mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 06:15:41 +00:00
Removed adding the statement: 'final int PRIME = 31;' in the HandleData's createHashCode method when there are 0 fields in the type (it would generate a local variable never used warning!)
This commit is contained in:
1 parent
63894b98dd
commit
dec4be3738
1 file changed
+8
-5
@@ -449,13 +449,16 @@ public class HandleData implements EclipseAnnotationHandler<Data> {
|
||||
|
||||
final char[] PRIME = "PRIME".toCharArray();
|
||||
final char[] RESULT = "result".toCharArray();
|
||||
final boolean isEmpty = fields.isEmpty();
|
||||
|
||||
/* final int PRIME = 31; */ {
|
||||
LocalDeclaration primeDecl = new LocalDeclaration(PRIME, 0 ,0);
|
||||
primeDecl.modifiers = Modifier.FINAL;
|
||||
primeDecl.type = TypeReference.baseTypeReference(TypeIds.T_int, 0);
|
||||
primeDecl.initialization = new IntLiteral("31".toCharArray(), 0, 0);
|
||||
statements.add(primeDecl);
|
||||
if ( !isEmpty ) { /* Without fields, PRIME isn't used, and that would trigger a 'local variable not used' warning. */
|
||||
LocalDeclaration primeDecl = new LocalDeclaration(PRIME, 0 ,0);
|
||||
primeDecl.modifiers = Modifier.FINAL;
|
||||
primeDecl.type = TypeReference.baseTypeReference(TypeIds.T_int, 0);
|
||||
primeDecl.initialization = new IntLiteral("31".toCharArray(), 0, 0);
|
||||
statements.add(primeDecl);
|
||||
}
|
||||
}
|
||||
|
||||
/* int result = 1; */ {
|
||||
|
||||
Reference in new issue
Block a user