From 0763c93af72c3151c0802e44c3b86c650b261dc5 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Wed, 18 Oct 2023 00:22:48 +0900 Subject: [PATCH 01/11] [Add]: publishing libcobj.jar to the maven repoistory of GitHub Package --- .github/workflows/publish-libcobj.yml | 26 ++++++++++++++++++++++++++ libcobj/app/build.gradle.kts | 14 ++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 .github/workflows/publish-libcobj.yml diff --git a/.github/workflows/publish-libcobj.yml b/.github/workflows/publish-libcobj.yml new file mode 100644 index 00000000..4cb704d4 --- /dev/null +++ b/.github/workflows/publish-libcobj.yml @@ -0,0 +1,26 @@ +name: Publish package to GitHub Packages +on: + workflow_dispatch: +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: | + libcobj + - uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3 + - name: Publish package + uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 + with: + arguments: publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/libcobj/app/build.gradle.kts b/libcobj/app/build.gradle.kts index 69dee9be..139d6a71 100644 --- a/libcobj/app/build.gradle.kts +++ b/libcobj/app/build.gradle.kts @@ -5,6 +5,8 @@ plugins { id("com.github.johnrengelman.shadow") version "8.1.1" id("java") id("com.github.sherter.google-java-format") version "0.9" + id("maven-publish") + kotlin("multiplatform") version "1.8.10" } repositories { @@ -23,6 +25,18 @@ java { } } +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/opensourcecobol/opensourcecobol4j") + credentials { + username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") + } + } + } +} application { mainClass.set("") From 34b7374ad7db1e293b6b42ee80fcf4703228f911 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Thu, 19 Oct 2023 21:00:07 +0900 Subject: [PATCH 02/11] [Wip]: wip --- libcobj/app/build.gradle.kts | 39 ++++++++++++++----- .../opensourcecobol/libcobj/AppTest.java | 16 -------- 2 files changed, 30 insertions(+), 25 deletions(-) delete mode 100644 libcobj/app/src/test/java/jp/osscons/opensourcecobol/libcobj/AppTest.java diff --git a/libcobj/app/build.gradle.kts b/libcobj/app/build.gradle.kts index 139d6a71..32559732 100644 --- a/libcobj/app/build.gradle.kts +++ b/libcobj/app/build.gradle.kts @@ -6,7 +6,6 @@ plugins { id("java") id("com.github.sherter.google-java-format") version "0.9" id("maven-publish") - kotlin("multiplatform") version "1.8.10" } repositories { @@ -26,16 +25,38 @@ java { } publishing { - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/opensourcecobol/opensourcecobol4j") - credentials { - username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") - password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") + publications { + create("mavenJava") { + artifactId = "my-library" + from(components["java"]) + //versionMapping { + // usage("java-api") { + // fromResolutionOf("runtimeClasspath") + // } + // usage("java-runtime") { + // fromResolutionResult() + // } + //} + //pom { + // name = "My Library" + // description = "A concise description of my library" + // url = "http://www.example.com/library" + // properties = mapOf( + // "myProp" to "value", + // "prop.with.dots" to "anotherValue" + // ) + //} + } + } + repositories { + maven { + url = uri("https://maven.pkg.github.com/yutaro-sakamoto/opensourcecobol4j") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } } } - } } application { diff --git a/libcobj/app/src/test/java/jp/osscons/opensourcecobol/libcobj/AppTest.java b/libcobj/app/src/test/java/jp/osscons/opensourcecobol/libcobj/AppTest.java deleted file mode 100644 index 7540d285..00000000 --- a/libcobj/app/src/test/java/jp/osscons/opensourcecobol/libcobj/AppTest.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * This Java source file was generated by the Gradle 'init' task. - */ -package opensource.cobol.j.libcobj; - -import static org.junit.jupiter.api.Assertions.*; - -import org.junit.jupiter.api.Test; - -class AppTest { - @Test - void appHasAGreeting() { - App classUnderTest = new App(); - assertNotNull(classUnderTest.getGreeting(), "app should have a greeting"); - } -} From d9a72280f3ed37ca2110b4607df24025a7e9eb74 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Thu, 19 Oct 2023 21:05:51 +0900 Subject: [PATCH 03/11] [Wip]: wip --- .github/workflows/publish-libcobj.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-libcobj.yml b/.github/workflows/publish-libcobj.yml index 4cb704d4..acacaaa9 100644 --- a/.github/workflows/publish-libcobj.yml +++ b/.github/workflows/publish-libcobj.yml @@ -12,6 +12,7 @@ jobs: with: sparse-checkout: | libcobj + - run: ls -la - uses: actions/setup-java@v3 with: java-version: '11' From 6d6b02283987410eb3891003f88d93469a3f2c49 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Thu, 19 Oct 2023 21:10:53 +0900 Subject: [PATCH 04/11] [Wip]: wip --- .github/workflows/publish-libcobj.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-libcobj.yml b/.github/workflows/publish-libcobj.yml index acacaaa9..cc206bb3 100644 --- a/.github/workflows/publish-libcobj.yml +++ b/.github/workflows/publish-libcobj.yml @@ -9,10 +9,10 @@ jobs: packages: write steps: - uses: actions/checkout@v4 - with: - sparse-checkout: | - libcobj - - run: ls -la + - run: | + cd ../ + mv opensourcecobol4j/* . + mv libcobj/* opensourcecobol4j - uses: actions/setup-java@v3 with: java-version: '11' From 9e481770d368c750c20592eaf5068fdc4e186841 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Thu, 19 Oct 2023 21:18:13 +0900 Subject: [PATCH 05/11] [Wip]: wip --- libcobj/app/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcobj/app/build.gradle.kts b/libcobj/app/build.gradle.kts index 32559732..10536959 100644 --- a/libcobj/app/build.gradle.kts +++ b/libcobj/app/build.gradle.kts @@ -25,7 +25,7 @@ java { } publishing { - publications { + /*publications { create("mavenJava") { artifactId = "my-library" from(components["java"]) @@ -47,7 +47,7 @@ publishing { // ) //} } - } + }*/ repositories { maven { url = uri("https://maven.pkg.github.com/yutaro-sakamoto/opensourcecobol4j") From ce06ebcb5a2bfcf0386c86e71de0404f8b8cf49e Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Thu, 19 Oct 2023 21:38:26 +0900 Subject: [PATCH 06/11] [Wip]: wip --- .github/workflows/publish-libcobj.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-libcobj.yml b/.github/workflows/publish-libcobj.yml index cc206bb3..f419cf3b 100644 --- a/.github/workflows/publish-libcobj.yml +++ b/.github/workflows/publish-libcobj.yml @@ -18,9 +18,9 @@ jobs: java-version: '11' distribution: 'temurin' - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3 + uses: gradle/wrapper-validation-action@v1 - name: Publish package - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 + uses: gradle/gradle-build-action@v2 with: arguments: publish env: From f8811975032099665b5e7ae686b7f5a656b5d118 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Thu, 19 Oct 2023 22:05:49 +0900 Subject: [PATCH 07/11] [Wip]: wip --- libcobj/app/build.gradle.kts | 41 +++++++++++------------------------- libcobj/settings.gradle.kts | 2 +- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/libcobj/app/build.gradle.kts b/libcobj/app/build.gradle.kts index 10536959..5e7dac09 100644 --- a/libcobj/app/build.gradle.kts +++ b/libcobj/app/build.gradle.kts @@ -25,37 +25,20 @@ java { } publishing { - /*publications { - create("mavenJava") { - artifactId = "my-library" - from(components["java"]) - //versionMapping { - // usage("java-api") { - // fromResolutionOf("runtimeClasspath") - // } - // usage("java-runtime") { - // fromResolutionResult() - // } - //} - //pom { - // name = "My Library" - // description = "A concise description of my library" - // url = "http://www.example.com/library" - // properties = mapOf( - // "myProp" to "value", - // "prop.with.dots" to "anotherValue" - // ) - //} - } - }*/ repositories { - maven { - url = uri("https://maven.pkg.github.com/yutaro-sakamoto/opensourcecobol4j") - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/yutaro-sakamoto/opensourcecobol4j") + credentials { + username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") + } + } + } + publications { + register("gpr") { + from(components["java"]) } - } } } diff --git a/libcobj/settings.gradle.kts b/libcobj/settings.gradle.kts index 99659dc9..33b2d4d6 100644 --- a/libcobj/settings.gradle.kts +++ b/libcobj/settings.gradle.kts @@ -2,5 +2,5 @@ plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.4.0" } -rootProject.name = "opensource COBOL 4J libcobj" +rootProject.name = "opensourcecobol4j" include("app") From 0c2732535994d0f7d966cf804085acde4b0758cc Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Sat, 21 Oct 2023 14:12:34 +0900 Subject: [PATCH 08/11] [Experiment]: Introduce PMD gradle plugin and add invalid code --- .github/workflows/cicd.yml | 8 +- libcobj/app/build.gradle.kts | 7 + .../libcobj/common/CobolIntrinsic.java | 404 ++++++++---------- {.github => libcobj/config}/ruleset.xml | 0 4 files changed, 188 insertions(+), 231 deletions(-) rename {.github => libcobj/config}/ruleset.xml (100%) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index c6e8f0af..c7f74441 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -96,9 +96,7 @@ jobs: run: | sudo apt-get update -y sudo apt-get install -y clang-format cppcheck - curl -L -o pmd-bin-6.52.0.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.52.0/pmd-bin-6.52.0.zip curl -L -o spotbugs-4.7.3.zip https://github.com/spotbugs/spotbugs/releases/download/4.7.3/spotbugs-4.7.3.zip - unzip pmd-bin-6.52.0.zip unzip spotbugs-4.7.3.zip - name: Install opensource COBOL 4J @@ -118,7 +116,11 @@ jobs: - name: Run PMD run: | - pmd-bin-6.52.0/bin/run.sh pmd -d ${PWD}/libcobj/src -R ${PWD}/.github/ruleset.xml -f text + cd libcobj/ + if ! ./gradlew pmdMain; then + cat app/build/reports/pmd/main.xml + exit 1 + fi - name: Run cppcheck run: | diff --git a/libcobj/app/build.gradle.kts b/libcobj/app/build.gradle.kts index 5ef0082c..466d0a97 100644 --- a/libcobj/app/build.gradle.kts +++ b/libcobj/app/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("java") id("com.github.sherter.google-java-format") version "0.9" id("maven-publish") + pmd } repositories { @@ -24,6 +25,12 @@ java { } } +pmd { + isConsoleOutput = true + ruleSets = listOf() + ruleSetFiles = files("${rootDir}/config/ruleset.xml") +} + publishing { repositories { maven { diff --git a/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java b/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java index bc3b14ed..6880d3ae 100644 --- a/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java +++ b/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java @@ -36,10 +36,10 @@ public class CobolIntrinsic { - private static int[] normalDays = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}; - private static int[] leapDays = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}; - private static int[] normalMonthDays = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - private static int[] leapMonthDays = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + private static int[] normalDays = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; + private static int[] leapDays = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }; + private static int[] normalMonthDays = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + private static int[] leapMonthDays = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; private static final int DEPTH_LEVEL = 8; private static final int sizeOfDouble = 8; private static int currEntry = 0; @@ -53,13 +53,12 @@ public class CobolIntrinsic { private static void makeDoubleEntry() { CobolDataStorage s = new CobolDataStorage(sizeOfDouble + 1); - CobolFieldAttribute newAttr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_DOUBLE, - 18, - 9, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute newAttr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_DOUBLE, + 18, + 9, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField newField = CobolFieldFactory.makeCobolField(sizeOfDouble, s, newAttr); calcField[currEntry] = newField; @@ -72,9 +71,8 @@ private static void makeDoubleEntry() { /** libcob/intrinsicのmake_field_entryの実装 */ private static void makeFieldEntry(AbstractCobolField f) { - AbstractCobolField newField = - CobolFieldFactory.makeCobolField( - f.getSize(), new CobolDataStorage(f.getSize() + 1), f.getAttribute()); + AbstractCobolField newField = CobolFieldFactory.makeCobolField( + f.getSize(), new CobolDataStorage(f.getSize() + 1), f.getAttribute()); calcField[currEntry] = newField; currField = calcField[currEntry]; @@ -96,8 +94,7 @@ private static boolean isLeapYear(int year) { /** libcob/intrinsicのcob_init_intrinsicの実装 */ public static void init() { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); for (int i = 0; i < DEPTH_LEVEL; ++i) { calcField[i] = CobolFieldFactory.makeCobolField(256, new CobolDataStorage(256), attr); } @@ -187,11 +184,9 @@ public static AbstractCobolField intrBinop(AbstractCobolField f1, int op, Abstra if (d1.getScale() > size) { size = d1.getScale(); } - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, size, d1.getScale(), attrsign, null); - AbstractCobolField field = - CobolFieldFactory.makeCobolField(size, (CobolDataStorage) null, attr); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, size, d1.getScale(), attrsign, null); + AbstractCobolField field = CobolFieldFactory.makeCobolField(size, (CobolDataStorage) null, attr); makeFieldEntry(field); d1.getDisplayField(currField, 0); return currField; @@ -204,8 +199,7 @@ public static AbstractCobolField intrBinop(AbstractCobolField f1, int op, Abstra * @return */ public static AbstractCobolField funcLength(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); currField.setInt(srcfield.getSize()); @@ -219,13 +213,12 @@ public static AbstractCobolField funcLength(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcInteger(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -271,13 +264,12 @@ public static AbstractCobolField funcInteger(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcIntegerPart(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -373,22 +365,20 @@ public static AbstractCobolField funcWhenCompiled(int offset, int length, Abstra * @return */ public static AbstractCobolField funcCurrentDate(int offset, int length) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(21, (CobolDataStorage) null, attr); makeFieldEntry(field); // TODO Time Zoneを表示する機能を取り入れる - String dateString = - String.format( - "%4d%02d%02d%02d%02d%02d%02d00000", - CobolUtil.cal.get(Calendar.YEAR), - CobolUtil.cal.get(Calendar.MONTH) + 1, - CobolUtil.cal.get(Calendar.DAY_OF_MONTH), - CobolUtil.cal.get(Calendar.HOUR_OF_DAY), - CobolUtil.cal.get(Calendar.MINUTE), - CobolUtil.cal.get(Calendar.SECOND), - CobolUtil.cal.get(Calendar.MILLISECOND) / 10); + String dateString = String.format( + "%4d%02d%02d%02d%02d%02d%02d00000", + CobolUtil.cal.get(Calendar.YEAR), + CobolUtil.cal.get(Calendar.MONTH) + 1, + CobolUtil.cal.get(Calendar.DAY_OF_MONTH), + CobolUtil.cal.get(Calendar.HOUR_OF_DAY), + CobolUtil.cal.get(Calendar.MINUTE), + CobolUtil.cal.get(Calendar.SECOND), + CobolUtil.cal.get(Calendar.MILLISECOND) / 10); currField.getDataStorage().memcpy(dateString.getBytes()); if (offset > 0) { @@ -404,8 +394,7 @@ public static AbstractCobolField funcCurrentDate(int offset, int length) { * @return */ public static AbstractCobolField funcChar(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(1, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -425,8 +414,7 @@ public static AbstractCobolField funcChar(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcOrd(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -441,8 +429,7 @@ public static AbstractCobolField funcOrd(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcDateOfInteger(AbstractCobolField srcdays) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -492,8 +479,7 @@ public static AbstractCobolField funcDateOfInteger(AbstractCobolField srcdays) { * @return */ public static AbstractCobolField funcDayOfInteger(AbstractCobolField srcdays) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 7, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 7, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(7, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -529,8 +515,7 @@ public static AbstractCobolField funcDayOfInteger(AbstractCobolField srcdays) { * @return */ public static AbstractCobolField funcIntegerOfDate(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -598,8 +583,7 @@ public static AbstractCobolField funcIntegerOfDate(AbstractCobolField srcfield) * @return */ public static AbstractCobolField funcIntegerOfDay(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -639,8 +623,7 @@ public static AbstractCobolField funcIntegerOfDay(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcFactorial(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 18, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 18, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -665,13 +648,12 @@ public static AbstractCobolField funcFactorial(AbstractCobolField srcfield) { private static CobolDecimal mathFunctionBefore1(AbstractCobolField srcfield) { CobolDecimal d1 = new CobolDecimal(); - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 17, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 17, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); d1.setField(srcfield); makeFieldEntry(field); @@ -813,13 +795,12 @@ public static AbstractCobolField funcTan(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcNumval(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); CobolDataStorage s = srcfield.getDataStorage(); @@ -833,7 +814,7 @@ public static AbstractCobolField funcNumval(AbstractCobolField srcfield) { for (int i = 0; i < srcfield.getSize(); ++i) { if (i < srcfield.getSize() - 1) { if ((Character.toUpperCase(s.getByte(i)) == 'C' - && Character.toUpperCase(s.getByte(i + 1)) == 'R') + && Character.toUpperCase(s.getByte(i + 1)) == 'R') || (Character.toUpperCase(s.getByte(i)) == 'D' && Character.toUpperCase(s.getByte(i + 1)) == 'B')) { sign = true; @@ -881,8 +862,7 @@ public static AbstractCobolField funcNumval(AbstractCobolField srcfield) { makeFieldEntry(field); currField.getDataStorage().set(llval); } else { - String dataString = - String.format("%s%s.%s", sign ? "-" : "", integerBuff.toString(), decimalBuff.toString()); + String dataString = String.format("%s%s.%s", sign ? "-" : "", integerBuff.toString(), decimalBuff.toString()); double val = Double.parseDouble(dataString); makeDoubleEntry(); currField.getDataStorage().set(val); @@ -898,13 +878,12 @@ public static AbstractCobolField funcNumval(AbstractCobolField srcfield) { */ public static AbstractCobolField funcNumvalC( AbstractCobolField srcfield, AbstractCobolField currency) { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); boolean sign = false; @@ -934,8 +913,7 @@ public static AbstractCobolField funcNumvalC( if (currencyData != null) { if (i < srcfield.getSize() - currency.getSize()) { if (currencyData.memcmp( - srcfield.getDataStorage().getSubDataStorage(i), currency.getSize()) - == 0) { + srcfield.getDataStorage().getSubDataStorage(i), currency.getSize()) == 0) { i += (currency.getSize() - 1); continue; } @@ -984,8 +962,7 @@ public static AbstractCobolField funcNumvalC( makeFieldEntry(field); currField.getDataStorage().set(llval); } else { - String dataString = - String.format("%s%s.%s", sign ? "-" : "", integerBuff.toString(), decimalBuff.toString()); + String dataString = String.format("%s%s.%s", sign ? "-" : "", integerBuff.toString(), decimalBuff.toString()); double val = Double.parseDouble(dataString); makeDoubleEntry(); currField.getDataStorage().set(val); @@ -1065,13 +1042,12 @@ public static AbstractCobolField funcSum(int params, AbstractCobolField... field int size = sizeInBase10(d1.getValue()); AbstractCobolField field; if (size < 19) { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - scale, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + scale, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); } else { if (d1.getScale() > size) { @@ -1080,13 +1056,12 @@ public static AbstractCobolField funcSum(int params, AbstractCobolField... field if (scale > size) { size = scale; } - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, - size, - scale, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, + size, + scale, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); field = CobolFieldFactory.makeCobolField(size, (CobolDataStorage) null, attr); } makeFieldEntry(field); @@ -1106,8 +1081,7 @@ public static AbstractCobolField funcSum(int params, AbstractCobolField... field * @return */ public static AbstractCobolField funcOrdMin(int params, AbstractCobolField... fields) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -1138,8 +1112,7 @@ public static AbstractCobolField funcOrdMin(int params, AbstractCobolField... fi * @return */ public static AbstractCobolField funcOrdMax(int params, AbstractCobolField... fields) { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -1284,13 +1257,12 @@ public static AbstractCobolField funcMedian(int params, AbstractCobolField... fi * @return */ public static AbstractCobolField funcMean(int pramas, AbstractCobolField... fields) { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); CobolDecimal d1 = new CobolDecimal(BigDecimal.ZERO); CobolDecimal d2 = new CobolDecimal(); @@ -1343,13 +1315,12 @@ public static AbstractCobolField funcMean(int pramas, AbstractCobolField... fiel */ public static AbstractCobolField funcMod( AbstractCobolField srcfield1, AbstractCobolField srcfield2) throws CobolStopRunException { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); CobolDecimal d1 = new CobolDecimal(); CobolDecimal d2 = new CobolDecimal(); @@ -1379,13 +1350,12 @@ public static AbstractCobolField funcMod( */ public static AbstractCobolField funcRange(int params, AbstractCobolField... fields) throws CobolStopRunException { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); CobolDecimal d1 = new CobolDecimal(); CobolDecimal d2 = new CobolDecimal(); @@ -1424,13 +1394,12 @@ public static AbstractCobolField funcRange(int params, AbstractCobolField... fie */ public static AbstractCobolField funcRem( AbstractCobolField srcfield1, AbstractCobolField srcfield2) throws CobolStopRunException { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); AbstractCobolField f1 = funcIntegerPart(intrBinop(srcfield1, '/', srcfield2)); CobolDecimal d1 = new CobolDecimal(); @@ -1459,13 +1428,12 @@ public static AbstractCobolField funcRem( * @return */ public static AbstractCobolField funcRandom(int prams, AbstractCobolField... fields) { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); if (fields.length > 0) { @@ -1506,13 +1474,12 @@ public static AbstractCobolField funcRandom(int prams, AbstractCobolField... fie */ public static AbstractCobolField funcVariance(int prams, AbstractCobolField... fields) throws CobolStopRunException { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); if (fields.length == 1) { @@ -1580,13 +1547,12 @@ public static AbstractCobolField funcVariance(int prams, AbstractCobolField... f */ public static AbstractCobolField funcStandardDeviation(int prams, AbstractCobolField... fields) throws CobolStopRunException { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeDoubleEntry(); @@ -1682,13 +1648,10 @@ public static AbstractCobolField funcPresentValue(int prams, AbstractCobolField. */ public static AbstractCobolField funcNational(AbstractCobolField srcfield) { int size = srcfield.getSize(); - byte[] pdata = - CobolNationalField.han2zen(srcfield.getDataStorage().getByteBuffer(size).array(), size); + byte[] pdata = CobolNationalField.han2zen(srcfield.getDataStorage().getByteBuffer(size).array(), size); int ndata = CobolNationalField.workReturnSize; - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NATIONAL, 0, 0, 0, null); - AbstractCobolField field = - CobolFieldFactory.makeCobolField(ndata, (CobolDataStorage) null, attr); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NATIONAL, 0, 0, 0, null); + AbstractCobolField field = CobolFieldFactory.makeCobolField(ndata, (CobolDataStorage) null, attr); makeFieldEntry(field); currField.getDataStorage().memcpy(pdata, ndata); return currField; @@ -1708,8 +1671,7 @@ public static AbstractCobolField funcCombinedDatetime( String str; byte[] buff = new byte[12]; - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 12, 5, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 12, 5, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(12, (CobolDataStorage) null, attr); makeFieldEntry(field); CobolRuntimeException.setException(0); @@ -1756,10 +1718,8 @@ public static AbstractCobolField funcConcatenate( for (i = 0; i < params; i++) { calcsize += fields[i].getSize(); } - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); - AbstractCobolField field = - CobolFieldFactory.makeCobolField(calcsize, (CobolDataStorage) null, attr); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + AbstractCobolField field = CobolFieldFactory.makeCobolField(calcsize, (CobolDataStorage) null, attr); makeFieldEntry(field); data = new byte[calcsize]; for (i = 0; i < params; i++) { @@ -1790,8 +1750,7 @@ public static AbstractCobolField funcDateToYyyymmdd(int params, AbstractCobolFie int maxyear; LocalDateTime timeptr; - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); year = fields[0].getInt(); @@ -1850,8 +1809,7 @@ public static AbstractCobolField funcDayToYyyyddd(int params, AbstractCobolField int maxyear; LocalDateTime timeptr; - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); year = fields[0].getInt(); @@ -1905,8 +1863,7 @@ public static AbstractCobolField funcExceptionFile() { int flen; byte[] data; - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(0, (CobolDataStorage) null, attr); if (CobolRuntimeException.getException() == 0 || (CobolRuntimeException.getExceptionCode() & 0x0500) != 0x0500) { @@ -1933,8 +1890,7 @@ public static AbstractCobolField funcExceptionFile() { public static AbstractCobolField funcExceptionLocation() { String buff; - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(0, (CobolDataStorage) null, attr); currField = field; if (CobolRuntimeException.getException() != 1 @@ -1946,32 +1902,28 @@ public static AbstractCobolField funcExceptionLocation() { } if (CobolRuntimeException.getOrigSection() != null && CobolRuntimeException.getOrigParagragh() != null) { - buff = - String.format( - "%s; %s OF %s; %d", - CobolRuntimeException.getOrigProgramId(), - CobolRuntimeException.getOrigParagragh(), - CobolRuntimeException.getOrigSection(), - CobolRuntimeException.getOrigLine()); + buff = String.format( + "%s; %s OF %s; %d", + CobolRuntimeException.getOrigProgramId(), + CobolRuntimeException.getOrigParagragh(), + CobolRuntimeException.getOrigSection(), + CobolRuntimeException.getOrigLine()); } else if (CobolRuntimeException.getOrigSection() != null) { - buff = - String.format( - "%s; %s; %d", - CobolRuntimeException.getOrigProgramId(), - CobolRuntimeException.getOrigSection(), - CobolRuntimeException.getOrigLine()); + buff = String.format( + "%s; %s; %d", + CobolRuntimeException.getOrigProgramId(), + CobolRuntimeException.getOrigSection(), + CobolRuntimeException.getOrigLine()); } else if (CobolRuntimeException.getOrigParagragh() != null) { - buff = - String.format( - "%s; %s; %d", - CobolRuntimeException.getOrigProgramId(), - CobolRuntimeException.getOrigParagragh(), - CobolRuntimeException.getOrigLine()); + buff = String.format( + "%s; %s; %d", + CobolRuntimeException.getOrigProgramId(), + CobolRuntimeException.getOrigParagragh(), + CobolRuntimeException.getOrigLine()); } else { - buff = - String.format( - "%s; ; %d", - CobolRuntimeException.getOrigProgramId(), CobolRuntimeException.getOrigLine()); + buff = String.format( + "%s; ; %d", + CobolRuntimeException.getOrigProgramId(), CobolRuntimeException.getOrigLine()); } localeBuff = buff.getBytes(); field.setSize(localeBuff.length); @@ -1985,8 +1937,7 @@ public static AbstractCobolField funcExceptionLocation() { * @return */ public static AbstractCobolField funcExceptionStatement() { - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(31, (CobolDataStorage) null, attr); makeFieldEntry(field); byte[] data; @@ -2010,17 +1961,15 @@ public static AbstractCobolField funcExceptionStatement() { public static AbstractCobolField funcExceptionStatus() { byte[] exceptName; - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(31, (CobolDataStorage) null, attr); makeFieldEntry(field); byte[] data = String.format("%-31s", "").getBytes(); currField.setDataStorage(new CobolDataStorage(data)); if (CobolRuntimeException.getExceptionCode() != 0) { try { - exceptName = - CobolRuntimeException.getExceptionName(CobolRuntimeException.getExceptionCode()) - .getBytes(); + exceptName = CobolRuntimeException.getExceptionName(CobolRuntimeException.getExceptionCode()) + .getBytes(); } catch (NullPointerException e) { exceptName = CONST_STRING_EXCEPTION_OBJECT; } @@ -2036,13 +1985,12 @@ public static AbstractCobolField funcExceptionStatus() { * @return */ public static AbstractCobolField funcFractionPart(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 18, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 18, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -2069,8 +2017,7 @@ public static AbstractCobolField funcSecondsFromFormattedTime( String p1; int p2; - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -2116,6 +2063,10 @@ public static AbstractCobolField funcSecondsFromFormattedTime( return currField; } + private static void func() { + + } + /** * cob_intr_seconds_past_midnightの実装 * @@ -2123,8 +2074,7 @@ public static AbstractCobolField funcSecondsFromFormattedTime( */ public static AbstractCobolField funcSecondsPastMidnight() { int seconds; - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); LocalDateTime currDate = LocalDateTime.now(); @@ -2140,13 +2090,12 @@ public static AbstractCobolField funcSecondsPastMidnight() { * @return */ public static AbstractCobolField funcSign(AbstractCobolField srcfield) { - CobolFieldAttribute attr = - new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 8, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 8, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -2169,8 +2118,7 @@ public static AbstractCobolField funcSign(AbstractCobolField srcfield) { public static AbstractCobolField funcStoredCharLength(AbstractCobolField srcfield) { int count; - CobolFieldAttribute attr = - new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); diff --git a/.github/ruleset.xml b/libcobj/config/ruleset.xml similarity index 100% rename from .github/ruleset.xml rename to libcobj/config/ruleset.xml From 9532309a412fd7ac86501845d052054be782c76a Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Sat, 21 Oct 2023 14:21:36 +0900 Subject: [PATCH 09/11] [Experiment]: fix slightly --- .github/workflows/cicd.yml | 7 ++----- libcobj/app/build.gradle.kts | 2 +- libcobj/config/{ruleset.xml => pmdRuleSet.xml} | 0 3 files changed, 3 insertions(+), 6 deletions(-) rename libcobj/config/{ruleset.xml => pmdRuleSet.xml} (100%) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index c7f74441..02652382 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -116,11 +116,8 @@ jobs: - name: Run PMD run: | - cd libcobj/ - if ! ./gradlew pmdMain; then - cat app/build/reports/pmd/main.xml - exit 1 - fi + cd libcobj + ./gradlew pmdMain - name: Run cppcheck run: | diff --git a/libcobj/app/build.gradle.kts b/libcobj/app/build.gradle.kts index 466d0a97..997ef91e 100644 --- a/libcobj/app/build.gradle.kts +++ b/libcobj/app/build.gradle.kts @@ -28,7 +28,7 @@ java { pmd { isConsoleOutput = true ruleSets = listOf() - ruleSetFiles = files("${rootDir}/config/ruleset.xml") + ruleSetFiles = files("${rootDir}/config/pmdRuleSet.xml") } publishing { diff --git a/libcobj/config/ruleset.xml b/libcobj/config/pmdRuleSet.xml similarity index 100% rename from libcobj/config/ruleset.xml rename to libcobj/config/pmdRuleSet.xml From 8609d27fcfb94e6ebd246cc0c93e4ee58a2f87f8 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Sat, 21 Oct 2023 14:32:23 +0900 Subject: [PATCH 10/11] [Fix]: remove invalid code --- .../libcobj/common/CobolIntrinsic.java | 404 ++++++++++-------- 1 file changed, 228 insertions(+), 176 deletions(-) diff --git a/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java b/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java index 6880d3ae..bc3b14ed 100644 --- a/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java +++ b/libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/common/CobolIntrinsic.java @@ -36,10 +36,10 @@ public class CobolIntrinsic { - private static int[] normalDays = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; - private static int[] leapDays = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }; - private static int[] normalMonthDays = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - private static int[] leapMonthDays = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + private static int[] normalDays = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}; + private static int[] leapDays = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}; + private static int[] normalMonthDays = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + private static int[] leapMonthDays = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; private static final int DEPTH_LEVEL = 8; private static final int sizeOfDouble = 8; private static int currEntry = 0; @@ -53,12 +53,13 @@ public class CobolIntrinsic { private static void makeDoubleEntry() { CobolDataStorage s = new CobolDataStorage(sizeOfDouble + 1); - CobolFieldAttribute newAttr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_DOUBLE, - 18, - 9, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute newAttr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_DOUBLE, + 18, + 9, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField newField = CobolFieldFactory.makeCobolField(sizeOfDouble, s, newAttr); calcField[currEntry] = newField; @@ -71,8 +72,9 @@ private static void makeDoubleEntry() { /** libcob/intrinsicのmake_field_entryの実装 */ private static void makeFieldEntry(AbstractCobolField f) { - AbstractCobolField newField = CobolFieldFactory.makeCobolField( - f.getSize(), new CobolDataStorage(f.getSize() + 1), f.getAttribute()); + AbstractCobolField newField = + CobolFieldFactory.makeCobolField( + f.getSize(), new CobolDataStorage(f.getSize() + 1), f.getAttribute()); calcField[currEntry] = newField; currField = calcField[currEntry]; @@ -94,7 +96,8 @@ private static boolean isLeapYear(int year) { /** libcob/intrinsicのcob_init_intrinsicの実装 */ public static void init() { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); for (int i = 0; i < DEPTH_LEVEL; ++i) { calcField[i] = CobolFieldFactory.makeCobolField(256, new CobolDataStorage(256), attr); } @@ -184,9 +187,11 @@ public static AbstractCobolField intrBinop(AbstractCobolField f1, int op, Abstra if (d1.getScale() > size) { size = d1.getScale(); } - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, size, d1.getScale(), attrsign, null); - AbstractCobolField field = CobolFieldFactory.makeCobolField(size, (CobolDataStorage) null, attr); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, size, d1.getScale(), attrsign, null); + AbstractCobolField field = + CobolFieldFactory.makeCobolField(size, (CobolDataStorage) null, attr); makeFieldEntry(field); d1.getDisplayField(currField, 0); return currField; @@ -199,7 +204,8 @@ public static AbstractCobolField intrBinop(AbstractCobolField f1, int op, Abstra * @return */ public static AbstractCobolField funcLength(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); currField.setInt(srcfield.getSize()); @@ -213,12 +219,13 @@ public static AbstractCobolField funcLength(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcInteger(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -264,12 +271,13 @@ public static AbstractCobolField funcInteger(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcIntegerPart(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -365,20 +373,22 @@ public static AbstractCobolField funcWhenCompiled(int offset, int length, Abstra * @return */ public static AbstractCobolField funcCurrentDate(int offset, int length) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(21, (CobolDataStorage) null, attr); makeFieldEntry(field); // TODO Time Zoneを表示する機能を取り入れる - String dateString = String.format( - "%4d%02d%02d%02d%02d%02d%02d00000", - CobolUtil.cal.get(Calendar.YEAR), - CobolUtil.cal.get(Calendar.MONTH) + 1, - CobolUtil.cal.get(Calendar.DAY_OF_MONTH), - CobolUtil.cal.get(Calendar.HOUR_OF_DAY), - CobolUtil.cal.get(Calendar.MINUTE), - CobolUtil.cal.get(Calendar.SECOND), - CobolUtil.cal.get(Calendar.MILLISECOND) / 10); + String dateString = + String.format( + "%4d%02d%02d%02d%02d%02d%02d00000", + CobolUtil.cal.get(Calendar.YEAR), + CobolUtil.cal.get(Calendar.MONTH) + 1, + CobolUtil.cal.get(Calendar.DAY_OF_MONTH), + CobolUtil.cal.get(Calendar.HOUR_OF_DAY), + CobolUtil.cal.get(Calendar.MINUTE), + CobolUtil.cal.get(Calendar.SECOND), + CobolUtil.cal.get(Calendar.MILLISECOND) / 10); currField.getDataStorage().memcpy(dateString.getBytes()); if (offset > 0) { @@ -394,7 +404,8 @@ public static AbstractCobolField funcCurrentDate(int offset, int length) { * @return */ public static AbstractCobolField funcChar(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(1, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -414,7 +425,8 @@ public static AbstractCobolField funcChar(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcOrd(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -429,7 +441,8 @@ public static AbstractCobolField funcOrd(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcDateOfInteger(AbstractCobolField srcdays) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -479,7 +492,8 @@ public static AbstractCobolField funcDateOfInteger(AbstractCobolField srcdays) { * @return */ public static AbstractCobolField funcDayOfInteger(AbstractCobolField srcdays) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 7, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 7, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(7, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -515,7 +529,8 @@ public static AbstractCobolField funcDayOfInteger(AbstractCobolField srcdays) { * @return */ public static AbstractCobolField funcIntegerOfDate(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -583,7 +598,8 @@ public static AbstractCobolField funcIntegerOfDate(AbstractCobolField srcfield) * @return */ public static AbstractCobolField funcIntegerOfDay(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -623,7 +639,8 @@ public static AbstractCobolField funcIntegerOfDay(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcFactorial(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 18, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 18, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -648,12 +665,13 @@ public static AbstractCobolField funcFactorial(AbstractCobolField srcfield) { private static CobolDecimal mathFunctionBefore1(AbstractCobolField srcfield) { CobolDecimal d1 = new CobolDecimal(); - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 17, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 17, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); d1.setField(srcfield); makeFieldEntry(field); @@ -795,12 +813,13 @@ public static AbstractCobolField funcTan(AbstractCobolField srcfield) { * @return */ public static AbstractCobolField funcNumval(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); CobolDataStorage s = srcfield.getDataStorage(); @@ -814,7 +833,7 @@ public static AbstractCobolField funcNumval(AbstractCobolField srcfield) { for (int i = 0; i < srcfield.getSize(); ++i) { if (i < srcfield.getSize() - 1) { if ((Character.toUpperCase(s.getByte(i)) == 'C' - && Character.toUpperCase(s.getByte(i + 1)) == 'R') + && Character.toUpperCase(s.getByte(i + 1)) == 'R') || (Character.toUpperCase(s.getByte(i)) == 'D' && Character.toUpperCase(s.getByte(i + 1)) == 'B')) { sign = true; @@ -862,7 +881,8 @@ public static AbstractCobolField funcNumval(AbstractCobolField srcfield) { makeFieldEntry(field); currField.getDataStorage().set(llval); } else { - String dataString = String.format("%s%s.%s", sign ? "-" : "", integerBuff.toString(), decimalBuff.toString()); + String dataString = + String.format("%s%s.%s", sign ? "-" : "", integerBuff.toString(), decimalBuff.toString()); double val = Double.parseDouble(dataString); makeDoubleEntry(); currField.getDataStorage().set(val); @@ -878,12 +898,13 @@ public static AbstractCobolField funcNumval(AbstractCobolField srcfield) { */ public static AbstractCobolField funcNumvalC( AbstractCobolField srcfield, AbstractCobolField currency) { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); boolean sign = false; @@ -913,7 +934,8 @@ public static AbstractCobolField funcNumvalC( if (currencyData != null) { if (i < srcfield.getSize() - currency.getSize()) { if (currencyData.memcmp( - srcfield.getDataStorage().getSubDataStorage(i), currency.getSize()) == 0) { + srcfield.getDataStorage().getSubDataStorage(i), currency.getSize()) + == 0) { i += (currency.getSize() - 1); continue; } @@ -962,7 +984,8 @@ public static AbstractCobolField funcNumvalC( makeFieldEntry(field); currField.getDataStorage().set(llval); } else { - String dataString = String.format("%s%s.%s", sign ? "-" : "", integerBuff.toString(), decimalBuff.toString()); + String dataString = + String.format("%s%s.%s", sign ? "-" : "", integerBuff.toString(), decimalBuff.toString()); double val = Double.parseDouble(dataString); makeDoubleEntry(); currField.getDataStorage().set(val); @@ -1042,12 +1065,13 @@ public static AbstractCobolField funcSum(int params, AbstractCobolField... field int size = sizeInBase10(d1.getValue()); AbstractCobolField field; if (size < 19) { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - scale, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + scale, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); } else { if (d1.getScale() > size) { @@ -1056,12 +1080,13 @@ public static AbstractCobolField funcSum(int params, AbstractCobolField... field if (scale > size) { size = scale; } - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, - size, - scale, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, + size, + scale, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); field = CobolFieldFactory.makeCobolField(size, (CobolDataStorage) null, attr); } makeFieldEntry(field); @@ -1081,7 +1106,8 @@ public static AbstractCobolField funcSum(int params, AbstractCobolField... field * @return */ public static AbstractCobolField funcOrdMin(int params, AbstractCobolField... fields) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -1112,7 +1138,8 @@ public static AbstractCobolField funcOrdMin(int params, AbstractCobolField... fi * @return */ public static AbstractCobolField funcOrdMax(int params, AbstractCobolField... fields) { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -1257,12 +1284,13 @@ public static AbstractCobolField funcMedian(int params, AbstractCobolField... fi * @return */ public static AbstractCobolField funcMean(int pramas, AbstractCobolField... fields) { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); CobolDecimal d1 = new CobolDecimal(BigDecimal.ZERO); CobolDecimal d2 = new CobolDecimal(); @@ -1315,12 +1343,13 @@ public static AbstractCobolField funcMean(int pramas, AbstractCobolField... fiel */ public static AbstractCobolField funcMod( AbstractCobolField srcfield1, AbstractCobolField srcfield2) throws CobolStopRunException { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); CobolDecimal d1 = new CobolDecimal(); CobolDecimal d2 = new CobolDecimal(); @@ -1350,12 +1379,13 @@ public static AbstractCobolField funcMod( */ public static AbstractCobolField funcRange(int params, AbstractCobolField... fields) throws CobolStopRunException { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); CobolDecimal d1 = new CobolDecimal(); CobolDecimal d2 = new CobolDecimal(); @@ -1394,12 +1424,13 @@ public static AbstractCobolField funcRange(int params, AbstractCobolField... fie */ public static AbstractCobolField funcRem( AbstractCobolField srcfield1, AbstractCobolField srcfield2) throws CobolStopRunException { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); AbstractCobolField f1 = funcIntegerPart(intrBinop(srcfield1, '/', srcfield2)); CobolDecimal d1 = new CobolDecimal(); @@ -1428,12 +1459,13 @@ public static AbstractCobolField funcRem( * @return */ public static AbstractCobolField funcRandom(int prams, AbstractCobolField... fields) { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); if (fields.length > 0) { @@ -1474,12 +1506,13 @@ public static AbstractCobolField funcRandom(int prams, AbstractCobolField... fie */ public static AbstractCobolField funcVariance(int prams, AbstractCobolField... fields) throws CobolStopRunException { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); if (fields.length == 1) { @@ -1547,12 +1580,13 @@ public static AbstractCobolField funcVariance(int prams, AbstractCobolField... f */ public static AbstractCobolField funcStandardDeviation(int prams, AbstractCobolField... fields) throws CobolStopRunException { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeDoubleEntry(); @@ -1648,10 +1682,13 @@ public static AbstractCobolField funcPresentValue(int prams, AbstractCobolField. */ public static AbstractCobolField funcNational(AbstractCobolField srcfield) { int size = srcfield.getSize(); - byte[] pdata = CobolNationalField.han2zen(srcfield.getDataStorage().getByteBuffer(size).array(), size); + byte[] pdata = + CobolNationalField.han2zen(srcfield.getDataStorage().getByteBuffer(size).array(), size); int ndata = CobolNationalField.workReturnSize; - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NATIONAL, 0, 0, 0, null); - AbstractCobolField field = CobolFieldFactory.makeCobolField(ndata, (CobolDataStorage) null, attr); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NATIONAL, 0, 0, 0, null); + AbstractCobolField field = + CobolFieldFactory.makeCobolField(ndata, (CobolDataStorage) null, attr); makeFieldEntry(field); currField.getDataStorage().memcpy(pdata, ndata); return currField; @@ -1671,7 +1708,8 @@ public static AbstractCobolField funcCombinedDatetime( String str; byte[] buff = new byte[12]; - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 12, 5, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_DISPLAY, 12, 5, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(12, (CobolDataStorage) null, attr); makeFieldEntry(field); CobolRuntimeException.setException(0); @@ -1718,8 +1756,10 @@ public static AbstractCobolField funcConcatenate( for (i = 0; i < params; i++) { calcsize += fields[i].getSize(); } - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); - AbstractCobolField field = CobolFieldFactory.makeCobolField(calcsize, (CobolDataStorage) null, attr); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + AbstractCobolField field = + CobolFieldFactory.makeCobolField(calcsize, (CobolDataStorage) null, attr); makeFieldEntry(field); data = new byte[calcsize]; for (i = 0; i < params; i++) { @@ -1750,7 +1790,8 @@ public static AbstractCobolField funcDateToYyyymmdd(int params, AbstractCobolFie int maxyear; LocalDateTime timeptr; - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); year = fields[0].getInt(); @@ -1809,7 +1850,8 @@ public static AbstractCobolField funcDayToYyyyddd(int params, AbstractCobolField int maxyear; LocalDateTime timeptr; - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); year = fields[0].getInt(); @@ -1863,7 +1905,8 @@ public static AbstractCobolField funcExceptionFile() { int flen; byte[] data; - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(0, (CobolDataStorage) null, attr); if (CobolRuntimeException.getException() == 0 || (CobolRuntimeException.getExceptionCode() & 0x0500) != 0x0500) { @@ -1890,7 +1933,8 @@ public static AbstractCobolField funcExceptionFile() { public static AbstractCobolField funcExceptionLocation() { String buff; - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(0, (CobolDataStorage) null, attr); currField = field; if (CobolRuntimeException.getException() != 1 @@ -1902,28 +1946,32 @@ public static AbstractCobolField funcExceptionLocation() { } if (CobolRuntimeException.getOrigSection() != null && CobolRuntimeException.getOrigParagragh() != null) { - buff = String.format( - "%s; %s OF %s; %d", - CobolRuntimeException.getOrigProgramId(), - CobolRuntimeException.getOrigParagragh(), - CobolRuntimeException.getOrigSection(), - CobolRuntimeException.getOrigLine()); + buff = + String.format( + "%s; %s OF %s; %d", + CobolRuntimeException.getOrigProgramId(), + CobolRuntimeException.getOrigParagragh(), + CobolRuntimeException.getOrigSection(), + CobolRuntimeException.getOrigLine()); } else if (CobolRuntimeException.getOrigSection() != null) { - buff = String.format( - "%s; %s; %d", - CobolRuntimeException.getOrigProgramId(), - CobolRuntimeException.getOrigSection(), - CobolRuntimeException.getOrigLine()); + buff = + String.format( + "%s; %s; %d", + CobolRuntimeException.getOrigProgramId(), + CobolRuntimeException.getOrigSection(), + CobolRuntimeException.getOrigLine()); } else if (CobolRuntimeException.getOrigParagragh() != null) { - buff = String.format( - "%s; %s; %d", - CobolRuntimeException.getOrigProgramId(), - CobolRuntimeException.getOrigParagragh(), - CobolRuntimeException.getOrigLine()); + buff = + String.format( + "%s; %s; %d", + CobolRuntimeException.getOrigProgramId(), + CobolRuntimeException.getOrigParagragh(), + CobolRuntimeException.getOrigLine()); } else { - buff = String.format( - "%s; ; %d", - CobolRuntimeException.getOrigProgramId(), CobolRuntimeException.getOrigLine()); + buff = + String.format( + "%s; ; %d", + CobolRuntimeException.getOrigProgramId(), CobolRuntimeException.getOrigLine()); } localeBuff = buff.getBytes(); field.setSize(localeBuff.length); @@ -1937,7 +1985,8 @@ public static AbstractCobolField funcExceptionLocation() { * @return */ public static AbstractCobolField funcExceptionStatement() { - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(31, (CobolDataStorage) null, attr); makeFieldEntry(field); byte[] data; @@ -1961,15 +2010,17 @@ public static AbstractCobolField funcExceptionStatement() { public static AbstractCobolField funcExceptionStatus() { byte[] exceptName; - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_ALPHANUMERIC, 0, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(31, (CobolDataStorage) null, attr); makeFieldEntry(field); byte[] data = String.format("%-31s", "").getBytes(); currField.setDataStorage(new CobolDataStorage(data)); if (CobolRuntimeException.getExceptionCode() != 0) { try { - exceptName = CobolRuntimeException.getExceptionName(CobolRuntimeException.getExceptionCode()) - .getBytes(); + exceptName = + CobolRuntimeException.getExceptionName(CobolRuntimeException.getExceptionCode()) + .getBytes(); } catch (NullPointerException e) { exceptName = CONST_STRING_EXCEPTION_OBJECT; } @@ -1985,12 +2036,13 @@ public static AbstractCobolField funcExceptionStatus() { * @return */ public static AbstractCobolField funcFractionPart(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 18, - 18, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 18, + 18, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(8, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -2017,7 +2069,8 @@ public static AbstractCobolField funcSecondsFromFormattedTime( String p1; int p2; - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -2063,10 +2116,6 @@ public static AbstractCobolField funcSecondsFromFormattedTime( return currField; } - private static void func() { - - } - /** * cob_intr_seconds_past_midnightの実装 * @@ -2074,7 +2123,8 @@ private static void func() { */ public static AbstractCobolField funcSecondsPastMidnight() { int seconds; - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); LocalDateTime currDate = LocalDateTime.now(); @@ -2090,12 +2140,13 @@ public static AbstractCobolField funcSecondsPastMidnight() { * @return */ public static AbstractCobolField funcSign(AbstractCobolField srcfield) { - CobolFieldAttribute attr = new CobolFieldAttribute( - CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, - 8, - 0, - CobolFieldAttribute.COB_FLAG_HAVE_SIGN, - null); + CobolFieldAttribute attr = + new CobolFieldAttribute( + CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, + 8, + 0, + CobolFieldAttribute.COB_FLAG_HAVE_SIGN, + null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); @@ -2118,7 +2169,8 @@ public static AbstractCobolField funcSign(AbstractCobolField srcfield) { public static AbstractCobolField funcStoredCharLength(AbstractCobolField srcfield) { int count; - CobolFieldAttribute attr = new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); + CobolFieldAttribute attr = + new CobolFieldAttribute(CobolFieldAttribute.COB_TYPE_NUMERIC_BINARY, 8, 0, 0, null); AbstractCobolField field = CobolFieldFactory.makeCobolField(4, (CobolDataStorage) null, attr); makeFieldEntry(field); From 28fed0ff7dade23d7757136ed412dddcdd519cfa Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Sat, 21 Oct 2023 14:36:10 +0900 Subject: [PATCH 11/11] [Doc]: update CONTRIBUTING.md and CONTRIBUTING_JP.md --- CONTRIBUTING.md | 16 ++-------------- CONTRIBUTING_JP.md | 16 ++-------------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3af22447..bf552d4a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,20 +14,8 @@ The below sections describe how to setup and run static code analysis. ## Setup static analysis tools -### clang-format - Run `sudo apt install clang-format` in Ubuntu to install `clang-format`. -### PMD - -Run the following commands to install `PMD`: -```sh -curl -L -o pmd-bin-6.52.0.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.52.0/pmd-bin-6.52.0.zip -unzip pmd-bin-6.52.0.zip -mv pmd-bin-6.52 /usr/local/bin/ -rm pmd-bin-6.52.0.zip -``` - ## Run static analysis ### check with clang-format and google-java-format @@ -37,7 +25,7 @@ If you want to make sure all files are formatted, run `./check-format` in the to ### PMD -Run the following command in the top directory of opensource COBOL 4J: +Run the following command in libcobj/ directory: ``` -/usr/local/bin/pmd-bin-6.52.0/bin/run.sh -d libcobj/src -R .github/ruleset.xml -f text +./gradlew pmdMain ``` diff --git a/CONTRIBUTING_JP.md b/CONTRIBUTING_JP.md index 854eb5ec..a191d350 100644 --- a/CONTRIBUTING_JP.md +++ b/CONTRIBUTING_JP.md @@ -14,20 +14,8 @@ CIの静的解析はCとJavaのソースコードがそれぞれ[clang-format](h ## セットアップ -### clang-format - Ubuntuでは`sudo apt install clang-format`コマンドを実行すれば`clang-format`をインストールできます。 -### PMD - -下記のコマンドを実行して`PMD`をインストールしてください。 -```sh -curl -L -o pmd-bin-6.52.0.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.52.0/pmd-bin-6.52.0.zip -unzip pmd-bin-6.52.0.zip -mv pmd-bin-6.52 /usr/local/bin/ -rm pmd-bin-6.52.0.zip -``` - ## 静的解析の実行 ### clang-formatとgoogle-java-format @@ -37,7 +25,7 @@ opensource COBOL 4Jのトップディレクトリで`./format`を実行してく ### PMD -opensource COBOL 4Jのトップディレクトリで下記のコマンドを実行してください。 +opensource COBOL 4Jのlibcobj/ディレクトリで下記のコマンドを実行してください。 ``` -/usr/local/bin/pmd-bin-6.52.0/bin/run.sh -d libcobj/src -R .github/ruleset.xml -f text +./gradlew pmdMain ```