Skip to content

Commit 45748c4

Browse files
authored
Celesta 8: upgrade to Java 11 (#632)
* move to Java 11 * jdk 11 everywhere * fix listing style in Asciidoctor * remove dbClassName instantiation machinery * remove the deprecated constructor from cursor * code cleanup
1 parent 5c91783 commit 45748c4

136 files changed

Lines changed: 734 additions & 978 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,15 @@ jobs:
1212
build-docs:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
16-
17-
- name: Set up JDK 8
18-
uses: actions/setup-java@v2
19-
with:
20-
distribution: 'adopt'
21-
java-version: '8'
22-
23-
- name: Set up JDK11
24-
uses: AdoptOpenJDK/install-jdk@v1
25-
with:
26-
version: '11'
27-
targets: 'JDK_11'
28-
29-
- uses: actions/cache@v1
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up JDK 11
18+
uses: actions/setup-java@v4
3019
with:
31-
path: ~/.m2/repository
32-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
33-
restore-keys: ${{ runner.os }}-maven-
20+
distribution: 'temurin'
21+
java-version: '11'
22+
cache: 'maven'
23+
3424
- name: Install aspell and graphviz
3525
run: sudo apt-get install -y aspell-en aspell-ru graphviz
3626
- name: Install jsyntrax
@@ -51,7 +41,6 @@ jobs:
5141
- name: Build documentation
5242
run: mvn generate-resources -pl :celesta-documentation
5343
env:
54-
JAVA_HOME: ${{ env.JDK_11 }}
5544
DIAGRAM_JSYNTRAX_HOME: ${{ github.workspace }}/jsyntrax-1.37
5645
- name: Move Javadoc
5746
run: mv target/site/apidocs celesta-documentation/target/generated-docs/apidocs

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
build-main:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414

15-
- name: Set up JDK 8
16-
uses: actions/setup-java@v3
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v4
1717
with:
1818
distribution: 'temurin'
19-
java-version: '8'
19+
java-version: '11'
2020
cache: 'maven'
2121

2222
- name: Setup Testcontainers Cloud Client

celesta-core/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>celesta-parent</artifactId>
55
<groupId>ru.curs</groupId>
6-
<version>7.4.41-SNAPSHOT</version>
6+
<version>8.0.0-SNAPSHOT</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99

@@ -15,7 +15,12 @@
1515
<dependency>
1616
<groupId>ru.curs</groupId>
1717
<artifactId>celesta-sql</artifactId>
18-
<version>7.4.41-SNAPSHOT</version>
18+
<version>8.0.0-SNAPSHOT</version>
19+
</dependency>
20+
21+
<dependency>
22+
<groupId>javax.annotation</groupId>
23+
<artifactId>javax.annotation-api</artifactId>
1924
</dependency>
2025

2126
<!-- TEST DEPENDENCIES -->

celesta-core/src/main/java/ru/curs/celesta/BaseAppSettings.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,6 @@ public String getScorePath() {
174174
return scorePath;
175175
}
176176

177-
/**
178-
* Returns parameter value "JDBC connection class".
179-
*
180-
* @return
181-
*/
182-
public String getDbClassName() {
183-
return dbType.getDriverClassName();
184-
}
185-
186177
/**
187178
* Returns parameter value "JDBC connection string".
188179
*

celesta-core/src/main/java/ru/curs/celesta/dbutils/BasicCursor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
import java.sql.SQLException;
6666
import java.util.ArrayList;
6767
import java.util.Arrays;
68+
import java.util.Collection;
6869
import java.util.Collections;
6970
import java.util.HashMap;
7071
import java.util.HashSet;
@@ -820,7 +821,7 @@ final ColumnMeta<?> validateColumnName(String name) {
820821

821822
private Object validateColumnValue(ColumnMeta<?> column, Object value) {
822823
if (value == null) {
823-
return value;
824+
return null;
824825
}
825826
if (!column.getJavaClass().isAssignableFrom(value.getClass())) {
826827
throw new CelestaException("Value %s is not of type %s.", value, column.getJavaClass());
@@ -1371,7 +1372,7 @@ public final void clearBuffer(boolean withKeys) {
13711372
* @param context call context
13721373
* @param fetchedFields list of fields to be fetched
13731374
*/
1374-
public final BasicCursor getBufferCopy(CallContext context, List<String> fetchedFields) {
1375+
public final BasicCursor getBufferCopy(CallContext context, Collection<? extends ColumnMeta<?>> fetchedFields) {
13751376
return _getBufferCopy(context, fetchedFields);
13761377
}
13771378

@@ -1382,7 +1383,7 @@ public final BasicCursor getBufferCopy(CallContext context, List<String> fetched
13821383
* can be caused.
13831384
*/
13841385
@SuppressWarnings("MethodName")
1385-
protected abstract BasicCursor _getBufferCopy(CallContext context, List<String> fields);
1386+
protected abstract BasicCursor _getBufferCopy(CallContext context, Collection<? extends ColumnMeta<?>> fields);
13861387

13871388
@SuppressWarnings("MethodName")
13881389
protected abstract Object[] _currentValues();

celesta-core/src/main/java/ru/curs/celesta/dbutils/Cursor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public Cursor(CallContext context, ColumnMeta<?>... columns) {
123123
this(context, Arrays.stream(columns).map(ColumnMeta::getName).collect(Collectors.toSet()));
124124
}
125125

126-
public Cursor(CallContext context, Set<String> fields) {
126+
Cursor(CallContext context, Set<String> fields) {
127127
super(context, fields);
128128

129129
CursorGetHelper.CursorGetHelperBuilder cghb = new CursorGetHelper.CursorGetHelperBuilder();

celesta-core/src/main/java/ru/curs/celesta/dbutils/filter/Filter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import ru.curs.celesta.score.StringColumn;
99

1010
import java.util.HashMap;
11+
import java.util.Objects;
1112

1213
/**
1314
* Single field filter.
@@ -46,7 +47,7 @@ public String makeWhereClause(String quotedName, final QueryBuildingHelper dba)
4647
public boolean filterEquals(AbstractFilter f) {
4748
if (f instanceof Filter) {
4849
Object v2 = ((Filter) f).value;
49-
return value == null ? v2 == null : value.equals(v2);
50+
return Objects.equals(value, v2);
5051
} else {
5152
return false;
5253
}

celesta-core/src/main/java/ru/curs/celesta/dbutils/filter/value/FieldsLookup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public void validate() {
275275

276276
columnOrdersInIndicesSet.retainAll(otherColumnOrdersInIndicesSet);
277277

278-
columnOrdersInIndicesSet.stream().forEach(Collections::sort);
278+
columnOrdersInIndicesSet.forEach(Collections::sort);
279279
Optional<List<Integer>> match = columnOrdersInIndicesSet.stream()
280280
.filter(l -> l.equals(IntStream.range(0, l.size()).boxed().collect(Collectors.toList()))).findAny();
281281

celesta-core/src/main/java/ru/curs/celesta/score/Score.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public final class Score extends AbstractScore {
1010
*/
1111
public static final String SYSTEM_SCHEMA_NAME = "celesta";
1212

13-
private IdentifierParser identifierParser = new PlainIdentifierParser();
13+
private final IdentifierParser identifierParser = new PlainIdentifierParser();
1414

1515
public Score() {
1616
}

celesta-documentation/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>celesta-parent</artifactId>
55
<groupId>ru.curs</groupId>
6-
<version>7.4.41-SNAPSHOT</version>
6+
<version>8.0.0-SNAPSHOT</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99

0 commit comments

Comments
 (0)