use of org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration in project lombok by rzwitserloot.
the class PatchExtensionMethod method getTypeNode.
public static EclipseNode getTypeNode(TypeDeclaration decl) {
CompilationUnitDeclaration cud = decl.scope.compilationUnitScope().referenceContext;
EclipseAST astNode = TransformEclipseAST.getAST(cud, false);
EclipseNode node = astNode.get(decl);
if (node == null) {
astNode = TransformEclipseAST.getAST(cud, true);
node = astNode.get(decl);
}
return node;
}
use of org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration in project webpieces by deanhiller.
the class CompilerWrapper method compile.
/**
* Please compile this className
*/
@SuppressWarnings("deprecation")
public void compile(String[] classNames, ClassDefinitionLoader loader) {
ICompilationUnit[] compilationUnits = new CompilationUnit[classNames.length];
for (int i = 0; i < classNames.length; i++) {
compilationUnits[i] = new CompilationUnit(classNames[i]);
}
IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.exitOnFirstError();
IProblemFactory problemFactory = new DefaultProblemFactory(Locale.ENGLISH);
/**
* To find types ...
*/
INameEnvironment nameEnvironment = new INameEnvironmentImpl(loader);
/**
* Compilation result
*/
ICompilerRequestor compilerRequestor = new ICompilerRequestorImpl();
/**
* The JDT compiler
*/
Compiler jdtCompiler = new Compiler(nameEnvironment, policy, settings, compilerRequestor, problemFactory) {
@Override
protected void handleInternalException(Throwable e, CompilationUnitDeclaration ud, CompilationResult result) {
}
};
// Go !
jdtCompiler.compile(compilationUnits);
}
Aggregations