EVALUATION
---
The submitter was almost right. There should be two errors. However,
the problem with m1() should be reported when the type variable T is
defined:
Test.java:3: m1() in Base cannot implement m1() in Intf; attempting to assign weaker access privileges; was public
public class Test<T extends Base & Intf> {
^
Test.java:7: reference to Inner is ambiguous, both class Base.Inner in Base and class Intf.Inner in Intf match
T.Inner inner = null; // This should be an ambiguous error
^
2 errors
|
SUGGESTED FIX
Index: j2se/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
6-10-22 21:21:15.000000000 -0700
+++ /tmp/getb22606 2006-10-22 21:21:15.000000000 -0700
@@ -342,7 +342,6 @@
// Enter and attribute type parameters.
List<Type> tvars = enter.classEnter(typarams, env);
attr.attribStats(typarams, env);
- attr.attribBounds(typarams);
// Enter and attribute value parameters.
ListBuffer<Type> argbuf = new ListBuffer<Type>();
@@ -406,7 +405,6 @@
(types.supertype(tree.sym.type).tsym.flags() & Flags.ENUM) == 0) {
addEnumMembers(tree, env);
}
- attr.attribBounds(tree.typarams);
memberEnter(tree.defs, env);
}
Index: j2se/src/share/classes/com/sun/tools/javac/comp/Attr.java
--- /tmp/geta12673 2006-10-24 22:24:16.000000000 -0700
+++ /tmp/getb12673 2006-10-24 22:24:16.000000000 -0700
@@ -532,10 +532,10 @@
Lint lint = env.info.lint.augment(m.attributes_field, m.flags());
Lint prevLint = chk.setLint(lint);
-
+ try {
chk.checkDeprecatedAnnotation(tree.pos(), m);
- try {
+ attribBounds(tree.typarams);
// If we override any other methods, check that we do so properly.
// JLS ???
@@ -2642,6 +2642,7 @@
chk.validateAnnotations(tree.mods.annotations, c);
// Validate type parameters, supertype and interfaces.
+ attribBounds(tree.typarams);
chk.validateTypeParams(tree.typarams);
chk.validate(tree.extending);
chk.validate(tree.implementing);
|