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
Address breaking changes in Java.Interop #7664
Merged
jonpryor
merged 2 commits into
xamarin:main
from
jonathanpeppers:JavaInteropBreakingChanges
Jan 9, 2023
Merged
Address breaking changes in Java.Interop #7664
jonpryor
merged 2 commits into
xamarin:main
from
jonathanpeppers:JavaInteropBreakingChanges
Jan 9, 2023
Conversation
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
Context: xamarin/java.interop#1069 Any place we had: TypeDefinitionCache? IMetadataResolver? These no longer allow nulls, and so overloads that use `Obsolete` now emit errors instead of warnings: [Obsolete ("Use the TypeDefinitionCache overload for better performance.", error: true)] public static MethodDefinition GetBaseDefinition (this MethodDefinition method) => GetBaseDefinition (method, resolver: null!); This results in 3 compiler errors in xamarin-android: src\Xamarin.Android.Build.Tasks\Mono.Android\ApplicationAttribute.Partial.cs(65,11): error CS0619: 'TypeDefinitionRocks.IsSubclassOf(TypeDefinition, string)' is obsolete: 'Use the TypeDefinitionCache overload for better performance.' src\Xamarin.Android.Build.Tasks\Mono.Android\ApplicationAttribute.Partial.cs(268,12): error CS0619: 'JavaNativeTypeManager.ToJniName(TypeDefinition)' is obsolete: 'Use the TypeDefinitionCache overload for better performance.' src\Xamarin.Android.Build.Tasks\Utilities\ManifestDocumentElement.cs(28,11): error CS0619: 'JavaNativeTypeManager.ToJniName(TypeDefinition)' is obsolete: 'Use the TypeDefinitionCache overload for better performance.' After these changes, it appears we will improve the performance further of apps that use: * `ApplicationAttribute.BackupAgent` * `ApplicationAttribute.Name` * `AndroidManifest.xml` attributes that take a `System.Type` values Additionally, fix NRE in the linker: Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at Java.Interop.Tools.Cecil.TypeDefinitionRocks.GetBaseType(TypeDefinition type, IMetadataResolver resolver) in /Users/builder/azdo/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/TypeDefinitionRocks.cs:line 21 at Java.Interop.Tools.Cecil.TypeDefinitionRocks.GetTypeAndBaseTypes(TypeDefinition type, IMetadataResolver resolver)+MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/TypeDefinitionRocks.cs:line 36 at Java.Interop.Tools.Cecil.TypeDefinitionRocks.IsSubclassOf(TypeDefinition type, String typeName, IMetadataResolver resolver) in /Users/builder/azdo/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/TypeDefinitionRocks.cs:line 87 at MonoDroid.Tuner.FixAbstractMethodsStep.ProcessType(TypeDefinition type) in /Users/builder/azdo/_work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/FixAbstractMethodsStep.cs:line 81 at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin) at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason, MessageOrigin& origin) at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason) at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.MarkStep.MarkAssembly(AssemblyDefinition assembly, DependencyInfo reason) at Mono.Linker.Steps.MarkStep.MarkModule(ModuleDefinition module, DependencyInfo reason) at Mono.Linker.Steps.MarkStep.ProcessMarkedPending() at Mono.Linker.Steps.MarkStep.Initialize() at Mono.Linker.Steps.MarkStep.Process(LinkContext context) at Mono.Linker.Pipeline.Process(LinkContext context) at Mono.Linker.Driver.Run(ILogger customLogger) at Mono.Linker.Driver.Main(String[] args) This was caused by removing null checks in Java.Interop.
jonathanpeppers
force-pushed
the
JavaInteropBreakingChanges
branch
from
January 9, 2023 14:13
fbe638d
to
6f46c7f
Compare
Bumps [external/Java.Interop](https://github.com/xamarin/java.interop) from `f8d77fa` to `cf80deb`. - [Release notes](https://github.com/xamarin/java.interop/releases) - [Commits](xamarin/java.interop@f8d77fa...cf80deb) --- updated-dependencies: - dependency-name: external/Java.Interop dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Jan 17, 2023
* main: [Xamarin.Android.Build.Tasks] skip XA1034 logic in some cases (xamarin#7680) [ci] Move OneLocBuild task to scheduled pipeline (xamarin#7679) [Mono.Android] ServerCertificateValidationCallback() and redirects (xamarin#7662) Bump to xamarin/java.interop@cf80deb7 (xamarin#7664) Localized file check-in by OneLocBuild (xamarin#7668) [api-merge] Correctly compute //method/@deprecated-since (xamarin#7645) [Xamarin.Android.Build.Tasks] _Microsoft.Android.Resource.Designer (xamarin#6427) [Xamarin.Android.Build.Tasks] downgrade d8/r8 `warning` messages to `info` (xamarin#7643) [Xamarin.Android.Build.Tasks] fix cases of missing `@(Reference)` (xamarin#7642) [Xamarin.Android.Build.Tasks] delay ToJniName calls in ManifestDocument (xamarin#7653) [Xamarin.Android.Build.Tasks] fast path for `<CheckClientHandlerType/>` (xamarin#7652)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Context: xamarin/java.interop#1069
Any place we had:
These no longer allow nulls, and so overloads that use
Obsolete
now emit errors instead of warnings:This results in 3 compiler errors in xamarin-android:
After these changes, it appears we will improve the performance further of apps that use:
ApplicationAttribute.BackupAgent
ApplicationAttribute.Name
AndroidManifest.xml
attributes that take aSystem.Type
values