java – Error when using LogManager (l4j2) with Java 8 (Java.lang.reflect.AnnotatedElement cannot be fixed)

When using JDK 8 and an IDE (or any other code processing tool / framework) with its own compiler, such as Eclipse, you need to upgrade the tool to a version with Java 8 support, even if you are not using the new features of Java 8.

The reason is that the compiler must be able to load the latest JRE class files to compile the software that references those classes.

Sometimes you can get away with an older compiler when it ignores the newer version number of the class files. But some types will confuse old-class file parsers as they use new features, in particular AnnotatedElement which now has methods default And Map.Entry a interface which now has methods static.

Eclipse appears to make no difference between references for which no class file was found and class files which it failed to read when it says ““classname”cannot be solved. “

The same is true for all tools and frameworks that use ECJ as a built-in compiler.

Leave a comment