public class Test {
public static void test() {
Object object4,object5,object6,object7,object8,object9,object10,object11,object12,
object13,object14,object15,object16,object17,object18,object19,object20,object21,
object22,object23,object24,object25,object26,object27,object28,object29,object30,
object31,object32,object33,object34,object35,object36,object37,object38,object39,
object40,object41,object42,object43,object44,object45,object46,object47,object48,
object49,object50,object51,object52,object53,object54,object55,object56,object57,
object58,object59,object60,object61,object62,object63,object64,
object3,object65,object2;
switch (1) {
case 4:
Object object1 = null;
break;
case 5:
if (null != null) {
object1 = null;
} else
{
object2 = null;
}
object3 = null;
break;
}
}
public static void main(String[] args) {
}
}
/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=64307:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/lib/tools.jar:/Users/bhawani-3138/Downloads/DI/out/production/DI Test
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.VerifyError: Instruction type does not match stack map
Exception Details:
Location:
Test.test()V @47: aconst_null
Reason:
Type top (current frame, locals[64]) is not assignable to 'java/lang/Object' (stack map, locals[64])
Current Frame:
bci: @47
flags: { }
locals: { top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, null }
stack: { }
Stackmap Frame:
bci: @47
flags: { }
locals: { top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, top, 'java/lang/Object' }
stack: { }
Bytecode:
0x0000000: 04ab 0000 0000 0031 0000 0002 0000 0004
0x0000010: 0000 001b 0000 0005 0000 0021 013a 40a7
0x0000020: 0013 01c6 0009 013a 40a7 0006 013a 3f01
0x0000030: 3a3d b1
Stackmap Table:
same_frame(@28)
same_frame(@34)
same_frame(@44)
full_frame(@47,{Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Object[#15]},{})
full_frame(@50,{},{})
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Process finished with exit code 1
答案 0 :(得分:1)
在切换之前将Object object1 = null;
移动
public class Test {
public static void test() {
Object object4,object5,object6,object7,object8,object9,object10,object11,object12,
object13,object14,object15,object16,object17,object18,object19,object20,object21,
object22,object23,object24,object25,object26,object27,object28,object29,object30,
object31,object32,object33,object34,object35,object36,object37,object38,object39,
object40,object41,object42,object43,object44,object45,object46,object47,object48,
object49,object50,object51,object52,object53,object54,object55,object56,object57,
object58,object59,object60,object61,object62,object63,object64,
object3,object65,object2;
Object object1;
switch (1) {
case 4:
object1 = null;
break;
case 5:
if (null != null) {
object1 = null;
} else
{
object2 = null;
}
object3 = null;
break;
}
}
public static void main(String[] args) {
}
}