-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
8u291, 11, 15, 16, 17
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
Platform:
macOS
java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.275-b01, mixed mode)
openjdk version "9"
OpenJDK Runtime Environment (build 9+181)
OpenJDK 64-Bit Server VM (build 9+181, mixed mode)
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment AdoptOpenJDK (build 10.0.2+13)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 10.0.2+13, mixed mode)
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
Windows 10
java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
A DESCRIPTION OF THE PROBLEM :
We found that hotspot sometimes failed to throw NoClassDefFoundError in synthetic accessor method. The simplified test case can be found in the attachment.
To simply, If we insert an undefined class declaration statement in the synthetic accessor method, hostpot does not throw any exception, this can be verified by executing src1.Outer in the attachment. However, if a method of an undefined class is called, NoClassDefFoundError will be thrown, this can be verified by executing src2.Outer in the attachment.
The main difference between the two classes is that in the access$000 method, src1.Outer only instantiates an object of an undefined class, while in src2.Outer, the clone method of the object is also called.
src1.Outer
static synthetic Method access$000:"()Ljava/lang/Object;":
...
new class UndefinedClass;
dup;
invokespecial Method UndefinedClass."<init>":"()V";
pop;
...
src2.Outer
static synthetic Method access$000:"()Ljava/lang/Object;":
...
new class UndefinedClass;
dup;
invokespecial Method UndefinedClass."<init>":"()V";
astore_1;
aload_1;
invokevirtual Method java/lang/Object.clone:"()Ljava/lang/Object;";
pop;
...
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Follow the commands in readme.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
throw NoClassDefFoundError
ACTUAL -
Outer
---------- BEGIN SOURCE ----------
https://drive.google.com/file/d/1MSVQmFzQg_iroKzZRu8N0ncMgyxFEJFE/view?usp=sharing
---------- END SOURCE ----------
FREQUENCY : always
Platform:
macOS
java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.275-b01, mixed mode)
openjdk version "9"
OpenJDK Runtime Environment (build 9+181)
OpenJDK 64-Bit Server VM (build 9+181, mixed mode)
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment AdoptOpenJDK (build 10.0.2+13)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 10.0.2+13, mixed mode)
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
Windows 10
java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
A DESCRIPTION OF THE PROBLEM :
We found that hotspot sometimes failed to throw NoClassDefFoundError in synthetic accessor method. The simplified test case can be found in the attachment.
To simply, If we insert an undefined class declaration statement in the synthetic accessor method, hostpot does not throw any exception, this can be verified by executing src1.Outer in the attachment. However, if a method of an undefined class is called, NoClassDefFoundError will be thrown, this can be verified by executing src2.Outer in the attachment.
The main difference between the two classes is that in the access$000 method, src1.Outer only instantiates an object of an undefined class, while in src2.Outer, the clone method of the object is also called.
src1.Outer
static synthetic Method access$000:"()Ljava/lang/Object;":
...
new class UndefinedClass;
dup;
invokespecial Method UndefinedClass."<init>":"()V";
pop;
...
src2.Outer
static synthetic Method access$000:"()Ljava/lang/Object;":
...
new class UndefinedClass;
dup;
invokespecial Method UndefinedClass."<init>":"()V";
astore_1;
aload_1;
invokevirtual Method java/lang/Object.clone:"()Ljava/lang/Object;";
pop;
...
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Follow the commands in readme.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
throw NoClassDefFoundError
ACTUAL -
Outer
---------- BEGIN SOURCE ----------
https://drive.google.com/file/d/1MSVQmFzQg_iroKzZRu8N0ncMgyxFEJFE/view?usp=sharing
---------- END SOURCE ----------
FREQUENCY : always