<s> package org . eclipse . jdt . internal . compiler . problem ; import org . eclipse . jdt . core . compiler . CategorizedProblem ; import org . eclipse . jdt . core . compiler . CharOperation ; import org . eclipse . jdt . internal . compiler . CompilationResult ; import org . eclipse . jdt . internal . compiler . IErrorHandlingPolicy ; import org . eclipse . jdt . internal . compiler . IProblemFactory ; import org . eclipse . jdt . internal . compiler . impl . CompilerOptions ; import org . eclipse . jdt . internal . compiler . impl . ReferenceContext ; import org . eclipse . jdt . internal . compiler . util . Util ; import org . eclipse . jdt . internal . core . builder . SourceFile ; public class ProblemHandler { public final static String [ ] NoArgument = CharOperation . NO_STRINGS ; final public IErrorHandlingPolicy policy ; public final IProblemFactory problemFactory ; public final CompilerOptions options ; public ProblemHandler ( IErrorHandlingPolicy policy , CompilerOptions options , IProblemFactory problemFactory ) { this . policy = policy ; this . problemFactory = problemFactory ; this . options = options ; } public int computeSeverity ( int problemId ) { return ProblemSeverities . Error ; } public CategorizedProblem createProblem ( char [ ] fileName , int problemId , String [ ] problemArguments , String [ ] messageArguments , int severity , int problemStartPosition , int problemEndPosition , int lineNumber , int columnNumber ) { return this . problemFactory . createProblem ( fileName , problemId , problemArguments , messageArguments , severity , problemStartPosition , problemEndPosition , lineNumber , columnNumber ) ; } public CategorizedProblem createProblem ( char [ ] fileName , int problemId , String [ ] problemArguments , int elaborationId , String [ ] messageArguments , int severity , int problemStartPosition , int problemEndPosition , int lineNumber , int columnNumber ) { return this . problemFactory . createProblem ( fileName , problemId , problemArguments , elaborationId , messageArguments , severity , problemStartPosition , problemEndPosition , lineNumber , columnNumber ) ; } public void handle ( int problemId , String [ ] problemArguments , int elaborationId , String [ ] messageArguments , int severity , int problemStartPosition , int problemEndPosition , ReferenceContext referenceContext , CompilationResult unitResult ) { if ( severity == ProblemSeverities . Ignore ) return ; if ( referenceContext == null ) { if ( ( severity & ProblemSeverities . Error ) != 0 ) { CategorizedProblem problem = this . createProblem ( null , problemId , problemArguments , elaborationId , messageArguments , severity , 0 , 0 , 0 , 0 ) ; throw new AbortCompilation ( null , problem ) ; } else { return ; } } int [ ] lineEnds ; int lineNumber = problemStartPosition >= 0 ? Util . getLineNumber ( problemStartPosition , lineEnds = unitResult . getLineSeparatorPositions ( ) , 0 , lineEnds . length - 1 ) : 0 ; int columnNumber = problemStartPosition >= 0 ? Util . searchColumnNumber ( unitResult . getLineSeparatorPositions ( ) , lineNumber , problemStartPosition ) : 0 ; CategorizedProblem problem = this . createProblem ( unitResult . getFileName ( ) , problemId , problemArguments , elaborationId , messageArguments , severity , problemStartPosition , problemEndPosition , lineNumber , columnNumber ) ; if ( problem == null ) return ; switch ( severity & ProblemSeverities . Error ) { case ProblemSeverities . Error : record ( problem , unitResult , referenceContext ) ; if ( ( severity & ProblemSeverities . Fatal ) != 0 ) { referenceContext . tagAsHavingErrors ( ) ; int abortLevel ; if ( ( abortLevel = this . policy . stopOnFirstError ( ) ? ProblemSeverities . AbortCompilation : severity & ProblemSeverities . Abort ) != 0 ) { referenceContext . abort ( abortLevel , problem ) ; } } break ; case ProblemSeverities . Warning : if ( ( this . options . groovyFlags & 0x01 ) != 0 ) { if ( ( unitResult . compilationUnit instanceof SourceFile ) && ( ( SourceFile ) unitResult . compilationUnit ) . isInLinkedSourceFolder ( ) ) { return ; } } record ( problem , unitResult , referenceContext ) ; break ; } } public void handle ( int problemId , String [ ] problemArguments , String [ ] messageArguments , int problemStartPosition , int problemEndPosition , ReferenceContext referenceContext , CompilationResult unitResult ) { this . handle ( problemId , problemArguments , 0 , messageArguments , computeSeverity ( problemId ) , problemStartPosition , problemEndPosition , referenceContext , unitResult ) ; } public void record ( CategorizedProblem problem , CompilationResult unitResult , ReferenceContext referenceContext ) { unitResult . record ( problem , referenceContext ) ; } public void record ( CategorizedProblem problem , CompilationResult unitResult , ReferenceContext referenceContext , boolean b ) { record ( problem , unitResult , referenceContext ) ; } } </s>