Code cleanup. (#201) * Fixed build link in README. Signed-off-by: Tomas Kraus <tomas.kraus@oracle.com>
diff --git a/README.md b/README.md index 90878d7..b16bd71 100644 --- a/README.md +++ b/README.md
@@ -6,10 +6,11 @@ [//]: # " " [//]: # " SPDX-License-Identifier: BSD-3-Clause " -[](https://travis-ci.com/eclipse-ee4j/jaxb-api) - # Jakarta XML Binding project +[](https://github.com/eclipse-ee4j/jaxb-api/actions/workflows/maven.yml?branch=master) +[](https://jakarta.oss.sonatype.org/content/repositories/staging/jakarta/xml/bind/jakarta.xml.bind-api/) + The Jakarta XML Binding provides an API and tools that automate the mapping between XML documents and Java objects.
diff --git a/api/pom.xml b/api/pom.xml index 30fc692..e99ae32 100644 --- a/api/pom.xml +++ b/api/pom.xml
@@ -27,6 +27,7 @@ <properties> <config.dir>${project.basedir}/../etc/config</config.dir> <legal.doc.source>${project.basedir}/..</legal.doc.source> + <spotbugs.exclude>${project.basedir}/../etc/spotbugs-exclude.xml</spotbugs.exclude> </properties> <dependencies> @@ -64,18 +65,6 @@ </configuration> </plugin> <plugin> - <groupId>com.github.spotbugs</groupId> - <artifactId>spotbugs-maven-plugin</artifactId> - <configuration> - <threshold>${spotbugs.threshold}</threshold> - <findbugsXmlWithMessages>true</findbugsXmlWithMessages> - <excludeFilterFile> - ${spotbugs.exclude} - </excludeFilterFile> - <fork>true</fork> - </configuration> - </plugin> - <plugin> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <additionalOptions> @@ -207,6 +196,8 @@ <compilerArgs> <arg>-Xlint:all</arg> </compilerArgs> + <showDeprecation>true</showDeprecation> + <showWarnings>true</showWarnings> </configuration> <executions> <execution> @@ -281,6 +272,23 @@ </archive> </configuration> </plugin> + <plugin> + <groupId>com.github.spotbugs</groupId> + <artifactId>spotbugs-maven-plugin</artifactId> + <configuration> + <findbugsXmlWithMessages>true</findbugsXmlWithMessages> + <fork>true</fork> + <excludeFilterFile>${spotbugs.exclude}</excludeFilterFile> + <failThreshold>High</failThreshold> + </configuration> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> </project>
diff --git a/api/src/main/java/jakarta/xml/bind/Binder.java b/api/src/main/java/jakarta/xml/bind/Binder.java index a340235..372a6aa 100644 --- a/api/src/main/java/jakarta/xml/bind/Binder.java +++ b/api/src/main/java/jakarta/xml/bind/Binder.java
@@ -50,7 +50,7 @@ * {@link JAXBContext#createBinder()} or {@link JAXBContext#createBinder(Class)}. * * <p> - * The template parameter, <code>XmlNode</code>, is the + * @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 * an <code>XmlNode</code> value of <code>org.w3c.dom.Node.class</code>. @@ -130,6 +130,7 @@ * the document/element to unmarshal XML data from. * @param declaredType * appropriate Jakarta XML Binding mapped class to hold {@code node}'s XML data. + * @param <T> the declared type * * @return * <a href="JAXBElement.html">JAXBElement</a> representation @@ -224,6 +225,8 @@ * have associated Jakarta XML Binding objects, and not all Jakarta XML Binding objects have * associated XML elements. * + * @param xmlNode the XML element + * * @return * null if the specified XML node is not known to this * {@link Binder}, or if it is not associated with a @@ -244,6 +247,10 @@ * updateXML( jaxbObject, getXMLNode(jaxbObject)); * </pre> * + * @param jaxbObject the XML Binding object + * + * @return the XML node associated with XML Binding object + * * @throws JAXBException * If any unexpected problem occurs updating corresponding XML content. * @throws IllegalArgumentException @@ -298,6 +305,8 @@ * As a side-effect, this operation updates the association between * XML nodes and Jakarta XML Binding objects. * + * @param xmlNode the XML node + * * @return * Returns the updated Jakarta XML Binding object. Typically, this is the same * object that was returned from earlier
diff --git a/api/src/main/java/jakarta/xml/bind/JAXBContext.java b/api/src/main/java/jakarta/xml/bind/JAXBContext.java index e3a99bc..220baa7 100644 --- a/api/src/main/java/jakarta/xml/bind/JAXBContext.java +++ b/api/src/main/java/jakarta/xml/bind/JAXBContext.java
@@ -234,6 +234,10 @@ * {@link #newInstance(String,ClassLoader)} method with * the context class loader of the current thread. * + * @param contextPath the context path + * + * @return the new instance of a {@code JAXBContext} class + * * @throws JAXBException if an error was encountered while creating the * {@code JAXBContext} such as * <ol> @@ -624,7 +628,9 @@ * Creates a {@code Binder} object that can be used for * associative/in-place unmarshalling/marshalling. * - * @param domType select the DOM API to use by passing in its DOM Node class. + * @param domType select the DOM API to use by passing in its DOM Node class + * + * @param <T> the DOM API type * * @return always a new valid {@code Binder} object. * @@ -697,12 +703,8 @@ return Thread.currentThread().getContextClassLoader(); } else { return java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction<ClassLoader>() { - @Override - public ClassLoader run() { - return Thread.currentThread().getContextClassLoader(); - } - }); + (java.security.PrivilegedAction<ClassLoader>) () + -> Thread.currentThread().getContextClassLoader()); } }
diff --git a/api/src/main/java/jakarta/xml/bind/Marshaller.java b/api/src/main/java/jakarta/xml/bind/Marshaller.java index d3d1e17..cecfe7f 100644 --- a/api/src/main/java/jakarta/xml/bind/Marshaller.java +++ b/api/src/main/java/jakarta/xml/bind/Marshaller.java
@@ -634,6 +634,12 @@ * <p> * This is a convenience method that invokes {@code setAdapter(adapter.getClass(),adapter);}. * + * @param adapter + * The instance of the adapter to be used. If null, it will un-register + * the current adapter set for this type. + * + * @param <A> the type of the adapter + * * @see #setAdapter(Class,XmlAdapter) * @throws IllegalArgumentException * if the adapter parameter is null. @@ -664,6 +670,8 @@ * @param adapter * The instance of the adapter to be used. If null, it will un-register * the current adapter set for this type. + * @param <A> the type of the adapter + * * @throws IllegalArgumentException * if the type parameter is null. * @throws UnsupportedOperationException @@ -674,9 +682,18 @@ /** * Gets the adapter associated with the specified type. - * * This is the reverse operation of the {@link #setAdapter} method. * + * @param type + * The type of the adapter. The specified instance will be used when + * {@link jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value()} + * refers to this type. + * + * @param <A> the type of the adapter + * + * @return + * The adapter associated with the specified type. + * * @throws IllegalArgumentException * if the type parameter is null. * @throws UnsupportedOperationException @@ -687,11 +704,13 @@ /** - * <p>Associate a context that enables binary data within an XML document + * Associate a context that enables binary data within an XML document * to be transmitted as XML-binary optimized attachment. * The attachment is referenced from the XML document content model * by content-id URIs(cid) references stored within the xml document. * + * @param am the attachment marshaller to be set + * * @throws IllegalStateException if attempt to concurrently call this * method during a marshal operation. */
diff --git a/api/src/main/java/jakarta/xml/bind/Unmarshaller.java b/api/src/main/java/jakarta/xml/bind/Unmarshaller.java index d94832b..52a30cc 100644 --- a/api/src/main/java/jakarta/xml/bind/Unmarshaller.java +++ b/api/src/main/java/jakarta/xml/bind/Unmarshaller.java
@@ -540,6 +540,8 @@ * @param declaredType * appropriate Jakarta XML Binding mapped class to hold {@code node}'s XML data. * + * @param <T> the XML Binding mapped class + * * @return <a href="#unmarshalDeclaredTypeReturn">JAXBElement</a> representation of {@code node} * * @throws JAXBException @@ -629,6 +631,9 @@ * only required to support SAXSource, DOMSource, and StreamSource) * @param declaredType * appropriate Jakarta XML Binding mapped class to hold {@code source}'s xml root element + * + * @param <T> the XML Binding mapped class + * * @return Java content rooted by <a href="#unmarshalDeclaredTypeReturn">JAXBElement</a> * * @throws JAXBException @@ -700,6 +705,8 @@ * @param declaredType * appropriate Jakarta XML Binding mapped class to hold {@code reader}'s START_ELEMENT XML data. * + * @param <T> the XML Binding mapped class + * * @return content tree rooted by <a href="#unmarshalDeclaredTypeReturn">JAXBElement</a> representation * * @throws JAXBException @@ -771,6 +778,8 @@ * @param declaredType * appropriate Jakarta XML Binding mapped class to hold {@code reader}'s START_ELEMENT XML data. * + * @param <T> the XML Binding mapped class + * * @return content tree rooted by <a href="#unmarshalDeclaredTypeReturn">JAXBElement</a> representation * * @throws JAXBException @@ -912,6 +921,10 @@ * <p> * This is a convenience method that invokes {@code setAdapter(adapter.getClass(),adapter);}. * + * @param adapter the configured instance of {@link XmlAdapter} + * + * @param <A> the type of {@link XmlAdapter} + * * @see #setAdapter(Class,XmlAdapter) * @throws IllegalArgumentException * if the adapter parameter is null. @@ -942,6 +955,9 @@ * @param adapter * The instance of the adapter to be used. If null, it will un-register * the current adapter set for this type. + * + * @param <A> the type of the adapter + * * @throws IllegalArgumentException * if the type parameter is null. * @throws UnsupportedOperationException @@ -952,9 +968,19 @@ /** * Gets the adapter associated with the specified type. - * * This is the reverse operation of the {@link #setAdapter} method. * + * + * @param type + * The type of the adapter. The specified instance will be used when + * {@link jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value()} + * refers to this type. + * + * @param <A> the type of the adapter + * + * @return + * The adapter associated with the specified type. + * * @throws IllegalArgumentException * if the type parameter is null. * @throws UnsupportedOperationException @@ -964,11 +990,12 @@ public <A extends XmlAdapter<?, ?>> A getAdapter( Class<A> type ); /** - * <p>Associate a context that resolves cid's, content-id URIs, to - * binary data passed as attachments.</p> - * <p>Unmarshal time validation, enabled via {@link #setSchema(Schema)}, + * Associate a context that resolves cid's, content-id URIs, to + * binary data passed as attachments. + * Unmarshal time validation, enabled via {@link #setSchema(Schema)}, * must be supported even when unmarshaller is performing XOP processing. - * </p> + * + * @param au the attachment unmarshaller to be set * * @throws IllegalStateException if attempt to concurrently call this * method during a unmarshal operation.
diff --git a/api/exclude.xml b/etc/spotbugs-exclude.xml similarity index 100% rename from api/exclude.xml rename to etc/spotbugs-exclude.xml
diff --git a/pom.xml b/pom.xml index f06e078..9ef8b70 100644 --- a/pom.xml +++ b/pom.xml
@@ -18,7 +18,7 @@ <parent> <groupId>org.eclipse.ee4j</groupId> <artifactId>project</artifactId> - <version>1.0.6</version> + <version>1.0.7</version> <relativePath/> </parent> @@ -74,10 +74,9 @@ <copyright.scmonly>true</copyright.scmonly> <copyright.templatefile>${config.dir}/edl-copyright.txt</copyright.templatefile> <copyright.update>false</copyright.update> - <spotbugs.exclude>${project.basedir}/exclude.xml</spotbugs.exclude> <spotbugs.skip>false</spotbugs.skip> <spotbugs.threshold>Low</spotbugs.threshold> - <spotbugs.version>4.2.0</spotbugs.version> + <spotbugs.version>4.3.0</spotbugs.version> <release.spec.feedback>jaxb-dev@eclipse.org</release.spec.feedback> <release.spec.date>Jul 2017</release.spec.date> @@ -127,15 +126,15 @@ </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> - <version>2.20</version> + <version>3.0.0-M5</version> </plugin> <plugin> <artifactId>maven-javadoc-plugin</artifactId> - <version>3.2.0</version> + <version>3.3.0</version> </plugin> <plugin> <artifactId>maven-enforcer-plugin</artifactId> - <version>3.0.0-M3</version> + <version>3.0.0</version> </plugin> <plugin> <groupId>org.apache.felix</groupId> @@ -165,7 +164,7 @@ </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.2</version> + <version>3.2.0</version> </plugin> <plugin> <groupId>com.github.spotbugs</groupId> @@ -173,6 +172,7 @@ <version>${spotbugs.version}</version> <configuration> <skip>${spotbugs.skip}</skip> + <threshold>${spotbugs.threshold}</threshold> </configuration> </plugin> </plugins>