Skip to content

jdk17 support #4414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 6, 2023
2 changes: 1 addition & 1 deletion .github/workflows/apiary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install drafter
run: npm install drafter
- name: Build
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,30 @@ on:

jobs:
build:
name: ${{ matrix.os }} with Java 11
name: ${{ matrix.os }} with Java 17
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout master branch
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'oracle'
java-version: '17'
- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Checkout Universal ctags
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: universal-ctags/ctags
path: ctags
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2

uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: '17'
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'oracle'
java-version: '17'
- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Checkout gh-pages branch
if: github.repository == 'oracle/opengrok'
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Get the tag name
id: get_tag
env:
Expand All @@ -25,19 +25,20 @@ jobs:
needs: get_tag
steps:
- name: Checkout master branch
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'oracle'
java-version: '17'
- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Checkout Universal ctags
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: universal-ctags/ctags
path: ctags
Expand Down
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
FROM ubuntu:jammy as build

# hadolint ignore=DL3008
RUN apt-get update && apt-get install --no-install-recommends -y openjdk-11-jdk python3 python3-venv && \
RUN apt-get update && apt-get install --no-install-recommends -y openjdk-17-jdk python3 python3-venv && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

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

FROM tomcat:10.1-jdk11
FROM tomcat:10.1.13-jdk17
LABEL maintainer="https://github.com/oracle/opengrok"

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

# disable all file logging
COPY docker/logging.properties /usr/local/tomcat/conf/logging.properties
Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ image based on the official one.
## Additional info about the image

* Tomcat 10
* JRE 11
* JRE 17
* Configurable mirroring/reindexing (default every 10 min)

The mirroring step works by going through all projects and attempting to
Expand Down
6 changes: 5 additions & 1 deletion opengrok-indexer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,14 @@ Portions Copyright (c) 2020-2020, Lubos Kosco <[email protected]>.
</excludes>
<argLine>
@{surefireArgLine}
--illegal-access=permit

</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ public void applyConfig(String configuration, boolean reindex, CommandTimeoutTyp
* @param reindex is the message result of reindex
* @param cmdType command timeout type
* @see ConfigurationChangedListener
* </p>
*
*/
public void applyConfig(Configuration config, boolean reindex, CommandTimeoutType cmdType) {
setConfiguration(config, cmdType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.LinkedList;
Expand Down Expand Up @@ -382,7 +380,7 @@ public final void reload() {

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

// notify the implementing class that the reload is about to begin
beforeReload();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
*
* @author Trond Norbye
*/
@SuppressWarnings("PMD.SystemPrintln")
public class DefaultIndexChangedListener implements IndexChangedListener {

private static final Logger LOGGER = LoggerFactory.getLogger(DefaultIndexChangedListener.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
* Windows already supports opening {@code /var/opengrok} as {@code C:\var\opengrok}
* </p>
*/
@SuppressWarnings({"PMD.AvoidPrintStackTrace", "PMD.SystemPrintln"})
@SuppressWarnings({"PMD.AvoidPrintStackTrace", "PMD.SystemPrintln", "java:S106"})
public final class Indexer {

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

Executor.registerErrorHandler();
List<String> subFiles = RuntimeEnvironment.getInstance().getSubFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,40 +61,41 @@ public LogFormatter(String format, String version) {
}

@Override
public String format(LogRecord record) {
Date dat = new Date(record.getMillis());
@SuppressWarnings("deprecation")
public String format(LogRecord logRecord) {
Date dat = new Date(logRecord.getMillis());
StringBuilder source = new StringBuilder();
if (record.getSourceClassName() != null) {
source.append(record.getSourceClassName());
if (record.getSourceMethodName() != null) {
source.append(' ').append(record.getSourceMethodName());
if (logRecord.getSourceClassName() != null) {
source.append(logRecord.getSourceClassName());
if (logRecord.getSourceMethodName() != null) {
source.append(' ').append(logRecord.getSourceMethodName());
}
} else {
source.append(record.getLoggerName());
source.append(logRecord.getLoggerName());
}

StringBuilder throwable = new StringBuilder();
if (record.getThrown() != null) {
if (logRecord.getThrown() != null) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println();
record.getThrown().printStackTrace(pw);
logRecord.getThrown().printStackTrace(pw);
pw.close();
throwable.append(sw.toString());
}

return String.format(format,
dat, //%1
source.toString(), //%2
record.getLoggerName(), //%3
record.getLevel().getLocalizedName(), //%4
formatMessage(record), //%5
logRecord.getLoggerName(), //%3
logRecord.getLevel().getLocalizedName(), //%4
formatMessage(logRecord), //%5
throwable, //%6 (till here the same as JDK7's SimpleFormatter)
record.getSourceClassName(), //%7
record.getSourceMethodName(), //%8
className(record.getSourceClassName()), //%9
record.getThreadID(), //%10
record.getMessage(), //%11
logRecord.getSourceClassName(), //%7
logRecord.getSourceMethodName(), //%8
className(logRecord.getSourceClassName()), //%9
logRecord.getThreadID(), //%10
logRecord.getMessage(), //%11
version
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public String toString() {
return messageLevelString;
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public void parseLogNoFile() throws Exception {
}

@Test
@SuppressWarnings("unchecked")
public void parseLogDirectory() throws Exception {
String revId1 = "1234";
String author1 = "[email protected]";
Expand Down
9 changes: 7 additions & 2 deletions opengrok-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,15 @@ Portions Copyright (c) 2018, 2020, Chris Fraire <[email protected]>.
<argLine>
@{surefireArgLine}
-Djna.nosys=true
--illegal-access=permit
--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
--add-exports java.base/sun.nio.ch=ALL-UNNAMED
--add-exports jdk.unsupported/sun.misc=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
--add-opens java.base/java.io=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ protected Query newFuzzyQuery(final Term term, final float minimumSimilarity, fi
replaceIdentifier(term.field(), term.text() + "~" + ((int) minimumSimilarity));
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,6 @@ void testAllowComplexQueries() {
}

@Test
@SuppressWarnings("unchecked") // for contains
void testGetPopularityDataSimple() {
assertTrue(SuggesterServiceImpl.getInstance().increaseSearchCount("rust",
new Term(QueryBuilder.FULL, "main"), 10, true));
Expand All @@ -611,7 +610,6 @@ void testGetPopularityDataSimple() {
}

@Test
@SuppressWarnings("unchecked") // for contains
void testGetPopularityDataAll() {
assertTrue(SuggesterServiceImpl.getInstance().increaseSearchCount("csharp",
new Term(QueryBuilder.FULL, "mynamespace"), 10, true));
Expand All @@ -630,7 +628,6 @@ void testGetPopularityDataAll() {
}

@Test
@SuppressWarnings("unchecked") // for contains
void testGetPopularityDataDifferentField() {
assertTrue(SuggesterServiceImpl.getInstance().increaseSearchCount("swift",
new Term(QueryBuilder.FULL, "print"), 10, true));
Expand Down
2 changes: 1 addition & 1 deletion plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Portions Copyright (c) 2020, Chris Fraire <[email protected]>.
</systemPropertyVariables>
<argLine>
@{surefireArgLine}
--illegal-access=permit

</argLine>
</configuration>
</plugin>
Expand Down
Loading