-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.1.4, 1.2.0
-
generic
-
generic
allan.jacobs@Eng 1997-10-13
The class Ambig extends S and implements I. Both S and I define a field i, but
this field is private in S. Therefore, Ambig inherits i from I only. There
should not be any ambiguity. Problem discovered using Modena test c0814702.
algol% cat Ambig.java
interface I {
int i=1;
}
class S {
private int i=-1;
int getI(){ return i; }
void setI( int j ){ i=j; }
}
public class Ambig extends S implements I {
public static void main( String[] argv ) {
Ambig a = new Ambig();
System.out.println(a.i);
}
}
algol% java -fullversion
java full version "1.1.4n:1997.09.11"
algol% setenv CLASSPATH .
algol% javac -d . Ambig.java
Ambig.java:13: Reference to i is ambiguous. It is defined in interface I and class S.
System.out.println(i);
^
1 error
- duplicates
-
JDK-4053724 reports non-ambiguous field access as ambiguous
-
- Closed
-