Intellij highlights error but code can be compiled and running correctly
hello everyone,
I met a strange issue in Intellij Ultimate 2019.3.2. It indicates a Java generic type error, like 'reason: no instance(s) of type variable(s) exist so that OCPerson conforms to IBaseObject' when I integrated a jar which provides a generic method in my current project, but the project can be compiled without any error or warning in Oracle JDK 8. More strange, when I use the generic method as source code directly, Intellij doesn't promote the error any more. Please see the detailed information in below:
The generic method signature looks like the below:
public static <T extends IBaseObject> void setEntityNameForMapObject(Map map, String key, Class<T> entityClass)
I built it as a single jar library. When I used this jar in a project, Intellij indicated the below error information. Actually, Gradle can compile the project correctly and there is no any warning message. BTW, the Intellij uses JDK 1.8.0_152. When I copy the source code in the current project, the indicated error message is gone in Intellij.

Could anyone point what is wrong for me?
Please sign in to leave a comment.
This could be a cache problem. Try "File | Invalidate caches and restart". Additionally, please switch IDEA's boot JDK to 11, it is more stable:
https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under
The problem still exists even I did specify the latest IDEA JDK and "Invalidate caches and restart".
No ideas on the fly. Please report at https://youtrack.jetbrains.com/issues/IDEA with a sample project attached