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

Eric Milles updated GROOVY-896:
-------------------------------
    Labels: ClassFormatError  (was: )

> Problem when accessing arrays of arrays from groovy
> ---------------------------------------------------
>
>                 Key: GROOVY-896
>                 URL: https://issues.apache.org/jira/browse/GROOVY-896
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 1.0-JSR-2
>         Environment: Windows, Java 1.5.0_03
>            Reporter: Martin C. Martin
>            Assignee: Jochen Theodorou
>            Priority: Major
>              Labels: ClassFormatError
>             Fix For: 1.0-JSR-5
>
>
> If I create a Java class which contains a field declared as:
> int[][] x;
> then pass an object to groovy and ask it to execute:
> println (the object).x[0]
> it throws:
> Exception in thread "main" java.lang.ClassFormatError: Illegal class name 
> "gjdk/[I_GroovyReflectorArray" in class file gjdk/[I_GroovyReflectorArray
> Printing just (the object).x works fine.
> The full code which reproduces this error is:
> bug4.groovy:
> class bug4 {
>    def bubbles(a) {
>       println a.x[0];
>    }
> }
> bug4j.java:
> import groovy.lang.*;
> import java.io.*;
> import org.codehaus.groovy.control.CompilationFailedException;
> public class bug4j {
>       public int[][] x;
>       
>       void ricky()  throws CompilationFailedException, InstantiationException,
>       IOException,  IllegalAccessException {
>               x = new int[][] {new int[5], new int[4], new int[3]};
>               
>               // Create the groovy object
>               ClassLoader parent = getClass().getClassLoader();
>               GroovyClassLoader loader = new GroovyClassLoader(parent);
>               Class groovyClass = loader.parseClass(new File("bug4.groovy"));
>               GroovyObject bug4 = (GroovyObject) groovyClass.newInstance();
>               Object[] args = {this};
>               bug4.invokeMethod("bubbles", args);
>       }
>       public static void main(String[] args) throws 
> CompilationFailedException,
>               InstantiationException, IOException,  IllegalAccessException  {
>               (new bug4j()).ricky();
>       }
> }



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to