Skip to content

Commit 2f7dacd

Browse files
jdk17 support
fixes #3899 --------- Signed-off-by: Gino Augustine <ginoaugustine@gmail.com>
1 parent 27edbb3 commit 2f7dacd

File tree

23 files changed

+98
-100
lines changed

23 files changed

+98
-100
lines changed

.github/workflows/apiary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout master branch
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v4
2020
- name: Install drafter
2121
run: npm install drafter
2222
- name: Build

.github/workflows/build.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,30 @@ on:
1111

1212
jobs:
1313
build:
14-
name: ${{ matrix.os }} with Java 11
14+
name: ${{ matrix.os }} with Java 17
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
fail-fast: false
1818
matrix:
1919
os: [ubuntu-latest, macos-latest, windows-latest]
2020
steps:
2121
- name: Checkout master branch
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
25-
- name: Set up JDK 11
26-
uses: actions/setup-java@v1
25+
- name: Set up JDK 17
26+
uses: actions/setup-java@v3
2727
with:
28-
java-version: 11
28+
distribution: 'oracle'
29+
java-version: '17'
2930
- name: Cache Maven packages
30-
uses: actions/cache@v2
31+
uses: actions/cache@v3
3132
with:
3233
path: ~/.m2
3334
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3435
restore-keys: ${{ runner.os }}-m2
3536
- name: Checkout Universal ctags
36-
uses: actions/checkout@v2
37+
uses: actions/checkout@v4
3738
with:
3839
repository: universal-ctags/ctags
3940
path: ctags

.github/workflows/codeql-analysis.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ jobs:
2121

2222
steps:
2323
- name: Checkout repository
24-
uses: actions/checkout@v2
25-
24+
uses: actions/checkout@v4
25+
- name: Set up JDK 17
26+
uses: actions/setup-java@v3
27+
with:
28+
distribution: 'oracle'
29+
java-version: '17'
2630
- name: Initialize CodeQL
27-
uses: github/codeql-action/init@v1
31+
uses: github/codeql-action/init@v2
2832
with:
2933
languages: ${{ matrix.language }}
3034

3135
- name: Autobuild
32-
uses: github/codeql-action/autobuild@v1
36+
uses: github/codeql-action/autobuild@v2
3337

3438
- name: Perform CodeQL Analysis
35-
uses: github/codeql-action/analyze@v1
39+
uses: github/codeql-action/analyze@v2

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout master branch
10-
uses: actions/checkout@v3
10+
uses: actions/checkout@v4
1111
- uses: actions/setup-python@v4
1212
with:
1313
python-version: '3.10'

.github/workflows/javadoc.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,21 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout master branch
20-
uses: actions/checkout@v2
21-
- name: Set up JDK 11
22-
uses: actions/setup-java@v1
20+
uses: actions/checkout@v4
21+
- name: Set up JDK 17
22+
uses: actions/setup-java@v3
2323
with:
24-
java-version: 11
24+
distribution: 'oracle'
25+
java-version: '17'
2526
- name: Cache Maven packages
26-
uses: actions/cache@v2
27+
uses: actions/cache@v3
2728
with:
2829
path: ~/.m2
2930
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3031
restore-keys: ${{ runner.os }}-m2
3132
- name: Checkout gh-pages branch
3233
if: github.repository == 'oracle/opengrok'
33-
uses: actions/checkout@v2
34+
uses: actions/checkout@v4
3435
with:
3536
ref: gh-pages
3637
path: gh-pages

.github/workflows/release.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout master branch
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1818
- name: Get the tag name
1919
id: get_tag
2020
env:
@@ -25,19 +25,20 @@ jobs:
2525
needs: get_tag
2626
steps:
2727
- name: Checkout master branch
28-
uses: actions/checkout@v2
29-
- name: Set up JDK 11
30-
uses: actions/setup-java@v1
28+
uses: actions/checkout@v4
29+
- name: Set up JDK 17
30+
uses: actions/setup-java@v3
3131
with:
32-
java-version: 11
32+
distribution: 'oracle'
33+
java-version: '17'
3334
- name: Cache Maven packages
34-
uses: actions/cache@v2
35+
uses: actions/cache@v3
3536
with:
3637
path: ~/.m2
3738
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3839
restore-keys: ${{ runner.os }}-m2
3940
- name: Checkout Universal ctags
40-
uses: actions/checkout@v2
41+
uses: actions/checkout@v4
4142
with:
4243
repository: universal-ctags/ctags
4344
path: ctags

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
FROM ubuntu:jammy as build
55

66
# hadolint ignore=DL3008
7-
RUN apt-get update && apt-get install --no-install-recommends -y openjdk-11-jdk python3 python3-venv && \
7+
RUN apt-get update && apt-get install --no-install-recommends -y openjdk-17-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-jdk11
44+
FROM tomcat:10.1.13-jdk17
4545
LABEL maintainer="https://github.com/oracle/opengrok"
4646

4747
# Add Perforce apt source.
@@ -93,6 +93,11 @@ ENV CATALINA_BASE /usr/local/tomcat
9393
ENV CATALINA_TMPDIR /usr/local/tomcat/temp
9494
ENV PATH $CATALINA_HOME/bin:$PATH
9595
ENV CLASSPATH /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
96+
ENV JAVA_OPTS="--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
97+
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
98+
--add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED \
99+
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED \
100+
--add-opens=java.base/java.util=ALL-UNNAMED"
96101

97102
# disable all file logging
98103
COPY docker/logging.properties /usr/local/tomcat/conf/logging.properties

docker/README.md

Lines changed: 1 addition & 1 deletion
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 11
29+
* JRE 17
3030
* Configurable mirroring/reindexing (default every 10 min)
3131

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

opengrok-indexer/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,14 @@ Portions Copyright (c) 2020-2020, Lubos Kosco <tarzanek@gmail.com>.
377377
</excludes>
378378
<argLine>
379379
@{surefireArgLine}
380-
--illegal-access=permit
380+
381381
</argLine>
382382
</configuration>
383383
</plugin>
384+
<plugin>
385+
<groupId>org.apache.maven.plugins</groupId>
386+
<artifactId>maven-compiler-plugin</artifactId>
387+
</plugin>
384388
</plugins>
385389
</build>
386390

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ public void applyConfig(String configuration, boolean reindex, CommandTimeoutTyp
18491849
* @param reindex is the message result of reindex
18501850
* @param cmdType command timeout type
18511851
* @see ConfigurationChangedListener
1852-
* </p>
1852+
*
18531853
*/
18541854
public void applyConfig(Configuration config, boolean reindex, CommandTimeoutType cmdType) {
18551855
setConfiguration(config, cmdType);

opengrok-indexer/src/main/java/org/opengrok/indexer/framework/PluginFramework.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
import java.io.IOException;
2727
import java.lang.reflect.InvocationTargetException;
2828
import java.lang.reflect.Modifier;
29-
import java.security.AccessController;
30-
import java.security.PrivilegedAction;
3129
import java.util.Arrays;
3230
import java.util.Enumeration;
3331
import java.util.LinkedList;
@@ -382,7 +380,7 @@ public final void reload() {
382380

383381
// trashing out the old instance of the loader enables us
384382
// to reload the stack at runtime
385-
loader = AccessController.doPrivileged((PrivilegedAction<PluginClassLoader>) () -> new PluginClassLoader(pluginDirectory));
383+
loader = new PluginClassLoader(pluginDirectory);
386384

387385
// notify the implementing class that the reload is about to begin
388386
beforeReload();

opengrok-indexer/src/main/java/org/opengrok/indexer/index/DefaultIndexChangedListener.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
*
3838
* @author Trond Norbye
3939
*/
40-
@SuppressWarnings("PMD.SystemPrintln")
4140
public class DefaultIndexChangedListener implements IndexChangedListener {
4241

4342
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultIndexChangedListener.class);

opengrok-indexer/src/main/java/org/opengrok/indexer/index/Indexer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
* Windows already supports opening {@code /var/opengrok} as {@code C:\var\opengrok}
9797
* </p>
9898
*/
99-
@SuppressWarnings({"PMD.AvoidPrintStackTrace", "PMD.SystemPrintln"})
99+
@SuppressWarnings({"PMD.AvoidPrintStackTrace", "PMD.SystemPrintln", "java:S106"})
100100
public final class Indexer {
101101

102102
private static final Logger LOGGER = LoggerFactory.getLogger(Indexer.class);
@@ -162,7 +162,6 @@ public static Indexer getInstance() {
162162
@SuppressWarnings("PMD.UseStringBufferForStringAppends")
163163
public static void main(String[] argv) {
164164
Statistics stats = new Statistics(); //this won't count JVM creation though
165-
boolean update = true;
166165

167166
Executor.registerErrorHandler();
168167
List<String> subFiles = RuntimeEnvironment.getInstance().getSubFiles();

opengrok-indexer/src/main/java/org/opengrok/indexer/logger/formatter/LogFormatter.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,40 +61,41 @@ public LogFormatter(String format, String version) {
6161
}
6262

6363
@Override
64-
public String format(LogRecord record) {
65-
Date dat = new Date(record.getMillis());
64+
@SuppressWarnings("deprecation")
65+
public String format(LogRecord logRecord) {
66+
Date dat = new Date(logRecord.getMillis());
6667
StringBuilder source = new StringBuilder();
67-
if (record.getSourceClassName() != null) {
68-
source.append(record.getSourceClassName());
69-
if (record.getSourceMethodName() != null) {
70-
source.append(' ').append(record.getSourceMethodName());
68+
if (logRecord.getSourceClassName() != null) {
69+
source.append(logRecord.getSourceClassName());
70+
if (logRecord.getSourceMethodName() != null) {
71+
source.append(' ').append(logRecord.getSourceMethodName());
7172
}
7273
} else {
73-
source.append(record.getLoggerName());
74+
source.append(logRecord.getLoggerName());
7475
}
7576

7677
StringBuilder throwable = new StringBuilder();
77-
if (record.getThrown() != null) {
78+
if (logRecord.getThrown() != null) {
7879
StringWriter sw = new StringWriter();
7980
PrintWriter pw = new PrintWriter(sw);
8081
pw.println();
81-
record.getThrown().printStackTrace(pw);
82+
logRecord.getThrown().printStackTrace(pw);
8283
pw.close();
8384
throwable.append(sw.toString());
8485
}
8586

8687
return String.format(format,
8788
dat, //%1
8889
source.toString(), //%2
89-
record.getLoggerName(), //%3
90-
record.getLevel().getLocalizedName(), //%4
91-
formatMessage(record), //%5
90+
logRecord.getLoggerName(), //%3
91+
logRecord.getLevel().getLocalizedName(), //%4
92+
formatMessage(logRecord), //%5
9293
throwable, //%6 (till here the same as JDK7's SimpleFormatter)
93-
record.getSourceClassName(), //%7
94-
record.getSourceMethodName(), //%8
95-
className(record.getSourceClassName()), //%9
96-
record.getThreadID(), //%10
97-
record.getMessage(), //%11
94+
logRecord.getSourceClassName(), //%7
95+
logRecord.getSourceMethodName(), //%8
96+
className(logRecord.getSourceClassName()), //%9
97+
logRecord.getThreadID(), //%10
98+
logRecord.getMessage(), //%11
9899
version
99100
);
100101
}

opengrok-indexer/src/main/java/org/opengrok/indexer/web/messages/Message.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public String toString() {
8080
return messageLevelString;
8181
}
8282

83-
@SuppressWarnings("rawtypes")
8483
public static final Comparator<MessageLevel> VALUE_COMPARATOR = Comparator.comparingInt(Enum::ordinal);
8584
}
8685

opengrok-indexer/src/test/java/org/opengrok/indexer/history/BazaarHistoryParserTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ public void parseLogNoFile() throws Exception {
143143
}
144144

145145
@Test
146-
@SuppressWarnings("unchecked")
147146
public void parseLogDirectory() throws Exception {
148147
String revId1 = "1234";
149148
String author1 = "username@example.com";

opengrok-web/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,15 @@ Portions Copyright (c) 2018, 2020, Chris Fraire <cfraire@me.com>.
253253
<argLine>
254254
@{surefireArgLine}
255255
-Djna.nosys=true
256-
--illegal-access=permit
257256
--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
258-
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
259257
--add-exports java.base/sun.nio.ch=ALL-UNNAMED
258+
--add-exports jdk.unsupported/sun.misc=ALL-UNNAMED
259+
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
260+
--add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED
261+
--add-opens java.base/java.lang=ALL-UNNAMED
262+
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
263+
--add-opens java.base/java.io=ALL-UNNAMED
264+
--add-opens java.base/java.util=ALL-UNNAMED
260265
</argLine>
261266
</configuration>
262267
</plugin>

opengrok-web/src/main/java/org/opengrok/web/api/v1/suggester/query/SuggesterQueryParser.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ protected Query newFuzzyQuery(final Term term, final float minimumSimilarity, fi
237237
replaceIdentifier(term.field(), term.text() + "~" + ((int) minimumSimilarity));
238238
}
239239

240-
@SuppressWarnings("deprecation")
241240
int numEdits = FuzzyQuery.floatToEdits(minimumSimilarity,
242241
newTerm.text().codePointCount(0, newTerm.text().length()));
243242

opengrok-web/src/test/java/org/opengrok/web/api/v1/controller/SuggesterControllerTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,6 @@ void testAllowComplexQueries() {
596596
}
597597

598598
@Test
599-
@SuppressWarnings("unchecked") // for contains
600599
void testGetPopularityDataSimple() {
601600
assertTrue(SuggesterServiceImpl.getInstance().increaseSearchCount("rust",
602601
new Term(QueryBuilder.FULL, "main"), 10, true));
@@ -611,7 +610,6 @@ void testGetPopularityDataSimple() {
611610
}
612611

613612
@Test
614-
@SuppressWarnings("unchecked") // for contains
615613
void testGetPopularityDataAll() {
616614
assertTrue(SuggesterServiceImpl.getInstance().increaseSearchCount("csharp",
617615
new Term(QueryBuilder.FULL, "mynamespace"), 10, true));
@@ -630,7 +628,6 @@ void testGetPopularityDataAll() {
630628
}
631629

632630
@Test
633-
@SuppressWarnings("unchecked") // for contains
634631
void testGetPopularityDataDifferentField() {
635632
assertTrue(SuggesterServiceImpl.getInstance().increaseSearchCount("swift",
636633
new Term(QueryBuilder.FULL, "print"), 10, true));

plugins/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Portions Copyright (c) 2020, Chris Fraire <cfraire@me.com>.
119119
</systemPropertyVariables>
120120
<argLine>
121121
@{surefireArgLine}
122-
--illegal-access=permit
122+
123123
</argLine>
124124
</configuration>
125125
</plugin>

0 commit comments

Comments
 (0)