当前位置: 首页>>代码示例>>Java>>正文


Java Options.instance方法代码示例

本文整理汇总了Java中com.sun.tools.javac.util.Options.instance方法的典型用法代码示例。如果您正苦于以下问题:Java Options.instance方法的具体用法?Java Options.instance怎么用?Java Options.instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.javac.util.Options的用法示例。


在下文中一共展示了Options.instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testOraculumLibrarySourceNoModuleInfo

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
public void testOraculumLibrarySourceNoModuleInfo() throws IOException {
    moduleFile1.delete();
    final ClasspathInfo cpInfo = new ClasspathInfo.Builder(ClassPath.EMPTY).build();
    final JavacParser parser = new JavacParser(Collections.emptyList(), true);
    final JavacTaskImpl impl = JavacParser.createJavacTask(
            javaFile1,
            root1,
            cpInfo,
            parser,
            null,
            false);
    assertNotNull(impl);
    final Options opts = Options.instance(impl.getContext());
    assertNotNull(opts);
    assertNull(opts.get("-XD-Xmodule:"));    //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ModuleOraculumTest.java

示例2: testOraculumProjectSource

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
public void testOraculumProjectSource() throws IOException {
    scan(root1);
    final ClasspathInfo cpInfo = new ClasspathInfo.Builder(ClassPath.EMPTY).build();
    final JavacParser parser = new JavacParser(Collections.emptyList(), true);
    final JavacTaskImpl impl = JavacParser.createJavacTask(
            javaFile1,
            root1,
            cpInfo,
            parser,
            null,
            false);
    assertNotNull(impl);
    final Options opts = Options.instance(impl.getContext());
    assertNotNull(opts);
    assertNull(opts.get("-XD-Xmodule:"));    //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ModuleOraculumTest.java

示例3: Analyzer

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
protected Analyzer(Context context) {
    context.put(analyzerKey, this);
    types = Types.instance(context);
    log = Log.instance(context);
    attr = Attr.instance(context);
    deferredAttr = DeferredAttr.instance(context);
    argumentAttr = ArgumentAttr.instance(context);
    make = TreeMaker.instance(context);
    names = Names.instance(context);
    Options options = Options.instance(context);
    String findOpt = options.get("find");
    //parse modes
    Source source = Source.instance(context);
    allowDiamondWithAnonymousClassCreation = source.allowDiamondWithAnonymousClassCreation();
    analyzerModes = AnalyzerMode.getAnalyzerModes(findOpt, source);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Analyzer.java

示例4: Enter

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
protected Enter(Context context) {
    context.put(enterKey, this);

    log = Log.instance(context);
    reader = ClassReader.instance(context);
    make = TreeMaker.instance(context);
    syms = Symtab.instance(context);
    chk = Check.instance(context);
    memberEnter = MemberEnter.instance(context);
    types = Types.instance(context);
    annotate = Annotate.instance(context);
    lint = Lint.instance(context);
    names = Names.instance(context);

    predefClassDef = make.ClassDef(
        make.Modifiers(PUBLIC),
        syms.predefClass.name, null, null, null, null);
    predefClassDef.sym = syms.predefClass;
    todo = Todo.instance(context);
    fileManager = context.get(JavaFileManager.class);

    Options options = Options.instance(context);
    pkginfoOpt = PkgInfo.get(options);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:25,代码来源:Enter.java

示例5: initProcessorOptions

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:JavacProcessingEnvironment.java

示例6: listOptions

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
private void listOptions(StringBuilder message, ProcessingEnvironment procEnv) {
	try {
		JavacProcessingEnvironment environment = (JavacProcessingEnvironment) procEnv;
		Options instance = Options.instance(environment.getContext());
		Field field = Options.class.getDeclaredField("values");
		field.setAccessible(true);
		@SuppressWarnings("unchecked") Map<String, String> values = (Map<String, String>) field.get(instance);
		if (values.isEmpty()) {
			message.append("Options: empty\n\n");
			return;
		}
		message.append("Compiler Options:\n");
		for (Map.Entry<String, String> value : values.entrySet()) {
			message.append("- ");
			string(message, value.getKey());
			message.append(" = ");
			string(message, value.getValue());
			message.append("\n");
		}
		message.append("\n");
	} catch (Exception e) {
		message.append("No options available\n\n");
	}
	
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:26,代码来源:Processor.java

示例7: getFileManager

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
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;
}
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:17,代码来源:TestInferBinaryName.java

示例8: FilerImpl

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
private FilerImpl(Context context) {
    context.put(filerKey, this);
    opts = Options.instance(context);
    declMaker = DeclarationMaker.instance(context);
    bark = Bark.instance(context);
    comp = com.sun.tools.apt.main.JavaCompiler.instance(context);
    roundOver = false;
    this.filesCreated = comp.getAggregateGenFiles();

    // Encoding
    encoding = opts.get("-encoding");
    if (encoding == null) {
        encoding = DEFAULT_ENCODING;
    }

    wc = new HashSet<Flushable>();

    // Locations
    locations = new EnumMap<Location, File>(Location.class);
    String s = opts.get("-s");      // location for new source files
    String d = opts.get("-d");      // location for new class files
    locations.put(SOURCE_TREE, new File(s != null ? s : "."));
    locations.put(CLASS_TREE,  new File(d != null ? d : "."));
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:25,代码来源:FilerImpl.java

示例9: FilerImpl

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
private FilerImpl(Context context) {
    context.put(filerKey, this);
    opts = Options.instance(context);
    declMaker = DeclarationMaker.instance(context);
    bark = Bark.instance(context);
    comp = com.sun.tools.apt.main.AptJavaCompiler.instance(context);
    roundOver = false;
    this.filesCreated = comp.getAggregateGenFiles();

    // Encoding
    encoding = opts.get("-encoding");
    if (encoding == null) {
        encoding = DEFAULT_ENCODING;
    }

    wc = new HashSet<Flushable>();

    // Locations
    locations = new EnumMap<Location, File>(Location.class);
    String s = opts.get("-s");      // location for new source files
    String d = opts.get("-d");      // location for new class files
    locations.put(SOURCE_TREE, new File(s != null ? s : "."));
    locations.put(CLASS_TREE,  new File(d != null ? d : "."));
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:25,代码来源:FilerImpl.java

示例10: testOraculumLibrarySourceWithRoot

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
public void testOraculumLibrarySourceWithRoot() {
    final ClasspathInfo cpInfo = new ClasspathInfo.Builder(ClassPath.EMPTY).build();
    final JavacParser parser = new JavacParser(Collections.emptyList(), true);
    final JavacTaskImpl impl = JavacParser.createJavacTask(
            javaFile1,
            root1,
            cpInfo,
            parser,
            null,
            false);
    assertNotNull(impl);
    final Options opts = Options.instance(impl.getContext());
    assertNotNull(opts);
    assertEquals("Test", opts.get("-XD-Xmodule:"));    //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ModuleOraculumTest.java

示例11: setContext

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
/**
 * Set the context for JavacPathFileManager.
 * @param context the context containing items to be associated with the file manager
 */
public void setContext(Context context) {
    log = Log.instance(context);
    options = Options.instance(context);
    classLoaderClass = options.get("procloader");

    // Avoid initializing Lint
    boolean warn = options.isLintSet("path");
    locations.update(log, warn, FSInfo.instance(context));

    // Setting this option is an indication that close() should defer actually closing
    // the file manager until after a specified period of inactivity.
    // This is to accomodate clients which save references to Symbols created for use
    // within doclets or annotation processors, and which then attempt to use those
    // references after the tool exits, having closed any internally managed file manager.
    // Ideally, such clients should run the tool via the javax.tools API, providing their
    // own file manager, which can be closed by the client when all use of that file
    // manager is complete.
    // If the option has a numeric value, it will be interpreted as the duration,
    // in seconds, of the period of inactivity to wait for, before the file manager
    // is actually closed.
    // See also deferredClose().
    String s = options.get("fileManager.deferClose");
    if (s != null) {
        try {
            deferredCloseTimeout = (int) (Float.parseFloat(s) * 1000);
        } catch (NumberFormatException e) {
            deferredCloseTimeout = 60 * 1000;  // default: one minute, in millis
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:BaseFileManager.java

示例12: testOraculumLibrarySourceWithoutRootWithoutSourcePath

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
public void testOraculumLibrarySourceWithoutRootWithoutSourcePath() {
    final ClasspathInfo cpInfo = new ClasspathInfo.Builder(ClassPath.EMPTY).build();
    final JavacParser parser = new JavacParser(Collections.emptyList(), true);
    final JavacTaskImpl impl = JavacParser.createJavacTask(
            javaFile1,
            null,
            cpInfo,
            parser,
            null,
            false);
    assertNotNull(impl);
    final Options opts = Options.instance(impl.getContext());
    assertNotNull(opts);
    assertEquals("Test", opts.get("-XD-Xmodule:"));    //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ModuleOraculumTest.java

示例13: ParserFactory

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
protected ParserFactory(Context context) {
    super();
    context.put(parserFactoryKey, this);
    this.F = TreeMaker.instance(context);
    this.docTreeMaker = DocTreeMaker.instance(context);
    this.log = Log.instance(context);
    this.names = Names.instance(context);
    this.tokens = Tokens.instance(context);
    this.source = Source.instance(context);
    this.options = Options.instance(context);
    this.scannerFactory = ScannerFactory.instance(context);
    this.locale = context.get(Locale.class);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:ParserFactory.java

示例14: initContext

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
private void initContext() {
    //initialize compiler's default locale
    context.put(Locale.class, locale);
    if (!addModules.isEmpty()) {
        String names = String.join(",", addModules);
        Options opts = Options.instance(context);
        String prev = opts.get(Option.ADD_MODULES);
        opts.put(Option.ADD_MODULES, (prev == null) ? names : prev + "," + names);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:JavadocTaskImpl.java

示例15: Lint

import com.sun.tools.javac.util.Options; //导入方法依赖的package包/类
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);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:15,代码来源:Lint.java


注:本文中的com.sun.tools.javac.util.Options.instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。