Migrate the documentation package to Java 11 (#729)

* Migrate the documentation package to Java 11

The old Doclet API is deprected and removed in Java 12. This commit
changes the documentation package to use the new recommended API.
However it is not a drop-in replacement and there are non-idiomatic
usages all over the place. I think it is eaiser to keep the current code
logic and kind of shoehorn in the new API than starting afresh as the
return on investment of a do-over is not great.

Also note that the docs package is disabled as of this commit because we
are still using Java 8 to compile which lacks the new API. Once we
switch our toolchains to Java 11 (but still compiling Java 8 bytecode)
we can re-enable this package.

TESTED=ran `./gradlew :docs:test` locally with the documentation package
enabled.
This commit is contained in:
Lai Jiang 2020-07-30 17:12:33 -04:00 committed by GitHub
parent a1f4e8b985
commit fba8af0485
11 changed files with 304 additions and 259 deletions

View file

@ -19,7 +19,6 @@ import static google.registry.util.BuildPathUtils.getProjectRoot;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.Joiner;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.junit.jupiter.api.Test;
@ -40,10 +39,9 @@ class FlowDocumentationTest {
"");
@Test
void testGeneratedMatchesGolden() throws IOException {
void testGeneratedMatchesGolden() throws Exception {
// Read the markdown file.
Path goldenMarkdownPath =
GOLDEN_MARKDOWN_FILEPATH;
Path goldenMarkdownPath = GOLDEN_MARKDOWN_FILEPATH;
String goldenMarkdown = new String(Files.readAllBytes(goldenMarkdownPath), UTF_8);

View file

@ -19,7 +19,6 @@ import static com.google.common.truth.Truth.assertWithMessage;
import com.google.common.collect.Sets;
import com.google.common.flogger.FluentLogger;
import google.registry.documentation.FlowDocumentation.ErrorCase;
import java.io.IOException;
import java.util.Set;
import org.junit.jupiter.api.Test;
@ -50,7 +49,7 @@ class FlowExceptionsTest {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Test
void testExceptionCorrespondence() throws IOException {
void testExceptionCorrespondence() throws Exception {
DocumentationGenerator docGenerator = new DocumentationGenerator();
Set<ErrorCase> possibleErrors = Sets.newHashSet(docGenerator.getAllErrors());
Set<String> mismatchingFlows = Sets.newHashSet();