com.sun.tools.javac.main.Option Java Examples
The following examples show how to use
com.sun.tools.javac.main.Option.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavacProcessingEnvironment.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Returns an empty processor iterator if no processors are on the * relevant path, otherwise if processors are present, logs an * error. Called when a service loader is unavailable for some * reason, either because a service loader class cannot be found * or because a security policy prevents class loaders from being * created. * * @param key The resource key to use to log an error message * @param e If non-null, pass this exception to Abort */ private Iterator<Processor> handleServiceLoaderUnavailability(String key, Exception e) { if (fileManager instanceof JavacFileManager) { StandardJavaFileManager standardFileManager = (JavacFileManager) fileManager; Iterable<? extends File> workingPath = fileManager.hasLocation(ANNOTATION_PROCESSOR_PATH) ? standardFileManager.getLocation(ANNOTATION_PROCESSOR_PATH) : standardFileManager.getLocation(CLASS_PATH); if (needClassLoader(options.get(Option.PROCESSOR), workingPath) ) handleException(key, e); } else { handleException(key, e); } java.util.List<Processor> pl = Collections.emptyList(); return pl.iterator(); }
Example #2
Source File: Locations.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
void initHandlers() { handlersForLocation = new HashMap<Location, LocationHandler>(); handlersForOption = new EnumMap<Option, LocationHandler>(Option.class); LocationHandler[] handlers = { new BootClassPathLocationHandler(), new ClassPathLocationHandler(), new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH), new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH), new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D), new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S), new OutputLocationHandler((StandardLocation.NATIVE_HEADER_OUTPUT), Option.H) }; for (LocationHandler h: handlers) { handlersForLocation.put(h.location, h); for (Option o: h.options) handlersForOption.put(o, h); } }
Example #3
Source File: Locations.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override boolean handleOption(Option option, String value) { if (!options.contains(option)) { return false; } if (value == null) { systemJavaHome = Locations.javaHome; } else if (value.equals("none")) { systemJavaHome = null; } else { update(getPath(value)); } modules = null; return true; }
Example #4
Source File: Locations.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Create a handler. The location and options provide a way to map * from a location or an option to the corresponding handler. * @see #initHandlers */ protected LocationHandler(Location location, Option... options) { this.location = location; this.options = options.length == 0 ? EnumSet.noneOf(Option.class): EnumSet.copyOf(Arrays.asList(options)); }
Example #5
Source File: BaseFileManager.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public int isSupportedOption(String option) { for (Option o : javacFileManagerOptions) { if (o.matches(option)) return o.hasArg() ? 1 : 0; } return -1; }
Example #6
Source File: JavacFiler.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
JavacFiler(Context context) { this.context = context; fileManager = context.get(JavaFileManager.class); elementUtils = JavacElements.instance(context); log = Log.instance(context); modules = Modules.instance(context); names = Names.instance(context); syms = Symtab.instance(context); initialInputs = synchronizedSet(new LinkedHashSet<>()); fileObjectHistory = synchronizedSet(new LinkedHashSet<>()); generatedSourceNames = synchronizedSet(new LinkedHashSet<>()); generatedSourceFileObjects = synchronizedSet(new LinkedHashSet<>()); generatedClasses = synchronizedMap(new LinkedHashMap<>()); openTypeNames = synchronizedSet(new LinkedHashSet<>()); aggregateGeneratedSourceNames = new LinkedHashSet<>(); aggregateGeneratedClassNames = new LinkedHashSet<>(); initialClassNames = new LinkedHashSet<>(); lint = (Lint.instance(context)).isEnabled(PROCESSING); Options options = Options.instance(context); defaultTargetModule = options.get(Option.DEFAULT_MODULE_FOR_CREATED_FILES); }
Example #7
Source File: Locations.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Create a handler. The location and options provide a way to map * from a location or an option to the corresponding handler. * @see #initHandlers */ protected LocationHandler(Location location, Option... options) { this.location = location; this.options = options.length == 0 ? EnumSet.noneOf(Option.class): EnumSet.copyOf(Arrays.asList(options)); }
Example #8
Source File: ClassFinder.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** Construct a new class finder. */ protected ClassFinder(Context context) { context.put(classFinderKey, this); reader = ClassReader.instance(context); names = Names.instance(context); syms = Symtab.instance(context); fileManager = context.get(JavaFileManager.class); dependencies = Dependencies.instance(context); if (fileManager == null) throw new AssertionError("FileManager initialization error"); diagFactory = JCDiagnostic.Factory.instance(context); log = Log.instance(context); annotate = Annotate.instance(context); Options options = Options.instance(context); verbose = options.isSet(Option.VERBOSE); cacheCompletionFailure = options.isUnset("dev"); preferSource = "source".equals(options.get("-Xprefer")); userPathsFirst = options.isSet(Option.XXUSERPATHSFIRST); allowSigFiles = context.get(PlatformDescription.class) != null; completionFailureName = options.isSet("failcomplete") ? names.fromString(options.get("failcomplete")) : null; profile = Profile.instance(context); }
Example #9
Source File: BaseFileManager.java From hottub with GNU General Public License v2.0 | 5 votes |
public String getEncodingName() { String encName = options.get(Option.ENCODING); if (encName == null) return getDefaultEncodingName(); else return encName; }
Example #10
Source File: Locations.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private Option canonicalize(Option option) { switch (option) { case XBOOTCLASSPATH: return Option.BOOTCLASSPATH; case DJAVA_ENDORSED_DIRS: return Option.ENDORSEDDIRS; case DJAVA_EXT_DIRS: return Option.EXTDIRS; default: return option; } }
Example #11
Source File: JavacTool.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public int isSupportedOption(String option) { Set<Option> recognizedOptions = Option.getJavacToolOptions(); for (Option o : recognizedOptions) { if (o.matches(option)) return o.hasArg() ? 1 : 0; } return -1; }
Example #12
Source File: Locations.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override boolean handleOption(Option option, String value) { if (!options.contains(option)) { return false; } moduleTable.clear(); // Allow an extended syntax for --patch-module consisting of a series // of values separated by NULL characters. This is to facilitate // supporting deferred file manager options on the command line. // See Option.PATCH_MODULE for the code that composes these multiple // values. for (String v : value.split("\0")) { int eq = v.indexOf('='); if (eq > 0) { String moduleName = v.substring(0, eq); SearchFile mPatchFile = new SearchFile() .addFiles(v.substring(eq + 1)); String name = location.getName() + "[" + moduleName + "]"; ModuleLocationHandler h = new ModuleLocationHandler(this, name, moduleName, mPatchFile, false); moduleTable.add(h); } else { // Should not be able to get here; // this should be caught and handled in Option.PATCH_MODULE log.error(Errors.LocnInvalidArgForXpatch(value)); } } return true; }
Example #13
Source File: Locations.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private Option canonicalize(Option option) { switch (option) { case XBOOTCLASSPATH: return Option.BOOTCLASSPATH; case DJAVA_ENDORSED_DIRS: return Option.ENDORSEDDIRS; case DJAVA_EXT_DIRS: return Option.EXTDIRS; default: return option; } }
Example #14
Source File: Locations.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override boolean handleOption(Option option, String value) { if (!options.contains(option)) return false; // TODO: could/should validate outputDir exists and is a directory // need to decide how best to report issue for benefit of // direct API call on JavaFileManager.handleOption(specifies IAE) // vs. command line decoding. outputDir = new File(value); return true; }
Example #15
Source File: Locations.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
void update(Options optionTable) { for (Option o: options) { String v = optionTable.get(o); if (v != null) { handleOption(o, v); } } }
Example #16
Source File: Locations.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void update(Options optionTable) { for (Option o: options) { String v = optionTable.get(o); if (v != null) { handleOption(o, v); } } }
Example #17
Source File: Locations.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void initHandlers() { handlersForLocation = new HashMap<>(); handlersForOption = new EnumMap<>(Option.class); BasicLocationHandler[] handlers = { new BootClassPathLocationHandler(), new ClassPathLocationHandler(), new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCE_PATH), new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSOR_PATH), new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_MODULE_PATH, Option.PROCESSOR_MODULE_PATH), new OutputLocationHandler(StandardLocation.CLASS_OUTPUT, Option.D), new OutputLocationHandler(StandardLocation.SOURCE_OUTPUT, Option.S), new OutputLocationHandler(StandardLocation.NATIVE_HEADER_OUTPUT, Option.H), new ModuleSourcePathLocationHandler(), new PatchModulesLocationHandler(), new ModulePathLocationHandler(StandardLocation.UPGRADE_MODULE_PATH, Option.UPGRADE_MODULE_PATH), new ModulePathLocationHandler(StandardLocation.MODULE_PATH, Option.MODULE_PATH), new SystemModulesLocationHandler(), }; for (BasicLocationHandler h : handlers) { handlersForLocation.put(h.location, h); for (Option o : h.options) { handlersForOption.put(o, h); } } }
Example #18
Source File: BaseFileManager.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public int isSupportedOption(String option) { for (Option o : javacFileManagerOptions) { if (o.matches(option)) return o.hasArg() ? 1 : 0; } return -1; }
Example #19
Source File: Locations.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override boolean handleOption(Option option, String value) { if (!options.contains(option)) return false; searchPath = value == null ? null : Collections.unmodifiableCollection(createPath().addFiles(value)); return true; }
Example #20
Source File: Locations.java From hottub with GNU General Public License v2.0 | 5 votes |
BootClassPathLocationHandler() { super(StandardLocation.PLATFORM_CLASS_PATH, Option.BOOTCLASSPATH, Option.XBOOTCLASSPATH, Option.XBOOTCLASSPATH_PREPEND, Option.XBOOTCLASSPATH_APPEND, Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS, Option.EXTDIRS, Option.DJAVA_EXT_DIRS); }
Example #21
Source File: BaseFileManager.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public String getEncodingName() { String encName = options.get(Option.ENCODING); if (encName == null) return getDefaultEncodingName(); else return encName; }
Example #22
Source File: JavacTool.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public int isSupportedOption(String option) { Set<Option> recognizedOptions = Option.getJavacToolOptions(); for (Option o : recognizedOptions) { if (o.matches(option)) return o.hasArg() ? 1 : 0; } return -1; }
Example #23
Source File: Log.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private int getIntOption(Options options, Option option, int defaultValue) { String s = options.get(option); try { if (s != null) { int n = Integer.parseInt(s); return (n <= 0 ? Integer.MAX_VALUE : n); } } catch (NumberFormatException e) { // silently ignore ill-formed numbers } return defaultValue; }
Example #24
Source File: Locations.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override boolean handleOption(Option option, String value) { if (!options.contains(option)) return false; // TODO: could/should validate outputDir exists and is a directory // need to decide how best to report issue for benefit of // direct API call on JavaFileManager.handleOption(specifies IAE) // vs. command line decoding. outputDir = new File(value); return true; }
Example #25
Source File: Locations.java From hottub with GNU General Public License v2.0 | 5 votes |
private Option canonicalize(Option option) { switch (option) { case XBOOTCLASSPATH: return Option.BOOTCLASSPATH; case DJAVA_ENDORSED_DIRS: return Option.ENDORSEDDIRS; case DJAVA_EXT_DIRS: return Option.EXTDIRS; default: return option; } }
Example #26
Source File: Locations.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override boolean handleOption(Option option, String value) { if (!options.contains(option)) return false; // TODO: could/should validate outputDir exists and is a directory // need to decide how best to report issue for benefit of // direct API call on JavaFileManager.handleOption(specifies IAE) // vs. command line decoding. outputDir = new File(value); return true; }
Example #27
Source File: Resolve.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected Resolve(Context context) { context.put(resolveKey, this); syms = Symtab.instance(context); varNotFound = new SymbolNotFoundError(ABSENT_VAR); methodNotFound = new SymbolNotFoundError(ABSENT_MTH); methodWithCorrectStaticnessNotFound = new SymbolNotFoundError(WRONG_STATICNESS, "method found has incorrect staticness"); typeNotFound = new SymbolNotFoundError(ABSENT_TYP); names = Names.instance(context); log = Log.instance(context); attr = Attr.instance(context); deferredAttr = DeferredAttr.instance(context); chk = Check.instance(context); infer = Infer.instance(context); reader = ClassReader.instance(context); treeinfo = TreeInfo.instance(context); types = Types.instance(context); diags = JCDiagnostic.Factory.instance(context); Source source = Source.instance(context); boxingEnabled = source.allowBoxing(); varargsEnabled = source.allowVarargs(); Options options = Options.instance(context); debugResolve = options.isSet("debugresolve"); compactMethodDiags = options.isSet(Option.XDIAGS, "compact") || options.isUnset(Option.XDIAGS) && options.isUnset("rawDiagnostics"); verboseResolutionMode = VerboseResolutionMode.getVerboseResolutionMode(options); Target target = Target.instance(context); allowMethodHandles = target.hasMethodHandles(); allowDefaultMethods = source.allowDefaultMethods(); allowStructuralMostSpecific = source.allowStructuralMostSpecific(); polymorphicSignatureScope = new Scope(syms.noSymbol); inapplicableMethodException = new InapplicableMethodException(diags); }
Example #28
Source File: Log.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private int getIntOption(Options options, Option option, int defaultValue) { String s = options.get(option); try { if (s != null) { int n = Integer.parseInt(s); return (n <= 0 ? Integer.MAX_VALUE : n); } } catch (NumberFormatException e) { // silently ignore ill-formed numbers } return defaultValue; }
Example #29
Source File: Locations.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Create a handler. The location and options provide a way to map * from a location or an option to the corresponding handler. * @see #initHandlers */ protected LocationHandler(Location location, Option... options) { this.location = location; this.options = options.length == 0 ? EnumSet.noneOf(Option.class): EnumSet.copyOf(Arrays.asList(options)); }
Example #30
Source File: JavacTool.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public int isSupportedOption(String option) { Set<Option> recognizedOptions = Option.getJavacToolOptions(); for (Option o : recognizedOptions) { if (o.matches(option)) return o.hasArg() ? 1 : 0; } return -1; }