@Override public boolean hasAncestorBeenUpdated() { if( !ExecutionMode.get().isRefreshSupportEnabled() ) { return false; } return haveAncestorsBeenUpdated(this, _tiChecksum, new HashSet<IType>()); }
ExecutionMode( boolean bSupportsRefresh ) { _bSupportsRefresh = checkCommandLineOverride( bSupportsRefresh ); }
protected AbstractPlatformHelper() { ExecutionMode.clear(); }
public void uninitializeMultipleModules( IExecutionEnvironment execEnv ) { if (ExecutionMode.isRuntime()) { throw new IllegalStateException( "The typesystem is not in multi-module mode." ); } ((ExecutionEnvironment)execEnv).uninitializeMultipleModules(); } }
protected GosuParser getOrCreateParser(CompiledGosuClassSymbolTable symbolTable) { if( _parser != null ){ return _parser; } else { GosuParser parser = createParser(symbolTable); if (ExecutionMode.isIDE()) { _parser = parser; } return parser; } }
protected ClassPath init() { return new ClassPath( _module, ExecutionMode.isRuntime() ? IClassPath.ONLY_API_CLASSES : // FIXME-isd: for performance reasons, only select API classes IClassPath.ALLOW_ALL_WITH_SUN_FILTER); } };
public IJavaClassInfo getJavaClassInfo( Class aClass, IModule gosuModule ) { if( ExecutionMode.isIDE() && _module != TypeSystem.getJreModule() && _module.equals( TypeSystem.getGlobalModule() ) ) { return null; } String fullyQualifiedName = aClass.getName().replace('$', '.'); IJavaClassInfo result = _classInfoCache.get( fullyQualifiedName ); if( result == null ) { result = new ClassJavaClassInfo( aClass, gosuModule ); _classInfoCache.put( fullyQualifiedName, result ); } return result == IJavaClassInfo.NULL_TYPE ? null : result; }
public static IJavaType pLONG() { if( !ExecutionMode.get().isRefreshSupportEnabled() ) { return THIS.pLONG == null ? THIS.pLONG = getJreType( long.class ) : THIS.pLONG; } return getJreType( long.class ); }
public ClassCache(final IModule module) { _module = module; ignoreTheCache = ExecutionMode.isRuntime(); _classPathCache = new LockingLazyVar<ClassPath>() { protected ClassPath init() { return new ClassPath( _module, ExecutionMode.isRuntime() ? IClassPath.ONLY_API_CLASSES : // FIXME-isd: for performance reasons, only select API classes IClassPath.ALLOW_ALL_WITH_SUN_FILTER); } }; _asmClassLoader = new AsmClassLoader(_module); }
public IJavaClassInfo getJavaClassInfo( AsmClass aClass, IModule gosuModule ) { if (ExecutionMode.isIDE() && _module != TypeSystem.getJreModule() && _module.equals( TypeSystem.getGlobalModule() )) { return null; } else { String fullyQualifiedName = aClass.getName().replace('$', '.'); IJavaClassInfo result = _classInfoCache.get( fullyQualifiedName ); if( result == null ) { result = new AsmClassJavaClassInfo( aClass, gosuModule ); _classInfoCache.put( fullyQualifiedName, result ); } return result == IJavaClassInfo.NULL_TYPE ? null : result; } }
public static IType RUNNABLE() { if( !ExecutionMode.get().isRefreshSupportEnabled() ) { return THIS.RUNNABLE == null ? THIS.RUNNABLE = getJreType( Runnable.class ) : THIS.RUNNABLE; } return getJreType( Runnable.class ); }
private static boolean shouldReplaceAnyway(IJavaClassInfo cls, JavaClassIRType javaClassIRType) { if( ILanguageLevel.Util.STANDARD_GOSU() ) { return false; } // Barf... return ExecutionMode.isRuntime() && !equal(javaClassIRType.getJavaClassInfo().getBackingClass().getClassLoader(), cls.getBackingClass().getClassLoader()); }
public IModule getModule(String strModuleName) { for (IModule m : _modules) { if (m.getName().equals(strModuleName)) { return m; } } if( !ExecutionMode.isIDE() && GLOBAL_MODULE_NAME.equals( strModuleName ) || TypeSystem.getJreModule() == TypeSystem.getGlobalModule() ) { return getGlobalModule(); } return null; }
public static IType THROWS() { if( !ExecutionMode.get().isRefreshSupportEnabled() ) { return THIS.THROWS == null ? THIS.THROWS = getSystemType( Throws.class ) : THIS.THROWS; } return getSystemType( Throws.class ); }
public static ClassLoader create(IModule module) { List<IDirectory> javaClassPath = module.getJavaClassPath(); List<URL> urls = new ArrayList<URL>(javaClassPath.size()); for (IDirectory entry : javaClassPath) { try { urls.add(entry.toURI().toURL()); } catch (MalformedURLException e) { throw new RuntimeException(e); } } IExecutionEnvironment environment = module.getExecutionEnvironment(); if (ExecutionMode.isRuntime()) { // XXX-isd: we need discardable classloader for JRE module, so we can use it for defining throw-away proxy classes. urls = Collections.emptyList(); //return CommonServices.getEntityAccess().getPluginClassLoader(); } // JRE module delegates to plugin classloader, all other modules delegate to JRE module first. ClassLoader parent = (module == environment.getJreModule()) ? CommonServices.getEntityAccess().getPluginClassLoader() : null; //environment.getJreModule().getModuleClassLoader(); return new ModuleClassLoader(urls.toArray(new URL[urls.size()]), parent, module); }
/** * @return The module responsible for resolving JRE core classes e.g., * java.lang.* etc. Note in default single module environment this is * the single module, otherwise this is the module create by calling createJreModule(). * This method will never return null but it will throw an NPE if the JRE module is null. */ public IModule getJreModule() { if (_jreModule == null) { if (!ExecutionMode.isIDE() || TypeSystem.getJreModule() == TypeSystem.getGlobalModule()) { _jreModule = getGlobalModule(); } else { throw new RuntimeException("The JRE module was not created. Please create it before trying to get it."); } } return _jreModule; }
public static IJavaType BYTE() { if( !ExecutionMode.get().isRefreshSupportEnabled() ) { return THIS.BYTE == null ? THIS.BYTE = getJreType( Byte.class ) : THIS.BYTE; } return getJreType(Byte.class); }
/** * Wraps the actual class with a proxy. */ @Override public ITypeRef create( IType type ) { // already a proxy? return as is then if( type instanceof ITypeRef ) { return (ITypeRef)type; } if( type instanceof INonLoadableType ) { throw new UnsupportedOperationException( "Type references are not supported for nonloadable types: " + type.getName() ); } String strTypeName = TypeLord.getNameWithQualifiedTypeVariables( type, true ); if( strTypeName == null || strTypeName.length() == 0 ) { throw new IllegalStateException( "Type has no name" ); } ITypeRef ref; if (ExecutionMode.isRuntime()) { ref = getRefTheFastWay(type, strTypeName); } else { ref = getRefTheSafeWay(type, strTypeName); } return ref; }
public Module getCurrentModule() { if( !ExecutionMode.isIDE() ) { return (Module)TypeSystem.getGlobalModule(); } ArrayList list = (ArrayList)g_moduleStack.get(); if( list != null && !list.isEmpty() ) { return (Module)list.get(list.size() - 1); } if( ExecutionEnvironment.getAll().size() == 1 ) { if( TypeSystem.getGlobalModule() instanceof DefaultSingleModule ) { // For single module IDE return (Module)TypeSystem.getGlobalModule(); } } return null; //throw new RuntimeException("Current module should never be null"); }
public static IJavaType STRING_BUFFER() { if( !ExecutionMode.get().isRefreshSupportEnabled() ) { return THIS.STRING_BUFFER == null ? THIS.STRING_BUFFER = getJreType( StringBuffer.class ) : THIS.STRING_BUFFER; } return getJreType(StringBuffer.class); }