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.

View | Details | Raw Unified | Return to bug 229684
Collapse All | Expand All

(-)a/java.hints/src/org/netbeans/modules/java/hints/Bundle.properties (-3 / +5 lines)
Lines 282-290 Link Here
282
282
283
DN_FieldUnusedParam=Assign Unused Constructor Parameter to Field
283
DN_FieldUnusedParam=Assign Unused Constructor Parameter to Field
284
DSC_FieldUnusedParam=Assign Unused Constructor Parameter to Field
284
DSC_FieldUnusedParam=Assign Unused Constructor Parameter to Field
285
FIX_AssignToExisting=Assign to Existing Field
285
# {0} field name
286
FIX_CreateField=Create Field
286
FIX_AssignToExisting=Assign to Existing Field ''{0}''
287
ERR_UnusedParameter=Unused Parameter
287
# {0} field name
288
FIX_CreateField=Create Field ''{0}''
289
ERR_UnusedParameter=Unused Parameter ''{0}''
288
290
289
291
290
DN_org.netbeans.modules.java.hints.EqualsMethodHint=.equals Method not Checking Type
292
DN_org.netbeans.modules.java.hints.EqualsMethodHint=.equals Method not Checking Type
(-)a/java.hints/src/org/netbeans/modules/java/hints/FieldForUnusedParam.java (-9 / +19 lines)
Lines 190-201 Link Here
190
        if (cancel.get() || found) {
190
        if (cancel.get() || found) {
191
            return null;
191
            return null;
192
        }
192
        }
193
        
193
194
        List<Fix> fix = Collections.<Fix>singletonList(new FixImpl(info.getJavaSource(), TreePathHandle.create(treePath, info), isFinalFields(getPreferences(null)), existing));
194
        if (treePath.getLeaf().getKind() == Kind.VARIABLE) {
195
        String displayName = NbBundle.getMessage(FieldForUnusedParam.class, "ERR_UnusedParameter");
195
            final VariableTree vt = (VariableTree) treePath.getLeaf();
196
        ErrorDescription err = ErrorDescriptionFactory.createErrorDescription(Severity.HINT, displayName,fix, info.getFileObject(), offset, offset);
196
            final String name = vt.getName().toString();
197
        
197
198
        return Collections.singletonList(err);
198
            List<Fix> fix = Collections.<Fix>singletonList(new FixImpl(info.getJavaSource(), TreePathHandle.create(treePath, info), isFinalFields(getPreferences(null)), existing, name));
199
            String displayName = NbBundle.getMessage(FieldForUnusedParam.class, "ERR_UnusedParameter", name);
200
            ErrorDescription err = ErrorDescriptionFactory.createErrorDescription(Severity.HINT, displayName, fix, info.getFileObject(), offset, offset);
201
202
            return Collections.singletonList(err);
203
        }
204
        else{
205
            return null;
206
        }
199
    }
207
    }
200
208
201
    public String getId() {
209
    public String getId() {
Lines 225-241 Link Here
225
        private final JavaSource js;
233
        private final JavaSource js;
226
        private final TreePathHandle tph;
234
        private final TreePathHandle tph;
227
        private final boolean finalFields;
235
        private final boolean finalFields;
236
        private final String fieldName;
228
                final boolean existing;
237
                final boolean existing;
229
238
230
        public FixImpl(JavaSource js, TreePathHandle tph, boolean finalFields, boolean existing) {
239
        public FixImpl(JavaSource js, TreePathHandle tph, boolean finalFields, boolean existing, String fieldName) {
231
            this.js = js;
240
            this.js = js;
232
            this.tph = tph;
241
            this.tph = tph;
233
            this.finalFields = finalFields;
242
            this.finalFields = finalFields;
234
            this.existing = existing;
243
            this.existing = existing;
244
            this.fieldName = fieldName;
235
        }
245
        }
236
        
246
237
        public String getText() {
247
        public String getText() {
238
            return existing ? NbBundle.getMessage(FieldForUnusedParam.class, "FIX_AssignToExisting") : NbBundle.getMessage(FieldForUnusedParam.class, "FIX_CreateField");
248
            return existing ? NbBundle.getMessage(FieldForUnusedParam.class, "FIX_AssignToExisting", fieldName) : NbBundle.getMessage(FieldForUnusedParam.class, "FIX_CreateField", fieldName);
239
        }
249
        }
240
250
241
        public ChangeInfo implement() throws Exception {
251
        public ChangeInfo implement() throws Exception {

Return to bug 229684