Lines 85-91
Link Here
|
85 |
*/ |
85 |
*/ |
86 |
public class FieldForUnusedParam implements TreeRule { |
86 |
public class FieldForUnusedParam implements TreeRule { |
87 |
|
87 |
|
88 |
private AtomicBoolean cancel = new AtomicBoolean(); |
88 |
private final AtomicBoolean cancel = new AtomicBoolean(); |
89 |
|
89 |
|
90 |
public Set<Kind> getTreeKinds() { |
90 |
public Set<Kind> getTreeKinds() { |
91 |
return EnumSet.of(Kind.VARIABLE); |
91 |
return EnumSet.of(Kind.VARIABLE); |
Lines 165-171
Link Here
|
165 |
if (cancel.get() || found) { |
165 |
if (cancel.get() || found) { |
166 |
return null; |
166 |
return null; |
167 |
} |
167 |
} |
168 |
|
168 |
|
169 |
List<Fix> fix = Collections.<Fix>singletonList(new FixImpl(info.getJavaSource(), TreePathHandle.create(treePath, info), existing)); |
169 |
List<Fix> fix = Collections.<Fix>singletonList(new FixImpl(info.getJavaSource(), TreePathHandle.create(treePath, info), existing)); |
170 |
String displayName = NbBundle.getMessage(FieldForUnusedParam.class, "ERR_UnusedParameter"); |
170 |
String displayName = NbBundle.getMessage(FieldForUnusedParam.class, "ERR_UnusedParameter"); |
171 |
ErrorDescription err = ErrorDescriptionFactory.createErrorDescription(Severity.HINT, displayName,fix, info.getFileObject(), offset, offset); |
171 |
ErrorDescription err = ErrorDescriptionFactory.createErrorDescription(Severity.HINT, displayName,fix, info.getFileObject(), offset, offset); |
Lines 232-238
Link Here
|
232 |
} |
232 |
} |
233 |
|
233 |
|
234 |
if (!existing) { |
234 |
if (!existing) { |
235 |
VariableTree field = make.Variable(make.Modifiers(EnumSet.of(Modifier.PRIVATE)), vt.getName(), vt.getType(), null); |
235 |
VariableTree field = make.Variable(make.Modifiers(EnumSet.of(Modifier.PRIVATE, Modifier.FINAL)), vt.getName(), vt.getType(), null); |
236 |
int insertPlace = -1; |
236 |
int insertPlace = -1; |
237 |
|
237 |
|
238 |
index = 0; |
238 |
index = 0; |