public EclipseFileManager(Locale locale, Charset charset) { this.locale = locale == null ? Locale.getDefault() : locale; this.charset = charset == null ? Charset.defaultCharset() : charset; this.locations = new HashMap<String, Iterable<? extends File>>(); this.archivesCache = new HashMap<File, Archive>(); try { this.setLocation(StandardLocation.PLATFORM_CLASS_PATH, getDefaultBootclasspath()); Iterable<? extends File> defaultClasspath = getDefaultClasspath(); this.setLocation(StandardLocation.CLASS_PATH, defaultClasspath); this.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, defaultClasspath); } catch (IOException e) { // ignore } try { this.bundle = ResourceBundleFactory.getBundle(this.locale); } catch(MissingResourceException e) { System.out.println("Missing resource : " + Main.bundleName.replace('.', '/') + ".properties for locale " + locale); //$NON-NLS-1$//$NON-NLS-2$ } }
@Override public void setLocationFromPaths(Location location, Collection<? extends Path> paths) throws IOException { setLocation(location, getFiles(paths)); if (location == StandardLocation.MODULE_PATH) { // FIXME: same for module source path? Map<String, String> options = new HashMap<>(); // FIXME: Find a way to get the options from the EclipseCompiler and pass it to the parser. // FIXME: need to be the latest and not hardcoded value options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_9); options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_9); options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_9); CompilerOptions compilerOptions = new CompilerOptions(options); ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, new DefaultProblemFactory()); for (Path path : paths) { List<Classpath> mp = ModuleFinder.findModules(path.toFile(), null, new Parser(problemReporter, true), null, true, this.releaseVersion); for (Classpath cp : mp) { Collection<String> moduleNames = cp.getModuleNames(null); for (String string : moduleNames) { Path p = Paths.get(cp.getPath()); setLocationForModule(StandardLocation.MODULE_PATH, string, Collections.singletonList(p)); } } } } }
public EclipseFileManager(Locale locale, Charset charset) { this.locale = locale == null ? Locale.getDefault() : locale; this.charset = charset == null ? Charset.defaultCharset() : charset; this.locations = new HashMap<String, Iterable<? extends File>>(); this.archivesCache = new HashMap<File, Archive>(); try { this.setLocation(StandardLocation.PLATFORM_CLASS_PATH, getDefaultBootclasspath()); Iterable<? extends File> defaultClasspath = getDefaultClasspath(); this.setLocation(StandardLocation.CLASS_PATH, defaultClasspath); this.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, defaultClasspath); } catch (IOException e) { // ignore } try { this.bundle = ResourceBundleFactory.getBundle(this.locale); } catch(MissingResourceException e) { System.out.println("Missing resource : " + Main.bundleName.replace('.', '/') + ".properties for locale " + locale); //$NON-NLS-1$//$NON-NLS-2$ } }
public EclipseFileManager(Locale locale, Charset charset) { this.locale = locale == null ? Locale.getDefault() : locale; this.charset = charset == null ? Charset.defaultCharset() : charset; this.locations = new HashMap<>(); this.archivesCache = new HashMap<>(); try { this.setLocation(StandardLocation.PLATFORM_CLASS_PATH, getDefaultBootclasspath()); Iterable<? extends File> defaultClasspath = getDefaultClasspath(); this.setLocation(StandardLocation.CLASS_PATH, defaultClasspath); this.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, defaultClasspath); } catch (IOException e) { // ignore } try { this.bundle = ResourceBundleFactory.getBundle(this.locale); } catch(MissingResourceException e) { System.out.println("Missing resource : " + Main.bundleName.replace('.', '/') + ".properties for locale " + locale); //$NON-NLS-1$//$NON-NLS-2$ } }
public EclipseFileManager(Locale locale, Charset charset) { this.locale = locale == null ? Locale.getDefault() : locale; this.charset = charset == null ? Charset.defaultCharset() : charset; this.locations = new HashMap<String, Iterable<? extends File>>(); this.archivesCache = new HashMap<File, Archive>(); try { this.setLocation(StandardLocation.PLATFORM_CLASS_PATH, getDefaultBootclasspath()); Iterable<? extends File> defaultClasspath = getDefaultClasspath(); this.setLocation(StandardLocation.CLASS_PATH, defaultClasspath); this.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, defaultClasspath); } catch (IOException e) { // ignore } try { this.bundle = ResourceBundleFactory.getBundle(this.locale); } catch(MissingResourceException e) { System.out.println("Missing resource : " + Main.bundleName.replace('.', '/') + ".properties for locale " + locale); //$NON-NLS-1$//$NON-NLS-2$ } }
public EclipseFileManager(Locale locale, Charset charset) { this.locale = locale == null ? Locale.getDefault() : locale; this.charset = charset == null ? Charset.defaultCharset() : charset; this.locations = new HashMap<>(); this.archivesCache = new HashMap<>(); try { this.setLocation(StandardLocation.PLATFORM_CLASS_PATH, getDefaultBootclasspath()); Iterable<? extends File> defaultClasspath = getDefaultClasspath(); this.setLocation(StandardLocation.CLASS_PATH, defaultClasspath); this.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, defaultClasspath); } catch (IOException e) { // ignore } try { this.bundle = ResourceBundleFactory.getBundle(this.locale); } catch(MissingResourceException e) { System.out.println("Missing resource : " + Main.bundleName.replace('.', '/') + ".properties for locale " + locale); //$NON-NLS-1$//$NON-NLS-2$ } }
protected void initialize(File javahome) throws IOException { if (this.isOnJvm9) { this.jrtSystem = new JrtFileSystem(javahome); this.archivesCache.put(javahome, this.jrtSystem); this.jrtHome = javahome; this.locationHandler.newSystemLocation(StandardLocation.SYSTEM_MODULES, this.jrtSystem); } else { this.setLocation(StandardLocation.PLATFORM_CLASS_PATH, getDefaultBootclasspath()); } Iterable<? extends File> defaultClasspath = getDefaultClasspath(); this.setLocation(StandardLocation.CLASS_PATH, defaultClasspath); // No annotation module path by default this.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, defaultClasspath); }
setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootclasspaths); } else if ((this.flags & EclipseFileManager.HAS_ENDORSED_DIRS) != 0) { setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, bootclasspaths)); } else { setLocation(StandardLocation.PLATFORM_CLASS_PATH, prependFiles(iterable, bootclasspaths)); Iterable<? extends File> iterable = getLocation(StandardLocation.CLASS_PATH); if (iterable != null) { setLocation(StandardLocation.CLASS_PATH, concatFiles(iterable, classpaths)); } else { setLocation(StandardLocation.CLASS_PATH, classpaths); setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, classpaths); if (remaining.hasNext()) { final Iterable<? extends File> sourcepaths = getPathsFrom(remaining.next()); if (sourcepaths != null) setLocation(StandardLocation.SOURCE_PATH, sourcepaths); return true; } else { if (remaining.hasNext()) { Iterable<? extends File> iterable = getLocation(StandardLocation.PLATFORM_CLASS_PATH); setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, getExtdirsFrom(remaining.next())));
setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootclasspaths); } else if ((this.flags & EclipseFileManager.HAS_ENDORSED_DIRS) != 0) { setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, bootclasspaths)); } else { setLocation(StandardLocation.PLATFORM_CLASS_PATH, prependFiles(iterable, bootclasspaths)); Iterable<? extends File> iterable = getLocation(StandardLocation.CLASS_PATH); if (iterable != null) { setLocation(StandardLocation.CLASS_PATH, concatFiles(iterable, classpaths)); } else { setLocation(StandardLocation.CLASS_PATH, classpaths); setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, classpaths); if (remaining.hasNext()) { final Iterable<? extends File> sourcepaths = getPathsFrom(remaining.next()); if (sourcepaths != null) setLocation(StandardLocation.SOURCE_PATH, sourcepaths); return true; } else { if (remaining.hasNext()) { Iterable<? extends File> iterable = getLocation(StandardLocation.PLATFORM_CLASS_PATH); setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, getExtdirsFrom(remaining.next())));
setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootclasspaths); } else if ((this.flags & HAS_ENDORSED_DIRS) != 0) { setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, bootclasspaths)); } else { setLocation(StandardLocation.PLATFORM_CLASS_PATH, prependFiles(iterable, bootclasspaths)); Iterable<? extends File> iterable = getLocation(StandardLocation.CLASS_PATH); if (iterable != null) { setLocation(StandardLocation.CLASS_PATH, concatFiles(iterable, classpaths)); } else { setLocation(StandardLocation.CLASS_PATH, classpaths); setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, classpaths); if (sourcepaths != null) setLocation(StandardLocation.SOURCE_PATH, sourcepaths); remaining.remove(); return true; setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, getExtdirsFrom(remaining.next()))); remaining.remove(); setLocation(StandardLocation.PLATFORM_CLASS_PATH, prependFiles(iterable, getEndorsedDirsFrom(remaining.next())));
setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootclasspaths); } else if ((this.flags & HAS_ENDORSED_DIRS) != 0) { setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, bootclasspaths)); } else { setLocation(StandardLocation.PLATFORM_CLASS_PATH, prependFiles(iterable, bootclasspaths)); Iterable<? extends File> iterable = getLocation(StandardLocation.CLASS_PATH); if (iterable != null) { setLocation(StandardLocation.CLASS_PATH, concatFiles(iterable, classpaths)); } else { setLocation(StandardLocation.CLASS_PATH, classpaths); setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, classpaths); if (sourcepaths != null) setLocation(StandardLocation.SOURCE_PATH, sourcepaths); remaining.remove(); return true; setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, getExtdirsFrom(remaining.next()))); remaining.remove(); setLocation(StandardLocation.PLATFORM_CLASS_PATH, prependFiles(iterable, getEndorsedDirsFrom(remaining.next())));
setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootclasspaths); } else if ((this.flags & HAS_ENDORSED_DIRS) != 0) { setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, bootclasspaths)); } else { setLocation(StandardLocation.PLATFORM_CLASS_PATH, prependFiles(iterable, bootclasspaths)); Iterable<? extends File> iterable = getLocation(StandardLocation.CLASS_PATH); if (iterable != null) { setLocation(StandardLocation.CLASS_PATH, concatFiles(iterable, classpaths)); } else { setLocation(StandardLocation.CLASS_PATH, classpaths); setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, classpaths); if (sourcepaths != null) setLocation(StandardLocation.SOURCE_PATH, sourcepaths); remaining.remove(); return true; setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, getExtdirsFrom(remaining.next()))); remaining.remove(); setLocation(StandardLocation.PLATFORM_CLASS_PATH, prependFiles(iterable, getEndorsedDirsFrom(remaining.next())));
setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootclasspaths); } else if ((this.flags & EclipseFileManager.HAS_ENDORSED_DIRS) != 0) { setLocation(StandardLocation.PLATFORM_CLASS_PATH, concatFiles(iterable, bootclasspaths)); } else { setLocation(StandardLocation.PLATFORM_CLASS_PATH, prependFiles(iterable, bootclasspaths)); Iterable<? extends File> iterable = getLocation(StandardLocation.SYSTEM_MODULES); if (iterable != null) { setLocation(StandardLocation.SYSTEM_MODULES, concatFiles(iterable, classpaths)); } else { setLocation(StandardLocation.SYSTEM_MODULES, classpaths); Iterable<? extends File> iterable = getLocation(StandardLocation.UPGRADE_MODULE_PATH); if (iterable != null) { setLocation(StandardLocation.UPGRADE_MODULE_PATH, concatFiles(iterable, classpaths)); } else { setLocation(StandardLocation.UPGRADE_MODULE_PATH, classpaths); Iterable<? extends File> iterable = getLocation(StandardLocation.CLASS_PATH); if (iterable != null) { setLocation(StandardLocation.CLASS_PATH, concatFiles(iterable, classpaths)); } else {
if (!isProcNone()) { fileManager = new EclipseFileManager(null, getSourceEncoding()); fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, processorpath); fileManager.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(getOutputDirectory())); fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, Collections.singleton(getGeneratedSourcesDirectory()));
if (!isProcNone()) { fileManager = new EclipseFileManager(null, getSourceEncoding()); fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, processorpath); fileManager.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(getOutputDirectory())); fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, Collections.singleton(getGeneratedSourcesDirectory()));