-
Bug
-
Resolution: Fixed
-
P2
-
5.0, 6
-
b03
-
generic, x86
-
generic, windows_xp
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2152441 | OpenJDK6 | Jonathan Gibbons | P3 | Closed | Not an Issue |
Name: rmT116609 Date: 06/10/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When an ambiguous reference is made to a member of a type variable (either a method or an inner class), no error is reported.
Also, the acessibility checking for members is incorrect when the type variable has multiple bounds.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Test.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Test.java:7: reference to Inner is ambiguous
Test.java:9: reference to m1() is ambiguous
ACTUAL -
Test.java:8: _field is not public in Base; cannot be accessed from outside package
t._field = 3; // This should not be an accessibility error
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
public class Test<T extends Base & Intf> {
public void foo() {
T t = null;
T.Inner inner = null; // This should be an ambiguous error
t._field = 3; // This should not be an accessibility error
t.m1(); // This should be an ambiguous error
}
}
class Base {
static class Inner {}
int _field;
int m1(){ return 0;}
}
interface Intf {
static final String C1 = "BLAH";
static class Inner{}
void m1();
}
---------- END SOURCE ----------
(Incident Review ID: 276926)
======================================================================
FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When an ambiguous reference is made to a member of a type variable (either a method or an inner class), no error is reported.
Also, the acessibility checking for members is incorrect when the type variable has multiple bounds.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Test.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Test.java:7: reference to Inner is ambiguous
Test.java:9: reference to m1() is ambiguous
ACTUAL -
Test.java:8: _field is not public in Base; cannot be accessed from outside package
t._field = 3; // This should not be an accessibility error
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
public class Test<T extends Base & Intf> {
public void foo() {
T t = null;
T.Inner inner = null; // This should be an ambiguous error
t._field = 3; // This should not be an accessibility error
t.m1(); // This should be an ambiguous error
}
}
class Base {
static class Inner {}
int _field;
int m1(){ return 0;}
}
interface Intf {
static final String C1 = "BLAH";
static class Inner{}
void m1();
}
---------- END SOURCE ----------
(Incident Review ID: 276926)
======================================================================
- backported by
-
JDK-2152441 No error for ambiguous member of intersection
- Closed
- duplicates
-
JDK-6421111 NullPointerException thrown when retrieving bounds for the type parameter
- Closed
-
JDK-6199146 Javac accepts ambiguous compound type
- Closed
- relates to
-
JDK-7030781 problem with multiple interface inheritance using bounded type parameters
- Closed