Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 231337

Summary: Component class not updated in .form file when generating FQN is off
Product: guibuilder Reporter: infonaut
Component: CodeAssignee: issues <issues.netbeans.org>
Status: NEW --- QA Contact: issues <issues.netbeans.org>
Priority: P3 CC: henri127
Version: 7.4   
Target Milestone: 8.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Issue Type: DEFECT Exception Report:
Attachments: crash log

Description infonaut 2013-06-17 07:51:09 UTC
[ BUILD # : 201306132201 ]
[ JDK VERSION : 1.7.0_21 ]

moving a package including a component used by a form does not update the
component class inside the form xml file (.form), the form file (.java) is
updated correctly.
this breaks the design editor throwing a ClassNotFoundException
Comment 1 Tomas Pavek 2013-06-19 16:34:42 UTC
Can you provide specific steps how to reproduce it? Possibly attach a sample project? There can be more ways of the setup and I have no luck reproducing it. I've tried to rename a package with a component used in a GUI form that is either in a different or in the same package (within the same project) and it worked fine. I guess there are some special steps/setup where it does not work - but I need to know how to get that situation. Thanks.
Comment 2 infonaut 2013-06-19 18:33:10 UTC
trying to create a reproduceable project, but the following procedure killed the X window.
netbeans is still running. see the attached log (from .xsession-errors)

how it comes:

create New Project... -> Java Class Library -> name it TestBase -> ok
create new Java Package under source -> name it gui -> ok
create new Java Class... -> name it MyLabel -> ok
in editor edit the class so it extends from JLabel and calls super("MyLabel");
Save all

create New Project... -> Java Application -> name it TestApp -> ok
create new JPanel Form... -> name it MyPanel -> ok -> panel in editor
TestApp>Properties>Libraries>Add Project... -> select TestBase -> ok
drag TestBase>Source>gui>MyLabel from Project into Design Editor -> Warning! -> ok
compile File MyLabel (wrong, must compile MyPanel why?)
drag TestBase>Source>gui>MyLabel from Project into Design Editor -> Warning!
---- crash XWindow gone, Jave still alive
this is reproduceable
in TestApp create a new Panel Form
drag MyLabel into -> warning -> ok
drag MyLabel into -> warning -> ok
---- crash Netbeans gone
Comment 3 infonaut 2013-06-19 18:34:13 UTC
Created attachment 136050 [details]
crash log
Comment 4 Tomas Pavek 2013-06-25 09:23:16 UTC
For the drag and drop crash please file a different bug (on product 'platform'), it's a different problem.

I've found how to reproduce the original problem - class not updated in .form file. It happens when the 'Generate Full Classnames' property of the form is turned off. You can turn it on again to workaround this problem (it is on by default and things are in general less prone to errors when fully qualified class names are generated in the code). To find the property, open the GUI form in design, in the navigator select the root node and see the properties window.

In fact there is not an obvious way how to fix this class move bug. The refactoring in form files is invoked when changes in the generated (guarded) code are requested by java refactoring. Here no change in guarded code is needed, only the import statement is changed.
Comment 5 Tomas Pavek 2014-01-13 10:25:33 UTC
Similar thing happens when renaming a component from default package to a named package - the java refactoring will create an import and not change anything in guarded code (bug 189514).
Comment 6 Tomas Pavek 2014-01-13 10:25:46 UTC
*** Bug 189514 has been marked as a duplicate of this bug. ***
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo