Running a SonarCloud code analysis through Azure DevOps results in some unpleasant errors when using openjdk-11 (Java 10.0.2):
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/opt/vsts-agent/.sonar/cache/e62315a34b56db679102b0a9639a11d9/sonar-scanner-engine-shaded-developer-7.7.0.22010-all.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
The analysis process works as intended, but the errors are alarming to viewers.
Using Azul Java 1.8.0_202 does not alarm to those deprecated operations, but is unfortunately not an option for us.
Any guidance as to the recommended JDK for code analysis through a CI tool?
I’m still seeing this issue with Java11, Sonar 7.9.1, and SonarC# 7.15. However, it appears protobuf might have this issue fixed based on the github link above?
Reviving topic, because the protobuf fix hasn’t reached sonar-maven-plugin:3.9.1.2184
Apparently this was fixed in Protocol Buffers v3.7.0 released 28 Feb 2019
The issue was tracked as issue #3781
Are you using SonarQube (if so, what version?) or SonarCloud? What exactly are you seeing in the logs? Such warnings should have been suppressed by now.
If I run mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar
on this, it works, but I see some WARNINGS on stderr:
...
[INFO] Executing post-job 'Forbidden Configuration Breaker'
[INFO] Executing post-job 'Quality Gate Breaker'
[INFO] Waiting for report processing to complete...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/C:/Users/Foobar/.sonar/cache/7e63d042b87426eb4623b4e172f5f812/sonar-buildbreaker-plugin.jar_unzip/META-INF/lib/protobuf-java-3.5.1.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Quality gate status: ERROR
[ERROR] Coverage on New Code: 0.0 < 80
[ERROR] [BUILD BREAKER] Project did not meet 1 conditions