Comments (4)
Hi @honghao12 ! I tried reproducing it, but anImport.toString
does evaluate to import static StaticTest3.StaticInnerTest1
. This functionality was last touched in #5213 and it was also released in 10.4.0
so it should work on any release after that. However, if it is still not working for you, could you please reproduce the output as a pull request (ideally as a new testcase)?
from spoon.
In what version of Java is import static used to import classes as opposed to fields and methods? Does that even compile with javac? import static StaticTest3.StaticInnerTest1
looks like it should be a compile time error anyway. import StaticTest3.StaticInnerTest1
looks correct.
from spoon.
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):
It is permissible for one single-static-import declaration to import several fields, classes, or interfaces with the same name, or several methods with the same name and signature.
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.
from spoon.
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.
from spoon.
Related Issues (20)
- [Bug]: Not allowed javaletter or keyword in identifier found HOT 5
- Move or delete spoon testing package from src/main HOT 1
- Delete old unused javadoc package HOT 2
- [Bug]: Under multithreading, using the isOverriding method will lead to incorrect results of the getElements method
- [Bug]: How to correctly recognize the signature of invoked methods in lambda expression?
- Java Compatibility with Older Versions of Spoon HOT 1
- [Bug]: CtReferenceImpl.isSpecialType throws an exception
- [Bug]: Bug adding comment in AST of lambda HOT 2
- Update a method calls reference
- java 22 HOT 1
- [Bug]: Control Flow graph missing edge for implicit default case in switch
- [Bug]: Control Flow Graph doesn't handle cases with multiple expressions
- Spotless for imports HOT 2
- [Bug]: Spoon inserts incorrect break in enhanced switch block
- [Feature Request]: Minimize Parens in `DefaultJavaPrettyPrinter` should use operator precedence (`(a == b) || (b == c)` could be `a == b || b == c`) HOT 2
- [Bug]: Javadoc of class missing HOT 1
- improve reproducible build architecture for Spoon HOT 2
- Unable to start JavaFX UI
- How to Implement Angelic Value with Spoon for APR
- Processing import Statements HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spoon.