-
Notifications
You must be signed in to change notification settings - Fork 58
[generator] Add nullable reference types (NRT) support. #563
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
14 commits
Select commit
Hold shift + click to select a range
d87725b
[WIP] [generator] Enable NRT support.
jpobst 8c26a3c
Add a little null forgiveness!
jpobst 3714b13
[J.I.T.JavaCallableWrappers] Enable NRT support.
jpobst da1ec79
More Java.Interop nullability work.
jpobst 9f7d634
Couple more nullability fixes.
jpobst c199e1f
Guard some nullability operators.
jpobst 758b0df
Guarding fixes and don't default NRT to on.
jpobst 57df7b7
Various fixes.
jpobst 95224d8
More fixes.
jpobst ce1b2dc
[TypeNameMappings] Fix NRT warnings caused by an annotated BCL.
jpobst 8871a63
[generator] Fix generated warning caused by annotated BCL.
jpobst 26ddbe9
[generator] Add NRT test suite.
jpobst 7be59de
Merge branch 'master' into generator-nrt
jpobst 745589b
Remove attributes added to generated files.
jpobst 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
90 changes: 47 additions & 43 deletions
90
...terop.Tools.TypeNameMappings/Java.Interop.Tools.TypeNameMappings/JavaNativeTypeManager.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
11 changes: 11 additions & 0 deletions
11
...nit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1-NRT/WriteCharSequenceEnumerator.txt
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,11 @@ | ||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () | ||
{ | ||
return GetEnumerator (); | ||
} | ||
|
||
public System.Collections.Generic.IEnumerator<char> GetEnumerator () | ||
{ | ||
for (int i = 0; i < Length(); i++) | ||
yield return CharAt (i); | ||
} | ||
|
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.
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.
This change concerns me: why did it occur? For that matter, how was it
java.lang.String
in the first place?Fortunately this doesn't trigger any API breakage in
Mono.Android.dll
, as per https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3648625&view=resultsI just find this really weird. What change to
generator
is triggering this? Was it deliberate? What's the rationale?I don't see this mentioned in the commit message.
Uh oh!
There was an error while loading. Please reload this page.
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.
The change is that previously we were writing this type from
property.Type
, which isSetter != null ? Setter.Parameters [0].Type : Getter.ReturnType
.https://github.com/xamarin/java.interop/blob/master/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/CodeGenerator.cs#L1690
This was refactored and combined with other places that were writing
property.Getter.ReturnType
, to a new method which always prefersGetter.ReturnType
:https://github.com/xamarin/java.interop/pull/563/files#diff-18357c6193fe262963d21bb1d0bab9feR99-R105
The test is a unit test and does not go through the full pipeline of resolving all the types, thus its
Setter.Parameters [0].Type
isn't changing fromjava.lang.String
tostring
, but itsGetter.ReturnType
is getting resolved tostring
.That is, the unit test code is incorrectly this:
Setter.Parameters [0].Type
=java.lang.String
Getter.ReturnType
=string
In the real world,
Setter.Parameters [0].Type
andGetter.ReturnType
should always refer to the same symbol, so this should not affect real code.