org.eclipse.jdt.core.dom.FileASTRequestor#com.sun.tools.javac.main.Option源码实例Demo

下面列出了org.eclipse.jdt.core.dom.FileASTRequestor#com.sun.tools.javac.main.Option 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-8-source   文件: Locations.java
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);
    }
}
 
源代码2 项目: openjdk-jdk9   文件: Locations.java
@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;
}
 
/**
 * 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();
}
 
源代码4 项目: openjdk-jdk8u-backup   文件: BaseFileManager.java
public int isSupportedOption(String option) {
    for (Option o : javacFileManagerOptions) {
        if (o.matches(option))
            return o.hasArg() ? 1 : 0;
    }
    return -1;
}
 
源代码5 项目: TencentKona-8   文件: Locations.java
@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;
}
 
源代码6 项目: lua-for-android   文件: Locations.java
@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;
}
 
源代码7 项目: lua-for-android   文件: ClassFinder.java
/** 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);
}
 
源代码8 项目: hottub   文件: BaseFileManager.java
public String getEncodingName() {
    String encName = options.get(Option.ENCODING);
    if (encName == null)
        return getDefaultEncodingName();
    else
        return encName;
}
 
源代码9 项目: openjdk-8   文件: Locations.java
/**
 * 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));
}
 
源代码10 项目: TencentKona-8   文件: Locations.java
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;
    }
}
 
源代码11 项目: TencentKona-8   文件: BaseFileManager.java
protected Source getSource() {
    String sourceName = options.get(Option.SOURCE);
    Source source = null;
    if (sourceName != null)
        source = Source.lookup(sourceName);
    return (source != null ? source : Source.DEFAULT);
}
 
源代码12 项目: openjdk-8   文件: BaseFileManager.java
public String getEncodingName() {
    String encName = options.get(Option.ENCODING);
    if (encName == null)
        return getDefaultEncodingName();
    else
        return encName;
}
 
源代码13 项目: openjdk-8   文件: Locations.java
@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;
}
 
源代码14 项目: jdk8u60   文件: Locations.java
void update(Options optionTable) {
    for (Option o: options) {
        String v = optionTable.get(o);
        if (v != null) {
            handleOption(o, v);
        }
    }
}
 
源代码15 项目: openjdk-jdk9   文件: Locations.java
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);
        }
    }
}
 
源代码16 项目: openjdk-8-source   文件: Locations.java
/**
 * 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));
}
 
源代码17 项目: hottub   文件: Locations.java
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);
}
 
源代码18 项目: openjdk-jdk8u-backup   文件: BaseFileManager.java
public String getEncodingName() {
    String encName = options.get(Option.ENCODING);
    if (encName == null)
        return getDefaultEncodingName();
    else
        return encName;
}
 
源代码19 项目: openjdk-8-source   文件: Log.java
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;
}
 
源代码20 项目: hottub   文件: Locations.java
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;
    }
}
 
源代码21 项目: jdk8u60   文件: Log.java
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;
}
 
源代码22 项目: openjdk-jdk8u   文件: JavacTool.java
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;
}
 
源代码23 项目: openjdk-jdk8u   文件: Locations.java
/**
 * 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));
}
 
源代码24 项目: openjdk-8-source   文件: Resolve.java
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);
}
 
源代码25 项目: openjdk-jdk8u   文件: Locations.java
@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;
}
 
源代码26 项目: openjdk-8-source   文件: Locations.java
@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;
}
 
源代码27 项目: openjdk-8-source   文件: JavacTool.java
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;
}
 
源代码28 项目: openjdk-8   文件: Locations.java
@Override
boolean handleOption(Option option, String value) {
    if (!options.contains(option))
        return false;
    searchPath = value == null ? null :
            Collections.unmodifiableCollection(createPath().addFiles(value));
    return true;
}
 
源代码29 项目: openjdk-jdk8u-backup   文件: Locations.java
void update(Options optionTable) {
    for (Option o: options) {
        String v = optionTable.get(o);
        if (v != null) {
            handleOption(o, v);
        }
    }
}
 
源代码30 项目: openjdk-jdk8u   文件: BaseFileManager.java
public int isSupportedOption(String option) {
    for (Option o : javacFileManagerOptions) {
        if (o.matches(option))
            return o.hasArg() ? 1 : 0;
    }
    return -1;
}