You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Emmanuel Bourg (JIRA)" <ji...@apache.org> on 2014/04/24 10:59:15 UTC

[jira] [Updated] (BCEL-108) RuntimeVisible Annotations duplicated

     [ 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)