Error message for a classfile 50 (1.6) containing a new constant pool constant is misleading if method handles aren't enable

Rémi Forax forax at univ-mlv.fr
Wed Jan 19 17:28:36 PST 2011


Hi John, hi Christian, hi all,
The logic in classFileParser.cpp around line 148 outputs
the wrong error message "This JVM does not support ..."
when a class file with a major version 50 contains a new constant pool 
constant
if method handles support is not enable.
It should output "Class file version does not support constant ..." instead.

The problem is that if the two conditions are true, the error message
should be "This JVM does not support ..." and not "Class file version 
does not support...".

the code:
case JVM_CONSTANT_MethodType :
         if (!EnableMethodHandles ||
             _major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
           classfile_parse_error(
             (!EnableMethodHandles ?
              "This JVM does not support constant tag %u in class file %s" :
              "Class file version does not support constant tag %u in 
class file %s"),
             tag, CHECK);
         }

should be replaced by:
case JVM_CONSTANT_MethodType :
         if (!EnableMethodHandles ||
             _major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
           classfile_parse_error(
             (_major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION ?
              "Class file version does not support constant tag %u in 
class file %s":
               "This JVM does not support constant tag %u in class file 
%s"),
             tag, CHECK);
         }

the code for constant InvokeDynamic (20 lines below) should be also changed
in the same way.

Rémi




More information about the mlvm-dev mailing list