-
Notifications
You must be signed in to change notification settings - Fork 52
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
[Java.Interop] ignore remaining trimming warnings #1190
Merged
jonpryor
merged 11 commits into
dotnet:main
from
jonathanpeppers:RemainingTrimmerWarnings
Feb 14, 2024
Merged
[Java.Interop] ignore remaining trimming warnings #1190
jonpryor
merged 11 commits into
dotnet:main
from
jonathanpeppers:RemainingTrimmerWarnings
Feb 14, 2024
Commits on Feb 13, 2024
-
[Java.Interop] ignore remaining trimming warnings
Fixes: dotnet#1157 The remaining trimmer warnings are around usage of System.Reflection such as: * Create an `Invoker` type from an original type via `Type.Assembly.GetType()` * Create a `Type` based on a `ParameterInfo.ParameterType` and/or create instances * Use `Type.MakeGenericType()` * Use `Type.MakeArrayType()` The trimming warnings themselves all indicate that these types "might be trimmed", in that nothing explicitly preserves them. However, we have a plethora of custom trimmer steps that work to preserve these types involved in Java interop, such as: * https://github.com/xamarin/xamarin-android/blob/main/src/Microsoft.Android.Sdk.ILLink/PreserveApplications.cs * https://github.com/xamarin/xamarin-android/blob/main/src/Microsoft.Android.Sdk.ILLink/PreserveExportedTypes.cs * https://github.com/xamarin/xamarin-android/blob/main/src/Microsoft.Android.Sdk.ILLink/PreserveJavaExceptions.cs * https://github.com/xamarin/xamarin-android/blob/main/src/Microsoft.Android.Sdk.ILLink/PreserveJavaInterfaces.cs * https://github.com/xamarin/xamarin-android/blob/main/src/Microsoft.Android.Sdk.ILLink/PreserveRegistrations.cs One day, in a perfect world, we could remove these trimmer steps and completely rely on the trimmer's warnings & attributing mechanisms. That day doesn't have to be today -- as our goal is begin surfacing trimmer warnings to users in their own code and dependencies. With these warnings ignored, we can fully enable analyzers with: <IsTrimmable>true</IsTrimmable> <EnableAotAnalyzer>true</EnableAotAnalyzer> We can then remove: [assembly: AssemblyMetadata ("IsTrimmable", "True")] As the MSBuild property does this for us, in addition to enabling analyzers. I don't think we should enable `$(IsAotCompatible)` quite yet, as `Java.Interop.dll` likely *won't work* yet on NativeAOT, and this places metadata that says an assembly is supported. We should just use the `$(EnableAotAnalyzer)` analyzers for now, so we don't introduce new issues.
Configuration menu - View commit details
-
Copy full SHA for 7482f46 - Browse repository at this point
Copy the full SHA 7482f46View commit details -
Configuration menu - View commit details
-
Copy full SHA for 33bd501 - Browse repository at this point
Copy the full SHA 33bd501View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4522d35 - Browse repository at this point
Copy the full SHA 4522d35View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9c7a05a - Browse repository at this point
Copy the full SHA 9c7a05aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5300682 - Browse repository at this point
Copy the full SHA 5300682View commit details -
Configuration menu - View commit details
-
Copy full SHA for 502e852 - Browse repository at this point
Copy the full SHA 502e852View commit details -
Configuration menu - View commit details
-
Copy full SHA for a493d15 - Browse repository at this point
Copy the full SHA a493d15View commit details -
Configuration menu - View commit details
-
Copy full SHA for ea2ff53 - Browse repository at this point
Copy the full SHA ea2ff53View commit details -
Configuration menu - View commit details
-
Copy full SHA for ad5019d - Browse repository at this point
Copy the full SHA ad5019dView commit details
Commits on Feb 14, 2024
-
Configuration menu - View commit details
-
Copy full SHA for f6bb010 - Browse repository at this point
Copy the full SHA f6bb010View commit details -
Configuration menu - View commit details
-
Copy full SHA for aea690e - Browse repository at this point
Copy the full SHA aea690eView commit details
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.