Pull #2859: Disallow usage of java.util.Stack and java.util.Vector in code
This commit is contained in:
parent
c934e12cfc
commit
b30c00753a
|
|
@ -28,7 +28,9 @@
|
|||
<module name="InterfaceTypeParameterNameCheck"/>
|
||||
<module name="ForbidThrowAnonymousExceptionsCheck"/>
|
||||
<module name="ForbidReturnInFinallyBlock"/>
|
||||
<module name="ForbidInstantiation"/>
|
||||
<module name="ForbidInstantiation">
|
||||
<property name="forbiddenClasses" value="java.lang.NullPointerException,java.util.Vector,java.util.Stack"/>
|
||||
</module>
|
||||
<module name="ForbidCCommentsInMethods"/>
|
||||
<module name="FinalizeImplementationCheck"/>
|
||||
<module name="RequiredParameterForAnnotation"/>
|
||||
|
|
@ -89,7 +91,7 @@
|
|||
</module>
|
||||
<module name="ForbidCertainImports">
|
||||
<property name="packageNameRegexp" value="^.*(api|utils).*$"/>
|
||||
<property name="forbiddenImportsRegexp" value="^.*checks.*$"/>
|
||||
<property name="forbiddenImportsRegexp" value="^.*checks.*|java\.util\.Vector|java\.util\.Stack$"/>
|
||||
</module>
|
||||
<module name="LineLengthExtended">
|
||||
<property name="max" value="100"/>
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.checks.indentation;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
import java.util.Locale;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
|
|
@ -497,11 +498,11 @@ public class CommentsIndentationCheck extends Check {
|
|||
*/
|
||||
private static DetailAST getOneLinePreviousStatementOfSingleLineComment(DetailAST comment) {
|
||||
DetailAST previousStatement = null;
|
||||
final Stack<DetailAST> stack = new Stack<>();
|
||||
final Deque<DetailAST> stack = new ArrayDeque<>();
|
||||
DetailAST root = comment.getParent();
|
||||
|
||||
while (root != null || !stack.empty()) {
|
||||
if (!stack.empty()) {
|
||||
while (root != null || !stack.isEmpty()) {
|
||||
if (!stack.isEmpty()) {
|
||||
root = stack.pop();
|
||||
}
|
||||
while (root != null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue