Bug 463674 - [xtend][aa] It should be possible to restrict Delegate AA to only one interface without considering super types (not transitive)
Summary: [xtend][aa] It should be possible to restrict Delegate AA to only one interfa...
Status: NEW
Alias: None
Product: Xtend
Classification: Tools
Component: Core (show other bugs)
Version: 2.9.0   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-01 08:32 EDT by Anton Kosyakov CLA
Modified: 2015-04-02 07:24 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Kosyakov CLA 2015-04-01 08:32:48 EDT
Something like that:
interface Foo {
  def void foo()
}

interface Bar extends Foo {
  def void bar()
}


class Client implements Bar {

  @Delegate(Bar -> false) // false means without implementing methods from super types
  Bar delegate

}

In this case only implementation for bar method will be generated.
Comment 1 Sebastian Zarnekow CLA 2015-04-01 08:44:56 EDT
If you implement foo in Client yourself, that should already do the trick, right?
Comment 2 Anton Kosyakov CLA 2015-04-02 07:17:32 EDT
What if Client extends ClientBase that implements Foo interface?

Then Client looks like:
class Client extends ClientBase implements Bar {

   @Delegate
   Bar delegate

   // just to avoid calling delegate#foo
   override foo() {
       super.foo
   }

}


It is fine if Foo has only one method but it gets tedious if Foo has a bunch of methods.
Comment 3 Sven Efftinge CLA 2015-04-02 07:23:21 EDT
Inheriting some implementations and deleting to others is a very error-prone approach and confusing. We had this situation just recently in the IDEA tests. I don't think we should enhance Delegate with more special semantics.
Comment 4 Sven Efftinge CLA 2015-04-02 07:24:58 EDT
That should have been "delegating" not "deleting", of course.