You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "A. Lepe (Jira)" <ji...@apache.org> on 2019/10/04 09:41:00 UTC

[jira] [Created] (GROOVY-9268) Access to ... is forbidden

A. Lepe created GROOVY-9268:
-------------------------------

             Summary: Access to ...  is forbidden
                 Key: GROOVY-9268
                 URL: https://issues.apache.org/jira/browse/GROOVY-9268
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.5.8
            Reporter: A. Lepe


I don't have a working code to reproduce the error except for the production code. I try my best to extract the main parts to be analyzed. 

Updating from 2.5.6 to 2.5.8 triggers this issue (I didn't tried 2.5.7 as it has a bug that affects my project).

The error I'm getting is: 

 
{code:java}
Access to com.example.MyClass$MyLib$Output#output is forbidden @ line #, column #{code}
Pointing to:

 
{code:java}
results << result.array.getInt(it * Native.getNativeSize(Integer.TYPE))
           ^{code}
This is the code:

 
{code:java}
@CompileStatic
class MyClass {

    List<Integer> getResult(String input) {
        List<Integer> results = []
        MyLib.Output output = MyLib.instance.getOutputList(input)
        if(output.results) {
            (0..output.results).each {
                results << result.array.getInt(it * Native.getNativeSize(Integer.TYPE))
            }
        }
        return results
    }

    interface MyLib extends Library {
        static MyLib instance = Native.load("mylibrary", MyLib.class)

        static class Output extends Structure {
            public int results
            public Pointer array

            Output() {
                super()
            }

            protected List<?> getFieldOrder() {
                return ["results", "array"]
            }
            static class ByReference extends Output implements Structure.ByReference {}
            static class ByValue extends Output implements Structure.ByValue {}
        }


        // Method in C library
        Ouput getOutputList(String input)

    }
}
{code}
 I changed the name of methods to make it easier to follow. 

 I believe it might be related to GROOVY-9043, which was fixed in 2.5.7.

It might be the same bug as GROOVY-9252

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)