First of all, the Java language lab is type safe. We usually encounter this problem when the object is converted to the target type
This transformation is not safe. This problem is generally believed to be caused by the use of JDK1.5 or 1.6 generics
Request. Getattribute (“* *”) gets a type that defaults to object. When you convert them to list & lt***> When
The compiler thinks that there may be errors, so it prompts that this type is safe
But how to remove this warning?The following is a common way to remove the warning (but the danger has not been removed)
1: Method to add @ suppresswarnings (“unchecked”)
2: Eclipse’s window – > Preferences-> Java-> Compiler-> Errors/Warning-> In generic types, unchecked generic type operation is set to ignore
3: Eclipse’s window – > Preferences-> Java-> Compiler sets compiler compliance level to less than 1.5
Similar Posts:
- [Solved] Syntax error, parameterized types are only available if source level is 1.5
- Convert Object to List>, avoiding Unchecked cast: ‘java.lang.Object’ to ‘java.util.List
- [Solved] Maven Error: No compiler is provided in this environment. Perhaps you are running on a JRE rather t…
- Javassist Compile Error: Type long_2nd (current frame, stack[2]) is not assignable to ‘java/lang/Long’
- Eclipse Unable to install breakpoint in XXX [How to Solve]
- How to Solve JAVA @override error
- Raw use of parameterized class ‘Future’
- An error is reported after eclipse changes the JDK version
- Maven Package Error: [INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files