Skip to content

Commit abad05a

Browse files
SONARJAVA-6016 Migrate the Guava project in the ruling tests to Java 21 (#5459)
1 parent 2712c10 commit abad05a

28 files changed

Lines changed: 915 additions & 165 deletions

.github/workflows/build.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ jobs:
5757
item:
5858
- { runner: github-ubuntu-latest-m, profile: without-sonarqube-project }
5959
- { runner: github-ubuntu-latest-m, profile: only-sonarqube-project }
60-
- { runner: github-ubuntu-latest-m, profile: only-guava-project, java_version: 17, sonar-runtime: "LATEST_RELEASE[2025.4]" }
6160
- { runner: github-windows-latest-m, profile: without-sonarqube-project }
6261
- { runner: github-windows-latest-m, profile: only-sonarqube-project }
63-
- { runner: github-windows-latest-m, profile: only-guava-project, java_version: 17, sonar-runtime: "LATEST_RELEASE[2025.4]" }
6462
name: Ruling QA
6563
needs:
6664
- build
@@ -79,9 +77,7 @@ jobs:
7977
with:
8078
version: 2025.7.12
8179
- name: Select Java Version
82-
env:
83-
JAVA_VERSION: ${{ matrix.item.java_version || '21' }}
84-
run: mise use "java@${{ env.JAVA_VERSION }}"
80+
run: mise use java@21
8581
- name: Configure Maven
8682
uses: SonarSource/ci-github-actions/config-maven@v1
8783
with:
@@ -99,10 +95,9 @@ jobs:
9995
env:
10096
MAVEN_OPTS: "-Xmx3g"
10197
GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }}
102-
SONAR_RUNTIME: ${{ matrix.item.sonar-runtime || 'LATEST_RELEASE' }}
10398
run: |
10499
cd its/ruling
105-
mvn package --batch-mode "-Pit-ruling,${{ matrix.item.profile }}" "-Dsonar.runtimeVersion=${{ env.SONAR_RUNTIME }}" -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dparallel=methods -DuseUnlimitedThreads=true
100+
mvn package --batch-mode "-Pit-ruling,${{ matrix.item.profile }}" -Dsonar.runtimeVersion=LATEST_RELEASE -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dparallel=methods -DuseUnlimitedThreads=true
106101
107102
plugin-qa:
108103
strategy:

its/ruling/pom.xml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
<groupId>org.apache.maven.plugins</groupId>
109109
<artifactId>maven-surefire-plugin</artifactId>
110110
<configuration>
111-
<test>!org.sonar.java.it.JavaRulingTest#sonarqube_server,!org.sonar.java.it.JavaRulingTest#guava</test>
111+
<test>!org.sonar.java.it.JavaRulingTest#sonarqube_server</test>
112112
</configuration>
113113
</plugin>
114114
</plugins>
@@ -128,20 +128,6 @@
128128
</plugins>
129129
</build>
130130
</profile>
131-
<profile>
132-
<id>only-guava-project</id>
133-
<build>
134-
<plugins>
135-
<plugin>
136-
<groupId>org.apache.maven.plugins</groupId>
137-
<artifactId>maven-surefire-plugin</artifactId>
138-
<configuration>
139-
<test>org.sonar.java.it.JavaRulingTest#guava</test>
140-
</configuration>
141-
</plugin>
142-
</plugins>
143-
</build>
144-
</profile>
145131
</profiles>
146132

147133
</project>

its/ruling/src/test/java/org/sonar/java/it/JavaRulingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ public void guava() throws Exception {
185185
String projectName = "guava";
186186
MavenBuild build = test_project("com.google.guava:guava", projectName);
187187
build
188-
// by default guava is compatible with java 6, however this is not supported with JDK 17
189-
.setProperty("java.version", "1.7")
188+
// by default guava is compatible with java 6, however this is not supported with JDK 21
189+
.setProperty("java.version", "1.8")
190190
.setProperty("maven.javadoc.skip", "true")
191191
// use batch
192192
.setProperty("sonar.java.experimental.batchModeSizeInKB", "8192");

its/ruling/src/test/resources/guava/java-S109.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
260
8181
],
8282
"com.google.guava:guava:src/com/google/common/collect/Collections2.java": [
83-
317,
84-
524
83+
316,
84+
523
8585
],
8686
"com.google.guava:guava:src/com/google/common/collect/EnumHashBiMap.java": [
8787
122,

its/ruling/src/test/resources/guava/java-S1108.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@
218218
32
219219
],
220220
"com.google.guava:guava:src/com/google/common/collect/Collections2.java": [
221-
111,
222-
113,
223-
127,
224-
129
221+
110,
222+
112,
223+
126,
224+
128
225225
],
226226
"com.google.guava:guava:src/com/google/common/collect/ComputingConcurrentHashMap.java": [
227227
112,

its/ruling/src/test/resources/guava/java-S1120.json

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -3451,104 +3451,104 @@
34513451
49
34523452
],
34533453
"com.google.guava:guava:src/com/google/common/collect/Collections2.java": [
3454-
59,
3455-
93,
3456-
96,
3457-
108,
3458-
110,
3459-
112,
3460-
114,
3461-
124,
3462-
126,
3463-
128,
3464-
130,
3454+
58,
3455+
92,
3456+
95,
3457+
107,
3458+
109,
3459+
111,
3460+
113,
3461+
123,
3462+
125,
3463+
127,
3464+
129,
3465+
133,
34653466
134,
3466-
135,
3467-
139,
3468-
144,
3469-
150,
3467+
138,
3468+
143,
3469+
149,
3470+
155,
34703471
156,
3471-
157,
3472-
164,
3473-
169,
3474-
171,
3475-
179,
3476-
184,
3477-
189,
3478-
194,
3479-
199,
3480-
204,
3481-
209,
3482-
215,
3483-
220,
3484-
245,
3472+
163,
3473+
168,
3474+
170,
3475+
178,
3476+
183,
3477+
188,
3478+
193,
3479+
198,
3480+
203,
3481+
208,
3482+
214,
3483+
219,
3484+
244,
3485+
247,
34853486
248,
3486-
249,
3487-
253,
3488-
259,
3489-
264,
3490-
269,
3491-
274,
3492-
291,
3493-
298,
3487+
252,
3488+
258,
3489+
263,
3490+
268,
3491+
273,
3492+
290,
3493+
297,
3494+
304,
34943495
305,
3495-
306,
3496-
316,
3497-
324,
3498-
359,
3499-
412,
3496+
315,
3497+
323,
3498+
358,
3499+
411,
3500+
414,
35003501
415,
3501-
416,
3502-
421,
3503-
437,
3504-
441,
3505-
444,
3506-
447,
3507-
455,
3508-
462,
3509-
467,
3510-
472,
3502+
420,
3503+
436,
3504+
440,
3505+
443,
3506+
446,
3507+
454,
3508+
461,
3509+
466,
3510+
471,
3511+
476,
35113512
477,
3512-
478,
3513-
486,
3514-
490,
3515-
492,
3516-
496,
3513+
485,
3514+
489,
3515+
491,
3516+
495,
3517+
501,
35173518
502,
3518-
503,
3519-
511,
3520-
513,
3519+
510,
3520+
512,
3521+
523,
35213522
524,
35223523
525,
3523-
526,
3524-
533,
3524+
532,
3525+
534,
35253526
535,
3526-
536,
3527-
565,
3527+
564,
3528+
567,
35283529
568,
3529-
569,
3530-
572,
3531-
577,
3532-
582,
3533-
587,
3530+
571,
3531+
576,
3532+
581,
3533+
586,
3534+
591,
35343535
592,
3535-
593,
3536-
601,
3536+
600,
3537+
604,
35373538
605,
3538-
606,
3539-
612,
3539+
611,
3540+
622,
35403541
623,
3541-
624,
3542-
632,
3543-
638,
3544-
642,
3545-
644,
3542+
631,
3543+
637,
3544+
641,
3545+
643,
3546+
647,
35463547
648,
3547-
649,
3548-
663,
3548+
662,
3549+
671,
35493550
672,
3550-
673,
3551-
681
3551+
680
35523552
],
35533553
"com.google.guava:guava:src/com/google/common/collect/ComparatorOrdering.java": [
35543554
31,

its/ruling/src/test/resources/guava/java-S1135.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
167
7575
],
7676
"com.google.guava:guava:src/com/google/common/collect/Collections2.java": [
77-
89
77+
88
7878
],
7979
"com.google.guava:guava:src/com/google/common/collect/ComputingConcurrentHashMap.java": [
8080
353

its/ruling/src/test/resources/guava/java-S1166.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
60
3535
],
3636
"com.google.guava:guava:src/com/google/common/collect/Collections2.java": [
37-
111,
38-
113,
39-
127,
40-
129
37+
110,
38+
112,
39+
126,
40+
128
4141
],
4242
"com.google.guava:guava:src/com/google/common/collect/ConcurrentHashMultiset.java": [
4343
244

its/ruling/src/test/resources/guava/java-S1213.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
52
319319
],
320320
"com.google.guava:guava:src/com/google/common/collect/Collections2.java": [
321-
327
321+
326
322322
],
323323
"com.google.guava:guava:src/com/google/common/collect/ComparatorOrdering.java": [
324324
64

its/ruling/src/test/resources/guava/java-S1309.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
358
7474
],
7575
"com.google.guava:guava:src/com/google/common/collect/Collections2.java": [
76-
170
76+
169
7777
],
7878
"com.google.guava:guava:src/com/google/common/collect/ComparisonChain.java": [
7979
79

0 commit comments

Comments
 (0)