All pastes #368694 Raw Edit

Anonymous

public text v1 · immutable
#368694 ·published 2007-02-23 07:54 UTC
rendered paste body
    public boolean find(JavaClass clazz) {
       for (Method m : clazz.getMethods()) {
            MethodGen methodGen = new MethodGen(m, className,
                    new ConstantPoolGen(clazz.getConstantPool()));
            InstructionList il = methodGen.getInstructionList();
            Iterator<InstructionHandle> ilit = il.iterator();
            while (ilit.hasNext()) {
                Instruction instruction = ilit.next().getInstruction();
                if (instruction instanceof LDC) {
                  int idx = ((LDC) instruction).getIndex();
                            ConstantInteger constant = ((ConstantInteger) (clazz.getConstantPool().getConstant(idx)));
                            int value = constant.getBytes();
                    if(value == -65536)
                    return true;
                }
            }
        }
        return false;
    }