Skip to content

Commit e84d396

Browse files
authored
switch to Java 21 for build/Docker (#4759)
fixes #4459
1 parent 1c311b0 commit e84d396

Some content is hidden

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

45 files changed

+149
-139
lines changed

.github/workflows/build.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
build:
14-
name: ${{ matrix.os }} with Java 17
14+
name: ${{ matrix.os }} with Java 21
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
fail-fast: false
@@ -22,11 +22,11 @@ jobs:
2222
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
25-
- name: Set up JDK 17
25+
- name: Set up JDK
2626
uses: actions/setup-java@v4
2727
with:
2828
distribution: 'oracle'
29-
java-version: '17'
29+
java-version: '21'
3030
- name: Cache Maven packages
3131
uses: actions/cache@v4
3232
with:

.github/workflows/javadoc.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ jobs:
1818
steps:
1919
- name: Checkout master branch
2020
uses: actions/checkout@v4
21-
- name: Set up JDK 17
21+
- name: Set up JDK
2222
uses: actions/setup-java@v4
2323
with:
2424
distribution: 'oracle'
25-
java-version: '17'
25+
java-version: '21'
2626
- name: Cache Maven packages
2727
uses: actions/cache@v4
2828
with:

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
steps:
2626
- name: Checkout master branch
2727
uses: actions/checkout@v4
28-
- name: Set up JDK 17
28+
- name: Set up JDK
2929
uses: actions/setup-java@v4
3030
with:
3131
distribution: 'oracle'
32-
java-version: '17'
32+
java-version: '21'
3333
- name: Cache Maven packages
3434
uses: actions/cache@v4
3535
with:

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2018, 2025 Oracle and/or its affiliates. All rights reserved.
22
# Portions Copyright (c) 2020, Chris Fraire <[email protected]>.
33

44
FROM ubuntu:jammy AS build
55

66
# hadolint ignore=DL3008
7-
RUN apt-get update && apt-get install --no-install-recommends -y openjdk-17-jdk python3 python3-venv && \
7+
RUN apt-get update && apt-get install --no-install-recommends -y openjdk-21-jdk python3 python3-venv && \
88
apt-get clean && \
99
rm -rf /var/lib/apt/lists/*
1010

@@ -41,7 +41,7 @@ RUN cp `ls -t distribution/target/*.tar.gz | head -1` /opengrok.tar.gz
4141
# Store the version in a file so that the tools can report it.
4242
RUN /mvn/mvnw help:evaluate -Dexpression=project.version -q -DforceStdout > /mvn/VERSION
4343

44-
FROM tomcat:10.1.40-jdk17
44+
FROM tomcat:10.1.40-jdk21
4545
LABEL maintainer="https://github.com/oracle/opengrok"
4646
LABEL org.opencontainers.image.source="https://github.com/oracle/opengrok"
4747
LABEL org.opencontainers.image.description="OpenGrok code search"

docker/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ image based on the official one.
2626
## Additional info about the image
2727

2828
* Tomcat 10
29-
* JRE 17
29+
* JRE 21
3030
* Configurable mirroring/reindexing (default every 10 min)
3131

3232
The mirroring step works by going through all projects and attempting to

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/Definitions.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2018, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.analysis;
@@ -66,24 +66,24 @@ public static class LineTagMap implements Serializable {
6666

6767
private static final long serialVersionUID = 1191703801007779481L;
6868
@SuppressWarnings("java:S116")
69-
private final Map<String, Set<Tag>> sym_tags; //NOPMD
69+
private final HashMap<String, Set<Tag>> sym_tags; //NOPMD
7070

7171
protected LineTagMap() {
7272
this.sym_tags = new HashMap<>();
7373
}
7474
}
7575
// line number -> tag map
7676
@SuppressWarnings("java:S116")
77-
private final Map<Integer, LineTagMap> line_maps;
77+
private final HashMap<Integer, LineTagMap> line_maps;
7878

7979
/**
8080
* Map from symbol to the line numbers on which the symbol is defined.
8181
*/
82-
private final Map<String, Set<Integer>> symbols;
82+
private final HashMap<String, Set<Integer>> symbols;
8383
/**
8484
* List of all the tags.
8585
*/
86-
private final List<Tag> tags;
86+
private final ArrayList<Tag> tags;
8787

8888
public Definitions() {
8989
symbols = new HashMap<>();

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexTokenizer.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2017, 2020, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.analysis;
@@ -49,6 +49,7 @@ public class JFlexTokenizer extends Tokenizer
4949
* will be owned by the {@link JFlexTokenizer}.
5050
* @param matcher a defined instance
5151
*/
52+
@SuppressWarnings("this-escape")
5253
public JFlexTokenizer(ScanningSymbolMatcher matcher) {
5354
if (matcher == null) {
5455
throw new IllegalArgumentException("`matcher' is null");
@@ -83,12 +84,9 @@ public final void close() throws IOException {
8384
matcher.yyclose();
8485
}
8586

86-
private final CharTermAttribute termAtt = addAttribute(
87-
CharTermAttribute.class);
88-
private final OffsetAttribute offsetAtt = addAttribute(
89-
OffsetAttribute.class);
90-
private final PositionIncrementAttribute posIncrAtt = addAttribute(
91-
PositionIncrementAttribute.class);
87+
private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
88+
private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
89+
private final PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class);
9290

9391
/**
9492
* Attempts to advance the stream to the next acceptable token, and updates

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/JFlexXref.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2011, Jens Elkner.
2323
* Portions Copyright (c) 2017, 2020, Chris Fraire <[email protected]>.
2424
*/
@@ -37,8 +37,7 @@
3737
/**
3838
* @author Lubos Kosco
3939
*/
40-
public class JFlexXref implements Xrefer, SymbolMatchedListener,
41-
NonSymbolMatchedListener {
40+
public class JFlexXref implements Xrefer, SymbolMatchedListener, NonSymbolMatchedListener {
4241

4342
/**
4443
* Used to indicate pre-formatted output with
@@ -99,6 +98,7 @@ public class JFlexXref implements Xrefer, SymbolMatchedListener,
9998
* will be owned by the {@link JFlexXref}.
10099
* @param matcher a defined instance
101100
*/
101+
@SuppressWarnings("this-escape")
102102
public JFlexXref(ScanningSymbolMatcher matcher) {
103103
if (matcher == null) {
104104
throw new IllegalArgumentException("`matcher' is null");
@@ -109,11 +109,11 @@ public JFlexXref(ScanningSymbolMatcher matcher) {
109109
// The xrefer will own the matcher, so we won't have to unsubscribe.
110110

111111
userPageLink = RuntimeEnvironment.getInstance().getUserPage();
112-
if (userPageLink != null && userPageLink.length() == 0) {
112+
if (userPageLink != null && userPageLink.isEmpty()) {
113113
userPageLink = null;
114114
}
115115
userPageSuffix = RuntimeEnvironment.getInstance().getUserPageSuffix();
116-
if (userPageSuffix != null && userPageSuffix.length() == 0) {
116+
if (userPageSuffix != null && userPageSuffix.isEmpty()) {
117117
userPageSuffix = null;
118118
}
119119
}

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/PathTokenizer.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2018, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.analysis;
@@ -52,7 +52,9 @@ public class PathTokenizer extends Tokenizer {
5252
// below should be '/' since we try to convert even windows file separators
5353
// to unix ones
5454
public static final char DEFAULT_DELIMITER = '/';
55+
@SuppressWarnings("this-escape")
5556
private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
57+
@SuppressWarnings("this-escape")
5658
private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
5759
private int startPosition = 0;
5860
private final char delimiter;

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/DefinitionsTokenStream.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
2222
* Copyright (c) 2018, 2020, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.analysis.plain;
@@ -48,12 +48,12 @@ public class DefinitionsTokenStream extends TokenStream {
4848
*/
4949
private final List<PendingToken> events = new ArrayList<>();
5050

51-
private final CharTermAttribute termAtt = addAttribute(
52-
CharTermAttribute.class);
53-
private final OffsetAttribute offsetAtt = addAttribute(
54-
OffsetAttribute.class);
55-
private final PositionIncrementAttribute posIncrAtt = addAttribute(
56-
PositionIncrementAttribute.class);
51+
@SuppressWarnings("this-escape")
52+
private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
53+
@SuppressWarnings("this-escape")
54+
private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
55+
@SuppressWarnings("this-escape")
56+
private final PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class);
5757

5858
private int offset;
5959

@@ -65,8 +65,7 @@ public class DefinitionsTokenStream extends TokenStream {
6565
* @param wrapper an optional instance
6666
* @throws IOException if I/O error occurs
6767
*/
68-
public void initialize(Definitions defs, StreamSource src,
69-
ReaderWrapper wrapper) throws IOException {
68+
public void initialize(Definitions defs, StreamSource src, ReaderWrapper wrapper) throws IOException {
7069
if (defs == null) {
7170
throw new IllegalArgumentException("`defs' is null");
7271
}

opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationEntity.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2018, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.authorization;
@@ -119,14 +119,14 @@ public boolean test(AuthorizationEntity t) {
119119
*/
120120
protected AuthControlFlag flag;
121121
protected String name;
122-
protected Map<String, Object> setup = new TreeMap<>();
122+
protected transient Map<String, Object> setup = new TreeMap<>();
123123
/**
124124
* Hold current setup - merged with all ancestor's stacks.
125125
*/
126126
protected transient Map<String, Object> currentSetup = new TreeMap<>();
127127

128-
private Set<String> forProjects = new TreeSet<>();
129-
private Set<String> forGroups = new TreeSet<>();
128+
private transient Set<String> forProjects = new TreeSet<>();
129+
private transient Set<String> forGroups = new TreeSet<>();
130130

131131
protected transient boolean working = true;
132132

opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationStack.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2018, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.authorization;
@@ -51,7 +51,7 @@ public class AuthorizationStack extends AuthorizationEntity {
5151

5252
private static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationStack.class);
5353

54-
private List<AuthorizationEntity> stack = new ArrayList<>();
54+
private transient List<AuthorizationEntity> stack = new ArrayList<>();
5555

5656
public AuthorizationStack() {
5757
}

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Filter.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2020, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.configuration;
@@ -37,11 +37,11 @@ public class Filter implements Serializable {
3737
private static final long serialVersionUID = 3L;
3838

3939
/** The list of exact filenames. */
40-
private final Set<String> filenames;
40+
private final transient Set<String> filenames;
4141
/** The list of filenames with wildcards. */
42-
private final List<Pattern> patterns;
42+
private final transient List<Pattern> patterns;
4343
/** The list of paths. */
44-
private final List<String> paths;
44+
private final transient List<String> paths;
4545
/**
4646
* The full list of all patterns. This list will be saved in the
4747
* configuration file (if used).

0 commit comments

Comments
 (0)