當前位置: 首頁>>代碼示例>>Java>>正文


Java DiagnosticListener.report方法代碼示例

本文整理匯總了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() ) );
  }
}
 
開發者ID:manifold-systems,項目名稱:manifold,代碼行數:21,代碼來源:JsonModel.java

示例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;
}
 
開發者ID:manifold-systems,項目名稱:manifold,代碼行數:26,代碼來源:ExtCodeGen.java

示例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()));
    }
}
 
開發者ID:manifold-systems,項目名稱:manifold,代碼行數:12,代碼來源:TemplateModel.java

示例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() ) );
  }
}
 
開發者ID:manifold-systems,項目名稱:manifold,代碼行數:15,代碼來源:Model.java

示例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() ) );
    }
  }
}
 
開發者ID:manifold-systems,項目名稱:manifold,代碼行數:13,代碼來源:JavascriptCodeGen.java


注:本文中的javax.tools.DiagnosticListener.report方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。