commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (BCEL-108) RuntimeVisible Annotations duplicated
Date Thu, 24 Apr 2014 08:59:15 GMT

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

Emmanuel Bourg updated BCEL-108:
--------------------------------

         Priority: Blocker
      Environment:     (was: Operating System: other
Platform: All)
    Fix Version/s: 6.0
         Priority:   (was: P2)
         Severity:   (was: normal)

> RuntimeVisible Annotations duplicated
> -------------------------------------
>
>                 Key: BCEL-108
>                 URL: https://issues.apache.org/jira/browse/BCEL-108
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Main
>    Affects Versions: 5.3
>            Reporter: Reinhard Pilz
>            Assignee: Apache Commons Developers
>            Priority: Blocker
>             Fix For: 6.0
>
>
> Classes containing runtime visible annotations are invalid when processed by BCEL.
> Example use case:
> The class to be processed:
> @javax.persistence.Entity
> public class Item {
> }
> Here the code snippets we are using to process the class:
> ClassGen classGen = new ClassGen(javaClass);
> ...
> // perform changes
> ...
> JavaClass result = classGen.getJavaClass();
> The result contains now two attributes "RuntimeVisibleAnnotation" which is invalid.
> Fix for the problem:
> org.apache.bcel.generic.ClassGen:
> On line 145 the list of attributes should not be filled with the annoation
> attributes, as they are appended later anyways.
> Original code:
> for (int i = 0; i < attributes.length; i++) {
>   addAttribute(attributes[i]);
> }
> Correct code:
> for (int i = 0; i < attributes.length; i++) {
>   if (!(attributes[i] instanceof Annotations)) {
>     addAttribute(attributes[i]);
>   }
> }



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message