aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2011-11-28 19:13:27 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2011-11-28 19:13:27 +0100
commitaaf3101393d4f87ea8e256ba35a5b5374e6a0161 (patch)
treea2aad280a48a4743f63a7ae1f5c2ee47b870f263 /src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
parent6d6a191c67827b626c67ddfbce071c17be58723b (diff)
parent53ce4f61788ab62263d9e267b947303973d11a7f (diff)
downloadlombok-aaf3101393d4f87ea8e256ba35a5b5374e6a0161.tar.gz
lombok-aaf3101393d4f87ea8e256ba35a5b5374e6a0161.tar.bz2
lombok-aaf3101393d4f87ea8e256ba35a5b5374e6a0161.zip
Merge branch 'Issue_81' of https://github.com/jvanderhel/lombok into jvanderhel-Issue_81
Conflicts: src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
index fd02e0e0..e7d6c04b 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
@@ -59,6 +59,30 @@ public class PatchFixes {
return false;
}
+ /* Very practical implementation, but works for getter and setter even with type parameters */
+ public static java.lang.String getRealMethodDeclarationSource(java.lang.String original, org.eclipse.jdt.core.dom.MethodDeclaration declaration) {
+ if(isGenerated(declaration)) {
+ String returnType = declaration.getReturnType2().toString();
+ String params = "";
+ for (Object object : declaration.parameters()) {
+ org.eclipse.jdt.core.dom.ASTNode parameter = ((org.eclipse.jdt.core.dom.ASTNode)object);
+ params += ","+parameter.toString();
+ }
+ return returnType + " "+declaration.getName().getFullyQualifiedName()+"("+(params.isEmpty() ? "" : params.substring(1))+");";
+ }
+ return original;
+ }
+
+ public static int getSourceEndFixed(int sourceEnd, org.eclipse.jdt.internal.compiler.ast.ASTNode node) throws Exception {
+ if (sourceEnd == -1) {
+ org.eclipse.jdt.internal.compiler.ast.ASTNode object = (org.eclipse.jdt.internal.compiler.ast.ASTNode)node.getClass().getField("$generatedBy").get(node);
+ if (object != null) {
+ return object.sourceEnd;
+ }
+ }
+ return sourceEnd;
+ }
+
public static int fixRetrieveStartingCatchPosition(int original, int start) {
return original == -1 ? start : original;
}
@@ -217,4 +241,4 @@ public class PatchFixes {
return replace;
}
-} \ No newline at end of file
+}