Name: viR10068 Date: 11/14/2003
The spec ClassFileFormat.pdf says:
"A method's Code attribute may have at most one StackMap attribute,
otherwise a java.lang.ClassFormatError is thrown."
But the JVM (1.5.0-beta-b28) accepts invalid classfile with 2
StackMap attributes.
The new JCK test is failed due to this error:
vm/cldc/classfmt/stackmap002/stackmap00202m1/stackmap00202m1.html
The test source:
--------------------- test14.jcod ---------------------------
class test14 {
0xCAFEBABE;
0;
49;
[] { // Constant Pool
; // first element is empty
Method #2 #5; // #1
class #4; // #2
Utf8 "t.jasm"; // #3
Utf8 "java/lang/Object"; // #4
NameAndType #11 #7; // #5
Utf8 "SourceFile"; // #6
Utf8 "()V"; // #7
Utf8 "Code"; // #8
class #10; // #9
Utf8 "test14"; // #10
Utf8 "<init>"; // #11
Utf8 "StackMap"; // #12
} // Constant Pool
0x0000; // access
#9;// this_cpx
#2;// super_cpx
[] { // Interfaces
} // Interfaces
[] { // fields
} // fields
[] { // methods
{ // Member
0x0001; // access
#11; // name_cpx
#7; // sig_cpx
[] { // Attributes
Attr(#8) { // Code
1; // max_stack
1; // max_locals
Bytes[]{
0x2AB70001B1;
};
[] { // Traps
} // end Traps
[] { // Attributes
Attr(#12) { // StackMap
[] {}
};
Attr(#12) { // StackMap
[] {}
}
} // Attributes
} // end Code
} // Attributes
} // Member
} // methods
[] { // Attributes
Attr(#6) { // SourceFile
#3;
} // end SourceFile
} // Attributes
} // end class
-------------------------------------------------------------
The execution log:
% dest/jdk1.5.0-b28/solaris-sparc/bin/java -showversion -Xfuture test14
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b28)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b28, mixed mode)
Exception in thread "main" java.lang.NoSuchMethodError: main
%
======================================================================
The spec ClassFileFormat.pdf says:
"A method's Code attribute may have at most one StackMap attribute,
otherwise a java.lang.ClassFormatError is thrown."
But the JVM (1.5.0-beta-b28) accepts invalid classfile with 2
StackMap attributes.
The new JCK test is failed due to this error:
vm/cldc/classfmt/stackmap002/stackmap00202m1/stackmap00202m1.html
The test source:
--------------------- test14.jcod ---------------------------
class test14 {
0xCAFEBABE;
0;
49;
[] { // Constant Pool
; // first element is empty
Method #2 #5; // #1
class #4; // #2
Utf8 "t.jasm"; // #3
Utf8 "java/lang/Object"; // #4
NameAndType #11 #7; // #5
Utf8 "SourceFile"; // #6
Utf8 "()V"; // #7
Utf8 "Code"; // #8
class #10; // #9
Utf8 "test14"; // #10
Utf8 "<init>"; // #11
Utf8 "StackMap"; // #12
} // Constant Pool
0x0000; // access
#9;// this_cpx
#2;// super_cpx
[] { // Interfaces
} // Interfaces
[] { // fields
} // fields
[] { // methods
{ // Member
0x0001; // access
#11; // name_cpx
#7; // sig_cpx
[] { // Attributes
Attr(#8) { // Code
1; // max_stack
1; // max_locals
Bytes[]{
0x2AB70001B1;
};
[] { // Traps
} // end Traps
[] { // Attributes
Attr(#12) { // StackMap
[] {}
};
Attr(#12) { // StackMap
[] {}
}
} // Attributes
} // end Code
} // Attributes
} // Member
} // methods
[] { // Attributes
Attr(#6) { // SourceFile
#3;
} // end SourceFile
} // Attributes
} // end class
-------------------------------------------------------------
The execution log:
% dest/jdk1.5.0-b28/solaris-sparc/bin/java -showversion -Xfuture test14
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b28)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b28, mixed mode)
Exception in thread "main" java.lang.NoSuchMethodError: main
%
======================================================================