src/share/classes/com/sun/java/util/jar/pack/Instruction.java

Print this page

        

*** 444,459 **** --- 444,461 ---- } public static boolean isCPRefOp(int bc) { if (bc < BC_INDEX[0].length && BC_INDEX[0][bc] > 0) return true; if (bc >= _xldc_op && bc < _xldc_limit) return true; + if (bc == _invokespecial_int || bc == _invokestatic_int) return true; return false; } public static byte getCPRefOpTag(int bc) { if (bc < BC_INDEX[0].length && BC_INDEX[0][bc] > 0) return BC_TAG[0][bc]; if (bc >= _xldc_op && bc < _xldc_limit) return CONSTANT_LoadableValue; + if (bc == _invokestatic_int || bc == _invokespecial_int) return CONSTANT_InterfaceMethodref; return CONSTANT_None; } public static boolean isFieldOp(int bc) { return (bc >= _getstatic && bc <= _putfield);
*** 645,655 **** BC_CON[w][bc] = (byte) con; } } } ! public static void opcodeChecker(byte[] code, ConstantPool.Entry[] cpMap) throws FormatException { Instruction i = at(code, 0); while (i != null) { int opcode = i.getBC(); if (opcode < _nop || opcode > _jsr_w) { String message = "illegal opcode: " + opcode + " " + i; --- 647,658 ---- BC_CON[w][bc] = (byte) con; } } } ! public static void opcodeChecker(byte[] code, ConstantPool.Entry[] cpMap, ! Package.Version clsVersion) throws FormatException { Instruction i = at(code, 0); while (i != null) { int opcode = i.getBC(); if (opcode < _nop || opcode > _jsr_w) { String message = "illegal opcode: " + opcode + " " + i;
*** 656,669 **** throw new FormatException(message); } ConstantPool.Entry e = i.getCPRef(cpMap); if (e != null) { byte tag = i.getCPTag(); ! if (!e.tagMatches(tag)) { ! String message = "illegal reference, expected type=" + ! ConstantPool.tagName(tag) + ": " + ! i.toString(cpMap); throw new FormatException(message); } } i = i.next(); } --- 659,679 ---- throw new FormatException(message); } ConstantPool.Entry e = i.getCPRef(cpMap); if (e != null) { byte tag = i.getCPTag(); ! boolean match = e.tagMatches(tag); ! if (!match && ! (i.bc == _invokespecial || i.bc == _invokestatic) && ! e.tagMatches(CONSTANT_InterfaceMethodref) && ! clsVersion.greaterThan(Constants.JAVA7_MAX_CLASS_VERSION)) { ! match = true; ! } ! if (!match) { ! String message = "illegal reference, expected type=" ! + ConstantPool.tagName(tag) + ": " ! + i.toString(cpMap); throw new FormatException(message); } } i = i.next(); }