bug icon indicating copy to clipboard operation
bug copied to clipboard

scala.reflect.internal.FatalError: class Object does not have a method getClass

Open tgodzik opened this issue 1 year ago • 16 comments

I am raising it here because I have no idea how this can happen. Restarting the presentation compiler doesn't help only restarting the whole JVM does. It's also not possible to reproduce it reliably.

What is more when debugging I managed at some point to find that getClass did exist, but it had no flags at all. Anyone has any idea how it's possible? Any hints or debugging advice would be welcome

Reproduction steps

I can't reproduce it reliably and it seems to happen more often a time especially on latests metals with 2.13.15.

Problem

Presentation compiler stops being possible to use

Error stacktrace:

scala.reflect.internal.Definitions$DefinitionsClass.fatalMissingSymbol(Definitions.scala:1422)
	scala.reflect.internal.Definitions$DefinitionsClass.miss$1(Definitions.scala:1475)
	scala.reflect.internal.Definitions$DefinitionsClass.$anonfun$getMemberMethod$2(Definitions.scala:1477)
	scala.reflect.internal.Definitions$DefinitionsClass.getMemberMethod(Definitions.scala:1477)
	scala.reflect.internal.Definitions$DefinitionsClass.Any_getClass$lzycompute(Definitions.scala:1181)
	scala.reflect.internal.Definitions$DefinitionsClass.Any_getClass(Definitions.scala:1181)
	scala.reflect.internal.Definitions$DefinitionsClass.syntheticCoreMethods$lzycompute(Definitions.scala:1589)
	scala.reflect.internal.Definitions$DefinitionsClass.syntheticCoreMethods(Definitions.scala:1583)
	scala.reflect.internal.Definitions$DefinitionsClass.symbolsNotPresentInBytecode$lzycompute(Definitions.scala:1614)
	scala.reflect.internal.Definitions$DefinitionsClass.symbolsNotPresentInBytecode(Definitions.scala:1614)
	scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1669)
	scala.tools.nsc.Global$Run.<init>(Global.scala:1263)
	scala.tools.nsc.interactive.Global$TyperRun.<init>(Global.scala:1351)
	scala.tools.nsc.interactive.Global.newTyperRun(Global.scala:1374)
	scala.tools.nsc.interactive.Global.<init>(Global.scala:294)
	scala.meta.internal.pc.MetalsGlobal.<init>(MetalsGlobal.scala:44)
	scala.meta.internal.pc.ScalaPresentationCompiler.newCompiler(ScalaPresentationCompiler.scala:522)

scalac options

-Yrangepos -Wunused -Xsource:3 -Wconf:msg=in anonymous function is never used:silent -Wconf:src=*.BasePCSuite.scala&msg=parameter (scalaVersion|classpath) in method (extraDependencies|scalacOptions):silent -Wconf:src=*.CodeLens.scala&msg=parameter (textDocumentWithPath|path) in method codeLenses is never used:silent -Wconf:src=*.Completions.scala&msg=parameter (member|m) in method (isCandidate|isPrioritized):silent -Wconf:src=*.JavaMtags.scala&msg=parameter (ctor|method) in method (visitConstructor|visitMethod):silent -Wconf:src=*.MtagsIndexer.scala&msg=parameter owner in method visitOccurrence:silent -Wconf:src=*.ScaladocParser.scala&msg=parameter (pos|message) in method reportError:silent -Wconf:src=*.TreeViewProvider.scala&msg=parameter params in method (children|parent) is never used:silent -Wconf:src=*.InheritanceContext.scala&msg=parameter ec in method getLocations is never used:silent -Wconf:src=*.CompilerWrapper.scala&msg=parameter params in method compiler is never used:silent -Wconf:src=.*(CompletionProvider|ArgCompletions|Completions|Keywords|IndentOnPaste).scala&msg=The outer reference:silent -Xplugin-require:semanticdb -release 17

classpath

<WORKSPACE>/tests/unit/src/test/resources [exists ], <WORKSPACE>/.bloop/unit/bloop-bsp-clients-classes/test-classes-Metals-hsGx1FlFQIGvtTBJOnsNXA== [exists ], <HOME>/.cache/bloop/semanticdb/com.sourcegraph.semanticdb-javac.0.10.3/semanticdb-javac-0.10.3.jar [exists ], <WORKSPACE>/tests/unit/target/scala-2.13/resource_managed/main [exists ], <WORKSPACE>/.bloop/unit/bloop-bsp-clients-classes/classes-Metals-hsGx1FlFQIGvtTBJOnsNXA== [exists ], <WORKSPACE>/.bloop/mtest/bloop-bsp-clients-classes/classes-Metals-hsGx1FlFQIGvtTBJOnsNXA== [exists ], <WORKSPACE>/mtags/src/main/resources [exists ], <WORKSPACE>/.bloop/mtags/bloop-bsp-clients-classes/classes-Metals-hsGx1FlFQIGvtTBJOnsNXA== [exists ], <WORKSPACE>/.bloop/mtagsShared/bloop-bsp-clients-classes/classes-Metals-hsGx1FlFQIGvtTBJOnsNXA== [exists ], <WORKSPACE>/.bloop/interfaces/bloop-bsp-clients-classes/classes-Metals-hsGx1FlFQIGvtTBJOnsNXA== [exists ], <WORKSPACE>/metals/src/main/resources [exists ], <WORKSPACE>/.bloop/metals/bloop-bsp-clients-classes/classes-Metals-hsGx1FlFQIGvtTBJOnsNXA== [exists ], <WORKSPACE>/.bloop/mtags-java/bloop-bsp-clients-classes/classes-Metals-hsGx1FlFQIGvtTBJOnsNXA== [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.15/scala-library-2.13.15.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/coursier_2.13/2.1.14/coursier_2.13-2.1.14.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/ch/epfl/scala/bloop-config_2.13/2.0.3/bloop-config_2.13-2.0.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/munit_2.13/1.0.2/munit_2.13-1.0.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/interface/1.0.21/interface-1.0.21.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/jdt/org.eclipse.jdt.core/3.25.0/org.eclipse.jdt.core-3.25.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.ant.core/3.5.500/org.eclipse.ant.core-3.5.500.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.compare.core/3.6.600/org.eclipse.compare.core-3.6.600.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.core.commands/3.9.500/org.eclipse.core.commands-3.9.500.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.core.contenttype/3.7.500/org.eclipse.core.contenttype-3.7.500.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.core.expressions/3.6.500/org.eclipse.core.expressions-3.6.500.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.core.filesystem/1.7.500/org.eclipse.core.filesystem-1.7.500.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.core.jobs/3.10.500/org.eclipse.core.jobs-3.10.500.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.core.resources/3.13.500/org.eclipse.core.resources-3.13.500.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.core.runtime/3.16.0/org.eclipse.core.runtime-3.16.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.core.variables/3.4.600/org.eclipse.core.variables-3.4.600.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.equinox.app/1.4.300/org.eclipse.equinox.app-1.4.300.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.equinox.common/3.10.600/org.eclipse.equinox.common-3.10.600.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.equinox.preferences/3.7.600/org.eclipse.equinox.preferences-3.7.600.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.equinox.registry/3.8.600/org.eclipse.equinox.registry-3.8.600.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.osgi/3.15.0/org.eclipse.osgi-3.15.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.team.core/3.8.700/org.eclipse.team.core-3.8.700.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.text/3.9.0/org.eclipse.text-3.9.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/google/guava/guava/33.3.1-jre/guava-33.3.1-jre.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/metaconfig-core_2.13/0.13.0/metaconfig-core_2.13-0.13.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openjdk/jol/jol-core/0.17/jol-core-0.17.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/swoval/file-tree-views/2.1.12/file-tree-views-2.1.12.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/undertow/undertow-core/2.2.20.Final/undertow-core-2.2.20.Final.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jboss/xnio/xnio-nio/3.8.16.Final/xnio-nio-3.8.16.Final.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/flywaydb/flyway-core/10.19.0/flyway-core-10.19.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/h2database/h2/2.3.232/h2-2.3.232.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-sbt/ipcsocket/ipcsocket/1.6.2/ipcsocket-1.6.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/ch/epfl/scala/bsp4j/2.2.0-M2/bsp4j-2.2.0-M2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/ch/epfl/scala/bloop-rifle_2.13/2.0.3/bloop-rifle_2.13-2.0.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/lsp4j/org.eclipse.lsp4j/0.23.1/org.eclipse.lsp4j-0.23.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/lsp4j/org.eclipse.lsp4j.debug/0.23.1/org.eclipse.lsp4j.debug-0.23.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/ch/epfl/scala/scala-debug-adapter_2.13/4.2.1/scala-debug-adapter_2.13-4.2.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/dev/dirs/directories/26/directories-26.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/mdoc-interfaces/2.6.1/mdoc-interfaces-2.6.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/scalafmt-dynamic_2.13/3.7.15/scalafmt-dynamic_2.13-3.7.15.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/ch/epfl/scala/scalafix-interfaces/0.13.0/scalafix-interfaces-0.13.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/coursier-sbt-maven-repository_2.13/2.1.14/coursier-sbt-maven-repository_2.13-2.1.14.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/outr/scribe_2.13/3.15.0/scribe_2.13-3.15.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/outr/scribe-file_2.13/3.15.0/scribe-file_2.13-3.15.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/outr/scribe-slf4j2_2.13/3.15.0/scribe-slf4j2_2.13-3.15.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/ujson_2.13/4.0.2/ujson_2.13-4.0.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/requests_2.13/0.9.0/requests_2.13-0.9.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/scalameta_2.13/4.10.1/scalameta_2.13-4.10.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/semanticdb-metap_2.13.15/4.10.1/semanticdb-metap_2.13.15-4.10.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/semanticdb-shared_2.13/4.10.1/semanticdb-shared_2.13-4.10.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/alexarchambault/ammonite/ammonite-runner_2.13/0.4.0/ammonite-runner_2.13-0.4.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-xml_2.13/2.3.0/scala-xml_2.13-2.3.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-parallel-collections_2.13/1.0.4/scala-parallel-collections_2.13-1.0.4.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/virtuslab/scala-cli/scala-cli-bsp/1.5.0/scala-cli-bsp-1.5.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/plokhotnyuk/jsoniter-scala/jsoniter-scala-core_2.13/2.13.5.2/jsoniter-scala-core_2.13-2.13.5.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/coursier-core_2.13/2.1.14/coursier-core_2.13-2.1.14.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/coursier-cache_2.13/2.1.14/coursier-cache_2.13-2.1.14.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/coursier-proxy-setup/2.1.14/coursier-proxy-setup-2.1.14.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/unroll-annotation_2.13/0.1.12/unroll-annotation_2.13-0.1.12.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/junit-interface/1.0.2/junit-interface-1.0.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/munit-diff_2.13/1.0.2/munit-diff_2.13-1.0.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/geny_2.13/1.1.1/geny_2.13-1.1.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/thoughtworks/qdox/qdox/2.1.0/qdox-2.1.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-java8-compat_2.13/1.0.2/scala-java8-compat_2.13-1.0.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jsoup/jsoup/1.18.1/jsoup-1.18.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/lz4/lz4-java/1.8.0/lz4-java-1.8.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/googlecode/java-diff-utils/diffutils/1.3.0/diffutils-1.3.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/semanticdb-scalac-core_2.13.15/4.10.1/semanticdb-scalac-core_2.13.15-4.10.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/pprint_2.13/0.7.3/pprint_2.13-0.7.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.13/slf4j-api-2.0.13.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.2/failureaccess-1.0.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/checkerframework/checker-qual/3.43.0/checker-qual-3.43.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.28.0/error_prone_annotations-2.28.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/3.0.0/j2objc-annotations-3.0.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/metaconfig-pprint_2.13/0.13.0/metaconfig-pprint_2.13-0.13.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/typelevel/paiges-core_2.13/0.4.4/paiges-core_2.13-0.4.4.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_2.13/2.12.0/scala-collection-compat_2.13-2.12.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.13.15/scala-reflect-2.13.15.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jboss/xnio/xnio-api/3.8.16.Final/xnio-api-3.8.16.Final.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jboss/threads/jboss-threads/3.1.0.Final/jboss-threads-3.1.0.Final.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-toml/2.15.2/jackson-dataformat-toml-2.15.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.15.2/jackson-datatype-jsr310-2.15.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.12.0/jna-platform-5.12.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/lsp4j/org.eclipse.lsp4j.generator/0.20.1/org.eclipse.lsp4j.generator-0.20.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/lsp4j/org.eclipse.lsp4j.jsonrpc/0.23.1/org.eclipse.lsp4j.jsonrpc-0.23.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/ch/epfl/scala/libdaemon_2.13/0.0.12/libdaemon_2.13-0.0.12.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/alexarchambault/scala-cli/snailgun/snailgun-core_2.13/0.4.1-sc2/snailgun-core_2.13-0.4.1-sc2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/lsp4j/org.eclipse.lsp4j.jsonrpc.debug/0.23.1/org.eclipse.lsp4j.jsonrpc.debug-0.23.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/ch/epfl/scala/com-microsoft-java-debug-core/0.34.0%2B32/com-microsoft-java-debug-core-0.34.0%2B32.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/ow2/asm/asm/9.7/asm-9.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/ow2/asm/asm-util/9.7/asm-util-9.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-sbt/test-agent/1.10.1/test-agent-1.10.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/parsers_2.13/4.10.1/parsers_2.13-4.10.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/scalafmt-interfaces/3.7.15/scalafmt-interfaces-3.7.15.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/typesafe/config/1.4.2/config-1.4.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/outr/perfolation_2.13/1.2.11/perfolation_2.13-1.2.11.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/sourcecode_2.13/0.4.2/sourcecode_2.13-0.4.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/outr/moduload_2.13/1.1.7/moduload_2.13-1.1.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_2.13/4.0.2/upickle-core_2.13-4.0.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scalap/2.13.15/scalap-2.13.15.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/thesamet/scalapb/scalapb-runtime_2.13/0.11.15/scalapb-runtime_2.13-0.11.15.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/coursier-launcher_2.13/2.0.16/coursier-launcher_2.13-2.0.16.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/alexarchambault/concurrent-reference-hash-map/1.1.0/concurrent-reference-hash-map-1.1.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/coursier-util_2.13/2.1.14/coursier-util_2.13-2.1.14.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/get-coursier/jniutils/windows-jni-utils/0.3.3/windows-jni-utils-0.3.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/codehaus/plexus/plexus-archiver/4.9.0/plexus-archiver-4.9.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/codehaus/plexus/plexus-container-default/2.1.1/plexus-container-default-2.1.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/virtuslab/scala-cli/config_2.13/0.2.1/config_2.13-0.2.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/alexarchambault/windows-ansi/windows-ansi/0.0.5/windows-ansi-0.0.5.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/google/protobuf/protobuf-java/4.28.2/protobuf-java-4.28.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.15/scala-compiler-2.13.15.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/fansi_2.13/0.5.0/fansi_2.13-0.5.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/wildfly/common/wildfly-common/1.5.4.Final/wildfly-common-1.5.4.Final.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.15.2/jackson-databind-2.15.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.15.2/jackson-core-2.15.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.15.2/jackson-annotations-2.15.2.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/xtend/org.eclipse.xtend.lib/2.28.0/org.eclipse.xtend.lib-2.28.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/google/code/gson/gson/2.11.0/gson-2.11.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.17.0/commons-lang3-3.17.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/reactivex/rxjava2/rxjava/2.2.21/rxjava-2.2.21.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/commons-io/commons-io/2.16.1/commons-io-2.16.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/ow2/asm/asm-tree/9.7/asm-tree-9.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/ow2/asm/asm-analysis/9.7/asm-analysis-9.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/trees_2.13/4.10.1/trees_2.13-4.10.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/thesamet/scalapb/lenses_2.13/0.11.15/lenses_2.13-0.11.15.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/4.0.0/plexus-utils-4.0.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/codehaus/plexus/plexus-io/3.4.1/plexus-io-3.4.1.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/commons/commons-compress/1.24.0/commons-compress-1.24.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/iq80/snappy/snappy/0.4/snappy-0.4.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/tukaani/xz/1.9/xz-1.9.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/luben/zstd-jni/1.5.5-10/zstd-jni-1.5.5-10.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/codehaus/plexus/plexus-classworlds/2.6.0/plexus-classworlds-2.6.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/apache/xbean/xbean-reflect/3.7/xbean-reflect-3.7.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.18/jansi-1.18.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/io/github/java-diff-utils/java-diff-utils/4.12/java-diff-utils-4.12.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/jline/jline/3.26.3/jline-3.26.3.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/xtext/org.eclipse.xtext.xbase.lib/2.28.0/org.eclipse.xtext.xbase.lib-2.28.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/eclipse/xtend/org.eclipse.xtend.lib.macro/2.28.0/org.eclipse.xtend.lib.macro-2.28.0.jar [exists ], <HOME>/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/common_2.13/4.10.1/common_2.13-4.10.1.jar [exists ]

More about it in https://github.com/scalameta/metals/issues/5272

tgodzik avatar Oct 11 '24 06:10 tgodzik

So we fail in

    def getMemberMethod(owner: Symbol, name: Name): TermSymbol = {
      def miss = fatalMissingSymbol(owner, name, "method")
      getMember(owner, name.toTermName) match {
        case x: TermSymbol => x.filter(_.isMethod).orElse(miss).asInstanceOf[TermSymbol] // <<<< `miss`
        case _             => miss
      }
    }

where owner is ObjectClass, name is getClass, some x: TermSymbol is found but isMethod is false.

I have to look a bit closer how interactive.Global does things, I think it creates new a global.Run often. Symbol instances (like ObjectClass or the TermSymbol for getClass) are kept between compiler runs, but they go through adaptToNewRunMap i think. I thought maybe there's something wrong there, maybe some missing lock and a race.

But if "Restarting the presentation compiler doesn't help" that sounds like a different cause...

lrytz avatar Oct 14 '24 15:10 lrytz

I started getting it more often now, so I will try and connect debugger again.

tgodzik avatar Oct 14 '24 19:10 tgodzik

Which repo..? Does it happen randomly, or only after longer sessions?

lrytz avatar Oct 15 '24 10:10 lrytz

In the scalameta/metals repository, but some people reported it happen in other repositories. It seems to happen quite randomly, but at that point everything is broken.

Might be connected to regenerating bloop config or switching branches a lot, but I could not make it reliably reproduce

tgodzik avatar Oct 15 '24 11:10 tgodzik

Ok it seems, everything in java.lang package has error type. Is it possible it's all due to using -release 17 flag ? It does seems to happen more if I have Metals running on a different version than defined for a project.

tgodzik avatar Oct 22 '24 06:10 tgodzik

Seems possible.. It still didn't reproduce for me. Being able to debug it would be great..

lrytz avatar Oct 22 '24 08:10 lrytz

I am trying out to run Metals on the same version as the project version to see if the problem ever happens without -release. If it doesn't break I will try to maybe run a test case multiple times to see if I am able to force it to break.

tgodzik avatar Oct 22 '24 09:10 tgodzik

Ok, so this is reproducible when -release flag is added, but it takes a while sometimes to happen. I will probably try some workarounds.

Btw. any idea where types might break when using -release? I can try to debug those places.

tgodzik avatar Oct 25 '24 14:10 tgodzik

I think this only happens with -release 17 I managed to reproduce it on a smaller project even.

The way to reproduce it locally if anyone has the time would be to do:

//> using scala 2.13.15
//> using options -release:17

object O {
  implicit def aString: String = "a"
  implicit def lengthOfString(implicit s: String): Int = s.length
  implicit def toLong(implicit i: Int): Long = i.toLong

  def toDouble(implicit l: Long): Double = l.toDouble

  def hello = {
    toDouble
  }

}

though I haven't managed to do it reliably.

tgodzik avatar Oct 28 '24 15:10 tgodzik

I did a workaround and now we remove -release flag for 17 and higher. Looks like that is the main culprit.

tgodzik avatar Oct 30 '24 08:10 tgodzik

Doesn't this lead to inconsistencies? E.g., when running on 21 with a project that uses -release 17, the presentation compiler would show API of 21 that's not there on 17.

I was hoping to take a look at this one but didn't yet manage to reproduce, and I don't have much time currenlty...

lrytz avatar Nov 11 '24 15:11 lrytz

It will show inconsistencies, but it's better than not showing anything at all 😅

No worries, it's a really weird one to reproduce, if you are able to point me to a specific part of code that might be responsible I can also just try to debug it myself once it breaks

tgodzik avatar Nov 11 '24 20:11 tgodzik

I have a suspicion that we have a similar issue in Scala 3 https://github.com/scala/scala3/issues/21947

Looks like that happens especially when compiling scala CLI from command line and from Metals at the same time. Though this should not happen, but is it possible that the state gets somehow corrupted?

tgodzik avatar Nov 14 '24 11:11 tgodzik

Is it possible that the cache here:

https://github.com/scala/scala/blob/360d5da544d84b821c40e4662ad08703b51a44e1/src/compiler/scala/tools/nsc/classpath/DirectoryClassPath.scala#L141

gets corrupted? And since it's an object it will only be fixed when we restart the virtual machine? Or we could create a new classloader, but not sure if the old one would be garbage collected

tgodzik avatar Dec 31 '24 16:12 tgodzik

Ok, so I think running close could help to clear those caches and we can see if that helps https://github.com/scalameta/metals/pull/7543/files

tgodzik avatar Jun 05 '25 14:06 tgodzik

Me and another person I work with saw this error often, but things have run much better since running the snapshot build after https://github.com/scalameta/metals/pull/7543 was merged  Thanks 🙏

christianharrington avatar Jun 23 '25 11:06 christianharrington

I too have not seen this in a while, and it was a daily occurrence before scalameta/metals#7543.

kubukoz avatar Jul 11 '25 23:07 kubukoz

Seems this is finally solved, thank you @tgodzik

lrytz avatar Jul 14 '25 13:07 lrytz

Looks like I still haven't fixed it, but clearing the caches manually actually works, so as a fallback I am doing a bit of reflection in https://github.com/scalameta/metals/pull/7697

tgodzik avatar Aug 05 '25 19:08 tgodzik