-
-
Notifications
You must be signed in to change notification settings - Fork 350
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
[Bug]: When you import a static inner class, spoon converts it to a non-static import #5528
Comments
Hi @honghao12 ! I tried reproducing it, but |
In what version of Java is import static used to import classes as opposed to fields and methods? Does that even compile with javac? |
The relevant part of the JLS regarding that is § 7.5.3. It mainly mentions static members, which includes static nested classes. This becomes clear from the following sentence (emphasis mine):
I don't know how well we have test coverage for that, but we should make sure that we get imports right for both static nested classes and non-static nested classes. |
Today I learned. From what I understand, for a static inner class it makes no real difference anyway, and some coding standards (like Google's) explicitly forbid using a single static import for static one classes ("use normal import instead"). Of course SPOON should handle this correctly. But the result (the missing "static" keyword) should have no negative effect on the resulting code from a practical point of view in (nearly?) all cases. |
Describe the bug
When you import a static inner class, spoon converts it to a non-static import
Source code you are trying to analyze/transform
Source code for your Spoon processing
Actual output
Expected output
Spoon Version
10.4.3-beta-2
JVM Version
11
What operating system are you using?
windows
The text was updated successfully, but these errors were encountered: