Java Mailing List Archive

Home » eclipse-plugin-dev.groovy »

[groovy-eclipse-plugin-dev] Resolving ClassNode during incremental compilation

Krzysztof Białek


Replies: Find Java Web Hosting

Author LoginPost Reply

I am implementing AST transformation which is adding a subset of properties of class A to class B.
Technically class B is annotated with @CopyPropertiesFrom(A)
The transformation works well in complete project compilation where AST of class A is present when transforming class B
Unfortunately it does now work with greclipse incremental compiler (GGTS in my case).
Once class B is touched the incremental compiler starts and the transformation is triggered for class B.
The ClassNode(A) is not initialized and I cannot iterate its properties.
I tried to use compilationUnit.resolveVisitor.visitClass but it did not manage to resolve the class

// get ResolveVisitor
ClassNode targetClass = // get ClassNode from @CopyPropertiesFrom.value member
Field rvField = CompilationUnit.class.getDeclaredField('resolveVisitor')
ResolveVisitor rv = (ResolveVisitor) rvField.get(this.compilationUnit)

this throws:
org.codehaus.jdt.groovy.internal.compiler.ast.GroovyEclipseBug: commencingResolution failed: no declaration found for class A -> A
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTResolver.commencingResolution(

I am aware of the limitations imposed by the incremental compiler. However in my opinion it should be possible to resolve classes on demand.

Can you please tell me if there is a working solution for my problem?


To unsubscribe from this list, please visit:

©2008 - Jax Systems, LLC, U.S.A.