aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2010-12-31 10:24:47 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2010-12-31 10:24:47 +0100
commit59e2a0ff1d347bb1a7d02b7ac37b1f9d38647e60 (patch)
treed4bd142aa6111db9681870bd2b7e87b2eb725f5b /src
parent49100b43c084f6774d43d93eee98440253965047 (diff)
downloadlombok-59e2a0ff1d347bb1a7d02b7ac37b1f9d38647e60.tar.gz
lombok-59e2a0ff1d347bb1a7d02b7ac37b1f9d38647e60.tar.bz2
lombok-59e2a0ff1d347bb1a7d02b7ac37b1f9d38647e60.zip
Presence of i.e. getABC() stops lombok from generating getAbc, but lombok will still attempt to call this nonexistent getAbc instead of getABC. Fixed.
Fixes issue #173.
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java24
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java22
2 files changed, 19 insertions, 27 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 293359dc..64eaa7e2 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -122,20 +122,16 @@ public class EclipseHandlerUtil {
boolean isBoolean = nameEquals(fieldType.getTypeName(), "boolean") && fieldType.dimensions() == 0;
EclipseNode typeNode = field.up();
for (String potentialGetterName : TransformationsUtil.toAllGetterNames(field.getName(), isBoolean)) {
- switch (methodExists(potentialGetterName, typeNode, false)) {
- case EXISTS_BY_LOMBOK:
- case EXISTS_BY_USER:
- for (EclipseNode potentialGetter : typeNode.down()) {
- if (potentialGetter.getKind() != Kind.METHOD) continue;
- if (!(potentialGetter.get() instanceof MethodDeclaration)) continue;
- MethodDeclaration method = (MethodDeclaration) potentialGetter.get();
- if (!potentialGetterName.equals(new String(method.selector))) continue;
- /** static getX() methods don't count. */
- if ((method.modifiers & ClassFileConstants.AccStatic) != 0) continue;
- /** Nor do getters with a non-empty parameter list. */
- if (method.arguments != null && method.arguments.length > 0) continue;
- return new GetterMethod(method.selector, method.returnType);
- }
+ for (EclipseNode potentialGetter : typeNode.down()) {
+ if (potentialGetter.getKind() != Kind.METHOD) continue;
+ if (!(potentialGetter.get() instanceof MethodDeclaration)) continue;
+ MethodDeclaration method = (MethodDeclaration) potentialGetter.get();
+ if (!potentialGetterName.equalsIgnoreCase(new String(method.selector))) continue;
+ /** static getX() methods don't count. */
+ if ((method.modifiers & ClassFileConstants.AccStatic) != 0) continue;
+ /** Nor do getters with a non-empty parameter list. */
+ if (method.arguments != null && method.arguments.length > 0) continue;
+ return new GetterMethod(method.selector, method.returnType);
}
}
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index acfc82c9..aa4e1bb2 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -294,19 +294,15 @@ public class JavacHandlerUtil {
JCVariableDecl decl = (JCVariableDecl)field.get();
JavacNode typeNode = field.up();
for (String potentialGetterName : toAllGetterNames(decl)) {
- switch (methodExists(potentialGetterName, typeNode, false)) {
- case EXISTS_BY_LOMBOK:
- case EXISTS_BY_USER:
- for (JavacNode potentialGetter : typeNode.down()) {
- if (potentialGetter.getKind() != Kind.METHOD) continue;
- JCMethodDecl method = (JCMethodDecl) potentialGetter.get();
- if (!method.name.contentEquals(potentialGetterName)) continue;
- /** static getX() methods don't count. */
- if ((method.mods.flags & Flags.STATIC) != 0) continue;
- /** Nor do getters with a non-empty parameter list. */
- if (method.params != null && method.params.size() > 0) continue;
- return new GetterMethod(method.name, method.restype);
- }
+ for (JavacNode potentialGetter : typeNode.down()) {
+ if (potentialGetter.getKind() != Kind.METHOD) continue;
+ JCMethodDecl method = (JCMethodDecl) potentialGetter.get();
+ if (!method.name.toString().equalsIgnoreCase(potentialGetterName)) continue;
+ /** static getX() methods don't count. */
+ if ((method.mods.flags & Flags.STATIC) != 0) continue;
+ /** Nor do getters with a non-empty parameter list. */
+ if (method.params != null && method.params.size() > 0) continue;
+ return new GetterMethod(method.name, method.restype);
}
}