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: | Implement an interface into an existing class | ||
---|---|---|---|
Product: | editor | Reporter: | Geertjan Wielenga <geertjan> |
Component: | Hints & Annotations | Assignee: | Dusan Balek <dbalek> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | jglick |
Priority: | P3 | ||
Version: | 7.2 | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
Geertjan Wielenga
2012-04-06 10:10:31 UTC
Does not sounds like a defect to me. Well, I think this one is a defect because if you type an existing class into the dialog, a new class is created. I would expect the normal behavior to be that if an existing class is entered, the interface will be added to the interfaces declared in the existing class, not in a new one. Yes, I agree it should add the interface to the list of implemented interfaces in such a case. Dusan, I do not remember if there was a reason to instantiate the template before entering the user task, but note that there is GeneratorUtilities.createFromTemplate now. If the template wouldn't be instantiated before the user task, that would make a fix for this much easier, I think. Note that a new file can be created by calling WorkingCopy.rewrite(null, CUT). Since this is a defect, could it be fixed for 7.2? Why wouldn't you just type "implements WordProcessor" at the end of the existing class definition and then accept to hint to implement all unimplemented methods? Because the nice thing about this hint is that you can define your interface and then, from the interface, automatically implement it. But even if you disagree with this, then it still is an error that the user can enter an existing class and then end up having the hint create a new class. E.g., if I type "MyImpl" and then "MyImpl" already exists, the hint will create "MyImpl1". That's simply wrong. Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/4e7f17de507b Integrated into 'main-golden', will be available in build *201204130400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/4e7f17de507b User: Dusan Balek <dbalek@netbeans.org> Log: Issue #210804: Implement an interface into an existing class - fixed. |