v1.2: GeneratedComponent duplicates builder.add calls for the same adapters
LoonyRules opened this issue · 6 comments
If you have a package that has 2 different classes that use the same class you have your @Json
annotation on, the GeneratedJsonComponent class will have 2 builder.add(..., ...)
method calls.
This causes the @MetaData(...)
annotation on the class to have the same adapter defined too.
Another thing I noticed during this duplicated builder.add method call, is that in v1.2-RC3
, the generated class is generated fine:
@Generated
@MetaData({ProbeStateJsonAdapter.class, ProbeStateJsonAdapter.class})
public class GeneratedJsonComponent implements Jsonb.GeneratedComponent {
@Override
public void register(Jsonb.Builder builder) {
builder.add(ProbeState.class, ProbeStateJsonAdapter::new);
builder.add(ProbeState.class, ProbeStateJsonAdapter::new);
}
}
However, in v1.2
the generated class is not fine:
@Generated
@MetaData({Prob.class, ProbeStateJsonAdapter.class})
public class GeneratedJsonComponent implements Jsonb.GeneratedComponent {
@Override
public void register(Jsonb.Builder builder) {
// This is wrong, Prob.class and ProbeStateJsonA.class do not exist, it's like the generation broke since the RC3 and the actual release.
builder.add(Prob.class, ProbeStateJsonA::new);
builder.add(ProbeState.class, ProbeStateJsonAdapter::new);
}
}
Update: This might be specific to running the application inside of IntelliJ as I am not able to reproduce if running directly via the java cli. The issue isn't present when running inside of IntelliJ when using v1.2-RC3 though, that could just be a fortunate cache (even though I have invalidated them all). Going to do more digging :)
I can't see anything obvious. One thing to mention is that IntelliJ will recompile some modules when you run/debug inside of IntelliJ. It's this step that causes the GeneratedJsonComponent
to be generated incorrectly. This is a blocker for us to upgrade from v1.2-RC3
to v1.2
in our use case as we use this IntelliJ feature quite heavily.
If you mvn clean package
or mvn clean install
separately and run the application via java -jar MyJar.jar
, everything is fine. Perhaps some edge-case was missed in the Prism addition?
No idea, but good luck @SentryMan 😅
Perhaps some edge-case was missed in the Prism addition?
It seems so
Looking to release 1.3-RC3 with #65 merged ... so we can look to confirm if that fixes it.
I think we're good with this, he messaged me and said it seems to work now
Closing as it has fixed the issue.