"Error:scalac: Error: object VolatileFloatRef does not have a member create" when using Scala 2.11.8 SDK

"Error:scalac: Error: object VolatileFloatRef does not have a member create" when using Scala 2.11.8 SDK

当我在 IntelliJ 中切换到 Scala 2.11.8 SDK 时,在编译期间出现以下错误。当我在 IntelliJ 中使用相同代码的 2.10.6 SDK 时编译正常。

关于如何解决这个问题有什么想法吗?

Error:scalac: Error: object VolatileFloatRef does not have a member create
scala.reflect.internal.FatalError: object VolatileFloatRef does not have a member create
    at scala.reflect.internal.Definitions$DefinitionsClass.scala$reflect$internal$Definitions$DefinitionsClass$$fatalMissingSymbol(Definitions.scala:1186)
    at scala.reflect.internal.Definitions$DefinitionsClass.getMember(Definitions.scala:1203)
    at scala.reflect.internal.Definitions$DefinitionsClass.getMemberMethod(Definitions.scala:1238)
    at scala.tools.nsc.transform.LambdaLift$$anonfun$scala$tools$nsc$transform$LambdaLift$$refCreateMethod.apply(LambdaLift.scala:41)
    at scala.tools.nsc.transform.LambdaLift$$anonfun$scala$tools$nsc$transform$LambdaLift$$refCreateMethod.apply(LambdaLift.scala:41)
    at scala.reflect.internal.util.Collections$$anonfun$mapFrom.apply(Collections.scala:182)
    at scala.reflect.internal.util.Collections$$anonfun$mapFrom.apply(Collections.scala:182)
    at scala.collection.immutable.List.map(List.scala:273)
    at scala.reflect.internal.util.Collections$class.mapFrom(Collections.scala:182)
    at scala.reflect.internal.SymbolTable.mapFrom(SymbolTable.scala:16)
    at scala.tools.nsc.transform.LambdaLift.scala$tools$nsc$transform$LambdaLift$$refCreateMethod$lzycompute(LambdaLift.scala:41)
    at scala.tools.nsc.transform.LambdaLift.scala$tools$nsc$transform$LambdaLift$$refCreateMethod(LambdaLift.scala:40)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.postTransform(LambdaLift.scala:489)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:544)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:56)
    at scala.reflect.api.Trees$Transformer$$anonfun$transformStats.apply(Trees.scala:2589)
    at scala.reflect.api.Trees$Transformer$$anonfun$transformStats.apply(Trees.scala:2587)
    at scala.collection.immutable.List.loop(List.scala:173)
    at scala.collection.immutable.List.mapConserve(List.scala:189)
    at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2587)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:562)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:56)
    at scala.reflect.internal.Trees$class.itransform(Trees.scala:1366)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
    at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.scala$reflect$internal$Trees$UnderConstructionTransformer$$super$transform(ExplicitOuter.scala:219)
    at scala.reflect.internal.Trees$UnderConstructionTransformer$class.transform(Trees.scala:1705)
    at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:291)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:536)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:544)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:56)
    at scala.reflect.internal.Trees$$anonfun$itransform.apply(Trees.scala:1363)
    at scala.reflect.internal.Trees$$anonfun$itransform.apply(Trees.scala:1361)
    at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
    at scala.reflect.internal.Trees$class.itransform(Trees.scala:1360)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
    at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.scala$reflect$internal$Trees$UnderConstructionTransformer$$super$transform(ExplicitOuter.scala:219)
    at scala.reflect.internal.Trees$UnderConstructionTransformer$class.transform(Trees.scala:1705)
    at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:291)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:536)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:544)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:56)
    at scala.reflect.api.Trees$Transformer$$anonfun$transformStats.apply(Trees.scala:2589)
    at scala.reflect.api.Trees$Transformer$$anonfun$transformStats.apply(Trees.scala:2587)
    at scala.collection.immutable.List.loop(List.scala:173)
    at scala.collection.immutable.List.mapConserve(List.scala:189)
    at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2587)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:562)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:56)
    at scala.reflect.internal.Trees$class.itransform(Trees.scala:1404)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:40)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform.apply(TypingTransformers.scala:40)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform.apply(TypingTransformers.scala:40)
    at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:40)
    at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.scala$reflect$internal$Trees$UnderConstructionTransformer$$super$transform(ExplicitOuter.scala:219)
    at scala.reflect.internal.Trees$UnderConstructionTransformer$class.transform(Trees.scala:1705)
    at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:291)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:536)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:544)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:56)
    at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2563)
    at scala.reflect.internal.Trees$$anonfun$itransform.apply(Trees.scala:1408)
    at scala.reflect.internal.Trees$$anonfun$itransform.apply(Trees.scala:1407)
    at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
    at scala.reflect.internal.Trees$class.itransform(Trees.scala:1406)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
    at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.scala$reflect$internal$Trees$UnderConstructionTransformer$$super$transform(ExplicitOuter.scala:219)
    at scala.reflect.internal.Trees$UnderConstructionTransformer$class.transform(Trees.scala:1705)
    at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:291)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:536)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:544)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:56)
    at scala.reflect.api.Trees$Transformer$$anonfun$transformStats.apply(Trees.scala:2589)
    at scala.reflect.api.Trees$Transformer$$anonfun$transformStats.apply(Trees.scala:2587)
    at scala.collection.immutable.List.loop(List.scala:173)
    at scala.collection.immutable.List.mapConserve(List.scala:189)
    at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2587)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:562)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:56)
    at scala.reflect.internal.Trees$$anonfun$itransform.apply(Trees.scala:1426)
    at scala.reflect.internal.Trees$$anonfun$itransform.apply(Trees.scala:1426)
    at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
    at scala.reflect.internal.Trees$class.itransform(Trees.scala:1425)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:40)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform.apply(TypingTransformers.scala:42)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform.apply(TypingTransformers.scala:42)
    at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:42)
    at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.scala$reflect$internal$Trees$UnderConstructionTransformer$$super$transform(ExplicitOuter.scala:219)
    at scala.reflect.internal.Trees$UnderConstructionTransformer$class.transform(Trees.scala:1705)
    at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:291)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:536)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:544)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:56)
    at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:147)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.scala$tools$nsc$transform$LambdaLift$LambdaLifter$$super$transformUnit(LambdaLift.scala:568)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter$$anonfun$transformUnit.apply(LambdaLift.scala:568)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter$$anonfun$transformUnit.apply(LambdaLift.scala:568)
    at scala.reflect.internal.SymbolTable.enteringPhase(SymbolTable.scala:235)
    at scala.reflect.internal.SymbolTable.exitingPhase(SymbolTable.scala:256)
    at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformUnit(LambdaLift.scala:567)
    at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase.apply$mcV$sp(Global.scala:440)
    at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:431)
    at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:440)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$run.apply(Global.scala:398)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$run.apply(Global.scala:398)
    at scala.collection.Iterator$class.foreach(Iterator.scala:893)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
    at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:398)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1501)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1486)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1481)
    at scala.tools.nsc.Global$Run.compile(Global.scala:1582)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:115)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:94)
    at xsbt.CompilerInterface.run(CompilerInterface.scala:22)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
    at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:29)
    at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:26)
    at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:67)
    at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:24)
    at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)

原来我在 build.sbt 中有一个 scalaVersion 不匹配。一旦我更新它以使其成为 IntelliJ 中设置的 Scala SDK 的确切版本,错误就消失了。

遇到同样的问题,我确认它来自 Scala 版本不匹配。我只想补充一点(在我的例子中)我必须在 IntelliJ 中做:

right click on your project -> maven -> reimport

之后工作正常