https://issues.apache.org/bugzilla/show_bug.cgi?id=51801

Byron Hawkins <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|                            |All

--- Comment #1 from Byron Hawkins <[email protected]> 2011-09-12 
06:12:00 UTC ---
Here is an icky workaround:


        Method method = <initialize>;
        MethodGen methodGenerator = new MethodGen(method, ...);
        InstructionList instructions = methodGenerator.getInstructionList();

        Map<Integer, InstructionHandle> handlesByPosition = new
HashMap<Integer, InstructionHandle>();
        for (InstructionHandle handle : instructions.getInstructionHandles())
        {
            handlesByPosition.put(handle.getPosition(), handle);
        }

        if (method.getLocalVariableTable() != null)
        {
            methodGenerator.removeLocalVariables();
            for (LocalVariable local :
method.getLocalVariableTable().getLocalVariableTable())
            {
                methodGenerator.addLocalVariable(local.getName(),
Type.getType(local.getSignature()), local.getIndex(),
                        handlesByPosition.get(local.getStartPC()),
handlesByPosition.get(local.getStartPC() + local.getLength()));
            }
        }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to