Skip to content

Commit 36423bd

Browse files
committed
Use expression
1 parent ab108a1 commit 36423bd

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

src/main/java/org/apache/commons/lang3/ClassUtils.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,10 +1412,7 @@ public static boolean isInnerClass(final Class<?> cls) {
14121412
* @since 3.1
14131413
*/
14141414
public static boolean isPrimitiveOrWrapper(final Class<?> type) {
1415-
if (type == null) {
1416-
return false;
1417-
}
1418-
return type.isPrimitive() || isPrimitiveWrapper(type);
1415+
return type != null && type.isPrimitive() || isPrimitiveWrapper(type);
14191416
}
14201417

14211418
/**

src/test/java/org/apache/commons/lang3/ClassUtilsTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,6 @@ void testHierarchyIncludingInterfaces() {
13181318

13191319
@Test
13201320
void testIsPrimitiveOrWrapper() {
1321-
13221321
// test primitive wrapper classes
13231322
assertTrue(ClassUtils.isPrimitiveOrWrapper(Boolean.class), "Boolean.class");
13241323
assertTrue(ClassUtils.isPrimitiveOrWrapper(Byte.class), "Byte.class");
@@ -1328,7 +1327,6 @@ void testIsPrimitiveOrWrapper() {
13281327
assertTrue(ClassUtils.isPrimitiveOrWrapper(Long.class), "Long.class");
13291328
assertTrue(ClassUtils.isPrimitiveOrWrapper(Double.class), "Double.class");
13301329
assertTrue(ClassUtils.isPrimitiveOrWrapper(Float.class), "Float.class");
1331-
13321330
// test primitive classes
13331331
assertTrue(ClassUtils.isPrimitiveOrWrapper(Boolean.TYPE), "boolean");
13341332
assertTrue(ClassUtils.isPrimitiveOrWrapper(Byte.TYPE), "byte");
@@ -1339,7 +1337,6 @@ void testIsPrimitiveOrWrapper() {
13391337
assertTrue(ClassUtils.isPrimitiveOrWrapper(Double.TYPE), "double");
13401338
assertTrue(ClassUtils.isPrimitiveOrWrapper(Float.TYPE), "float");
13411339
assertTrue(ClassUtils.isPrimitiveOrWrapper(Void.TYPE), "Void.TYPE");
1342-
13431340
// others
13441341
assertFalse(ClassUtils.isPrimitiveOrWrapper(null), "null");
13451342
assertFalse(ClassUtils.isPrimitiveOrWrapper(Void.class), "Void.class");

0 commit comments

Comments
 (0)