Duplicate attributes in class files
Remi Forax
forax at univ-mlv.fr
Mon Dec 28 16:42:26 UTC 2020
----- Mail original -----
> De: "x4e_x4e" <x4e_x4e at protonmail.com>
> À: "hotspot-dev" <hotspot-dev at openjdk.java.net>
> Envoyé: Lundi 28 Décembre 2020 17:02:37
> Objet: Duplicate attributes in class files
Hi !
> The current JVM specification (chapter 4) does not seem to place enough
> constraints on duplicate attributes.
> What I mean by this is if two attributes share the same name (but not
> necessarily the same length or content).
>
> The JVM specification does say that if two attributes have the same name and
> length this will result in a "conflict".
It's not what the spec says, the text in section 4.7.1
"Two attributes that are intended to be distinct, but that happen to use the same attribute name and are of the same length, will conflict on implementations that recognize either attribute"
refers to two user defined attributes. It's not about spec defined attributes but user defined attributes which should use the reverse DNS convention for their names to avoid name collision (conflict).
For the attributes defined by the spec, you have to read the text corresponding to the specific attribute to know if you can have more than one or not,
By example, you can have several attributes "ConstantValue" (4.7.2) but a method can not have more than one attribute "Code" (4.7.3).
[...]
regards,
Rémi
More information about the hotspot-dev
mailing list