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

The following examples show how to use com.sun.tools.javac.util.Log#error() . 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: SymbolMetadata.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private <T extends Attribute.Compound> T replaceOne(Placeholder<T> placeholder, Annotate.AnnotateRepeatedContext<T> ctx) {
    Log log = ctx.log;

    // Process repeated annotations
    T validRepeated = ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym);

    if (validRepeated != null) {
        // Check that the container isn't manually
        // present along with repeated instances of
        // its contained annotation.
        ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
        if (manualContainer != null) {
            log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present",
                    manualContainer.first().type.tsym);
        }
    }

    // A null return will delete the Placeholder
    return validRepeated;
}
 
Example 2
Source File: SymbolMetadata.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private <T extends Attribute.Compound> T replaceOne(Placeholder<T> placeholder, Annotate.AnnotateRepeatedContext<T> ctx) {
    Log log = ctx.log;

    // Process repeated annotations
    T validRepeated = ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym);

    if (validRepeated != null) {
        // Check that the container isn't manually
        // present along with repeated instances of
        // its contained annotation.
        ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
        if (manualContainer != null) {
            log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present",
                    manualContainer.first().type.tsym);
        }
    }

    // A null return will delete the Placeholder
    return validRepeated;
}
 
Example 3
Source File: SymbolMetadata.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private <T extends Attribute.Compound> T replaceOne(Placeholder<T> placeholder, Annotate.AnnotateRepeatedContext<T> ctx) {
    Log log = ctx.log;

    // Process repeated annotations
    T validRepeated = ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym);

    if (validRepeated != null) {
        // Check that the container isn't manually
        // present along with repeated instances of
        // its contained annotation.
        ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
        if (manualContainer != null) {
            log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present",
                    manualContainer.first().type.tsym);
        }
    }

    // A null return will delete the Placeholder
    return validRepeated;
}
 
Example 4
Source File: SymbolMetadata.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private <T extends Attribute.Compound> T replaceOne(Placeholder<T> placeholder, Annotate.AnnotateRepeatedContext<T> ctx) {
    Log log = ctx.log;

    // Process repeated annotations
    T validRepeated = ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym);

    if (validRepeated != null) {
        // Check that the container isn't manually
        // present along with repeated instances of
        // its contained annotation.
        ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
        if (manualContainer != null) {
            log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present",
                    manualContainer.first().type.tsym);
        }
    }

    // A null return will delete the Placeholder
    return validRepeated;
}
 
Example 5
Source File: SymbolMetadata.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private <T extends Attribute.Compound> T replaceOne(Placeholder<T> placeholder, Annotate.AnnotateRepeatedContext<T> ctx) {
    Log log = ctx.log;

    // Process repeated annotations
    T validRepeated = ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym);

    if (validRepeated != null) {
        // Check that the container isn't manually
        // present along with repeated instances of
        // its contained annotation.
        ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
        if (manualContainer != null) {
            log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present",
                    manualContainer.first().type.tsym);
        }
    }

    // A null return will delete the Placeholder
    return validRepeated;
}
 
Example 6
Source File: SymbolMetadata.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private <T extends Attribute.Compound> T replaceOne(Placeholder<T> placeholder, Annotate.AnnotateRepeatedContext<T> ctx) {
    Log log = ctx.log;

    // Process repeated annotations
    T validRepeated = ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym);

    if (validRepeated != null) {
        // Check that the container isn't manually
        // present along with repeated instances of
        // its contained annotation.
        ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
        if (manualContainer != null) {
            log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present",
                    manualContainer.first().type.tsym);
        }
    }

    // A null return will delete the Placeholder
    return validRepeated;
}
 
Example 7
Source File: JavacProcessingEnvironment.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean checkOptionName(String optionName, Log log) {
    boolean valid = isValidOptionName(optionName);
    if (!valid)
        log.error("proc.processor.bad.option.name",
                    optionName,
                    processor.getClass().getName());
    return valid;
}
 
Example 8
Source File: JavacProcessingEnvironment.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean checkOptionName(String optionName, Log log) {
    boolean valid = isValidOptionName(optionName);
    if (!valid)
        log.error("proc.processor.bad.option.name",
                    optionName,
                    processor.getClass().getName());
    return valid;
}
 
Example 9
Source File: JavacProcessingEnvironment.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private boolean checkOptionName(String optionName, Log log) {
    boolean valid = isValidOptionName(optionName);
    if (!valid)
        log.error("proc.processor.bad.option.name",
                    optionName,
                    processor.getClass().getName());
    return valid;
}
 
Example 10
Source File: JavacProcessingEnvironment.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
ServiceIterator(ClassLoader classLoader, Log log) {
    this.log = log;
    try {
        try {
            loader = ServiceLoader.load(Processor.class, classLoader);
            this.iterator = loader.iterator();
        } catch (Exception e) {
            // Fail softly if a loader is not actually needed.
            this.iterator = handleServiceLoaderUnavailability("proc.no.service", null);
        }
    } catch (Throwable t) {
        log.error("proc.service.problem");
        throw new Abort(t);
    }
}
 
Example 11
Source File: JavacProcessingEnvironment.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private boolean checkOptionName(String optionName, Log log) {
    boolean valid = isValidOptionName(optionName);
    if (!valid)
        log.error("proc.processor.bad.option.name",
                    optionName,
                    processor.getClass().getName());
    return valid;
}
 
Example 12
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 13
Source File: JavacProcessingEnvironment.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private boolean checkOptionName(String optionName, Log log) {
    boolean valid = isValidOptionName(optionName);
    if (!valid)
        log.error(Errors.ProcProcessorBadOptionName(optionName,
                                                    processor.getClass().getName()));
    return valid;
}
 
Example 14
Source File: JavacProcessingEnvironment.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private boolean checkOptionName(String optionName, Log log) {
    boolean valid = isValidOptionName(optionName);
    if (!valid)
        log.error("proc.processor.bad.option.name",
                    optionName,
                    processor.getClass().getName());
    return valid;
}
 
Example 15
Source File: JavacProcessingEnvironment.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
ServiceIterator(ClassLoader classLoader, Log log) {
    this.log = log;
    try {
        try {
            loader = ServiceLoader.load(Processor.class, classLoader);
            this.iterator = loader.iterator();
        } catch (Exception e) {
            // Fail softly if a loader is not actually needed.
            this.iterator = handleServiceLoaderUnavailability("proc.no.service", null);
        }
    } catch (Throwable t) {
        log.error("proc.service.problem");
        throw new Abort(t);
    }
}
 
Example 16
Source File: JavacProcessingEnvironment.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private boolean checkOptionName(String optionName, Log log) {
    boolean valid = isValidOptionName(optionName);
    if (!valid)
        log.error("proc.processor.bad.option.name",
                    optionName,
                    processor.getClass().getName());
    return valid;
}
 
Example 17
Source File: JavacProcessingEnvironment.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
ServiceIterator(ClassLoader classLoader, Log log) {
    this.log = log;
    try {
        try {
            loader = ServiceLoader.load(Processor.class, classLoader);
            this.iterator = loader.iterator();
        } catch (Exception e) {
            // Fail softly if a loader is not actually needed.
            this.iterator = handleServiceLoaderUnavailability("proc.no.service", null);
        }
    } catch (Throwable t) {
        log.error("proc.service.problem");
        throw new Abort(t);
    }
}
 
Example 18
Source File: JavacProcessingEnvironment.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private boolean checkOptionName(String optionName, Log log) {
    boolean valid = isValidOptionName(optionName);
    if (!valid)
        log.error("proc.processor.bad.option.name",
                    optionName,
                    processor.getClass().getName());
    return valid;
}
 
Example 19
Source File: JavacProcessingEnvironment.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean checkOptionName(String optionName, Log log) {
    boolean valid = isValidOptionName(optionName);
    if (!valid)
        log.error("proc.processor.bad.option.name",
                    optionName,
                    processor.getClass().getName());
    return valid;
}
 
Example 20
Source File: JavaDynamicJdk_8.java    From manifold with Apache License 2.0 4 votes vote down vote up
@Override
public void logError( Log logger, JCDiagnostic.DiagnosticPosition pos, String key, Object... args )
{
  logger.error( pos, key, args );
}