Bug 468783 - [xtend] Linking of overloaded static methods using generics and being implemented in Java is broken
Summary: [xtend] Linking of overloaded static methods using generics and being impleme...
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.8.2   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-05-29 08:09 EDT by Christian Schneider CLA
Modified: 2015-11-11 04:14 EST (History)
1 user (show)

See Also:


Attachments
test project (22.33 KB, application/zip)
2015-05-29 08:09 EDT, Christian Schneider CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Schneider CLA 2015-05-29 08:09:15 EDT
Created attachment 253931 [details]
test project

Assume a Java file like this:

public class ContribJava {
    
  public static <T extends ETypedElement> T doSomething(final T typed) {
    return typed;
  }
  
  public static <T extends EClassifier> T doSomething(final T classifier) {
    return classifier;
  }
}


In an Xtend class implementing the following method

def void a() {
    ContribJava.doSomething(EcoreFactory.eINSTANCE.createEAttribute)
    ContribJava.doSomething(EcoreFactory.eINSTANCE.createEClass)
}

the second statement is flagged erroneous.

Interestingly, having 'doSomething(...)' implemented in an Xtend like 

class ContribXtend {
    
  def static <T extends ETypedElement> T doSomething(T typed) {
    return typed;
  }
    
  def static <T extends EClassifier> T doSomething(T classifier) {
    return classifier;
  }
}

def void b() {
    ContribXtend.doSomething(EcoreFactory.eINSTANCE.createEAttribute)
    ContribXtend.doSomething(EcoreFactory.eINSTANCE.createEClass)
}

can be compiled properly (although I temporarily encountered the issue there as well while writing this report; removing all files in xtend-gen fixed it).

Find a small test project attached.
Comment 1 Sebastian Zarnekow CLA 2015-06-01 05:02:04 EDT
Workaround: Rename T to E in one of the methods. Filtering by signature appears to be broken.
Comment 2 Christian Schneider CLA 2015-06-01 08:47:50 EDT
Good hint, works for me! Thank you :-)