Skip to content

v1.2: GeneratedComponent duplicates builder.add calls for the same adapters #60

@LoonyRules

Description

@LoonyRules

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);
 }

}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions