Yesterday my girlfriend told me reading is cool.
I then started to read the java source code, and noticed something that I could not figure out why it was done like that.
I understand what is the utility of @Native
tag.
Indicates that a field defining a constant value may be referenced from native code. The annotation may be used as a hint by tools that generate native header files to determine whether a header file is required, and if so, what declarations it should contain.
However, while reading the java source code I noticed that in the class Integer
and Long
the SIZE
constant is @Native
while it is not for the Float, Byte, Double, Short and Character.
Note that the SIZE constant represent the number of bits used to represent the actual value.
public static final int SIZE = 8;//Byte
public static final int SIZE = 16;//Character
public static final int SIZE = 16;//Short
public static final int SIZE = 32;//Float
@Native public static final int SIZE = 32;//Integer
@Native public static final int SIZE = 64;//Long
public static final int SIZE = 64;//Double
Edit : I just noticed that this also apply for MAX_VALUE
and MIN_VALUE
of the same classes.
Why is the SIZE constant only @Native for Integer and Long ?
Aucun commentaire:
Enregistrer un commentaire