-
Notifications
You must be signed in to change notification settings - Fork 874
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
Problem renaming classes and interfaces in Java projects #3725
Comments
Thanks. Multiple reports and I've seen this myself. Adding milestone but no priority at this stage. |
Tried reinstalling Netbeans 13 against JDK 11 and I still get this problem. |
I got the same error with Usage search when loading Keycloak project. Dump file is in the attached GroupLDAPStorageMapper.zip, originating from Keycloak project Product Version: Apache NetBeans IDE 15 OS: Fedora 36
|
Same here, Netbeans 15, Win10, JDK17.
|
Is this still being worked on? This is a huge blocker on any sort of refactor work because none of other tests are operational either because this is failing :compileJava level |
Any resolution is appreciated, if anyone has been able to resolve this: Sharing my logs here too, just in case: Same issue with Gradle as well:
|
So, I found a fix that worked for me - not sure if this will help others. Originally, I was on Amazon Corretto Java 17.0.2 and now I upgraded it Amazon Corretto Java 17.0.8 and it did the trick - able to have a successful build now. I hope this helps someone if they're still blocked by this error. Happy Coding! |
@gg-happyhour #3725 (comment) this exception you posted is from Gradle and not from NetBeans. However, it is interesting that updating to the latest JDK 17 release did fix it for you. This might indicate that it was fixed in javac itself at some point. (NB 18 ships with a javac based on JDK 20) |
The problem occurs and with moving classes/interfaces from package in one module to package in another module:
|
@neilcsmith-net Can you explain why this issue wasn't fixed again? Nobody can reproduce it? Or there are other problems? I asked in dev mailing list a few days ago but my message was ignored. |
@PavelTurk short answer, because nobody worked on it. I've certainly seen this issue, as I mentioned earlier, which seems related to JPMS. |
@neilcsmith-net Yes, I also think it is related with to JPMS. If I can give exact steps to reproduce it can you fix the issue? I am asking because I once spent several hours trying to reproduce it, but failed. So, it can require N hours. |
the stacktrace is from javac, so it is unlikely to be fixable within NB. But having minimal NB reproducer might help to create a javac reproducer and file a bug against openjdk. NB 22 which is baking in master will also have a newer javac based on jdk 22, so the stack traces might differ slightly between NB 21 which was just released and future 22. |
@mbien I think it is related to JPMS, NB cache and refactoring. I will explain why I think so. I've noticed that when I clear NB cache and everything is OK, no errors are shown in NB, all code is compiled and works. Then I start refactoring. If I change key classes/interfaces I can get something like this in my tests: NB says that some modules are not imported, but it is false as if I clear cache again, then everything is OK. Besides renaming stops working at some point. I work only with JPMS. |
I even opened this issue #6750 because I need to clear NB cache sometimes 3-4 times a day. That's really very serious problem for me. |
i also noticed some oddities while using modules: #6725 those things might be related, however IMO javac should not throw NPEs, there might be also something wrong there. |
@PavelTurk thanks for taking your time and creating a reproducer. We had many duplicates but not one which showed how to replicate it. we have now a PR #7153 open which tries to resolve the issue, the workflow there should produce dev-builds for easy testing. (e.g build, expires in 7 days) I did also go through the duplicates and linked everything to the PR. |
@PavelTurk it worked for me, i tried it twice and it renamed it correctly. First time I opened all projects and it got renamed everywhere, second time I only opened api and impl1 and it got only renamed in those two modules. |
@mbien That's very strange. Maybe we use different java versions? Please see this peek: Peek.2024-03-14.21-24.mp4 |
I was using JDK 21.0.2 too as NB runtime. The same JDK was used for the project since that is the default (I haven't modified anything after starting or opening the project, however I did build it once first). can you try to reset the project and run again from a fresh user directory. E.g:
|
this reminds me, since your project uses java modules, building before refactoring might be required as workaround at the moment due to #6725 |
@mbien I did two tests. Both tests failed - class was renamed only in one file and wasn't renamed in files that use it. Test 1.
Test 2.
|
@mbien I also tried to use JDK 21.0.2 instead of JDK 21.0.1 - didn't help. I increased minimum memory to 3GB - didn't help. |
we are likely going to merge #7153 soon, this will close a bunch of bug reports including this one here. The fact that @PavelTurk is still experiencing issues which I can't reproduce unfortunately, indicates that there is likely a second problem somewhere, additional to the javac NPEs which this was about. In a week or so there will be NB 22 rc1 out, if it is still reproducible I would recommend to file a fresh bug report against NB 22, essentially pasting the reproducer of #3725 (comment) into the form so that it is not lost. |
@mbien I am using now Apache NetBeans IDE 22-rc1. Unfortunately as I noticed earlier sometimes (not always) renaming happens only in main file (that declares class/enum), but not in files that use them. Although situation became much better. Should I open a new issue? As I see #7331 is not about this problem. |
@PavelTurk yes please file a fresh bug report based on your post at #3725 (comment). I suppose you could copy/paste most of the post. |
Apache NetBeans version
Apache NetBeans 13
What happened
I have maven projects with modules. Evey module is also a JPMS module (contains module-info). So, I have api modues, impl modules etc. I often get the following error when I try to rename classes/interfaces/packages. So, every severe refactoring goes with pain.
This is the log
How to reproduce
Unfortunately I can't provide a solid example how to reproduce this error. It often happens but I can get it when I need. Sometimes it works well, sometime gives the error.
Did this work correctly in an earlier version?
No
Operating System
Ubuntu 20.04.3 LTS, Linux version 5.11.0-38-generic running on amd64; UTF-8; en_US (nb)
JDK
Java: 17.0.2; OpenJDK 64-Bit Server VM 17.0.2+8-86
Apache NetBeans packaging
Apache NetBeans provided installer
Anything else
No response
Are you willing to submit a pull request?
No
Code of Conduct
Yes
The text was updated successfully, but these errors were encountered: