You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling java source code, rules about Raw types are not enforced.
note that in any real project, the javac compiler will also run and check these rules so this is not super high priority
Compiler version
3.4.0-RC3
Minimized code
// RawTypes.javapackagelib;
publicclassRawTypes {
publicclassC<T> {
publicclassD<U> {}
}
publicstaticvoidm_Raw_Raw(C.Dd) {}
publicstaticvoidm_Raw_Gen(C.D<Object> d) {} // should be errorpublicstaticvoidm_Gen_Raw(C<Object>.Dd) {} // should be error
}
Output
compiles ok
Expectation
javac compiler gives these errors:
RawTypes.java:10: error: improperly formed type, type arguments given on a raw type
public static void m_Raw_Gen(C.D<Object> d) {} // should be error
^
RawTypes.java:11: error: improperly formed type, some parameters are missing
public static void m_Gen_Raw(C<Object>.D d) {} // should be error
^
2 errors
JLS 4.8 states these rules
It is a compile-time error to pass type arguments to a non-static member class or interface of a raw type that is not inherited from its superclasses or superinterfaces.
^ this invalidates C.D<Object> as a type, because D is not static, and C is a raw type.
It is a compile-time error to attempt to use a member class or interface of a parameterized type as a raw type.
^ this invalidates C<Object>.D as a type, because D is not allowed to be a raw type when C is parameterized.
Notes
C.D is ok because they are all raw types.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
When compiling java source code, rules about Raw types are not enforced.
note that in any real project, the javac compiler will also run and check these rules so this is not super high priority
Compiler version
3.4.0-RC3
Minimized code
Output
compiles ok
Expectation
javac compiler gives these errors:
JLS 4.8 states these rules
^ this invalidates
C.D<Object>
as a type, becauseD
is not static, andC
is a raw type.^ this invalidates
C<Object>.D
as a type, becauseD
is not allowed to be a raw type whenC
is parameterized.Notes
C.D
is ok because they are all raw types.The text was updated successfully, but these errors were encountered: