Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

Commit 2573dc8

Browse files
authored
[Java.Interop.Tools.*] IMetadataResolver not TypeDefinitionCache (#842)
Context: b81cfbb Context: dotnet/android#5748 Context: dotnet/android#5748 (comment) Commit b81cfbb introduced `TypeDefinitionCache`, which caches `TypeReference.Resolve()` invocations so as to speed things up. Enter dotnet/android#5748: we want to adopt some linker API changes, and mono/linker's [`LinkContext` API][0] *also* has a `TypeDefinition` cache construct. Consequently, to "fully embrace" the new `LinkContext` API changes, *large portions* of `Java.Interop.Tools.Cecil.dll` are copied so that `LinkContext`'s caching can be used instead of `TypeDefinitionCache`'s caching, because mono/linker doesn't use Java.Interop, and thus can't use `TypeDefinitionCache`. Clean this up and split the difference: "duplicate" the APIs in `Java.Interop.Tools.Cecil.dll`, `Java.Interop.Tools.JavaCallableWrappers.dll`, and `src/Java.Interop.Tools.TypeNameMappings` so that instead of optionally using `TypeDefinitionCache`, we instead permit the use of the [`Mono.Cecil.IMetadataResolver` interface][1], which is a "superset" of `TypeDefinitionCache` functionality. Update `TypeDefinitionCache` to implement the `IMetadataResolver` interface, implementing `IMetadataResolver.Resolve()` so that previous caching functionality is preserved. This *should* result in no breakage of existing xamarin-android code, while allowing for a reasonable integration point between `Java.Interop.Tools.Cecil.dll` and mono/linker, by way of `IMetadataResolver`. [0]: https://github.com/mono/linker/blob/30f2498c2a3de1f7e236d5793f5f1aca6e5ba456/src/linker/Linker/LinkContext.cs [1]: https://github.com/mono/cecil/blob/e069cd8d25d5b61b0e28fe65e75959c20af7aa80/Mono.Cecil/MetadataResolver.cs#L22-L26
1 parent 412e974 commit 2573dc8

7 files changed

Lines changed: 224 additions & 104 deletions

File tree

‎src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/MethodDefinitionRocks.cs‎

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@ public static class MethodDefinitionRocks
1111
{
1212
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
1313
publicstaticMethodDefinitionGetBaseDefinition(thisMethodDefinitionmethod)=>
14-
GetBaseDefinition(method,cache:null);
14+
GetBaseDefinition(method,resolver:null);
1515

16-
publicstaticMethodDefinitionGetBaseDefinition(thisMethodDefinitionmethod,TypeDefinitionCache?cache)
16+
publicstaticMethodDefinitionGetBaseDefinition(thisMethodDefinitionmethod,TypeDefinitionCache?cache)=>
17+
GetBaseDefinition(method,(IMetadataResolver?)cache);
18+
19+
publicstaticMethodDefinitionGetBaseDefinition(thisMethodDefinitionmethod,IMetadataResolver?resolver)
1720
{
1821
if(method.IsStatic||method.IsNewSlot||!method.IsVirtual)
1922
returnmethod;
2023

21-
foreach(varbaseTypeinmethod.DeclaringType.GetBaseTypes(cache)){
24+
foreach(varbaseTypeinmethod.DeclaringType.GetBaseTypes(resolver)){
2225
foreach(varminbaseType.Methods){
2326
if(!m.IsConstructor&&
2427
m.Name==method.Name&&
2528
(m.IsVirtual||m.IsAbstract)&&
26-
AreParametersCompatibleWith(m.Parameters,method.Parameters,cache)){
29+
AreParametersCompatibleWith(m.Parameters,method.Parameters,resolver)){
2730
returnm;
2831
}
2932
}
@@ -33,14 +36,17 @@ public static MethodDefinition GetBaseDefinition (this MethodDefinition method,
3336

3437
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
3538
publicstaticIEnumerable<MethodDefinition>GetOverriddenMethods(MethodDefinitionmethod,boolinherit)=>
36-
GetOverriddenMethods(method,inherit,cache:null);
39+
GetOverriddenMethods(method,inherit,resolver:null);
40+
41+
publicstaticIEnumerable<MethodDefinition>GetOverriddenMethods(MethodDefinitionmethod,boolinherit,TypeDefinitionCache?cache)=>
42+
GetOverriddenMethods(method,inherit,(IMetadataResolver?)cache);
3743

38-
publicstaticIEnumerable<MethodDefinition>GetOverriddenMethods(MethodDefinitionmethod,boolinherit,TypeDefinitionCache?cache)
44+
publicstaticIEnumerable<MethodDefinition>GetOverriddenMethods(MethodDefinitionmethod,boolinherit,IMetadataResolver?resolver)
3945
{
4046
yieldreturnmethod;
4147
if(inherit){
4248
MethodDefinitionbaseMethod=method;
43-
while((baseMethod=method.GetBaseDefinition(cache))!=null&&baseMethod!=method){
49+
while((baseMethod=method.GetBaseDefinition(resolver))!=null&&baseMethod!=method){
4450
yieldreturnmethod;
4551
method=baseMethod;
4652
}
@@ -49,9 +55,12 @@ public static IEnumerable<MethodDefinition> GetOverriddenMethods (MethodDefiniti
4955

5056
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
5157
publicstaticboolAreParametersCompatibleWith(thisCollection<ParameterDefinition>a,Collection<ParameterDefinition>b)=>
52-
AreParametersCompatibleWith(a,b,cache:null);
58+
AreParametersCompatibleWith(a,b,resolver:null);
59+
60+
publicstaticboolAreParametersCompatibleWith(thisCollection<ParameterDefinition>a,Collection<ParameterDefinition>b,TypeDefinitionCache?cache)=>
61+
AreParametersCompatibleWith(a,b,(IMetadataResolver?)cache);
5362

54-
publicstaticboolAreParametersCompatibleWith(thisCollection<ParameterDefinition>a,Collection<ParameterDefinition>b,TypeDefinitionCache?cache)
63+
publicstaticboolAreParametersCompatibleWith(thisCollection<ParameterDefinition>a,Collection<ParameterDefinition>b,IMetadataResolver?resolver)
5564
{
5665
if(a.Count!=b.Count)
5766
returnfalse;
@@ -60,21 +69,21 @@ public static bool AreParametersCompatibleWith (this Collection<ParameterDefinit
6069
returntrue;
6170

6271
for(inti=0;i<a.Count;i++)
63-
if(!IsParameterCompatibleWith(a[i].ParameterType,b[i].ParameterType,cache))
72+
if(!IsParameterCompatibleWith(a[i].ParameterType,b[i].ParameterType,resolver))
6473
returnfalse;
6574

6675
returntrue;
6776
}
6877

69-
staticboolIsParameterCompatibleWith(IModifierTypea,IModifierTypeb,TypeDefinitionCache?cache)
78+
staticboolIsParameterCompatibleWith(IModifierTypea,IModifierTypeb,IMetadataResolver?cache)
7079
{
7180
if(!IsParameterCompatibleWith(a.ModifierType,b.ModifierType,cache))
7281
returnfalse;
7382

7483
returnIsParameterCompatibleWith(a.ElementType,b.ElementType,cache);
7584
}
7685

77-
staticboolIsParameterCompatibleWith(TypeSpecificationa,TypeSpecificationb,TypeDefinitionCache?cache)
86+
staticboolIsParameterCompatibleWith(TypeSpecificationa,TypeSpecificationb,IMetadataResolver?cache)
7887
{
7988
if(aisGenericInstanceType)
8089
returnIsParameterCompatibleWith((GenericInstanceType)a,(GenericInstanceType)b,cache);
@@ -85,7 +94,7 @@ static bool IsParameterCompatibleWith (TypeSpecification a, TypeSpecification b,
8594
returnIsParameterCompatibleWith(a.ElementType,b.ElementType,cache);
8695
}
8796

88-
staticboolIsParameterCompatibleWith(GenericInstanceTypea,GenericInstanceTypeb,TypeDefinitionCache?cache)
97+
staticboolIsParameterCompatibleWith(GenericInstanceTypea,GenericInstanceTypeb,IMetadataResolver?cache)
8998
{
9099
if(!IsParameterCompatibleWith(a.ElementType,b.ElementType,cache))
91100
returnfalse;
@@ -103,7 +112,7 @@ static bool IsParameterCompatibleWith (GenericInstanceType a, GenericInstanceTyp
103112
returntrue;
104113
}
105114

106-
staticboolIsParameterCompatibleWith(TypeReferencea,TypeReferenceb,TypeDefinitionCache?cache)
115+
staticboolIsParameterCompatibleWith(TypeReferencea,TypeReferenceb,IMetadataResolver?cache)
107116
{
108117
if(aisTypeSpecification||bisTypeSpecification){
109118
if(a.GetType()!=b.GetType())
Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
11
usingSystem.Collections.Generic;
22
usingMono.Cecil;
33

4+
usingJava.Interop.Tools.Diagnostics;
5+
46
namespaceJava.Interop.Tools.Cecil
57
{
68
/// <summary>
79
/// A class for caching lookups from TypeReference -> TypeDefinition.
810
/// Generally its lifetime should match an AssemblyResolver instance.
911
/// </summary>
10-
publicclassTypeDefinitionCache
12+
publicclassTypeDefinitionCache:IMetadataResolver
1113
{
12-
readonlyDictionary<TypeReference,TypeDefinition>cache=newDictionary<TypeReference,TypeDefinition>();
14+
readonlyDictionary<TypeReference,TypeDefinition?>types=newDictionary<TypeReference,TypeDefinition?>();
15+
readonlyDictionary<FieldReference,FieldDefinition?>fields=newDictionary<FieldReference,FieldDefinition?>();
16+
readonlyDictionary<MethodReference,MethodDefinition?>methods=newDictionary<MethodReference,MethodDefinition?>();
1317

14-
publicvirtualTypeDefinitionResolve(TypeReferencetypeReference)
18+
publicvirtualTypeDefinition?Resolve(TypeReferencetypeReference)
1519
{
16-
if(cache.TryGetValue(typeReference,outvartypeDefinition))
20+
if(types.TryGetValue(typeReference,outvartypeDefinition))
1721
returntypeDefinition;
18-
returncache[typeReference]=typeReference.Resolve();
22+
returntypes[typeReference]=typeReference.Resolve();
23+
}
24+
25+
publicvirtualFieldDefinition?Resolve(FieldReferencefield)
26+
{
27+
if(fields.TryGetValue(field,outvarfieldDefinition))
28+
returnfieldDefinition;
29+
returnfields[field]=field.Resolve();
30+
}
31+
32+
publicvirtualMethodDefinition?Resolve(MethodReferencemethod)
33+
{
34+
if(methods.TryGetValue(method,outvarmethodDefinition))
35+
returnmethodDefinition;
36+
returnmethods[method]=method.Resolve();
1937
}
2038
}
2139
}

‎src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/TypeDefinitionRocks.cs‎

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,74 @@ public static class TypeDefinitionRocks {
99

1010
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
1111
publicstaticTypeDefinition?GetBaseType(thisTypeDefinitiontype)=>
12-
GetBaseType(type,cache:null);
12+
GetBaseType(type,resolver:null);
1313

14-
publicstaticTypeDefinition?GetBaseType(thisTypeDefinitiontype,TypeDefinitionCache?cache)
14+
publicstaticTypeDefinition?GetBaseType(thisTypeDefinitiontype,TypeDefinitionCache?cache)=>
15+
GetBaseType(type,(IMetadataResolver?)cache);
16+
17+
publicstaticTypeDefinition?GetBaseType(thisTypeDefinitiontype,IMetadataResolver?resolver)
1518
{
1619
varbt=type.BaseType;
1720
if(bt==null)
1821
returnnull;
19-
if(cache!=null)
20-
returncache.Resolve(bt);
22+
if(resolver!=null)
23+
returnresolver.Resolve(bt);
2124
returnbt.Resolve();
2225
}
2326

2427
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
2528
publicstaticIEnumerable<TypeDefinition>GetTypeAndBaseTypes(thisTypeDefinitiontype)=>
26-
GetTypeAndBaseTypes(type,cache:null);
29+
GetTypeAndBaseTypes(type,resolver:null);
30+
31+
publicstaticIEnumerable<TypeDefinition>GetTypeAndBaseTypes(thisTypeDefinitiontype,TypeDefinitionCache?cache)=>
32+
GetTypeAndBaseTypes(type,(IMetadataResolver?)cache);
2733

28-
publicstaticIEnumerable<TypeDefinition>GetTypeAndBaseTypes(thisTypeDefinitiontype,TypeDefinitionCache?cache)
34+
publicstaticIEnumerable<TypeDefinition>GetTypeAndBaseTypes(thisTypeDefinitiontype,IMetadataResolver?resolver)
2935
{
3036
TypeDefinition?t=type;
3137

3238
while(t!=null){
3339
yieldreturnt;
34-
t=t.GetBaseType(cache);
40+
t=t.GetBaseType(resolver);
3541
}
3642
}
3743

3844
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
3945
publicstaticIEnumerable<TypeDefinition>GetBaseTypes(thisTypeDefinitiontype)=>
40-
GetBaseTypes(type,cache:null);
46+
GetBaseTypes(type,resolver:null);
4147

42-
publicstaticIEnumerable<TypeDefinition>GetBaseTypes(thisTypeDefinitiontype,TypeDefinitionCache?cache)
48+
publicstaticIEnumerable<TypeDefinition>GetBaseTypes(thisTypeDefinitiontype,TypeDefinitionCache?cache)=>
49+
GetBaseTypes(type,(IMetadataResolver?)cache);
50+
51+
publicstaticIEnumerable<TypeDefinition>GetBaseTypes(thisTypeDefinitiontype,IMetadataResolver?resolver)
4352
{
4453
TypeDefinition?t=type;
4554

46-
while((t=t.GetBaseType(cache))!=null){
55+
while((t=t.GetBaseType(resolver))!=null){
4756
yieldreturnt;
4857
}
4958
}
5059

5160
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
5261
publicstaticboolIsAssignableFrom(thisTypeReferencetype,TypeReferencec)=>
53-
IsAssignableFrom(type,c,cache:null);
62+
IsAssignableFrom(type,c,resolver:null);
63+
64+
publicstaticboolIsAssignableFrom(thisTypeReferencetype,TypeReferencec,TypeDefinitionCache?cache)=>
65+
IsAssignableFrom(type,c,(IMetadataResolver?)cache);
5466

55-
publicstaticboolIsAssignableFrom(thisTypeReferencetype,TypeReferencec,TypeDefinitionCache?cache)
67+
publicstaticboolIsAssignableFrom(thisTypeReferencetype,TypeReferencec,IMetadataResolver?resolver)
5668
{
5769
if(type.FullName==c.FullName)
5870
returntrue;
59-
vard=c.Resolve();
71+
vard=(resolver?.Resolve(c))??c.Resolve();
6072
if(d==null)
6173
returnfalse;
62-
foreach(vartind.GetTypeAndBaseTypes(cache)){
74+
foreach(vartind.GetTypeAndBaseTypes(resolver)){
6375
if(type.FullName==t.FullName)
6476
returntrue;
6577
foreach(varifaceImplint.Interfaces){
6678
vari=ifaceImpl.InterfaceType;
67-
if(IsAssignableFrom(type,i,cache))
79+
if(IsAssignableFrom(type,i,resolver))
6880
returntrue;
6981
}
7082
}
@@ -73,11 +85,13 @@ public static bool IsAssignableFrom (this TypeReference type, TypeReference c, T
7385

7486
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
7587
publicstaticboolIsSubclassOf(thisTypeDefinitiontype,stringtypeName)=>
76-
IsSubclassOf(type,typeName,cache:null);
88+
IsSubclassOf(type,typeName,resolver:null);
7789

78-
publicstaticboolIsSubclassOf(thisTypeDefinitiontype,stringtypeName,TypeDefinitionCache?cache)
90+
publicstaticboolIsSubclassOf(thisTypeDefinitiontype,stringtypeName,TypeDefinitionCache?cache)=>
91+
IsSubclassOf(type,typeName,(IMetadataResolver?)cache);
92+
publicstaticboolIsSubclassOf(thisTypeDefinitiontype,stringtypeName,IMetadataResolver?resolver)
7993
{
80-
foreach(vartintype.GetTypeAndBaseTypes(cache)){
94+
foreach(vartintype.GetTypeAndBaseTypes(resolver)){
8195
if(t.FullName==typeName){
8296
returntrue;
8397
}
@@ -87,11 +101,14 @@ public static bool IsSubclassOf (this TypeDefinition type, string typeName, Type
87101

88102
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
89103
publicstaticboolImplementsInterface(thisTypeDefinitiontype,stringinterfaceName)=>
90-
ImplementsInterface(type,interfaceName,cache:null);
104+
ImplementsInterface(type,interfaceName,resolver:null);
91105

92-
publicstaticboolImplementsInterface(thisTypeDefinitiontype,stringinterfaceName,TypeDefinitionCache?cache)
106+
publicstaticboolImplementsInterface(thisTypeDefinitiontype,stringinterfaceName,TypeDefinitionCache?cache)=>
107+
ImplementsInterface(type,interfaceName,(IMetadataResolver?)cache);
108+
109+
publicstaticboolImplementsInterface(thisTypeDefinitiontype,stringinterfaceName,IMetadataResolver?resolver)
93110
{
94-
foreach(vartintype.GetTypeAndBaseTypes(cache)){
111+
foreach(vartintype.GetTypeAndBaseTypes(resolver)){
95112
foreach(variint.Interfaces){
96113
if(i.InterfaceType.FullName==interfaceName){
97114
returntrue;
@@ -103,34 +120,43 @@ public static bool ImplementsInterface (this TypeDefinition type, string interfa
103120

104121
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
105122
publicstaticstringGetPartialAssemblyName(thisTypeReferencetype)=>
106-
GetPartialAssemblyName(type,cache:null);
123+
GetPartialAssemblyName(type,resolver:null);
124+
125+
publicstaticstringGetPartialAssemblyName(thisTypeReferencetype,TypeDefinitionCache?cache)=>
126+
GetPartialAssemblyName(type,(IMetadataResolver?)cache);
107127

108-
publicstaticstringGetPartialAssemblyName(thisTypeReferencetype,TypeDefinitionCache?cache)
128+
publicstaticstringGetPartialAssemblyName(thisTypeReferencetype,IMetadataResolver?resolver)
109129
{
110-
TypeDefinitiondef=cache!=null?cache.Resolve(type):type.Resolve();
130+
TypeDefinition?def=(resolver?.Resolve(type))??type.Resolve();
111131
return(def??type).Module.Assembly.Name.Name;
112132
}
113133

114134
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
115135
publicstaticstringGetPartialAssemblyQualifiedName(thisTypeReferencetype)=>
116-
GetPartialAssemblyQualifiedName(type,cache:null);
136+
GetPartialAssemblyQualifiedName(type,resolver:null);
117137

118-
publicstaticstringGetPartialAssemblyQualifiedName(thisTypeReferencetype,TypeDefinitionCache?cache)
138+
publicstaticstringGetPartialAssemblyQualifiedName(thisTypeReferencetype,TypeDefinitionCache?cache)=>
139+
GetPartialAssemblyQualifiedName(type,(IMetadataResolver?)cache);
140+
141+
publicstaticstringGetPartialAssemblyQualifiedName(thisTypeReferencetype,IMetadataResolver?resolver)
119142
{
120143
returnstring.Format("{0}, {1}",
121144
// Cecil likes to use '/' as the nested type separator, while
122145
// Reflection uses '+' as the nested type separator. Use Reflection.
123146
type.FullName.Replace('/','+'),
124-
type.GetPartialAssemblyName(cache));
147+
type.GetPartialAssemblyName(resolver));
125148
}
126149

127150
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
128151
publicstaticstringGetAssemblyQualifiedName(thisTypeReferencetype)=>
129-
GetAssemblyQualifiedName(type,cache:null);
152+
GetAssemblyQualifiedName(type,resolver:null);
153+
154+
publicstaticstringGetAssemblyQualifiedName(thisTypeReferencetype,TypeDefinitionCache?cache)=>
155+
GetAssemblyQualifiedName(type,(IMetadataResolver?)cache);
130156

131-
publicstaticstringGetAssemblyQualifiedName(thisTypeReferencetype,TypeDefinitionCache?cache)
157+
publicstaticstringGetAssemblyQualifiedName(thisTypeReferencetype,IMetadataResolver?resolver)
132158
{
133-
TypeDefinitiondef=cache!=null?cache.Resolve(type):type.Resolve();
159+
TypeDefinition?def=(resolver?.Resolve(type))??type.Resolve();
134160
returnstring.Format("{0}, {1}",
135161
// Cecil likes to use '/' as the nested type separator, while
136162
// Reflection uses '+' as the nested type separator. Use Reflection.

‎src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers/JavaCallableWrapperGenerator.cs‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ namespace Java.Interop.Tools.JavaCallableWrappers {
2323
publicclassJavaCallableWrapperGenerator{
2424

2525
classJavaFieldInfo{
26-
publicJavaFieldInfo(MethodDefinitionmethod,stringfieldName,TypeDefinitionCachecache)
26+
publicJavaFieldInfo(MethodDefinitionmethod,stringfieldName,IMetadataResolverresolver)
2727
{
2828
this.FieldName=fieldName;
2929
InitializerName=method.Name;
30-
TypeName=JavaNativeTypeManager.ReturnTypeFromSignature(GetJniSignature(method,cache)).Type;
30+
TypeName=JavaNativeTypeManager.ReturnTypeFromSignature(GetJniSignature(method,resolver)).Type;
3131
IsStatic=method.IsStatic;
3232
Access=method.Attributes&MethodAttributes.MemberAccessMask;
3333
Annotations=GetAnnotationsString("\t",method.CustomAttributes);
@@ -54,15 +54,20 @@ public string GetJavaAccess ()
5454
List<Signature>methods=newList<Signature>();
5555
List<Signature>ctors=newList<Signature>();
5656
List<JavaCallableWrapperGenerator>children;
57-
readonlyTypeDefinitionCachecache;
57+
readonlyIMetadataResolvercache;
5858

5959
[Obsolete("Use the TypeDefinitionCache overload for better performance.")]
6060
publicJavaCallableWrapperGenerator(TypeDefinitiontype,Action<string,object[]>log)
61-
:this(type,null,log,cache:null)
61+
:this(type,null,log,resolver:null)
6262
{}
6363

6464
publicJavaCallableWrapperGenerator(TypeDefinitiontype,Action<string,object[]>log,TypeDefinitionCachecache)
65-
:this(type,null,log,cache)
65+
:this(type,log,(IMetadataResolver)cache)
66+
{
67+
}
68+
69+
publicJavaCallableWrapperGenerator(TypeDefinitiontype,Action<string,object[]>log,IMetadataResolverresolver)
70+
:this(type,null,log,resolver)
6671
{
6772
if(type.HasNestedTypes){
6873
children=newList<JavaCallableWrapperGenerator>();
@@ -103,11 +108,11 @@ void AddNestedTypes (TypeDefinition type)
103108
HasExport|=children.Any(t =>t.HasExport);
104109
}
105110

106-
JavaCallableWrapperGenerator(TypeDefinitiontype,stringouterType,Action<string,object[]>log,TypeDefinitionCachecache)
111+
JavaCallableWrapperGenerator(TypeDefinitiontype,stringouterType,Action<string,object[]>log,IMetadataResolverresolver)
107112
{
108113
this.type=type;
109114
this.log=log;
110-
this.cache=cache??newTypeDefinitionCache();
115+
this.cache=resolver??newTypeDefinitionCache();
111116

112117
if(type.IsEnum||type.IsInterface||type.IsValueType)
113118
Diagnostic.Error(4200,LookupSource(type),Localization.Resources.JavaCallableWrappers_XA4200,type.FullName);
@@ -655,7 +660,7 @@ public Signature (MethodDefinition method, RegisterAttribute register, string ma
655660
Annotations=JavaCallableWrapperGenerator.GetAnnotationsString("\t",method.CustomAttributes);
656661
}
657662

658-
publicSignature(MethodDefinitionmethod,ExportAttributeexport,TypeDefinitionCachecache)
663+
publicSignature(MethodDefinitionmethod,ExportAttributeexport,IMetadataResolvercache)
659664
:this(method.Name,GetJniSignature(method,cache),"__export__",null,null,export.SuperArgumentsString)
660665
{
661666
IsExport=true;
@@ -666,7 +671,7 @@ public Signature (MethodDefinition method, ExportAttribute export, TypeDefinitio
666671
Annotations=JavaCallableWrapperGenerator.GetAnnotationsString("\t",method.CustomAttributes);
667672
}
668673

669-
publicSignature(MethodDefinitionmethod,ExportFieldAttributeexportField,TypeDefinitionCachecache)
674+
publicSignature(MethodDefinitionmethod,ExportFieldAttributeexportField,IMetadataResolvercache)
670675
:this(method.Name,GetJniSignature(method,cache),"__export__",null,null,null)
671676
{
672677
if(method.HasParameters)

0 commit comments

Comments
 (0)