aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent
diff options
context:
space:
mode:
authorRobert Wertman <robert.wertman@gmail.com>2019-01-27 00:39:30 -0500
committerRoel Spilker <r.spilker@gmail.com>2019-01-28 20:44:53 +0100
commitf2d03973d59d96d8bfef51d8378a4069d8d46205 (patch)
treed3d75b5fbca4e64d5ee967f3ec90b547019e89fd /src/eclipseAgent
parentccd802503d8aa578be3f1f956d97b06a803de0aa (diff)
downloadlombok-f2d03973d59d96d8bfef51d8378a4069d8d46205.tar.gz
lombok-f2d03973d59d96d8bfef51d8378a4069d8d46205.tar.bz2
lombok-f2d03973d59d96d8bfef51d8378a4069d8d46205.zip
Replace sized array in toArray with 0
This approach has been benchmarked to be marginally faster. Fixes #2030.
Diffstat (limited to 'src/eclipseAgent')
-rwxr-xr-x[-rw-r--r--]src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethodCompletionProposal.java2
-rwxr-xr-x[-rw-r--r--]src/eclipseAgent/lombok/launch/PatchFixesHider.java6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethodCompletionProposal.java b/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethodCompletionProposal.java
index ace97a4d..085c903f 100644..100755
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethodCompletionProposal.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethodCompletionProposal.java
@@ -78,7 +78,7 @@ public class PatchExtensionMethodCompletionProposal {
}
}
}
- return proposals.toArray(new IJavaCompletionProposal[proposals.size()]);
+ return proposals.toArray(new IJavaCompletionProposal[0]);
}
diff --git a/src/eclipseAgent/lombok/launch/PatchFixesHider.java b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
index 3c70d81d..5c409603 100644..100755
--- a/src/eclipseAgent/lombok/launch/PatchFixesHider.java
+++ b/src/eclipseAgent/lombok/launch/PatchFixesHider.java
@@ -551,7 +551,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 +570,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 +591,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,