Java Mailing List Archive

http://www.gg3721.com/

Home » eclipse-plugin-dev.groovy »

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

Krzysztof Białek

2013-06-24

Replies: Find Java Web Hosting

Author LoginPost Reply
Hello,

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')
rvField.setAccessible(true)
ResolveVisitor rv = (ResolveVisitor) rvField.get(this.compilationUnit)
rv.visitClass(targetClass)

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(JDTResolver.java:498)

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?

Cheers,
Krzysztof

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


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