Enums are not correctly handled (included suggested fix)
Eclipse Plugin to find unused Java code
Brought to you by:
spj
Enums are not correctly handled
They are listed as fields and shown as unused, even if they are used.
I ran into a similar issue working with the Eclipse JDT, which was related to the JDT compiler options by default using 1.4, before enums existed. The fix that worked in my project was to call the following on my compiler options
JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, compilerOptions);
I'm also using the AST.JLS8 level for the parser, so it can handle reading Java 1.8 code.
I'm using version 3.12.2 of the dependency "org.eclipse.jdt > org.eclipse.jdt.core".
Anonymous
Just testet with eclipse Neon.3 Release (4.6.3). Everything works fine.
I think it is a problem of your default compiler settings in Eclipse.
UCDetector will not JavaCore.setComplianceOptions() because it seems to change the default settings of of Eclipse.