Browse Source

Improve how the build deals with javadoc invalid references

This commit improves how the build deals with javadoc invalid references
in two ways.

Link/see references that are temporarily invalid during javadoc
generation of individual modules are better masked by using the option
`Xdoclint:syntax` instead of `Xdoclint:none` (warnings were still
visible in some cases, e.g. when individually building the javadoc for
a specific module).

Global javadoc-building task `api` now combines `syntax` and `reference`
`Xdoclint` groups, allowing to raise truly invalid references even when
all the modules have been aggregated.

This commit also fixes the 20+ errors which appeared following the later
change in doclet configuration.

Closes gh-30428
pull/30619/head
Simon Baslé 3 years ago
parent
commit
eabb846d07
  1. 2
      framework-docs/framework-docs.gradle
  2. 2
      framework-docs/modules/ROOT/pages/appendix.adoc
  3. 7
      gradle/spring-module.gradle
  4. 1
      spring-core/src/main/java/org/springframework/cglib/core/CodeEmitter.java
  5. 2
      spring-core/src/main/java/org/springframework/cglib/proxy/InterfaceMaker.java
  6. 2
      spring-core/src/main/java/org/springframework/cglib/proxy/InvocationHandler.java
  7. 2
      spring-core/src/main/java/org/springframework/cglib/transform/impl/UndeclaredThrowableStrategy.java
  8. 4
      spring-core/src/main/java/org/springframework/cglib/util/ParallelSorter.java
  9. 2
      spring-core/src/main/java/org/springframework/core/SpringProperties.java
  10. 6
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DriverManagerDataSource.java
  11. 1
      spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java
  12. 2
      spring-test/src/main/java/org/springframework/test/context/TestContextAnnotationUtils.java
  13. 6
      spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java
  14. 2
      spring-test/src/main/java/org/springframework/test/util/TestSocketUtils.java
  15. 2
      spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java
  16. 2
      spring-tx/src/main/java/org/springframework/transaction/annotation/Isolation.java
  17. 2
      spring-web/src/main/java/org/springframework/http/client/support/HttpAccessor.java
  18. 6
      spring-web/src/main/java/org/springframework/web/client/RestOperations.java

2
framework-docs/framework-docs.gradle

@ -104,7 +104,7 @@ task api(type: Javadoc) {
overview = "framework-docs/src/docs/api/overview.html" overview = "framework-docs/src/docs/api/overview.html"
splitIndex = true splitIndex = true
links(project.ext.javadocLinks) links(project.ext.javadocLinks)
addBooleanOption('Xdoclint:syntax', true) // only check syntax with doclint addBooleanOption('Xdoclint:syntax,reference', true) // only check syntax and reference with doclint
addBooleanOption('Werror', true) // fail build on Javadoc warnings addBooleanOption('Werror', true) // fail build on Javadoc warnings
} }
source moduleProjects.collect { project -> source moduleProjects.collect { project ->

2
framework-docs/modules/ROOT/pages/appendix.adoc

@ -25,7 +25,7 @@ The following table lists all currently supported Spring properties.
| `spring.beaninfo.ignore` | `spring.beaninfo.ignore`
| Instructs Spring to use the `Introspector.IGNORE_ALL_BEANINFO` mode when calling the | Instructs Spring to use the `Introspector.IGNORE_ALL_BEANINFO` mode when calling the
JavaBeans `Introspector`. See JavaBeans `Introspector`. See
{api-spring-framework}++/beans/CachedIntrospectionResults.html#IGNORE_BEANINFO_PROPERTY_NAME++[`CachedIntrospectionResults`] {api-spring-framework}++/beans/StandardBeanInfoFactory.html#IGNORE_BEANINFO_PROPERTY_NAME++[`CachedIntrospectionResults`]
for details. for details.
| `spring.expression.compiler.mode` | `spring.expression.compiler.mode`

7
gradle/spring-module.gradle

@ -72,10 +72,13 @@ javadoc {
options.header = project.name options.header = project.name
options.use = true options.use = true
options.links(project.ext.javadocLinks) options.links(project.ext.javadocLinks)
options.addStringOption("Xdoclint:none", "-quiet") // Check for syntax during linting. 'none' doesn't seem to work in suppressing
// all linting warnings all the time (see/link references most notably).
options.addStringOption("Xdoclint:syntax", "-quiet")
// Suppress warnings due to cross-module @see and @link references. // Suppress warnings due to cross-module @see and @link references.
// Note that global 'api' task does display all warnings. // Note that global 'api' task does display all warnings, and
// checks for 'reference' on top of 'syntax'.
logging.captureStandardError LogLevel.INFO logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
} }

1
spring-core/src/main/java/org/springframework/cglib/core/CodeEmitter.java

@ -737,7 +737,6 @@ public class CodeEmitter extends LocalVariablesSorter {
* on the top of the stack with the unwrapped (primitive) * on the top of the stack with the unwrapped (primitive)
* equivalent. For example, Character -> char. * equivalent. For example, Character -> char.
* @param type the class indicating the desired type of the top stack value * @param type the class indicating the desired type of the top stack value
* @return true if the value was unboxed
*/ */
public void unbox(Type type) { public void unbox(Type type) {
Type t = Constants.TYPE_NUMBER; Type t = Constants.TYPE_NUMBER;

2
spring-core/src/main/java/org/springframework/cglib/proxy/InterfaceMaker.java

@ -74,7 +74,7 @@ public class InterfaceMaker extends AbstractClassGenerator
* Add all the public methods in the specified class. * Add all the public methods in the specified class.
* Methods from superclasses are included, except for methods declared in the base * Methods from superclasses are included, except for methods declared in the base
* Object class (e.g. <code>getClass</code>, <code>equals</code>, <code>hashCode</code>). * Object class (e.g. <code>getClass</code>, <code>equals</code>, <code>hashCode</code>).
* @param class the class containing the methods to add to the interface * @param clazz the class containing the methods to add to the interface
*/ */
public void add(Class clazz) { public void add(Class clazz) {
Method[] methods = clazz.getMethods(); Method[] methods = clazz.getMethods();

2
spring-core/src/main/java/org/springframework/cglib/proxy/InvocationHandler.java

@ -28,7 +28,7 @@ public interface InvocationHandler
extends Callback extends Callback
{ {
/** /**
* @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object) * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
*/ */
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable; public Object invoke(Object proxy, Method method, Object[] args) throws Throwable;

2
spring-core/src/main/java/org/springframework/cglib/transform/impl/UndeclaredThrowableStrategy.java

@ -25,7 +25,7 @@ import org.springframework.cglib.transform.MethodFilterTransformer;
import org.springframework.cglib.transform.TransformingClassGenerator; import org.springframework.cglib.transform.TransformingClassGenerator;
/** /**
* A {@link GeneratorStrategy} suitable for use with {@link org.springframework.cglib.Enhancer} which * A {@link GeneratorStrategy} suitable for use with {@link org.springframework.cglib.proxy.Enhancer} which
* causes all undeclared exceptions thrown from within a proxied method to be wrapped * causes all undeclared exceptions thrown from within a proxied method to be wrapped
* in an alternative exception of your choice. * in an alternative exception of your choice.
*/ */

4
spring-core/src/main/java/org/springframework/cglib/util/ParallelSorter.java

@ -64,7 +64,6 @@ abstract public class ParallelSorter extends SorterTemplate {
* @param arrays An array of arrays to sort. The arrays may be a mix * @param arrays An array of arrays to sort. The arrays may be a mix
* of primitive and non-primitive types, but should all be the same * of primitive and non-primitive types, but should all be the same
* length. * length.
* @param loader ClassLoader for generated class, uses "current" if null
*/ */
public static ParallelSorter create(Object[] arrays) { public static ParallelSorter create(Object[] arrays) {
Generator gen = new Generator(); Generator gen = new Generator();
@ -135,8 +134,7 @@ abstract public class ParallelSorter extends SorterTemplate {
/** /**
* Sort the arrays using an in-place merge sort. * Sort the arrays using an in-place merge sort.
* @param index array (column) to sort by * @param index array (column) to sort by
* @param lo starting array index (row), inclusive * @param cmp Comparator to use if the specified column is non-primitive
* @param hi ending array index (row), exclusive
*/ */
public void mergeSort(int index, Comparator cmp) { public void mergeSort(int index, Comparator cmp) {
mergeSort(index, 0, len(), cmp); mergeSort(index, 0, len(), cmp);

2
spring-core/src/main/java/org/springframework/core/SpringProperties.java

@ -38,7 +38,7 @@ import org.springframework.lang.Nullable;
* *
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 3.2.7 * @since 3.2.7
* @see org.springframework.beans.CachedIntrospectionResults#IGNORE_BEANINFO_PROPERTY_NAME * @see org.springframework.beans.StandardBeanInfoFactory#IGNORE_BEANINFO_PROPERTY_NAME
* @see org.springframework.context.index.CandidateComponentsIndexLoader#IGNORE_INDEX * @see org.springframework.context.index.CandidateComponentsIndexLoader#IGNORE_INDEX
* @see org.springframework.core.env.AbstractEnvironment#IGNORE_GETENV_PROPERTY_NAME * @see org.springframework.core.env.AbstractEnvironment#IGNORE_GETENV_PROPERTY_NAME
* @see org.springframework.expression.spel.SpelParserConfiguration#SPRING_EXPRESSION_COMPILER_MODE_PROPERTY_NAME * @see org.springframework.expression.spel.SpelParserConfiguration#SPRING_EXPRESSION_COMPILER_MODE_PROPERTY_NAME

6
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DriverManagerDataSource.java

@ -48,9 +48,9 @@ import org.springframework.util.ClassUtils;
* the container. Such a DataSource can be exposed as a DataSource bean in a Spring * the container. Such a DataSource can be exposed as a DataSource bean in a Spring
* ApplicationContext via {@link org.springframework.jndi.JndiObjectFactoryBean}, * ApplicationContext via {@link org.springframework.jndi.JndiObjectFactoryBean},
* for seamless switching to and from a local DataSource bean like this class. * for seamless switching to and from a local DataSource bean like this class.
* For tests, you can then either set up a mock JNDI environment through Spring's * For tests, you can then either set up a mock JNDI environment through complete
* {@link org.springframework.mock.jndi.SimpleNamingContextBuilder}, or switch the * solutions from third parties such as <a href="https://github.com/h-thurow/Simple-JNDI">Simple-JNDI</a>,
* bean definition to a local DataSource (which is simpler and thus recommended). * or switch the bean definition to a local DataSource (which is simpler and thus recommended).
* *
* <p>This {@code DriverManagerDataSource} class was originally designed alongside * <p>This {@code DriverManagerDataSource} class was originally designed alongside
* <a href="https://commons.apache.org/proper/commons-dbcp">Apache Commons DBCP</a> * <a href="https://commons.apache.org/proper/commons-dbcp">Apache Commons DBCP</a>

1
spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java

@ -81,7 +81,6 @@ public interface CacheAwareContextLoaderDelegate {
* the application context * the application context
* @see #isContextLoaded * @see #isContextLoaded
* @see #closeContext * @see #closeContext
* @see #setContextFailureProcessor
*/ */
ApplicationContext loadContext(MergedContextConfiguration mergedContextConfiguration); ApplicationContext loadContext(MergedContextConfiguration mergedContextConfiguration);

2
spring-test/src/main/java/org/springframework/test/context/TestContextAnnotationUtils.java

@ -66,7 +66,7 @@ import org.springframework.util.ObjectUtils;
* example, {@link ContextConfiguration#inheritLocations}. * example, {@link ContextConfiguration#inheritLocations}.
* *
* @author Sam Brannen * @author Sam Brannen
* @since 5.3, though originally since 4.0 as {@link org.springframework.test.util.MetaAnnotationUtils} * @since 5.3, though originally since 4.0 as {@code org.springframework.test.util.MetaAnnotationUtils}
* @see AnnotationUtils * @see AnnotationUtils
* @see AnnotatedElementUtils * @see AnnotatedElementUtils
* @see AnnotationDescriptor * @see AnnotationDescriptor

6
spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java

@ -494,13 +494,13 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot
* interaction with the {@code ContextCache}. * interaction with the {@code ContextCache}.
* <p>The default implementation delegates to * <p>The default implementation delegates to
* {@code getBootstrapContext().getCacheAwareContextLoaderDelegate()} and * {@code getBootstrapContext().getCacheAwareContextLoaderDelegate()} and
* supplies the returned delegate the configured * the default one will load {@link org.springframework.test.context.ApplicationContextFailureProcessor}
* {@link #getApplicationContextFailureProcessor() ApplicationContextFailureProcessor}. * via the service loading mechanism.
* <p>Concrete subclasses may choose to override this method to return a custom * <p>Concrete subclasses may choose to override this method to return a custom
* {@code CacheAwareContextLoaderDelegate} implementation with custom * {@code CacheAwareContextLoaderDelegate} implementation with custom
* {@link org.springframework.test.context.cache.ContextCache ContextCache} support. * {@link org.springframework.test.context.cache.ContextCache ContextCache} support.
* @return the context loader delegate (never {@code null}) * @return the context loader delegate (never {@code null})
* @see #getApplicationContextFailureProcessor() * @see org.springframework.test.context.ApplicationContextFailureProcessor
*/ */
protected CacheAwareContextLoaderDelegate getCacheAwareContextLoaderDelegate() { protected CacheAwareContextLoaderDelegate getCacheAwareContextLoaderDelegate() {
return getBootstrapContext().getCacheAwareContextLoaderDelegate(); return getBootstrapContext().getCacheAwareContextLoaderDelegate();

2
spring-test/src/main/java/org/springframework/test/util/TestSocketUtils.java

@ -28,7 +28,7 @@ import org.springframework.util.Assert;
* Simple utility for finding available TCP ports on {@code localhost} for use in * Simple utility for finding available TCP ports on {@code localhost} for use in
* integration testing scenarios. * integration testing scenarios.
* *
* <p>This is a limited form of {@link org.springframework.util.SocketUtils} which * <p>This is a limited form of {@code org.springframework.util.SocketUtils}, which
* has been deprecated since Spring Framework 5.3.16 and removed in Spring * has been deprecated since Spring Framework 5.3.16 and removed in Spring
* Framework 6.0. * Framework 6.0.
* *

2
spring-test/src/main/java/org/springframework/test/web/client/AbstractRequestExpectationManager.java

@ -110,7 +110,7 @@ public abstract class AbstractRequestExpectationManager implements RequestExpect
/** /**
* As of 5.0.3 subclasses should implement this method instead of * As of 5.0.3 subclasses should implement this method instead of
* {@link #validateRequestInternal(ClientHttpRequest)} in order to match the * {@code #validateRequestInternal(ClientHttpRequest)} in order to match the
* request to an expectation, leaving the call to create the response as a separate step * request to an expectation, leaving the call to create the response as a separate step
* (to be invoked by this class). * (to be invoked by this class).
* @param request the current request * @param request the current request

2
spring-tx/src/main/java/org/springframework/transaction/annotation/Isolation.java

@ -70,7 +70,7 @@ public enum Isolation {
/** /**
* A constant indicating that dirty reads, non-repeatable reads, and phantom * A constant indicating that dirty reads, non-repeatable reads, and phantom
* reads are prevented. * reads are prevented.
* <p>This level includes the prohibitions in {@link #ISOLATION_REPEATABLE_READ} * <p>This level includes the prohibitions in {@link #REPEATABLE_READ}
* and further prohibits the situation where one transaction reads all rows that * and further prohibits the situation where one transaction reads all rows that
* satisfy a {@code WHERE} condition, a second transaction inserts a row * satisfy a {@code WHERE} condition, a second transaction inserts a row
* that satisfies that {@code WHERE} condition, and the first transaction * that satisfies that {@code WHERE} condition, and the first transaction

2
spring-web/src/main/java/org/springframework/http/client/support/HttpAccessor.java

@ -66,7 +66,7 @@ public abstract class HttpAccessor {
* Configure the Apache HttpComponents or OkHttp request factory to enable PATCH.</b> * Configure the Apache HttpComponents or OkHttp request factory to enable PATCH.</b>
* @see #createRequest(URI, HttpMethod) * @see #createRequest(URI, HttpMethod)
* @see SimpleClientHttpRequestFactory * @see SimpleClientHttpRequestFactory
* @see org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory * @see org.springframework.http.client.HttpComponentsClientHttpRequestFactory
* @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory * @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory
*/ */
public void setRequestFactory(ClientHttpRequestFactory requestFactory) { public void setRequestFactory(ClientHttpRequestFactory requestFactory) {

6
spring-web/src/main/java/org/springframework/web/client/RestOperations.java

@ -383,7 +383,7 @@ public interface RestOperations {
* @since 4.3.5 * @since 4.3.5
* @see HttpEntity * @see HttpEntity
* @see RestTemplate#setRequestFactory * @see RestTemplate#setRequestFactory
* @see org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory * @see org.springframework.http.client.HttpComponentsClientHttpRequestFactory
* @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory * @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory
*/ */
@Nullable @Nullable
@ -406,7 +406,7 @@ public interface RestOperations {
* @since 4.3.5 * @since 4.3.5
* @see HttpEntity * @see HttpEntity
* @see RestTemplate#setRequestFactory * @see RestTemplate#setRequestFactory
* @see org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory * @see org.springframework.http.client.HttpComponentsClientHttpRequestFactory
* @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory * @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory
*/ */
@Nullable @Nullable
@ -427,7 +427,7 @@ public interface RestOperations {
* @since 4.3.5 * @since 4.3.5
* @see HttpEntity * @see HttpEntity
* @see RestTemplate#setRequestFactory * @see RestTemplate#setRequestFactory
* @see org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory * @see org.springframework.http.client.HttpComponentsClientHttpRequestFactory
* @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory * @see org.springframework.http.client.OkHttp3ClientHttpRequestFactory
*/ */
@Nullable @Nullable

Loading…
Cancel
Save