-
-
Notifications
You must be signed in to change notification settings - Fork 697
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
Java6Assertions is calling a Java 8 Streams method #1474
Comments
Streams
method
Sorry about that, it is likely due to an internal refactoring. which version are you using ? |
It looks like this one occurs starting from 3.11.0. |
It's a bit difficult to be aware of android incompatibility since we don't have tests for that. @tir38 the best option is to use assertj-core 2.9.1 which is built with java 7 thus ensuring no java 8 api is used. |
Please forgive my ignorance but why are these assertions accessible via the |
I was our attempt at the pre java 8 time to expose assertions for java 6 types only (which List is part of). Obviously we failed to maintain the java 6 compatibility when adding new assertions for List or simply refactoring the internal implementation. Sorry for that. Since we are not going to remove java 8 specific assertions from the current version, the only safe way to use AssertJ for Android is to use assertj-core 2.9.1. We will update the documentation to reflect that. |
As newer version of Android support Strams and some Android focused libs are moving to Java 8 it is not worth the bother imho.
As Joel said using 2.x is the best way to ensure no Java 8 features are used.
We should think about deprecating the Java6 assertion classes. In retrospect we should have done it when we stopped developing 2.x and started the Java 8 refactorings.
|
Deprecating Java6 assertions classes is a good idea (including documenting what to use instead) |
As part of the documentation cleanup, will you be recommending a "min" Android version for use with 3.x? Or do you think that 3.x won't support Android until Android fully supports Java8? I.e. it's up to Android to fully support Java8 and all AssertJ's cares about is supporting Java8 |
I don't think we have a 3.x version that supports Android but 2.9.1 is not that old and provides most of the non java 8 assertions in 3.x. If you find something important missing in 2.9.1, it is always possible to contribute to it and we will release a new version (but otherwise we don't spend time on 2.x). |
Closing this after deprecating Java 6 assertions entry point classes. |
"I don't think we have a 3.x version that supports Android but 2.9.1 is not that old and provides most of the non java 8 assertions in 3.x." Yep so I'm asking if you can update the docs https://assertj.github.io/doc/#assertj-core-java-versions to make it clear that people should use version 2.9.x for all versions of Android? |
I don't think is correct to say everybody Android developer should use 2.9.x. As you said |
@tir38 I have clarified this in the doc, is that better ? see https://assertj.github.io/doc/#assertj-core-android |
The goal of these entry points was to provide Java6/Android compatible assertions but since we have moved to Java 8 it became more complicated, filtering out java 8 types is not sufficient as we have refactored some assertions implementation to use lambdas and streams that made them improper to use in Java 6. Reverting all this work is not worth it as Android is moving to have more java 8 support.
We hit this stack trace on our Android test:
You can see that
Streams
got added to Android in API 24, so our tests are crashing on earlier versions.https://developer.android.com/reference/java/util/stream/Stream
We are using the correct Java6 import in our test:
I don't fully understand how the Java6Assertions package accomplishes it's task, but one of the subsequent calls is not calling purely Java-6 code.
The text was updated successfully, but these errors were encountered: