You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/03/21 00:45:00 UTC
[jira] [Resolved] (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 ]
Paul King resolved GROOVY-7288.
-------------------------------
Fix Version/s: 5.0.0-alpha-1
3.0.11
4.0.2
Resolution: Fixed
> @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
> Assignee: Eric Milles
> Priority: Major
> Labels: trait, traits
> Fix For: 5.0.0-alpha-1, 3.0.11, 4.0.2
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> 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.20.1#820001)