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 222488 - Hint for "variable X might not have been initialized" is shown at class not at variable
Summary: Hint for "variable X might not have been initialized" is shown at class not a...
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-20 18:12 UTC by _ gtzabari
Modified: 2016-07-07 18:28 UTC (History)
1 user (show)

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 _ gtzabari 2012-11-20 18:12:56 UTC
1. Given:

public class CompanyResource
{
	private final WebResource resource;
}

2. Netbeans complains:

variable resource might not have been initialized
----
(Alt-Enter shows hints)

3. The editor hint is "create subclass".

Expected behavior:

1. Remove hint to create a subclass
2. Add hint to create a constructor if none already exists
3. Add a hint to initialize the variable without a constructor (in-line initialization).
Comment 1 markiewb 2012-12-28 22:11:46 UTC
> 1. Remove hint to create a subclass
Veto. I think the hint is valid at this position.

> 2. Add hint to create a constructor if none already exists
That is different hint, so create a new RFE for it.

> 3. Add a hint to initialize the variable without a constructor (in-line
initialization).
I propose a hint at the variable declaration (not at the class), which initializes the variable.
Comment 2 _ gtzabari 2012-12-28 22:19:18 UTC
>That is different hint, so create a new RFE for it.

Done: http://netbeans.org/bugzilla/show_bug.cgi?id=224295

> I propose a hint at the variable declaration (not at the class), which
initializes the variable.

Fine with me, though if that's the case the error annotation should show up underneath the field, not the class. I hope you understand what I mean. It doesn't make sense for Netbeans to highlight the class name to signify an error but then the hint for fixing it shows up under the field.

If you could get Netbeans to mark the field needing to be fixed instead of the class we'd be even better off.
Comment 3 markiewb 2012-12-28 22:51:27 UTC
(In reply to comment #2)
> 
> Fine with me, though if that's the case the error annotation should show up
> underneath the field, not the class. I hope you understand what I mean. It
> doesn't make sense for Netbeans to highlight the class name to signify an error
> but then the hint for fixing it shows up under the field.
> 
+1: That is what i mean and want too. 

IMHO the current behaviour is a defect, so i changed the issue type from enhancement to defect.
Comment 4 Martin Balin 2016-07-07 07:16:03 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 5 _ gtzabari 2016-07-07 18:28:14 UTC
In dev build 201607060002, the compiler error shows up under the field instead of the class.