-
Notifications
You must be signed in to change notification settings - Fork 183
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
Random IllegalArgumentException when importing Java types #301
Comments
Not sure what you mean by "associative properties", but I think your diagnosis could well be correct: it doesn't define a total order. Methods of the same name, class, number of arguments and return type, could still be different in signature, so not equal, while ranking equal in the sort. |
Sorry, I've mistyped associative properties, I meant that the full signature of methods aren't used for comparison, only a subset, and there can be ambiguities. |
@DavidPerezIngeniero What do you mean by "the full signature of methods aren't used for comparison"? Jython does its best to handle overloaded methods but there are definitely issues when using scalar types in such methods. For example, Jython has never really been able to differentiate between byte, char, short, int, and long. |
I mean that only for comparison is used the name of the method, the class which it belongs to, the number of arguments, the return type, but not the type of each argument. |
@DavidPerezIngeniero That's simply not the case. It is looking at the argument types when matching methods (with the previous caveats around scalar types). Take a look at how the By the way, Java method selection never uses the return type. Try overloading a method where the return types are different and see what the Java compiler has to say about it... |
Well, @robertpatrick , @DavidPerezIngeniero quotes a specific comparator in It's different from the comparator you refer to involving Seems to me there's room for both to be right. If Hmm ... @DavidPerezIngeniero : what version is this? I can't make the line numbers correspond exactly, but 2.7.1 is nearest. |
It's jython-standalone 2.7.1b3, but the method comparator implementation hasn't changed in latest versions. |
I've been using Java 17, not Java 8. |
Good finds @robertpatrick . The bug report claims resolved in Java 9, so we should assume the general problem is fixed in @DavidPerezIngeniero's Java 17. Tricky to investigate without a reliable way to reproduce. |
@jeff5 what would be an interesting data point would be for @DavidPerezIngeniero to try using the system property to disable TimSort to see if the issue still reproduces. |
When importing this class:
whose documentation is here:
https://www.scala-lang.org/api/2.13.3/scala/jdk/CollectionConverters$.html
the following happens radomly:
Here is tha failing code from file
PyJavaType.java
:After some research, I've come to the conclusion that the
MethodComparator
for sorting the methods of a Java class, doesn't have associative properties.In the failing class, we have many methods with the same name and number of arguments but different signature.
MethodComparator
only considers:The text was updated successfully, but these errors were encountered: