Java Code Examples for com.sun.tools.javac.code.Lint#instance()

The following examples show how to use com.sun.tools.javac.code.Lint#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: Enter.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 2
Source File: Flow.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
protected Flow(Context context) {
    context.put(flowKey, this);
    names = Names.instance(context);
    log = Log.instance(context);
    syms = Symtab.instance(context);
    types = Types.instance(context);
    chk = Check.instance(context);
    lint = Lint.instance(context);
    rs = Resolve.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    Source source = Source.instance(context);
    allowImprovedRethrowAnalysis = source.allowImprovedRethrowAnalysis();
    allowImprovedCatchAnalysis = source.allowImprovedCatchAnalysis();
    allowEffectivelyFinalInInnerClasses = source.allowEffectivelyFinalInInnerClasses();
    enforceThisDotInit = source.enforceThisDotInit();
}
 
Example 3
Source File: Annotate.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
protected Annotate(Context context) {
    context.put(annotateKey, this);

    attr = Attr.instance(context);
    chk = Check.instance(context);
    cfolder = ConstFold.instance(context);
    deferredLintHandler = DeferredLintHandler.instance(context);
    enter = Enter.instance(context);
    log = Log.instance(context);
    lint = Lint.instance(context);
    make = TreeMaker.instance(context);
    names = Names.instance(context);
    resolve = Resolve.instance(context);
    syms = Symtab.instance(context);
    typeEnvs = TypeEnvs.instance(context);
    types = Types.instance(context);

    theUnfinishedDefaultValue =  new Attribute.Error(syms.errType);

    Source source = Source.instance(context);
    allowRepeatedAnnos = source.allowRepeatedAnnotations();
    sourceName = source.name;

    blockCount = 1;
}
 
Example 4
Source File: TypeEnter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
protected TypeEnter(Context context) {
    context.put(typeEnterKey, this);
    names = Names.instance(context);
    enter = Enter.instance(context);
    memberEnter = MemberEnter.instance(context);
    log = Log.instance(context);
    chk = Check.instance(context);
    attr = Attr.instance(context);
    syms = Symtab.instance(context);
    make = TreeMaker.instance(context);
    todo = Todo.instance(context);
    annotate = Annotate.instance(context);
    typeAnnotations = TypeAnnotations.instance(context);
    types = Types.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    deferredLintHandler = DeferredLintHandler.instance(context);
    lint = Lint.instance(context);
    typeEnvs = TypeEnvs.instance(context);
    dependencies = Dependencies.instance(context);
    Source source = Source.instance(context);
    allowTypeAnnos = source.allowTypeAnnotations();
    allowDeprecationOnImport = source.allowDeprecationOnImport();
}
 
Example 5
Source File: Enter.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
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);
}
 
Example 6
Source File: Enter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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 7
Source File: Check.java    From openjdk-8 with GNU General Public License v2.0 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);
    diags = JCDiagnostic.Factory.instance(context);
    Options options = Options.instance(context);
    lint = Lint.instance(context);
    treeinfo = TreeInfo.instance(context);
    fileManager = context.get(JavaFileManager.class);

    Source source = Source.instance(context);
    allowGenerics = source.allowGenerics();
    allowVarargs = source.allowVarargs();
    allowAnnotations = source.allowAnnotations();
    allowCovariantReturns = source.allowCovariantReturns();
    allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    allowDefaultMethods = source.allowDefaultMethods();
    allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
    complexInference = options.isSet("complexinference");
    warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
    suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
    enableSunApiLintControl = options.isSet("enableSunApiLintControl");

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

    profile = Profile.instance(context);

    boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
    boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
    boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
    boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();

    deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
            enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
    uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
            enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
    sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
            enforceMandatoryWarnings, "sunapi", null);

    deferredLintHandler = DeferredLintHandler.instance(context);
}
 
Example 8
Source File: Check.java    From TencentKona-8 with GNU General Public License v2.0 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);
    diags = JCDiagnostic.Factory.instance(context);
    Options options = Options.instance(context);
    lint = Lint.instance(context);
    treeinfo = TreeInfo.instance(context);
    fileManager = context.get(JavaFileManager.class);

    Source source = Source.instance(context);
    allowGenerics = source.allowGenerics();
    allowVarargs = source.allowVarargs();
    allowAnnotations = source.allowAnnotations();
    allowCovariantReturns = source.allowCovariantReturns();
    allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    allowDefaultMethods = source.allowDefaultMethods();
    allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
    complexInference = options.isSet("complexinference");
    warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
    suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
    enableSunApiLintControl = options.isSet("enableSunApiLintControl");
    warnOnAccessToSensitiveMembers = options.isSet("warnOnAccessToSensitiveMembers");

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

    profile = Profile.instance(context);

    boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
    boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
    boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
    boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();

    deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
            enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
    uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
            enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
    sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
            enforceMandatoryWarnings, "sunapi", null);

    deferredLintHandler = DeferredLintHandler.instance(context);
}
 
Example 9
Source File: Check.java    From openjdk-8-source with GNU General Public License v2.0 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);
    diags = JCDiagnostic.Factory.instance(context);
    Options options = Options.instance(context);
    lint = Lint.instance(context);
    treeinfo = TreeInfo.instance(context);
    fileManager = context.get(JavaFileManager.class);

    Source source = Source.instance(context);
    allowGenerics = source.allowGenerics();
    allowVarargs = source.allowVarargs();
    allowAnnotations = source.allowAnnotations();
    allowCovariantReturns = source.allowCovariantReturns();
    allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    allowDefaultMethods = source.allowDefaultMethods();
    allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
    complexInference = options.isSet("complexinference");
    warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
    suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
    enableSunApiLintControl = options.isSet("enableSunApiLintControl");

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

    profile = Profile.instance(context);

    boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
    boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
    boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
    boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();

    deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
            enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
    uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
            enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
    sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
            enforceMandatoryWarnings, "sunapi", null);

    deferredLintHandler = DeferredLintHandler.instance(context);
}
 
Example 10
Source File: Check.java    From hottub with GNU General Public License v2.0 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);
    diags = JCDiagnostic.Factory.instance(context);
    Options options = Options.instance(context);
    lint = Lint.instance(context);
    treeinfo = TreeInfo.instance(context);
    fileManager = context.get(JavaFileManager.class);

    Source source = Source.instance(context);
    allowGenerics = source.allowGenerics();
    allowVarargs = source.allowVarargs();
    allowAnnotations = source.allowAnnotations();
    allowCovariantReturns = source.allowCovariantReturns();
    allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    allowDefaultMethods = source.allowDefaultMethods();
    allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
    complexInference = options.isSet("complexinference");
    warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
    suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
    enableSunApiLintControl = options.isSet("enableSunApiLintControl");
    warnOnAccessToSensitiveMembers = options.isSet("warnOnAccessToSensitiveMembers");

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

    profile = Profile.instance(context);

    boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
    boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
    boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
    boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();

    deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
            enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
    uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
            enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
    sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
            enforceMandatoryWarnings, "sunapi", null);

    deferredLintHandler = DeferredLintHandler.instance(context);
}
 
Example 11
Source File: Check.java    From openjdk-jdk9 with GNU General Public License v2.0 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);
}
 
Example 12
Source File: Check.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
protected Check(Context context) {
    context.put(checkKey, this);

    names = Names.instance(context);
    log = Log.instance(context);
    syms = Symtab.instance(context);
    enter = Enter.instance(context);
    infer = Infer.instance(context);
    this.types = Types.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    Options options = Options.instance(context);
    lint = Lint.instance(context);
    treeinfo = TreeInfo.instance(context);

    Source source = Source.instance(context);
    allowGenerics = source.allowGenerics();
    allowAnnotations = source.allowAnnotations();
    allowCovariantReturns = source.allowCovariantReturns();
    allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    complexInference = options.isSet(COMPLEXINFERENCE);
    skipAnnotations = options.isSet("skipAnnotations");
    warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
    suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
    enableSunApiLintControl = options.isSet("enableSunApiLintControl");

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

    boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
    boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
    boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
    boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();

    deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
            enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
    uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
            enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
    sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
            enforceMandatoryWarnings, "sunapi", null);

    deferredLintHandler = DeferredLintHandler.immediateHandler;
}
 
Example 13
Source File: Paths.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
void setContext(Context context) {
    log = Log.instance(context);
    options = Options.instance(context);
    lint = Lint.instance(context);
    fsInfo = FSInfo.instance(context);
}
 
Example 14
Source File: Check.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 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);
    diags = JCDiagnostic.Factory.instance(context);
    Options options = Options.instance(context);
    lint = Lint.instance(context);
    treeinfo = TreeInfo.instance(context);
    fileManager = context.get(JavaFileManager.class);

    Source source = Source.instance(context);
    allowGenerics = source.allowGenerics();
    allowVarargs = source.allowVarargs();
    allowAnnotations = source.allowAnnotations();
    allowCovariantReturns = source.allowCovariantReturns();
    allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    allowDefaultMethods = source.allowDefaultMethods();
    allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
    complexInference = options.isSet("complexinference");
    warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
    suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
    enableSunApiLintControl = options.isSet("enableSunApiLintControl");
    warnOnAccessToSensitiveMembers = options.isSet("warnOnAccessToSensitiveMembers");

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

    profile = Profile.instance(context);

    boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
    boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
    boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
    boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();

    deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
            enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
    uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
            enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
    sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
            enforceMandatoryWarnings, "sunapi", null);

    deferredLintHandler = DeferredLintHandler.instance(context);
}
 
Example 15
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);
}
 
Example 16
Source File: Check.java    From openjdk-jdk8u with GNU General Public License v2.0 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);
    diags = JCDiagnostic.Factory.instance(context);
    Options options = Options.instance(context);
    lint = Lint.instance(context);
    treeinfo = TreeInfo.instance(context);
    fileManager = context.get(JavaFileManager.class);

    Source source = Source.instance(context);
    allowGenerics = source.allowGenerics();
    allowVarargs = source.allowVarargs();
    allowAnnotations = source.allowAnnotations();
    allowCovariantReturns = source.allowCovariantReturns();
    allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    allowDefaultMethods = source.allowDefaultMethods();
    allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
    complexInference = options.isSet("complexinference");
    warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
    suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
    enableSunApiLintControl = options.isSet("enableSunApiLintControl");
    warnOnAccessToSensitiveMembers = options.isSet("warnOnAccessToSensitiveMembers");

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

    profile = Profile.instance(context);

    boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
    boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
    boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
    boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();

    deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
            enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
    uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
            enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
    sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
            enforceMandatoryWarnings, "sunapi", null);

    deferredLintHandler = DeferredLintHandler.instance(context);
}
 
Example 17
Source File: Check.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
protected Check(Context context) {
    context.put(checkKey, this);

    names = Names.instance(context);
    log = Log.instance(context);
    syms = Symtab.instance(context);
    enter = Enter.instance(context);
    infer = Infer.instance(context);
    this.types = Types.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    Options options = Options.instance(context);
    lint = Lint.instance(context);
    treeinfo = TreeInfo.instance(context);

    Source source = Source.instance(context);
    allowGenerics = source.allowGenerics();
    allowAnnotations = source.allowAnnotations();
    allowCovariantReturns = source.allowCovariantReturns();
    allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    complexInference = options.isSet(COMPLEXINFERENCE);
    skipAnnotations = options.isSet("skipAnnotations");
    warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
    suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
    enableSunApiLintControl = options.isSet("enableSunApiLintControl");

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

    boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
    boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
    boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
    boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();

    deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
            enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
    uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
            enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
    sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
            enforceMandatoryWarnings, "sunapi", null);

    deferredLintHandler = DeferredLintHandler.immediateHandler;
}
 
Example 18
Source File: Paths.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
void setContext(Context context) {
    log = Log.instance(context);
    options = Options.instance(context);
    lint = Lint.instance(context);
    fsInfo = FSInfo.instance(context);
}
 
Example 19
Source File: Check.java    From jdk8u60 with GNU General Public License v2.0 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);
    diags = JCDiagnostic.Factory.instance(context);
    Options options = Options.instance(context);
    lint = Lint.instance(context);
    treeinfo = TreeInfo.instance(context);
    fileManager = context.get(JavaFileManager.class);

    Source source = Source.instance(context);
    allowGenerics = source.allowGenerics();
    allowVarargs = source.allowVarargs();
    allowAnnotations = source.allowAnnotations();
    allowCovariantReturns = source.allowCovariantReturns();
    allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    allowDefaultMethods = source.allowDefaultMethods();
    allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
    complexInference = options.isSet("complexinference");
    warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
    suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
    enableSunApiLintControl = options.isSet("enableSunApiLintControl");
    warnOnAccessToSensitiveMembers = options.isSet("warnOnAccessToSensitiveMembers");

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

    profile = Profile.instance(context);

    boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
    boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
    boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
    boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();

    deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
            enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
    uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
            enforceMandatoryWarnings, "unchecked", LintCategory.UNCHECKED);
    sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
            enforceMandatoryWarnings, "sunapi", null);

    deferredLintHandler = DeferredLintHandler.instance(context);
}