java - BCEL code example to put "new Class[]{String.class}" on the stack -
How do I create an array of size 1 with examples of java.lang.Class and looking for example BCEL code In other words, start its only element with reference to java.lang.String.class
, I want to insert the "new class [] {String.class}" on the stack to write the BCEL code Looking for a sample.
Thank you.
Assuming that you want to create a class file version 49 (Java 5) or more, the necessary instruction The sequence is:
java / lang / class
java.lang .tring.class
Now the only question is how should it be generated in BCEEL what I saw, according to which, the generator code can look like this:
il.append (InstructionConstants.ICONST_1); Il.append (factory.createNewArray (Type.getType (class class), 1)); Il.append (InstructionConstants.DUP); Il.append (InstructionConstants.ICONST_0); IL.Append (new LDC (continuously Paul Jane.AddClass (type.tatotype (string class))); Il.append (InstructionConstants.AASTORE);
However I have not tested it.
Comments
Post a Comment