Skip to content

[Xamarin.Android.Build.Tasks] Allow the cache'ing of the dex/jack compilation for support libraries. [DO NOT MERGE WIP]#299

Closed
dellis1972 wants to merge 1 commit intodotnet:masterfrom
dellis1972:dexcache
Closed

[Xamarin.Android.Build.Tasks] Allow the cache'ing of the dex/jack compilation for support libraries. [DO NOT MERGE WIP]#299
dellis1972 wants to merge 1 commit intodotnet:masterfrom
dellis1972:dexcache

Conversation

@dellis1972
Copy link
Contributor

Support libraries mostly contain classes.jar which needs to be converted to
a .dex format (or the .jack format). This can take some time. If we
pre convert the support libraries and cache the results we can cut down
the build time. dx.jar has the capability to merge in other .jar files
which contain classes.dex instead of .class files.

…pilation for support libraries.

Support libraries mostly contain classes.jar which needs to be converted to
a .dex format (or the .jack format). This can take some time. If we
pre convert the support libraries and cache the results we can cut down
the build time. dx.jar has the capability to merge in other .jar files
which contain classes.dex instead of .class files.
@dellis1972 dellis1972 added the do-not-merge PR should not be merged. label Nov 17, 2016
@dellis1972 dellis1972 closed this Apr 27, 2017
radical pushed a commit that referenced this pull request May 8, 2018
Context: 4ec5d4e

In improving our support for "package-private" classes, we added a
check to compare if two methods have the same signature. The
expression was of the form:

	m.Name == baseMethod.Name && m.Parameters.JavaSignature == baseMethod.Parameters.JavaSignature

The problem with this is that the `JavaSignature` property can throw
a `NullReferenceException` if one of the parameter types is unknown,
or only becomes valid later on in generator's process:

	System.NullReferenceException: Object reference not set to an instance of an object
	  at MonoDroid.Generation.Parameter.get_JavaType ()
	  at MonoDroid.Generation.ParameterList.get_JavaSignature ()
	  at MonoDroid.Generation.ClassGen+<>c__DisplayClass29_0.<FixupAccessModifiers>b__0 (MonoDroid.Generation.Method m)
	  at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found)
	  at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate)
	  at MonoDroid.Generation.ClassGen.FixupAccessModifiers ()
	  at Xamarin.Android.Binder.CodeGenerator.Validate (System.Collections.Generic.List`1[T] gens, MonoDroid.Generation.CodeGenerationOptions opt)
	  at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options, Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver)
	  at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options)
	  at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args)


Instead of using `JavaSignature`, we need to rely *only* on the
original Java information, and loop over the parameters individually.

To fix this:

  - Create a `bool Matches (MethodBase other)` method in `MethodBase`
  - Override `Matches()` in `Method`, also check the return type
  - Add some unit tests for these scenarios for both `XmlMethod` and
    `ManagedMethod`
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

do-not-merge PR should not be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants