Raw Type Warning in Android Studio

Android Studio does not show a compiler warning when using a raw type when referencing a generic type. Is there any way to enable this feature?

public class GenericClass<T> { } public class SpecificClass extends GenericClass { } 

Eclipse usually displays the following warning: GenericClass is a raw type. References to the generic GenericClass <T> type should be parameterized.

+7
java android-studio compiler-warnings
source share
1 answer

You can enable a warning, but you cannot do this as a compilation error. The same thing happens in Eclipse [see Tail to upgrade]. You can refer to JLS , which points to this compilation warning, not a compilation error.

You can enable validation in your Android studio. Go to File > Settings > Inspection and enable validation, since the setting "Unhandled use of a parameterized class", as shown below, can help:

raw usage

Thanks Stephan: you can enable this in Eclipse using: Java Compiler > Errors/Warnings > Generic Types > Usage of a raw type : and select Error in combo

+6
source share

All Articles