com.sun.tools.javac.resources.CompilerProperties.Warnings Java Examples

The following examples show how to use com.sun.tools.javac.resources.CompilerProperties.Warnings. 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: Locations.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void addDirectory(File dir, boolean warn) {
    if (!dir.isDirectory()) {
        if (warn) {
            log.warning(Lint.LintCategory.PATH,
                        Warnings.DirPathElementNotFound(dir));
        }
        return;
    }

    try  {
        Stream<File> s = Stream.of(dir.listFiles());
        s.filter(Locations.this::isArchive)
                .forEach(dirEntry -> addFile(dirEntry, warn));
        s.close();
    } catch (Exception ignore) {
    }
}
 
Example #2
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
void checkDeprecatedAnnotation(DiagnosticPosition pos, Symbol s) {
    if (lint.isEnabled(LintCategory.DEP_ANN) && s.isDeprecatableViaAnnotation() &&
        (s.flags() & DEPRECATED) != 0 &&
        !syms.deprecatedType.isErroneous() &&
        s.attribute(syms.deprecatedType.tsym) == null) {
        log.warning(LintCategory.DEP_ANN,
                pos, Warnings.MissingDeprecatedAnnotation);
    }
    // Note: @Deprecated has no effect on local variables, parameters and package decls.
    if (lint.isEnabled(LintCategory.DEPRECATION) && !s.isDeprecatableViaAnnotation()) {
        if (!syms.deprecatedType.isErroneous() && s.attribute(syms.deprecatedType.tsym) != null) {
            log.warning(LintCategory.DEPRECATION, pos,
                        Warnings.DeprecatedAnnotationHasNoEffect(Kinds.kindName(s)));
        }
    }
}
 
Example #3
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void checkClassOverrideEqualsAndHash(DiagnosticPosition pos,
        ClassSymbol someClass) {
    if (lint.isEnabled(LintCategory.OVERRIDES)) {
        MethodSymbol equalsAtObject = (MethodSymbol)syms.objectType
                .tsym.members().findFirst(names.equals);
        MethodSymbol hashCodeAtObject = (MethodSymbol)syms.objectType
                .tsym.members().findFirst(names.hashCode);
        boolean overridesEquals = types.implementation(equalsAtObject,
            someClass, false, equalsHasCodeFilter).owner == someClass;
        boolean overridesHashCode = types.implementation(hashCodeAtObject,
            someClass, false, equalsHasCodeFilter) != hashCodeAtObject;

        if (overridesEquals && !overridesHashCode) {
            log.warning(LintCategory.OVERRIDES, pos,
                        Warnings.OverrideEqualsButNotHashcode(someClass));
        }
    }
}
 
Example #4
Source File: Flow.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void visitSwitch(JCSwitch tree) {
    ListBuffer<PendingExit> prevPendingExits = pendingExits;
    pendingExits = new ListBuffer<>();
    scan(tree.selector);
    boolean hasDefault = false;
    for (List<JCCase> l = tree.cases; l.nonEmpty(); l = l.tail) {
        alive = true;
        JCCase c = l.head;
        if (c.pat == null)
            hasDefault = true;
        else
            scan(c.pat);
        scanStats(c.stats);
        // Warn about fall-through if lint switch fallthrough enabled.
        if (alive &&
            lint.isEnabled(Lint.LintCategory.FALLTHROUGH) &&
            c.stats.nonEmpty() && l.tail.nonEmpty())
            log.warning(Lint.LintCategory.FALLTHROUGH,
                        l.tail.head.pos(),
                        Warnings.PossibleFallThroughIntoCase);
    }
    if (!hasDefault) {
        alive = true;
    }
    alive |= resolveBreaks(tree, prevPendingExits);
}
 
Example #5
Source File: Analyzer.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
void process(JCNewClass oldTree, JCNewClass newTree, boolean hasErrors) {
    if (!hasErrors) {
        List<Type> inferredArgs, explicitArgs;
        if (oldTree.def != null) {
            inferredArgs = newTree.def.implementing.nonEmpty()
                              ? newTree.def.implementing.get(0).type.getTypeArguments()
                              : newTree.def.extending.type.getTypeArguments();
            explicitArgs = oldTree.def.implementing.nonEmpty()
                              ? oldTree.def.implementing.get(0).type.getTypeArguments()
                              : oldTree.def.extending.type.getTypeArguments();
        } else {
            inferredArgs = newTree.type.getTypeArguments();
            explicitArgs = oldTree.type.getTypeArguments();
        }
        for (Type t : inferredArgs) {
            if (!types.isSameType(t, explicitArgs.head)) {
                return;
            }
            explicitArgs = explicitArgs.tail;
        }
        //exact match
        log.warning(oldTree.clazz, Warnings.DiamondRedundantArgs);
    }
}
 
Example #6
Source File: Locations.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Split a search path into its elements. If emptyPathDefault is not null, all empty elements in the
 * path, including empty elements at either end of the path, will be replaced with the value of
 * emptyPathDefault.
 *
 * @param searchPath The search path to be split
 * @param emptyPathDefault The value to substitute for empty path elements, or null, to ignore
 * empty path elements
 * @return The elements of the path
 */
private Iterable<File> getPathEntries(String searchPath, File emptyPathDefault) {
    ListBuffer<File> entries = new ListBuffer<>();
    for (String s: searchPath.split(Pattern.quote(File.pathSeparator), -1)) {
        if (s.isEmpty()) {
            if (emptyPathDefault != null) {
                entries.add(emptyPathDefault);
            }
        } else {
            try {
                entries.add(new File(s));
            } catch (IllegalArgumentException e) {
                if (warn) {
                    log.warning(LintCategory.PATH, Warnings.InvalidPath(s));
                }
            }
        }
    }
    return entries;
}
 
Example #7
Source File: Locations.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Split a search path into its elements. If emptyFileDefault is not null, all empty elements in the
 * path, including empty elements at either end of the path, will be replaced with the value of
 * emptyFileDefault.
 *
 * @param searchFile The search path to be split
 * @param emptyFileDefault The value to substitute for empty path elements, or null, to ignore
 * empty path elements
 * @return The elements of the path
 */
private Iterable<File> getFileEntries(String searchFile, File emptyFileDefault) {
    ListBuffer<File> entries = new ListBuffer<>();
    for (String s: searchFile.split(Pattern.quote(File.pathSeparator), -1)) {
        if (s.isEmpty()) {
            if (emptyFileDefault != null) {
                entries.add(emptyFileDefault);
            }
        } else {
            try {
                entries.add(getFile(s));
            } catch (IllegalArgumentException e) {
                if (warn) {
                    log.warning(LintCategory.PATH, Warnings.InvalidPath(s));
                }
            }
        }
    }
    return entries;
}
 
Example #8
Source File: ClassReader.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
protected boolean accepts(AttributeKind kind) {
    if (kinds.contains(kind)) {
        if (majorVersion > version.major || (majorVersion == version.major && minorVersion >= version.minor))
            return true;

        if (lintClassfile && !warnedAttrs.contains(name)) {
            JavaFileObject prev = log.useSource(currentClassFile);
            try {
                log.warning(LintCategory.CLASSFILE, (DiagnosticPosition) null,
                            Warnings.FutureAttr(name, version.major, version.minor, majorVersion, minorVersion));
            } finally {
                log.useSource(prev);
            }
            warnedAttrs.add(name);
        }
    }
    return false;
}
 
Example #9
Source File: JavacProcessingEnvironment.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Convert import-style string for supported annotations into a
 * regex matching that string.  If the string is not a valid
 * import-style string, return a regex that won't match anything.
 */
private static Pattern importStringToPattern(boolean allowModules, String s, Processor p, Log log) {
    String module;
    String pkg;
    int slash = s.indexOf('/');
    if (slash == (-1)) {
        if (s.equals("*")) {
            return MatchingUtils.validImportStringToPattern(s);
        }
        module = allowModules ? ".*/" : "";
        pkg = s;
    } else {
        module = Pattern.quote(s.substring(0, slash + 1));
        pkg = s.substring(slash + 1);
    }
    if (MatchingUtils.isValidImportString(pkg)) {
        return Pattern.compile(module + MatchingUtils.validImportStringToPatternString(pkg));
    } else {
        log.warning(Warnings.ProcMalformedSupportedString(s, p.getClass().getName()));
        return noMatches; // won't match any valid identifier
    }
}
 
Example #10
Source File: Check.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void checkPackageExistsForOpens(final DiagnosticPosition pos, PackageSymbol packge) {
    if (packge.members().isEmpty() &&
        ((packge.flags() & Flags.HAS_RESOURCE) == 0)) {
        deferredLintHandler.report(() -> {
            if (lint.isEnabled(LintCategory.OPENS))
                log.warning(pos, Warnings.PackageEmptyOrNotFound(packge));
        });
    }
}
 
Example #11
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Check that an auxiliary class is not accessed from any other file than its own.
 */
void checkForBadAuxiliaryClassAccess(DiagnosticPosition pos, Env<AttrContext> env, ClassSymbol c) {
    if (lint.isEnabled(Lint.LintCategory.AUXILIARYCLASS) &&
        (c.flags() & AUXILIARY) != 0 &&
        rs.isAccessible(env, c) &&
        !fileManager.isSameFile(c.sourcefile, env.toplevel.sourcefile))
    {
        log.warning(pos,
                    Warnings.AuxiliaryClassAccessedFromOutsideOfItsSourceFile(c, c.sourcefile));
    }
}
 
Example #12
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void checkVisible(DiagnosticPosition pos, Symbol what, PackageSymbol inPackage, boolean inSuperType) {
    if (!isAPISymbol(what) && !inSuperType) { //package private/private element
        log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessible(kindName(what), what, what.packge().modle));
        return ;
    }

    PackageSymbol whatPackage = what.packge();
    ExportsDirective whatExport = findExport(whatPackage);
    ExportsDirective inExport = findExport(inPackage);

    if (whatExport == null) { //package not exported:
        log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleUnexported(kindName(what), what, what.packge().modle));
        return ;
    }

    if (whatExport.modules != null) {
        if (inExport.modules == null || !whatExport.modules.containsAll(inExport.modules)) {
            log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleUnexportedQualified(kindName(what), what, what.packge().modle));
        }
    }

    if (whatPackage.modle != inPackage.modle && whatPackage.modle != syms.java_base) {
        //check that relativeTo.modle requires transitive what.modle, somehow:
        List<ModuleSymbol> todo = List.of(inPackage.modle);

        while (todo.nonEmpty()) {
            ModuleSymbol current = todo.head;
            todo = todo.tail;
            if (current == whatPackage.modle)
                return ; //OK
            for (RequiresDirective req : current.requires) {
                if (req.isTransitive()) {
                    todo = todo.prepend(req.module);
                }
            }
        }

        log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleNotRequiredTransitive(kindName(what), what, what.packge().modle));
    }
}
 
Example #13
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void checkModuleExists(final DiagnosticPosition pos, ModuleSymbol msym) {
    if (msym.kind != MDL) {
        deferredLintHandler.report(() -> {
            if (lint.isEnabled(LintCategory.MODULE))
                log.warning(LintCategory.MODULE, pos, Warnings.ModuleNotFound(msym));
        });
    }
}
 
Example #14
Source File: Modules.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isKnownModule(ModuleSymbol msym, Set<ModuleSymbol> unknownModules) {
    if (allModules.contains(msym)) {
        return true;
    }

    if (!unknownModules.contains(msym)) {
        if (lintOptions) {
            log.warning(LintCategory.OPTIONS,
                    Warnings.ModuleForOptionNotFound(Option.ADD_EXPORTS, msym));
        }
        unknownModules.add(msym);
    }
    return false;
}
 
Example #15
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void checkPackageExistsForOpens(final DiagnosticPosition pos, PackageSymbol packge) {
    if (packge.members().isEmpty() &&
        ((packge.flags() & Flags.HAS_RESOURCE) == 0)) {
        deferredLintHandler.report(() -> {
            if (lint.isEnabled(LintCategory.OPENS))
                log.warning(pos, Warnings.PackageEmptyOrNotFound(packge));
        });
    }
}
 
Example #16
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void checkModuleRequires(final DiagnosticPosition pos, final RequiresDirective rd) {
    if ((rd.module.flags() & Flags.AUTOMATIC_MODULE) != 0) {
        deferredLintHandler.report(() -> {
            if (rd.isTransitive() && lint.isEnabled(LintCategory.REQUIRES_TRANSITIVE_AUTOMATIC)) {
                log.warning(pos, Warnings.RequiresTransitiveAutomatic);
            } else if (lint.isEnabled(LintCategory.REQUIRES_AUTOMATIC)) {
                log.warning(pos, Warnings.RequiresAutomatic);
            }
        });
    }
}
 
Example #17
Source File: Check.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void checkModuleRequires(final DiagnosticPosition pos, final RequiresDirective rd) {
    if ((rd.module.flags() & Flags.AUTOMATIC_MODULE) != 0) {
        deferredLintHandler.report(() -> {
            if (rd.isTransitive() && lint.isEnabled(LintCategory.REQUIRES_TRANSITIVE_AUTOMATIC)) {
                log.warning(pos, Warnings.RequiresTransitiveAutomatic);
            } else if (lint.isEnabled(LintCategory.REQUIRES_AUTOMATIC)) {
                log.warning(pos, Warnings.RequiresAutomatic);
            }
        });
    }
}
 
Example #18
Source File: Analyzer.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
void process (JCMethodInvocation oldTree, JCMethodInvocation newTree, boolean hasErrors){
    if (!hasErrors) {
        //exact match
        log.warning(oldTree, Warnings.MethodRedundantTypeargs);
    }
}
 
Example #19
Source File: Check.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void checkModuleExists(final DiagnosticPosition pos, ModuleSymbol msym) {
    if (msym.kind != MDL) {
        deferredLintHandler.report(() -> {
            if (lint.isEnabled(LintCategory.MODULE))
                log.warning(LintCategory.MODULE, pos, Warnings.ModuleNotFound(msym));
        });
    }
}
 
Example #20
Source File: Analyzer.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Analyze results of local variable inference.
 */
void processVar(JCVariableDecl oldTree, JCVariableDecl newTree, boolean hasErrors) {
    if (!hasErrors) {
        if (types.isSameType(oldTree.type, newTree.type)) {
            log.warning(oldTree, Warnings.LocalRedundantType);
        }
    }
}
 
Example #21
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void checkSunAPI(final DiagnosticPosition pos, final Symbol s) {
    if ((s.flags() & PROPRIETARY) != 0) {
        deferredLintHandler.report(() -> {
            log.mandatoryWarning(pos, Warnings.SunProprietary(s));
        });
    }
}
 
Example #22
Source File: Check.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkVisible(DiagnosticPosition pos, Symbol what, PackageSymbol inPackage, boolean inSuperType) {
    if (!isAPISymbol(what) && !inSuperType) { //package private/private element
        log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessible(kindName(what), what, what.packge().modle));
        return ;
    }

    PackageSymbol whatPackage = what.packge();
    ExportsDirective whatExport = findExport(whatPackage);
    ExportsDirective inExport = findExport(inPackage);

    if (whatExport == null) { //package not exported:
        log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleUnexported(kindName(what), what, what.packge().modle));
        return ;
    }

    if (whatExport.modules != null) {
        if (inExport.modules == null || !whatExport.modules.containsAll(inExport.modules)) {
            log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleUnexportedQualified(kindName(what), what, what.packge().modle));
        }
    }

    if (whatPackage.modle != inPackage.modle && whatPackage.modle != syms.java_base) {
        //check that relativeTo.modle requires transitive what.modle, somehow:
        List<ModuleSymbol> todo = List.of(inPackage.modle);

        while (todo.nonEmpty()) {
            ModuleSymbol current = todo.head;
            todo = todo.tail;
            if (current == whatPackage.modle)
                return ; //OK
            for (RequiresDirective req : current.requires) {
                if (req.isTransitive()) {
                    todo = todo.prepend(req.module);
                }
            }
        }

        log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleNotRequiredTransitive(kindName(what), what, what.packge().modle));
    }
}
 
Example #23
Source File: Modules.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private boolean isKnownModule(ModuleSymbol msym, Set<ModuleSymbol> unknownModules) {
    if (allModules.contains(msym)) {
        return true;
    }

    if (!unknownModules.contains(msym)) {
        if (lintOptions) {
            log.warning(LintCategory.OPTIONS,
                    Warnings.ModuleForOptionNotFound(Option.ADD_EXPORTS, msym));
        }
        unknownModules.add(msym);
    }
    return false;
}
 
Example #24
Source File: Arguments.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void validateAddReads(SourceVersion sv) {
    String addReads = options.get(Option.ADD_READS);
    if (addReads != null) {
        // Each entry must be of the form source=target-list where target-list is a
        // comma-separated list of module or ALL-UNNAMED.
        // Empty items in the target list are ignored.
        // There must be at least one item in the list; this is handled in Option.ADD_READS.
        Pattern p = Option.ADD_READS.getPattern();
        for (String e : addReads.split("\0")) {
            Matcher m = p.matcher(e);
            if (m.matches()) {
                String sourceName = m.group(1);
                if (!SourceVersion.isName(sourceName, sv)) {
                    // syntactically invalid source name:  e.g. --add-reads m!=m2
                    log.warning(Warnings.BadNameForOption(Option.ADD_READS, sourceName));
                }

                String targetNames = m.group(2);
                for (String targetName : targetNames.split(",", -1)) {
                    switch (targetName) {
                        case "":
                        case "ALL-UNNAMED":
                            break;

                        default:
                            if (!SourceVersion.isName(targetName, sv)) {
                                // syntactically invalid target name:  e.g. --add-reads m1=m!
                                log.warning(Warnings.BadNameForOption(Option.ADD_READS, targetName));
                            }
                            break;
                    }
                }
            }
        }
    }
}
 
Example #25
Source File: Check.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void checkModuleName (JCModuleDecl tree) {
    Name moduleName = tree.sym.name;
    Assert.checkNonNull(moduleName);
    if (lint.isEnabled(LintCategory.MODULE)) {
        JCExpression qualId = tree.qualId;
        while (qualId != null) {
            Name componentName;
            DiagnosticPosition pos;
            switch (qualId.getTag()) {
                case SELECT:
                    JCFieldAccess selectNode = ((JCFieldAccess) qualId);
                    componentName = selectNode.name;
                    pos = selectNode.pos();
                    qualId = selectNode.selected;
                    break;
                case IDENT:
                    componentName = ((JCIdent) qualId).name;
                    pos = qualId.pos();
                    qualId = null;
                    break;
                default:
                    throw new AssertionError("Unexpected qualified identifier: " + qualId.toString());
            }
            if (componentName != null) {
                String moduleNameComponentString = componentName.toString();
                int nameLength = moduleNameComponentString.length();
                if (nameLength > 0 && Character.isDigit(moduleNameComponentString.charAt(nameLength - 1))) {
                    log.warning(Lint.LintCategory.MODULE, pos, Warnings.PoorChoiceForModuleName(componentName));
                }
            }
        }
    }
}
 
Example #26
Source File: Locations.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void addFile(File file, boolean warn) {
    if (contains(file)) {
        // discard duplicates
        return;
    }

    if (!fsInfo.exists(file)) {
        /* No such file or directory exists */
        if (warn) {
            log.warning(Lint.LintCategory.PATH,
                    Warnings.PathElementNotFound(file));
        }
        super.add(file);
        return;
    }

    File canonFile = fsInfo.getCanonicalFile(file);
    if (canonicalValues.contains(canonFile)) {
        /* Discard duplicates and avoid infinite recursion */
        return;
    }


    /* Now what we have left is either a directory or a file name
     conforming to archive naming convention */
    super.add(file);
    canonicalValues.add(canonFile);

    if (expandJarClassPaths && fsInfo.isFile(file) ) {
        addJarClassPath(file, warn);
    }
}
 
Example #27
Source File: Arguments.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void validateAddReads(SourceVersion sv) {
    String addReads = options.get(Option.ADD_READS);
    if (addReads != null) {
        // Each entry must be of the form source=target-list where target-list is a
        // comma-separated list of module or ALL-UNNAMED.
        // Empty items in the target list are ignored.
        // There must be at least one item in the list; this is handled in Option.ADD_READS.
        Pattern p = Option.ADD_READS.getPattern();
        for (String e : addReads.split("\0")) {
            Matcher m = p.matcher(e);
            if (m.matches()) {
                String sourceName = m.group(1);
                if (!SourceVersion.isName(sourceName, sv)) {
                    // syntactically invalid source name:  e.g. --add-reads m!=m2
                    log.warning(Warnings.BadNameForOption(Option.ADD_READS, sourceName));
                }

                String targetNames = m.group(2);
                for (String targetName : targetNames.split(",", -1)) {
                    switch (targetName) {
                        case "":
                        case "ALL-UNNAMED":
                            break;

                        default:
                            if (!SourceVersion.isName(targetName, sv)) {
                                // syntactically invalid target name:  e.g. --add-reads m1=m!
                                log.warning(Warnings.BadNameForOption(Option.ADD_READS, targetName));
                            }
                            break;
                    }
                }
            }
        }
    }
}
 
Example #28
Source File: JavaCompiler.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void reportDeferredDiagnostics() {
    if (errorCount() == 0
            && annotationProcessingOccurred
            && implicitSourceFilesRead
            && implicitSourcePolicy == ImplicitSourcePolicy.UNSET) {
        if (explicitAnnotationProcessingRequested())
            log.warning(Warnings.ProcUseImplicit);
        else
            log.warning(Warnings.ProcUseProcOrImplicit);
    }
    chk.reportDeferredDiagnostics();
    if (log.compressedOutput) {
        log.mandatoryNote(null, Notes.CompressedDiags);
    }
}
 
Example #29
Source File: CRTable.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Source file positions in CRT are integers in the format:
*  {@literal line-number << LINESHIFT + column-number }
*/
private int encodePosition(int pos, Position.LineMap lineMap, Log log) {
    int line = lineMap.getLineNumber(pos);
    int col = lineMap.getColumnNumber(pos);
    int new_pos = Position.encodePosition(line, col);
    if (crtDebug) {
        System.out.println(", line = " + line + ", column = " + col +
                           ", new_pos = " + new_pos);
    }
    if (new_pos == Position.NOPOS)
        log.warning(pos, Warnings.PositionOverflow(line));

   return new_pos;
}
 
Example #30
Source File: JavacProcessingEnvironment.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Checks whether or not a processor's source version is
 * compatible with the compilation source version.  The
 * processor's source version needs to be greater than or
 * equal to the source version of the compile.
 */
private void checkSourceVersionCompatibility(Source source, Log log) {
    SourceVersion procSourceVersion = processor.getSupportedSourceVersion();

    if (procSourceVersion.compareTo(Source.toSourceVersion(source)) < 0 )  {
        log.warning(Warnings.ProcProcessorIncompatibleSourceVersion(procSourceVersion,
                                                                    processor.getClass().getName(),
                                                                    source.name));
    }
}