summaryrefslogtreecommitdiff
path: root/test/files/run/t8442/Test.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-03-25 14:08:27 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-03-25 14:40:16 +0100
commit8262ed2fc618d27258eb975fd401b31f1064cc3e (patch)
tree5448b9b5574cf3071778afa8efe558606ef58b0d /test/files/run/t8442/Test.scala
parent5720e97b95da57c9549698a9038efb79092394ad (diff)
downloadscala-8262ed2fc618d27258eb975fd401b31f1064cc3e.tar.gz
scala-8262ed2fc618d27258eb975fd401b31f1064cc3e.tar.bz2
scala-8262ed2fc618d27258eb975fd401b31f1064cc3e.zip
SI-8442 Ignore stub annotation symbols in `AnnotationInfo#matches`
And update the java `ClassFileParser` to create distinguished `StubClassSymbol`s, rather that a regular `ClassSymbol`s, when encountering a deficient classpath. This brings it into line with `Unpickler`, which has done as much since a55788e275f. This stops the enclosed test case from crashing when determining if the absent symbol, `A_1`, is a subclass of `@deprecated`. This is ostensibly fixes a regression, although it only worked in `2.10.[0-3]` by a fluke: the class file parser's promiscious exception handling caught and recovered from the NPE introduced in SI-7439! % javac -d /tmp test/files/run/t8442/{A,B}_1.java && qbin/scalac -classpath /tmp -d /tmp test/files/run/t8442/C_2.scala && (rm /tmp/A_1.class; true) && scalac-hash v2.10.0 -classpath /tmp -d /tmp test/files/run/t8442/C_2.scala warning: Class A_1 not found - continuing with a stub. warning: Caught: java.lang.NullPointerException while parsing annotations in /tmp/B_1.class two warnings found
Diffstat (limited to 'test/files/run/t8442/Test.scala')
-rw-r--r--test/files/run/t8442/Test.scala29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/t8442/Test.scala b/test/files/run/t8442/Test.scala
new file mode 100644
index 0000000000..ff6da4e206
--- /dev/null
+++ b/test/files/run/t8442/Test.scala
@@ -0,0 +1,29 @@
+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 app = """
+ class C_2 {
+ def foo(b: B_1) {
+ b.get()
+ }
+ }
+ """
+
+ def show(): Unit = {
+ val tClass = new File(testOutput.path, "A_1.class")
+ assert(tClass.exists)
+ assert(tClass.delete())
+
+ // Expecting stub symbol warning, but no stack trace!
+ compileCode(app)
+ println(filteredInfos.mkString("\n"))
+ }
+}