com.sun.org.apache.bcel.internal.classfile.Constant Java Examples
The following examples show how to use
com.sun.org.apache.bcel.internal.classfile.Constant.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstructionList.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** Replace all references to the old constant pool with references to the new * constant pool */ public void replaceConstantPool(ConstantPoolGen old_cp, ConstantPoolGen new_cp) { for(InstructionHandle ih=start; ih != null; ih = ih.next) { Instruction i = ih.instruction; if(i instanceof CPInstruction) { CPInstruction ci = (CPInstruction)i; Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #2
Source File: InstructionList.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** Replace all references to the old constant pool with references to the new * constant pool */ public void replaceConstantPool(ConstantPoolGen old_cp, ConstantPoolGen new_cp) { for(InstructionHandle ih=start; ih != null; ih = ih.next) { Instruction i = ih.instruction; if(i instanceof CPInstruction) { CPInstruction ci = (CPInstruction)i; Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #3
Source File: InstructionList.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** Replace all references to the old constant pool with references to the new * constant pool */ public void replaceConstantPool(ConstantPoolGen old_cp, ConstantPoolGen new_cp) { for(InstructionHandle ih=start; ih != null; ih = ih.next) { Instruction i = ih.instruction; if(i instanceof CPInstruction) { CPInstruction ci = (CPInstruction)i; Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #4
Source File: InstructionList.java From hottub with GNU General Public License v2.0 | 5 votes |
/** Replace all references to the old constant pool with references to the new * constant pool */ public void replaceConstantPool(ConstantPoolGen old_cp, ConstantPoolGen new_cp) { for(InstructionHandle ih=start; ih != null; ih = ih.next) { Instruction i = ih.instruction; if(i instanceof CPInstruction) { CPInstruction ci = (CPInstruction)i; Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #5
Source File: InstructionList.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** Replace all references to the old constant pool with references to the new * constant pool */ public void replaceConstantPool(ConstantPoolGen old_cp, ConstantPoolGen new_cp) { for(InstructionHandle ih=start; ih != null; ih = ih.next) { Instruction i = ih.instruction; if(i instanceof CPInstruction) { CPInstruction ci = (CPInstruction)i; Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #6
Source File: CPInstruction.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * @return mnemonic for instruction with symbolic references resolved */ @Override public String toString( final ConstantPool cp ) { final Constant c = cp.getConstant(index); String str = cp.constantToString(c); if (c instanceof ConstantClass) { str = str.replace('.', '/'); } return com.sun.org.apache.bcel.internal.Const.getOpcodeName(super.getOpcode()) + " " + str; }
Example #7
Source File: InstructionList.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Replace all references to the old constant pool with references to the * new constant pool */ public void replaceConstantPool(final ConstantPoolGen old_cp, final ConstantPoolGen new_cp) { for (InstructionHandle ih = start; ih != null; ih = ih.getNext()) { final Instruction i = ih.getInstruction(); if (i instanceof CPInstruction) { final CPInstruction ci = (CPInstruction) i; final Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #8
Source File: InvokeInstruction.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * @return mnemonic for instruction with symbolic references resolved */ @Override public String toString( final ConstantPool cp ) { final Constant c = cp.getConstant(super.getIndex()); final StringTokenizer tok = new StringTokenizer(cp.constantToString(c)); return Const.getOpcodeName(super.getOpcode()) + " " + tok.nextToken().replace('.', '/') + tok.nextToken(); }
Example #9
Source File: ConstantPoolGen.java From Bytecoder with Apache License 2.0 | 5 votes |
/** Resize internal array of constants. */ protected void adjustSize() { if (index + 3 >= size) { final Constant[] cs = constants; size *= 2; constants = new Constant[size]; System.arraycopy(cs, 0, constants, 0, index); } }
Example #10
Source File: InstructionList.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** Replace all references to the old constant pool with references to the new * constant pool */ public void replaceConstantPool(ConstantPoolGen old_cp, ConstantPoolGen new_cp) { for(InstructionHandle ih=start; ih != null; ih = ih.next) { Instruction i = ih.instruction; if(i instanceof CPInstruction) { CPInstruction ci = (CPInstruction)i; Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #11
Source File: InstructionList.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** Replace all references to the old constant pool with references to the new * constant pool */ public void replaceConstantPool(ConstantPoolGen old_cp, ConstantPoolGen new_cp) { for(InstructionHandle ih=start; ih != null; ih = ih.next) { Instruction i = ih.instruction; if(i instanceof CPInstruction) { CPInstruction ci = (CPInstruction)i; Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #12
Source File: InstructionList.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** Replace all references to the old constant pool with references to the new * constant pool */ public void replaceConstantPool(ConstantPoolGen old_cp, ConstantPoolGen new_cp) { for(InstructionHandle ih=start; ih != null; ih = ih.next) { Instruction i = ih.instruction; if(i instanceof CPInstruction) { CPInstruction ci = (CPInstruction)i; Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #13
Source File: InstructionList.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** Replace all references to the old constant pool with references to the new * constant pool */ public void replaceConstantPool(ConstantPoolGen old_cp, ConstantPoolGen new_cp) { for(InstructionHandle ih=start; ih != null; ih = ih.next) { Instruction i = ih.instruction; if(i instanceof CPInstruction) { CPInstruction ci = (CPInstruction)i; Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #14
Source File: InstructionList.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** Replace all references to the old constant pool with references to the new * constant pool */ public void replaceConstantPool(ConstantPoolGen old_cp, ConstantPoolGen new_cp) { for(InstructionHandle ih=start; ih != null; ih = ih.next) { Instruction i = ih.instruction; if(i instanceof CPInstruction) { CPInstruction ci = (CPInstruction)i; Constant c = old_cp.getConstant(ci.getIndex()); ci.setIndex(new_cp.addConstant(c, old_cp)); } } }
Example #15
Source File: ConstantPoolGen.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * @return constant pool with proper length */ public ConstantPool getFinalConstantPool() { final Constant[] cs = new Constant[index]; System.arraycopy(constants, 0, cs, 0, index); return new ConstantPool(cs); }
Example #16
Source File: ConstantPoolGen.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Create empty constant pool. */ public ConstantPoolGen() { size = DEFAULT_BUFFER_SIZE; constants = new Constant[size]; }
Example #17
Source File: FieldGen.java From Bytecoder with Apache License 2.0 | 4 votes |
private void setValue( final int index ) { final ConstantPool cp = super.getConstantPool().getConstantPool(); final Constant c = cp.getConstant(index); value = ((ConstantObject) c).getConstantValue(cp); }
Example #18
Source File: ConstantPoolGen.java From Bytecoder with Apache License 2.0 | 2 votes |
/** * @param i index in constant pool * @return constant pool entry at index i */ public Constant getConstant( final int i ) { return constants[i]; }
Example #19
Source File: ConstantPoolGen.java From Bytecoder with Apache License 2.0 | 2 votes |
/** * Use with care! * * @param i index in constant pool * @param c new constant pool entry at index i */ public void setConstant( final int i, final Constant c ) { constants[i] = c; }