summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-12-19 11:53:59 +0100
committerSeth Tisue <seth@tisue.net>2017-01-27 09:29:13 -0800
commit27c10db549e6f43571663d0162b58fc04fbb34bf (patch)
tree855edd6dbdae7b4b44abacf39c7e59dc95378a5b /test/files/run
parentb9d4089d19ead36d07c2d6cdda283c9b678d515e (diff)
downloadscala-27c10db549e6f43571663d0162b58fc04fbb34bf.tar.gz
scala-27c10db549e6f43571663d0162b58fc04fbb34bf.tar.bz2
scala-27c10db549e6f43571663d0162b58fc04fbb34bf.zip
adjust to partest 1.1.0's new mixed Java/Scala compilation
upgrades partest from 1.0.17 to 1.1.0 https://github.com/scala/scala-partest/pull/69 changed the mode for mixed compilation, which used to be 1. scalac *.java *.scala -d o 2. javac *.java -d o -cp o 3. scalac *.scala -d o -cp o Now the third step is skipped. This required some adjustments to existing tests. - t7014 is split in two groups, the fix is for separate compilation. - t7582 is also split. It tests inliner warnings when inling code that accesses Java-defined package-private code. Inlining from Java only works in separate compilation (no bytecode available in mixed compilation). - Java compiler warnings of "run" tests were not reported in the old scheme, now they are. Deprecation / unchecked warnings were removed from t6240, t8786, varargs. - t4788 required a .check file update to pass, which hints at a bug. I will re-open SI-4788 and investigate later.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/bcodeInlinerMixed/B_1.scala14
-rw-r--r--test/files/run/bcodeInlinerMixed/Test.scala16
-rw-r--r--test/files/run/bcodeInlinerMixed/Test_2.scala30
-rw-r--r--test/files/run/t4788-separate-compilation.check4
-rw-r--r--test/files/run/t4788.check4
-rw-r--r--test/files/run/t6240a/StepOne.java2
-rw-r--r--test/files/run/t6240b/StepOne.java2
-rw-r--r--test/files/run/t7582.check4
-rw-r--r--test/files/run/t7582/InlineHolder_2.scala (renamed from test/files/run/t7582/InlineHolder.scala)2
-rw-r--r--test/files/run/t7582/PackageProtectedJava_1.java (renamed from test/files/run/t7582/PackageProtectedJava.java)2
-rw-r--r--test/files/run/t7582b.check4
-rw-r--r--test/files/run/t7582b/InlineHolder_2.scala (renamed from test/files/run/t7582b/InlineHolder.scala)2
-rw-r--r--test/files/run/t7582b/PackageProtectedJava_1.java (renamed from test/files/run/t7582b/PackageProtectedJava.java)2
13 files changed, 50 insertions, 38 deletions
diff --git a/test/files/run/bcodeInlinerMixed/B_1.scala b/test/files/run/bcodeInlinerMixed/B_1.scala
index 2aadeccb82..b26f2f1dd5 100644
--- a/test/files/run/bcodeInlinerMixed/B_1.scala
+++ b/test/files/run/bcodeInlinerMixed/B_1.scala
@@ -1,15 +1,13 @@
-// Partest does proper mixed compilation:
+// Since 1.0.18, partest does mixed compilation only in two stages
// 1. scalac *.scala *.java
// 2. javac *.java
-// 3. scalc *.scala
-//
-// In the second scalc round, the classfile for A_1 is on the classpath.
-// Therefore the inliner has access to the bytecode of `bar`, which means
-// it can verify that the invocation to `bar` can be safely inlined.
//
-// So both callsites of `flop` are inlined.
+// Before it used to do a third stage
+// 3. scalc *.scala
//
-// In a single mixed compilation, `flop` cannot be inlined, see JUnit InlinerTest.scala, def mixedCompilationNoInline.
+// Because he inliner doesn't has access to the bytecode of `bar`, it cannot verify whether the
+// invocation of `bar` can be safely copied to a differnet place, so `flop` is not inlined to `B.g`
+// or `C.h`.
class B {
@inline final def flop = A_1.bar
diff --git a/test/files/run/bcodeInlinerMixed/Test.scala b/test/files/run/bcodeInlinerMixed/Test.scala
deleted file mode 100644
index c8c7a9fe2a..0000000000
--- a/test/files/run/bcodeInlinerMixed/Test.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-import scala.tools.partest.{BytecodeTest, ASMConverters}
-import ASMConverters._
-
-object Test extends BytecodeTest {
- def show: Unit = {
- val gIns = instructionsFromMethod(getMethod(loadClassNode("B"), "g"))
- val hIns = instructionsFromMethod(getMethod(loadClassNode("C"), "h"))
- // val invocation = Invoke(INVOKESTATIC, A_1, bar, ()I, false)
- for (i <- List(gIns, hIns)) {
- assert(i exists {
- case Invoke(_, _, "bar", "()I", _) => true
- case _ => false
- }, i mkString "\n")
- }
- }
-}
diff --git a/test/files/run/bcodeInlinerMixed/Test_2.scala b/test/files/run/bcodeInlinerMixed/Test_2.scala
new file mode 100644
index 0000000000..db1ea14a8f
--- /dev/null
+++ b/test/files/run/bcodeInlinerMixed/Test_2.scala
@@ -0,0 +1,30 @@
+import scala.tools.partest.{BytecodeTest, ASMConverters}
+import ASMConverters._
+
+class D {
+ // This is compiled with `A_1.class` on the classpath. When inlining `flop` (which invokes
+ // `A_1.bar`), the inliner can check that the call to `A_1.bar` can be safely inlined into a
+ // different classfile (D). See also comment in B_1.scala.
+ def m(b: B) = b.flop
+}
+
+object Test extends BytecodeTest {
+ def show: Unit = {
+ val gIns = instructionsFromMethod(getMethod(loadClassNode("B"), "g"))
+ val hIns = instructionsFromMethod(getMethod(loadClassNode("C"), "h"))
+ for (i <- List(gIns, hIns)) {
+ assert(i exists {
+ // `flop` is not inlined
+ case Invoke(_, _, "flop", "()I", _) => true
+ case _ => false
+ }, i mkString "\n")
+ }
+
+ val mIns = instructionsFromMethod(getMethod(loadClassNode("D"), "m"))
+ assert(mIns exists {
+ // `flop` is inlined, we get a call to `bar`
+ case Invoke(_, _, "bar", "()I", _) => true
+ case _ => false
+ }, mIns mkString "\n")
+ }
+}
diff --git a/test/files/run/t4788-separate-compilation.check b/test/files/run/t4788-separate-compilation.check
index 172ad90102..618fddfea3 100644
--- a/test/files/run/t4788-separate-compilation.check
+++ b/test/files/run/t4788-separate-compilation.check
@@ -1,5 +1,5 @@
Some(@Ljava/lang/Deprecated;())
None
-None
-Some(@LCAnnotation;() // invisible)
+Some(@LSAnnotation;())
+Some(@LCAnnotation;())
Some(@LRAnnotation;())
diff --git a/test/files/run/t4788.check b/test/files/run/t4788.check
index 172ad90102..618fddfea3 100644
--- a/test/files/run/t4788.check
+++ b/test/files/run/t4788.check
@@ -1,5 +1,5 @@
Some(@Ljava/lang/Deprecated;())
None
-None
-Some(@LCAnnotation;() // invisible)
+Some(@LSAnnotation;())
+Some(@LCAnnotation;())
Some(@LRAnnotation;())
diff --git a/test/files/run/t6240a/StepOne.java b/test/files/run/t6240a/StepOne.java
index 342d617c79..a9c076c000 100644
--- a/test/files/run/t6240a/StepOne.java
+++ b/test/files/run/t6240a/StepOne.java
@@ -31,7 +31,7 @@ public class StepOne {
// launch StepTwo
URL[] launchURLs = new URL[launchPaths.length];
for (int i = 0; i < launchPaths.length; i++) {
- launchURLs[i] = new File(launchPaths[i]).toURL();
+ launchURLs[i] = new File(launchPaths[i]).toURI().toURL();
}
URLClassLoader classLoader = new URLClassLoader(launchURLs, Object.class.getClassLoader());
Class<?> stepTwo = classLoader.loadClass("StepTwo");
diff --git a/test/files/run/t6240b/StepOne.java b/test/files/run/t6240b/StepOne.java
index 342d617c79..a9c076c000 100644
--- a/test/files/run/t6240b/StepOne.java
+++ b/test/files/run/t6240b/StepOne.java
@@ -31,7 +31,7 @@ public class StepOne {
// launch StepTwo
URL[] launchURLs = new URL[launchPaths.length];
for (int i = 0; i < launchPaths.length; i++) {
- launchURLs[i] = new File(launchPaths[i]).toURL();
+ launchURLs[i] = new File(launchPaths[i]).toURI().toURL();
}
URLClassLoader classLoader = new URLClassLoader(launchURLs, Object.class.getClassLoader());
Class<?> stepTwo = classLoader.loadClass("StepTwo");
diff --git a/test/files/run/t7582.check b/test/files/run/t7582.check
index 58d0f19f5d..d0a0975d4c 100644
--- a/test/files/run/t7582.check
+++ b/test/files/run/t7582.check
@@ -1,5 +1,5 @@
-InlineHolder.scala:9: warning: p1/InlineHolder$::inlinable()I is annotated @inline but could not be inlined:
-The callee p1/InlineHolder$::inlinable()I contains the instruction INVOKESTATIC p1/PackageProtectedJava.protectedMethod ()I
+InlineHolder_2.scala:9: warning: p1/InlineHolder$::inlinable()I is annotated @inline but could not be inlined:
+The callee p1/InlineHolder$::inlinable()I contains the instruction INVOKESTATIC p1/PackageProtectedJava_1.protectedMethod ()I
that would cause an IllegalAccessError when inlined into class O$.
def x = p1.InlineHolder.inlinable
^
diff --git a/test/files/run/t7582/InlineHolder.scala b/test/files/run/t7582/InlineHolder_2.scala
index a18b9effaa..44c68d49b9 100644
--- a/test/files/run/t7582/InlineHolder.scala
+++ b/test/files/run/t7582/InlineHolder_2.scala
@@ -1,6 +1,6 @@
package p1 {
object InlineHolder {
- @inline def inlinable = p1.PackageProtectedJava.protectedMethod() + 1
+ @inline def inlinable = p1.PackageProtectedJava_1.protectedMethod() + 1
}
}
diff --git a/test/files/run/t7582/PackageProtectedJava.java b/test/files/run/t7582/PackageProtectedJava_1.java
index b7ea2a7676..a3a957dad8 100644
--- a/test/files/run/t7582/PackageProtectedJava.java
+++ b/test/files/run/t7582/PackageProtectedJava_1.java
@@ -1,6 +1,6 @@
package p1;
// public class, protected method
-public class PackageProtectedJava {
+public class PackageProtectedJava_1 {
static final int protectedMethod() { return 1; }
}
diff --git a/test/files/run/t7582b.check b/test/files/run/t7582b.check
index 58d0f19f5d..d0a0975d4c 100644
--- a/test/files/run/t7582b.check
+++ b/test/files/run/t7582b.check
@@ -1,5 +1,5 @@
-InlineHolder.scala:9: warning: p1/InlineHolder$::inlinable()I is annotated @inline but could not be inlined:
-The callee p1/InlineHolder$::inlinable()I contains the instruction INVOKESTATIC p1/PackageProtectedJava.protectedMethod ()I
+InlineHolder_2.scala:9: warning: p1/InlineHolder$::inlinable()I is annotated @inline but could not be inlined:
+The callee p1/InlineHolder$::inlinable()I contains the instruction INVOKESTATIC p1/PackageProtectedJava_1.protectedMethod ()I
that would cause an IllegalAccessError when inlined into class O$.
def x = p1.InlineHolder.inlinable
^
diff --git a/test/files/run/t7582b/InlineHolder.scala b/test/files/run/t7582b/InlineHolder_2.scala
index a18b9effaa..44c68d49b9 100644
--- a/test/files/run/t7582b/InlineHolder.scala
+++ b/test/files/run/t7582b/InlineHolder_2.scala
@@ -1,6 +1,6 @@
package p1 {
object InlineHolder {
- @inline def inlinable = p1.PackageProtectedJava.protectedMethod() + 1
+ @inline def inlinable = p1.PackageProtectedJava_1.protectedMethod() + 1
}
}
diff --git a/test/files/run/t7582b/PackageProtectedJava.java b/test/files/run/t7582b/PackageProtectedJava_1.java
index 55a44b79f9..42a2019b91 100644
--- a/test/files/run/t7582b/PackageProtectedJava.java
+++ b/test/files/run/t7582b/PackageProtectedJava_1.java
@@ -1,6 +1,6 @@
package p1;
// protected class, public method
-class PackageProtectedJava {
+class PackageProtectedJava_1 {
public static final int protectedMethod() { return 1; }
}