Skip to content

Commit f7c7168

Browse files
Downgrade the JDK version partially (#249)
1 parent c4efab4 commit f7c7168

File tree

7 files changed

+51
-117
lines changed

7 files changed

+51
-117
lines changed

.github/workflows/cicd.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@ jobs:
1717
container:
1818
image: ${{ matrix.os }}
1919
steps:
20-
20+
21+
- uses: actions/setup-java@v3
22+
with:
23+
distribution: 'temurin'
24+
java-version: '11'
25+
2126
- name: Install dependencies on Ubuntu 22.04
2227
if: matrix.os == 'ubuntu:22.04'
2328
run: |
2429
apt update -y
25-
apt install -y default-jdk build-essential bison flex gettext texinfo automake autoconf
30+
apt install -y build-essential bison flex gettext texinfo automake autoconf
2631
2732
- name: Install dependencies on AlmaLinux 9
2833
if: matrix.os == 'almalinux:9'
2934
run: |
3035
dnf -y update
31-
dnf install -y java-17-openjdk-devel gcc make bison flex automake autoconf diffutils gettext
36+
dnf install -y gcc make bison flex automake autoconf diffutils gettext
3237
3338
- name: Checkout opensource COBOL 4J
3439
uses: actions/checkout@v3
@@ -90,7 +95,7 @@ jobs:
9095
- uses: actions/setup-java@v3
9196
with:
9297
distribution: 'temurin'
93-
java-version: '17'
98+
java-version: '11'
9499

95100
- name: Install static analysis tools
96101
run: |

.github/workflows/coverage.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

.github/workflows/test-nist.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,22 @@ jobs:
2929
with:
3030
name: opensourcecobol4j-${{ env.ARTIFACT_NAME }}
3131

32+
- uses: actions/setup-java@v3
33+
with:
34+
distribution: 'temurin'
35+
java-version: '11'
36+
3237
- name: Install dependencies on Ubuntu 22.04
3338
if: matrix.os == 'ubuntu:22.04'
3439
run: |
3540
apt update -y
36-
apt install -y default-jdk build-essential
41+
apt install -y build-essential
3742
3843
- name: Install dependencies on AlmaLinux 9
3944
if: matrix.os == 'almalinux:9'
4045
run: |
4146
dnf -y update
42-
dnf install -y java-17-openjdk-devel gcc make perl
47+
dnf install -y gcc make perl
4348
4449
- name: Install opensource COBOL 4J
4550
run: |

.github/workflows/test-other.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,22 @@ jobs:
2626
with:
2727
name: opensourcecobol4j-${{ env.ARTIFACT_NAME }}
2828

29+
- uses: actions/setup-java@v3
30+
with:
31+
distribution: 'temurin'
32+
java-version: '11'
33+
2934
- name: Install dependencies on Ubuntu 22.04
3035
if: matrix.os == 'ubuntu:22.04'
3136
run: |
3237
apt update -y
33-
apt install -y default-jdk build-essential
38+
apt install -y build-essential
3439
3540
- name: Install dependencies on AlmaLinux 9
3641
if: matrix.os == 'almalinux:9'
3742
run: |
3843
dnf -y update
39-
dnf install -y java-17-openjdk-devel gcc make diffutils
44+
dnf install -y gcc make diffutils
4045
4146
- name: Install opensource COBOL 4J
4247
run: |

libcobj/app/build.gradle.kts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ repositories {
1414
mavenCentral()
1515
}
1616

17+
tasks {
18+
javadoc {
19+
options.encoding = "UTF-8"
20+
}
21+
compileJava {
22+
options.encoding = "UTF-8"
23+
}
24+
compileTestJava {
25+
options.encoding = "UTF-8"
26+
}
27+
}
28+
1729
dependencies {
1830
implementation("com.google.guava:guava:31.1-jre")
1931
implementation("org.xerial:sqlite-jdbc:3.30.1")
@@ -22,7 +34,7 @@ dependencies {
2234

2335
java {
2436
toolchain {
25-
languageVersion.set(JavaLanguageVersion.of(11))
37+
languageVersion.set(JavaLanguageVersion.of(8))
2638
}
2739
}
2840

libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/CobolIndexedFile.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public int indexed_start_internal(
256256
boolean isDuplicate = this.keys[p.key_index].getFlag() != 0;
257257

258258
this.cursor = IndexedCursor.createCursor(p.connection, p.key, p.key_index, isDuplicate, cond);
259-
if (this.cursor.isEmpty()) {
259+
if (!this.cursor.isPresent()) {
260260
return COB_STATUS_30_PERMANENT_ERROR;
261261
}
262262

@@ -316,33 +316,33 @@ public int readNext(int readOpts) {
316316
if (this.indexedFirstRead || this.flag_begin_of_file) {
317317
this.cursor =
318318
IndexedCursor.createCursor(p.connection, p.key, p.key_index, isDuplicate, COB_GE);
319-
if (this.cursor.isEmpty()) {
319+
if (!this.cursor.isPresent()) {
320320
return COB_STATUS_10_END_OF_FILE;
321321
}
322322
this.cursor.get().moveToFirst();
323323
} else if (this.flag_end_of_file) {
324324
this.cursor =
325325
IndexedCursor.createCursor(p.connection, p.key, p.key_index, isDuplicate, COB_LE);
326-
if (this.cursor.isEmpty()) {
326+
if (!this.cursor.isPresent()) {
327327
return COB_STATUS_30_PERMANENT_ERROR;
328328
}
329329
this.cursor.get().moveToLast();
330330
} else if (this.updateWhileReading) {
331331
this.updateWhileReading = false;
332-
if (this.cursor.isEmpty()) {
332+
if (!this.cursor.isPresent()) {
333333
return COB_STATUS_30_PERMANENT_ERROR;
334334
}
335335
IndexedCursor oldCursor = this.cursor.get();
336336
Optional<IndexedCursor> newCursor = oldCursor.reloadCursor();
337-
if (newCursor.isEmpty()) {
337+
if (!newCursor.isPresent()) {
338338
this.cursor = Optional.of(oldCursor);
339339
} else {
340340
oldCursor.close();
341341
this.cursor = newCursor;
342342
}
343343
}
344344

345-
if (this.cursor.isEmpty()) {
345+
if (!this.cursor.isPresent()) {
346346
return COB_STATUS_30_PERMANENT_ERROR;
347347
}
348348

@@ -361,7 +361,7 @@ public int readNext(int readOpts) {
361361

362362
this.indexedFirstRead = false;
363363

364-
if (optionalResult.isEmpty()) {
364+
if (!optionalResult.isPresent()) {
365365
return COB_STATUS_10_END_OF_FILE;
366366
} else {
367367
FetchResult result = optionalResult.get();

libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/IndexedCursor.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static Optional<IndexedCursor> createCursor(
128128
IndexedCursor cursor = new IndexedCursor(conn, key, tableIndex, isDuplicate, comparator);
129129
cursor.forwardCursor = getCursor(conn, key, tableIndex, isDuplicate, comparator, true);
130130
cursor.backwardCursor = getCursor(conn, key, tableIndex, isDuplicate, comparator, false);
131-
if (cursor.forwardCursor.isEmpty() || cursor.backwardCursor.isEmpty()) {
131+
if (!cursor.forwardCursor.isPresent() || !cursor.backwardCursor.isPresent()) {
132132
return Optional.empty();
133133
} else {
134134
return Optional.of(cursor);
@@ -178,14 +178,14 @@ public Optional<IndexedCursor> reloadCursor() {
178178

179179
Optional<FetchResult> reFetchResult =
180180
reFetch(this.conn, this.tableIndex, this.isDuplicate, result);
181-
if (!reFetchResult.isEmpty()) {
181+
if (reFetchResult.isPresent()) {
182182
FetchResult r = reFetchResult.get();
183183
newCursor.forwardBuffer.add(r);
184184
newCursor.cursorIndex = 0;
185185
newCursor.firstFetch = false;
186186
}
187187

188-
if (newCursor.forwardCursor.isEmpty() || newCursor.backwardCursor.isEmpty()) {
188+
if (!newCursor.forwardCursor.isPresent() || !newCursor.backwardCursor.isPresent()) {
189189
return Optional.empty();
190190
} else {
191191
return Optional.of(newCursor);
@@ -409,7 +409,7 @@ private Optional<FetchResult> fetchPrev(ResultSet cursor) {
409409
* return Optional.empty()
410410
*/
411411
public Optional<FetchResult> next() {
412-
if (this.forwardCursor.isEmpty()) {
412+
if (!this.forwardCursor.isPresent()) {
413413
return Optional.empty();
414414
}
415415
ResultSet cursor = this.forwardCursor.get();
@@ -458,7 +458,7 @@ public Optional<FetchResult> next() {
458458
* return Optional.empty()
459459
*/
460460
public Optional<FetchResult> prev() {
461-
if (this.backwardCursor.isEmpty()) {
461+
if (!this.backwardCursor.isPresent()) {
462462
return Optional.empty();
463463
}
464464
ResultSet cursor = this.backwardCursor.get();
@@ -524,7 +524,7 @@ private static Optional<ResultSet> getCursor(
524524
boolean forward) {
525525
final Optional<String> optionalCompOperator = getCompOperator(comparator, forward);
526526

527-
if (optionalCompOperator.isEmpty()) {
527+
if (!optionalCompOperator.isPresent()) {
528528
return Optional.empty();
529529
}
530530

@@ -617,7 +617,7 @@ private Optional<ResultSet> getCursorForFirstLast(
617617
public boolean moveToFirst() {
618618
Optional<ResultSet> cursor =
619619
getCursorForFirstLast(this.tableIndex, this.isDuplicate, CursorReadOption.FIRST);
620-
if (cursor.isEmpty()) {
620+
if (!cursor.isPresent()) {
621621
return false;
622622
}
623623
this.forwardCursor = cursor;
@@ -630,7 +630,7 @@ public boolean moveToFirst() {
630630
public boolean moveToLast() {
631631
Optional<ResultSet> cursor =
632632
getCursorForFirstLast(this.tableIndex, this.isDuplicate, CursorReadOption.LAST);
633-
if (cursor.isEmpty()) {
633+
if (!cursor.isPresent()) {
634634
return false;
635635
}
636636
this.backwardCursor = cursor;

0 commit comments

Comments
 (0)