当前位置: 首页>>代码示例>>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;未经允许,请勿转载。