Relates :
|
|
Relates :
|
|
Relates :
|
FULL PRODUCT VERSION : java version "1.5.0_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05) Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing) A DESCRIPTION OF THE PROBLEM : Invalid generics code does compiles under certain conditions STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Try to compile the code given. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The code should not compile ACTUAL - The code compiles REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- package tests; import java.util.Collection; import java.util.Collections; public class CompileTest1 { class Request<R extends Request<R, V>,V> {} class RequestMap { public <R extends Request<R, W>,W> R intersection (Collection<R> c) { // In my real code I make use of W of course return null; } } class DeltaRequest extends Request<DeltaRequest,double[]> {} public void test () { RequestMap m = new RequestMap (); Collection<DeltaRequest> c = Collections.singleton (new DeltaRequest ()); // Why does this line compile? DeltaRequest o = m.intersection (c); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Err ...
|