diff options
author | Lars Vogel | 2021-07-01 12:05:50 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2021-08-13 06:06:01 +0000 |
commit | d042db1fee4a4f7a927cfce82da7030d29807aae (patch) | |
tree | 37825f6d73fc6c9955ee40d05551031b97096a07 | |
parent | 1cd63ee57fd6bf29c58975d09a62ce2ee46276b2 (diff) | |
download | rt.equinox.p2-d042db1fee4a4f7a927cfce82da7030d29807aae.tar.gz rt.equinox.p2-d042db1fee4a4f7a927cfce82da7030d29807aae.tar.xz rt.equinox.p2-d042db1fee4a4f7a927cfce82da7030d29807aae.zip |
[dogfooding][cleanup] Use new StringBuffer -> StringBuilder
cleanup for p2
To ensure that the new JDT cleanup works correctly for clients we should
run it also on our own code base. This help to ensure that the cleanup
works fine and helps us to cleanup our own code base.
From the commit message of the cleanup:
- create a cleanup to replace usage of StringBuffer with
StringBuilder. The two are equivalent, but StringBuffer is
thread-safe and synchronized which makes it slower than
StringBuilder which was introduced in Java 1.5.
To avoid API changes, we should only use the local variable change.
Change-Id: Iab5520fa3bf21f5374cc70de2a8fd4b63790027a
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182677
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
3 files changed, 5 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java index 808c70e83..ae30164ad 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java @@ -299,7 +299,7 @@ public class Projector { if (weightedObjects == null) return; if (DEBUG) { - StringBuffer b = new StringBuffer(); + StringBuilder b = new StringBuilder(); for (WeightedObject<? extends Object> object : weightedObjects) { if (b.length() > 0) b.append(", "); //$NON-NLS-1$ @@ -926,7 +926,7 @@ public class Projector { private void createAtMostOne(IInstallableUnit[] ius) throws ContradictionException { if (DEBUG) { - StringBuffer b = new StringBuffer(); + StringBuilder b = new StringBuilder(); for (IInstallableUnit iu : ius) { b.append(iu.toString()); } diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/expression/SimplePattern.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/expression/SimplePattern.java index 2b088c077..b844ee817 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/expression/SimplePattern.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/expression/SimplePattern.java @@ -182,7 +182,7 @@ public class SimplePattern implements Serializable, Comparable<SimplePattern> { private static Node parse(String pattern, int pos) { int top = pattern.length(); - StringBuffer bld = null; + StringBuilder bld = null; Node parsedNode = null; while (pos < top) { char c = pattern.charAt(pos); @@ -201,7 +201,7 @@ public class SimplePattern implements Serializable, Comparable<SimplePattern> { // fall through default : if (bld == null) - bld = new StringBuffer(); + bld = new StringBuilder(); bld.append(c); ++pos; continue; diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java index 944754e37..e783dd074 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java @@ -438,7 +438,7 @@ public class SiteBundle { */ @Override public String toString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append(getClass().toString() + " :"); //$NON-NLS-1$ buffer.append(" at "); //$NON-NLS-1$ if (url != null) |