@@ -59,6 +59,16 @@ public class ClassReader extends ByteArrayInputStream {
5959 private static final int CONSTANT_Double = 6 ;
6060 private static final int CONSTANT_NameAndType = 12 ;
6161 private static final int CONSTANT_Utf8 = 1 ;
62+
63+ /*java 8 9 10 11 new tokens https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-4.html*/
64+ private static final int CONSTANT_MethodHandle = 15 ;
65+ private static final int CONSTANT_MethodType = 16 ;
66+ private static final int CONSTANT_Dynamic = 17 ;
67+ private static final int CONSTANT_InvokeDynamic = 18 ;
68+ private static final int CONSTANT_Module = 19 ;
69+ private static final int CONSTANT_Package = 20 ;
70+ /*end of ava 8 9 10 11 new tokens*/
71+
6272 /**
6373 * the constant pool. constant pool indices in the class file
6474 * directly index into this array. The value stored in this array
@@ -346,12 +356,31 @@ protected final void readCpool() throws IOException {
346356
347357 int len = readShort ();
348358 skipFully (len );
359+ break ;
360+ case CONSTANT_MethodHandle :
361+
362+ read (); // reference kind
363+ readShort (); // reference index
364+ break ;
365+
366+ case CONSTANT_MethodType :
367+
368+ readShort (); // descriptor index
369+ break ;
370+
371+ case CONSTANT_Dynamic :
372+ readShort (); // bootstrap method attr index
373+ readShort (); // name and type index
374+ break ;
375+ case CONSTANT_InvokeDynamic :
376+
377+ readShort (); // bootstrap method attr index
378+ readShort (); // name and type index
349379 break ;
350380
351381 default :
352382 // corrupt class file
353- throw new IllegalStateException (
354- Messages .getMessage ("unexpectedBytes00" ));
383+ throw new IllegalStateException ("Error looking for paramter names in bytecode: unexpected bytes in file, tag:" +c );
355384 }
356385 }
357386 }
0 commit comments