[ 
https://issues.apache.org/jira/browse/GROOVY-9291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17206692#comment-17206692
 ] 

Paul King commented on GROOVY-9291:
-----------------------------------

Do you have an example that illustrates what you are after. The normal case 
where interfaces are automatically added to the class should already be covered:
{code}
interface Foo {
  def foo1(Object param)
  def foo2(Object param)
}
class Bar {
  def bar1(param) { }
  def bar2(param) { }
}
class Baz extends Bar implements Foo {
  @Delegate
  List<String> items = []
  
  @Override
  def foo1(param) {}

  @Override
  def foo2(param) {}

//  @Override
  def foo2(String param) {}

  @Override
  def bar1(param) {}

//  @Override
  def bar2(String param) {}

  @Override
  boolean contains(param) { false }

//  @Override
  boolean contains(String param) { false }
}
{code}

> Detect unsucessfull delegation override attempts
> ------------------------------------------------
>
>                 Key: GROOVY-9291
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9291
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Dariusz Hudziak
>            Priority: Trivial
>
> Java offers support for method override with '@Override'
> Which helps to detect failed override atempts due to inexact paramter types
> Groovy offers great feature to support replacement of inheritance with 
> composition by 
> '@Delegate' However the same issue as with inheritance may occur.  We may 
> wan't to override the default delegation  with custom one. That is as simple 
> as implementing correct method. But here we can also be 'bitten' by inexact 
> type problem.  To solve this issue i propose that either '@DelegatesTo' or 
> '@Delegate' be applicable on method with a menaing
> that it is a compile time error if this method won't shadow any method from 
> any delegate ( preferably from delegate supplied in the annotation )
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to