aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok/launch/PatchFixesHider.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eclipseAgent/lombok/launch/PatchFixesHider.java')
-rwxr-xr-x[-rw-r--r--]src/eclipseAgent/lombok/launch/PatchFixesHider.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/eclipseAgent/lombok/launch/PatchFixesHider.java b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
index 3c70d81d..3741aba8 100644..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) {
@@ -551,7 +553,7 @@ final class PatchFixesHider {
// Since Eclipse doesn't honor the "insert at specified location" for already existing members,
// we'll just add them last
newChildren.addAll(modifiedChildren);
- return newChildren.toArray(new RewriteEvent[newChildren.size()]);
+ return newChildren.toArray(new RewriteEvent[0]);
}
public static int getTokenEndOffsetFixed(TokenScanner scanner, int token, int startOffset, Object domNode) throws CoreException {
@@ -570,7 +572,7 @@ final class PatchFixesHider {
for (IMethod m : methods) {
if (m.getNameRange().getLength() > 0 && !m.getNameRange().equals(m.getSourceRange())) result.add(m);
}
- return result.size() == methods.length ? methods : result.toArray(new IMethod[result.size()]);
+ return result.size() == methods.length ? methods : result.toArray(new IMethod[0]);
}
public static SearchMatch[] removeGenerated(SearchMatch[] returnValue) {
@@ -591,7 +593,7 @@ final class PatchFixesHider {
}
result.add(searchResult);
}
- return result.toArray(new SearchMatch[result.size()]);
+ return result.toArray(new SearchMatch[0]);
}
public static SearchResultGroup[] createFakeSearchResult(SearchResultGroup[] returnValue,