I have a JPA static metamodel class which is as follows-
@StaticMetamodel(Test.class)
public class Test_{
public static volatile SingularAttribute<Test, String> id;
public static volatile SingularAttribute<Test, String> name;
public static volatile SingularAttribute<Test, String> description;
public static volatile ListAttribute<Test, Property> property;
}
I am using sonarqube
to improve my code quality and it suggested that I have to change public static id to field final for above member variables.
Can anyone suggest that should I change these variables to final?
The JPA
static metamodel ("_") classes are generated by your JPA
provider, not by you. They follow exactly what the JPA spec says to include (and there is no "final" there). Not including "final" makes perfect sense because those variables need initialising, and are not initialised by included code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.