I am getting IllegalArgumentException
key already registered on a custom lombok handler.
@ProviderFor(EclipseAnnotationHandler.class)
public class HandleEntityData extends EclipseAnnotationHandler<EntityData> {
@Override
public void handle(AnnotationValues<EntityData> annotation,
Annotation ast,
EclipseNode annotationNode) {
handleFlagUsage(
annotationNode,
new ConfigurationKey<FlagUsageType>("lombok.entity.flagUsage",
"Emit a warning or error if @EntityData is used.") {},
"@EntityData"
);
}
I already checked that the key is unique. And so wondering if anyone had ideas why ?
Found the answer to my own question. Basically moved the CONFIGURATION keys as a separate static constant so that it does not get constructed everytime handle()
is called. (The identity of the key object seems to fallback to Object equals/hashcode.)
@ProviderFor(EclipseAnnotationHandler.class)
public class HandleEntityData extends EclipseAnnotationHandler<EntityData> {
public final static ConfigurationKey CONFIGURATION_KEY = new ConfigurationKey<FlagUsageType>("lombok.entity.flagUsage",
"Emit a warning or error if @EntityData is used.") {};
@Override
public void handle(AnnotationValues<EntityData> annotation,
Annotation ast,
EclipseNode annotationNode) {
handleFlagUsage(
annotationNode,
CONFIGURATION_KEYS,
"@EntityData"
);
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments