Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Detect compilation errors after modifying AST
Detect compilation errors after modifying AST [message #257742] Thu, 11 December 2008 09:41 Go to next message
Eclipse UserFriend
Hi

I'm using ASTRewrite to modify the AST of a compilation unit. Before I
commit the changes I need to check whether they lead to new compilation
errors or not. I tried to create a new CompilationUnit by parsing the
modified source code and using the method getProblems() to retrieve
compilation errors. But the returned array is always empty (I guess that
is because the bindings can not be resolved).

Can anybody please help? It is quite urgent.

Thank you very much!

sonja
Re: Detect compilation errors after modifying AST [message #257767 is a reply to message #257742] Thu, 11 December 2008 20:20 Go to previous messageGo to next message
Eclipse UserFriend
Sonja Oberst wrote:
> Hi
>
> I'm using ASTRewrite to modify the AST of a compilation unit. Before I
> commit the changes I need to check whether they lead to new compilation
> errors or not. I tried to create a new CompilationUnit by parsing the
> modified source code and using the method getProblems() to retrieve
> compilation errors. But the returned array is always empty (I guess that
> is because the bindings can not be resolved).
>
> Can anybody please help? It is quite urgent.


I think to do what you want, you need to provide your own WorkingCopyOwner.

Take a look at how refactorings are done - the refactoring operations
need to solve the same problem you are trying to solve.
Re: Detect compilation errors after modifying AST [message #257802 is a reply to message #257767] Mon, 15 December 2008 16:26 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your answer. Could you point me to some example code?
Re: Detect compilation errors after modifying AST [message #257849 is a reply to message #257802] Thu, 18 December 2008 03:31 Go to previous message
Eclipse UserFriend
"Sonja Oberst" <soob@gmx.ch> wrote in message
news:a2bbd940cad2371d9a7a2bb4c6ab22b1$1@www.eclipse.org...
> Thanks for your answer. Could you point me to some example code?

Well, I would start in the org.eclipse.jdt.internal.corext.refactoring.*
packages, in the source code of org.eclipse.jdt.ui. I'm sorry I can't be
more specific - I am not very familiar with that code, I just have heard
that that's how they solved the problem there.
Previous Topic:APT processing on Local Variables (was Modeling Local Variables)
Next Topic:ExecutableElement#getReturnType() - always returns null
Goto Forum:
  


Current Time: Sat Apr 26 03:10:04 EDT 2025

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

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

Back to the top