本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.hasErrors方法的典型用法代码示例。如果您正苦于以下问题:Java CompilationUnitDeclaration.hasErrors方法的具体用法?Java CompilationUnitDeclaration.hasErrors怎么用?Java CompilationUnitDeclaration.hasErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration
的用法示例。
在下文中一共展示了CompilationUnitDeclaration.hasErrors方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; //导入方法依赖的package包/类
@Override public ASTNode process(Source in, Void irrelevant) throws ConversionProblem {
CompilerOptions compilerOptions = ecjCompilerOptions();
Parser parser = new Parser(new ProblemReporter(
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
compilerOptions,
new DefaultProblemFactory()
), compilerOptions.parseLiteralExpressionsAsConstants);
parser.javadocParser.checkDocComment = true;
CompilationUnit sourceUnit = new CompilationUnit(in.getRawInput().toCharArray(), in.getName(), charset.name());
CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
if (cud.hasErrors()) {
throw new ConversionProblem(String.format("Can't read file %s due to parse error: %s", in.getName(), compilationResult.getErrors()[0]));
}
return cud;
}
示例2: parseWithLombok
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; //导入方法依赖的package包/类
@Override
protected ASTNode parseWithLombok(Source source) {
CompilerOptions compilerOptions = ecjCompilerOptions();
Parser parser = new Parser(new ProblemReporter(
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
compilerOptions,
new DefaultProblemFactory()
), compilerOptions.parseLiteralExpressionsAsConstants);
parser.javadocParser.checkDocComment = true;
CompilationUnit sourceUnit = new CompilationUnit(source.getRawInput().toCharArray(), source.getName(), "UTF-8");
CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
if (cud.hasErrors()) return null;
EcjTreeConverter converter = new EcjTreeConverter();
converter.visit(source.getRawInput(), cud);
Node lombokized = converter.get();
EcjTreeBuilder builder = new EcjTreeBuilder(source.getRawInput(), source.getName(), ecjCompilerOptions());
builder.visit(lombokized);
return builder.get();
}
示例3: parseWithTargetCompiler
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; //导入方法依赖的package包/类
@Override
protected ASTNode parseWithTargetCompiler(Source source) {
CompilerOptions compilerOptions = ecjCompilerOptions();
Parser parser = new Parser(new ProblemReporter(
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
compilerOptions,
new DefaultProblemFactory()
), compilerOptions.parseLiteralExpressionsAsConstants);
parser.javadocParser.checkDocComment = true;
CompilationUnit sourceUnit = new CompilationUnit(source.getRawInput().toCharArray(), source.getName(), "UTF-8");
CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
if (cud.hasErrors()) return null;
return cud;
}
示例4: parseWithTargetCompiler
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; //导入方法依赖的package包/类
@Override
protected ASTNode parseWithTargetCompiler(Source source) {
CompilerOptions compilerOptions = ecjCompilerOptions();
Parser parser = new Parser(new ProblemReporter(
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
compilerOptions,
new DefaultProblemFactory()
), compilerOptions.parseLiteralExpressionsAsConstants);
parser.javadocParser.checkDocComment = true;
CompilationUnit sourceUnit = new CompilationUnit(source.getRawInput().toCharArray(), source.getName(), "UTF-8");
CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
if (cud.hasErrors()) return null;
return cud;
}
示例5: parseWithTargetCompiler
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; //导入方法依赖的package包/类
protected Node parseWithTargetCompiler(Source source) {
CompilerOptions compilerOptions = ecjCompilerOptions();
Parser parser = new Parser(new ProblemReporter(
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
compilerOptions,
new DefaultProblemFactory()
), compilerOptions.parseLiteralExpressionsAsConstants);
parser.javadocParser.checkDocComment = true;
CompilationUnit sourceUnit = new CompilationUnit(source.getRawInput().toCharArray(), source.getName(), "UTF-8");
CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
if (cud.hasErrors()) return null;
EcjTreeConverter converter = new EcjTreeConverter();
converter.visit(source.getRawInput(), cud);
return converter.get();
}