[jira] [Commented] (GROOVY-8463) Inconsistency: setter imported with getter alias
[ https://issues.apache.org/jira/browse/GROOVY-8463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16343369#comment-16343369 ] Daniil Ovchinnikov commented on GROOVY-8463: Sorry, it appears I've already reported same issue > Inconsistency: setter imported with getter alias > > > Key: GROOVY-8463 > URL: https://issues.apache.org/jira/browse/GROOVY-8463 > Project: Groovy > Issue Type: Bug >Reporter: Daniil Ovchinnikov >Priority: Major > > {code:java|title=com/foo/Bar.groovy} > class Bar { > static def myProperty = 'hello' > } > {code} > {code:java|title=bugs.groovy} > import com.foo.Bar > import static com.foo.Bar.setMyProperty as getAbc > println Bar.@myProperty // as expected: 'hello' > abc // -> getAbc() -> getAbc(null) -> setMyProperty(null) > println Bar.@myProperty // expected: null, actual: 'hello', field value was > not updated > getAbc() // -> getAbc(null) -> setMyProperty(null) > println Bar.@myProperty // as expected: null, field was updated to null > getAbc(42) // -> setMyProperty(42) > println Bar.@myProperty // as expected: 42, field was updated to 42{code} > {{abc}} should call setter as explicit {{getAbc()}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (GROOVY-8463) Inconsistency: setter imported with getter alias
[ https://issues.apache.org/jira/browse/GROOVY-8463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniil Ovchinnikov resolved GROOVY-8463. Resolution: Duplicate > Inconsistency: setter imported with getter alias > > > Key: GROOVY-8463 > URL: https://issues.apache.org/jira/browse/GROOVY-8463 > Project: Groovy > Issue Type: Bug >Reporter: Daniil Ovchinnikov >Priority: Major > > {code:java|title=com/foo/Bar.groovy} > class Bar { > static def myProperty = 'hello' > } > {code} > {code:java|title=bugs.groovy} > import com.foo.Bar > import static com.foo.Bar.setMyProperty as getAbc > println Bar.@myProperty // as expected: 'hello' > abc // -> getAbc() -> getAbc(null) -> setMyProperty(null) > println Bar.@myProperty // expected: null, actual: 'hello', field value was > not updated > getAbc() // -> getAbc(null) -> setMyProperty(null) > println Bar.@myProperty // as expected: null, field was updated to null > getAbc(42) // -> setMyProperty(42) > println Bar.@myProperty // as expected: 42, field was updated to 42{code} > {{abc}} should call setter as explicit {{getAbc()}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (GROOVY-8463) Inconsistency: setter imported with getter alias
Daniil Ovchinnikov created GROOVY-8463: -- Summary: Inconsistency: setter imported with getter alias Key: GROOVY-8463 URL: https://issues.apache.org/jira/browse/GROOVY-8463 Project: Groovy Issue Type: Bug Reporter: Daniil Ovchinnikov {code:java|title=com/foo/Bar.groovy} class Bar { static def myProperty = 'hello' } {code} {code:java|title=bugs.groovy} import com.foo.Bar import static com.foo.Bar.setMyProperty as getAbc println Bar.@myProperty // as expected: 'hello' abc // -> getAbc() -> getAbc(null) -> setMyProperty(null) println Bar.@myProperty // expected: null, actual: 'hello', field value was not updated getAbc() // -> getAbc(null) -> setMyProperty(null) println Bar.@myProperty // as expected: null, field was updated to null getAbc(42) // -> setMyProperty(42) println Bar.@myProperty // as expected: 42, field was updated to 42{code} {{abc}} should call setter as explicit {{getAbc()}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (GROOVY-8462) ShortTypeHandling.castToString() is applied even when @CompileStatic is present
[ https://issues.apache.org/jira/browse/GROOVY-8462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dmitry Zhikharev updated GROOVY-8462: - Description: Even when {{@CompileStatic}} is present on the class, {{ShortTypeHandling.castToString()}} is applied to RHS of the expression when LHS is of type String. I've attached a test class and the compilation result (compiled with groovyc 2.4.13. Versions 2.5.0-beta-2, 2.6.0-alpha-2, 3.0.0-alpha-1 yielded same results). was: Even when {{@CompileStatic}} is present on the class, {{ShortTypeHandling.castToString()}} is applied to RHS of the expression when LHS is of type String. I've attached a test class and the compilation result (compiled with groovyc 2.4.13, version 2.5.0-beta-2, 2.6.0-alpha-2, 3.0.0-alpha-1 yielded same results). > ShortTypeHandling.castToString() is applied even when @CompileStatic is > present > --- > > Key: GROOVY-8462 > URL: https://issues.apache.org/jira/browse/GROOVY-8462 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker >Affects Versions: 3.0.0-alpha-1, 2.5.0-beta-2, 2.4.13, 2.6.0-alpha-2 >Reporter: Dmitry Zhikharev >Priority: Major > Attachments: Test.class, Test.groovy > > > Even when > {{@CompileStatic}} is present on the class, > {{ShortTypeHandling.castToString()}} is applied to RHS of the expression when > LHS is of type String. > I've attached a test class and the compilation result (compiled with groovyc > 2.4.13. Versions 2.5.0-beta-2, 2.6.0-alpha-2, 3.0.0-alpha-1 yielded same > results). -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (GROOVY-8462) ShortTypeHandling.castToString() is applied even when @CompileStatic is present
Dmitry Zhikharev created GROOVY-8462: Summary: ShortTypeHandling.castToString() is applied even when @CompileStatic is present Key: GROOVY-8462 URL: https://issues.apache.org/jira/browse/GROOVY-8462 Project: Groovy Issue Type: Bug Components: Static Type Checker Affects Versions: 2.6.0-alpha-2, 2.4.13, 2.5.0-beta-2, 3.0.0-alpha-1 Reporter: Dmitry Zhikharev Attachments: Test.class, Test.groovy Even when {{@CompileStatic}} is present on the class, {{ShortTypeHandling.castToString()}} is applied to RHS of the expression when LHS is of type String. I've attached a test class and the compilation result (compiled with groovyc 2.4.13, version 2.5.0-beta-2, 2.6.0-alpha-2, 3.0.0-alpha-1 yielded same results). -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (GROOVY-3942) Using metaClass to override methods in class hierarchy does not work as expected
[ https://issues.apache.org/jira/browse/GROOVY-3942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16343137#comment-16343137 ] Jan Šmucr commented on GROOVY-3942: --- Just ran into this and trying to figure out some workaround. :( > Using metaClass to override methods in class hierarchy does not work as > expected > > > Key: GROOVY-3942 > URL: https://issues.apache.org/jira/browse/GROOVY-3942 > Project: Groovy > Issue Type: Bug > Components: groovy-runtime >Affects Versions: 1.8-beta-1 > Environment: Windows XP >Reporter: Alex McManus >Priority: Major > Attachments: MetaclassOverrideTest.groovy > > > I've found some strange behaviour when dynamically overriding methods that > are called in a class hierarchy, which I think might be a bug. The problem is > that when I override a method on a subclass, code in the superclass still > calls the original method (note all classes are Groovy ones, I know this > wouldn't work with a Java class hierarchy). > I've isolated it to this sample code: > {code:Java} > class BaseClass { > def baseClassMethod() { > println "BaseClass.baseClassMethod()" > internalMethod() > } > def internalMethod() { >println "BaseClass.internalMethod()" > } > } > class SubClass extends BaseClass { > def subClassMethod() { > println "SubClass.subClassMethod()" > internalMethod() > } > } > def subClass = new SubClass() > subClass.metaClass.internalMethod = { -> println (" > (dynamic).internalMethod()")} > subClass.baseClassMethod() > subClass.subClassMethod() > {code} > ...which gives me the following output... > BaseClass.baseClassMethod() > BaseClass.internalMethod() > SubClass.subClassMethod() > (dynamic).internalMethod() > I would have expected that the dynamic version of internalMethod() would be > called both times, given that Groovy has dynamic method dispatching. > Some discussion of this issue took place on the mailing list: > http://old.nabble.com/Problems-using-metaClass-to-override-methods-in-class-hierarchy-td26743895.html#a26743895 > The suggestion is that the CallSiteArray.createCallCurrentSite(...) method > could check whether the receiver is a sub class of the sender class. -- This message was sent by Atlassian JIRA (v7.6.3#76005)