Open shoeoffhead opened 4 years ago
Thanks a lot for the bug report.
Could you share a link to the source file you're analyzing?
Just the latest commons-io version: 2.6 https://mvnrepository.com/artifact/commons-io/commons-io/2.6
You can also download it manually: https://repo1.maven.org/maven2/commons-io/commons-io/2.6 The file is called: commons-io-2.6-sources.jar
I also use the latest Spoon.
Would you be able to isolate the bug in a failing test case in a pull request? That would be super useful. Thanks!
I did now several other tests read/writing sources from big libraries. I always have issues with static imports not written out.
I will prepare a minimal project for you showing the bug. I am not very familiar with Github ;)
[UPDATE]: I forgot that this problems happens when using launcher.getEnvironment().setAutoImports(true);
With this setting Spoon removes the static import in the written out source code: for example: import static java.lang.Character.isLetter;
If I use setAutoImports(false), Spoon removes the static import BUT also writes the full qualified name for EVERY import in the source code: for example: java.lang.Character.isLetter(...)
I would prefer using setAutoImports(true) because otherwise the source code is cluttered with qualified names.
excellent, looking forward to it!
Did you have time looking into this?
Not yet. If you could reproduce the bug in a failing test case in a pull request, that would be super useful. Thanks!
Sorry. I am not really familiar with Git. The zip project is super simple though. You can reproduce the problem in seconds.
I just did a little test reading in and writing out commons-io-2.6-sources.jar with Spoon.
IOUtils defines: public static final int EOF = -1;
This is statically imported by org.apache.commons.io.output.ByteArrayOutputStream and org.apache.commons.io.EndianUtils
Spoon just adds this static import to ByteArrayOutputStream but NOT EndianUtils