/** * Find the closest previous instruction from the current iterator * position that matches the given one, according to the * {@link Object#equals} methods of the instruction types. This allows * for matching based on template instructions, as the equals methods of * most instructions return true if the information for the given * instruction has not been filled in. If a match is found, the iterator * is placed before the matching Instruction. If no match is found, * moves the iterator to {@link #beforeFirst}. * * @return true if match found */ public boolean searchBackward(Instruction template) { if (template == null) return false; while (hasPrevious()) if (template.equalsInstruction(previous())) return true; return false; }
/** * Find the closest previous instruction from the current iterator * position that matches the given one, according to the * {@link Object#equals} methods of the instruction types. This allows * for matching based on template instructions, as the equals methods of * most instructions return true if the information for the given * instruction has not been filled in. If a match is found, the iterator * is placed before the matching Instruction. If no match is found, * moves the iterator to {@link #beforeFirst}. * * @return true if match found */ public boolean searchBackward(Instruction template) { if (template == null) return false; while (hasPrevious()) if (template.equalsInstruction(previous())) return true; return false; }
/** * Enhance constructor to initialize fields */ private void enhanceConstructor(BCClass bc) { BCMethod cons = bc.getDeclaredMethod("<init>", (String[]) null); Code code = cons.getCode(false); code.afterLast(); code.previous(); // private BitSet loaded = new BitSet(); BCField loaded = addBeanField(bc, "loaded", BitSet.class); loaded.setFinal(true); code.aload().setThis(); code.anew().setType(BitSet.class); code.dup(); code.constant().setValue(bc.getFields().length); code.invokespecial().setMethod(BitSet.class, "<init>", void.class, new Class[]{ int.class }); code.putfield().setField(loaded); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Enhance constructor to initialize fields */ private void enhanceConstructor(BCClass bc) { BCMethod cons = bc.getDeclaredMethod("<init>", (String[]) null); Code code = cons.getCode(false); code.afterLast(); code.previous(); // private BitSet loaded = new BitSet(); BCField loaded = addBeanField(bc, "loaded", BitSet.class); loaded.setFinal(true); code.aload().setThis(); code.anew().setType(BitSet.class); code.dup(); code.constant().setValue(bc.getFields().length); code.invokespecial().setMethod(BitSet.class, "<init>", void.class, new Class[]{ int.class }); code.putfield().setField(loaded); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Enhance constructor to initialize fields */ private void enhanceConstructor(BCClass bc) { BCMethod cons = bc.getDeclaredMethod("<init>", (String[]) null); Code code = cons.getCode(false); code.afterLast(); code.previous(); // private BitSet loaded = new BitSet(); BCField loaded = addBeanField(bc, "loaded", BitSet.class); loaded.setFinal(true); code.aload().setThis(); code.anew().setType(BitSet.class); code.dup(); code.constant().setValue(bc.getFields().length); code.invokespecial().setMethod(BitSet.class, "<init>", void.class, new Class[]{ int.class }); code.putfield().setField(loaded); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Enhance constructor to initialize fields */ private void enhanceConstructor(BCClass bc) { BCMethod cons = bc.getDeclaredMethod("<init>", (String[]) null); Code code = cons.getCode(false); code.afterLast(); code.previous(); // private BitSet loaded = new BitSet(); BCField loaded = addBeanField(bc, "loaded", BitSet.class); loaded.setFinal(true); code.aload().setThis(); code.anew().setType(BitSet.class); code.dup(); code.constant().setValue(bc.getFields().length); code.invokespecial().setMethod(BitSet.class, "<init>", void.class, new Class[]{ int.class }); code.putfield().setField(loaded); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Enhance constructor to initialize fields */ private void enhanceConstructor(BCClass bc) { BCMethod cons = bc.getDeclaredMethod("<init>", (String[]) null); Code code = cons.getCode(false); code.afterLast(); code.previous(); // private BitSet loaded = new BitSet(); BCField loaded = addBeanField(bc, "loaded", BitSet.class); loaded.setFinal(true); code.aload().setThis(); code.anew().setType(BitSet.class); code.dup(); code.constant().setValue(bc.getFields().length); code.invokespecial().setMethod(BitSet.class, "<init>", void.class, new Class[]{ int.class }); code.putfield().setField(loaded); code.calculateMaxStack(); code.calculateMaxLocals(); }
while (code.searchForward(ins)) { fi = (FieldInstruction) code.previous(); name = fi.getFieldName(); typeName = fi.getFieldTypeName();
code.beforeFirst(); while (code.searchForward(tmplate)) { ret = code.previous();
code.beforeFirst(); while (code.searchForward(tmplate)) { ret = code.previous();
code.beforeFirst(); while (code.searchForward(tmplate)) { ret = code.previous();
code.beforeFirst(); while (code.searchForward(tmplate)) { ret = code.previous();
code.beforeFirst(); while (code.searchForward(tmplate)) { ret = code.previous();