From f865ae5802e673feb8272231749191b10a3a014e Mon Sep 17 00:00:00 2001 From: Oliver Burn Date: Wed, 13 Nov 2002 04:33:23 +0000 Subject: [PATCH] removed unused code --- .../tools/checkstyle/JavadocTag.java | 112 ------------- .../tools/checkstyle/MethodSignature.java | 149 ------------------ .../tools/checkstyle/JavadocTagTest.java | 21 --- .../tools/checkstyle/MethodSignatureTest.java | 21 --- 4 files changed, 303 deletions(-) delete mode 100644 src/checkstyle/com/puppycrawl/tools/checkstyle/JavadocTag.java delete mode 100644 src/checkstyle/com/puppycrawl/tools/checkstyle/MethodSignature.java delete mode 100644 src/tests/com/puppycrawl/tools/checkstyle/JavadocTagTest.java delete mode 100644 src/tests/com/puppycrawl/tools/checkstyle/MethodSignatureTest.java diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/JavadocTag.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/JavadocTag.java deleted file mode 100644 index 88f6cf8c1..000000000 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/JavadocTag.java +++ /dev/null @@ -1,112 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code for adherence to a set of rules. -// Copyright (C) 2001-2002 Oliver Burn -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle; - -/** - * Represents a Javadoc tag. Provides methods to query what type of tag it is. - * @author Oliver Burn - **/ -class JavadocTag -{ - /** the line number of the tag **/ - private final int mLineNo; - /** the tag string **/ - private final String mTag; - /** an optional first argument. For example the parameter name. **/ - private final String mArg1; - - /** - * Constructs the object. - * @param aLine the line number of the tag - * @param aTag the tag string - * @param aArg1 the tag argument - **/ - JavadocTag(int aLine, String aTag, String aArg1) - { - mLineNo = aLine; - mTag = aTag; - mArg1 = aArg1; - } - - /** - * Constructs the object. - * @param aLine the line number of the tag - * @param aTag the tag string - **/ - JavadocTag(int aLine, String aTag) - { - this(aLine, aTag, null); - } - - /** @return the tag string **/ - String getTag() - { - return mTag; - } - - /** @return the first argument. null if not set. **/ - String getArg1() - { - return mArg1; - } - - /** @return the line number **/ - int getLineNo() - { - return mLineNo; - } - - /** @return a string representation of the object **/ - public String toString() - { - return "{Tag = '" + getTag() + "', lineNo = " + getLineNo() - + ", Arg1 = '" + getArg1() + "'}"; - } - - /** @return whether the tag is an 'author' tag **/ - boolean isAuthorTag() - { - return "author".equals(getTag()); - } - - /** @return whether the tag is an 'return' tag **/ - boolean isReturnTag() - { - return "return".equals(getTag()); - } - - /** @return whether the tag is an 'param' tag **/ - boolean isParamTag() - { - return "param".equals(getTag()); - } - - /** @return whether the tag is an 'throws' or 'exception' tag **/ - boolean isThrowsTag() - { - return ("throws".equals(getTag()) || "exception".equals(getTag())); - } - - /** @return whether the tag is a 'see' tag **/ - boolean isSeeTag() - { - return "see".equals(getTag()); - } -} - diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/MethodSignature.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/MethodSignature.java deleted file mode 100644 index af3cedf19..000000000 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/MethodSignature.java +++ /dev/null @@ -1,149 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code for adherence to a set of rules. -// Copyright (C) 2001-2002 Oliver Burn -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//////////////////////////////////////////////////////////////////////////////// -package com.puppycrawl.tools.checkstyle; - -import java.util.ArrayList; -import java.util.List; - -/** - * Represents the signature for a method. Actually this is a lie as it only - * represents the method name, parameters, exceptions and line number of - * the name. - * It does not have the return type or modifiers. - * @author Oliver Burn - **/ -class MethodSignature -{ - /** the parameters **/ - private final List mParams = new ArrayList(); - /** the throws **/ - private List mThrows = new ArrayList(); - /** the name **/ - private MyCommonAST mName; - /** the modifiers **/ - private final MyModifierSet mModSet = new MyModifierSet(); - /** the return type **/ - private MyCommonAST mReturnType; - - /** - * Adds a parameter. - * @param aParam the parameter details. - **/ - void addParam(LineText aParam) - { - mParams.add(aParam); - } - - /** @return the parameters as a List that can be modified **/ - List getParams() - { - return new ArrayList(mParams); - } - - /** - * Sets the list of throws. - * @param aThrows the throws - **/ - void setThrows(List aThrows) - { - mThrows = aThrows; - } - - /** @return the list of throws as a List that can be modified **/ - List getThrows() - { - return new ArrayList(mThrows); - } - - /** - * @param aName method name - */ - void setName(MyCommonAST aName) - { - mName = aName; - } - - /** @return method name **/ - MyCommonAST getName() - { - return mName; - } - - /** @return the MyModifierSet for the method **/ - MyModifierSet getModSet() - { - return mModSet; - } - - /** @return the first line of the method signature **/ - int getFirstLineNo() - { - if (mModSet.size() > 0) { - return mModSet.getFirstLineNo(); - } - else if (mReturnType != null) { - return mReturnType.getLineNo(); - } - else { - return mName.getLineNo(); - } - } - - /** @return the first column of the method signature **/ - int getFirstColNo() - { - if (mModSet.size() > 0) { - return mModSet.getFirstColNo(); - } - else if (mReturnType != null) { - return mReturnType.getColumnNo(); - } - else { - return mName.getColumnNo(); - } - } - - /** @return the return type **/ - MyCommonAST getReturnType() - { - return mReturnType; - } - - /** - * @param aReturnType the return type - */ - void setReturnType(MyCommonAST aReturnType) - { - mReturnType = aReturnType; - } - - /** @return whether the method is a function **/ - boolean isFunction() - { - return isConstructor() - ? false - : !"void".equals(mReturnType.getText().trim()); - } - - /** @return whether the method is really a constructor **/ - boolean isConstructor() - { - return (mReturnType == null); - } -} diff --git a/src/tests/com/puppycrawl/tools/checkstyle/JavadocTagTest.java b/src/tests/com/puppycrawl/tools/checkstyle/JavadocTagTest.java deleted file mode 100644 index c074af4e5..000000000 --- a/src/tests/com/puppycrawl/tools/checkstyle/JavadocTagTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.puppycrawl.tools.checkstyle; - -import junit.framework.TestCase; - -public class JavadocTagTest - extends TestCase -{ - public JavadocTagTest(String name) - { - super(name); - } - - public void testMisc() - { - final JavadocTag o = new JavadocTag(666, "@fred"); - assertNotNull(o); - assertEquals("{Tag = '@fred', lineNo = 666, Arg1 = 'null'}", - o.toString()); - assertEquals(false, o.isAuthorTag()); - } -} diff --git a/src/tests/com/puppycrawl/tools/checkstyle/MethodSignatureTest.java b/src/tests/com/puppycrawl/tools/checkstyle/MethodSignatureTest.java deleted file mode 100644 index c26ac1870..000000000 --- a/src/tests/com/puppycrawl/tools/checkstyle/MethodSignatureTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.puppycrawl.tools.checkstyle; - -import junit.framework.TestCase; - -public class MethodSignatureTest - extends TestCase -{ - public MethodSignatureTest(String name) - { - super(name); - } - - public void testMisc() - { - final MethodSignature o = new MethodSignature(); - assertNotNull(o); - final MyCommonAST ret = new MyCommonAST(); - o.setReturnType(ret); - assertEquals(ret, o.getReturnType()); - } -}