[jira] [Created] (GROOVY-8905) MissingMethodException when private method is called on parent class in a closure
Caleb Ott created GROOVY-8905: - Summary: MissingMethodException when private method is called on parent class in a closure Key: GROOVY-8905 URL: https://issues.apache.org/jira/browse/GROOVY-8905 Project: Groovy Issue Type: Bug Components: class generator Affects Versions: 2.5.4, 3.0.0-alpha-3, 2.6.0-alpha-4 Reporter: Caleb Ott This appears to be a bug since a MissingMethodException is being thrown when it shouldn't be. Here is the simplified code to reproduce the issue. I've tested on 2.5.4/2.6.0-alpha-4/3.0.0-alpha-3. {code:java} class Parent { protected void doSomethingParent() { // calling it outside of the closure works fine theSomething(1_000, 'This works') // setup a closure that calls another private method in the parent Closure closure = { int num -> // calling it inside the closure breaks theSomething(num, 'this breaks') } closure(10) } // only breaks because it is "private" private void theSomething(int num, String someValue) { println "${num} = ${someValue}" } } class Child extends Parent { void doSomethingChild() { // just calls the parent method doSomethingParent() } } // run the test def test = new Child() test.doSomethingChild() {code} Output: {noformat} 1000 = This works Caught: groovy.lang.MissingMethodException: No signature of method: Child.theSomething() is applicable for argument types: (Integer, String) values: [10, this breaks] groovy.lang.MissingMethodException: No signature of method: Child.theSomething() is applicable for argument types: (Integer, String) values: [10, this breaks] at Parent$_doSomethingParent_closure1.doCall(ScratchPad.groovy:10) at Parent.doSomethingParent(ScratchPad.groovy:13) at Child.doSomethingChild(ScratchPad.groovy:25) at Child$doSomethingChild.call(Unknown Source) at ScratchPad.run(ScratchPad.groovy:31){noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (GROOVY-7917) Sub class can't override final static member
[ https://issues.apache.org/jira/browse/GROOVY-7917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Caleb Ott updated GROOVY-7917: -- Affects Version/s: 2.4.7 > Sub class can't override final static member > > > Key: GROOVY-7917 > URL: https://issues.apache.org/jira/browse/GROOVY-7917 > Project: Groovy > Issue Type: Bug > Components: class generator >Affects Versions: 2.4.7 >Reporter: Caleb Ott > > Running the code below, "Derived Class" is expected to be printed out, but > instead "Base Class" is printed. > {code:java} > class Base { > static final String CONST = "Base Class" > } > class Derived extends Base { > static final String CONST = "Derived Class" > } > println Derived.CONST > {code} > When writing this same code in Java, "Derived Class" is properly printed out. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (GROOVY-7916) MissingPropertyException when accessing a static inner class member from a sub class
[ https://issues.apache.org/jira/browse/GROOVY-7916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Caleb Ott updated GROOVY-7916: -- Affects Version/s: 2.4.7 Fix Version/s: (was: 2.4.7) > MissingPropertyException when accessing a static inner class member from a > sub class > > > Key: GROOVY-7916 > URL: https://issues.apache.org/jira/browse/GROOVY-7916 > Project: Groovy > Issue Type: Bug > Components: class generator >Affects Versions: 2.4.7 >Reporter: Caleb Ott > > Run the following code in groovy to get the error. > {code:java} > class Base { > static class Inner { > static final String CONST = "Hello World"; > } > } > class Derived extends Base { > // empty for this example > } > println Derived.Inner.CONST > {code} > Error: > {code} > Caught: groovy.lang.MissingPropertyException: No such property: Inner for > class: Derived > groovy.lang.MissingPropertyException: No such property: Inner for class: > Derived > {code} > This code can be easily converted to Java and in Java everything works as it > should. > GROOVY-7762 seems to be a related issue. > I've verified the issue is on this line... > {code}println Derived.Inner.CONST{code} > ...because I tried writing the two classes in Java and still have the same > issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (GROOVY-7917) Sub class can't override final static member
Caleb Ott created GROOVY-7917: - Summary: Sub class can't override final static member Key: GROOVY-7917 URL: https://issues.apache.org/jira/browse/GROOVY-7917 Project: Groovy Issue Type: Bug Components: class generator Reporter: Caleb Ott Running the code below, "Derived Class" is expected to be printed out, but instead "Base Class" is printed. {code:java} class Base { static final String CONST = "Base Class" } class Derived extends Base { static final String CONST = "Derived Class" } println Derived.CONST {code} When writing this same code in Java, "Derived Class" is properly printed out. -- This message was sent by Atlassian JIRA (v6.3.4#6332)