Java Code Examples for com.sun.tools.javac.util.Log#warning()

The following examples show how to use com.sun.tools.javac.util.Log#warning() . 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: JavacProcessingEnvironment.java    From openjdk-jdk9 with GNU General Public License v2.0 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("proc.malformed.supported.string", s, p.getClass().getName());
        return noMatches; // won't match any valid identifier
    }
}
 
Example 2
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 3
Source File: JavacProcessingEnvironment.java    From openjdk-8 with GNU General Public License v2.0 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("proc.processor.incompatible.source.version",
                    procSourceVersion,
                    processor.getClass().getName(),
                    source.name);
    }
}
 
Example 4
Source File: JavacProcessingEnvironment.java    From TencentKona-8 with GNU General Public License v2.0 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("proc.processor.incompatible.source.version",
                    procSourceVersion,
                    processor.getClass().getName(),
                    source.name);
    }
}
 
Example 5
Source File: JavacProcessingEnvironment.java    From openjdk-8-source with GNU General Public License v2.0 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("proc.processor.incompatible.source.version",
                    procSourceVersion,
                    processor.getClass().getName(),
                    source.name);
    }
}
 
Example 6
Source File: JavaDynamicJdk_8.java    From manifold with Apache License 2.0 5 votes vote down vote up
@Override
public <T> void report( Log issueLogger, Diagnostic<? extends T> diagnostic )
{
  // Adapted from JavacMessager.printMessage.  Following same basic routine regarding use of Log

  JavaFileObject oldSource = issueLogger.useSource( (JavaFileObject)diagnostic.getSource() );
  boolean oldMultipleErrors = issueLogger.multipleErrors;
  issueLogger.multipleErrors = true;
  try
  {
    switch( diagnostic.getKind() )
    {
      case ERROR:
        issueLogger.error( new IssueReporter.Position( diagnostic ), "proc.messager", diagnostic.getMessage( Locale.getDefault() ) );
        break;
      case WARNING:
        issueLogger.warning( new IssueReporter.Position( diagnostic ), "proc.messager", diagnostic.getMessage( Locale.getDefault() ) );
        break;
      case MANDATORY_WARNING:
        issueLogger.mandatoryWarning( new IssueReporter.Position( diagnostic ), "proc.messager", diagnostic.getMessage( Locale.getDefault() ) );
        break;
      case NOTE:
      case OTHER:
        issueLogger.note( new IssueReporter.Position( diagnostic ), "proc.messager", diagnostic.getMessage( Locale.getDefault() ) );
        break;
    }
  }
  finally
  {
    issueLogger.useSource( oldSource );
    issueLogger.multipleErrors = oldMultipleErrors;
  }
}
 
Example 7
Source File: JavacProcessingEnvironment.java    From openjdk-jdk9 with GNU General Public License v2.0 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("proc.processor.incompatible.source.version",
                    procSourceVersion,
                    processor.getClass().getName(),
                    source.name);
    }
}
 
Example 8
Source File: JavacProcessingEnvironment.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Convert import-style string for supported annotations into a
 * regex matching that string.  If the string is a valid
 * import-style string, return a regex that won't match anything.
 */
private static Pattern importStringToPattern(String s, Processor p, Log log) {
    if (isValidImportString(s)) {
        return validImportStringToPattern(s);
    } else {
        log.warning("proc.malformed.supported.string", s, p.getClass().getName());
        return noMatches; // won't match any valid identifier
    }
}
 
Example 9
Source File: JavacProcessingEnvironment.java    From javaide with GNU General Public License v3.0 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("proc.processor.incompatible.source.version",
                    procSourceVersion,
                    processor.getClass().getName(),
                    source.name);
    }
}
 
Example 10
Source File: JavacProcessingEnvironment.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert import-style string for supported annotations into a
 * regex matching that string.  If the string is a valid
 * import-style string, return a regex that won't match anything.
 */
private static Pattern importStringToPattern(String s, Processor p, Log log) {
    if (isValidImportString(s)) {
        return validImportStringToPattern(s);
    } else {
        log.warning("proc.malformed.supported.string", s, p.getClass().getName());
        return noMatches; // won't match any valid identifier
    }
}
 
Example 11
Source File: JavacProcessingEnvironment.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 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("proc.processor.incompatible.source.version",
                    procSourceVersion,
                    processor.getClass().getName(),
                    source.name);
    }
}
 
Example 12
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));
    }
}
 
Example 13
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 14
Source File: JavacProcessingEnvironment.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert import-style string for supported annotations into a
 * regex matching that string.  If the string is a valid
 * import-style string, return a regex that won't match anything.
 */
private static Pattern importStringToPattern(String s, Processor p, Log log) {
    if (isValidImportString(s)) {
        return validImportStringToPattern(s);
    } else {
        log.warning("proc.malformed.supported.string", s, p.getClass().getName());
        return noMatches; // won't match any valid identifier
    }
}
 
Example 15
Source File: JavacProcessingEnvironment.java    From openjdk-jdk8u with GNU General Public License v2.0 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("proc.processor.incompatible.source.version",
                    procSourceVersion,
                    processor.getClass().getName(),
                    source.name);
    }
}
 
Example 16
Source File: JavacProcessingEnvironment.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Convert import-style string for supported annotations into a
 * regex matching that string.  If the string is a valid
 * import-style string, return a regex that won't match anything.
 */
private static Pattern importStringToPattern(String s, Processor p, Log log) {
    if (isValidImportString(s)) {
        return validImportStringToPattern(s);
    } else {
        log.warning("proc.malformed.supported.string", s, p.getClass().getName());
        return noMatches; // won't match any valid identifier
    }
}
 
Example 17
Source File: JavacProcessingEnvironment.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert import-style string for supported annotations into a
 * regex matching that string.  If the string is a valid
 * import-style string, return a regex that won't match anything.
 */
private static Pattern importStringToPattern(String s, Processor p, Log log) {
    if (isValidImportString(s)) {
        return validImportStringToPattern(s);
    } else {
        log.warning("proc.malformed.supported.string", s, p.getClass().getName());
        return noMatches; // won't match any valid identifier
    }
}
 
Example 18
Source File: JavacProcessingEnvironment.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert import-style string for supported annotations into a
 * regex matching that string.  If the string is a valid
 * import-style string, return a regex that won't match anything.
 */
private static Pattern importStringToPattern(String s, Processor p, Log log) {
    if (isValidImportString(s)) {
        return validImportStringToPattern(s);
    } else {
        log.warning("proc.malformed.supported.string", s, p.getClass().getName());
        return noMatches; // won't match any valid identifier
    }
}
 
Example 19
Source File: JavacProcessingEnvironment.java    From jdk8u60 with GNU General Public License v2.0 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("proc.processor.incompatible.source.version",
                    procSourceVersion,
                    processor.getClass().getName(),
                    source.name);
    }
}
 
Example 20
Source File: JavacProcessingEnvironment.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert import-style string for supported annotations into a
 * regex matching that string.  If the string is a valid
 * import-style string, return a regex that won't match anything.
 */
private static Pattern importStringToPattern(String s, Processor p, Log log) {
    if (isValidImportString(s)) {
        return validImportStringToPattern(s);
    } else {
        log.warning("proc.malformed.supported.string", s, p.getClass().getName());
        return noMatches; // won't match any valid identifier
    }
}