Truth8 java 8 extension part of the main library?
apflieger opened this issue · 6 comments
Hello,
I couldn't find any discussion about that so I wanted to give it a chance.
java 8 is now 6 years old, I doubt there are many legacy project (<java 8) that introduce Truth in their code base whereas people starts new project on java 11 at least now.
What do you think?
Thanks. We plan to at least merge the 2 artifacts into 1 "soon" (probably months from now if it's left up to me, but this may be the kind of thing that someone could put together a PR for). We will still keep Truth
and Truth8
as separate classes for the moment, but maybe we can convince ourselves that it's safe enough to merge the classes, too. (That might well break something, for Java 7 or for Android. We'd have to see. We probably won't drop compatibility with old versions of Android yet, but if Android works but Java 7 does not, we could consider dropping Java 7.)
Yeah I mean merging Truth and Truth8 because that's what is painful to use.
Yeah. I forget if we've experimented to see what might break. Someday :(
com.google.common.truth.Truth
and com.google.common.truth.Truth8
classes reside in the same package but in different modules. After converting both maven artifacts to OSGI bundles I get java.lang.NoClassDefFoundError: com/google/common/truth/Subject
by calling Truth8.assertThat(Optional<?>).hasValue(expected)
in a downstream test bundle.
Both bundles provide Export-Package: com.google.common.truth
in MANIFEST.MF
. This looks like split package problem. Truth Subject
from "main" bundle is not visible in the "extension" bundle.
At the first glance, there are two possible solutions:
- Move
Truth8
to a subpackage likecom.google.common.truth.extensions.truth8
likeProtoTruth
andRe2jSubjects
- Merge Truth8 extension with Truth main module (preferred)
All true, thanks. We intend to merge them, but it's been difficult to schedule time for Truth among our other priorities. It is frequently on my mind, but that doesn't actually help people who are hitting this issue :(
With the release of Truth 1.4.2, this is essentially done: You no longer need the truth-java8-extension
artifact, and you no longer need the Truth8
class.
We could still do some more internal cleanup (like to move the tests of the Truth8
functionality into the core
directory). But from the perspective of users, this is finally done.