AdevintaSpain / AdevintaSpain/Barista
Java version of assertAny
- Langage dominant
- Kotlin
- Étoiles
- 1.7k
- Forks
- 119
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
**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` (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:**
1. Write a Java file with `import static com.adevinta.android.barista.assertion.BaristaAssertions.assertAny;` in the imports
2. Compile and note that the compiler gives an error that the method was not found
Or:
1. Extract the `classes.jar` from the final `aar` release of barista
2. Decompile `classes.jar` using any Java decompiler (I used JD-GUI)
3. 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?
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.