本文整理汇总了Java中org.eclipse.jdt.internal.compiler.CompilationResult.hasErrors方法的典型用法代码示例。如果您正苦于以下问题:Java CompilationResult.hasErrors方法的具体用法?Java CompilationResult.hasErrors怎么用?Java CompilationResult.hasErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.CompilationResult
的用法示例。
在下文中一共展示了CompilationResult.hasErrors方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: outputClassFiles
import org.eclipse.jdt.internal.compiler.CompilationResult; //导入方法依赖的package包/类
@Override
public void outputClassFiles(CompilationResult result) {
super.outputClassFiles(result);
if (result == null || result.hasErrors() && !proceedOnError) {
return;
}
List<String> classFiles = new ArrayList<String>();
for (ClassFile file : result.getClassFiles()) {
classFiles.add(new String(file.fileName()) + ".class");
}
myOutputs.put(new String(result.getFileName()), classFiles);
}
示例2: acceptResult
import org.eclipse.jdt.internal.compiler.CompilationResult; //导入方法依赖的package包/类
public void acceptResult(CompilationResult result) {
String className = ((CompilationUnit) result.getCompilationUnit()).className;
int classIdx;
for (classIdx = 0; classIdx < units.length; ++classIdx) {
if (className.equals(units[classIdx].getName())) {
break;
}
}
if (result.hasErrors()) {
// IProblem[] problems = result.getErrors();
IProblem[] problems = getJavaCompilationErrors(result);
unitResults[classIdx].problems = problems;
String sourceCode = units[classIdx].getSourceCode();
for (int i = 0; i < problems.length; i++) {
IProblem problem = problems[i];
if (IProblem.UndefinedMethod == problem.getID()) {
if (problem.getSourceStart() >= 0 && problem.getSourceEnd() >= 0) {
String methodName = sourceCode.substring(problem.getSourceStart(), problem.getSourceEnd() + 1);
Method method = FunctionsUtil.getInstance(jasperReportsContext).getMethod4Function(methodName);
if (method != null) {
unitResults[classIdx].addMissingMethod(method);
// continue;
}
}
}
}
} else {
ClassFile[] resultClassFiles = result.getClassFiles();
for (int i = 0; i < resultClassFiles.length; i++) {
units[classIdx].setCompileData(resultClassFiles[i].getBytes());
}
}
}
示例3: acceptResult
import org.eclipse.jdt.internal.compiler.CompilationResult; //导入方法依赖的package包/类
public void acceptResult(CompilationResult result)
{
super.acceptResult(result);
if (result.hasErrors())
{
String className = String.valueOf(result.getCompilationUnit().getMainTypeName());
JRCompilationUnit unit = null;
for (int classIdx = 0; classIdx < units.length; ++classIdx)
{
if (className.equals(units[classIdx].getName()))
{
unit = units[classIdx];
break;
}
}
IProblem[] errors = result.getErrors();
for (int i = 0; i < errors.length; i++)
{
IProblem problem = errors[i];
int line = problem.getSourceLineNumber();
JRCompilationSourceCode sourceCode = unit.getCompilationSource();
JRExpression expression = sourceCode.getExpressionAtLine(line);
if (expression == null)
{
getErrorHandler().addMarker( problem, null);
}
else if (addExpressionError(expression, problem))
{
SourceLocation location = getDigester().getLocation(expression);
getErrorHandler().addMarker(problem, expression, location);
}
}
}
}
示例4: acceptResult
import org.eclipse.jdt.internal.compiler.CompilationResult; //导入方法依赖的package包/类
@Override
public void acceptResult(CompilationResult result)
{
String className = ((CompilationUnit) result.getCompilationUnit()).className;
int classIdx;
for (classIdx = 0; classIdx < units.length; ++classIdx)
{
if (className.equals(units[classIdx].getName()))
{
break;
}
}
if (result.hasErrors())
{
//IProblem[] problems = result.getErrors();
IProblem[] problems = getJavaCompilationErrors(result);
unitResults[classIdx].problems = problems;
String sourceCode = units[classIdx].getSourceCode();
for (int i = 0; i < problems.length; i++)
{
IProblem problem = problems[i];
if (IProblem.UndefinedMethod == problem.getID())
{
if (
problem.getSourceStart() >= 0
&& problem.getSourceEnd() >= 0
)
{
String methodName =
sourceCode.substring(
problem.getSourceStart(),
problem.getSourceEnd() + 1
);
Method method = FunctionsUtil.getInstance(jasperReportsContext).getMethod4Function(methodName);
if (method != null)
{
unitResults[classIdx].addMissingMethod(method);
//continue;
}
}
}
}
}
else
{
ClassFile[] resultClassFiles = result.getClassFiles();
for (int i = 0; i < resultClassFiles.length; i++)
{
units[classIdx].setCompileData(resultClassFiles[i].getBytes());
}
}
}