本文整理匯總了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() ) );
}
}
}