-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update NodeMapper to handle Trait sourceLocation (#865)
* Update NodeMapper to handle Trait sourceLocation This updates NodeMapper so that it can properly set source location on traits that use the AbstractTraitBuilder. Unfortunately the fix implemented here is a hack that looks for that specific case, and the same root cause may bite us elsewhere. The true root cause is that our default deserializer is unable to resolve generics. AbstractTraitBuilder generically defines the return value of the setter `sourceLocation` to `B extends AbstractTraitBuilder`. When we use reflection to look at the return type, all we see is `AbstractTraitBuilder`. We *can* also get the type variable, but actually resolving it will take a decent amount of effort as that functionality isn't built in. * Make NodeMapper pass along source location This updates the serializer for NodeMapper to pass along the source location. * Check if builder return type is self-assignable This updates the builder detection in the node deserializer to check to see if the builder type is assignable to a given method's return type. This removes the need for a hack enabling source location, but it's still not perfect. Ideally we should attempt to resolve any generic return types.
- Loading branch information
1 parent
ae3af5e
commit 4a68144
Showing
3 changed files
with
93 additions
and
5 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
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