FN with ctor var shadowing
This commit is contained in:
@ -81,7 +81,7 @@ public class UnusedAssignmentRule extends AbstractJavaRule {
|
|||||||
* labels on arbitrary statements
|
* labels on arbitrary statements
|
||||||
* foreach var should be reassigned from one iter to another
|
* foreach var should be reassigned from one iter to another
|
||||||
* test local class/anonymous class
|
* test local class/anonymous class
|
||||||
* test this.field in ctors
|
* explicit ctor call (hard to impossible without type res)
|
||||||
|
|
||||||
DONE
|
DONE
|
||||||
* conditionals
|
* conditionals
|
||||||
@ -92,6 +92,7 @@ public class UnusedAssignmentRule extends AbstractJavaRule {
|
|||||||
* lambdas
|
* lambdas
|
||||||
* constructors + initializers
|
* constructors + initializers
|
||||||
* anon class
|
* anon class
|
||||||
|
* test this.field in ctors
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -320,6 +321,12 @@ public class UnusedAssignmentRule extends AbstractJavaRule {
|
|||||||
// this is the normal finally
|
// this is the normal finally
|
||||||
finalState = acceptOpt(finallyClause, finalState);
|
finalState = acceptOpt(finallyClause, finalState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In the 7.0 grammar, the resources should be explicitly
|
||||||
|
// used here. For now they don't trigger anything as their
|
||||||
|
// node is not a VariableDeclaratorId. There's a test to
|
||||||
|
// check that.
|
||||||
|
|
||||||
return finalState;
|
return finalState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -964,6 +971,9 @@ public class UnusedAssignmentRule extends AbstractJavaRule {
|
|||||||
static class AssignmentEntry {
|
static class AssignmentEntry {
|
||||||
|
|
||||||
final VariableNameDeclaration var;
|
final VariableNameDeclaration var;
|
||||||
|
|
||||||
|
// this is not necessarily an expression, it may be also the
|
||||||
|
// variable declarator of a foreach loop
|
||||||
final JavaNode rhs;
|
final JavaNode rhs;
|
||||||
|
|
||||||
AssignmentEntry(VariableNameDeclaration var, JavaNode rhs) {
|
AssignmentEntry(VariableNameDeclaration var, JavaNode rhs) {
|
||||||
|
@ -141,12 +141,12 @@ public class VariableNameDeclaration extends AbstractNameDeclaration implements
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
VariableNameDeclaration n = (VariableNameDeclaration) o;
|
VariableNameDeclaration n = (VariableNameDeclaration) o;
|
||||||
return n.node.getImage().equals(node.getImage());
|
return n.node.equals(this.node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return node.getImage().hashCode();
|
return node.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user