Bug 100421 - [1.5][compiler] chain of generics-extends confuse compiler
Summary: [1.5][compiler] chain of generics-extends confuse compiler
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC3   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-16 11:32 EDT by Tobias Riemenschneider CLA
Modified: 2005-06-16 17:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Riemenschneider CLA 2005-06-16 11:32:24 EDT
When I upgraded from M7 to RC2, a new compiler error was introduced to my code.
####
public class TestEclipse {

  public abstract class ClassA<A, B> {
    public abstract B method(A param);
  }

  public class ClassB<C, D extends C> {
    // the following field declaration causes an error
    ClassA<? super C, ? extends D> classA;

    public D method(D d) {
      return classA.method(d);
    }
  }
}
####
Declaring the field classA in the following way
  ClassA<? super C, D> classA;
causes RC2 to remove the error, but javac successfully compiles both the 
original and the changed code.
Comment 1 Philipe Mulet CLA 2005-06-16 12:26:39 EDT
Reproduced. It looks completely wrong.
Comment 2 Philipe Mulet CLA 2005-06-16 16:22:28 EDT
+1 for RC3

Darin - pls vote for it. Problem is that we issue an error which is totally
wrong (bound mismatch for variable with no formal bound !?) and it used to work
pre-RC2.

Added GenericTypeTest#test761-762


Problem comes from merged algorithm to find supertype erasure which lost custom
support for type variables in supertypes (here: ? extends D).
Fix is to propagate type variable check when walking supertypes.
Comment 3 Darin Wright CLA 2005-06-16 16:24:29 EDT
+1
Comment 4 Philipe Mulet CLA 2005-06-16 16:32:36 EDT
Fixed
Comment 5 Olivier Thomann CLA 2005-06-16 17:20:05 EDT
Verified using N20050616-0010 + JDT/Core HEAD