Commit 9b89e90
authored
[generator] Ignore types without names (#837)
Fixes: #835
Context: https://github.com/firebase/firebase-android-sdk/blob/1fba4a70395c20dcc858b22ee8247acbed7cf8d3/firebase-firestore/src/main/java/com/google/firebase/firestore/model/Document.java
Context: https://maven.google.com/web/index.html?q=firestore#com.google.firebase:firebase-firestore:22.1.2
Somehow Google has compiled `firebase-firestore.aar` to contain a
`Document$.class` with a "non-sensical" *empty* inner class name:
<class
abstract="false"
deprecated="not deprecated"
jni-extends="Ljava/lang/Object;"
extends="java.lang.Object"
extends-generic-aware="java.lang.Object"
final="false"
name="Document."
jni-signature="Lcom/google/firebase/firestore/model/Document$;"
source-file-name="Document.java"
static="false"
visibility="public"
/>
The presence of a `//class[@name='Document.']` element causes an
`IndexOutOfRangeException` for `generator` when it tries to parse
`Document.` into a parent class name and nested class name.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at MonoDroid.Generation.XmlApiImporter.CreateGenBaseSupport (System.Xml.Linq.XElement pkg, System.Xml.Linq.XElement elem, System.Boolean isInterface)
at MonoDroid.Generation.XmlApiImporter.CreateClass (System.Xml.Linq.XElement pkg, System.Xml.Linq.XElement elem,
at MonoDroid.Generation.Parser.ParsePackage (System.Xml.Linq.XElement ns, System.Predicate`1[T] p)
at MonoDroid.Generation.Parser.ParsePackage (System.Xml.Linq.XElement ns)
at MonoDroid.Generation.Parser.Parse (System.Xml.Linq.XDocument doc, System.Collections.Generic.IEnumerable`1[T] fixups,
at MonoDroid.Generation.Parser.Parse (System.String filename, System.Collections.Generic.IEnumerable`1[T] fixups,
at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options,
at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options)
at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args)
We cannot reproduce *how* to get a `Document$.class` file, so we're
currently assuming this is some sort of bytecode manipulation.
As such, we are going to have `generator` ignore types with an empty
name and types that end in a period, which would indicate a nested
type with an empty name.1 parent 0e01fb5 commit 9b89e90
File tree
2 files changed
+55
-6
lines changed- tests/generator-Tests/Unit-Tests
- tools/generator/Java.Interop.Tools.Generator.Importers
2 files changed
+55
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
269 | 305 | | |
270 | 306 | | |
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
| 64 | + | |
| 65 | + | |
67 | 66 | | |
68 | 67 | | |
69 | | - | |
70 | | - | |
71 | | - | |
| 68 | + | |
| 69 | + | |
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
| |||
522 | 520 | | |
523 | 521 | | |
524 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
525 | 538 | | |
526 | 539 | | |
0 commit comments