Java Code Examples for com.sun.tools.javac.util.Options#isSet()

The following examples show how to use com.sun.tools.javac.util.Options#isSet() . 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: DocCommentParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 2
Source File: DocCommentParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 3
Source File: DocCommentParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 4
Source File: LambdaToMethod.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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: DocCommentParser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 6
Source File: DocCommentParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 7
Source File: DocCommentParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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();
}
 
Example 8
Source File: Lint.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected Lint(Context context) {
    // initialize values according to the lint options
    Options options = Options.instance(context);

    if (options.isSet(Option.XLINT) || options.isSet(Option.XLINT_CUSTOM, "all")) {
        // If -Xlint or -Xlint:all is given, enable all categories by default
        values = EnumSet.allOf(LintCategory.class);
    } else if (options.isSet(Option.XLINT_CUSTOM, "none")) {
        // if -Xlint:none is given, disable all categories by default
        values = EnumSet.noneOf(LintCategory.class);
    } else {
        // otherwise, enable on-by-default categories
        values = EnumSet.noneOf(LintCategory.class);

        Source source = Source.instance(context);
        if (source.compareTo(Source.JDK1_9) >= 0) {
            values.add(LintCategory.DEP_ANN);
        }
        values.add(LintCategory.REQUIRES_TRANSITIVE_AUTOMATIC);
        values.add(LintCategory.OPENS);
        values.add(LintCategory.MODULE);
        values.add(LintCategory.REMOVAL);
    }

    // Look for specific overrides
    for (LintCategory lc : LintCategory.values()) {
        if (options.isSet(Option.XLINT_CUSTOM, lc.option)) {
            values.add(lc);
        } else if (options.isSet(Option.XLINT_CUSTOM, "-" + lc.option)) {
            values.remove(lc);
        }
    }

    suppressedValues = EnumSet.noneOf(LintCategory.class);

    context.put(lintKey, this);
    augmentor = new AugmentVisitor(context);
}
 
Example 9
Source File: JNIWriter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** 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()
}
 
Example 10
Source File: JNIWriter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** 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 11
Source File: Main.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Print a message reporting a fatal error.
 */
void feMessage(Throwable ex, Options options) {
    log.printRawLines(ex.getMessage());
    if (ex.getCause() != null && options.isSet("dev")) {
        ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE));
    }
}
 
Example 12
Source File: JavaCompiler.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
static boolean explicitAnnotationProcessingRequested(Options options) {
    return
        options.isSet(PROCESSOR) ||
        options.isSet(PROCESSOR_PATH) ||
        options.isSet(PROCESSOR_MODULE_PATH) ||
        options.isSet(PROC, "only") ||
        options.isSet(XPRINT);
}
 
Example 13
Source File: Lint.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected Lint(Context context) {
    // initialize values according to the lint options
    Options options = Options.instance(context);

    if (options.isSet(Option.XLINT) || options.isSet(Option.XLINT_CUSTOM, "all")) {
        // If -Xlint or -Xlint:all is given, enable all categories by default
        values = EnumSet.allOf(LintCategory.class);
    } else if (options.isSet(Option.XLINT_CUSTOM, "none")) {
        // if -Xlint:none is given, disable all categories by default
        values = EnumSet.noneOf(LintCategory.class);
    } else {
        // otherwise, enable on-by-default categories
        values = EnumSet.noneOf(LintCategory.class);

        Source source = Source.instance(context);
        if (source.compareTo(Source.JDK1_9) >= 0) {
            values.add(LintCategory.DEP_ANN);
        }
        values.add(LintCategory.REQUIRES_TRANSITIVE_AUTOMATIC);
        values.add(LintCategory.OPENS);
        values.add(LintCategory.MODULE);
        values.add(LintCategory.REMOVAL);
    }

    // Look for specific overrides
    for (LintCategory lc : LintCategory.values()) {
        if (options.isSet(Option.XLINT_CUSTOM, lc.option)) {
            values.add(lc);
        } else if (options.isSet(Option.XLINT_CUSTOM, "-" + lc.option)) {
            values.remove(lc);
        }
    }

    suppressedValues = EnumSet.noneOf(LintCategory.class);

    context.put(lintKey, this);
    augmentor = new AugmentVisitor(context);
}
 
Example 14
Source File: JNIWriter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** 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 15
Source File: JavaCompiler.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
static boolean explicitAnnotationProcessingRequested(Options options) {
    return
            options.isSet(PROCESSOR) ||
                    options.isSet(PROCESSORPATH) ||
                    options.isSet(PROC, "only") ||
                    options.isSet(XPRINT);
}
 
Example 16
Source File: JNIWriter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** 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 17
Source File: JNIWriter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** 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 18
Source File: JavaCompiler.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
static boolean explicitAnnotationProcessingRequested(Options options) {
    return
            options.isSet(PROCESSOR) ||
                    options.isSet(PROCESSORPATH) ||
                    options.isSet(PROC, "only") ||
                    options.isSet(XPRINT);
}
 
Example 19
Source File: JNIWriter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** 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 20
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
protected Check(Context context) {
    context.put(checkKey, this);

    names = Names.instance(context);
    dfltTargetMeta = new Name[] { names.PACKAGE, names.TYPE,
        names.FIELD, names.METHOD, names.CONSTRUCTOR,
        names.ANNOTATION_TYPE, names.LOCAL_VARIABLE, names.PARAMETER};
    log = Log.instance(context);
    rs = Resolve.instance(context);
    syms = Symtab.instance(context);
    enter = Enter.instance(context);
    deferredAttr = DeferredAttr.instance(context);
    infer = Infer.instance(context);
    types = Types.instance(context);
    typeAnnotations = TypeAnnotations.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    Options options = Options.instance(context);
    lint = Lint.instance(context);
    fileManager = context.get(JavaFileManager.class);

    source = Source.instance(context);
    allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    allowDefaultMethods = source.allowDefaultMethods();
    allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
    allowPrivateSafeVarargs = source.allowPrivateSafeVarargs();
    allowDiamondWithAnonymousClassCreation = source.allowDiamondWithAnonymousClassCreation();
    warnOnAnyAccessToMembers = options.isSet("warnOnAccessToMembers");

    Target target = Target.instance(context);
    syntheticNameChar = target.syntheticNameChar();

    profile = Profile.instance(context);

    boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
    boolean verboseRemoval = lint.isEnabled(LintCategory.REMOVAL);
    boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
    boolean enforceMandatoryWarnings = true;

    deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
            enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
    removalHandler = new MandatoryWarningHandler(log, verboseRemoval,
            enforceMandatoryWarnings, "removal", LintCategory.REMOVAL);
    uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
            enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
    sunApiHandler = new MandatoryWarningHandler(log, false,
            enforceMandatoryWarnings, "sunapi", null);

    deferredLintHandler = DeferredLintHandler.instance(context);
}