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 11:23:22 UTC

[jira] [Updated] (BCEL-68) Unable to generate method that returns an array of integers

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

Emmanuel Bourg updated BCEL-68:
-------------------------------

         Priority: Major
      Environment:     (was: Operating System: Linux
Platform: PC)
    Fix Version/s: 5.2
         Priority:   (was: P2)
         Severity:   (was: normal)

> Unable to generate method that returns an array of integers
> -----------------------------------------------------------
>
>                 Key: BCEL-68
>                 URL: https://issues.apache.org/jira/browse/BCEL-68
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Main
>    Affects Versions: 5.1
>            Reporter: cavengene
>            Assignee: Apache Commons Developers
>             Fix For: 5.2
>
>
> I'm trying to generate the following code use BCEL:
> package bci;
> public class Test {
>   public int[] getArray() {
>     return new int[1];
>   }
>   public static void main(String[] args) {
>   }
> }
> I use BCELIfier to generate the code that creates Test. The snippet that creates getArray is
>   private void createMethod_2() {
>     InstructionList il = new InstructionList();
>     MethodGen method = new MethodGen(ACC_PUBLIC, new ArrayType(T_INT, 1), Type.NO_ARGS, new 
> String[] {  }, "getArray", "bci.Test", il, _cp);
>     InstructionHandle ih_0 = il.append(new PUSH(_cp, 1));
>     il.append(_factory.createNewArray(new ArrayType(T_INT, 1), (short) 1));
>     InstructionHandle ih_3 = il.append(_factory.createReturn(Type.OBJECT));
>     method.setMaxStack();
>     method.setMaxLocals();
>     _cg.addMethod(method.getMethod());
>     il.dispose();
>   }
> I run TestCreator (generated by BCELIfier) and execute Test, which triggers the following error:
> Exception in thread "main" java.lang.VerifyError: (class: bci/Test, method: getArray signature: ()[I) 
> Wrong return type in function
> If I return null rather than the array, everything is perfectly allright.



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