fix isClassName method error

This commit is contained in:
oppofind 2020-08-28 22:31:31 +08:00
parent 9a1a8936f7
commit 624d2d974b
1 changed files with 10 additions and 10 deletions

View File

@ -28,6 +28,7 @@ import com.power.doc.model.ApiReturn;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
/**
* Description:
@ -239,16 +240,15 @@ public class DocClassUtil {
}
private static boolean isClassName(String className) {
if (StringUtil.isEmpty(className)) {
return false;
}
if (className.contains("<") && !className.contains(">")) {
return false;
} else if (className.contains(">") && !className.contains("<")) {
return false;
} else {
return true;
className = className.replaceAll("[^<>]", "");
Stack<Character> stack = new Stack<>();
for (char c : className.toCharArray()) {
if (c == '<') {
stack.push('>');
} else if (stack.isEmpty() || c != stack.pop()) {
return false;
}
}
return stack.isEmpty();
}
}