Commit 74573d9
committed
[Java.Interop.Tools.JavaCallableWrappers] Support MultiDexApplication
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=40976
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=41342
There is a desire to *trivially* enable use of MultiDexApplication by
setting the $(AndroidEnableMultiDex) MSBuild property to True. When
False (the default), the normal Java Callable Wrapper (JCW) base class
naming logic would be used (e.g. use the `[Register]`ed type name of
the base class in the `extends` clause). This normal logic hinders
"trivial" use of MultiDexApplication, as it would require that any
custom `Android.App.Application` type be changed to instead inherit
`Android.Support.Multidex.MultiDexApplication`, and default
`MultiDexApplication` use is required to support other functionality
such as enhanced Fast Deployment.
The original fix for Bug #40976 altered JCW generation so that a new
`$(AndroidApplicationJavaClass)` MSBuild property -- controlled by
`$(AndroidEnableMultiDex)` -- would explicitly provide the base class
for all `Application` subclasses.
Unfortunately, the fix applied to *all* `Application` subclasses,
including "indirect" subclasses. This C# hierarchy:
partial class BaseApp : Android.App.Application {
}
partial class App : BaseApp {
}
would result in the Java Callable Wrappers for *both* `BaseApp` and
`App` inheriting from `android.app.Application`, which would cause
everything to break if `BaseApp` e.g. implemented a new interface.
This was bug #41342: indirect subclasses had the wrong base class.
For Java.Interop purposes, merge both fixes together so that
`JavaCallableWrapperGenerator.AndroidJavaClass` can be used to
override the default `android.app.Application` base class, but *only*
when the base class is `android.app.Application`. This allows "fixing"
the JCW for `BaseApp` to inherit from `MultiDexApplication` if desired
while `App` continues to inherit from `BaseApp`.1 parent 93af129 commit 74573d9
File tree
2 files changed
+28
-18
lines changed- src/Java.Interop.Tools.JavaCallableWrappers
- Java.Interop.Tools.JavaCallableWrappers
- Test/Java.Interop.Tools.JavaCallableWrappers
2 files changed
+28
-18
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
530 | 532 | | |
531 | 533 | | |
532 | 534 | | |
| 535 | + | |
| 536 | + | |
533 | 537 | | |
534 | 538 | | |
535 | 539 | | |
| |||
Lines changed: 24 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
98 | 100 | | |
99 | | - | |
100 | | - | |
| 101 | + | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | | - | |
| 106 | + | |
105 | 107 | | |
106 | 108 | | |
107 | | - | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | | - | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | | - | |
| 115 | + | |
114 | 116 | | |
115 | 117 | | |
116 | | - | |
| 118 | + | |
117 | 119 | | |
118 | | - | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
122 | | - | |
| 124 | + | |
123 | 125 | | |
124 | 126 | | |
125 | 127 | | |
126 | | - | |
| 128 | + | |
127 | 129 | | |
128 | 130 | | |
129 | | - | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | | - | |
133 | | - | |
| 134 | + | |
| 135 | + | |
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
138 | | - | |
| 140 | + | |
139 | 141 | | |
140 | 142 | | |
141 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
142 | 146 | | |
143 | 147 | | |
144 | 148 | | |
| |||
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
150 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
151 | 157 | | |
152 | | - | |
| 158 | + | |
153 | 159 | | |
154 | 160 | | |
155 | 161 | | |
| |||
0 commit comments