|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AbstractIllegalCheck | Line # 29 | 81% |
0.8095238
|
6.25 | 10 | 6 | 6 | 0.6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ( 10 of 12) | |||
| Result | |||
|
0.8095238
|
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testMessage
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testMessage
|
1 PASS | |
|
0.8095238
|
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testNone
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testNone
|
1 PASS | |
|
0.8095238
|
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testCheckCPP
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testCheckCPP
|
1 PASS | |
|
0.8095238
|
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testDefault
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testDefault
|
1 PASS | |
|
0.8095238
|
com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheckTest.testDefault
com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheckTest.testDefault
|
1 PASS | |
|
0.8095238
|
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testOffFormatCheck
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testOffFormatCheck
|
1 PASS | |
|
0.8095238
|
com.puppycrawl.tools.checkstyle.checks.coding.IllegalThrowsCheckTest.testDefault
com.puppycrawl.tools.checkstyle.checks.coding.IllegalThrowsCheckTest.testDefault
|
1 PASS | |
|
0.8095238
|
com.puppycrawl.tools.checkstyle.checks.coding.IllegalThrowsCheckTest.testIllegalClassNames
com.puppycrawl.tools.checkstyle.checks.coding.IllegalThrowsCheckTest.testIllegalClassNames
|
1 PASS | |
|
0.8095238
|
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testCheckC
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testCheckC
|
1 PASS | |
|
0.8095238
|
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testOffFormat
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilterTest.testOffFormat
|
1 PASS | |
| 2 tests are not displayed. This report was configured to show the top 10 tests that covered this file. | |||
| 1 | //////////////////////////////////////////////////////////////////////////////// | |
| 2 | // checkstyle: Checks Java source code for adherence to a set of rules. | |
| 3 | // Copyright (C) 2001-2005 Oliver Burn | |
| 4 | // | |
| 5 | // This library is free software; you can redistribute it and/or | |
| 6 | // modify it under the terms of the GNU Lesser General Public | |
| 7 | // License as published by the Free Software Foundation; either | |
| 8 | // version 2.1 of the License, or (at your option) any later version. | |
| 9 | // | |
| 10 | // This library is distributed in the hope that it will be useful, | |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | // Lesser General Public License for more details. | |
| 14 | // | |
| 15 | // You should have received a copy of the GNU Lesser General Public | |
| 16 | // License along with this library; if not, write to the Free Software | |
| 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 18 | //////////////////////////////////////////////////////////////////////////////// | |
| 19 | package com.puppycrawl.tools.checkstyle.checks.coding; | |
| 20 | ||
| 21 | import com.puppycrawl.tools.checkstyle.api.Check; | |
| 22 | import java.util.HashSet; | |
| 23 | import java.util.Set; | |
| 24 | ||
| 25 | /** | |
| 26 | * Support for checks that look for usage of illegal types. | |
| 27 | * @author Oliver Burn | |
| 28 | */ | |
| 29 | public abstract class AbstractIllegalCheck extends Check | |
| 30 | { | |
| 31 | /** Illegal class names */ | |
| 32 | private final Set mIllegalClassNames = new HashSet(); | |
| 33 | ||
| 34 | /** | |
| 35 | * Constructs an object. | |
| 36 | * @param aInitialNames the initial class names to treat as illegal | |
| 37 | */ | |
| 38 | 12 |
protected AbstractIllegalCheck(final String[] aInitialNames) |
| 39 | { | |
| 40 | 0 | assert aInitialNames != null; |
| 41 | 12 | setIllegalClassNames(aInitialNames); |
| 42 | } | |
| 43 | ||
| 44 | /** | |
| 45 | * Checks if given class is illegal. | |
| 46 | * | |
| 47 | * @param aIdent | |
| 48 | * ident to check. | |
| 49 | * @return true if given ident is illegal. | |
| 50 | */ | |
| 51 | 36 |
protected final boolean isIllegalClassName(final String aIdent) |
| 52 | { | |
| 53 | 36 | return mIllegalClassNames.contains(aIdent); |
| 54 | } | |
| 55 | ||
| 56 | /** | |
| 57 | * Set the list of illegal classes. | |
| 58 | * | |
| 59 | * @param aClassNames | |
| 60 | * array of illegal exception classes | |
| 61 | */ | |
| 62 | 14 |
public final void setIllegalClassNames(final String[] aClassNames) |
| 63 | { | |
| 64 | 0 | assert aClassNames != null; |
| 65 | 14 | mIllegalClassNames.clear(); |
| 66 | 112 | for (int i = 0; i < aClassNames.length; i++) { |
| 67 | 98 | final String name = aClassNames[i]; |
| 68 | 98 | mIllegalClassNames.add(name); |
| 69 | 98 | final int lastDot = name.lastIndexOf("."); |
| 70 | 98 | if ((lastDot > 0) && (lastDot < (name.length() - 1))) { |
| 71 | 51 | final String shortName = name |
| 72 | .substring(name.lastIndexOf(".") + 1); | |
| 73 | 51 | mIllegalClassNames.add(shortName); |
| 74 | } | |
| 75 | } | |
| 76 | } | |
| 77 | } | |
|
|||||||||||||