Thread: [Clirr-devel] CVS: clirr/src/test/net/sf/clirr/checks MethodSetCheckTest.java,1.1,1.2
Status: Alpha
Brought to you by:
lkuehne
From: Lars K?h. <lk...@us...> - 2004-01-26 09:34:55
|
Update of /cvsroot/clirr/clirr/src/test/net/sf/clirr/checks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28527/src/test/net/sf/clirr/checks Modified Files: MethodSetCheckTest.java Log Message: Implemented initial checking for parameter types and return types The current algorithm for finding matching methods between old and new class is very naive but should be sufficient to serve as a test for the framework (filtering of errors, etc.) There are a few other implementation limitations as well, see TODO comments in the code Index: MethodSetCheckTest.java =================================================================== RCS file: /cvsroot/clirr/clirr/src/test/net/sf/clirr/checks/MethodSetCheckTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MethodSetCheckTest.java 18 Jan 2004 12:04:59 -0000 1.1 +++ MethodSetCheckTest.java 25 Jan 2004 08:16:46 -0000 1.2 @@ -15,9 +15,13 @@ { ApiDifference[] expected = new ApiDifference[] { - // method visibility changes - //new ApiDifference("Accessibility of method 'public int getPriv2()' has been weakened in testlib.MethodsChange", - // Severity.ERROR, "testlib.MethodsChange", "public int getPriv2()", null), + // method addition and removal + new ApiDifference("Method 'public void removedMethod(java.lang.String)' has been removed in testlib.MethodsChange", + Severity.ERROR, "testlib.MethodsChange", "public void removedMethod(java.lang.String)", null), + new ApiDifference("Method 'public int getPriv2()' has been removed in testlib.MethodsChange", + Severity.ERROR, "testlib.MethodsChange", "public int getPriv2()", null), + new ApiDifference("Method 'public void printPriv()' has been removed in testlib.MethodsChange", + Severity.ERROR, "testlib.MethodsChange", "public void printPriv()", null), // parameter type changes //new ApiDifference("Parameter type of method 'public void changeParamterType(java.lang.String)' has changed.", @@ -28,27 +32,27 @@ // Severity.INFO, "testlib.MethodsChange", "public void strengthenParamterType(java.lang.Object)", null), // Constructor changes - /* - new ApiDifference("Method 'public void removedMethod(java.lang.String)' has been removed in testlib.MethodsChange", - Severity.ERROR, "testlib.MethodsChange", "public void removedMethod(java.lang.String)", null), - new ApiDifference("Constructor 'protected MethodsChange(int)' has been removed in testlib.MethodsChange", - Severity.ERROR, "testlib.MethodsChange", "public MethodsChange(int)", null), - new ApiDifference("Constructor 'protected MethodsChange(java.lang.Integer)' has been added in testlib.MethodsChange", - Severity.INFO, "testlib.MethodsChange", "public MethodsChange(java.lang.Integer)", null), - new ApiDifference("Constructor 'protected MethodsChange(int, boolean)' has been added in testlib.MethodsChange", - Severity.INFO, "testlib.MethodsChange", "public MethodsChange(int, boolean)", null), - */ + new ApiDifference("Parameter 1 of 'protected MethodsChange(int)' has changed it's type to java.lang.Integer in testlib.MethodsChange", + Severity.ERROR, "testlib.MethodsChange", "protected MethodsChange(int)", null), +// new ApiDifference("Constructor 'protected MethodsChange(int, boolean)' has been added in testlib.MethodsChange", +// Severity.INFO, "testlib.MethodsChange", "public MethodsChange(int, boolean)", null), // return type changes - /* - new ApiDifference("Return type of Method 'public java.lang.Number getPrivAsNumber()' has been changed to java.lang.Integer", - Severity.INFO, "testlib.MethodsChange", "public java.lang.Number getPrivAsNumber()", null), - new ApiDifference("Return type of Method 'public java.lang.Integer getPrivAsInteger()' has been changed to java.lang.Number", + new ApiDifference("Return type of Method 'public java.lang.Number getPrivAsNumber()' has been changed to java.lang.Integer in testlib.MethodsChange", + Severity.ERROR, "testlib.MethodsChange", "public java.lang.Number getPrivAsNumber()", null), + // TODO: INFO if method is final + new ApiDifference("Return type of Method 'public java.lang.Integer getPrivAsInteger()' has been changed to java.lang.Number in testlib.MethodsChange", Severity.ERROR, "testlib.MethodsChange", "public java.lang.Integer getPrivAsInteger()", null), - */ // parameter list changes - // TODO + // Note: This is the current behaviour, not necessarily the spec of the desired behaviour + // TODO: need to check assignability of types (and check if method or class is final?) + new ApiDifference("Parameter 1 of 'public void strengthenParamType(java.lang.Object)' has changed it's type to java.lang.String in testlib.MethodsChange", + Severity.ERROR, "testlib.MethodsChange", "public void strengthenParamType(java.lang.Object)", null), + new ApiDifference("Parameter 1 of 'public void weakenParamType(java.lang.String)' has changed it's type to java.lang.Object in testlib.MethodsChange", + Severity.ERROR, "testlib.MethodsChange", "public void weakenParamType(java.lang.String)", null), + new ApiDifference("Parameter 1 of 'public void changeParamType(java.lang.String)' has changed it's type to java.lang.Integer in testlib.MethodsChange", + Severity.ERROR, "testlib.MethodsChange", "public void changeParamType(java.lang.String)", null), // declared exceptions // TODO |