You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure if this is a bug, but I could not find any way to invoke the convenience method assertAny from Java code.
The Kotlin function(s) are annotated with @JvmStatic (in BaristaAssertions.kt) which makes me think that there's meant to be a static version of this method which can be called from Java code, but there is no such method in the final bytecode. There IS a method com.adevinta.android.barista.internal.AssertAnyKt.assertAny in Java, but that method has a different signature assertAny(Matcher, Matcher) and also it's clearly an internal method from the package name.
I believe that reified functions cannot be called from Java code, which is why this issue appears.
If this was never meant to be possible, then I apologise and this should not be considered a bug - but in that case I'm not sure why the function is annotated as @JvmStatic.
Steps to reproduce the bug:
Write a Java file with import static com.adevinta.android.barista.assertion.BaristaAssertions.assertAny; in the imports
Compile and note that the compiler gives an error that the method was not found
Or:
Extract the classes.jar from the final aar release of barista
Decompile classes.jar using any Java decompiler (I used JD-GUI)
Observe that there is no assertAny static method in the final bytecode (apart from the internal version mentioned above)
Expected Behavior:
I expected to be able to import this method and call it from Java code. I am aware that the syntax would not be quite as simple as in Kotlin code, but still better than creating custom matchers. Is it possible to create a non-reified version of this function so it can be called from Java code?
The text was updated successfully, but these errors were encountered:
Library Version:
4.3.0
Describe the Bug:
I am not sure if this is a bug, but I could not find any way to invoke the convenience method
assertAny
from Java code.The Kotlin function(s) are annotated with
@JvmStatic
(inBaristaAssertions.kt
) which makes me think that there's meant to be a static version of this method which can be called from Java code, but there is no such method in the final bytecode. There IS a methodcom.adevinta.android.barista.internal.AssertAnyKt.assertAny
in Java, but that method has a different signatureassertAny(Matcher, Matcher)
and also it's clearly an internal method from the package name.I believe that reified functions cannot be called from Java code, which is why this issue appears.
If this was never meant to be possible, then I apologise and this should not be considered a bug - but in that case I'm not sure why the function is annotated as
@JvmStatic
.Steps to reproduce the bug:
import static com.adevinta.android.barista.assertion.BaristaAssertions.assertAny;
in the importsOr:
classes.jar
from the finalaar
release of baristaclasses.jar
using any Java decompiler (I used JD-GUI)assertAny
static method in the final bytecode (apart from the internal version mentioned above)Expected Behavior:
I expected to be able to import this method and call it from Java code. I am aware that the syntax would not be quite as simple as in Kotlin code, but still better than creating custom matchers. Is it possible to create a non-reified version of this function so it can be called from Java code?
The text was updated successfully, but these errors were encountered: