-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support use-site meta-annotations #16445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6d3ee4a
Support use-site meta-annotations
dwijnand 6d5ccbb
Fix bean-meta annotation support
dwijnand 1c644d7
Fix BeanProperties positions
dwijnand 78a433f
Don't depend on JVM's Annotation toString impl
dwijnand 48a7d11
Ignore Java reflection using tests in Scala.js
dwijnand ad520f3
Use ||, not |
dwijnand c2c937e
Make sure memoised accessors keep their meta annotation
dwijnand caf73bf
Add an indirect `@beanGetter` example
dwijnand fa6326a
Only retain `@field`-bearing annotations on fields
dwijnand e580aaa
Correctly shuffle annotations to where they should go
dwijnand f847ef6
Switch to atPhaseNoLater & push it upstream
dwijnand ceabdbd
Set field annotations immediately
dwijnand 8c512cd
Fix tests/run/beans expectations
dwijnand e35dc2a
Rename meta annotation sets
dwijnand 0bd5087
Reuse SymUtils.withAnnotationsCarrying
dwijnand ff68dc3
Push copyAndKeepAnnotationsCarrying into SymDenotation
dwijnand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
true | ||
10 | ||
[@beans.LibraryAnnotation_1()] | ||
[] | ||
some text | ||
other text |
This file contains hidden or 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 hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
inspecting constructor MyTable | ||
inspecting param aaaParam1 @MyColumnBase | ||
inspecting param fldParam1 | ||
inspecting param getParam1 | ||
inspecting param parParam1 @MyColumnBase | ||
inspecting field aaaField1 @MyColumnBase | ||
inspecting field aaaParam1 | ||
inspecting field fldField1 @MyColumnBase | ||
inspecting field fldParam1 @MyColumnBase | ||
inspecting field getField1 | ||
inspecting field getParam1 | ||
inspecting field parField1 | ||
inspecting field parParam1 | ||
inspecting method aaaField1 | ||
inspecting method aaaParam1 | ||
inspecting method fldField1 | ||
inspecting method fldParam1 | ||
inspecting method getField1 @MyColumnBase | ||
inspecting method getParam1 @MyColumnBase | ||
inspecting method parField1 | ||
inspecting method parParam1 | ||
inspecting constructor MyTable2 | ||
inspecting param fldParam2 | ||
inspecting param getParam2 | ||
inspecting param parParam2 @MyColumnBase | ||
inspecting field fldField2 @MyColumnBase | ||
inspecting field fldParam2 @MyColumnBase | ||
inspecting field getField2 | ||
inspecting field getParam2 | ||
inspecting field parField2 | ||
inspecting field parParam2 | ||
inspecting method fldField2 | ||
inspecting method fldParam2 | ||
inspecting method getField2 @MyColumnBase | ||
inspecting method getParam2 @MyColumnBase | ||
inspecting method parField2 | ||
inspecting method parParam2 |
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface MyColumnBase {} |
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import scala.annotation.meta.{ field as fld, getter as get, param as par } | ||
|
||
type FldColumn = MyColumnBase @fld | ||
type GetColumn = MyColumnBase @get | ||
type ParColumn = MyColumnBase @par | ||
|
||
class MyTable( | ||
@(MyColumnBase ) val aaaParam1: String, | ||
@(MyColumnBase @fld) val fldParam1: String, | ||
@(MyColumnBase @get) val getParam1: String, | ||
@(MyColumnBase @par) val parParam1: String, | ||
) { | ||
@(MyColumnBase ) val aaaField1: String = "" | ||
@(MyColumnBase @fld) val fldField1: String = "" | ||
@(MyColumnBase @get) val getField1: String = "" | ||
@(MyColumnBase @par) val parField1: String = "" | ||
} | ||
|
||
class MyTable2( | ||
@FldColumn val fldParam2: String, | ||
@GetColumn val getParam2: String, | ||
@ParColumn val parParam2: String, | ||
) { | ||
@FldColumn val fldField2: String = "" | ||
@GetColumn val getField2: String = "" | ||
@ParColumn val parField2: String = "" | ||
} |
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// scalajs: --skip | ||
object Test: | ||
def main(args: Array[String]): Unit = | ||
go(classOf[MyTable]) | ||
go(classOf[MyTable2]) | ||
|
||
def go(cls: Class[?]): Unit = | ||
for c <- cls.getDeclaredConstructors.sortBy(_.getName) do | ||
c.setAccessible(true) | ||
println(s"inspecting constructor ${c.getName}") | ||
for p <- c.getParameters.sortBy(_.getName) do | ||
print(s"inspecting param ${p.getName}") | ||
for a <- p.getAnnotations.sortBy(_.annotationType.toString) do | ||
print(s" @${a.annotationType.getName}") | ||
println() | ||
|
||
for (m <- cls.getDeclaredFields.sortBy(_.getName)) { | ||
m.setAccessible(true) | ||
print(s"inspecting field ${m.getName}") | ||
for a <- m.getAnnotations().sortBy(_.annotationType.toString) do | ||
print(s" @${a.annotationType.getName}") | ||
println() | ||
} | ||
|
||
for (m <- cls.getDeclaredMethods.sortBy(_.getName)) { | ||
m.setAccessible(true) | ||
print(s"inspecting method ${m.getName}") | ||
for a <- m.getAnnotations().sortBy(_.annotationType.toString) do | ||
print(s" @${a.annotationType.getName}") | ||
println() | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.