Run tests under Java 17
See original GitHub issueWe would want to detect anything that breaks with more recent versions than what we currently test with (Java 11).
To do so, I’m told that we’ll have to omit the --no-module-directories
option that we’re likely adding in https://github.com/google/guava/pull/5800, just as we’ll have to have found a way to omit it under Java 8.
I think that’s fine, as I think we’re using it only to work around a JDK11(?) bug that was fixed in JDK13(?): https://bugs.openjdk.java.net/browse/JDK-8215582
After that, I see issues because we pass the JDK sources to our Javadoc generation (so that @inheritDoc
works for JDK classes). We’ve seen this before, though we just omitted files to work around it. (Maybe we’d want to rewrite the files, or maybe we can really pass -source 17
or whatever nowadays??) For purposes of filing this bug, I’m just skipping that by passing -Dmaven.javadoc.skip=true
.
There’s also a TreeMap
bug that I’ve been meaning to report for a long time. (As of Java 15, that was the only test failure.)
My notes from Java 15 (internal bug 182929722) also describe some compilation errors, which I still see (as expected) under Java 17:
[ERROR] /usr/local/google/home/cpovirk/clients/guava-black/guava/guava-tests/benchmark/com/google/common/util/concurrent/FuturesGetCheckedBenchmark.java:[37,25] package java.security.acl does not exist
Just pick another exception type to test with.
[ERROR] /usr/local/google/home/cpovirk/clients/guava-black/guava/guava-tests/test/com/google/common/reflect/TypeTokenTest.java:[421,11] types java.lang.CharSequence and java.util.List<E> are incompatible; [ERROR] class java.lang.Object&java.util.List<java.lang.String>&java.lang.CharSequence inherits abstract and default for isEmpty() from types java.lang.CharSequence and java.util.List [ERROR] /usr/local/google/home/cpovirk/clients/guava-black/guava/guava-tests/test/com/google/common/reflect/TypeTokenTest.java:[435,11] types java.lang.CharSequence and java.util.List<E> are incompatible; [ERROR] class java.lang.Object&java.util.List<java.lang.String>&java.lang.CharSequence inherits abstract and default for isEmpty() from types java.lang.CharSequence and java.util.List
…because both define
isEmpty()
. Just pick another type.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (8 by maintainers)
Top GitHub Comments
That’s my initial thinking. But you raise an interesting option that I don’t think we’d considered.
We currently run the release script on our own machines and with whatever the Google default JDK is. That, particularly the second half, is not necessarily a great idea (see also internal bug 165936854), so it could be nice to hardcode a JDK that we change only deliberately.
The place to do that would be (Google-internal)
devtools/javalibraries/release/release.sh
. It would need to pull a Java 17 from somewhere (I can point you at a Java Platform Team copy) and pointJAVA_HOME
at that. (Or there’s probably some better way that we should be doing all this.)That would also mean fixing the tests – for this project and for the other project that use that script, or else we could make the choice of JDK conditional on the project.
I think I’ve seen the early-access approach in Error Prone. It sounds like a good idea, too, though I want to say we’re all pulling from a common Google quota, so there is some cost.
(I have been meaning to report the
TreeMap
thing forever 😦 One of these years…)RE: Mockito: It looks specific to the
InnocuousThread
tests:The simplest thing is probably just to not use Mockito there, since we don’t really need it. That will also make our tests runnable under GWT, which is nice. I’ll take a stab at it.