[ 
https://issues.apache.org/jira/browse/FELIX-3573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francois Valdy updated FELIX-3573:
----------------------------------

    Description: 
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 shown in javap -verbose -c -private 
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.

  was:
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 shown 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.

    
> 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 shown in javap -verbose -c 
> -private 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