Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8253218 ClassFileParser hits assert(klass->access_flags().is_inline_t… #191

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -5299,7 +5299,7 @@ void ClassFileParser::verify_legal_field_signature(const Symbol* name,
const Symbol* signature,
TRAPS) const {
if (!_need_verify) { return; }
if (!supports_inline_types() && signature->is_Q_signature()) {
if (!supports_inline_types() && (signature->is_Q_signature() || signature->is_Q_array_signature())) {
throwIllegalSignature("Field", name, signature, CHECK);
}

@@ -64,6 +64,10 @@ public static void main(String[] args) throws Exception {
runTest("OldClassWithQSig",
"Field \"this\" in class OldClassWithQSig has illegal signature \"QOldClassWithQSig;\"");

// Test that a class with an old class file version cannot contain an array Q signature.
runTest("OldClassWithQArraySig",
"Field \"ia\" in class OldClassWithQArraySig has illegal signature \"[Qjava/lang/Integer;\"");

// Test that ClassCircularityError gets detected for instance fields.
System.out.println("Testing ClassCircularityError for instance fields");
try {
@@ -2385,3 +2385,108 @@ class OldClassWithQSig {
} // end ScalaSig
} // Attributes
} // end class OldClassWithQSig


// Test that a class with an old class file version cannot contain an array Q signature.
class OldClassWithQArraySig {
0xCAFEBABE;
0; // minor version
52; // version
[20] { // Constant Pool
; // first element is empty
Method #2 #3; // #1 at 0x0A
class #4; // #2 at 0x0F
NameAndType #5 #6; // #3 at 0x12
Utf8 "java/lang/Object"; // #4 at 0x17
Utf8 "<init>"; // #5 at 0x2A
Utf8 "()V"; // #6 at 0x33
class #8; // #7 at 0x39
Utf8 "java/lang/Integer"; // #8 at 0x3C
Field #10 #11; // #9 at 0x50
class #12; // #10 at 0x55
NameAndType #13 #14; // #11 at 0x58
Utf8 "OldClassWithQArraySig"; // #12 at 0x5D
Utf8 "ia"; // #13 at 0x65
Utf8 "[Qjava/lang/Integer;"; // #14 at 0x6A
Utf8 "Code"; // #15 at 0x81
Utf8 "LineNumberTable"; // #16 at 0x88
Utf8 "runIt"; // #17 at 0x9A
Utf8 "SourceFile"; // #18 at 0xA2
Utf8 "OldClassWithQArraySig.java"; // #19 at 0xAF
} // Constant Pool

0x0021; // access [ ACC_PUBLIC ACC_SUPER ]
#10;// this_cpx
#2;// super_cpx

[0] { // Interfaces
} // Interfaces

[1] { // Fields
{ // field at 0xC6
0x0000; // access
#13; // name_index : ia
#14; // descriptor_index : [Qjava/lang/Integer;
[0] { // Attributes
} // Attributes
}
} // Fields

[2] { // Methods
{ // method at 0xD0
0x0001; // access
#5; // name_index : <init>
#6; // descriptor_index : ()V
[1] { // Attributes
Attr(#15, 29) { // Code at 0xD8
1; // max_stack
1; // max_locals
Bytes[5]{
0x2AB70001B1;
}
[0] { // Traps
} // end Traps
[1] { // Attributes
Attr(#16, 6) { // LineNumberTable at 0xEF
[1] { // line_number_table
0 1; // at 0xFB
}
} // end LineNumberTable
} // Attributes
} // end Code
} // Attributes
}
;
{ // method at 0xFB
0x0001; // access
#17; // name_index : runIt
#6; // descriptor_index : ()V
[1] { // Attributes
Attr(#15, 37) { // Code at 0x0103
2; // max_stack
1; // max_locals
Bytes[9]{
0x2A05BD0007B50009;
0xB1;
}
[0] { // Traps
} // end Traps
[1] { // Attributes
Attr(#16, 10) { // LineNumberTable at 0x011E
[2] { // line_number_table
0 6; // at 0x012A
8 7; // at 0x012E
}
} // end LineNumberTable
} // Attributes
} // end Code
} // Attributes
}
} // Methods

[1] { // Attributes
Attr(#18, 2) { // SourceFile at 0x0130
#19;
} // end SourceFile
} // Attributes
} // end class OldClassWithQArraySig