diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-12-04 20:54:02 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-12-04 20:54:02 +0100 |
commit | 229cbbb0d9e7b18b4a4b214f8d5198c527a4f714 (patch) | |
tree | d72ad1fa441dc8fbe0a393843cb7d2b322094fda /src/core/lombok/eclipse/handlers | |
parent | a23d77f5804f4ac91c48cf78e21905960d45e179 (diff) | |
download | lombok-229cbbb0d9e7b18b4a4b214f8d5198c527a4f714.tar.gz lombok-229cbbb0d9e7b18b4a4b214f8d5198c527a4f714.tar.bz2 lombok-229cbbb0d9e7b18b4a4b214f8d5198c527a4f714.zip |
Prep work for fixing issue #75.
Diffstat (limited to 'src/core/lombok/eclipse/handlers')
-rw-r--r-- | src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index 8b4a84c1..e6d700f8 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -138,13 +138,21 @@ public class EclipseHandlerUtil { } /** + * Wrapper for {@link #methodExists(String, EclipseNode, boolean)} with {@code caseSensitive} = {@code true}. + */ + public static MemberExistsResult methodExists(String methodName, EclipseNode node) { + return methodExists(methodName, node, true); + } + + /** * Checks if there is a method with the provided name. In case of multiple methods (overloading), only * the first method decides if EXISTS_BY_USER or EXISTS_BY_LOMBOK is returned. * * @param methodName the method name to check for. * @param node Any node that represents the Type (TypeDeclaration) to look in, or any child node thereof. + * @param caseSensitive If the search should be case sensitive. */ - public static MemberExistsResult methodExists(String methodName, EclipseNode node) { + public static MemberExistsResult methodExists(String methodName, EclipseNode node, boolean caseSensitive) { while (node != null && !(node.get() instanceof TypeDeclaration)) { node = node.up(); } @@ -154,7 +162,8 @@ public class EclipseHandlerUtil { if (typeDecl.methods != null) for (AbstractMethodDeclaration def : typeDecl.methods) { char[] mName = def.selector; if (mName == null) continue; - if (methodName.equals(new String(mName))) { + boolean nameEquals = caseSensitive ? methodName.equals(new String(mName)) : methodName.equalsIgnoreCase(new String(mName)); + if (nameEquals) { EclipseNode existing = node.getNodeFor(def); if (existing == null || !existing.isHandled()) return MemberExistsResult.EXISTS_BY_USER; return MemberExistsResult.EXISTS_BY_LOMBOK; |