-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IOORE importing type with name ending in a period #835
Comments
Notes: This is an issue caused by a change between Java source code: https://github.com/firebase/firebase-android-sdk/blob/master/firebase-firestore/src/main/java/com/google/firebase/firestore/model/Document.java Java library: https://maven.google.com/web/index.html?q=firestore#com.google.firebase:firebase-firestore:22.1.2
|
This would also help with this issue #789 (comment). |
I'm wondering about how specifically this is happening, as I cannot repro it: import java.util.Comparator;
class Example implements Comparable<Example> {
public int compareTo(Example a) {return 0;}
static final Comparator<Example> COMPARATOR = (left, right) -> left.compareTo(right);
public static Comparator<Example> keyComparator() { return COMPARATOR; }
} Using both JDK 1.8 and JDK 11's $ javap -l -constants -c -private -s Example.class
…
private static int lambda$static$0(Example, Example);
descriptor: (LExample;LExample;)I
Code:
0: aload_0
1: aload_1
2: invokevirtual #4 // Method compareTo:(LExample;)I
5: ireturn
LineNumberTable:
line 6: 0
static {};
descriptor: ()V
Code:
0: invokedynamic #5, 0 // InvokeDynamic #0:compare:()Ljava/util/Comparator;
5: putstatic #2 // Field COMPARATOR:Ljava/util/Comparator;
8: return
LineNumberTable:
line 6: 0 The (My Kotlin toolchain is screwed up, so I can't currently try to see what Kotlin would do in a similar scenario.) I thus don't understand where |
Doubly odd is that $ javap -constants -p -l -c -verbose -private -s Document.class| grep 'Document\$'
#28 = Utf8 com/google/firebase/firestore/model/Document$$Lambda$1
#29 = Class #28 // com/google/firebase/firestore/model/Document$$Lambda$1
#33 = Methodref #29.#32 // com/google/firebase/firestore/model/Document$$Lambda$1.lambdaFactory$:()Ljava/util/Comparator;
0: invokestatic #33 // Method com/google/firebase/firestore/model/Document$$Lambda$1.lambdaFactory$:()Ljava/util/Comparator;
# note: no mention of `Document$`,
# except as part of a larger `Document$$Lambda$1`
I have to wonder if there's some "Java bytecode post processing" going on… |
We already skip types with "obfuscated" names: so perhaps the "easy" fix is to extend |
Yeah, I couldn't repro it either, and thought this might be the case. |
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.
Fixes: dotnet/java-interop#835 Fixes: dotnet#5921 Context: dotnet#5894 Changes: http://github.com/xamarin/Java.Interop/compare/12e670a8560f69581d3a3adf0a9d91e8ce8c9afa...2573dc8c84fd4eb68e75bcae73912c26f4942356 * dotnet/java-interop@2573dc8c: [Java.Interop.Tools.*] IMetadataResolver not TypeDefinitionCache (dotnet#842) * dotnet/java-interop@412e974b: Revert "[generator] Disable [SupportedOSPlatform] until .NET 5/6. (dotnet#781)" (dotnet#841) * dotnet/java-interop@23baf0bc: [Java.Interop] Fix NRT warnings introduced by targeting 'net6.0' (dotnet#840) * dotnet/java-interop@131c1496: [generator] Fix NRE from return type not consistently set (dotnet#834) * dotnet/java-interop@100fffc1: [generator] Ensure "global::" is prepended to generic return casts. (dotnet#838) * dotnet/java-interop@9b89e90e: [generator] Ignore types without names (dotnet#837) * dotnet/java-interop@0e01fb5d: [Java.Interop.Tools.JavaSource] Merge @return block values (dotnet#836)
Fixes: dotnet/java-interop#835 Fixes: dotnet#5921 Context: dotnet#5894 Changes: http://github.com/xamarin/Java.Interop/compare/12e670a8560f69581d3a3adf0a9d91e8ce8c9afa...2573dc8c84fd4eb68e75bcae73912c26f4942356 * dotnet/java-interop@2573dc8c: [Java.Interop.Tools.*] IMetadataResolver not TypeDefinitionCache (dotnet#842) * dotnet/java-interop@412e974b: Revert "[generator] Disable [SupportedOSPlatform] until .NET 5/6. (dotnet#781)" (dotnet#841) * dotnet/java-interop@23baf0bc: [Java.Interop] Fix NRT warnings introduced by targeting 'net6.0' (dotnet#840) * dotnet/java-interop@131c1496: [generator] Fix NRE from return type not consistently set (dotnet#834) * dotnet/java-interop@100fffc1: [generator] Ensure "global::" is prepended to generic return casts. (dotnet#838) * dotnet/java-interop@9b89e90e: [generator] Ignore types without names (dotnet#837) * dotnet/java-interop@0e01fb5d: [Java.Interop.Tools.JavaSource] Merge @return block values (dotnet#836)
Fixes: dotnet/java-interop#835 Fixes: dotnet#5921 Context: dotnet#5894 Changes: http://github.com/xamarin/Java.Interop/compare/12e670a8560f69581d3a3adf0a9d91e8ce8c9afa...a5ed8919fb2ec894cb8144e51ae7c29b4811ee2a * dotnet/java-interop@a5ed8919: [Java.Interop.Tools.Cecil] Fix the xamarin-android build * dotnet/java-interop@2573dc8c: [Java.Interop.Tools.*] IMetadataResolver not TypeDefinitionCache (dotnet#842) * dotnet/java-interop@412e974b: Revert "[generator] Disable [SupportedOSPlatform] until .NET 5/6. (dotnet#781)" (dotnet#841) * dotnet/java-interop@23baf0bc: [Java.Interop] Fix NRT warnings introduced by targeting 'net6.0' (dotnet#840) * dotnet/java-interop@131c1496: [generator] Fix NRE from return type not consistently set (dotnet#834) * dotnet/java-interop@100fffc1: [generator] Ensure "global::" is prepended to generic return casts. (dotnet#838) * dotnet/java-interop@9b89e90e: [generator] Ignore types without names (dotnet#837) * dotnet/java-interop@0e01fb5d: [Java.Interop.Tools.JavaSource] Merge @return block values (dotnet#836)
Fixes: dotnet/java-interop#835 Fixes: #5921 Context: #5894 Changes: http://github.com/xamarin/Java.Interop/compare/12e670a8560f69581d3a3adf0a9d91e8ce8c9afa...a5ed8919fb2ec894cb8144e51ae7c29b4811ee2a * dotnet/java-interop@a5ed8919: [Java.Interop.Tools.Cecil] Fix the xamarin-android build * dotnet/java-interop@2573dc8c: [Java.Interop.Tools.*] IMetadataResolver not TypeDefinitionCache (#842) * dotnet/java-interop@412e974b: Revert "[generator] Disable [SupportedOSPlatform] until .NET 5/6. (#781)" (#841) * dotnet/java-interop@23baf0bc: [Java.Interop] Fix NRT warnings introduced by targeting 'net6.0' (#840) * dotnet/java-interop@131c1496: [generator] Fix NRE from return type not consistently set (#834) * dotnet/java-interop@100fffc1: [generator] Ensure "global::" is prepended to generic return casts. (#838) * dotnet/java-interop@9b89e90e: [generator] Ignore types without names (#837) * dotnet/java-interop@0e01fb5d: [Java.Interop.Tools.JavaSource] Merge @return block values (#836)
Context:
com.google.firebase.firestore.model.Document
The following code:
is being parsed out as:
The
name='Document.'
causes anIndexOutOfRangeException
building the model from the XML:The text was updated successfully, but these errors were encountered: