Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9268

Access to ... is forbidden

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.5.8
    • 3.0.0-rc-1
    • None
    • None

    Description

      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: 

       

      Access to com.example.MyClass$MyLib$Output#output is forbidden @ line #, column #

      Pointing to:

       

      results << result.array.getInt(it * Native.getNativeSize(Integer.TYPE))
                 ^

      This is the code:

       

      @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)
      
          }
      }
      

       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

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            lepe A. Lepe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: