8016640: compiler hangs if the generics arity of a base class is wrong
Summary: Check.checkCompatibleConcretes hang when javac creates synthetic supertypes for 269 model API
Reviewed-by: jjg
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jul 17 14:14:49 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jul 17 14:16:25 2013 +0100
@@ -2245,7 +2245,7 @@
@Override
public Type visitErrorType(ErrorType t, Void ignored) {
- return t;
+ return Type.noType;
}
};
// </editor-fold>
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Wed Jul 17 14:14:49 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Wed Jul 17 14:16:25 2013 +0100
@@ -46,6 +46,7 @@
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.code.TypeTag;
import com.sun.tools.javac.comp.AttrContext;
import com.sun.tools.javac.comp.Env;
import com.sun.tools.javac.tree.JCTree;
@@ -516,7 +517,7 @@
return null;
Type sup = env.types.supertype(type);
return TypeMaker.getType(env,
- (sup != type) ? sup : env.syms.objectType);
+ (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup);
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/8016640/T8016640.java Wed Jul 17 14:16:25 2013 +0100
@@ -0,0 +1,10 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8016640
+ * @summary compiler hangs if the generics arity of a base class is wrong
+ * @compile/fail/ref=T8016640.out -XDrawDiagnostics T8016640.java
+ */
+class T8016640 {
+ static class Foo<X,Y> { }
+ static class BadFoo<T> extends Foo<T> { }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/8016640/T8016640.out Wed Jul 17 14:16:25 2013 +0100
@@ -0,0 +1,2 @@
+T8016640.java:9:39: compiler.err.wrong.number.type.args: 2
+1 error