-
Notifications
You must be signed in to change notification settings - Fork 63
Permalink
Choose a base ref
{{ refName }}
default
Choose a head ref
{{ refName }}
default
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also or
learn more about diff comparisons.
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
Learn more about diff comparisons here.
base repository: dotnet/java-interop
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f8d77faf55347a58030a694332ba97f0dee88246
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
...
head repository: dotnet/java-interop
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf80deb7d2ad3c79abfd0140e4adee4376b41af5
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
- 2 commits
- 15 files changed
- 2 contributors
Commits on Jan 7, 2023
-
[generator] enum map.csv can set
@deprecated-sincefor enum values (#……1070) Context: dotnet/android#7670 While auditing the `Mono.Android.dll`, we've found that some constants were added to the wrong enums. Consider [`xamarin-android/src/Mono.Android/map.csv`][0], lines 739-743: E,28,android/app/usage/UsageStatsManager.STANDBY_BUCKET_ACTIVE,10,Android.App.Usage.StandbyBucket,Active,remove, E,28,android/app/usage/UsageStatsManager.STANDBY_BUCKET_FREQUENT,30,Android.App.Usage.StandbyBucket,Frequent,remove, E,28,android/app/usage/UsageStatsManager.STANDBY_BUCKET_RARE,40,Android.App.Usage.StandbyBucket,Rare,remove, E,30,android/app/usage/UsageStatsManager.STANDBY_BUCKET_RESTRICTED,45,Android.App.Usage.UsageStatsInterval,Restricted,remove, E,28,android/app/usage/UsageStatsManager.STANDBY_BUCKET_WORKING_SET,20,Android.App.Usage.StandbyBucket,WorkingSet,remove, `STANDBY_BUCKET_RESTRICTED` should have been added to `StandbyBucket` instead of `UsageStatsInterval`. To fix this in a backwards-compatible way, we can add it to both enums: E,30,android/app/usage/UsageStatsManager.STANDBY_BUCKET_RESTRICTED,45,Android.App.Usage.StandbyBucket,Restricted,remove, A,30,,45,Android.App.Usage.UsageStatsInterval,Restricted,remove, However, we have no way to mark `UsageStatsInterval.Restricted` as `[Obsolete]`, so people may still unintentionally use it. Add a new field to our csv that allows us to set a constant's `@deprecated-since` field, the `30` at the end: A,30,,45,Android.App.Usage.UsageStatsInterval,Restricted,remove,,30 This allows us to generate: [global::System.Runtime.Versioning.ObsoletedOSPlatform ("android30.0")] Restricted = 45 Additionally, when the cause is that we accidentally added an invalid value to the enum, we should provide a better obsolete message, letting the user know that the value will not function. This is done by setting `@deprecated-since` to `-1`: A,30,,45,Android.App.Usage.UsageStatsInterval,Restricted,remove,,-1 resulting in: [global::System.Obsolete (@"This value was incorrectly added to the enumeration and is not a valid value")] Restricted = 45 [0]: https://github.com/xamarin/xamarin-android/blob/cc70ce20aff6934532a8cb6a7bddbf3710fd7e1c/src/Mono.Android/map.csv
Configuration menu - View commit details
-
Copy full SHA for 5c5dc08 - Browse repository at this point
Copy the full SHA 5c5dc08View commit details -
[Java.Interop.Tools.JavaCallableWrappers] use IMetadataResolver more (#…
…1069) Context: b81cfbb Reviewing code in `JavaCallableWrapperGenerator`, I found codepaths where we weren't caching `TypeReference.Resolve()` calls *at all*, e.g. `JavaNativeTypeManager.GetPrimitiveClass(TypeDefinition)`. We thus appear to be calling `TypeReference.Resolve()` potentially on the same types. For example, `dotnet trace` output of an incremental build of a `dotnet new maui` project: 41.65ms xamarin.android.cecil!Mono.Cecil.TypeReference.Resolve() It appears that, in trying to make our maintenance lives easier by preserving backward API compatibility with callers that couldn't provide a `TypeDefinitionCache` or `IMetadataResolver` instance -- by providing method overloads which took e.g. `IMetadataResolver? resolver` parameters which could be `null` -- we made our optimization and performance lives *harder*, because not all codepaths which needed to use caching *were* using caching, as they were overlooked. As the `Java.Interop.Tools.*` assemblies are internal API, introduce an *API break* while preserving *ABI*: `IMetadataResolver` is now required. Thus, previous/current "compatibility methods" which allow *not* providing an `IMetadataResolver` instance such as: // old and busted partial class TypeDefinitionRocks { [Obsolete ("Use the TypeDefinitionCache overload for better performance.")] public static TypeDefinition? GetBaseType (this TypeDefinition type) => GetBaseType (type, resolver: null); } will now become *errors* to use: // new hawtness partial class TypeDefinitionRocks { [Obsolete ("Use the TypeDefinitionCache overload for better performance.", error:true)] public static TypeDefinition? GetBaseType (this TypeDefinition type) => throw new NotSupportedException (); } This allows the C# compiler to help us audit our codebase, ensuring that *all* codepaths which call `TypeReference.Resolve()` instead use `IMetadataResolver.Resolve()`, including: * `JavaCallableWrapperGenerator.GetAnnotationsString()` * `JavaCallableWrapperGenerator.WriteAnnotations()` * `JavaNativeTypeManager.GetPrimitiveClass()` Requiring caching results in: 23.89ms xamarin.android.cecil!Mono.Cecil.TypeReference.Resolve() Additionally, I updated two places to use plain `foreach` loops instead of using System.Linq. * Before: 1.03s xamarin.android.build.tasks!Xamarin.Android.Tasks.GenerateJavaStubs.RunTask() * After: 944.48ms xamarin.android.build.tasks!Xamarin.Android.Tasks.GenerateJavaStubs.RunTask() I think this likely saves about ~50ms off incremental builds of a `dotnet new maui` project.
Configuration menu - View commit details
-
Copy full SHA for cf80deb - Browse repository at this point
Copy the full SHA cf80debView commit details
Loading
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff f8d77faf55347a58030a694332ba97f0dee88246...cf80deb7d2ad3c79abfd0140e4adee4376b41af5