Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365565

Summary: [Xtend] missing validation for type parameters
Product: [Tools] Xtend Reporter: Holger Schill <Holger.Schill>
Component: CoreAssignee: Jan Koehnlein <jan>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dennis.huebner, jan, moritz.eysholdt, sebastian.zarnekow, sven.efftinge
Version: 2.2.0Flags: sven.efftinge: kepler+
Target Milestone: M6   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Bug Depends on: 376037    
Bug Blocks: 380055    

Description Holger Schill CLA 2011-12-05 05:40:26 EST
The missing validation to report that a type parameter is missing leads to invalid java code for the following example:

Java class Test:

public abstract class Test<M,T> {}

Xtend class Bar :

class Bar extends Test<String> {}

This is valid for Xtend but produces the following invalid java code:

@SuppressWarnings("all")
public class Foo extends Test<String> {
}

The Error is placed on Test with the message:
Incorrect number of arguments for type Test<M,T>; it cannot be parameterized with arguments <String>
Comment 1 Moritz Eysholdt CLA 2012-06-10 06:44:57 EDT
The same happens when the TypeReference is a method's return type:

--------- Xtend ---------
import java.util.Map

class Bug {
	def Map<Integer> foo() {
	}  
}
-------------------------

In Xtend, this snipped doesn't cause any error, but in Java it does.
Comment 2 Moritz Eysholdt CLA 2012-11-02 05:56:38 EDT
missing error when specifying type parameters for parameterless type:

Example:

--------- Xtend ---------
def List<AbstractEntry<?>> getEntries() {
}

abstract class AbstractEntry {
}
------------------------

There should be an error for <?> since AbstractEntry has no type parameters.

Here, as in the other scenarios, the generated Java code is broken.
Comment 3 Dennis Huebner CLA 2013-02-14 04:00:38 EST
Still a valid bug.
Comment 4 Sven Efftinge CLA 2013-02-16 09:07:06 EST
see also bug# 380055
Comment 5 Jan Koehnlein CLA 2013-02-18 11:52:22 EST
Pushed to gerrit. 

Also added a check for wildcards in super types.
Comment 6 Eclipse Webmaster CLA 2017-10-31 11:05:43 EDT
Requested via bug 522520.

-M.
Comment 7 Eclipse Webmaster CLA 2017-10-31 11:17:00 EDT
Requested via bug 522520.

-M.