Francois Valdy created FELIX-3573:
-------------------------------------

             Summary: IPojo bytecode manipulation generates a duplicate local 
variable
                 Key: FELIX-3573
                 URL: https://issues.apache.org/jira/browse/FELIX-3573
             Project: Felix
          Issue Type: Bug
          Components: iPOJO
    Affects Versions: ipojo-manipulator-1.8.6
            Reporter: Francois Valdy
            Priority: Minor


In the following code:
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java?revision=1327153&view=markup

The method visitLocalVariable should have a "else" statement like below:
if (index == 0) {
  mv.visitLocalVariable(name, desc, signature, start, end, index);
  mv.visitLocalVariable("_manager", "Lorg/apache/felix/ipojo/InstanceManager;", 
null, start, end, 1);
} else {
  mv.visitLocalVariable(name, desc, signature, start, end, index + 1);
}

Otherwise, when index == 0 ("this" parameter), we'll generate 2 variables at 
index 1 (manager & this a second time), as should in javap -verbose output 
below:

  LocalVariableTable:
   Start  Length  Slot  Name   Signature
   0      26      0    this       Lfoo/Bar;
   0      26      1    _manager       Lorg/apache/felix/ipojo/InstanceManager;
   0      26      1    this       Lfoo/Bar;

It works fine as the last one is probably ignored by everyone, but it'd be 
cleaner.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to