Merge pull request #1627 from cal101/erefactor/v5-dev-project/1/jdt/jdt-InvertEqualsCleanUp

[cleanup] erefactor/EclipseJdt - Invert equals arguments if parameter…
This commit is contained in:
Golden Looly
2021-06-07 00:22:11 +08:00
committed by GitHub
8 changed files with 18 additions and 18 deletions

View File

@@ -273,19 +273,19 @@ public class BeanDesc implements Serializable {
if (fieldName.startsWith("is")) {
// 字段已经是is开头
if (methodName.equals(fieldName) // isName -》 isName
|| methodName.equals("get" + handledFieldName)// isName -》 getIsName
|| methodName.equals("is" + handledFieldName)// isName -》 isIsName
|| ("get" + handledFieldName).equals(methodName)// isName -》 getIsName
|| ("is" + handledFieldName).equals(methodName)// isName -》 isIsName
) {
return true;
}
} else if (methodName.equals("is" + handledFieldName)) {
} else if (("is" + handledFieldName).equals(methodName)) {
// 字段非is开头 name -》 isName
return true;
}
}
// 包括boolean的任何类型只有一种匹配情况name -》 getName
return methodName.equals("get" + handledFieldName);
return ("get" + handledFieldName).equals(methodName);
}
/**
@@ -324,15 +324,15 @@ public class BeanDesc implements Serializable {
// 针对Boolean类型特殊检查
if (isBooleanField && fieldName.startsWith("is")) {
// 字段是is开头
if (methodName.equals("set" + StrUtil.removePrefix(fieldName, "is"))// isName -》 setName
|| methodName.equals("set" + handledFieldName)// isName -》 setIsName
if (("set" + StrUtil.removePrefix(fieldName, "is")).equals(methodName)// isName -》 setName
|| ("set" + handledFieldName).equals(methodName)// isName -》 setIsName
) {
return true;
}
}
// 包括boolean的任何类型只有一种匹配情况name -》 setName
return methodName.equals("set" + fieldName);
return ("set" + fieldName).equals(methodName);
}
// ------------------------------------------------------------------------------------------------------ Private method end
}

View File

@@ -1166,7 +1166,7 @@ public class ImgUtil {
* @since 4.3.2
*/
public static BufferedImage toBufferedImage(Image image, String imageType) {
final int type = imageType.equalsIgnoreCase(IMAGE_TYPE_PNG)
final int type = IMAGE_TYPE_PNG.equalsIgnoreCase(imageType)
? BufferedImage.TYPE_INT_ARGB
: BufferedImage.TYPE_INT_RGB;
return toBufferedImage(image, type);

View File

@@ -243,7 +243,7 @@ public class NetUtil {
long cBegin = NetUtil.ipv4ToLong("192.168.0.0");
long cEnd = NetUtil.ipv4ToLong("192.168.255.255");
isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || ipAddress.equals(LOCAL_IP);
isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || LOCAL_IP.equals(ipAddress);
return isInnerIp;
}

View File

@@ -1508,7 +1508,7 @@ public class XmlUtil {
*/
@Override
public String getNamespaceURI(String prefix) {
if (prefix == null || prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) {
if (prefix == null || XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
return prefixUri.get(DEFAULT_NS);
} else {
return prefixUri.get(prefix);

View File

@@ -102,7 +102,7 @@ public class CollUtilTest {
Collection<String> union = CollUtil.union(list1, list2);
Assert.assertEquals(3, CollUtil.count(union, t -> t.equals("b")));
Assert.assertEquals(3, CollUtil.count(union, t -> "b".equals(t)));
}
@Test
@@ -111,7 +111,7 @@ public class CollUtilTest {
ArrayList<String> list2 = CollUtil.newArrayList("a", "b", "b", "b", "c", "d");
Collection<String> intersection = CollUtil.intersection(list1, list2);
Assert.assertEquals(2, CollUtil.count(intersection, t -> t.equals("b")));
Assert.assertEquals(2, CollUtil.count(intersection, t -> "b".equals(t)));
}
@Test
@@ -236,7 +236,7 @@ public class CollUtilTest {
final String[] result = new String[1];
CollUtil.forEach(map, (key, value, index) -> {
if (key.equals("a")) {
if ("a".equals(key)) {
result[0] = value;
}
});