javadoc and spotbugs warnings, turn javadoc warnings into errors, remove obsolete code, update build plugins Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/api/pom.xml b/api/pom.xml index b7b1bc6..d33f2ed 100644 --- a/api/pom.xml +++ b/api/pom.xml
@@ -67,6 +67,9 @@ <plugin> <artifactId>maven-javadoc-plugin</artifactId> <configuration> + <failOnWarnings>true</failOnWarnings> + <doclint>all,-missing</doclint> + <quiet>true</quiet> <nodeprecated>false</nodeprecated> <notimestamp>true</notimestamp> <nosince>true</nosince> @@ -173,6 +176,7 @@ <configuration> <compilerArgs> <arg>-Xlint:all</arg> + <arg>-Xdoclint:all,-missing</arg> </compilerArgs> <showDeprecation>true</showDeprecation> <showWarnings>true</showWarnings>
diff --git a/api/src/main/java/jakarta/xml/bind/Binder.java b/api/src/main/java/jakarta/xml/bind/Binder.java index 372a6aa..acf2a17 100644 --- a/api/src/main/java/jakarta/xml/bind/Binder.java +++ b/api/src/main/java/jakarta/xml/bind/Binder.java
@@ -49,7 +49,6 @@ * A Binder instance is created using the factory method * {@link JAXBContext#createBinder()} or {@link JAXBContext#createBinder(Class)}. * - * <p> * @param <XmlNode> the template parameter, <code>XmlNode</code>, is the * root interface/class for the XML infoset preserving representation. * A Binder implementation is required to minimally support
diff --git a/api/src/main/java/jakarta/xml/bind/ContextFinder.java b/api/src/main/java/jakarta/xml/bind/ContextFinder.java index 6435cd1..727bbb1 100644 --- a/api/src/main/java/jakarta/xml/bind/ContextFinder.java +++ b/api/src/main/java/jakarta/xml/bind/ContextFinder.java
@@ -367,43 +367,6 @@ return value; } - private static Properties loadJAXBProperties(URL url) throws JAXBException { - - try { - Properties props; - logger.log(Level.FINE, "loading props from {0}", url); - props = new Properties(); - InputStream is = url.openStream(); - props.load(is); - is.close(); - return props; - } catch (IOException ioe) { - logger.log(Level.FINE, "Unable to load " + url.toString(), ioe); - throw new JAXBException(ioe.toString(), ioe); - } - } - - /** - * If run on JPMS package containing resource must be open unconditionally. - * - * @param classLoader classloader to load resource with - * @param resourceName qualified name of the resource - * @return resource url if found - */ - private static URL getResourceUrl(ClassLoader classLoader, String resourceName) { - URL url; - if (classLoader == null) - url = ClassLoader.getSystemResource(resourceName); - else - url = classLoader.getResource(resourceName); - return url; - } - - private static URL getResourceUrl(Class<?> clazz, String resourceName) { - return clazz.getResource(resourceName); - } - - /** * Search the given ClassLoader for an instance of the specified class and * return a string representation of the URL that points to the resource.
diff --git a/api/src/main/java/jakarta/xml/bind/DatatypeConverterImpl.java b/api/src/main/java/jakarta/xml/bind/DatatypeConverterImpl.java index c394800..f183823 100644 --- a/api/src/main/java/jakarta/xml/bind/DatatypeConverterImpl.java +++ b/api/src/main/java/jakarta/xml/bind/DatatypeConverterImpl.java
@@ -75,7 +75,7 @@ } /** - * Faster but less robust String->int conversion. + * Faster but less robust {@code String->int} conversion. * * Note that: * <ol>
diff --git a/api/src/main/java/jakarta/xml/bind/JAXB.java b/api/src/main/java/jakarta/xml/bind/JAXB.java index b3606fc..7610cba 100644 --- a/api/src/main/java/jakarta/xml/bind/JAXB.java +++ b/api/src/main/java/jakarta/xml/bind/JAXB.java
@@ -289,7 +289,7 @@ * the body. If this object has {@link XmlRootElement} * on its class definition, that will be used as the root tag name * and the given object will provide the body. Otherwise, - * the root tag name is {@link java.beans.Introspector#decapitalize(String) infered} from + * the root tag name is inferred from * {@link Class#getSimpleName() the short class name}. * This parameter must not be null. * @@ -313,7 +313,7 @@ * the body. If this object has {@link XmlRootElement} * on its class definition, that will be used as the root tag name * and the given object will provide the body. Otherwise, - * the root tag name is {@link java.beans.Introspector#decapitalize(String) infered} from + * the root tag name is inferred from * {@link Class#getSimpleName() the short class name}. * This parameter must not be null. * @@ -340,7 +340,7 @@ * the body. If this object has {@link XmlRootElement} * on its class definition, that will be used as the root tag name * and the given object will provide the body. Otherwise, - * the root tag name is {@link java.beans.Introspector#decapitalize(String) infered} from + * the root tag name is inferred from * {@link Class#getSimpleName() the short class name}. * This parameter must not be null. * @@ -364,7 +364,7 @@ * the body. If this object has {@link XmlRootElement} * on its class definition, that will be used as the root tag name * and the given object will provide the body. Otherwise, - * the root tag name is {@link java.beans.Introspector#decapitalize(String) infered} from + * the root tag name is inferred from * {@link Class#getSimpleName() the short class name}. * This parameter must not be null. * @@ -389,7 +389,7 @@ * the body. If this object has {@link XmlRootElement} * on its class definition, that will be used as the root tag name * and the given object will provide the body. Otherwise, - * the root tag name is {@link java.beans.Introspector#decapitalize(String) infered} from + * the root tag name is inferred from * {@link Class#getSimpleName() the short class name}. * This parameter must not be null. * @@ -413,7 +413,7 @@ * the body. If this object has {@link XmlRootElement} * on its class definition, that will be used as the root tag name * and the given object will provide the body. Otherwise, - * the root tag name is {@link java.beans.Introspector#decapitalize(String) infered} from + * the root tag name is inferred from * {@link Class#getSimpleName() the short class name}. * This parameter must not be null. * @@ -437,7 +437,7 @@ * the body. If this object has {@link XmlRootElement} * on its class definition, that will be used as the root tag name * and the given object will provide the body. Otherwise, - * the root tag name is {@link java.beans.Introspector#decapitalize(String) infered} from + * the root tag name is inferred from * {@link Class#getSimpleName() the short class name}. * This parameter must not be null. * @@ -477,14 +477,16 @@ * the body. If this object has {@link XmlRootElement} * on its class definition, that will be used as the root tag name * and the given object will provide the body. Otherwise, - * the root tag name is {@link java.beans.Introspector#decapitalize(String) infered} from + * the root tag name is inferred from * {@link Class#getSimpleName() the short class name}. * This parameter must not be null. * * @param xml * Represents the receiver of XML. Objects of the following types are allowed. * - * <table><tr> + * <table> + * <caption>Allowed Objects</caption> + * <tr> * <th>Type</th> * <th>Operation</th> * </tr><tr> @@ -552,14 +554,14 @@ // XXX - behaviour of this method must be same as of Introspector.decapitalize // which is not used to avoid dependency on java.desktop String simpleName = clazz.getSimpleName(); - if (simpleName == null || simpleName.isEmpty()) { + if (simpleName.isEmpty()) { return simpleName; } if (simpleName.length() > 1 && Character.isUpperCase(simpleName.charAt(1)) && Character.isUpperCase(simpleName.charAt(0))) { return simpleName; } - char chars[] = simpleName.toCharArray(); + char[] chars = simpleName.toCharArray(); chars[0] = Character.toLowerCase(chars[0]); return new String(chars); }
diff --git a/api/src/main/java/jakarta/xml/bind/JAXBPermission.java b/api/src/main/java/jakarta/xml/bind/JAXBPermission.java index 7f9c641..170a896 100644 --- a/api/src/main/java/jakarta/xml/bind/JAXBPermission.java +++ b/api/src/main/java/jakarta/xml/bind/JAXBPermission.java
@@ -48,7 +48,7 @@ * Malicious code can set {@link DatatypeConverterInterface}, which has * VM-wide singleton semantics, before a genuine Jakarta XML Binding implementation sets one. * This allows malicious code to gain access to objects that it may otherwise - * not have access to, such as {@link java.awt.Frame#getFrames()} that belongs to + * not have access to, such as {@code java.awt.Frame#getFrames()} that belongs to * another application running in the same JVM. * </td> * </tr>
diff --git a/api/src/main/java/jakarta/xml/bind/annotation/XmlInlineBinaryData.java b/api/src/main/java/jakarta/xml/bind/annotation/XmlInlineBinaryData.java index 2d59db6..2b48235 100644 --- a/api/src/main/java/jakarta/xml/bind/annotation/XmlInlineBinaryData.java +++ b/api/src/main/java/jakarta/xml/bind/annotation/XmlInlineBinaryData.java
@@ -27,7 +27,7 @@ * * <p> * When XOP encoding is enabled as described in {@link AttachmentMarshaller#isXOPPackage()}, - * this annotation disables datatypes such as {@link java.awt.Image} or {@link Source} + * this annotation disables datatypes such as {@code java.awt.Image} or {@link Source} * or {@code byte[]} that are bound to base64-encoded binary from being considered for * XOP encoding. If a Jakarta XML Binding property is annotated with this annotation or if * the Jakarta XML Binding property's base type is annotated with this annotation,
diff --git a/api/src/main/java/jakarta/xml/bind/annotation/XmlMimeType.java b/api/src/main/java/jakarta/xml/bind/annotation/XmlMimeType.java index e57835e..7f52629 100644 --- a/api/src/main/java/jakarta/xml/bind/annotation/XmlMimeType.java +++ b/api/src/main/java/jakarta/xml/bind/annotation/XmlMimeType.java
@@ -24,7 +24,7 @@ * * <p> * This annotation is used in conjunction with datatypes such as - * {@link java.awt.Image} or {@link Source} that are bound to base64-encoded binary in XML. + * {@code java.awt.Image} or {@link Source} that are bound to base64-encoded binary in XML. * * <p> * If a property that has this annotation has a sibling property bound to
diff --git a/api/src/main/java/jakarta/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java b/api/src/main/java/jakarta/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java index ade56a4..50a3e08 100644 --- a/api/src/main/java/jakarta/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java +++ b/api/src/main/java/jakarta/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java
@@ -81,6 +81,7 @@ * Points to the class that converts a value type to a bound type or vice versa. * See {@link XmlAdapter} for more details. */ + @SuppressWarnings({"rawtypes"}) Class<? extends XmlAdapter> value(); /**
diff --git a/api/src/main/java/jakarta/xml/bind/annotation/package-info.java b/api/src/main/java/jakarta/xml/bind/annotation/package-info.java index a016cff..903f65d 100644 --- a/api/src/main/java/jakarta/xml/bind/annotation/package-info.java +++ b/api/src/main/java/jakarta/xml/bind/annotation/package-info.java
@@ -16,7 +16,6 @@ * <h2>Package Specification</h2> * <p>The following table shows the Jakarta XML Binding mapping annotations * that can be associated with each program element. </p> - * <p> * <table class="striped"> * <caption>Annotations for customizing Java program elements to XML Schema mapping</caption> * <thead> @@ -143,7 +142,6 @@ * <b>Namespace prefixes</b> * <p>The following namespace prefixes are used in the XML Schema * fragments in this package. - * <p> * <table class="striped"> * <caption>XML Schema fragments namespace prefixes</caption> * <thead>
diff --git a/api/src/main/java/jakarta/xml/bind/attachment/package-info.java b/api/src/main/java/jakarta/xml/bind/attachment/package-info.java index c163a2e..e570c53 100644 --- a/api/src/main/java/jakarta/xml/bind/attachment/package-info.java +++ b/api/src/main/java/jakarta/xml/bind/attachment/package-info.java
@@ -13,7 +13,6 @@ * enables the interpretation and creation of optimized binary data * within an MIME-based package format. * <p> - * <p> * Soap MTOM[1], XOP([2][3]) and WS-I AP[4] standardize approaches to * optimized transmission of binary datatypes as an attachment. * To optimally support these standards within a message passing @@ -23,13 +22,10 @@ * References in this document to JAXB refer to the Jakarta XML Binding unless otherwise noted. * * <h2>Package Specification</h2> - * <p> * <ul> * <li><a href="https://projects.eclipse.org/projects/ee4j.jaxb">Jakarta XML Binding Specification project</a> * </ul> - * <p> * <h2>Related Standards</h2> - * <p> * <ul> * <li><a href="http://www.w3.org/TR/2004/WD-soap12-mtom-20040608/">[1]SOAP Message Transmission Optimization Mechanism</a> </li> * <li><a href="http://www.w3.org/TR/2005/REC-xop10-20050125/">[2]XML-binary Optimized Packaging</a></li>
diff --git a/api/src/main/java/jakarta/xml/bind/package-info.java b/api/src/main/java/jakarta/xml/bind/package-info.java index 36480ae..60ba012 100644 --- a/api/src/main/java/jakarta/xml/bind/package-info.java +++ b/api/src/main/java/jakarta/xml/bind/package-info.java
@@ -12,21 +12,16 @@ * Provides a runtime binding framework for client applications including * unmarshalling, marshalling, and validation capabilities. * <p> - * <p> * <code>JAXBContext</code> is the client-entry point to the runtime binding * framework. * <p> - * <p> * References in this document to JAXB refer to the Jakarta XML Binding unless otherwise noted. * * <h2>Package Specification</h2> - * <p> * <ul> * <li><a href="https://projects.eclipse.org/projects/ee4j.jaxb">Jakarta XML Binding Specification project</a> * </ul> - * <p> * <h2>Related Documentation</h2> - * <p> * For overviews, tutorials, examples, guides, and tool documentation, * please see: * <ul>
diff --git a/etc/spotbugs-exclude.xml b/etc/spotbugs-exclude.xml index 5ce58f2..7dfe711 100644 --- a/etc/spotbugs-exclude.xml +++ b/etc/spotbugs-exclude.xml
@@ -13,6 +13,35 @@ <FindBugsFilter> <!-- + TODO: reevaluate for MR + As designed, impossible to change, maybe with MR. + --> + <Match> + <Bug pattern="EI_EXPOSE_REP"/> + <Or> + <Class name="~.*\.*Exception"/> + <Class name="~.*\.W3CDomHandler"/> + <Class name="~.*\.ValidationEventImpl"/> + <Class name="~.*\.ValidationEventLocatorImpl"/> + </Or> + </Match> + + <!-- + TODO: reevaluate for MR + As designed, impossible to change, maybe with MR. + --> + <Match> + <Bug pattern="EI_EXPOSE_REP2"/> + <Or> + <Class name="~.*\.*Exception"/> + <Class name="~.*\.W3CDomHandler"/> + <Class name="~.*\.ValidationEventImpl"/> + <Class name="~.*\.ValidationEventLocatorImpl"/> + <Class name="jakarta.xml.bind.util.JAXBSource"/> + </Or> + </Match> + + <!-- As designed. --> <Match> @@ -29,13 +58,4 @@ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/> </Match> - <!-- - https://github.com/eclipse-ee4j/jaxb-api/issues/78 - --> - <Match> - <Class name="jakarta.xml.bind.ModuleUtil"/> - <Bug pattern="DM_STRING_TOSTRING"/> - </Match> - - </FindBugsFilter>
diff --git a/pom.xml b/pom.xml index 75f1e8d..14171a4 100644 --- a/pom.xml +++ b/pom.xml
@@ -76,12 +76,12 @@ <copyright.update>false</copyright.update> <spotbugs.skip>false</spotbugs.skip> <spotbugs.threshold>Low</spotbugs.threshold> - <spotbugs.version>4.3.0</spotbugs.version> + <spotbugs.version>4.5.0.0</spotbugs.version> <maven.compiler.release>11</maven.compiler.release> <release.spec.feedback>jaxb-dev@eclipse.org</release.spec.feedback> - <release.spec.date>Jul 2017</release.spec.date> + <release.spec.date>Jan 2022</release.spec.date> <api.package>jakarta.xml.bind</api.package> <extension.name>jakarta.xml.bind</extension.name> <spec.version>4.0</spec.version> @@ -110,7 +110,7 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> - <version>1.4</version> + <version>3.0.0</version> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> @@ -132,7 +132,7 @@ </plugin> <plugin> <artifactId>maven-javadoc-plugin</artifactId> - <version>3.3.0</version> + <version>3.3.1</version> </plugin> <plugin> <artifactId>maven-enforcer-plugin</artifactId>