本文整理汇总了Java中javax.tools.DiagnosticListener.report方法的典型用法代码示例。如果您正苦于以下问题:Java DiagnosticListener.report方法的具体用法?Java DiagnosticListener.report怎么用?Java DiagnosticListener.report使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.tools.DiagnosticListener
的用法示例。
在下文中一共展示了DiagnosticListener.report方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: report
import javax.tools.DiagnosticListener; //导入方法依赖的package包/类
void report( DiagnosticListener<JavaFileObject> errorHandler )
{
if( errorHandler == null )
{
return;
}
List<IIssue> issues = getIssues();
if( issues.isEmpty() )
{
return;
}
JavaFileObject file = new SourceJavaFileObject( getFile().toURI() );
for( IIssue issue : issues )
{
Diagnostic.Kind kind = issue.getKind() == IIssue.Kind.Error ? Diagnostic.Kind.ERROR : Diagnostic.Kind.WARNING;
errorHandler.report( new JavacDiagnostic( file, kind, issue.getStartOffset(), issue.getLine(), issue.getColumn(), issue.getMessage() ) );
}
}
示例2: warnIfDuplicate
import javax.tools.DiagnosticListener; //导入方法依赖的package包/类
private boolean warnIfDuplicate( AbstractSrcMethod method, SrcClass extendedType, DiagnosticListener<JavaFileObject> errorHandler, JavacTaskImpl javacTask )
{
AbstractSrcMethod duplicate = findMethod( method, extendedType, new JavacTaskImpl[]{javacTask} );
if( duplicate == null )
{
return false;
}
JavacElements elems = JavacElements.instance( javacTask.getContext() );
Symbol.ClassSymbol sym = elems.getTypeElement( ((SrcClass)method.getOwner()).getName() );
JavaFileObject file = sym.sourcefile;
SrcAnnotationExpression anno = duplicate.getAnnotation( ExtensionMethod.class );
if( anno != null )
{
errorHandler.report( new JavacDiagnostic( file.toUri().getScheme() == null ? null : new SourceJavaFileObject( file.toUri() ),
Diagnostic.Kind.WARNING, 0, 0, 0, ExtIssueMsg.MSG_EXTENSION_DUPLICATION.get( method.signature(), ((SrcClass)method.getOwner()).getName(), anno.getArgument( ExtensionMethod.extensionClass ).getValue()) ) );
}
else
{
errorHandler.report( new JavacDiagnostic( file.toUri().getScheme() == null ? null : new SourceJavaFileObject( file.toUri() ),
Diagnostic.Kind.WARNING, 0, 0, 0, ExtIssueMsg.MSG_EXTENSION_SHADOWS.get( method.signature(), ((SrcClass)method.getOwner()).getName(), extendedType.getName()) ) );
}
return true;
}
示例3: report
import javax.tools.DiagnosticListener; //导入方法依赖的package包/类
void report(DiagnosticListener errorHandler) {
if (_issues.isEmpty() || errorHandler == null) {
return;
}
JavaFileObject file = new SourceJavaFileObject(getFile().toURI());
for (IIssue issue : _issues.getIssues()) {
Diagnostic.Kind kind = issue.getKind() == IIssue.Kind.Error ? Diagnostic.Kind.ERROR : Diagnostic.Kind.WARNING;
errorHandler.report(new JavacDiagnostic(file, kind, issue.getStartOffset(), issue.getLine(), issue.getColumn(), issue.getMessage()));
}
}
示例4: report
import javax.tools.DiagnosticListener; //导入方法依赖的package包/类
void report( DiagnosticListener<JavaFileObject> errorHandler )
{
if( _issues == null || errorHandler == null )
{
return;
}
JavaFileObject file = new SourceJavaFileObject( getFile().toURI() );
for( IIssue issue : _issues.getIssues() )
{
Diagnostic.Kind kind = issue.getKind() == IIssue.Kind.Error ? Diagnostic.Kind.ERROR : Diagnostic.Kind.WARNING;
errorHandler.report( new JavacDiagnostic( file, kind, issue.getStartOffset(), issue.getLine(), issue.getColumn(), issue.getMessage() ) );
}
}
示例5: reportErrors
import javax.tools.DiagnosticListener; //导入方法依赖的package包/类
private void reportErrors( DiagnosticListener<JavaFileObject> errorHandler, ProgramNode programNode )
{
if( programNode.errorCount() > 0 )
{
JavaFileObject file = new SourceJavaFileObject( _file.toURI() );
for( ParseError error : programNode.getErrorList() )
{
Token token = error.getToken();
errorHandler.report( new JavacDiagnostic( file, Diagnostic.Kind.ERROR, token.getOffset(), token.getLineNumber(), token.getCol(), error.getMessage() ) );
}
}
}