groovy / groovy/groovy-eclipse

Properties added by AST transform not visible even after compilation

Open
#704 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

duplicate
Dominant language
Java
Stars
681
Forks
197
PR merge metrics
No merged PRs in 30d

Description

This is probably related to #421 but is a distinct failure case.

I have a small utility library called GroovyBeans Toolkit (updated name as I finally got it pushed to Central). One of the features is a @GbtId annotation that inserts a JPA ID property with all the usual boilerplate, similar to the built-in @Slf4j. This annotation is working correctly with the Groovy-Eclipse plugin, and javap reports this on the class file:

public java.util.UUID getId();
public void setId(java.util.UUID);
public java.time.Instant getVersion();
public void setVersion(java.time.Instant);

So far, so good. However, the plugin itself fails to resolve these visible methods when compiling Java source code; this happens both in the editor and in Maven batch mode.

        p.setId(UUID.randomUUID());
          ^^^^^
The method setId(UUID) is undefined for the type Person

I understand the limitations of editor visibility, but seems to be more fundamental--valid joint code refuses to compile.

I have had this exact construction working before, but reverting the Maven GEP to 2.9.2-01 does not resolve it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by investigating how Groovy-Eclipse handles AST-transform-generated methods during Java joint compilation, using the @GbtId example and the Maven GEP failure described here. Compare the methods reported by javap with method resolution in the editor and Maven batch mode. Done means setId, getId, setVersion, and getVersion resolve in both environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.