Enums should be annotated with @Immutable
mglazer opened this issue · comments
Mike Glazer commented
What happened?
warning: [ImmutableEnumChecker] enums should be immutable: 'VectorFieldType' has field 'conjureType' of type 'com.palantir.tiles2.api.config.ConjureVectorFieldType', the declaration of type 'com.palantir.tiles2.api.config.ConjureVectorFieldType' is not annotated with @com.google.errorprone.annotations.Immutable
When I define a type:
public enum VectorFieldType {
Number(ConjureVectorFieldType.NUMBER);
private final ConjureVectorFieldType conjureType;
VectorFieldType(ConjureVectorFieldType conjureType) {
this.conjureType = conjureType;
}
}
What did you want to happen?
The conjure generated enums should be annotated with @com.google.errorprone.annotations.Immutable
if they truly are (they are).
iamdanfox commented
I'm actually a huge fan of that @immutable annotation, as I love how if your system is currently immutable all the way down, you can whack it on a class and then rest assured that nobody will sneakily add in some mutation without having to conspicuously take out the annotation!
PR up anyway: palantir/conjure-java#1086