ciField::is_constant.
The compiler already treats static final fields and instance final fields in
record classes and hidden classes as constant. All classes in select
packages (Defined in trust_final_non_static_fields in ciField.cpp) in
the boot class loader also have their instance final fields trusted. This
annotation is not necessary in these cases.
The Stable annotation treats fields as constants once they are not the
zero or null value. In comparison, a non-stable final instance field
trusted by this annotation can treat zero and null values as constants.
This annotation is suitable when constant treatment of final fields is performance sensitive, yet package-wide final field constant treatment may be at risk from final field modifications such as serialization.
This annotation is only recognized on classes from the boot and platform class loaders and is ignored elsewhere.