From 69a84e9b81068c00c4da221f4db4f3fc7dc2412d Mon Sep 17 00:00:00 2001 From: Chris Vest Date: Tue, 4 Dec 2018 21:22:49 +0100 Subject: [PATCH 01/20] Update snapshot version to 2.0.0. Also update Java dependency to Java 11, and update all Maven plugins to the latest version. Also add a requirement that the Maven version must be at least 3.0.5 in order to support the latest plugins. --- pom.xml | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/pom.xml b/pom.xml index a4f0e21..1900cf5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.asciidoctor asciidoclet jar - 1.5.7-SNAPSHOT + 2.0.0-SNAPSHOT AsciiDoc Javadoc Doclet @@ -46,13 +46,6 @@ asciidoctorj 1.5.8.1 - - com.sun.tools - tools - ${java.version} - system - ${java.home}/../lib/tools.jar - org.slf4j slf4j-simple @@ -97,19 +90,39 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M2 + + + enforce-maven + + enforce + + + + + 3.0.5 + + + + + + org.apache.maven.plugins maven-compiler-plugin - 3.1 + 3.8.0 - 1.6 - 1.6 + 11 + 11 org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.0.1 attach-sources @@ -123,7 +136,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9 + 3.0.1 attach-javadocs @@ -140,12 +153,12 @@ asciidoclet ${project.version} - + --base-dir ${project.basedir} --attribute "project_name=${project.name}" --attribute "project_version=${project.version}" --attribute "project_desc=${project.description}" - + true src/main/java/overview.adoc @@ -154,7 +167,7 @@ com.mycila.maven-license-plugin maven-license-plugin - 1.9.0 + 1.10.b1
NOTICE
@@ -178,7 +191,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.1.1 + 3.2.1 true shaded From 19dfdc0916158345ba6eed02ee62222d7cc9366e Mon Sep 17 00:00:00 2001 From: Chris Vest Date: Tue, 4 Dec 2018 21:38:53 +0100 Subject: [PATCH 02/20] Modularise and get things compiling on Java 11. The StandardAdapter was trashed in the process, though. --- pom.xml | 2 +- src/main/java/module-info.java | 22 +++++++++++++++++++ .../Asciidoclet.java | 12 ++++++---- .../asciidoclet/AsciidoctorRenderer.java | 4 ++-- .../asciidoclet/AttributesLoader.java | 4 ++-- .../asciidoclet/DocletIterator.java | 4 ++-- .../asciidoclet/DocletOptions.java | 4 ++-- .../asciidoclet/DocletRenderer.java | 4 ++-- .../asciidoclet/OutputTemplates.java | 4 ++-- .../asciidoclet/StandardAdapter.java | 11 +++++----- .../asciidoclet/Stylesheets.java | 4 ++-- .../package-info.java | 8 +++---- .../AsciidocletTest.java | 15 ++++++++----- .../asciidoclet/AsciidoctorRendererTest.java | 9 +++++--- .../asciidoclet/AttributesLoaderTest.java | 6 +++-- .../asciidoclet/DocletIteratorTest.java | 9 +++++--- .../asciidoclet/DocletOptionsTest.java | 9 ++++---- .../asciidoclet/StandardAdapterTest.java | 22 +++++++++---------- .../asciidoclet/StylesheetsTest.java | 14 +++++++----- 19 files changed, 103 insertions(+), 64 deletions(-) create mode 100644 src/main/java/module-info.java rename src/main/java/org/{asciidoctor => asciidoclet}/Asciidoclet.java (95%) rename src/main/java/org/{asciidoctor => asciidoclet}/asciidoclet/AsciidoctorRenderer.java (98%) rename src/main/java/org/{asciidoctor => asciidoclet}/asciidoclet/AttributesLoader.java (98%) rename src/main/java/org/{asciidoctor => asciidoclet}/asciidoclet/DocletIterator.java (98%) rename src/main/java/org/{asciidoctor => asciidoclet}/asciidoclet/DocletOptions.java (98%) rename src/main/java/org/{asciidoctor => asciidoclet}/asciidoclet/DocletRenderer.java (90%) rename src/main/java/org/{asciidoctor => asciidoclet}/asciidoclet/OutputTemplates.java (97%) rename src/main/java/org/{asciidoctor => asciidoclet}/asciidoclet/StandardAdapter.java (78%) rename src/main/java/org/{asciidoctor => asciidoclet}/asciidoclet/Stylesheets.java (97%) rename src/main/java/org/{asciidoctor => asciidoclet}/package-info.java (96%) rename src/test/java/org/{asciidoctor => asciidoclet}/AsciidocletTest.java (89%) rename src/test/java/org/{asciidoctor => asciidoclet}/asciidoclet/AsciidoctorRendererTest.java (93%) rename src/test/java/org/{asciidoctor => asciidoclet}/asciidoclet/AttributesLoaderTest.java (97%) rename src/test/java/org/{asciidoctor => asciidoclet}/asciidoclet/DocletIteratorTest.java (93%) rename src/test/java/org/{asciidoctor => asciidoclet}/asciidoclet/DocletOptionsTest.java (91%) rename src/test/java/org/{asciidoctor => asciidoclet}/asciidoclet/StandardAdapterTest.java (74%) rename src/test/java/org/{asciidoctor => asciidoclet}/asciidoclet/StylesheetsTest.java (86%) diff --git a/pom.xml b/pom.xml index 1900cf5..88996ca 100644 --- a/pom.xml +++ b/pom.xml @@ -147,7 +147,7 @@
1.7 - org.asciidoctor.Asciidoclet + org.asciidoclet.Asciidoclet org.asciidoctor asciidoclet diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..c5b2402 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,22 @@ +/** + * Copyright 2013-2018 John Ericksen + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +module asciidoclet { + requires java.base; + requires jdk.javadoc; + requires asciidoctorj; + requires guava; + exports org.asciidoclet; +} \ No newline at end of file diff --git a/src/main/java/org/asciidoctor/Asciidoclet.java b/src/main/java/org/asciidoclet/Asciidoclet.java similarity index 95% rename from src/main/java/org/asciidoctor/Asciidoclet.java rename to src/main/java/org/asciidoclet/Asciidoclet.java index 513557f..8d32fd3 100644 --- a/src/main/java/org/asciidoctor/Asciidoclet.java +++ b/src/main/java/org/asciidoclet/Asciidoclet.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,13 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor; +package org.asciidoclet; import com.sun.javadoc.DocErrorReporter; import com.sun.javadoc.Doclet; import com.sun.javadoc.LanguageVersion; import com.sun.javadoc.RootDoc; -import org.asciidoctor.asciidoclet.*; +import org.asciidoclet.asciidoclet.AsciidoctorRenderer; +import org.asciidoclet.asciidoclet.DocletIterator; +import org.asciidoclet.asciidoclet.DocletOptions; +import org.asciidoclet.asciidoclet.StandardAdapter; +import org.asciidoclet.asciidoclet.Stylesheets; /** * = Asciidoclet @@ -163,7 +167,7 @@ * * @author https://github.com/johncarl81[John Ericksen] * @version {project_version} - * @see org.asciidoctor.Asciidoclet + * @see Asciidoclet * @since 0.1.0 * @serial (or @serialField or @serialData) */ diff --git a/src/main/java/org/asciidoctor/asciidoclet/AsciidoctorRenderer.java b/src/main/java/org/asciidoclet/asciidoclet/AsciidoctorRenderer.java similarity index 98% rename from src/main/java/org/asciidoctor/asciidoclet/AsciidoctorRenderer.java rename to src/main/java/org/asciidoclet/asciidoclet/AsciidoctorRenderer.java index 240eb73..32ab281 100644 --- a/src/main/java/org/asciidoctor/asciidoclet/AsciidoctorRenderer.java +++ b/src/main/java/org/asciidoclet/asciidoclet/AsciidoctorRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.google.common.base.Optional; import com.sun.javadoc.Doc; diff --git a/src/main/java/org/asciidoctor/asciidoclet/AttributesLoader.java b/src/main/java/org/asciidoclet/asciidoclet/AttributesLoader.java similarity index 98% rename from src/main/java/org/asciidoctor/asciidoclet/AttributesLoader.java rename to src/main/java/org/asciidoclet/asciidoclet/AttributesLoader.java index b47e768..44580b4 100644 --- a/src/main/java/org/asciidoctor/asciidoclet/AttributesLoader.java +++ b/src/main/java/org/asciidoclet/asciidoclet/AttributesLoader.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.google.common.base.Optional; import com.google.common.collect.ImmutableSet; diff --git a/src/main/java/org/asciidoctor/asciidoclet/DocletIterator.java b/src/main/java/org/asciidoclet/asciidoclet/DocletIterator.java similarity index 98% rename from src/main/java/org/asciidoctor/asciidoclet/DocletIterator.java rename to src/main/java/org/asciidoclet/asciidoclet/DocletIterator.java index d1a51ae..7f94050 100644 --- a/src/main/java/org/asciidoctor/asciidoclet/DocletIterator.java +++ b/src/main/java/org/asciidoclet/asciidoclet/DocletIterator.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.google.common.base.Optional; import com.google.common.io.Files; diff --git a/src/main/java/org/asciidoctor/asciidoclet/DocletOptions.java b/src/main/java/org/asciidoclet/asciidoclet/DocletOptions.java similarity index 98% rename from src/main/java/org/asciidoctor/asciidoclet/DocletOptions.java rename to src/main/java/org/asciidoclet/asciidoclet/DocletOptions.java index a8512c9..28e4481 100644 --- a/src/main/java/org/asciidoctor/asciidoclet/DocletOptions.java +++ b/src/main/java/org/asciidoclet/asciidoclet/DocletOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.google.common.base.Optional; import com.google.common.base.Splitter; diff --git a/src/main/java/org/asciidoctor/asciidoclet/DocletRenderer.java b/src/main/java/org/asciidoclet/asciidoclet/DocletRenderer.java similarity index 90% rename from src/main/java/org/asciidoctor/asciidoclet/DocletRenderer.java rename to src/main/java/org/asciidoclet/asciidoclet/DocletRenderer.java index 1dccf83..ee32c91 100644 --- a/src/main/java/org/asciidoctor/asciidoclet/DocletRenderer.java +++ b/src/main/java/org/asciidoclet/asciidoclet/DocletRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.sun.javadoc.Doc; diff --git a/src/main/java/org/asciidoctor/asciidoclet/OutputTemplates.java b/src/main/java/org/asciidoclet/asciidoclet/OutputTemplates.java similarity index 97% rename from src/main/java/org/asciidoctor/asciidoclet/OutputTemplates.java rename to src/main/java/org/asciidoclet/asciidoclet/OutputTemplates.java index 26dd46b..037ea22 100644 --- a/src/main/java/org/asciidoctor/asciidoclet/OutputTemplates.java +++ b/src/main/java/org/asciidoclet/asciidoclet/OutputTemplates.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.google.common.base.Optional; import com.google.common.io.ByteSink; diff --git a/src/main/java/org/asciidoctor/asciidoclet/StandardAdapter.java b/src/main/java/org/asciidoclet/asciidoclet/StandardAdapter.java similarity index 78% rename from src/main/java/org/asciidoctor/asciidoclet/StandardAdapter.java rename to src/main/java/org/asciidoclet/asciidoclet/StandardAdapter.java index dbf8c4b..a9de8c0 100644 --- a/src/main/java/org/asciidoctor/asciidoclet/StandardAdapter.java +++ b/src/main/java/org/asciidoclet/asciidoclet/StandardAdapter.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.sun.javadoc.DocErrorReporter; import com.sun.javadoc.RootDoc; -import com.sun.tools.doclets.standard.Standard; /** * Adapter class to use the Standard Javadoc Doclet in a non-static context. @@ -27,14 +26,14 @@ public class StandardAdapter { public int optionLength(String option) { - return Standard.optionLength(option); + return 0;//Standard.optionLength(option); } public boolean start(RootDoc rootDoc) { - return Standard.start(rootDoc); + return true;//Standard.start(rootDoc); } public boolean validOptions(String[][] options, DocErrorReporter errorReporter) { - return Standard.validOptions(options, errorReporter); + return false;//Standard.validOptions(options, errorReporter); } } diff --git a/src/main/java/org/asciidoctor/asciidoclet/Stylesheets.java b/src/main/java/org/asciidoclet/asciidoclet/Stylesheets.java similarity index 97% rename from src/main/java/org/asciidoctor/asciidoclet/Stylesheets.java rename to src/main/java/org/asciidoclet/asciidoclet/Stylesheets.java index c44869a..25fd9ca 100644 --- a/src/main/java/org/asciidoctor/asciidoclet/Stylesheets.java +++ b/src/main/java/org/asciidoclet/asciidoclet/Stylesheets.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.google.common.io.Resources; import com.sun.javadoc.DocErrorReporter; diff --git a/src/main/java/org/asciidoctor/package-info.java b/src/main/java/org/asciidoclet/package-info.java similarity index 96% rename from src/main/java/org/asciidoctor/package-info.java rename to src/main/java/org/asciidoclet/package-info.java index 6f3a57d..5070ee8 100644 --- a/src/main/java/org/asciidoctor/package-info.java +++ b/src/main/java/org/asciidoclet/package-info.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ * 2.9 * * 1.7 - * org.asciidoctor.Asciidoclet + * org.asciidoclet.Asciidoclet * * org.asciidoclet * asciidoclet @@ -173,8 +173,8 @@ * * @author https://github.com/johncarl81[John Ericksen] * @version 0.1.0 - * @see org.asciidoctor.Asciidoclet + * @see org.asciidoclet.Asciidoclet * @since 0.1.0 * @serial (or @serialField or @serialData) */ -package org.asciidoctor; +package org.asciidoclet; diff --git a/src/test/java/org/asciidoctor/AsciidocletTest.java b/src/test/java/org/asciidoclet/AsciidocletTest.java similarity index 89% rename from src/test/java/org/asciidoctor/AsciidocletTest.java rename to src/test/java/org/asciidoclet/AsciidocletTest.java index 635def0..115c055 100644 --- a/src/test/java/org/asciidoctor/AsciidocletTest.java +++ b/src/test/java/org/asciidoclet/AsciidocletTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,12 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor; +package org.asciidoclet; import com.sun.javadoc.DocErrorReporter; import com.sun.javadoc.LanguageVersion; import com.sun.javadoc.RootDoc; -import org.asciidoctor.asciidoclet.*; +import org.asciidoclet.Asciidoclet; +import org.asciidoclet.asciidoclet.DocletIterator; +import org.asciidoclet.asciidoclet.DocletOptions; +import org.asciidoclet.asciidoclet.DocletRenderer; +import org.asciidoclet.asciidoclet.StandardAdapter; +import org.asciidoclet.asciidoclet.Stylesheets; import org.junit.Before; import org.junit.Test; @@ -40,7 +45,7 @@ public void setup() { mockAdapter = mock(StandardAdapter.class); mockIterator = mock(DocletIterator.class); mockStylesheets = mock(Stylesheets.class); - when(mockIterator.render(any(RootDoc.class), any(DocletRenderer.class))).thenReturn(true); + when(mockIterator.render(any(RootDoc.class), any( DocletRenderer.class))).thenReturn(true); when(mockStylesheets.copy()).thenReturn(true); } @@ -51,7 +56,7 @@ public void testVersion() { @Test public void testIncludeBaseDirOptionLength() { - assertEquals(2, Asciidoclet.optionLength(DocletOptions.BASEDIR, mockAdapter)); + assertEquals(2, Asciidoclet.optionLength( DocletOptions.BASEDIR, mockAdapter)); verifyZeroInteractions(mockAdapter); verifyZeroInteractions(mockIterator); diff --git a/src/test/java/org/asciidoctor/asciidoclet/AsciidoctorRendererTest.java b/src/test/java/org/asciidoclet/asciidoclet/AsciidoctorRendererTest.java similarity index 93% rename from src/test/java/org/asciidoctor/asciidoclet/AsciidoctorRendererTest.java rename to src/test/java/org/asciidoclet/asciidoclet/AsciidoctorRendererTest.java index 097853e..2fad163 100644 --- a/src/test/java/org/asciidoctor/asciidoclet/AsciidoctorRendererTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/AsciidoctorRendererTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,13 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.google.common.base.Optional; import com.sun.javadoc.Doc; import com.sun.javadoc.DocErrorReporter; import com.sun.javadoc.ParamTag; import com.sun.javadoc.Tag; +import org.asciidoclet.asciidoclet.AsciidoctorRenderer; +import org.asciidoclet.asciidoclet.DocletOptions; +import org.asciidoclet.asciidoclet.OutputTemplates; import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.junit.Before; @@ -41,7 +44,7 @@ public class AsciidoctorRendererTest { @Before public void setup() { mockAsciidoctor = mock(Asciidoctor.class); - renderer = new AsciidoctorRenderer(DocletOptions.NONE, mock(DocErrorReporter.class), Optional.absent(), mockAsciidoctor); + renderer = new AsciidoctorRenderer( DocletOptions.NONE, mock(DocErrorReporter.class), Optional.absent(), mockAsciidoctor); } @Test diff --git a/src/test/java/org/asciidoctor/asciidoclet/AttributesLoaderTest.java b/src/test/java/org/asciidoclet/asciidoclet/AttributesLoaderTest.java similarity index 97% rename from src/test/java/org/asciidoctor/asciidoclet/AttributesLoaderTest.java rename to src/test/java/org/asciidoclet/asciidoclet/AttributesLoaderTest.java index f369bd8..f388bd9 100644 --- a/src/test/java/org/asciidoctor/asciidoclet/AttributesLoaderTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/AttributesLoaderTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,11 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.google.common.base.Charsets; import com.google.common.io.Files; import com.sun.javadoc.DocErrorReporter; +import org.asciidoclet.asciidoclet.AttributesLoader; +import org.asciidoclet.asciidoclet.DocletOptions; import org.asciidoctor.Asciidoctor; import org.hamcrest.Matchers; import org.junit.Rule; diff --git a/src/test/java/org/asciidoctor/asciidoclet/DocletIteratorTest.java b/src/test/java/org/asciidoclet/asciidoclet/DocletIteratorTest.java similarity index 93% rename from src/test/java/org/asciidoctor/asciidoclet/DocletIteratorTest.java rename to src/test/java/org/asciidoclet/asciidoclet/DocletIteratorTest.java index 17c8ecf..2209132 100644 --- a/src/test/java/org/asciidoctor/asciidoclet/DocletIteratorTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/DocletIteratorTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,9 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.sun.javadoc.*; +import org.asciidoclet.asciidoclet.DocletIterator; +import org.asciidoclet.asciidoclet.DocletOptions; +import org.asciidoclet.asciidoclet.DocletRenderer; import org.junit.Before; import org.junit.Test; @@ -65,7 +68,7 @@ private T mockClassDoc(Class type, PackageDoc packageDoc @Test public void testIteration() { - new DocletIterator(DocletOptions.NONE).render(mockDoc, mockRenderer); + new DocletIterator( DocletOptions.NONE).render(mockDoc, mockRenderer); verify(mockRenderer).renderDoc(mockClassDoc); verify(mockRenderer).renderDoc(mockFieldDoc); diff --git a/src/test/java/org/asciidoctor/asciidoclet/DocletOptionsTest.java b/src/test/java/org/asciidoclet/asciidoclet/DocletOptionsTest.java similarity index 91% rename from src/test/java/org/asciidoctor/asciidoclet/DocletOptionsTest.java rename to src/test/java/org/asciidoclet/asciidoclet/DocletOptionsTest.java index fa6c2ea..488faf6 100644 --- a/src/test/java/org/asciidoctor/asciidoclet/DocletOptionsTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/DocletOptionsTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,14 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.google.common.base.Charsets; +import org.asciidoclet.asciidoclet.DocletOptions; import org.junit.Test; import java.nio.charset.Charset; -import static org.asciidoctor.asciidoclet.DocletOptions.*; +import static org.asciidoclet.asciidoclet.DocletOptions.*; import static org.hamcrest.Matchers.contains; import static org.junit.Assert.*; @@ -28,7 +29,7 @@ public class DocletOptionsTest { @Test public void testGetBaseDir() { - assertFalse(DocletOptions.NONE.baseDir().isPresent()); + assertFalse( DocletOptions.NONE.baseDir().isPresent()); assertEquals("test", new DocletOptions(new String[][]{{BASEDIR, "test"}}).baseDir().get().getName()); } diff --git a/src/test/java/org/asciidoctor/asciidoclet/StandardAdapterTest.java b/src/test/java/org/asciidoclet/asciidoclet/StandardAdapterTest.java similarity index 74% rename from src/test/java/org/asciidoctor/asciidoclet/StandardAdapterTest.java rename to src/test/java/org/asciidoclet/asciidoclet/StandardAdapterTest.java index b5c39bc..aaf0ac5 100644 --- a/src/test/java/org/asciidoctor/asciidoclet/StandardAdapterTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/StandardAdapterTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.sun.javadoc.DocErrorReporter; import com.sun.javadoc.RootDoc; -import com.sun.tools.doclets.standard.Standard; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import static org.junit.Assert.assertEquals; @@ -33,14 +31,14 @@ * @author John Ericksen */ @RunWith(PowerMockRunner.class) -@PrepareForTest(Standard.class) +//@PrepareForTest(Standard.class) public class StandardAdapterTest { private StandardAdapter adapter; @Before public void setup() throws Exception { - PowerMockito.mockStatic(Standard.class); +// PowerMockito.mockStatic(Standard.class); adapter = new StandardAdapter(); } @@ -49,24 +47,24 @@ public void testOptionLength() throws Exception { String options = "options"; int optionsLength = 42; - PowerMockito.when(Standard.class, "optionLength", options).thenReturn(optionsLength); +// PowerMockito.when(Standard.class, "optionLength", options).thenReturn(optionsLength); assertEquals(optionsLength, adapter.optionLength(options)); PowerMockito.verifyStatic(); - Standard.optionLength(options); +// Standard.optionLength(options); } @Test public void testStart() throws Exception { RootDoc mockDoc = mock(RootDoc.class); - PowerMockito.when(Standard.class, "start", mockDoc).thenReturn(true); +// PowerMockito.when(Standard.class, "start", mockDoc).thenReturn(true); assertTrue(adapter.start(mockDoc)); PowerMockito.verifyStatic(); - Standard.start(mockDoc); +// Standard.start(mockDoc); } @Test @@ -74,11 +72,11 @@ public void testValidOptions() throws Exception { DocErrorReporter mockReporter = mock(DocErrorReporter.class); String[][] options = new String[][]{{"test"}}; - PowerMockito.when(Standard.class, "validOptions", options, mockReporter).thenReturn(true); +// PowerMockito.when(Standard.class, "validOptions", options, mockReporter).thenReturn(true); assertTrue(adapter.validOptions(options, mockReporter)); PowerMockito.verifyStatic(); - Standard.validOptions(options, mockReporter); +// Standard.validOptions(options, mockReporter); } } diff --git a/src/test/java/org/asciidoctor/asciidoclet/StylesheetsTest.java b/src/test/java/org/asciidoclet/asciidoclet/StylesheetsTest.java similarity index 86% rename from src/test/java/org/asciidoctor/asciidoclet/StylesheetsTest.java rename to src/test/java/org/asciidoclet/asciidoclet/StylesheetsTest.java index cf9c7d0..aed256e 100644 --- a/src/test/java/org/asciidoctor/asciidoclet/StylesheetsTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/StylesheetsTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2013-2015 John Ericksen + * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,15 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.asciidoctor.asciidoclet; +package org.asciidoclet.asciidoclet; import com.sun.javadoc.DocErrorReporter; +import org.asciidoclet.asciidoclet.DocletOptions; +import org.asciidoclet.asciidoclet.Stylesheets; import org.junit.Before; import org.junit.Test; -import static org.asciidoctor.asciidoclet.Stylesheets.JAVA6_STYLESHEET; -import static org.asciidoctor.asciidoclet.Stylesheets.JAVA8_STYLESHEET; -import static org.asciidoctor.asciidoclet.Stylesheets.JAVA9_STYLESHEET; +import static org.asciidoclet.asciidoclet.Stylesheets.JAVA6_STYLESHEET; +import static org.asciidoclet.asciidoclet.Stylesheets.JAVA8_STYLESHEET; +import static org.asciidoclet.asciidoclet.Stylesheets.JAVA9_STYLESHEET; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.*; @@ -33,7 +35,7 @@ public class StylesheetsTest { @Before public void setup() throws Exception { mockErrorReporter = mock(DocErrorReporter.class); - stylesheets = new Stylesheets(DocletOptions.NONE, mockErrorReporter); + stylesheets = new Stylesheets( DocletOptions.NONE, mockErrorReporter); } @Test From ccd0f58ceb805e2ced74bbdfdc3e5f9cf9f2b845 Mon Sep 17 00:00:00 2001 From: Chris Vest Date: Tue, 4 Dec 2018 21:43:18 +0100 Subject: [PATCH 03/20] License headers are not javadocs. --- pom.xml | 3 +++ src/main/java/module-info.java | 2 +- src/main/java/org/asciidoclet/Asciidoclet.java | 2 +- .../java/org/asciidoclet/asciidoclet/AsciidoctorRenderer.java | 2 +- .../java/org/asciidoclet/asciidoclet/AttributesLoader.java | 2 +- src/main/java/org/asciidoclet/asciidoclet/DocletIterator.java | 2 +- src/main/java/org/asciidoclet/asciidoclet/DocletOptions.java | 2 +- src/main/java/org/asciidoclet/asciidoclet/DocletRenderer.java | 2 +- src/main/java/org/asciidoclet/asciidoclet/OutputTemplates.java | 2 +- src/main/java/org/asciidoclet/asciidoclet/StandardAdapter.java | 2 +- src/main/java/org/asciidoclet/asciidoclet/Stylesheets.java | 2 +- src/main/java/org/asciidoclet/package-info.java | 2 +- src/test/java/org/asciidoclet/AsciidocletTest.java | 2 +- .../org/asciidoclet/asciidoclet/AsciidoctorRendererTest.java | 2 +- .../java/org/asciidoclet/asciidoclet/AttributesLoaderTest.java | 2 +- .../java/org/asciidoclet/asciidoclet/DocletIteratorTest.java | 2 +- .../java/org/asciidoclet/asciidoclet/DocletOptionsTest.java | 2 +- .../java/org/asciidoclet/asciidoclet/StandardAdapterTest.java | 2 +- src/test/java/org/asciidoclet/asciidoclet/StylesheetsTest.java | 2 +- 19 files changed, 21 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index 88996ca..ea0d5ac 100644 --- a/pom.xml +++ b/pom.xml @@ -186,6 +186,9 @@ true true + + SLASHSTAR_STYLE +
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index c5b2402..5e1099b 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/org/asciidoclet/Asciidoclet.java b/src/main/java/org/asciidoclet/Asciidoclet.java index 8d32fd3..c4c7df0 100644 --- a/src/main/java/org/asciidoclet/Asciidoclet.java +++ b/src/main/java/org/asciidoclet/Asciidoclet.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/org/asciidoclet/asciidoclet/AsciidoctorRenderer.java b/src/main/java/org/asciidoclet/asciidoclet/AsciidoctorRenderer.java index 32ab281..134d42f 100644 --- a/src/main/java/org/asciidoclet/asciidoclet/AsciidoctorRenderer.java +++ b/src/main/java/org/asciidoclet/asciidoclet/AsciidoctorRenderer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/org/asciidoclet/asciidoclet/AttributesLoader.java b/src/main/java/org/asciidoclet/asciidoclet/AttributesLoader.java index 44580b4..9444a06 100644 --- a/src/main/java/org/asciidoclet/asciidoclet/AttributesLoader.java +++ b/src/main/java/org/asciidoclet/asciidoclet/AttributesLoader.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/org/asciidoclet/asciidoclet/DocletIterator.java b/src/main/java/org/asciidoclet/asciidoclet/DocletIterator.java index 7f94050..69d5ef6 100644 --- a/src/main/java/org/asciidoclet/asciidoclet/DocletIterator.java +++ b/src/main/java/org/asciidoclet/asciidoclet/DocletIterator.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/org/asciidoclet/asciidoclet/DocletOptions.java b/src/main/java/org/asciidoclet/asciidoclet/DocletOptions.java index 28e4481..a81510e 100644 --- a/src/main/java/org/asciidoclet/asciidoclet/DocletOptions.java +++ b/src/main/java/org/asciidoclet/asciidoclet/DocletOptions.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/org/asciidoclet/asciidoclet/DocletRenderer.java b/src/main/java/org/asciidoclet/asciidoclet/DocletRenderer.java index ee32c91..a61ff68 100644 --- a/src/main/java/org/asciidoclet/asciidoclet/DocletRenderer.java +++ b/src/main/java/org/asciidoclet/asciidoclet/DocletRenderer.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/org/asciidoclet/asciidoclet/OutputTemplates.java b/src/main/java/org/asciidoclet/asciidoclet/OutputTemplates.java index 037ea22..6d93849 100644 --- a/src/main/java/org/asciidoclet/asciidoclet/OutputTemplates.java +++ b/src/main/java/org/asciidoclet/asciidoclet/OutputTemplates.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/org/asciidoclet/asciidoclet/StandardAdapter.java b/src/main/java/org/asciidoclet/asciidoclet/StandardAdapter.java index a9de8c0..86eb290 100644 --- a/src/main/java/org/asciidoclet/asciidoclet/StandardAdapter.java +++ b/src/main/java/org/asciidoclet/asciidoclet/StandardAdapter.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/org/asciidoclet/asciidoclet/Stylesheets.java b/src/main/java/org/asciidoclet/asciidoclet/Stylesheets.java index 25fd9ca..6e698fb 100644 --- a/src/main/java/org/asciidoclet/asciidoclet/Stylesheets.java +++ b/src/main/java/org/asciidoclet/asciidoclet/Stylesheets.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/main/java/org/asciidoclet/package-info.java b/src/main/java/org/asciidoclet/package-info.java index 5070ee8..057d24b 100644 --- a/src/main/java/org/asciidoclet/package-info.java +++ b/src/main/java/org/asciidoclet/package-info.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/org/asciidoclet/AsciidocletTest.java b/src/test/java/org/asciidoclet/AsciidocletTest.java index 115c055..35ec1e1 100644 --- a/src/test/java/org/asciidoclet/AsciidocletTest.java +++ b/src/test/java/org/asciidoclet/AsciidocletTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/org/asciidoclet/asciidoclet/AsciidoctorRendererTest.java b/src/test/java/org/asciidoclet/asciidoclet/AsciidoctorRendererTest.java index 2fad163..d7ea4c5 100644 --- a/src/test/java/org/asciidoclet/asciidoclet/AsciidoctorRendererTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/AsciidoctorRendererTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/org/asciidoclet/asciidoclet/AttributesLoaderTest.java b/src/test/java/org/asciidoclet/asciidoclet/AttributesLoaderTest.java index f388bd9..7755b0b 100644 --- a/src/test/java/org/asciidoclet/asciidoclet/AttributesLoaderTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/AttributesLoaderTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/org/asciidoclet/asciidoclet/DocletIteratorTest.java b/src/test/java/org/asciidoclet/asciidoclet/DocletIteratorTest.java index 2209132..7c6181b 100644 --- a/src/test/java/org/asciidoclet/asciidoclet/DocletIteratorTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/DocletIteratorTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/org/asciidoclet/asciidoclet/DocletOptionsTest.java b/src/test/java/org/asciidoclet/asciidoclet/DocletOptionsTest.java index 488faf6..9bb6958 100644 --- a/src/test/java/org/asciidoclet/asciidoclet/DocletOptionsTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/DocletOptionsTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/org/asciidoclet/asciidoclet/StandardAdapterTest.java b/src/test/java/org/asciidoclet/asciidoclet/StandardAdapterTest.java index aaf0ac5..f518de4 100644 --- a/src/test/java/org/asciidoclet/asciidoclet/StandardAdapterTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/StandardAdapterTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/test/java/org/asciidoclet/asciidoclet/StylesheetsTest.java b/src/test/java/org/asciidoclet/asciidoclet/StylesheetsTest.java index aed256e..904d6c3 100644 --- a/src/test/java/org/asciidoclet/asciidoclet/StylesheetsTest.java +++ b/src/test/java/org/asciidoclet/asciidoclet/StylesheetsTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2013-2018 John Ericksen * * Licensed under the Apache License, Version 2.0 (the "License"); From 4b128b7cbc0f8a2f8090a8855fe9255fcbffc1d2 Mon Sep 17 00:00:00 2001 From: Chris Vest Date: Fri, 7 Jun 2019 16:08:11 +0200 Subject: [PATCH 04/20] First draft of getting the asciidoclet to run on the new Javadoc APIs under Java 11. Many things are broken. This is currently more of an exploratory prototype, than it is working but incomplete code. There are a lot of ugly hacks here, to work around the new restrictions of the javadoc APIs. --- pom.xml | 69 +++-- .../java/org/asciidoclet/Asciidoclet.java | 156 ++++------ .../java/org/asciidoclet/OptionProcessor.java | 71 +++++ .../asciidoclet/AsciidocletOptions.java | 78 +++++ .../AsciidoctorFilteredEnvironment.java | 289 ++++++++++++++++++ .../asciidoclet/AsciidoctorRenderer.java | 22 +- .../asciidoclet/AttributesLoader.java | 16 +- .../asciidoclet/DocletIterator.java | 115 ------- .../asciidoclet/DocletOptions.java | 192 ++++-------- .../asciidoclet/DocletRenderer.java | 28 -- .../LazyDocCommentTableProcessor.java | 75 +++++ .../asciidoclet/OutputTemplates.java | 36 +-- .../asciidoclet/StandardAdapter.java | 39 --- .../asciidoclet/asciidoclet/Stylesheets.java | 15 +- .../AsciidocletIntegrationTest.java | 55 ++++ .../java/org/asciidoclet/AsciidocletTest.java | 234 +++++++------- .../asciidoclet/AsciidoctorRendererTest.java | 268 ++++++++-------- .../asciidoclet/AttributesLoaderTest.java | 184 ++++++----- .../asciidoclet/DocletIteratorTest.java | 116 ------- .../asciidoclet/DocletOptionsTest.java | 111 +++++-- .../asciidoclet/StandardAdapterTest.java | 82 ----- .../asciidoclet/asciidoclet/StubReporter.java | 59 ++++ .../asciidoclet/StylesheetsTest.java | 135 ++++---- 23 files changed, 1323 insertions(+), 1122 deletions(-) create mode 100644 src/main/java/org/asciidoclet/OptionProcessor.java create mode 100644 src/main/java/org/asciidoclet/asciidoclet/AsciidocletOptions.java create mode 100644 src/main/java/org/asciidoclet/asciidoclet/AsciidoctorFilteredEnvironment.java delete mode 100644 src/main/java/org/asciidoclet/asciidoclet/DocletIterator.java delete mode 100644 src/main/java/org/asciidoclet/asciidoclet/DocletRenderer.java create mode 100644 src/main/java/org/asciidoclet/asciidoclet/LazyDocCommentTableProcessor.java delete mode 100644 src/main/java/org/asciidoclet/asciidoclet/StandardAdapter.java create mode 100644 src/test/java/org/asciidoclet/AsciidocletIntegrationTest.java delete mode 100644 src/test/java/org/asciidoclet/asciidoclet/DocletIteratorTest.java delete mode 100644 src/test/java/org/asciidoclet/asciidoclet/StandardAdapterTest.java create mode 100644 src/test/java/org/asciidoclet/asciidoclet/StubReporter.java diff --git a/pom.xml b/pom.xml index ea0d5ac..fcd2f54 100644 --- a/pom.xml +++ b/pom.xml @@ -62,30 +62,30 @@ 4.12 test
- - org.mockito - mockito-all - 1.10.19 - test - - - org.powermock - powermock-module-junit4 - 1.6.4 - test - - - org.powermock - powermock-api-mockito - 1.6.4 - test - - - org.hamcrest - hamcrest-library - 1.3 - test - + + + + + + + + + + + + + + + + + + + + + + + + @@ -117,6 +117,24 @@ 11 11 + + --add-exports + jdk.javadoc/jdk.javadoc.internal.tool=asciidoclet + --add-exports + jdk.compiler/com.sun.tools.javac.parser=asciidoclet + --add-exports + jdk.compiler/com.sun.tools.javac.tree=asciidoclet + + + + + org.apache.maven.plugins + maven-surefire-plugin + + once + + --add-exports jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED + @@ -146,7 +164,8 @@ - 1.7 + 11 + -J--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED org.asciidoclet.Asciidoclet org.asciidoctor diff --git a/src/main/java/org/asciidoclet/Asciidoclet.java b/src/main/java/org/asciidoclet/Asciidoclet.java index c4c7df0..08caa42 100644 --- a/src/main/java/org/asciidoclet/Asciidoclet.java +++ b/src/main/java/org/asciidoclet/Asciidoclet.java @@ -15,16 +15,22 @@ */ package org.asciidoclet; -import com.sun.javadoc.DocErrorReporter; -import com.sun.javadoc.Doclet; -import com.sun.javadoc.LanguageVersion; -import com.sun.javadoc.RootDoc; +import jdk.javadoc.doclet.Doclet; +import jdk.javadoc.doclet.DocletEnvironment; +import jdk.javadoc.doclet.Reporter; +import jdk.javadoc.doclet.StandardDoclet; +import org.asciidoclet.asciidoclet.AsciidocletOptions; +import org.asciidoclet.asciidoclet.AsciidoctorFilteredEnvironment; import org.asciidoclet.asciidoclet.AsciidoctorRenderer; -import org.asciidoclet.asciidoclet.DocletIterator; import org.asciidoclet.asciidoclet.DocletOptions; -import org.asciidoclet.asciidoclet.StandardAdapter; import org.asciidoclet.asciidoclet.Stylesheets; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Locale; +import java.util.Set; +import javax.lang.model.SourceVersion; + /** * = Asciidoclet * @@ -171,116 +177,60 @@ * @since 0.1.0 * @serial (or @serialField or @serialData) */ -public class Asciidoclet extends Doclet { - - private final RootDoc rootDoc; - private final DocletOptions docletOptions; - private final DocletIterator iterator; - private final Stylesheets stylesheets; - - public Asciidoclet(RootDoc rootDoc) { - this.rootDoc = rootDoc; - this.docletOptions = new DocletOptions(rootDoc); - this.iterator = new DocletIterator(docletOptions); - this.stylesheets = new Stylesheets(docletOptions, rootDoc); - } - - // test use - Asciidoclet(RootDoc rootDoc, DocletIterator iterator, Stylesheets stylesheets) { - this.rootDoc = rootDoc; - this.docletOptions = new DocletOptions(rootDoc); - this.iterator = iterator; - this.stylesheets = stylesheets; - } +public class Asciidoclet implements Doclet +{ - /** - * .Example usage - * [source,java] - * exampleDeprecated("do not use"); - * - * @deprecated for example purposes - * @exception Exception example - * @throws RuntimeException example - * @serialData something else - * @link Asciidoclet - */ - public static void exampleDeprecated(String field) throws Exception { - //noop - } - - /** - * Sets the language version to Java 5. - * - * _Javadoc spec requirement._ - * - * @return language version number - */ - @SuppressWarnings("UnusedDeclaration") - public static LanguageVersion languageVersion() { - return LanguageVersion.JAVA_1_5; - } - - /** - * Sets the option length to the standard Javadoc option length. - * - * _Javadoc spec requirement._ - * - * @param option input option - * @return length of required parameters - */ - @SuppressWarnings("UnusedDeclaration") - public static int optionLength(String option) { - return optionLength(option, new StandardAdapter()); - } + private StandardDoclet standardDoclet; + private DocletOptions docletOptions; + private Stylesheets stylesheets; + private Locale locale; + private Reporter reporter; - /** - * The starting point of Javadoc render. - * - * _Javadoc spec requirement._ - * - * @param rootDoc input class documents - * @return success - */ - @SuppressWarnings("UnusedDeclaration") - public static boolean start(RootDoc rootDoc) { - return new Asciidoclet(rootDoc).start(new StandardAdapter()); + public Asciidoclet() { + standardDoclet = new StandardDoclet(); } - /** - * Processes the input options by delegating to the standard handler. - * - * _Javadoc spec requirement._ - * - * @param options input option array - * @param errorReporter error handling - * @return success - */ - @SuppressWarnings("UnusedDeclaration") - public static boolean validOptions(String[][] options, DocErrorReporter errorReporter) { - return validOptions(options, errorReporter, new StandardAdapter()); + @Override + public void init( Locale locale, Reporter reporter ) + { + this.locale = locale; + this.reporter = reporter; + standardDoclet.init( locale, reporter ); + this.docletOptions = new DocletOptions( reporter ); + this.stylesheets = new Stylesheets(docletOptions, reporter); } - static int optionLength(String option, StandardAdapter standardDoclet) { - return DocletOptions.optionLength(option, standardDoclet); + @Override + public String getName() + { + return "Asciidoclet"; } - static boolean validOptions(String[][] options, DocErrorReporter errorReporter, StandardAdapter standardDoclet) { - return DocletOptions.validOptions(options, errorReporter, standardDoclet); + @Override + public Set getSupportedOptions() + { + Set