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.

Bug 197721 - hint "Utility class with visible constructor" misidentifies exceptions as utility classes
Summary: hint "Utility class with visible constructor" misidentifies exceptions as uti...
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Hints & Annotations (show other bugs)
Version: 7.0.1
Hardware: All All
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-13 20:12 UTC by athompson
Modified: 2011-05-20 15:09 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description athompson 2011-04-13 20:12:07 UTC
Consider the code:

package net.rabbitware.core;

/**
 * Exception.
 *
 * @author alvin
 */
public class NewException extends Exception {
	private static final long serialVersionUID = 1L;

	/**
	 * Constructor.
	 *
	 * @param message
	 * the detail message
	 */
	public NewException(String message) {
		super(message);
	}

	/**
	 * Constructor.
	 *
	 * @param message
	 * the detail message
	 *
	 * @param cause
	 * the underlying cause of this exception
	 */
	public NewException(String message, Throwable cause) {
		super(message, cause);
	}
}


The two constructors give the "Utility class with visible constructor" warning.  It seems to only happen if you set a serialVersionUId.  I guess you can't get away with assuming any class which extends another class is not a utility class, but if a class extends a class which does not fit the criteria of a utility class, than AFAIK it's safe to assume the child class is also not a utility class.
Comment 1 Jan Lahoda 2011-05-02 09:48:53 UTC
Ok:
http://hg.netbeans.org/jet-main/rev/07ff664d5428
Comment 2 Quality Engineering 2011-05-03 05:24:52 UTC
Integrated into 'main-golden', will be available in build *201105030000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/07ff664d5428
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #197721: do not consider j.l.Throwable subclasses to be static utility classes.
Comment 3 athompson 2011-05-20 15:09:44 UTC
yup