diff options
Diffstat (limited to 'src/eclipseAgent/lombok')
3 files changed, 18 insertions, 11 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; diff --git a/src/eclipseAgent/lombok/launch/PatchFixesHider.java b/src/eclipseAgent/lombok/launch/PatchFixesHider.java index 5c409603..3741aba8 100755 --- a/src/eclipseAgent/lombok/launch/PatchFixesHider.java +++ b/src/eclipseAgent/lombok/launch/PatchFixesHider.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2015 The Project Lombok Authors. + * Copyright (C) 2010-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 @@ -31,8 +31,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Stack; -import lombok.eclipse.EclipseAugments; - import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.IAnnotatable; import org.eclipse.jdt.core.IAnnotation; @@ -64,6 +62,8 @@ import org.eclipse.jdt.internal.core.dom.rewrite.TokenScanner; import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.structure.ASTNodeSearchUtil; +import lombok.eclipse.EclipseAugments; + /** These contain a mix of the following: * <ul> * <li> 'dependency free' method wrappers that cross the shadowloader barrier. @@ -476,8 +476,10 @@ final class PatchFixesHider { return original == -1 ? start : original; } - public static int fixRetrieveIdentifierEndPosition(int original, int end) { - return original == -1 ? end : original; + public static int fixRetrieveIdentifierEndPosition(int original, int start, int end) { + if (original == -1) return end; + if (original < start) return end; + return original; } public static int fixRetrieveEllipsisStartPosition(int original, int end) { |