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

Groovy classes cannot access protected methods from base classes under Java 16

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.8
    • Fix Version/s: None
    • Component/s: groovy-runtime
    • Labels:
      None

      Description

      Running following script in Groovy Console

      import javax.swing.DefaultListModel
      class MyDefaultListModel extends DefaultListModel<String>{
          void test(){
              println(System.getProperty('java.version'))
              fireIntervalAdded( this, 0, 1 )
              println "passed"
          }
      }
      tested = new MyDefaultListModel()
      tested.test()
      

      generates following output:

      16.0.1
      Exception thrown
      
      groovy.lang.MissingMethodException: No signature of method: MyDefaultListModel.fireIntervalAdded() is applicable for argument types: (MyDefaultListModel, Integer, Integer) values: [[], 0, 1]
      	at MyDefaultListModel.test(ConsoleScript4:5)
      	at MyDefaultListModel$test.call(Unknown Source)
      	at ConsoleScript4.run(ConsoleScript4:10)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      

      The called method is declared as protected void fireIntervalAdded(Object, int, int) in javax.swing.AbstractListModel

      Running under Java 15 it generates following output:

      15.0.2
      passed
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dpolivaev Dimitry Polivaev
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: