summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-03-22 11:29:16 -0700
committerJames Iry <jamesiry@gmail.com>2013-03-22 11:29:16 -0700
commit62dd51a79ef1b1c240c1eb1e97c330347f842d4c (patch)
tree5df4821cfbc3705c9f992fba9dab06122a538c37 /test
parente5a081cb6a6f5e627765efb188c53f646fbe8ad9 (diff)
parent50ee635e3c5914f75be57209f7a145fbb3e23d80 (diff)
downloadscala-62dd51a79ef1b1c240c1eb1e97c330347f842d4c.tar.gz
scala-62dd51a79ef1b1c240c1eb1e97c330347f842d4c.tar.bz2
scala-62dd51a79ef1b1c240c1eb1e97c330347f842d4c.zip
Merge pull request #2274 from vigdorchik/ticket/si-5699
SI-5699 correct java parser for annotation defs.
Diffstat (limited to 'test')
-rwxr-xr-xtest/files/run/t5699.check11
-rwxr-xr-xtest/files/run/t5699.scala24
2 files changed, 35 insertions, 0 deletions
diff --git a/test/files/run/t5699.check b/test/files/run/t5699.check
new file mode 100755
index 0000000000..df19644ae6
--- /dev/null
+++ b/test/files/run/t5699.check
@@ -0,0 +1,11 @@
+[[syntax trees at end of parser]] // annodef.java
+package <empty> {
+ object MyAnnotation extends {
+ def <init>() = _
+ };
+ class MyAnnotation extends scala.annotation.Annotation with _root_.java.lang.annotation.Annotation with scala.annotation.ClassfileAnnotation {
+ def <init>() = _;
+ def value(): String
+ }
+}
+
diff --git a/test/files/run/t5699.scala b/test/files/run/t5699.scala
new file mode 100755
index 0000000000..5cef67e3b1
--- /dev/null
+++ b/test/files/run/t5699.scala
@@ -0,0 +1,24 @@
+import scala.tools.partest.DirectTest
+import scala.tools.nsc.util.BatchSourceFile
+
+object Test extends DirectTest {
+ // Java code
+ override def code = """
+ |public @interface MyAnnotation { String value(); }
+ """.stripMargin
+
+ override def extraSettings: String = "-usejavacp -Ystop-after:typer -Xprint:parser"
+
+ override def show(): Unit = {
+ // redirect err to out, for logging
+ val prevErr = System.err
+ System.setErr(System.out)
+ compile()
+ System.setErr(prevErr)
+ }
+
+ override def newSources(sourceCodes: String*) = {
+ assert(sourceCodes.size == 1)
+ List(new BatchSourceFile("annodef.java", sourceCodes(0)))
+ }
+}