diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 900e0a6..ad5c96c 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -43,9 +43,9 @@ jobs: git clone https://github.com/vesoft-inc/nebula-docker-compose.git pushd nebula-docker-compose/ cp ../../src/test/resources/docker-compose.yaml . - docker-compose up -d + docker compose up -d sleep 30 - docker-compose ps + docker compose ps popd popd diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4419332..347191d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,9 +18,9 @@ jobs: git clone https://github.com/vesoft-inc/nebula-docker-compose.git pushd nebula-docker-compose/ cp ../../src/test/resources/docker-compose.yaml . - docker-compose up -d + docker compose up -d sleep 30 - docker-compose ps + docker compose ps popd popd diff --git a/src/main/java/org/nebula/contrib/ngbatis/utils/ReflectUtil.java b/src/main/java/org/nebula/contrib/ngbatis/utils/ReflectUtil.java index fdac24d..1b7a99a 100644 --- a/src/main/java/org/nebula/contrib/ngbatis/utils/ReflectUtil.java +++ b/src/main/java/org/nebula/contrib/ngbatis/utils/ReflectUtil.java @@ -295,8 +295,9 @@ public static Class fieldType(Object o, String fieldName) { * @return paramType 是否为 parentType 子类或实现类 */ public static boolean isCurrentTypeOrParentType(Class paramType, Class parentType) { - if (paramType == null) return false; - if (parentType == null) return false; + if (paramType == null || parentType == null) { + return false; + } if (paramType == parentType) { return true; } diff --git a/src/test/java/org/nebula/contrib/ngbatis/utils/ReflectUtilTest.java b/src/test/java/org/nebula/contrib/ngbatis/utils/ReflectUtilTest.java index ad32f32..b96cd56 100644 --- a/src/test/java/org/nebula/contrib/ngbatis/utils/ReflectUtilTest.java +++ b/src/test/java/org/nebula/contrib/ngbatis/utils/ReflectUtilTest.java @@ -28,11 +28,11 @@ public void testIsCurrentTypeOrParentType() { @Test public void testFindLeafClass() { Set> classes = new HashSet>() {{ - add(A.class); - add(E.class); - add(F.class); - add(G.class); - }}; + add(A.class); + add(E.class); + add(F.class); + add(G.class); + }}; Class leafType = ReflectUtil.findNoForkLeafClass(classes, C.class); Assertions.assertEquals(D.class, leafType); @@ -42,27 +42,37 @@ public void testFindLeafClass() { leafType = ReflectUtil.findNoForkLeafClass(classes, B.class); Assertions.assertEquals(B.class, leafType); } -} -/* - * - A - * - B - * - C - * - D - * - F - * - G - * - E - */ -class A {} -class B extends A {} + /* + * - A + * - B + * - C + * - D + * - F + * - G + * - E + */ + static class A { + + } -class C extends B {} + static class B extends A { + } -class D extends C {} + static class C extends B { + } -class F extends D {} + static class D extends C { + } -class G extends D {} + static class F extends D { + } + + static class G extends D { + } + + static class E extends B { + } +} -class E extends B {}