public static ExecutionMode get() { return _mode == null ? (_mode = CommonServices.getPlatformHelper().getExecutionMode()) : _mode; } public static void clear() {
@Override public boolean isPathIgnored( String sourceFile ) { return CommonServices.getPlatformHelper().isPathIgnored( sourceFile ); } }
protected boolean shouldCacheTypeNames() { return CommonServices.getPlatformHelper().shouldCacheTypeNames(); } }
protected boolean shouldCacheTypeNames() { return CommonServices.getPlatformHelper().shouldCacheTypeNames(); } }
protected void deleteIndexFile() { File indexFile = CommonServices.getPlatformHelper().getIndexFile(getId()); try { indexFile.delete(); } catch (Exception e) { } return; }
protected void deleteIndexFile() { File indexFile = CommonServices.getPlatformHelper().getIndexFile(getId()); try { indexFile.delete(); } catch (Exception e) { } return; }
SingleServingGosuClassLoader( GosuClassLoader parent ) { super( parent.getActualLoader() ); _parent = parent; if( CommonServices.getPlatformHelper().isInIDE() ) { //## todo: uncomment //throw new IllegalStateException( "Class loading with single-serving loader is probably wrong in the IDE" ); } }
protected GosuParser getOrCreateParser(CompiledGosuClassSymbolTable symbolTable) { if( _parser != null ){ return _parser; } else { GosuParser parser = createParser(symbolTable); if (CommonServices.getPlatformHelper().isInIDE()) { _parser = parser; } return parser; } }
public void updateSource( String source ) { _sourceFingerprint = CommonServices.getPlatformHelper().getExecutionMode() == ExecutionMode.IDE ? new FP64(source).getRawFingerprint() // only really matters inside an IDE : source.length(); }
private static Iterable<? extends IFile> getSchemaLocationsFiles(IModule module) { if (CommonServices.getPlatformHelper().isInIDE()) { module = TypeSystem.getGlobalModule(); } Set<IFile> result = new LinkedHashSet<IFile>(); result.addAll(findAllFiles("config/xml/schemalocations.xml", module.getRoots())); // XML module itself now has this file inside "sources path" result.addAll(findAllFiles("xml/schemalocations.xml", module.getSourcePath())); return result; }
private static boolean shouldReplaceAnyway(IJavaClassInfo cls, JavaClassIRType javaClassIRType) { return !CommonServices.getPlatformHelper().isInIDE() && !equal(javaClassIRType.getJavaClassInfo().getBackingClass().getClassLoader(), cls.getBackingClass().getClassLoader()); }
@Override public final Set<String> getAllTypeNames() { if (_typeNames == null) { Set<String> names = shouldCacheTypeNames() ? loadTypeNames() : null; if (names != null) { _typeNames = names; } else { _typeNames = CommonServices.getPlatformHelper().isInIDE() ? new HashSet<String>( computeTypeNames() ) : new HashSet<String>( computeTypeNames() ); } } return _typeNames; }
public static IJavaClassInfo getClassInfo( AsmClass cls, IModule module ) { if( isProxy( cls ) ) { return getJavaClassInfo( cls, module ); } else { if( !CommonServices.getPlatformHelper().isInIDE() ) { // Don't try to load from source unless we have to, this saves a load of time esp. for case // where we're loading an inner java class where replacing the '$' below with '.' we bascially // put the type system through a load of unnecessary work. IJavaClassInfo classInfo = getJavaClassInfo( cls, module ); if( classInfo != null ) { return classInfo; } } return getClassInfo( cls.getName().replace( '$', '.' ), module ); } }
private void processDirectory(PackageToClassPathEntryTreeMap node, IFileSystemGosuClassRepository.ClassPathEntry entry, IDirectory path) { if (_excludedPath.contains(path)) { return; } IDirectory entryPath = entry.getPath(); if (entryPath.equals(path) || !CommonServices.getPlatformHelper().isPathIgnored(entryPath.relativePath(path))) { List<? extends IDirectory> dirs = path.listDirs(); for (IDirectory dir : dirs) { if (isValidDirectory(dir)) { PackageToClassPathEntryTreeMap child = node.createChildForDir(entry, dir.getName()); processDirectory(child, entry, dir); } } } }
private IJavaClassInfo getByClass( String className, IModule lookupModule, IModule actualModule ) { DefaultTypeLoader loader = (DefaultTypeLoader)lookupModule.getTypeLoaders( IDefaultTypeLoader.class ).get( 0 ); if( USE_ASM_LOADER && CommonServices.getPlatformHelper().isInIDE() ) { AsmClass theClass = loader.loadAsmClass( className ); if( theClass == null ) { return null; } return getJavaClassInfo( theClass, actualModule ); } else { Class theClass = loader.loadClass( className ); if( theClass == null ) { return null; } return getJavaClassInfo( theClass, actualModule ); } }
private void processDirectory(PackageToClassPathEntryTreeMap node, IFileSystemGosuClassRepository.ClassPathEntry entry, IDirectory path) { IDirectory entryPath = entry.getPath(); if (entryPath.equals(path) || !CommonServices.getPlatformHelper().isPathIgnored(entryPath.relativePath(path))) { List<? extends IDirectory> dirs = path.listDirs(); for (IDirectory dir : dirs) { if (isValidDirectory(dir)) { PackageToClassPathEntryTreeMap child = node.createChildForDir(entry, dir.getName()); processDirectory(child, entry, dir); } } } }
private static void allContainedFilesExcludingIgnored(IDirectory root, IDirectory dir, DynamicArray<IFile> files) { files.addAll(dir.listFiles()); for (IDirectory subDir : dir.listDirs()) { if (!CommonServices.getPlatformHelper().isPathIgnored(root.relativePath(subDir))) { allContainedFilesExcludingIgnored(root, subDir, files); } } }
private static void allContainedFilesExcludingIgnored(IDirectory root, IDirectory dir, DynamicArray<IFile> files) { files.addAll(dir.listFiles()); for (IDirectory subDir : dir.listDirs()) { if (!CommonServices.getPlatformHelper().isPathIgnored(root.relativePath(subDir))) { allContainedFilesExcludingIgnored(root, subDir, files); } } }
private static void addAllLocalResourceFilesByExtensionInternal(String relativePath, IDirectory dir, String extension, List<Pair<String, IFile>> results) { if (!CommonServices.getPlatformHelper().isPathIgnored(relativePath)) { for (IFile file : dir.listFiles()) { if (file.getName().endsWith(extension)) { String path = appendResourceNameToPath(relativePath, file.getName()); results.add(new Pair<String, IFile>(path, file)); } } for (IDirectory subdir : dir.listDirs()) { String path = appendResourceNameToPath(relativePath, subdir.getName()); addAllLocalResourceFilesByExtensionInternal(path, subdir, extension, results); } } }
private GosuParser makeParserForPhase() { createNewParseInfo(); CompiledGosuClassSymbolTable symbolTable = CompiledGosuClassSymbolTable.instance(); GosuParser parser = getOrCreateParser(symbolTable); ISource source = _sourceFileHandle.getSource(); parser.setScript(source); _parseInfo.updateSource(source.getSource()); if (CommonServices.getPlatformHelper().isInIDE()) { parser.setThrowParseExceptionForWarnings(true); parser.setDontOptimizeStatementLists(true); parser.setWarnOnCaseIssue(true); parser.setEditorParser(true); } assignTypeUsesMap( parser ); return parser; }