This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
dev build 200212110100 Something is majorily broken in the Import Management Tool (hence the P2 priority). I run it on the attached file and get: java.io.IOException, frequency = 2, final FQN freq = 0, Action: Create Import Statement ... I get this for 5-6 other classes. The thing is, these classes *are* being imported; there is no need to create a new import statement. I click on NEXT and enter the "Remove unused imports" screen. It suggests removing java.io.* (5-6 classes) and adding a single-name import on the package name. Specifically there is a node in the tree that reads: "java.io" and to its right it reads "Use Single- Name Import" instead of "Use Package Import" as I'm expecting. I click on FINISH and instead of adding a package-level import on java.io.* it simply *removes* all imports having to do with java.io.* and breaks my entire program.
Created attachment 8302 [details] Source-code used to reproduce problem
Import Managment Tool is part of the Java module. Reassigning.
Indeed. I was about to report a problem myself. Its hosed. Here is 1 issue. 1. If you invoke the IMT, and it shows unresolved identifiers 2. Go to source and hit space bar to change source. 3. invoke IMT and notice that it shows NO unresolved identifiers anymore. this is VERY bad because if you have unresolved identifiers naturally you will be editing the code next. So your next invocation will be a bad one. And if you finish out that bad IMT invocation it will remove lots of your necessary imports.
C'est la vie. I can not reproduce the errors I was speaking of today. RC1, windowsLF, 1.3.1_06. maybe the tool gets out of synch...
I used your file on 20030120 dev. build and I cannot reproduce the problem. I used your file (BTW: there is no ImageRepository and Category classes) and IMT creates two import statements for import java.io.IOException; import java.io.Serializable; with default settings (FQN threshold = 0 and wildcard threshold = 4).
dnoyeB, can you reproduce? On my end, I'll try reproducing the problem on the latest dev build on the same physical machine (at work). This will take me at least two weeks because I no longer have the original file and the only way for me to reproduce this is use Netbeans for long periods of time and hope I run into the problem. I'll let you know..would be nice if someone else can reproduce it quicker than me.
This could be related to issue #30290. I'm going to see if it is. When I first started with NB I started with internal compiler. Then since I learned more I always use external compiler now. So maybe thats why I don't see it anymore. But his conditions were VERY similar. compile. introduce error. recompile. That was the same scenario I used to produce the IMT issue. Testing. How can I add this to myissues list?
Perhaps this was a S1S issue and since I changed to NB because it was more "patched" I simply can not produce anymore. Tried my best but I have not seen a single hitch. I'm satisfied that either it was resolved, or I was CWI... Their is something lurking here though. Under certain steps, the IMT option disappears from the menu. Perhaps someone 'fixed' it by disabling it under certain conditions. I think once you invoke the IMT, it wont run again until the file is saved. the IMT even when it does no changes causes the file to require saving. unsure if this is related. im done with this one.
This issue is not closed. I just managed to reproduce it (randomily) under build 200301300100. But I do think you're right about one thing, the internal compiler might be somehow related to the problem.
Im trying to find out what is problem here and im a bit confused. From the report im not sure what is the problem. When I run the IMT on given class with default settings im getting: 1. On the 'Create Import Statements' page: java.lang.String Freq: 1 Final F.: 0 Action: No action java.io.IOException Freq: 2 Final F.: 2 Action: Use FQN java.io.Serializable Freq: 1 Final F.: 1 Action: Use FQN java.util.ArrayList Freq: 2 Final F.: 2 Action: Use FQN 2. On the 'Remove Unused Imports' page: All classes having 'Remove' action selected and all packages having 'Use Single-Name Import' action selected. According to the help it means that no import statement will be created and all classes will use Fully Qalified Names. Well IMHO no bug, but that could be only my problem that I did not uderstand the issue... So, Gili could you please be so kind and tell us what exactly did you reproduce and what do you think is the problem (and what is desired behaviour)?
In order to reproduce the behavior I do the following: 1) Use the internal compiler with default settings 2) Enable Java Sources | Import Management Tool Settings | Search well-known packages 3) When running the IMT, click FINISH on the first page of the wizard. I never bother expanding it. Maybe that's somehow related to the problem. This issue might also be related to the following scenerio: - Run IMT and at least one of the classes we depend on has a compilation bug (specifically, a class which *it* depends on has moved and cannot be found). Maybe under the aforementioned condition, IMT will fail to include this dependency because Reflection fails? Just a guess on my part.
Thanks a lot for a quick reply. The issue is, that I still do not understand what exactly is the problem. Which package import is mishandled? Could you attach here a result (bad one) of IMT aswell? Im guessing, the problem might be connected with a fact that IDE cannot find imported package/class? For example for me, if im using IMT on the WonderfulGirl class it indeed damages the source code, because "import com.shadowcraft.desktopbeautifier.ImageRepository;" is removed from a code, but line: "public class WonderfulGirls implements ImageRepository,.." remains untouched. For me this is clear: Class is not present (ie. import is not valid). But if the unavailability is temporal (so the code which was compilable is not compilable after using IMT), then indeed it might be some bug. But even that could be fixed on the 1st page of IMT where you can manually define link for Unresolved Identifiers (and then it works normally)
My issue was this, and its a little different from the original issue I think. IMT would remove required imports. And yes, I too hit finish on the first page because that page reported an error that I thought I needed to fix immediately.
DnojeB, thanks for reply, but I have to repeat myself: what is exactly the problem then? Im willing to fix this, but I have to know what do you think is the problem. Could you write here what exactly are you doing, what do you think is wrong (also put here 'bad' output) and how do you think it should work. (Gili, if you could aswell I would really apreciate it). Otherwise I vote for closing this one as worksforme (as designed). Do you agree Tomas? Btw you probably know, but for being sure: Anytime you are not satisfied with IMT result you can undo all changes by using classic editor undo.
Thank you for your consideration, I must also repeat myself. It removes necessary imports. Withtout necessary imports the program will not compile. This is 'bad' behavior. No, I never devised a method to reproduce this bug, and I have not seen it in a long time. Based on the date of the bug I am also suspicious that I might have been using S1S4 anyway which I switched from because it had too many bugs... I posted earlier that I supported closing this bug. I still do as I have yet to see it again. It must have been fixed by something.
OK. Please reopen this bug if you see it again. Thanks
I believe my issues are now being covered by issue #27671 issue #21919