You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bruno P. Kinoshita (JIRA)" <ji...@apache.org> on 2017/05/19 06:44:04 UTC
[jira] [Resolved] (BCEL-289) Crash when parsing constructor of
inner classes with parameters annotated
[ https://issues.apache.org/jira/browse/BCEL-289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bruno P. Kinoshita resolved BCEL-289.
-------------------------------------
Resolution: Fixed
> Crash when parsing constructor of inner classes with parameters annotated
> -------------------------------------------------------------------------
>
> Key: BCEL-289
> URL: https://issues.apache.org/jira/browse/BCEL-289
> Project: Commons BCEL
> Issue Type: Bug
> Components: Parser
> Affects Versions: 6.0
> Reporter: Pietro Ferrara
> Assignee: Bruno P. Kinoshita
> Priority: Critical
> Fix For: 6.1
>
>
> BCEL crashes when parsing the constructor of an inner class whose parameters are annotated. For instance, when parsing the jar obtained from the following classes:
> {code:java}
> public @interface A {}
> public @interface B {}
> public class Test {
> public class Inner {
> public Inner(@A Object a, @B Object b) {}
> }
> }
> {code}
> In particular:
> {code:java}
> ClassParser cp = new ClassParser(args[0]);
> ClassGen cg = new ClassGen(cp.parse());
> MethodGen mg = new MethodGen(cg.getMethodAt(0), cg.getClassName(), cg.getConstantPool());
> mg.getAnnotationsOnParameter(0);
> {code}
> (where args\[0\] points to Test$Inner.class)
> you get
> {noformat}
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
> at org.apache.bcel.generic.MethodGen.ensureExistingParameterAnnotationsUnpacked(MethodGen.java:1120)
> at org.apache.bcel.generic.MethodGen.getAnnotationsOnParameter(MethodGen.java:1073)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)