-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SI-5699 correct java parser for annotation defs.
Correct java source parser not to insert a constructor with the type of its value method.
- Loading branch information
1 parent
b7b4f87
commit 50ee635
Showing
3 changed files
with
36 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 | |||
} | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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))) | |||
} | |||
} |
50ee635
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Job pr-rangepos-per-commit failed for 50ee635 (results):
Took 8 s.
to rebuild, comment "PLS REBUILD/pr-rangepos-per-commit@50ee635e3c5914f75be57209f7a145fbb3e23d80" on PR 2274
50ee635
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Job pr-checkin-per-commit failed for 50ee635 (results):
Took 35 s.
to rebuild, comment "PLS REBUILD/pr-checkin-per-commit@50ee635e3c5914f75be57209f7a145fbb3e23d80" on PR 2274