Skip to content

Commit

Permalink
fix:Utility classes should not have public constructors (#10019)
Browse files Browse the repository at this point in the history
  • Loading branch information
4yDX3906 authored Mar 6, 2023
1 parent e58c444 commit 74b81be
Show file tree
Hide file tree
Showing 29 changed files with 89 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
*/
public abstract class AbstractAssert {

private AbstractAssert() {
}

/**
* Assert a boolean expression, throwing an {@code IllegalStateException}
* if the expression evaluates to {@code false}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
*/
public abstract class AbstractObjectUtils {

private AbstractObjectUtils() {
}

private static final int INITIAL_HASH = 7;

private static final int MULTIPLIER = 31;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* @author zzq
*/
public class ArrayUtils {

private ArrayUtils() {
}

/**
* <p>Checks if an array of Objects is empty or {@code null}.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
public final class ByteUtils {

private ByteUtils() {
}

public static final byte[] EMPTY = new byte[0];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
public final class ClassUtils {

private ClassUtils() {
}

public static final String ARRAY_SUFFIX = "[]";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
public final class CollectionUtils {

private CollectionUtils() {
}

/**
* Returns the <code>index</code>-th value in <code>object</code>, throwing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
public final class ConvertUtils {

private ConvertUtils() {
}

private static final String NULL_STR = "null";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* @author zzq
*/
public class DateFormatUtils {

private DateFormatUtils() {
}

public static final String YYYYMMDD = "yyyyMMdd";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
* @since 1.2.0
*/
public class ExceptionUtil {

private ExceptionUtil() {
}

/**
* Represents an empty exception, that is, no exception occurs, only a constant.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
* @since 0.8.0
*/
public class HttpMethod {

private HttpMethod() {
}

public static final String GET = "GET";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
*/
@SuppressWarnings({"checkstyle:AbbreviationAsWordInName", "PMD.ClassNamingShouldBeCamelRule"})
public class InetAddressValidator {

private InetAddressValidator() {
}

private static final String PERCENT = "%";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
*/
@SuppressWarnings({"checkstyle:AbbreviationAsWordInName", "PMD.ClassNamingShouldBeCamelRule"})
public class InternetAddressUtil {


private InternetAddressUtil() {
}

public static final boolean PREFER_IPV6_ADDRESSES = Boolean.parseBoolean(System.getProperty("java.net.preferIPv6Addresses"));

public static final String IPV6_START_MARK = "[";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
* @author nacos
*/
public class IoUtils {

private IoUtils() {
}

/**
* Try decompress by GZIP from stream.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
public final class JacksonUtils {

private JacksonUtils() {
}

static ObjectMapper mapper = new ObjectMapper();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
public final class LoggerUtils {

private LoggerUtils() {
}

public static final String TRACE = "TRACE";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
*/
@SuppressWarnings("PMD.ClassNamingShouldBeCamelRule")
public class MD5Utils {

private MD5Utils() {
}

private static final char[] DIGITS_LOWER = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
'e', 'f'};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
public class MapUtil {

private MapUtil() {
}

/**
* Null-safe check if the specified Dictionary is empty.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* @date 2020/10/12 17:56
*/
public class NamespaceUtil {

private NamespaceUtil() {
}

private static final String NAMESPACE_PUBLIC_KEY = "public";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* @author zzq
*/
public class NumberUtils {

private NumberUtils() {
}

/**
* Convert a <code>String</code> to an <code>int</code>, returning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
* @date 2021/7/29
*/
public class Preconditions {


private Preconditions() {
}

/**
* check precondition.
* @param expression a boolean expression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
* @author Pixy Yuan on 2022/3/24
*/
public class PropertyUtils {

private PropertyUtils() {
}

private static final String PROCESSORS_ENV_NAME = "NACOS_COMMON_PROCESSORS";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* @author zzq
*/
public class RandomUtils {

private RandomUtils() {
}

/**
* Random Object for random method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
* @version $Id: ReflectUtils.java, v 0.1 2020年08月20日 12:57 PM liuzunfei Exp $
*/
public class ReflectUtils {

private ReflectUtils() {
}

/**
* get filed value of obj.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
* @author boyan
*/
public class ResourceUtils {

private ResourceUtils() {
}

private static final String CLASSPATH_PREFIX = "classpath:";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
* @author zzq
*/
public class StringUtils {

private StringUtils() {
}

public static final String DOT = ".";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
* @author <a href="mailto:[email protected]">liaochuntao</a>
*/
public final class ThreadUtils {

private ThreadUtils() {
}

private static final int THREAD_MULTIPLER = 2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
* @author zzq
*/
public class TypeUtils {

private TypeUtils() {
}

/**
* Create a parameterized type instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* @author nkorange
*/
public class UuidUtils {

private UuidUtils() {
}

public static String generateUuid() {
return UUID.randomUUID().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
* @author xingxuechao on:2019/2/27 12:32 PM
*/
public class VersionUtils {

private VersionUtils() {
}

public static String version;

Expand Down

0 comments on commit 74b81be

Please sign in to comment.