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.
Summary: | Possible generification problem in WizardDescriptor constructor | ||
---|---|---|---|
Product: | platform | Reporter: | Jesse Glick <jglick> |
Component: | Dialogs&Wizards | Assignee: | Jaroslav Tulach <jtulach> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | apireviews |
Priority: | P2 | Keywords: | API_REVIEW_FAST |
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | 153672 | ||
Bug Blocks: | 92762 | ||
Attachments: |
Possible patch
Using ... instead of [] new version of the api for jesse. do you like this? Ok, so I'll integrate on Monday |
Description
Jesse Glick
2007-04-24 02:31:31 UTC
Created attachment 41512 [details]
Possible patch
Created attachment 41741 [details]
Using ... instead of []
I guess there is a need for just a cosmetic fix. Jesse, is this ok for you? I'm not sure what your patch has to do with the problem I reported. You are not even looking at the same constructor. ?? #1 I do not think that your patch with ? extends WizardDescriptor is correct. #2 Somewhere where you instantiate the ShortcutWizard, just call super() and then call setPanelsAndSettings(new ShortcutIterator(), this); There is no zero-arg supertype constructor. The available constructors are: 1. (Iterator<WizardDescriptor>). Forces unchecked warnings, as described here, since I have an Iterator<ShortcutWizard>. 2. (Panel<WizardDescriptor>[]). Incorrect (I have a nontrivial iterator), and anyway an array of a generic type cannot be constructed without unchecked warnings. (Which makes your proposed [] -> ... replacement useless, since varargs do not avoid this warning.) 3. (Panel<Data>[],Data). Same problems as #2. 4. (Iterator<Data>,Data). Fine as a method, but cannot be used for a constructor, since a this-reference cannot be passed to a super constructor. It would probably suffice for a no-arg protected constructor to be added as then I could call setPanelsAndSettings as you suggest. However then there is nothing preventing someone from forgetting to set an iterator. (There are some places where data.getIterator(this) != null is checked, implying that sometimes it is null, but it is not obvious when.) Or the default constructor could just be @SuppressWarnings("unchecked") /** Initially no panels, call {@link #setPanelsAndSettings} to use. */ protected WizardDescriptor() { this(new Panel<WizardDescriptor>[0]); } Created attachment 41891 [details]
new version of the api for jesse. do you like this?
Yes, I think that can work. Probably a good idea to mention in the Javadoc of the new method that the purpose of calling setPanelsAndSettings separately is to avoid unchecked warnings. Forgot '#' in @link. (Check your imports. Looks like I am not the only one for whom Retouche adds unnecessary imports of nested classes. I need to file a bug about this at some point. I will add you to CC.) Created attachment 41932 [details]
Ok, so I'll integrate on Monday
new revision: 1.14; previous revision: 1.13 done Checking in dialogs/manifest.mf; /cvs/openide/dialogs/manifest.mf,v <-- manifest.mf new revision: 1.12; previous revision: 1.11 done Checking in dialogs/src/org/openide/WizardDescriptor.java; /cvs/openide/dialogs/src/org/openide/WizardDescriptor.java,v <-- WizardDescriptor.java new revision: 1.47; previous revision: 1.46 done RCS file: /cvs/openide/dialogs/test/unit/src/org/openide/WizardSetDataAndIteratorTest.java,v done Checking in dialogs/test/unit/src/org/openide/WizardSetDataAndIteratorTest.java; /cvs/openide/dialogs/test/unit/src/org/openide/WizardSetDataAndIteratorTest.java,v <-- WizardSetDataAndIteratorTest.java initial revision: 1.1 FYI: Checking in IntroPanel.java; /shared/data/ccvs/repository/ant/src/org/apache/tools/ant/module/wizards/shortcut/IntroPanel.java,v <-- IntroPanel.java new revision: 1.18; previous revision: 1.17 done Checking in SelectFolderPanel.java; /shared/data/ccvs/repository/ant/src/org/apache/tools/ant/module/wizards/shortcut/SelectFolderPanel.java,v <-- SelectFolderPanel.java new revision: 1.16; previous revision: 1.15 done Checking in CustomizeScriptPanel.java; /shared/data/ccvs/repository/ant/src/org/apache/tools/ant/module/wizards/shortcut/CustomizeScriptPanel.java,v <-- CustomizeScriptPanel.java new revision: 1.15; previous revision: 1.14 done Checking in ShortcutIterator.java; /shared/data/ccvs/repository/ant/src/org/apache/tools/ant/module/wizards/shortcut/ShortcutIterator.java,v <-- ShortcutIterator.java new revision: 1.19; previous revision: 1.18 done Checking in SelectKeyboardShortcutPanel.java; /shared/data/ccvs/repository/ant/src/org/apache/tools/ant/module/wizards/shortcut/SelectKeyboardShortcutPanel.java,v <-- SelectKeyboardShortcutPanel.java new revision: 1.15; previous revision: 1.14 done Checking in ShortcutWizard.java; /shared/data/ccvs/repository/ant/src/org/apache/tools/ant/module/wizards/shortcut/ShortcutWizard.java,v <-- ShortcutWizard.java new revision: 1.7; previous revision: 1.6 done |