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: | Wrong hint to declare CloneNotSupportedException | ||
---|---|---|---|
Product: | java | Reporter: | cezariusz <cezariusz> |
Component: | Hints | Assignee: | Svata Dedic <sdedic> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 8.2 | ||
Hardware: | PC | ||
OS: | Other | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | Error |
I'll make the hint not appear if the overriden clone does not declare CNSE. fixed in jet-main#16564a9df1c1 Integrated into 'main-silver', will be available in build *201608110002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/16564a9df1c1 User: Svata Dedic <sdedic@netbeans.org> Log: #267399: do not suggest to and CNSE if superclass' clone() does not declare it |
Created attachment 161530 [details] Error Product Version: NetBeans IDE Dev (Build 201606280002) Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23 Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27 System: Windows 10 version 10.0 running on amd64; Cp1250; pl_PL (nb) 1. Create a class which extends java.util.Date: public class NewClass1 extends Date { private static final long serialVersionUID = 1L; } 2. On the class name you will have a hint to implement clone() - do it: public class NewClass1 extends Date { private static final long serialVersionUID = 1L; @Override public Object clone() { return super.clone(); } } 3. On the clone() method you will see a hint to declare CloneNotSupportedException - do it: public class NewClass1 extends Date { private static final long serialVersionUID = 1L; @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } } 4. You end up with an error, because the overridden method does not throw CloneNotSupportedException.