copy array before returning it

thanks to Peter Dobratz for reporting this problem
This commit is contained in:
Lars Kühne 2003-03-01 07:24:09 +00:00
parent 784b327005
commit 632b1cd8cf
2 changed files with 5 additions and 13 deletions

View File

@ -35,24 +35,20 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST;
* so their company's coding standards forbids them.
*
* @author lkuehne
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
public class AvoidInlineConditionalsCheck extends Check
{
/** avoids multiple instantiations of equivalten arrays */
private static final int[] DEFAULT_TOKENS =
new int[]{TokenTypes.QUESTION};
/** @see Check */
public int[] getDefaultTokens()
{
return DEFAULT_TOKENS;
return new int[]{TokenTypes.QUESTION};
}
/** @see Check */
public int[] getRequiredTokens()
{
return DEFAULT_TOKENS;
return getDefaultTokens();
}
/** @see Check */

View File

@ -53,18 +53,14 @@ import com.puppycrawl.tools.checkstyle.api.ScopeUtils;
* </p>
*
* @author lkuehne
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
public class DesignForInheritanceCheck extends Check
{
/** the default tokens for this check */
private static final int[] DEFAULT_TOKENS =
new int[] {TokenTypes.METHOD_DEF};
/** @see Check */
public int[] getDefaultTokens()
{
return DEFAULT_TOKENS;
return new int[] {TokenTypes.METHOD_DEF};
}
/** @see Check */