当前位置: 首页>>代码示例>>Java>>正文


Java CompilationResult.hasErrors方法代码示例

本文整理汇总了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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:GreclipseMain.java

示例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());
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:41,代码来源:JRJdtCompiler.java

示例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);
			}
		}
	}
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:37,代码来源:ExtendedJRJdtCompiler.java

示例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());
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:60,代码来源:JRJdtCompiler.java


注:本文中的org.eclipse.jdt.internal.compiler.CompilationResult.hasErrors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。