Skip to content

Commit

Permalink
Use java 17 for SonarCloud
Browse files Browse the repository at this point in the history
WE2-841

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Nov 27, 2023
1 parent 08ac13d commit ad987af
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
Expand All @@ -28,7 +28,7 @@ jobs:
with:
path: ~/.m2
key: ${{ runner.os }}-m2-v11-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-v11
restore-keys: ${{ runner.os }}-m2-v17
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.6.2</maven-javadoc-plugin.version>
<jacoco.version>0.8.5</jacoco.version>
<jacoco.version>0.8.8</jacoco.version>
<sonar.coverage.jacoco.xmlReportPaths>
${project.basedir}/../jacoco-coverage-report/target/site/jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/webeid/security/util/DateAndTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void requirePositiveDuration(Duration duration, String fieldName)

public static class DefaultClock implements Clock {

public static final Clock INSTANCE = new DefaultClock();
public static Clock INSTANCE = new DefaultClock();

@Override
public Date now() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/eu/webeid/security/testutil/Dates.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ private static void setClockField(Class<? extends Clock> cls, Date date) throws
private static void setFinalStaticField(Field field, Object newValue) throws NoSuchFieldException, IllegalAccessException {
field.setAccessible(true);

/* https://stackoverflow.com/questions/56039341/get-declared-fields-of-java-lang-reflect-fields-in-jdk12
final Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
*/

field.set(null, newValue);
}
Expand Down

0 comments on commit ad987af

Please sign in to comment.