diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-09-03 02:25:51 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-09-03 02:25:51 +0200 |
commit | 0b30a5695022649c0e9288b167fe15893e06887b (patch) | |
tree | 0fdbf015db81cd86d2e01cd1c739a092cf07f74b /src/lombok/javac | |
parent | cfa9bef58d15bea474b83b3ce80c06f5af814711 (diff) | |
download | lombok-0b30a5695022649c0e9288b167fe15893e06887b.tar.gz lombok-0b30a5695022649c0e9288b167fe15893e06887b.tar.bz2 lombok-0b30a5695022649c0e9288b167fe15893e06887b.zip |
Fixed a problem in AnnotationValues where 'isExplicit' always returned true.
Diffstat (limited to 'src/lombok/javac')
-rw-r--r-- | src/lombok/javac/Javac.java | 4 | ||||
-rw-r--r-- | src/lombok/javac/handlers/HandleEqualsAndHashCode.java | 5 | ||||
-rw-r--r-- | src/lombok/javac/handlers/HandleToString.java | 5 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/lombok/javac/Javac.java b/src/lombok/javac/Javac.java index 0987d31a..60c86099 100644 --- a/src/lombok/javac/Javac.java +++ b/src/lombok/javac/Javac.java @@ -92,6 +92,7 @@ public class Javac { List<String> raws = new ArrayList<String>(); List<Object> guesses = new ArrayList<Object>(); final List<DiagnosticPosition> positions = new ArrayList<DiagnosticPosition>(); + boolean isExplicit = false; for ( JCExpression arg : arguments ) { String mName; @@ -107,6 +108,7 @@ public class Javac { } if ( !mName.equals(name) ) continue; + isExplicit = true; if ( rhs instanceof JCNewArray ) { List<JCExpression> elems = ((JCNewArray)rhs).elems; for ( JCExpression inner : elems ) { @@ -121,7 +123,7 @@ public class Javac { } } - values.put(name, new AnnotationValue(node, raws, guesses) { + values.put(name, new AnnotationValue(node, raws, guesses, isExplicit) { @Override public void setError(String message, int valueIdx) { node.addError(message, positions.get(valueIdx)); } diff --git a/src/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/lombok/javac/handlers/HandleEqualsAndHashCode.java index 16a04da7..21966be2 100644 --- a/src/lombok/javac/handlers/HandleEqualsAndHashCode.java +++ b/src/lombok/javac/handlers/HandleEqualsAndHashCode.java @@ -84,6 +84,11 @@ public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAnd if ( !annotation.isExplicit("exclude") ) excludes = null; if ( !annotation.isExplicit("of") ) includes = null; + if ( excludes != null && includes != null ) { + excludes = null; + annotation.setWarning("exclude", "exclude and of are mutually exclusive; the 'exclude' parameter will be ignored."); + } + return generateMethods(typeNode, annotationNode, excludes, includes, callSuper, true); } diff --git a/src/lombok/javac/handlers/HandleToString.java b/src/lombok/javac/handlers/HandleToString.java index 7cdbb6e1..eb2013c7 100644 --- a/src/lombok/javac/handlers/HandleToString.java +++ b/src/lombok/javac/handlers/HandleToString.java @@ -81,6 +81,11 @@ public class HandleToString implements JavacAnnotationHandler<ToString> { if ( !annotation.isExplicit("exclude") ) excludes = null; if ( !annotation.isExplicit("of") ) includes = null; + if ( excludes != null && includes != null ) { + excludes = null; + annotation.setWarning("exclude", "exclude and of are mutually exclusive; the 'exclude' parameter will be ignored."); + } + return generateToString(typeNode, annotationNode, excludes, includes, ann.includeFieldNames(), callSuper, true); } |