Update of /cvsroot/clirr/clirr/core/src/java/net/sf/clirr/core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26466/src/java/net/sf/clirr/core
Modified Files:
ApiDifference.java
Log Message:
toString() method now reports both binary and source severity level, if
they are different. Previously, only binary severity was reported.
Index: ApiDifference.java
===================================================================
RCS file: /cvsroot/clirr/clirr/core/src/java/net/sf/clirr/core/ApiDifference.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ApiDifference.java 18 Jul 2004 00:58:35 -0000 1.3
+++ ApiDifference.java 23 Jul 2004 08:07:33 -0000 1.4
@@ -270,8 +270,10 @@
*/
public String toString()
{
- return "" + message.getId() + " (" + binaryCompatibilitySeverity + ") - "
- + affectedClass + '[' + affectedField + '/' + affectedMethod + ']';
+ StringBuffer buf = new StringBuffer();
+ buf.append(message.getId());
+ appendCommonData(buf);
+ return buf.toString();
}
/**
@@ -280,7 +282,34 @@
*/
public String toString(MessageTranslator translator)
{
- return getReport(translator) + " (" + binaryCompatibilitySeverity + ") - "
- + affectedClass + '[' + affectedField + '/' + affectedMethod + ']';
+ StringBuffer buf = new StringBuffer();
+ buf.append(getReport(translator));
+ appendCommonData(buf);
+ return buf.toString();
+ }
+
+ /**
+ * Build a string containing a string representation of most of the
+ * fields in this object, but not the message-id or the string
+ * translation thereof.
+ */
+ private void appendCommonData(StringBuffer buf)
+ {
+ buf.append(" (");
+ buf.append(binaryCompatibilitySeverity);
+
+ if (sourceCompatibilitySeverity != binaryCompatibilitySeverity)
+ {
+ buf.append(",");
+ buf.append(sourceCompatibilitySeverity);
+ }
+
+ buf.append(") - ");
+ buf.append(affectedClass);
+ buf.append("[");
+ buf.append(affectedField);
+ buf.append("/");
+ buf.append(affectedMethod);
+ buf.append("]");
}
}
|