Community
Participate
Working Groups
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
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.
*** This bug has been marked as a duplicate of 58722 ***