Commit a8b444d
authored
[Java.Interop.Tools.JavaTypeSystem] ctors w/ generic type parameters (#919)
While [testing][0] the new JavaTypeSystem (f658ab2) on [AndroidX][1],
the api-diff was reporting various constructors had been removed:
## Xamarin.Android.Glide.dll
#### Type Changed: Bumptech.Glide.Registry.NoModelLoaderAvailableException
Removed constructor:
```csharp
public Registry.NoModelLoaderAvailableException (Java.Lang.Object model, System.Collections.IList matchingButNotHandlingModelLoaders);
```
Investigating let to realizing Java constructors can have generic type parameters:
```java
public static class NoModelLoaderAvailableException extends MissingComponentException {
public <M> NoModelLoaderAvailableException(
@nonnull M model, @nonnull List<ModelLoader<M, ?>> matchingButNotHandlingModelLoaders) {
super(
"Found ModelLoaders for model class: "
+ matchingButNotHandlingModelLoaders
+ ", but none that handle this specific model instance: "
+ model);
}
```
[(source)][2]
`class-parse` correctly emits these constructors with generic types:
```xml
<constructor
deprecated="not deprecated"
final="false"
name="Registry.NoModelLoaderAvailableException"
static="false"
visibility="public"
bridge="false"
synthetic="false"
jni-signature="(Ljava/lang/Object;Ljava/util/List;)V">
<typeParameters>
<typeParameter
name="M"
jni-classBound="Ljava/lang/Object;"
classBound="java.lang.Object"
interfaceBounds=""
jni-interfaceBounds="" />
</typeParameters>
<parameter
name="model"
type="M"
jni-type="TM;"
not-null="true" />
<parameter
name="matchingButNotHandlingModelLoaders"
type="java.util.List<com.bumptech.glide.load.model.ModelLoader<M, ?>>"
jni-type="Ljava/util/List<Lcom/bumptech/glide/load/model/ModelLoader<TM;*>;>;"
not-null="true" />
</constructor>
```
We need to import this information in JavaTypeSystem so that the type
parameters can be resolved. Without them, the constructor is omitted
because the type `M` cannot be resolved:
The constructor 'Constructor: com.bumptech.glide.Registry.NoModelLoaderAvailableException.Registry.NoModelLoaderAvailableException'
was removed because the Java parameter type 'M' could not be found.
Tested against AndroidX and this change restores the constructors.
[0]: dotnet/android-libraries#414
[1]: https://github.com/xamarin/AndroidX
[2]: https://github.com/bumptech/glide/blob/master/library/src/main/java/com/bumptech/glide/Registry.java1 parent 0293360 commit a8b444d
File tree
1 file changed
+4
-0
lines changed- src/Java.Interop.Tools.JavaTypeSystem/Adapters
1 file changed
+4
-0
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
232 | 236 | | |
233 | 237 | | |
234 | 238 | | |
| |||
0 commit comments