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.
In the code editor, when you use the wizards to add a property to a class, the "preview" code is ok but the actual code inserted into the editor is messed up. Steps: 1. Create a new source file for a class, name it whatever you want. 2. Inside the code editor, press ALT-Insert, then choose "Add Property..." from the resulting drop-down 3. Give the propery a name, type, and check the checkboxes for "Generate getter and setter" as well as "Generate Property Change Support" 4. Look at the code preview - it all look ok 5. Press the "OK" button. 6. The code that gets inserted into yor class is messed up; it doesn't even compile Workaround: The "preview" code works, you just have to copy it into your clipboard before you press the "OK" button (step 5 above). Then you can replace the badly-generated code with the "preview" code. Other comments: 1. The problem does not seem to happen when the very first property is added to a class, only when subsequent properties are added. 2. I first noticed this problem when I was following this tutorial: http://www.netbeans.org/kb/docs/java/gui-db- custom.html 3. Environment details: - Netbeans 6.7 M3 - Sun JDK 1.6.0_13 - Windows XP, SP2 Thanks !
Can you attach the file before/and after the broken code was inserted? Thanks
Attaching following items: (*) CustomerRecords.zip - contains the final compileable, working project, minus the database (follow instructions in the tutorial if you need to get the database running) (*) OrderEditor_BeforeCodeGen.java - Version of OrderEditor.java prior to generating bad code (*) OrderEditor_AfterCodeGen.java - Version of OrderEditor.java after generating bad code
Created attachment 80204 [details] Source file before badly-generated code is added
Created attachment 80205 [details] Source file after badly-generated code is added
Unable to attach CustomerRecords.zip, it is 11 MB and the upload only allows 1 MB max. I believe the final source code for the project can be downloaded directly from the referenced tutorial.
reproducible, thanks for the attached files
jcasabla: Thank you for additional details. I can reproduce it too now. It seems to be caused by rewrite of java.source to the new Parsing API. Nested java source tasks do not see changes made in outer tasks. As it is unlikely that the java.source will fix it in NB 6.7 I will attempt to work around it in the beans module.
It should work now. http://hg.netbeans.org/jet-main/rev/3f9f8a8e6bc1
Integrated into 'main-golden', will be available in build *200904180201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/3f9f8a8e6bc1 User: Jan Pokorsky <jpokorsky@netbeans.org> Log: #162630: work around for broken nesting of JavaSource tasks
Integrated into 'main-golden', will be available in build *200904201507* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/3f9f8a8e6bc1 User: Jan Pokorsky <jpokorsky@netbeans.org> Log: #162630: work around for broken nesting of JavaSource tasks