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.
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).
> 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.
>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.
(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.
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
In dev build 201607060002, the compiler error shows up under the field instead of the class.