-
-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some issues with static imports and inner classes or enums #1048
Conversation
…ith an or instead of an and. Now the test is failing, proof that the assertion is checked :)
… a local variable in the same block or by a field (or a variable in another block). First detection implemented but patch not satisfying.
Solve in using version of inria/master
…e tests in DefaultJavaPrettyPrinterTest)
} | ||
|
||
} | ||
printer.writeln().writeTabs(); | ||
} | ||
} | ||
|
||
private String removeInnerTypeSeparator(String FQN) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name FQN
does not comply with Java conventions. Our xxxx-checkstyle doesn't detect this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently not... I'll open an issue to fix/simplify the checkstyle!
} | ||
|
||
} | ||
printer.writeln().writeTabs(); | ||
} | ||
} | ||
|
||
private String removeInnerTypeSeparator(String FQN) { | ||
return FQN.replace('$', '.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a TYPE_SEPARATOR representing $
somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed.
Some issues have been detected using spoon on open source projects (see https://ci.inria.fr/sos/job/EveryNightRegressionTesting/516/) du to failing static import on inner classes or enum.
Fix the detected errors by changing the way fully qualified name are printed in imports for inner classes (for now a $ was printed before the inner class name) and by detecting in the MinimalImportScanner if the simpleName of the currentRef is creating a collision: in that case, we should not import the element as it could create bug by autoreference.