[Nice-commit] Nice/src/bossa/syntax NiceMethod.java,1.31,1.32
Brought to you by:
bonniot
From: <bo...@us...> - 2004-03-03 12:50:25
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4158/src/bossa/syntax Modified Files: NiceMethod.java Log Message: Print a warning when a method does an implicit override. Index: NiceMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceMethod.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** NiceMethod.java 3 Mar 2004 09:40:27 -0000 1.31 --- NiceMethod.java 3 Mar 2004 12:37:52 -0000 1.32 *************** *** 169,172 **** --- 169,188 ---- User.error(this, "This method does not override any other method"); + if (! inInterfaceFile() && ! isOverride && specializedMethods != null) + { + MethodDeclaration parent = + (MethodDeclaration) specializedMethods.get(0); + boolean sameResult = + getReturnType().toString().equals(parent.getReturnType().toString()); + + if (sameResult) + User.warning(this, "This method overrides " + parent + + "\nYou should make this explicit, either by omitting the return type" + + "\nor by using the 'override' keyword"); + else + User.warning(this, "This method overrides " + parent + + "\nYou should make this explicit by using the 'override' keyword"); + } + super.typedResolve(); } |