summaryrefslogtreecommitdiff
path: root/test/files/run/sd275-java/Test.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-11-29 14:42:01 +1000
committerJason Zaugg <jzaugg@gmail.com>2016-11-29 14:48:58 +1000
commit51d851ce2e403201d99d236a4bafd5728edc754f (patch)
tree749dd8e62ce2875bd4101d454676b68c3caff422 /test/files/run/sd275-java/Test.scala
parentb47aaf6445afe4a6818c31a0ed10e680e6b82c24 (diff)
downloadscala-51d851ce2e403201d99d236a4bafd5728edc754f.tar.gz
scala-51d851ce2e403201d99d236a4bafd5728edc754f.tar.bz2
scala-51d851ce2e403201d99d236a4bafd5728edc754f.zip
SD-275 Further harden against refs to absentee classes
- Limit the strategy of unpickling an external reference to a module class to a lookup of the module var to non-stub owners in order to enable fall through to stub symbol creation. Fixes scala/scala-dev#275
Diffstat (limited to 'test/files/run/sd275-java/Test.scala')
-rw-r--r--test/files/run/sd275-java/Test.scala39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/files/run/sd275-java/Test.scala b/test/files/run/sd275-java/Test.scala
new file mode 100644
index 0000000000..84187527d2
--- /dev/null
+++ b/test/files/run/sd275-java/Test.scala
@@ -0,0 +1,39 @@
+import scala.tools.partest._
+import java.io.File
+
+object Test extends StoreReporterDirectTest {
+ def code = ???
+
+ def compileCode(code: String) = {
+ val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator")
+ compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code)
+ }
+
+ def show(): Unit = {
+ deletePackage("p1/p2/p3")
+ deletePackage("p1/p2")
+
+ compileCode("""
+package sample
+
+class Test {
+ final class Inner extends A.A_Inner {
+ def foo = 42
+ }
+
+ def test = new Inner().foo
+}
+ """)
+ assert(storeReporter.infos.isEmpty, storeReporter.infos.mkString("\n"))
+ }
+
+ def deletePackage(name: String) {
+ val directory = new File(testOutput.path, name)
+ for (f <- directory.listFiles()) {
+ assert(f.getName.endsWith(".class"))
+ assert(f.delete())
+ }
+ assert(directory.listFiles().isEmpty)
+ assert(directory.delete())
+ }
+}