Permalink
Browse files

Support CONSTANT_Class values in constant pool (was not allowed back …

…when the verifier was written).
  • Loading branch information...
1 parent 8f0cd17 commit c669a8e20aaf23ae41aa4e9f088f075157b10b6a @krestenkrab committed Jun 7, 2010
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/verify/bytecode/BytecodeVerifier.java
@@ -565,10 +565,11 @@ else if (mode == BYTE_MODE_ILLEGAL)
int index = n2h.get1u (code, pc++);
Type t = getConstantType (index);
- if (t != ctx.FLOAT && t != ctx.INT && t != ctx.STRING)
+ if ( t != ctx.FLOAT && t != ctx.INT
+ && t != ctx.STRING && t != ctx.CLASS)
{
throw new verify.type.IncompatibleTypesException
- ("erroneous operand, "+t+", for ldc2_w instrunction");
+ ("erroneous operand, "+t+", for ldc instrunction");
}
state.push (t);
@@ -2013,11 +2014,11 @@ Type getConstantType (int index)
static final Class XCLASS = FOOBAR.class;
but it does not, so this is also not allowed as a constant value.
-
- // case CONSTANT_Class:
- // return ctx.CLASS;
*/
+ case CONSTANT_Class:
+ return ctx.CLASS;
+
default:
throw new verify.VerificationException
("did not find a constant value at index "

0 comments on commit c669a8e

Please sign in to comment.