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


Java Options类代码示例

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


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

示例1: testOraculumLibrarySourceWithoutRootWithSourcePath

import com.sun.tools.javac.util.Options; //导入依赖的package包/类
public void testOraculumLibrarySourceWithoutRootWithSourcePath() {
    Lookup.getDefault().lookup(CPP.class).add(
            root1,
            ClassPath.SOURCE,
            ClassPathSupport.createClassPath(root1));
    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,代码行数:20,代码来源:ModuleOraculumTest.java

示例2: 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

示例3: 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

示例4: testOraculumLibrarySourceWithRootExpliciteXModule

import com.sun.tools.javac.util.Options; //导入依赖的package包/类
public void testOraculumLibrarySourceWithRootExpliciteXModule() throws IOException {
    Lookup.getDefault().lookup(COQ.class)
            .forRoot(root1)
            .apply("-XD-Xmodule:SomeModule");  //NOI18N
    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("SomeModule", opts.get("-XD-Xmodule:"));    //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ModuleOraculumTest.java

示例5: init

import com.sun.tools.javac.util.Options; //导入依赖的package包/类
/*****************************************
 * Add task to the javac compilation process
 * @param pe the processing environment
 ****************************************/
@Override
public synchronized void init(ProcessingEnvironment pe) {
	JavacTask task = JavacTask.instance(pe);
	if (!(task instanceof BasicJavacTask)) {
		pe.getMessager()
				.printMessage(Diagnostic.Kind.WARNING,
								  "Unfortunately you are using an incompatible " +
										  "version of the javac.  Please report this at " +
										  "https://github.com/prestongarno/trywithres-compat/issues. Thank you.");
		return;
	}

	super.init(pe);
	task.addTaskListener(new Loader.TaskListenerImpl(task));
	String v = Options.instance(((BasicJavacTask) task).getContext()).get("-g:source");
	INJECT_STDOUT_STATEMENT = v != null;
}
 
开发者ID:prestongarno,项目名称:trywithres-compat,代码行数:22,代码来源:FakeProcessor.java

示例6: 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:tranleduy2000,项目名称:javaide,代码行数:25,代码来源:JavacProcessingEnvironment.java

示例7: 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

示例8: DocCommentParser

import com.sun.tools.javac.util.Options; //导入依赖的package包/类
DocCommentParser(ParserFactory fac, DiagnosticSource diagSource, Comment comment) {
    this.fac = fac;
    this.diagSource = diagSource;
    this.comment = comment;
    names = fac.names;
    m = fac.docTreeMaker;

    Locale locale = (fac.locale == null) ? Locale.getDefault() : fac.locale;

    Options options = fac.options;
    boolean useBreakIterator = options.isSet("breakIterator");
    if (useBreakIterator || !locale.getLanguage().equals(Locale.ENGLISH.getLanguage()))
        sentenceBreaker = BreakIterator.getSentenceInstance(locale);

    initTagParsers();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:DocCommentParser.java

示例9: 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

示例10: 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

示例11: 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:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:17,代码来源:TestInferBinaryName.java

示例12: 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

示例13: main

import com.sun.tools.javac.util.Options; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
	if (args.length == 0) {
		System.out.println("Usage: Supply a file name to print.");
		return;
	}
	Context context = new Context();
	
	Options.instance(context).put(OptionName.ENCODING, "UTF-8");
	
	JavaCompiler compiler = new JavaCompiler(context);
	compiler.genEndPos = true;
	compiler.keepComments = true;
	
	@SuppressWarnings("deprecation") JCCompilationUnit cu = compiler.parse(args[0]);
	JcTreePrinter printer = new JcTreePrinter(true);
	printer.visit(cu);
	System.out.println(printer);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:19,代码来源:JcTreePrinter.java

示例14: parseWithLombok

import com.sun.tools.javac.util.Options; //导入依赖的package包/类
protected JCTree parseWithLombok(Source source) {
	Context context = new Context();
	
	Options.instance(context).put(OptionName.ENCODING, "UTF-8");
	
	JavaCompiler compiler = new JavaCompiler(context);
	compiler.genEndPos = true;
	compiler.keepComments = true;
	
	JCCompilationUnit cu = compiler.parse(new ContentBasedJavaFileObject(source.getName(), source.getRawInput()));
	JcTreeConverter converter = new JcTreeConverter();
	JcTreeBuilder builder = new JcTreeBuilder();
	converter.visit(cu);
	builder.visit(converter.getResult());
	return builder.get();
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:17,代码来源:JcTreeConverterType2Test.java

示例15: init

import com.sun.tools.javac.util.Options; //导入依赖的package包/类
@Override
public void init(JavacTask javacTask, String... args) {
  Context context = ((BasicJavacTask) javacTask).getContext();
  BaseErrorProneJavaCompiler.checkCompilePolicy(Options.instance(context).get("compilePolicy"));
  BaseErrorProneJavaCompiler.setupMessageBundle(context);
  RefactoringCollection[] refactoringCollection = {null};
  javacTask.addTaskListener(
      BaseErrorProneJavaCompiler.createAnalyzer(
          BuiltInCheckerSuppliers.defaultChecks(),
          ErrorProneOptions.processArgs(args),
          context,
          refactoringCollection));
  if (refactoringCollection[0] != null) {
    javacTask.addTaskListener(new RefactoringTask(context, refactoringCollection[0]));
  }
}
 
开发者ID:google,项目名称:error-prone,代码行数:17,代码来源:ErrorProneJavacPlugin.java


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