groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Milles (Jira)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-9268) Access to ... is forbidden
Date Fri, 04 Oct 2019 14:59:00 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-9268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16944574#comment-16944574
] 

Eric Milles commented on GROOVY-9268:
-------------------------------------

I believe this is a duplicate of GROOVY-9265,  There is an open pull request to resolve the
issue -- access to field of local variable within closure under static compilation.  Your
example appears to meet all the criteria.

> 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
>            Priority: Critical
>
> 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)

Mime
View raw message