You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/10/18 00:09:00 UTC
[jira] [Updated] (GROOVY-7288) @Delegate to object by Class which
implementing trait with fields complains 'abstract method in a non-abstract
class'
[ https://issues.apache.org/jira/browse/GROOVY-7288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-7288:
--------------------------------
Labels: trait traits (was: )
> @Delegate to object by Class which implementing trait with fields complains 'abstract method in a non-abstract class'
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-7288
> URL: https://issues.apache.org/jira/browse/GROOVY-7288
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.3.6
> Reporter: Pavel Alexeev
> Priority: Major
> Labels: trait, traits
>
> Please look at short reproduce:
> {code}
> import groovy.transform.TupleConstructor
> trait Some{
> String STATIC = 'static data' // Commenting it out make it work (it have no difference static it or not)
> String so(){
> println ('STATIC=' + STATIC)
> }
> }
> class Delegator implements Some{
> String delegated(){
> println 'delegated work'
> }
> }
> class SomeClass{
> @Delegate Delegator delegator = new Delegator();
> }
> def s = new SomeClass()
> s.delegated()
> {code}
> Running it I have:
> {noformat}
> 2 compilation errors:
> Can't have an abstract method in a non-abstract class. The class 'SomeClass' must be declared abstract or the method 'java.lang.String Some__STATIC$get()' must be implemented.
> at line: 17, column: 1
> Can't have an abstract method in a non-abstract class. The class 'SomeClass' must be declared abstract or the method 'void Some__STATIC$set(java.lang.String)' must be implemented.
> at line: 17, column: 1
> {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)