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
This commit is contained in:
Andy Wilkinson 2017-09-25 06:43:07 +01:00
parent 43ff84e214
commit dd4dbce816
5 changed files with 26 additions and 22 deletions

View File

@ -217,7 +217,7 @@
<maven-invoker-plugin.version>3.0.0</maven-invoker-plugin.version>
<maven-help-plugin.version>2.2</maven-help-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-shade-plugin.version>2.4.3</maven-shade-plugin.version>
<maven-site-plugin.version>3.5.1</maven-site-plugin.version>

View File

@ -18,11 +18,10 @@ package org.springframework.boot.devtools.autoconfigure;
import java.lang.reflect.Field;
import javax.annotation.PostConstruct;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
@ -35,22 +34,26 @@ import org.springframework.util.ReflectionUtils;
* @author Andy Wilkinson
* @since 1.3.0
*/
class HateoasObjenesisCacheDisabler {
class HateoasObjenesisCacheDisabler implements InitializingBean {
private static final Log logger = LogFactory
.getLog(HateoasObjenesisCacheDisabler.class);
private static boolean cacheDisabled;
@PostConstruct
void disableCaching() {
@Override
public void afterPropertiesSet() {
disableCaching();
}
private void disableCaching() {
if (!cacheDisabled) {
cacheDisabled = true;
doDisableCaching();
}
}
void doDisableCaching() {
private void doDisableCaching() {
try {
Class<?> type = ClassUtils.forName(
"org.springframework.hateoas.core.DummyInvocationUtils",

View File

@ -1,5 +1,5 @@
/*
* 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");
* you may not use this file except in compliance with the License.
@ -16,11 +16,10 @@
package org.springframework.boot.devtools.autoconfigure;
import javax.annotation.PostConstruct;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.devtools.livereload.LiveReloadServer;
/**
@ -30,7 +29,7 @@ import org.springframework.boot.devtools.livereload.LiveReloadServer;
* @author Phillip Webb
* @since 1.3.0
*/
public class OptionalLiveReloadServer {
public class OptionalLiveReloadServer implements InitializingBean {
private static final Log logger = LogFactory.getLog(OptionalLiveReloadServer.class);
@ -44,12 +43,12 @@ public class OptionalLiveReloadServer {
this.server = server;
}
/**
* {@link PostConstruct} method to start the server if possible.
* @throws Exception in case of errors
*/
@PostConstruct
public void startServer() throws Exception {
@Override
public void afterPropertiesSet() throws Exception {
startServer();
}
void startServer() throws Exception {
if (this.server != null) {
try {
if (!this.server.isStarted()) {

View File

@ -24,11 +24,10 @@ import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.annotation.PostConstruct;
import org.apache.commons.logging.Log;
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.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@ -70,7 +69,7 @@ import org.springframework.util.StringUtils;
*/
@Configuration
@EnableConfigurationProperties(DevToolsProperties.class)
public class RemoteClientConfiguration {
public class RemoteClientConfiguration implements InitializingBean {
private static final Log logger = LogFactory.getLog(RemoteClientConfiguration.class);
@ -111,7 +110,10 @@ public class RemoteClientConfiguration {
return new HttpHeaderInterceptor(secretHeaderName, secret);
}
@PostConstruct
public void afterPropertiesSet() {
logWarnings();
}
private void logWarnings() {
RemoteDevToolsProperties remoteProperties = this.properties.getRemote();
if (!remoteProperties.getRestart().isEnabled()) {

View File

@ -55,7 +55,7 @@ public class HateoasObjenesisCacheDisablerTests {
@Test
public void cacheIsDisabled() {
new HateoasObjenesisCacheDisabler().doDisableCaching();
new HateoasObjenesisCacheDisabler().afterPropertiesSet();
assertThat(this.objenesis.getInstantiatorOf(TestObject.class))
.isNotSameAs(this.objenesis.getInstantiatorOf(TestObject.class));
}