diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-08-01 13:14:59 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-08-01 13:18:34 +0200 |
commit | 8428be5c680b5b9e89a58a3ea77d134196f52957 (patch) | |
tree | a810d339d4d6d7b46b361774b9a1eab7aa5b84a7 /src/lombok/javac | |
parent | 2bdc1210d7a26df8b69563f0de22524398ba9bfd (diff) | |
download | lombok-8428be5c680b5b9e89a58a3ea77d134196f52957.tar.gz lombok-8428be5c680b5b9e89a58a3ea77d134196f52957.tar.bz2 lombok-8428be5c680b5b9e89a58a3ea77d134196f52957.zip |
The warning for not enabling callSuper cannot be avoided, but there are legal reasons for using it, so, changed it: explicitly setting 'callSuper=false' removes the warning. You only get the warning
if callSuper is false because that's the default.
Fixes issue #13
Diffstat (limited to 'src/lombok/javac')
-rw-r--r-- | src/lombok/javac/handlers/HandleEqualsAndHashCode.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/lombok/javac/handlers/HandleEqualsAndHashCode.java index 1a1158eb..18202eb5 100644 --- a/src/lombok/javac/handlers/HandleEqualsAndHashCode.java +++ b/src/lombok/javac/handlers/HandleEqualsAndHashCode.java @@ -86,7 +86,8 @@ public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAnd checkForBogusExcludes(typeNode, annotation); - return generateMethods(typeNode, annotationNode, excludes, ann.callSuper(), true); + return generateMethods(typeNode, annotationNode, excludes, + ann.callSuper(), annotation.getRawExpression("callSuper") == null, true); } public void generateEqualsAndHashCodeForType(Node typeNode, Node errorNode) { @@ -103,11 +104,11 @@ public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAnd try { callSuper = ((Boolean)EqualsAndHashCode.class.getMethod("callSuper").getDefaultValue()).booleanValue(); } catch ( Exception ignore ) {} - generateMethods(typeNode, errorNode, List.<String>nil(), callSuper, false); + generateMethods(typeNode, errorNode, List.<String>nil(), callSuper, true, false); } private boolean generateMethods(Node typeNode, Node errorNode, List<String> excludes, - boolean callSuper, boolean whineIfExists) { + boolean callSuper, boolean implicit, boolean whineIfExists) { boolean notAClass = true; if ( typeNode.get() instanceof JCClassDecl ) { long flags = ((JCClassDecl)typeNode.get()).mods.flags; @@ -132,8 +133,8 @@ public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAnd return true; } - if ( !isDirectDescendentOfObject && !callSuper ) { - errorNode.addWarning("Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object."); + if ( !isDirectDescendentOfObject && !callSuper && implicit ) { + errorNode.addWarning("Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add '@EqualsAndHashCode(callSuper=false)' to your type."); } List<Node> nodesForEquality = List.nil(); |