Wed, 17 Jul 2013 14:16:25 +0100
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
1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jul 17 14:14:49 2013 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jul 17 14:16:25 2013 +0100 1.3 @@ -2245,7 +2245,7 @@ 1.4 1.5 @Override 1.6 public Type visitErrorType(ErrorType t, Void ignored) { 1.7 - return t; 1.8 + return Type.noType; 1.9 } 1.10 }; 1.11 // </editor-fold>
2.1 --- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Wed Jul 17 14:14:49 2013 +0100 2.2 +++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Wed Jul 17 14:16:25 2013 +0100 2.3 @@ -46,6 +46,7 @@ 2.4 import com.sun.tools.javac.code.Symbol.*; 2.5 import com.sun.tools.javac.code.Type; 2.6 import com.sun.tools.javac.code.Type.ClassType; 2.7 +import com.sun.tools.javac.code.TypeTag; 2.8 import com.sun.tools.javac.comp.AttrContext; 2.9 import com.sun.tools.javac.comp.Env; 2.10 import com.sun.tools.javac.tree.JCTree; 2.11 @@ -516,7 +517,7 @@ 2.12 return null; 2.13 Type sup = env.types.supertype(type); 2.14 return TypeMaker.getType(env, 2.15 - (sup != type) ? sup : env.syms.objectType); 2.16 + (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup); 2.17 } 2.18 2.19 /**
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/tools/javac/generics/8016640/T8016640.java Wed Jul 17 14:16:25 2013 +0100 3.3 @@ -0,0 +1,10 @@ 3.4 +/* 3.5 + * @test /nodynamiccopyright/ 3.6 + * @bug 8016640 3.7 + * @summary compiler hangs if the generics arity of a base class is wrong 3.8 + * @compile/fail/ref=T8016640.out -XDrawDiagnostics T8016640.java 3.9 + */ 3.10 +class T8016640 { 3.11 + static class Foo<X,Y> { } 3.12 + static class BadFoo<T> extends Foo<T> { } 3.13 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/tools/javac/generics/8016640/T8016640.out Wed Jul 17 14:16:25 2013 +0100 4.3 @@ -0,0 +1,2 @@ 4.4 +T8016640.java:9:39: compiler.err.wrong.number.type.args: 2 4.5 +1 error