Merge
This commit is contained in:
commit
501fe865e8
@ -1169,12 +1169,17 @@ public class Check {
|
||||
if (lint.isEnabled(LintCategory.RAW) &&
|
||||
tree.type.tag == CLASS &&
|
||||
!TreeInfo.isDiamond(tree) &&
|
||||
!env.enclClass.name.isEmpty() && //anonymous or intersection
|
||||
!withinAnonConstr(env) &&
|
||||
tree.type.isRaw()) {
|
||||
log.warning(LintCategory.RAW,
|
||||
tree.pos(), "raw.class.use", tree.type, tree.type.tsym.type);
|
||||
}
|
||||
}
|
||||
|
||||
boolean withinAnonConstr(Env<AttrContext> env) {
|
||||
return env.enclClass.name.isEmpty() &&
|
||||
env.enclMethod != null && env.enclMethod.name == names.init;
|
||||
}
|
||||
}
|
||||
|
||||
/* *************************************************************************
|
||||
|
37
langtools/test/tools/javac/warnings/7090499/T7090499.java
Normal file
37
langtools/test/tools/javac/warnings/7090499/T7090499.java
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 7094099
|
||||
* @summary -Xlint:rawtypes
|
||||
* @compile/fail/ref=T7090499.out -XDrawDiagnostics -Xlint:rawtypes T7090499.java
|
||||
*/
|
||||
|
||||
|
||||
class T7090499<E> {
|
||||
|
||||
static class B<X> {}
|
||||
|
||||
class A<X> {
|
||||
class X {}
|
||||
class Z<Y> {}
|
||||
}
|
||||
|
||||
T7090499 t = new T7090499() { //raw warning (2)
|
||||
|
||||
A.X x1;//raw warning
|
||||
A.Z z1;//raw warning
|
||||
|
||||
T7090499.B<Integer> b1;//ok
|
||||
T7090499.B b2;//raw warning
|
||||
|
||||
A<String>.X x2;//ok
|
||||
A<String>.Z<Integer> z2;//ok
|
||||
A<B>.Z<A<B>> z3;//raw warning (2)
|
||||
|
||||
void test(Object arg1, B arg2) {//raw warning
|
||||
boolean b = arg1 instanceof A;//ok
|
||||
Object a = (A)arg1;//ok
|
||||
A a2 = new A() {};//raw warning (2)
|
||||
a2.new Z() {};//raw warning
|
||||
}
|
||||
};
|
||||
}
|
17
langtools/test/tools/javac/warnings/7090499/T7090499.out
Normal file
17
langtools/test/tools/javac/warnings/7090499/T7090499.out
Normal file
@ -0,0 +1,17 @@
|
||||
T7090499.java:18:5: compiler.warn.raw.class.use: T7090499, T7090499<E>
|
||||
T7090499.java:18:22: compiler.warn.raw.class.use: T7090499, T7090499<E>
|
||||
T7090499.java:20:10: compiler.warn.raw.class.use: T7090499.A.X, T7090499<E>.A<X>.X
|
||||
T7090499.java:21:10: compiler.warn.raw.class.use: T7090499.A.Z, T7090499<E>.A<X>.Z<Y>
|
||||
T7090499.java:24:17: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
|
||||
T7090499.java:26:10: compiler.err.improperly.formed.type.inner.raw.param
|
||||
T7090499.java:27:10: compiler.err.improperly.formed.type.inner.raw.param
|
||||
T7090499.java:28:18: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
|
||||
T7090499.java:28:17: compiler.err.improperly.formed.type.inner.raw.param
|
||||
T7090499.java:28:11: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
|
||||
T7090499.java:28:10: compiler.err.improperly.formed.type.inner.raw.param
|
||||
T7090499.java:30:32: compiler.warn.raw.class.use: T7090499.B, T7090499.B<X>
|
||||
T7090499.java:33:13: compiler.warn.raw.class.use: T7090499.A, T7090499<E>.A<X>
|
||||
T7090499.java:33:24: compiler.warn.raw.class.use: T7090499.A, T7090499<E>.A<X>
|
||||
T7090499.java:34:20: compiler.warn.raw.class.use: T7090499.A.Z, T7090499<E>.A<X>.Z<Y>
|
||||
4 errors
|
||||
11 warnings
|
Loading…
Reference in New Issue
Block a user