Skip to content

Commit

Permalink
Support CONSTANT_Class values in constant pool (was not allowed back …
Browse files Browse the repository at this point in the history
…when the verifier was written).
  • Loading branch information
krestenkrab committed Jun 7, 2010
1 parent 8f0cd17 commit c669a8e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/verify/bytecode/BytecodeVerifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 "
Expand Down

0 comments on commit c669a8e

Please sign in to comment.