Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to get the compilation unit produced by the compiler
How to get the compilation unit produced by the compiler [message #830403] Tue, 27 March 2012 15:24 Go to next message
Fabrice Marcelin is currently offline Fabrice MarcelinFriend
Messages: 15
Registered: February 2011
Location: USA
Junior Member

Hello there,

Instead of creating a compilation unit from AST, I was wondering if it is possible to get a hold on the compilation unit that the compiler produced.

Thanks in advance.
Re: How to get the compilation unit produced by the compiler [message #830928 is a reply to message #830403] Wed, 28 March 2012 08:30 Go to previous message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
The compilation unit that compiler produced is internal and it is exposed outside through the DOM/AST. Here are some internal ways to get hold of the internal CompilationUnit.
- If you use setResolveBindings(true) while creating the AST, the references to the internal CompilationUnit is still kept at DefaultBindingResolver#newAstToOldAst.
- Look at org.eclipse.jdt.internal.compiler.Compiler.compile(ICompilationUnit[]) and it's references and see if you want to call directly.
Note that internal types/methods are liable to change which could break your code.

Previous Topic:Move refactoring programmatically
Next Topic:Eclipse's rename refactoring in code
Goto Forum:
  


Current Time: Mon Dec 29 00:26:15 GMT 2014

Powered by FUDForum. Page generated in 0.06829 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software