Sonarqube Gradle plugin - CollectorsToListCheck: java.lang.IndexOutOfBoundsException: Index: 0

Running the sonar Gradle task produces the following:

Unable to run check class org.sonar.java.checks.CollectorsToListCheck - S6204 on file 'support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/SamlRegisteredServiceMetadataAdaptor.java', To help improve the SonarSource Java Analyzer, please report this problem to SonarSource: see https://community.sonarsource.com/
java.lang.IndexOutOfBoundsException: Index: 0
	at java.base/java.util.Collections$EmptyList.get(Collections.java:4807)
	at org.sonar.java.checks.CollectorsToListCheck.isInvariantTypeArgument(CollectorsToListCheck.java:110)
	at org.sonar.java.checks.CollectorsToListCheck.onMethodInvocationFound(CollectorsToListCheck.java:95)
	at org.sonar.java.checks.methods.AbstractMethodDetection.visitNode(AbstractMethodDetection.java:45)
	at org.sonar.java.model.VisitorsBridge$IssuableSubscriptionVisitorsRunner.lambda$visit$6(VisitorsBridge.java:452)
	at org.sonar.java.model.VisitorsBridge$IssuableSubscriptionVisitorsRunner.lambda$forEach$9(VisitorsBridge.java:468)
  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Sonarqube Gradle plugin: 5.0.0.4638 with JDK 21

Gradle:

------------------------------------------------------------
Gradle 8.7
------------------------------------------------------------

Build time:   2024-03-22 15:52:46 UTC
Revision:     650af14d7653aa949fce5e886e685efc9cf97c10

Kotlin:       1.9.22
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          21 (Oracle Corporation 21+35-2513)
OS:           Mac OS X 14.4.1 aarch64

Gradle task:

./gradlew sonar --build-cache --configure-on-demand --no-daemon -DskipAot=true --parallel \
    -x javadoc -Dsonar.login="${SONARCLOUD_TOKEN}" -DskipNestedConfigMetadataGen=true -Dverbose=true \
    -Dsonar.coverage.jacoco.xmlReportPaths=./build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml

Hey ther.e

Just to confirm – you’re actually connecting to SonarCloud, not a self-hosted SonarQube instance?

Can you provide a copy of support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/SamlRegisteredServiceMetadataAdaptor.java?

Correct. This is SonarCloud.

Here is the file:

Hello @mmoayyed

Thanks for the report. As the project is open source, I was able to reproduce the issue relatively easily and can confirm that there is an issue with how the lombok val feature is (not) supported by rule S6204.

I’ve created a ticket, where you can follow the progress of this issue.

1 Like

Thank you. It appears that my account may not have enough permissions to watch the JIRA, and I’ll check back periodically.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.