Bug 62806 - [1.5] Generic class not recognised as Generic
Summary: [1.5] Generic class not recognised as Generic
Status: RESOLVED DUPLICATE of bug 58722
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-18 17:04 EDT by Roberto S. Tyley CLA
Modified: 2005-01-11 11:03 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto S. Tyley CLA 2004-05-18 17:04:48 EDT
With Eclipse I20040514 and Cheetah5 in a fresh install and a new project, I
created the following two parameterized classes- however in the second class
'Function' is incorrectly highlighted by Eclipse with the message "The type
Function is not generic; it cannot be parameterized with arguments <Y, X>":

----

public abstract class Function<Y,X> {
    
    public abstract Y eval(X x);

}

----

import java.util.*;

public class FunctionMappedComparator<Y,X> implements Comparator<X> {
	/*
	 * 'Function' is highlighted as an error here - the message is:
	 * "The type Function is not generic; it cannot be parameterized with arguments
<Y, X>"
	 */
    protected Function<Y,X> function;
    protected Comparator<Y> comparator;
    
    public FunctionMappedComparator(Function<Y,X> function,Comparator<Y>
comparator ) {
        this.function=function;
        this.comparator=comparator;
    }

    public int compare(X x1, X x2) {
        return comparator.compare(function.eval(x1),function.eval(x2));
    }

}

----

I'm using J2SE1.50 beta1 (1.5.0-beta-b32c) - yes, I'm one of those lusers who
has to wait for the public release of beta2! Does this reproduce with a current
drop of beta2?

Roberto
Comment 1 Philipe Mulet CLA 2004-05-21 15:50:26 EDT
Note: it doesn't make any difference whether you use beta1 or beta2, since you 
are actually using the Eclipse java compiler, not Sun javac. 

This being said, you aren't getting any compilation error when building; only 
errors in editor (i.e. no problem in problem view). This is due to the fact 
that our lightweight compilation mode used to compile on the fly as you type 
hasn't been leveraged for 1.5 support yet, and thus treats generic types as 
non generic ones (discarding the type parameters). It requires to upgrade the 
JavaModel implementation to properly handle errors in editor.
Comment 2 Philipe Mulet CLA 2004-05-21 15:51:59 EDT

*** This bug has been marked as a duplicate of 58722 ***