diff --git a/src/compiler/scala/tools/asm/LabelAccess.java b/src/compiler/scala/tools/asm/LabelAccess.java deleted file mode 100644 index 29ed302b4f7f..000000000000 --- a/src/compiler/scala/tools/asm/LabelAccess.java +++ /dev/null @@ -1,18 +0,0 @@ -package scala.tools.asm; - -/** - * Temporary class to allow access to the package-private status field of class Label. - */ -public class LabelAccess { - public static boolean isLabelFlagSet(Label l, int f) { - return (l.status & f) != 0; - } - - public static void setLabelFlag(Label l, int f) { - l.status |= f; - } - - public static void clearLabelFlag(Label l, int f) { - l.status &= ~f; - } -} diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala index 3839cb31a61f..59a64a9b338c 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala @@ -765,6 +765,8 @@ abstract class BTypes { // finds the first common one. // MOST LIKELY the answer can be found here, see the comments and links by Miguel: // - https://github.com/scala/bug/issues/3872 + // @jz Wouldn't it be better to walk the superclass chain of both types in reverse (starting from Object), and + // finding the last common link? That would be O(N), whereas this looks O(N^2) firstCommonSuffix(this :: this.superClassesTransitive.orThrow, other :: other.superClassesTransitive.orThrow) } diff --git a/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala b/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala index 1f1416ca970f..a76999a3d580 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala @@ -13,7 +13,7 @@ import scala.tools.asm import scala.tools.asm.Opcodes._ import scala.tools.asm.tree._ import scala.tools.asm.tree.analysis._ -import scala.tools.asm.{Handle, LabelAccess, Type} +import scala.tools.asm.{Handle, Label, Type} import scala.tools.nsc.backend.jvm.BTypes._ import scala.tools.nsc.backend.jvm.GenBCode._ import scala.tools.nsc.backend.jvm.analysis.BackendUtils._ @@ -587,9 +587,18 @@ object BackendUtils { def clearDceDone(method: MethodNode) = method.access &= ~ACC_DCE_DONE private val LABEL_REACHABLE_STATUS = 0x1000000 - def isLabelReachable(label: LabelNode) = LabelAccess.isLabelFlagSet(label.getLabel, LABEL_REACHABLE_STATUS) - def setLabelReachable(label: LabelNode) = LabelAccess.setLabelFlag(label.getLabel, LABEL_REACHABLE_STATUS) - def clearLabelReachable(label: LabelNode) = LabelAccess.clearLabelFlag(label.getLabel, LABEL_REACHABLE_STATUS) + private def isLabelFlagSet(l: Label, f: Int): Boolean = (l.flags & f) != 0 + + private def setLabelFlag(l: Label, f: Int): Unit = { + l.flags |= f + } + + private def clearLabelFlag(l: Label, f: Int): Unit = { + l.flags &= ~f + } + def isLabelReachable(label: LabelNode) = isLabelFlagSet(label.getLabel, LABEL_REACHABLE_STATUS) + def setLabelReachable(label: LabelNode) = setLabelFlag(label.getLabel, LABEL_REACHABLE_STATUS) + def clearLabelReachable(label: LabelNode) = clearLabelFlag(label.getLabel, LABEL_REACHABLE_STATUS) abstract class NestedClassesCollector[T] extends GenericSignatureVisitor { val innerClasses = mutable.Set.empty[T] diff --git a/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerImpl.scala b/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerImpl.scala index 34d96740321d..a00e8c65e82e 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerImpl.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerImpl.scala @@ -457,7 +457,7 @@ case class ParameterProducer(local: Int) case class UninitializedLocalProducer(local: Int) extends InitialProducer case class ExceptionProducer[V <: Value](handlerLabel: LabelNode, handlerStackTop: Int) extends InitialProducer -class InitialProducerSourceInterpreter extends SourceInterpreter { +class InitialProducerSourceInterpreter extends SourceInterpreter(scala.tools.asm.Opcodes.ASM7_EXPERIMENTAL) { override def newParameterValue(isInstanceMethod: Boolean, local: Int, tp: Type): SourceValue = { new SourceValue(tp.getSize, ParameterProducer(local)) } diff --git a/src/compiler/scala/tools/nsc/backend/jvm/analysis/TypeFlowInterpreter.scala b/src/compiler/scala/tools/nsc/backend/jvm/analysis/TypeFlowInterpreter.scala index bcf9978c164a..9bb79eae24dc 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/analysis/TypeFlowInterpreter.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/analysis/TypeFlowInterpreter.scala @@ -5,7 +5,7 @@ package analysis import scala.tools.asm.Type import scala.tools.asm.tree.analysis.{BasicValue, BasicInterpreter} -abstract class TypeFlowInterpreter extends BasicInterpreter { +abstract class TypeFlowInterpreter extends BasicInterpreter(scala.tools.asm.Opcodes.ASM7_EXPERIMENTAL) { override def newValue(tp: Type) = { if (tp == null) super.newValue(tp) else if (isRef(tp)) new BasicValue(tp) diff --git a/src/partest/scala/tools/partest/nest/StreamCapture.scala b/src/partest/scala/tools/partest/nest/StreamCapture.scala index be059e6d872f..b24a4f9c768e 100644 --- a/src/partest/scala/tools/partest/nest/StreamCapture.scala +++ b/src/partest/scala/tools/partest/nest/StreamCapture.scala @@ -41,7 +41,12 @@ object StreamCapture { def withExtraProperties[A](extra: Map[String, String])(action: => A): A = { val saved = System.getProperties() val modified = new java.util.Properties() - modified.putAll(saved) + // on Java 9, we need to cast our way around this: + // src/main/scala/scala/tools/partest/nest/StreamCapture.scala:44: ambiguous reference to overloaded definition, + // both method putAll in class Properties of type (x$1: java.util.Map[_, _])Unit + // and method putAll in class Hashtable of type (x$1: java.util.Map[_ <: Object, _ <: Object])Unit + // match argument types (java.util.Properties) + (modified: java.util.Hashtable[AnyRef, AnyRef]).putAll(saved) extra.foreach { case (k, v) => modified.setProperty(k, v) } // Trying to avoid other threads seeing the new properties object prior to the new entries // https://github.com/scala/scala/pull/6391#issuecomment-371346171 diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala index 9e8965435501..4e4fe594579c 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala @@ -1720,7 +1720,7 @@ class InlinerTest extends BytecodeTesting { """.stripMargin val warn = """T::m()I is annotated @inline but could not be inlined: - |The callee T::m()I contains the instruction INVOKESPECIAL T.impl$1 ()I + |The callee T::m()I contains the instruction INVOKESPECIAL T.impl$1 ()I (itf) |that would cause an IllegalAccessError when inlined into class C.""".stripMargin val List(a, c, t) = compileClasses(code, allowMessage = _.msg contains warn) assertInvoke(getMethod(c, "t"), "T", "m$") diff --git a/versions.properties b/versions.properties index ad86745dd7c6..b4c45b67db2a 100644 --- a/versions.properties +++ b/versions.properties @@ -7,5 +7,5 @@ starr.version=2.13.0-M4 # Other usages: # - scala-asm: jar content included in scala-compiler # - jline: shaded with JarJar and included in scala-compiler -scala-asm.version=6.0.0-scala-1 +scala-asm.version=6.2.0-scala-2 jline.version=2.14.6