Commit dd4dbce8 authored by Andy Wilkinson's avatar Andy Wilkinson

Fix generation of Javadoc on Java 9

This commit fixes Javadoc generation when building with Java 9. It
upgrades the Javadoc plugin to a version that is Java 9 compatible
(3.0.0-M1) and reworks DevTools to remove usage of @PostConstruct.
The latter change is necessary as @PostConstruct is not visible by
default when building with Java 9 and, therefore its usage causes
Javadoc generation to fail.

Closes gh-10029
parent 43ff84e2
...@@ -217,7 +217,7 @@ ...@@ -217,7 +217,7 @@
<maven-invoker-plugin.version>3.0.0</maven-invoker-plugin.version> <maven-invoker-plugin.version>3.0.0</maven-invoker-plugin.version>
<maven-help-plugin.version>2.2</maven-help-plugin.version> <maven-help-plugin.version>2.2</maven-help-plugin.version>
<maven-jar-plugin.version>3.0.2</maven-jar-plugin.version> <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
<maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version> <maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version>
<maven-resources-plugin.version>3.0.1</maven-resources-plugin.version> <maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
<maven-shade-plugin.version>2.4.3</maven-shade-plugin.version> <maven-shade-plugin.version>2.4.3</maven-shade-plugin.version>
<maven-site-plugin.version>3.5.1</maven-site-plugin.version> <maven-site-plugin.version>3.5.1</maven-site-plugin.version>
......
...@@ -18,11 +18,10 @@ package org.springframework.boot.devtools.autoconfigure; ...@@ -18,11 +18,10 @@ package org.springframework.boot.devtools.autoconfigure;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import javax.annotation.PostConstruct;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
...@@ -35,22 +34,26 @@ import org.springframework.util.ReflectionUtils; ...@@ -35,22 +34,26 @@ import org.springframework.util.ReflectionUtils;
* @author Andy Wilkinson * @author Andy Wilkinson
* @since 1.3.0 * @since 1.3.0
*/ */
class HateoasObjenesisCacheDisabler { class HateoasObjenesisCacheDisabler implements InitializingBean {
private static final Log logger = LogFactory private static final Log logger = LogFactory
.getLog(HateoasObjenesisCacheDisabler.class); .getLog(HateoasObjenesisCacheDisabler.class);
private static boolean cacheDisabled; private static boolean cacheDisabled;
@PostConstruct @Override
void disableCaching() { public void afterPropertiesSet() {
disableCaching();
}
private void disableCaching() {
if (!cacheDisabled) { if (!cacheDisabled) {
cacheDisabled = true; cacheDisabled = true;
doDisableCaching(); doDisableCaching();
} }
} }
void doDisableCaching() { private void doDisableCaching() {
try { try {
Class<?> type = ClassUtils.forName( Class<?> type = ClassUtils.forName(
"org.springframework.hateoas.core.DummyInvocationUtils", "org.springframework.hateoas.core.DummyInvocationUtils",
......
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -16,11 +16,10 @@ ...@@ -16,11 +16,10 @@
package org.springframework.boot.devtools.autoconfigure; package org.springframework.boot.devtools.autoconfigure;
import javax.annotation.PostConstruct;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.devtools.livereload.LiveReloadServer; import org.springframework.boot.devtools.livereload.LiveReloadServer;
/** /**
...@@ -30,7 +29,7 @@ import org.springframework.boot.devtools.livereload.LiveReloadServer; ...@@ -30,7 +29,7 @@ import org.springframework.boot.devtools.livereload.LiveReloadServer;
* @author Phillip Webb * @author Phillip Webb
* @since 1.3.0 * @since 1.3.0
*/ */
public class OptionalLiveReloadServer { public class OptionalLiveReloadServer implements InitializingBean {
private static final Log logger = LogFactory.getLog(OptionalLiveReloadServer.class); private static final Log logger = LogFactory.getLog(OptionalLiveReloadServer.class);
...@@ -44,12 +43,12 @@ public class OptionalLiveReloadServer { ...@@ -44,12 +43,12 @@ public class OptionalLiveReloadServer {
this.server = server; this.server = server;
} }
/** @Override
* {@link PostConstruct} method to start the server if possible. public void afterPropertiesSet() throws Exception {
* @throws Exception in case of errors startServer();
*/ }
@PostConstruct
public void startServer() throws Exception { void startServer() throws Exception {
if (this.server != null) { if (this.server != null) {
try { try {
if (!this.server.isStarted()) { if (!this.server.isStarted()) {
......
...@@ -24,11 +24,10 @@ import java.util.List; ...@@ -24,11 +24,10 @@ import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import javax.annotation.PostConstruct;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
...@@ -70,7 +69,7 @@ import org.springframework.util.StringUtils; ...@@ -70,7 +69,7 @@ import org.springframework.util.StringUtils;
*/ */
@Configuration @Configuration
@EnableConfigurationProperties(DevToolsProperties.class) @EnableConfigurationProperties(DevToolsProperties.class)
public class RemoteClientConfiguration { public class RemoteClientConfiguration implements InitializingBean {
private static final Log logger = LogFactory.getLog(RemoteClientConfiguration.class); private static final Log logger = LogFactory.getLog(RemoteClientConfiguration.class);
...@@ -111,7 +110,10 @@ public class RemoteClientConfiguration { ...@@ -111,7 +110,10 @@ public class RemoteClientConfiguration {
return new HttpHeaderInterceptor(secretHeaderName, secret); return new HttpHeaderInterceptor(secretHeaderName, secret);
} }
@PostConstruct public void afterPropertiesSet() {
logWarnings();
}
private void logWarnings() { private void logWarnings() {
RemoteDevToolsProperties remoteProperties = this.properties.getRemote(); RemoteDevToolsProperties remoteProperties = this.properties.getRemote();
if (!remoteProperties.getRestart().isEnabled()) { if (!remoteProperties.getRestart().isEnabled()) {
......
...@@ -55,7 +55,7 @@ public class HateoasObjenesisCacheDisablerTests { ...@@ -55,7 +55,7 @@ public class HateoasObjenesisCacheDisablerTests {
@Test @Test
public void cacheIsDisabled() { public void cacheIsDisabled() {
new HateoasObjenesisCacheDisabler().doDisableCaching(); new HateoasObjenesisCacheDisabler().afterPropertiesSet();
assertThat(this.objenesis.getInstantiatorOf(TestObject.class)) assertThat(this.objenesis.getInstantiatorOf(TestObject.class))
.isNotSameAs(this.objenesis.getInstantiatorOf(TestObject.class)); .isNotSameAs(this.objenesis.getInstantiatorOf(TestObject.class));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment