aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/eclipse
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-09-03 02:25:51 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-09-03 02:25:51 +0200
commit0b30a5695022649c0e9288b167fe15893e06887b (patch)
tree0fdbf015db81cd86d2e01cd1c739a092cf07f74b /src/lombok/eclipse
parentcfa9bef58d15bea474b83b3ce80c06f5af814711 (diff)
downloadlombok-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/eclipse')
-rw-r--r--src/lombok/eclipse/Eclipse.java8
-rw-r--r--src/lombok/eclipse/handlers/HandleToString.java7
2 files changed, 11 insertions, 4 deletions
diff --git a/src/lombok/eclipse/Eclipse.java b/src/lombok/eclipse/Eclipse.java
index 5a69fca9..c37d1e33 100644
--- a/src/lombok/eclipse/Eclipse.java
+++ b/src/lombok/eclipse/Eclipse.java
@@ -346,11 +346,13 @@ public class Eclipse {
if ( mName.equals(name) ) fullExpression = pair.value;
}
- if ( fullExpression != null ) {
+ boolean isExplicit = fullExpression != null;
+
+ if ( isExplicit ) {
if ( fullExpression instanceof ArrayInitializer ) {
expressions = ((ArrayInitializer)fullExpression).expressions;
} else expressions = new Expression[] { fullExpression };
- for ( Expression ex : expressions ) {
+ if ( expressions != null ) for ( Expression ex : expressions ) {
StringBuffer sb = new StringBuffer();
ex.print(0, sb);
raws.add(sb.toString());
@@ -361,7 +363,7 @@ public class Eclipse {
final Expression fullExpr = fullExpression;
final Expression[] exprs = expressions;
- values.put(name, new AnnotationValue(annotationNode, raws, guesses) {
+ values.put(name, new AnnotationValue(annotationNode, raws, guesses, isExplicit) {
@Override public void setError(String message, int valueIdx) {
Expression ex;
if ( valueIdx == -1 ) ex = fullExpr;
diff --git a/src/lombok/eclipse/handlers/HandleToString.java b/src/lombok/eclipse/handlers/HandleToString.java
index d639e3fd..5b88b568 100644
--- a/src/lombok/eclipse/handlers/HandleToString.java
+++ b/src/lombok/eclipse/handlers/HandleToString.java
@@ -108,6 +108,11 @@ public class HandleToString implements EclipseAnnotationHandler<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.");
+ }
+
checkForBogusFieldNames(typeNode, annotation);
return generateToString(typeNode, annotationNode, excludes, includes, ann.includeFieldNames(), callSuper, true);
@@ -147,7 +152,7 @@ public class HandleToString implements EclipseAnnotationHandler<ToString> {
//Skip static fields.
if ( (fieldDecl.modifiers & ClassFileConstants.AccStatic) != 0 ) continue;
//Skip excluded fields.
- if ( excludes.contains(new String(fieldDecl.name)) ) continue;
+ if ( excludes != null && excludes.contains(new String(fieldDecl.name)) ) continue;
//Skip fields that start with $
if ( fieldDecl.name.length > 0 && fieldDecl.name[0] == '$' ) continue;
nodesForToString.add(child);