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.
I get following NPE.
Created attachment 41097 [details] NPE
I am adding a new field to empty class ElementHandle<VariableElement> handle = ...; VariableElement elm = handle.resolve(wc); Tree tree = SourceUtils.treeFor(wc, elm); List<Tree> members = new ArrayList<Tree>(); members.add(tree); ... ClassTree newClassTree = make.Class( classTree.getModifiers(), classTree.getSimpleName(), newTypeParams, superClass, implementsList, members); Here is the debugger output. old class tree: public class NewClassEx { public NewClassEx() { super(); } } new class tree: public class NewClassEx extends newpackage.NewSuperClass { public int public_field; }
Reproducible. Temporary fix exists.
*** Issue 101725 has been marked as a duplicate of this issue. ***
*** Issue 102202 has been marked as a duplicate of this issue. ***
Changing priority to P1 (as issue 102202 is P1). This has a bad impact on WS Client code that isn't generated correctly. Isn't that possible to fix this to M9 ?
This issue is stopper for J1 preview release (Identity module).
It is related to detection of fields separated by commas. Unfortunately I do not have simple solution. I'm able to fix it, but it will broke other things. (Currently renaming of enum constant.) I have thought about the final solution and have some idea, but it is not bug fix, there has to be done more work than just changing several lines. When I'll be available, I'll try to find some hacking stuff.
Testcase Checking in test/unit/src/org/netbeans/api/java/source/gen/ClassMemberTest.java; /cvs/java/source/test/unit/src/org/netbeans/api/java/source/gen/ClassMemberTest.java,v <-- ClassMemberTest.java new revision: 1.25; previous revision: 1.24 done
Milane, is it newly created field or was it found in different source and replaced to the first one?
I was unable to reproduce it with my test-case. It looks like test-case does not cover the same scenario. Also, I was unable to reproduce it in current trunk build. We are trying to reproduce it with Honza.
Checking in src/org/netbeans/modules/refactoring/java/plugins/ExtractSuperclassRefactoringPlugin.java; /cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/ExtractSuperclassRefactoringPlugin.java,v <-- ExtractSuperclassRefactoringPlugin.java new revision: 1.3; previous revision: 1.2 done
Created attachment 41636 [details] Applied workaround.
Workaround exists, see commit to refactoring/java or attachement. It doesn't mean that issue is finished, we still plan to fix it correctly. For the time being, please, use workaround if you need immediate fix. Removing PREVIEW_STOPPER and changing priority back to P2. (Only what you need is not to put the found tree to different places. Make a copy of it.)
*** Issue 102813 has been marked as a duplicate of this issue. ***
Should be this fixed now? I've found reproducible testcase in actual build. Just call Pull Up on class with two methods and two fields and select all to be refactored.
Please, would it be possible to fix that for M10 ? See the issue 107039. I applied a workarond suggested in this issue but, apparently, this didn't help.
I'm not sure, perhaps no.
*** Issue 107350 has been marked as a duplicate of this issue. ***
Priority increased because of P1 duplicate.
Anyone has a simple straight-forward reproducible test-case? I'm trying to figure out the test for it, but still I'm not successful.
Not so straightforward, but reliably reproducible with following steps: -have an IDE with enterprise cluster -create new Java EE 5 web project (you'll need glassfish for this - https://glassfish.dev.java.net/downloads/v2-b52.html) -create new file -> web services -> web service client (you can use this wsdl URL: http://wsparam.strikeiron.com/zipinfo?wsdl) -create new servlet -invoke web service client resources -> Call ws operation from editor's context menu within processRequest method in the servlet, choose eg. getZipinfoSoap in the dialog which appears and press OK => reported NPE You can also try to check generateServiceRefInjection method in JaxWsCodeGenerator class from websvc/core module from where this NPE is being thrown, this could maybe save you some time.... Hope this somehow helps
Preventing NPE. Hacking stuff, should work for you right now. Checking in org/netbeans/modules/java/source/save/CasualDiff.java; /cvs/java/source/src/org/netbeans/modules/java/source/save/CasualDiff.java,v <-- CasualDiff.java new revision: 1.143; previous revision: 1.142 done
Thanks to Honza Stola and Lukas Jungmann for test-cases, I used Honza's test-case to reproduce the issue. (Glassfish installation and Enterprise cluster compiling was exactly what I didn't want to do. ;-) It takes too long.) Please, reopen, if you are able to reproduce it in another testcase.
Still reproducible in Lukas' test-case. Another hack, now it will be hopefully correct. Checking in src/org/netbeans/modules/java/source/save/CasualDiff.java; /cvs/java/source/src/org/netbeans/modules/java/source/save/CasualDiff.java,v <-- CasualDiff.java new revision: 1.144; previous revision: 1.143 don
That's it, thank you a lot, Pavel! :) Since I'm not able to reproduce this any more in any test case I have, I'm marking this as verified. We will reopen this if we find some new test case for this (if there will be any, but I hope there won't be ;)...)