New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala 2.12.8 compiler does not work with "-opt:l:method" on JDK12+ #11372

Open
xuwei-k opened this Issue Jan 19, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@xuwei-k
Copy link

xuwei-k commented Jan 19, 2019

I think we should also upgrade to asm 7 (backport scala/scala#7384) if JDK12+ support in Scala 2.12.x.

package example

class Foo
$ java --version
openjdk 12-ea 2019-03-19
OpenJDK Runtime Environment (build 12-ea+28)
OpenJDK 64-Bit Server VM (build 12-ea+28, mixed mode, sharing)
$ scalac -version
Scala compiler version 2.12.8 -- Copyright 2002-2018, LAMP/EPFL and Lightbend, Inc.
$ scalac -opt:l:method Foo.scala
error: java.lang.IllegalArgumentException: Unsupported class file major version 56
	at scala.tools.asm.ClassReader.<init>(ClassReader.java:176)
	at scala.tools.asm.ClassReader.<init>(ClassReader.java:158)
	at scala.tools.asm.ClassReader.<init>(ClassReader.java:146)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.$anonfun$parseClass$1(ByteCodeRepository.scala:259)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.parseClass(ByteCodeRepository.scala:257)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.$anonfun$parsedClassNode$1(ByteCodeRepository.scala:72)
	at scala.collection.mutable.MapLike.getOrElseUpdate(MapLike.scala:209)
	at scala.collection.mutable.MapLike.getOrElseUpdate$(MapLike.scala:206)
	at scala.collection.mutable.AbstractMap.getOrElseUpdate(Map.scala:82)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.parsedClassNode(ByteCodeRepository.scala:72)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.classNode(ByteCodeRepository.scala:93)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.methodNode(ByteCodeRepository.scala:241)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.$anonfun$addMethod$2(CallGraph.scala:161)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.$anonfun$addMethod$2$adapted(CallGraph.scala:158)
	at scala.collection.Iterator.foreach(Iterator.scala:941)
	at scala.collection.Iterator.foreach$(Iterator.scala:941)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.addMethod(CallGraph.scala:158)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.$anonfun$addClass$1(CallGraph.scala:117)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.$anonfun$addClass$1$adapted(CallGraph.scala:117)
	at scala.collection.Iterator.foreach(Iterator.scala:941)
	at scala.collection.Iterator.foreach$(Iterator.scala:941)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
	at scala.collection.IterableLike.foreach(IterableLike.scala:74)
	at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
	at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.addClass(CallGraph.scala:117)
	at scala.tools.nsc.backend.jvm.PostProcessor.$anonfun$runGlobalOptimizations$5(PostProcessor.scala:125)
	at scala.tools.nsc.backend.jvm.PostProcessor.$anonfun$runGlobalOptimizations$5$adapted(PostProcessor.scala:123)
	at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:792)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:791)
	at scala.tools.nsc.backend.jvm.PostProcessor.$anonfun$runGlobalOptimizations$3(PostProcessor.scala:123)
	at scala.tools.nsc.backend.jvm.PostProcessor.$anonfun$runGlobalOptimizations$3$adapted(PostProcessor.scala:123)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at scala.tools.nsc.backend.jvm.PostProcessor.runGlobalOptimizations(PostProcessor.scala:123)
	at scala.tools.nsc.backend.jvm.GeneratedClassHandler$GlobalOptimisingGeneratedClassHandler.complete(GeneratedClassHandler.scala:93)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.$anonfun$run$1(GenBCode.scala:81)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:78)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1498)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1482)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1475)
	at scala.tools.nsc.Global$Run.compile(Global.scala:1598)
	at scala.tools.nsc.Driver.doCompile(Driver.scala:47)
	at scala.tools.nsc.MainClass.doCompile(Main.scala:32)
	at scala.tools.nsc.Driver.process(Driver.scala:67)
	at scala.tools.nsc.Driver.main(Driver.scala:80)
	at scala.tools.nsc.Main.main(Main.scala)
Exception in thread "main" java.lang.IllegalArgumentException: Unsupported class file major version 56
	at scala.tools.asm.ClassReader.<init>(ClassReader.java:176)
	at scala.tools.asm.ClassReader.<init>(ClassReader.java:158)
	at scala.tools.asm.ClassReader.<init>(ClassReader.java:146)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.$anonfun$parseClass$1(ByteCodeRepository.scala:259)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.parseClass(ByteCodeRepository.scala:257)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.$anonfun$parsedClassNode$1(ByteCodeRepository.scala:72)
	at scala.collection.mutable.MapLike.getOrElseUpdate(MapLike.scala:209)
	at scala.collection.mutable.MapLike.getOrElseUpdate$(MapLike.scala:206)
	at scala.collection.mutable.AbstractMap.getOrElseUpdate(Map.scala:82)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.parsedClassNode(ByteCodeRepository.scala:72)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.classNode(ByteCodeRepository.scala:93)
	at scala.tools.nsc.backend.jvm.opt.ByteCodeRepository.methodNode(ByteCodeRepository.scala:241)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.$anonfun$addMethod$2(CallGraph.scala:161)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.$anonfun$addMethod$2$adapted(CallGraph.scala:158)
	at scala.collection.Iterator.foreach(Iterator.scala:941)
	at scala.collection.Iterator.foreach$(Iterator.scala:941)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.addMethod(CallGraph.scala:158)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.$anonfun$addClass$1(CallGraph.scala:117)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.$anonfun$addClass$1$adapted(CallGraph.scala:117)
	at scala.collection.Iterator.foreach(Iterator.scala:941)
	at scala.collection.Iterator.foreach$(Iterator.scala:941)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
	at scala.collection.IterableLike.foreach(IterableLike.scala:74)
	at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
	at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
	at scala.tools.nsc.backend.jvm.opt.CallGraph.addClass(CallGraph.scala:117)
	at scala.tools.nsc.backend.jvm.PostProcessor.$anonfun$runGlobalOptimizations$5(PostProcessor.scala:125)
	at scala.tools.nsc.backend.jvm.PostProcessor.$anonfun$runGlobalOptimizations$5$adapted(PostProcessor.scala:123)
	at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:792)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:791)
	at scala.tools.nsc.backend.jvm.PostProcessor.$anonfun$runGlobalOptimizations$3(PostProcessor.scala:123)
	at scala.tools.nsc.backend.jvm.PostProcessor.$anonfun$runGlobalOptimizations$3$adapted(PostProcessor.scala:123)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at scala.tools.nsc.backend.jvm.PostProcessor.runGlobalOptimizations(PostProcessor.scala:123)
	at scala.tools.nsc.backend.jvm.GeneratedClassHandler$GlobalOptimisingGeneratedClassHandler.complete(GeneratedClassHandler.scala:93)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.$anonfun$run$1(GenBCode.scala:81)
	at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:78)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1498)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1482)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1475)
	at scala.tools.nsc.Global$Run.compile(Global.scala:1598)
	at scala.tools.nsc.Driver.doCompile(Driver.scala:47)
	at scala.tools.nsc.MainClass.doCompile(Main.scala:32)
	at scala.tools.nsc.Driver.process(Driver.scala:67)
	at scala.tools.nsc.Driver.main(Driver.scala:80)
	at scala.tools.nsc.Main.main(Main.scala)
@SethTisue

This comment has been minimized.

Copy link
Member

SethTisue commented Jan 21, 2019

tentatively marking as "blocker", for Lukas to at least assess, risk/reward-wise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment