Java Code Examples for com.sun.tools.javac.util.Options#instance()
The following examples show how to use
com.sun.tools.javac.util.Options#instance() .
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 TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private Map<String, String> initProcessorOptions(Context context) { Options options = Options.instance(context); Set<String> keySet = options.keySet(); Map<String, String> tempOptions = new LinkedHashMap<String, String>(); for(String key : keySet) { if (key.startsWith("-A") && key.length() > 2) { int sepIndex = key.indexOf('='); String candidateKey = null; String candidateValue = null; if (sepIndex == -1) candidateKey = key.substring(2); else if (sepIndex >= 3) { candidateKey = key.substring(2, sepIndex); candidateValue = (sepIndex < key.length()-1)? key.substring(sepIndex+1) : null; } tempOptions.put(candidateKey, candidateValue); } } return Collections.unmodifiableMap(tempOptions); }
Example 2
Source File: JavacProcessingEnvironment.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private Map<String, String> initProcessorOptions(Context context) { Options options = Options.instance(context); Set<String> keySet = options.keySet(); Map<String, String> tempOptions = new LinkedHashMap<String, String>(); for(String key : keySet) { if (key.startsWith("-A") && key.length() > 2) { int sepIndex = key.indexOf('='); String candidateKey = null; String candidateValue = null; if (sepIndex == -1) candidateKey = key.substring(2); else if (sepIndex >= 3) { candidateKey = key.substring(2, sepIndex); candidateValue = (sepIndex < key.length()-1)? key.substring(sepIndex+1) : null; } tempOptions.put(candidateKey, candidateValue); } } return Collections.unmodifiableMap(tempOptions); }
Example 3
Source File: TestInferBinaryName.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
JavaFileManager getFileManager(String classpathProperty, boolean symFileKind, boolean zipFileIndexKind) throws IOException { Context ctx = new Context(); Options options = Options.instance(ctx); options.put("useOptimizedZip", Boolean.toString(zipFileIndexKind == USE_ZIP_FILE_INDEX)); if (symFileKind == IGNORE_SYMBOL_FILE) options.put("ignore.symbol.file", "true"); JavacFileManager fm = new JavacFileManager(ctx, false, null); List<File> path = getPath(System.getProperty(classpathProperty)); fm.setLocation(CLASS_PATH, path); return fm; }
Example 4
Source File: LambdaToMethod.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 6 votes |
private LambdaToMethod(Context context) { context.put(unlambdaKey, this); diags = JCDiagnostic.Factory.instance(context); log = Log.instance(context); lower = Lower.instance(context); names = Names.instance(context); syms = Symtab.instance(context); rs = Resolve.instance(context); operators = Operators.instance(context); make = TreeMaker.instance(context); types = Types.instance(context); transTypes = TransTypes.instance(context); analyzer = new LambdaAnalyzerPreprocessor(); Options options = Options.instance(context); dumpLambdaToMethodStats = options.isSet("debug.dumpLambdaToMethodStats"); attr = Attr.instance(context); forceSerializable = options.isSet("forceSerializable"); }
Example 5
Source File: Modules.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected Modules(Context context) { context.put(Modules.class, this); log = Log.instance(context); names = Names.instance(context); syms = Symtab.instance(context); attr = Attr.instance(context); chk = Check.instance(context); deferredLintHandler = DeferredLintHandler.instance(context); typeEnvs = TypeEnvs.instance(context); moduleFinder = ModuleFinder.instance(context); types = Types.instance(context); fileManager = context.get(JavaFileManager.class); source = Source.instance(context); allowModules = source.allowModules(); Options options = Options.instance(context); allowAccessIntoSystem = options.isUnset(Option.RELEASE); lintOptions = options.isUnset(Option.XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option); multiModuleMode = fileManager.hasLocation(StandardLocation.MODULE_SOURCE_PATH); ClassWriter classWriter = ClassWriter.instance(context); classWriter.multiModuleMode = multiModuleMode; JNIWriter jniWriter = JNIWriter.instance(context); jniWriter.multiModuleMode = multiModuleMode; java_se = names.fromString("java.se"); java_ = names.fromString("java."); addExportsOpt = options.get(Option.ADD_EXPORTS); addReadsOpt = options.get(Option.ADD_READS); addModsOpt = options.get(Option.ADD_MODULES); limitModsOpt = options.get(Option.LIMIT_MODULES); moduleVersionOpt = options.get(Option.MODULE_VERSION); }
Example 6
Source File: TypeAnnotations.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected TypeAnnotations(Context context) { context.put(typeAnnosKey, this); names = Names.instance(context); log = Log.instance(context); syms = Symtab.instance(context); annotate = Annotate.instance(context); attr = Attr.instance(context); Options options = Options.instance(context); }
Example 7
Source File: T6877206.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
JavacFileManager createFileManager(boolean useOptimizedZip, boolean useSymbolFile) { Context ctx = new Context(); Options options = Options.instance(ctx); options.put("useOptimizedZip", Boolean.toString(useOptimizedZip)); if (!useSymbolFile) { options.put("ignore.symbol.file", "true"); } return new JavacFileManager(ctx, false, null); }
Example 8
Source File: Lower.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected Lower(Context context) { context.put(lowerKey, this); names = Names.instance(context); log = Log.instance(context); syms = Symtab.instance(context); rs = Resolve.instance(context); operators = Operators.instance(context); chk = Check.instance(context); attr = Attr.instance(context); make = TreeMaker.instance(context); writer = ClassWriter.instance(context); cfolder = ConstFold.instance(context); target = Target.instance(context); source = Source.instance(context); typeEnvs = TypeEnvs.instance(context); dollarAssertionsDisabled = names. fromString(target.syntheticNameChar() + "assertionsDisabled"); classDollar = names. fromString("class" + target.syntheticNameChar()); dollarCloseResource = names. fromString(target.syntheticNameChar() + "closeResource"); types = Types.instance(context); Options options = Options.instance(context); debugLower = options.isSet("debuglower"); pkginfoOpt = PkgInfo.get(options); }
Example 9
Source File: Test.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
JavacFileManager createFileManager(boolean useOptimizedZip, boolean useSymbolFile) { Context c = new Context(); Options options = Options.instance(c); options.put("useOptimizedZip", Boolean.toString(useOptimizedZip)); if (!useSymbolFile) { options.put("ignore.symbol.file", "true"); } return new JavacFileManager(c, false, null); }
Example 10
Source File: Enter.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected Enter(Context context) { context.put(enterKey, this); log = Log.instance(context); make = TreeMaker.instance(context); syms = Symtab.instance(context); chk = Check.instance(context); typeEnter = TypeEnter.instance(context); types = Types.instance(context); annotate = Annotate.instance(context); lint = Lint.instance(context); names = Names.instance(context); modules = Modules.instance(context); diags = JCDiagnostic.Factory.instance(context); predefClassDef = make.ClassDef( make.Modifiers(PUBLIC), syms.predefClass.name, List.nil(), null, List.nil(), List.nil()); predefClassDef.sym = syms.predefClass; todo = Todo.instance(context); fileManager = context.get(JavaFileManager.class); Options options = Options.instance(context); pkginfoOpt = PkgInfo.get(options); typeEnvs = TypeEnvs.instance(context); }
Example 11
Source File: JNIWriter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** Construct a class writer, given an options table. */ private JNIWriter(Context context) { context.put(jniWriterKey, this); fileManager = context.get(JavaFileManager.class); log = Log.instance(context); Options options = Options.instance(context); verbose = options.isSet(VERBOSE); checkAll = options.isSet("javah:full"); this.context = context; // for lazyInit() syms = Symtab.instance(context); lineSep = System.getProperty("line.separator"); }
Example 12
Source File: Arguments.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected Arguments(Context context) { context.put(argsKey, this); options = Options.instance(context); log = Log.instance(context); this.context = context; // Ideally, we could init this here and update/configure it as // needed, but right now, initializing a file manager triggers // initialization of other items in the context, such as Lint // and FSInfo, which should not be initialized until after // processArgs // fileManager = context.get(JavaFileManager.class); }
Example 13
Source File: JavacProcessingEnvironment.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
public JavacProcessingEnvironment(Context context, Iterable<? extends Processor> processors) { this.context = context; log = Log.instance(context); source = Source.instance(context); diags = JCDiagnostic.Factory.instance(context); options = Options.instance(context); printProcessorInfo = options.isSet(XPRINTPROCESSORINFO); printRounds = options.isSet(XPRINTROUNDS); verbose = options.isSet(VERBOSE); lint = Lint.instance(context).isEnabled(PROCESSING); procOnly = options.isSet(PROC, "only") || options.isSet(XPRINT); fatalErrors = options.isSet("fatalEnterError"); showResolveErrors = options.isSet("showResolveErrors"); werror = options.isSet(WERROR); platformAnnotations = initPlatformAnnotations(); foundTypeProcessors = false; // Initialize services before any processors are initialized // in case processors use them. filer = new JavacFiler(context); messager = new JavacMessager(context, this); elementUtils = JavacElements.instance(context); typeUtils = JavacTypes.instance(context); processorOptions = initProcessorOptions(context); unmatchedProcessorOptions = initUnmatchedProcessorOptions(); messages = JavacMessages.instance(context); initProcessorIterator(context, processors); }
Example 14
Source File: T6877206.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
JavacFileManager createFileManager(boolean useOptimizedZip, boolean useSymbolFile) { Context ctx = new Context(); Options options = Options.instance(ctx); options.put("useOptimizedZip", Boolean.toString(useOptimizedZip)); if (!useSymbolFile) { options.put("ignore.symbol.file", "true"); } return new JavacFileManager(ctx, false, null); }
Example 15
Source File: Javac8BasedLombokOptions.java From EasyMPermission with MIT License | 5 votes |
public static Javac8BasedLombokOptions replaceWithDelombokOptions(Context context) { Options options = Options.instance(context); context.put(optionsKey, (Options)null); Javac8BasedLombokOptions result = new Javac8BasedLombokOptions(context); result.putAll(options); return result; }
Example 16
Source File: Lint.java From hottub with GNU General Public License v2.0 | 5 votes |
protected Lint(Context context) { // initialize values according to the lint options Options options = Options.instance(context); values = EnumSet.noneOf(LintCategory.class); for (Map.Entry<String, LintCategory> e: map.entrySet()) { if (options.lint(e.getKey())) values.add(e.getValue()); } suppressedValues = EnumSet.noneOf(LintCategory.class); context.put(lintKey, this); augmentor = new AugmentVisitor(context); }
Example 17
Source File: JavaCompiler.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
/** * Construct a new compiler using a shared context. */ public JavaCompiler(Context context) { this.context = context; context.put(compilerKey, this); // if fileManager not already set, register the JavacFileManager to be used if (context.get(JavaFileManager.class) == null) JavacFileManager.preRegister(context); names = Names.instance(context); log = Log.instance(context); diagFactory = JCDiagnostic.Factory.instance(context); reader = ClassReader.instance(context); make = TreeMaker.instance(context); writer = ClassWriter.instance(context); enter = Enter.instance(context); todo = Todo.instance(context); fileManager = context.get(JavaFileManager.class); parserFactory = ParserFactory.instance(context); try { // catch completion problems with predefineds syms = Symtab.instance(context); } catch (CompletionFailure ex) { // inlined Check.completionError as it is not initialized yet log.error("cant.access", ex.sym, ex.getDetailValue()); if (ex instanceof ClassReader.BadClassFile) throw new Abort(); } source = Source.instance(context); attr = Attr.instance(context); chk = Check.instance(context); gen = Gen.instance(context); flow = Flow.instance(context); transTypes = TransTypes.instance(context); lower = Lower.instance(context); annotate = Annotate.instance(context); types = Types.instance(context); taskListener = context.get(TaskListener.class); reader.sourceCompleter = this; options = Options.instance(context); verbose = options.isSet(VERBOSE); sourceOutput = options.isSet(PRINTSOURCE); // used to be -s stubOutput = options.isSet("-stubs"); relax = options.isSet("-relax"); printFlat = options.isSet("-printflat"); attrParseOnly = options.isSet("-attrparseonly"); encoding = options.get(ENCODING); lineDebugInfo = options.isUnset(G_CUSTOM) || options.isSet(G_CUSTOM, "lines"); genEndPos = options.isSet(XJCOV) || context.get(DiagnosticListener.class) != null; devVerbose = options.isSet("dev"); processPcks = options.isSet("process.packages"); werror = options.isSet(WERROR); if (source.compareTo(Source.DEFAULT) < 0) { if (options.isUnset(XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option)) { if (fileManager instanceof BaseFileManager) { if (((BaseFileManager) fileManager).isDefaultBootClassPath()) log.warning(LintCategory.OPTIONS, "source.no.bootclasspath", source.name); } } } verboseCompilePolicy = options.isSet("verboseCompilePolicy"); if (attrParseOnly) compilePolicy = CompilePolicy.ATTR_ONLY; else compilePolicy = CompilePolicy.decode(options.get("compilePolicy")); implicitSourcePolicy = ImplicitSourcePolicy.decode(options.get("-implicit")); completionFailureName = options.isSet("failcomplete") ? names.fromString(options.get("failcomplete")) : null; shouldStopPolicy = options.isSet("shouldStopPolicy") ? CompileState.valueOf(options.get("shouldStopPolicy")) : null; if (options.isUnset("oldDiags")) log.setDiagnosticFormatter(RichDiagnosticFormatter.instance(context)); }
Example 18
Source File: JavacProcessingEnvironment.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 4 votes |
protected JavacProcessingEnvironment(Context context) { this.context = context; context.put(JavacProcessingEnvironment.class, this); log = Log.instance(context); source = Source.instance(context); diags = JCDiagnostic.Factory.instance(context); options = Options.instance(context); printProcessorInfo = options.isSet(Option.XPRINTPROCESSORINFO); printRounds = options.isSet(Option.XPRINTROUNDS); verbose = options.isSet(Option.VERBOSE); lint = Lint.instance(context).isEnabled(PROCESSING); compiler = JavaCompiler.instance(context); if (options.isSet(Option.PROC, "only") || options.isSet(Option.XPRINT)) { compiler.shouldStopPolicyIfNoError = CompileState.PROCESS; } fatalErrors = options.isSet("fatalEnterError"); showResolveErrors = options.isSet("showResolveErrors"); werror = options.isSet(Option.WERROR); fileManager = context.get(JavaFileManager.class); platformAnnotations = initPlatformAnnotations(); // Initialize services before any processors are initialized // in case processors use them. filer = new JavacFiler(context); messager = new JavacMessager(context, this); elementUtils = JavacElements.instance(context); typeUtils = JavacTypes.instance(context); modules = Modules.instance(context); types = Types.instance(context); annotate = Annotate.instance(context); processorOptions = initProcessorOptions(); unmatchedProcessorOptions = initUnmatchedProcessorOptions(); messages = JavacMessages.instance(context); taskListener = MultiTaskListener.instance(context); symtab = Symtab.instance(context); names = Names.instance(context); enter = Enter.instance(context); initialCompleter = ClassFinder.instance(context).getCompleter(); chk = Check.instance(context); initProcessorLoader(); allowModules = source.allowModules(); }
Example 19
Source File: Paths.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
void setContext(Context context) { log = Log.instance(context); options = Options.instance(context); lint = Lint.instance(context); fsInfo = FSInfo.instance(context); }
Example 20
Source File: Paths.java From javaide with GNU General Public License v3.0 | 4 votes |
void setContext(Context context) { log = Log.instance(context); options = Options.instance(context); lint = Lint.instance(context); fsInfo = FSInfo.instance(context); }