Skip to content

Commit

Permalink
Restore API compatibility after StringBuffer clean-up
Browse files Browse the repository at this point in the history
and replace StringBuffer in Java-doc where necessary.
  • Loading branch information
HannesWell committed Dec 9, 2023
1 parent f05cd6f commit d2492e3
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.metadata;singleton:=true
Bundle-Version: 2.8.100.qualifier
Bundle-Version: 2.9.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.equinox.internal.p2.metadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ public abstract class BasicVersion extends Version {
public abstract String getQualifier();

/**
* Appends the original for this version onto the <code>sb</code> StringBuffer
* Appends the original for this version onto the <code>sb</code> StringBuilder
* if present.
* @param sb The buffer that will receive the raw string format
* @param rangeSafe Set to <code>true</code> if range delimiters should be escaped
*/
public abstract void originalToString(StringBuilder sb, boolean rangeSafe);

/**
* Appends the raw format for this version onto the <code>sb</code> StringBuffer.
* Appends the raw format for this version onto the <code>sb</code> StringBuilder.
* @param sb The buffer that will receive the raw string format
* @param rangeSafe Set to <code>true</code> if range delimiters should be escaped
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public boolean isOSGiCompatible() {
}

/**
* Appends the original for this version onto the <code>sb</code> StringBuffer
* Appends the original for this version onto the <code>sb</code> StringBuilder
* if present.
* @param sb The buffer that will receive the raw string format
* @param rangeSafe Set to <code>true</code> if range delimiters should be escaped
Expand All @@ -203,7 +203,7 @@ public void originalToString(StringBuilder sb, boolean rangeSafe) {
}

/**
* Appends the raw format for this version onto the <code>sb</code> StringBuffer.
* Appends the raw format for this version onto the <code>sb</code> StringBuilder.
* @param sb The buffer that will receive the raw string format
* @param rangeSafe Set to <code>true</code> if range delimiters should be escaped
*/
Expand All @@ -214,7 +214,7 @@ public void rawToString(StringBuilder sb, boolean rangeSafe) {

/**
* Appends the string representation of this version onto the
* <code>sb</code> StringBuffer.
* <code>sb</code> StringBuilder.
* @param sb The buffer that will receive the version string
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,25 @@ public interface IVersionFormat {
static final String DEFAULT_MIN_STRING_TRANSLATION = "-"; //$NON-NLS-1$

/**
* Appends the string representation of this compiled format to
* the given StringBuffer.
* Appends the string representation of this compiled format to the given
* StringBuffer.
*
* @param sb The buffer that will receive the string representation
* @deprecated Use {@link #toString(StringBuilder)} instead
*/
@Deprecated(since = "2.9")
default void toString(StringBuffer sb) {
StringBuilder builder = new StringBuilder();
toString(builder);
sb.append(builder);
}

/**
* Appends the string representation of this compiled format to the given
* StringBuilder.
*
* @param sb The builder that will receive the string representation
* @since 2.9
*/
void toString(StringBuilder sb);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,21 @@ public String toString() {
* Appends the string representation of this version onto the
* <code>sb</code> StringBuffer.
* @param sb The buffer that will receive the version string
* @deprecated use {@link #toString(StringBuilder)} instead
*/
@Deprecated(since = "2.9")
public void toString(StringBuffer sb) {
StringBuilder builder = new StringBuilder();
toString(builder);
sb.append(builder);
}

/**
* Appends the string representation of this version onto the <code>sb</code>
* StringBuilder.
*
* @param sb The builder that will receive the version string
* @since 2.9
*/
public abstract void toString(StringBuilder sb);
}
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,19 @@ public String toString() {
return result.toString();
}

/**
* @deprecated use {@link #toString(StringBuilder)} instead.
*/
@Deprecated(since = "2.9")
public void toString(StringBuffer result) {
StringBuilder builder = new StringBuilder();
toString(builder);
result.append(builder);
}

/**
* @since 2.9
*/
public void toString(StringBuilder result) {
boolean gtEqual = includeMin && includeMax && Version.MAX_VERSION.equals(maxVersion);
if (gtEqual && Version.emptyVersion.equals(minVersion)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,48 @@ public interface IExpression {
int getExpressionType();

/**
* Appends the string representation of this expression to the collector <code>collector</code>.
* Appends the string representation of this expression to the collector
* <code>collector</code>.
*
* @deprecated use {@link #toString(StringBuilder)} instead
*/
@Deprecated(since = "2.9")
default void toString(StringBuffer collector) {
StringBuilder builder = new StringBuilder();
toString(builder);
collector.append(builder);
}

/**
* Appends the string representation of this expression to the collector
* <code>collector</code>.
*
* @since 2.9
*/
void toString(StringBuilder collector);

/**
* Appends the an LDAP filter representation of this expression to the <code>collector</code>.
* @throws UnsupportedOperationException if the expression contains nodes
* that cannot be represented in an LDAP filter
* Appends the an LDAP filter representation of this expression to the
* <code>collector</code>.
*
* @throws UnsupportedOperationException if the expression contains nodes that
* cannot be represented in an LDAP filter
* @deprecated use {@link #toLDAPString(StringBuilder)} instead
*/
@Deprecated(since = "2.9")
default void toLDAPString(StringBuffer collector) {
StringBuilder builder = new StringBuilder();
toLDAPString(builder);
collector.append(builder);
}

/**
* Appends the an LDAP filter representation of this expression to the
* <code>collector</code>.
*
* @throws UnsupportedOperationException if the expression contains nodes that
* cannot be represented in an LDAP filter
* @since 2.9
*/
void toLDAPString(StringBuilder collector);
}

0 comments on commit d2492e3

Please sign in to comment.