The mysterious constant pool tag #2
Alex Buckley
alex.buckley at oracle.com
Wed Jan 13 23:14:06 UTC 2021
A knowledgeable correspondent pointed me to an RFE from John Rose:
https://bugs.openjdk.java.net/browse/JDK-8161256
which contains the info we seek:
"The code 2 has been held open under the name CONSTANT_Unicode
but has never been used, probably because of the wide adoption
of UTF8 for string data."
Alex
On 1/13/2021 1:08 PM, Alex Buckley wrote:
> The earliest JVM Spec listed on docs.oracle.com is actually the Second
> Edition from 1999, specifying Java 1.2:
> https://docs.oracle.com/javase/specs/jvms/se6/html/VMSpecTOC.doc.html.
> It's listed under Java SE 6 due to a complicated update history, not
> relevant here.
>
> In any case, you're right that constant pool tag 2 was not defined in
> even the First Edition from 1996. I have information about many
> historical artifacts in the JVM Spec, but not this. Since tag 1 is
> CONSTANT_Utf8, and since the ClassFile's UTF-8 isn't exactly UTF-8, and
> since tags for numeric constants start rather clearly at 3, I'd guess
> that tag 2 was once another string encoding, perhaps CONSTANT_Utf16.
>
> Alex
>
> On 1/13/2021 11:28 AM, x4e_x4e wrote:
>> Hello,
>>
>> I am attempting to find the purpose of the seemingly abandoned
>> constant pool tag number 2.
>> My guess is that the item type denoted by this tag was removed and the
>> tag was never reclaimed.
>>
>> I've attempted to locate the earliest possible JVM spec including this
>> constant tag - to no avail.
>> The earliest spec listed on https://docs.oracle.com/javase/specs/ is
>> the SE 6 spec, which does not include the tag.
>> I did however find the original JSR catalog
>> (https://jcp.org/en/jsr/all), however it is unclear which JSR contains
>> the first JVM specification (Many links 404 and earlier specifications
>> only cover the language side of things).
>> As far as I can tell, this is the first final release JVM
>> specification:
>> http://web.archive.org/web/20000816180614/http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html
>> however, once again, it seems that there is no constant tag number 2.
>>
>> I am wondering if anyone here (probably someone involved in the early
>> JVM design) knows the original purpose of tag number 2?
>>
>> Thank You.
>>
>> PS: I found that you can actually buy the original JVM specification
>> on amazon
>> (https://www.amazon.co.uk/Java-Virtual-Machine-Specification/dp/020163452X)
>> - even new!
>>
>> JSth
>>
More information about the jdk-dev
mailing list