From 50ee635e3c5914f75be57209f7a145fbb3e23d80 Mon Sep 17 00:00:00 2001 From: Eugene Vigdorchik Date: Mon, 18 Mar 2013 16:34:15 +0400 Subject: SI-5699 correct java parser for annotation defs. Correct java source parser not to insert a constructor with the type of its value method. --- test/files/run/t5699.check | 11 +++++++++++ test/files/run/t5699.scala | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 test/files/run/t5699.check create mode 100755 test/files/run/t5699.scala (limited to 'test') 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 { + object MyAnnotation extends { + def () = _ + }; + class MyAnnotation extends scala.annotation.Annotation with _root_.java.lang.annotation.Annotation with scala.annotation.ClassfileAnnotation { + def () = _; + 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))) + } +} -- cgit v1.2.3