aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/eclipse/agent
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-01-29 00:43:46 +0100
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-01-29 00:43:46 +0100
commit54dce4c83b57b78c75f471ec5978b87b2bbd464f (patch)
tree9fb92d983b8a33f621e79867cd08e8c92aed3ad3 /src/eclipseAgent/lombok/eclipse/agent
parent2a8225a6af39d4a82f20928409fcb96ae72d363f (diff)
downloadlombok-54dce4c83b57b78c75f471ec5978b87b2bbd464f.tar.gz
lombok-54dce4c83b57b78c75f471ec5978b87b2bbd464f.tar.bz2
lombok-54dce4c83b57b78c75f471ec5978b87b2bbd464f.zip
[fixes #2024] FieldNameConstants was causing lots of problems in eclipse, especially with save actions.
Diffstat (limited to 'src/eclipseAgent/lombok/eclipse/agent')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java6
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchDiagnostics.java11
2 files changed, 11 insertions, 6 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index a6d745b6..0e74dfaf 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2015 The Project Lombok Authors.
+ * Copyright (C) 2009-2019 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -392,8 +392,8 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
private static void patchIdentifierEndReparse(ScriptManager sm) {
sm.addScript(ScriptBuilder.wrapReturnValue()
.target(new MethodTarget("org.eclipse.jdt.core.dom.ASTConverter", "retrieveIdentifierEndPosition"))
- .wrapMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "fixRetrieveIdentifierEndPosition", "int", "int", "int"))
- .transplant().request(StackRequest.RETURN_VALUE, StackRequest.PARAM2).build());
+ .wrapMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "fixRetrieveIdentifierEndPosition", "int", "int", "int", "int"))
+ .transplant().request(StackRequest.RETURN_VALUE, StackRequest.PARAM1, StackRequest.PARAM2).build());
}
private static void patchRetrieveEllipsisStartPosition(ScriptManager sm) {
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchDiagnostics.java b/src/eclipseAgent/lombok/eclipse/agent/PatchDiagnostics.java
index 82c4f522..157d92a3 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchDiagnostics.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchDiagnostics.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 The Project Lombok Authors.
+ * Copyright (C) 2012-2019 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,14 +29,19 @@ public class PatchDiagnostics {
* checks, and throw the exact same exception (thus, effectively, we don't change how eclipse operates), but, we <em>do</em> provide a useful message.
*/
public static boolean setSourceRangeCheck(Object astNode, int startPosition, int length) {
+ String nodeTxt;
if (startPosition >= 0 && length < 0) {
+ if (astNode == null) nodeTxt = "(NULL NODE)";
+ else nodeTxt = astNode.getClass() + ": " + astNode.toString();
throw new IllegalArgumentException("startPos = " + startPosition + " and length is " + length + ".\n" +
- "This breaks the rule that lengths are not allowed to be negative. Affected Node:\n" + astNode);
+ "This breaks the rule that lengths are not allowed to be negative. Affected Node:\n" + nodeTxt);
}
if (startPosition < 0 && length != 0) {
+ if (astNode == null) nodeTxt = "(NULL NODE)";
+ else nodeTxt = astNode.getClass() + ": " + astNode.toString();
throw new IllegalArgumentException("startPos = " + startPosition + " and length is " + length + ".\n" +
- "This breaks the rule that length must be 0 if startPosition is negative. Affected Node:\n" + astNode);
+ "This breaks the rule that length must be 0 if startPosition is negative. Affected Node:\n" + nodeTxt);
}
return false;