Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

java.lang.IllegalAccessError: class org.sonarsource.scala.checks.DuplicateBranchScalaCheck$$Lambda$5577/0x00000008020cdb00 #200

Open
Gregory-Berkman-Imprivata opened this issue Sep 2, 2021 · 2 comments

Comments

@Gregory-Berkman-Imprivata
Copy link

Gregory-Berkman-Imprivata commented Sep 2, 2021

Seeing very strange error when running sonarqube in CI, not clear what could be causing it.

ran this command in CI:

sbt -Dsonar.pullrequest.branch=${GITHUB_REF#refs/heads/} -Dsonar.pullrequest.key=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") -Dsonar.pullrequest.base="main" -Dsonar.login="$SONAR_CI_TOKEN" "service/sonarScan"
java.lang.IllegalAccessError: class org.sonarsource.scala.checks.DuplicateBranchScalaCheck$$Lambda$5577/0x00000008020cdb00 tried to access protected method 'boolean org.sonarsource.slang.checks.DuplicateBranchCheck.spansMultipleLines(org.sonarsource.slang.api.Tree)' (org.sonarsource.scala.checks.DuplicateBranchScalaCheck$$Lambda$5577/0x00000008020cdb00 and org.sonarsource.slang.checks.DuplicateBranchCheck are in unnamed module of loader org.sonar.classloader.ClassRealm @77a5a495)
[error] 	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176)
[error] 	at java.base/java.util.stream.SliceOps$1$1.accept(SliceOps.java:199)
[error] 	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
[error] 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
[error] 	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
[error] 	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
[error] 	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
[error] 	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[error] 	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
[error] 	at org.sonarsource.scala.checks.DuplicateBranchScalaCheck.checkDuplicatedBranches(DuplicateBranchScalaCheck.java:50)
[error] 	at org.sonarsource.slang.checks.AbstractBranchDuplicationCheck.checkConditionalStructure(AbstractBranchDuplicationCheck.java:57)
[error] 	at org.sonarsource.slang.checks.AbstractBranchDuplicationCheck.lambda$initialize$1(AbstractBranchDuplicationCheck.java:49)
[error] 	at org.sonarsource.slang.plugin.ChecksVisitor$ContextAdapter.lambda$register$0(ChecksVisitor.java:68)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor$ConsumerFilter.accept(TreeVisitor.java:87)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor$ConsumerFilter.access$000(TreeVisitor.java:74)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.visit(TreeVisitor.java:50)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.lambda$visit$0(TreeVisitor.java:53)
[error] 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.visit(TreeVisitor.java:53)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.lambda$visit$0(TreeVisitor.java:53)
[error] 	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.visit(TreeVisitor.java:53)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.lambda$visit$0(TreeVisitor.java:53)
[error] 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.visit(TreeVisitor.java:53)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.lambda$visit$0(TreeVisitor.java:53)
[error] 	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.visit(TreeVisitor.java:53)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.lambda$visit$0(TreeVisitor.java:53)
[error] 	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.visit(TreeVisitor.java:53)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.lambda$visit$0(TreeVisitor.java:53)
[error] 	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.visit(TreeVisitor.java:53)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.lambda$visit$0(TreeVisitor.java:53)
[error] 	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.visit(TreeVisitor.java:53)
[error] 	at org.sonarsource.slang.visitors.TreeVisitor.scan(TreeVisitor.java:40)
[error] 	at org.sonarsource.slang.plugin.SlangSensor.lambda$analyseFile$1(SlangSensor.java:129)
[error] 	at org.sonarsource.slang.plugin.DurationStatistics.time(DurationStatistics.java:64)
[error] 	at org.sonarsource.slang.plugin.SlangSensor.analyseFile(SlangSensor.java:129)
[error] 	at org.sonarsource.slang.plugin.SlangSensor.analyseFiles(SlangSensor.java:91)
[error] 	at org.sonarsource.slang.plugin.SlangSensor.execute(SlangSensor.java:166)
[error] 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
[error] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
[error] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
[error] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
[error] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
[error] 	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
[error] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
[error] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
[error] 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:389)
[error] 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:385)
[error] 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:354)
[error] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
[error] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
[error] 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
[error] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
[error] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
[error] 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
[error] 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
[error] 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
[error] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
[error] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[error] 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
[error] 	at com.sun.proxy.$Proxy20.execute(Unknown Source)
[error] 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
[error] 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
[error] 	at sbtsonar.SonarPlugin$.useEmbeddedScanner(SonarPlugin.scala:253)
[error] 	at sbtsonar.SonarPlugin$.$anonfun$projectSettings$5(SonarPlugin.scala:110)
[error] 	at sbtsonar.SonarPlugin$.$anonfun$projectSettings$5$adapted(SonarPlugin.scala:84)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] 	at sbt.Execute.work(Execute.scala:291)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error] 	at java.base/java.lang.Thread.run(Thread.java:832)
[error] (service / sonarScan) java.lang.IllegalAccessError: class org.sonarsource.scala.checks.DuplicateBranchScalaCheck$$Lambda$5577/0x00000008020cdb00 tried to access protected method 'boolean org.sonarsource.slang.checks.DuplicateBranchCheck.spansMultipleLines(org.sonarsource.slang.api.Tree)' (org.sonarsource.scala.checks.DuplicateBranchScalaCheck$$Lambda$5577/0x00000008020cdb00 and org.sonarsource.slang.checks.DuplicateBranchCheck are in unnamed module of loader org.sonar.classloader.ClassRealm @77a5a495)

Any suggestions as to what could cause this?

@ikexq
Copy link

ikexq commented Jan 22, 2022

This is apparently related to the version of java in use by SBT. Encountered the exact issue, but downgrading from java 15 to 13 solved it for me.

@martinock
Copy link

martinock commented Sep 23, 2022

Seems like this is a Java version issue. This is the issue mentioned in JDK.

Since it was said that the issue affects 15-18, I think the solution is to upgrade your java version to >= 17 -- because the commits seems to be applied on version 17+ only -- or downgrade your java version to 13 like @ikexq did.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants