Skip to content

modello-plugin-java: Incorrect toString()/equals() generation for fields of type "Boolean" #543

@kwin

Description

@kwin

The logic in

String getter = "boolean".equals(identifier.getType()) ? "is" : "get";
only uses the prefix is for type boolean. However the same prefix is also used for the non primitive Boolean.

For those the method JavaFieldMetadata.isBooleanGetter() returns true as well (

metadata.setBooleanGetter((fieldType != null) && fieldType.endsWith("oolean"));
) which leads to generating method with this prefix (
String prefix = javaFieldMetadata.isBooleanGetter() ? "is" : "get";
).

This leads to compile time errors due to non existing methods being referenced in the toString() method.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions