[Codenarc-user] UnnecessaryGroovyImport handles static imports incorrectly
Brought to you by:
chrismair
From: R. S. <ren...@go...> - 2011-05-29 19:00:08
|
Why does UnnecessaryGroovyImport mark static import of default imports as unnecessary? They are not staticly imported by default. Looking UnnecessaryGroovyImportTest shows that static imports are also tested. But the expected results are incorrect. See below: --------------------------------------------------------------- void testApplyTo_StaticImport_Violations() { final SOURCE = ''' import static java.io.DataInputStream.* import static java.lang.Integer.MAX_VALUE ''' assertTwoViolations(SOURCE, 2, 'import static java.io.DataInputStream.*', 3, 'import static java.lang.Integer.MAX_VALUE') } --------------------------------------------------------------- If for example MAX_VALUE from java.lang.Integer should be used directly without prefixing it with Integer, it has to be imported staticly. If you feel the samem just let me know and I will open a ticket and fix it. Regards, René Scheibe |