Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to Jakarta XML Binding 3 and Java 8 #69

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ target/
.project
.classpath
.settings/
.idea/
*.iml
6 changes: 5 additions & 1 deletion .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#Thu Mar 01 11:53:23 CET 2012
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
encoding/README.md=UTF-8
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JAXB @XmlElementWrapper Plugin
# Jakarta XML Binding (JAXB) `@XmlElementWrapper` Plugin

[![Build Status](https://travis-ci.org/dmak/jaxb-xew-plugin.svg)](https://travis-ci.org/dmak/jaxb-xew-plugin)
[![Coverage Status](https://coveralls.io/repos/github/dmak/jaxb-xew-plugin/badge.svg?branch=master)](https://coveralls.io/github/dmak/jaxb-xew-plugin?branch=master)
Expand Down Expand Up @@ -180,8 +180,8 @@ With JAXB customization it is possible to pass the same options as via XJC argum
```xml
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
jaxb:version="2.0"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="3.0"
xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
xmlns:xew="http://github.com/jaxb-xew-plugin"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
jaxb:extensionBindingPrefixes="xew"
Expand All @@ -202,8 +202,8 @@ With JAXB customization it is possible to pass the same options as via XJC argum
XJC arguments are overridden with JAXB global customizations, which are overridden with JAXB type customizations, which are overridden with JAXB field customizations. Per-type and per-field customizations cannot override `control` and `summary` configuration options, but have additionally `annotate` option, which if set to `false`, disables annotation/replacement of the particular field or all fields of the type/class (see [`element-with-customization.xsd`](src/test/resources/com/sun/tools/xjc/addon/xew/element-with-customization.xsd) example for global, per-type and per-field customization). Note that in contrast to `exclude` mode in control file, this option controls the behaviour for the particular field (or all fields of a type/class) which are being annotated with `@XmlElementWrapper`, but not the types/classes which are used for substitution (candidate classes). Example of per-field JXB file:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
<jaxb:bindings
xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xew="http://github.com/jaxb-xew-plugin"
jaxb:extensionBindingPrefixes="xew"
Expand Down Expand Up @@ -383,15 +383,15 @@ plugins {
id 'maven'
}

sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceCompatibility = 8
targetCompatibility = 8

repositories {
mavenCentral()
}

project.ext {
jaxbVersion = "2.2.11"
jaxbVersion = "3.0.1"
generatedSourcesDir = "target/generated-sources"
}

Expand Down Expand Up @@ -483,9 +483,9 @@ Everybody is very welcomed to send patches by email. But the best way would be:
- Create a branch referring the ticket number (`git branch issue-22`).
- Do the changes.
- Verify your outgoing changeset. Make sure that:
- your changeset is _minimal and sufficient_ for the feature implementation
- your formatting rules have not caused changes in each and every line (e.g. due to end-of-line markers)
- all unit tests run successfully
- Your changeset is _minimal and sufficient_ for the feature implementation.
- Your formatting rules have not caused changes in each and every line (e.g. due to end-of-line markers).
- All unit tests run successfully.
- Commit to your own fork, mentioning the ticket number in commit message (`Implemented nice feature (fixes #22)`). Check [here](https://github.com/blog/831-issues-2-0-the-next-generation) the commit message syntax sugar.
- [Request for pull](http://help.github.com/send-pull-requests/).

Expand Down
88 changes: 49 additions & 39 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@
<licenses>
<license>
<name>LGPLv3 License</name>
<url>http://www.gnu.org/licenses/lgpl-3.0.html</url>
<url>https://www.gnu.org/licenses/lgpl-3.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<jaxb.version>2.2.11</jaxb.version>
<jaxb-api.version>3.0.1</jaxb-api.version>
<jaxb-core.version>3.0.1</jaxb-core.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -141,7 +142,6 @@
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version>

<executions>
<execution>
<phase>install</phase>
Expand All @@ -167,24 +167,42 @@
<developer>
<name>Dmitry Katsubo</name>
<email>dmitry.katsubo@gmail.com</email>
<url>http://www.linkedin.com/in/dkatsubo</url>
<url>https://www.linkedin.com/in/dkatsubo</url>
<roles>
<role>developer</role>
</roles>
</developer>
</developers>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.8.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>${jaxb.version}</version>
<version>${jaxb-core.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb.version}</version>
<version>${jaxb-core.version}</version>
</dependency>

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
Expand All @@ -193,46 +211,36 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-tools</artifactId>
<version>0.12.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
<version>3.12.0</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.6</version>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.22.0</version>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-assertj3</artifactId>
<version>2.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.version}</version>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-jakarta-jaxb-impl</artifactId>
<version>2.9.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>${jaxb-core.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -242,19 +250,20 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<configuration>
<!-- Fix for "gpg: signing failed: Inappropriate ioctl for device", see https://gist.github.com/michaelajr/ff4693bce9fc20e5200b34683aa4ba51 and https://ru.stackoverflow.com/questions/791317/ -->
<gpgArguments>
Expand All @@ -270,12 +279,13 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
<version>2.7</version>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
<check/>
</configuration>
<executions>
<execution>
Expand Down
1 change: 0 additions & 1 deletion samples/cxf-codegen-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

<modelVersion>4.0.0</modelVersion>

<groupId>com.github.jaxb-xew-plugin.sample</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
Expand Down
9 changes: 0 additions & 9 deletions samples/jaxb2-maven-plugin-immutable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

<modelVersion>4.0.0</modelVersion>

<groupId>com.github.jaxb-xew-plugin.sample</groupId>
<artifactId>jaxb2-maven-plugin-immutable</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
Expand Down Expand Up @@ -70,12 +69,4 @@
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</project>
9 changes: 0 additions & 9 deletions samples/jaxb2-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

<modelVersion>4.0.0</modelVersion>

<groupId>com.github.jaxb-xew-plugin.sample</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
Expand Down Expand Up @@ -75,12 +74,4 @@
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</project>
1 change: 0 additions & 1 deletion samples/jaxws-maven-plugin-exclude/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

<modelVersion>4.0.0</modelVersion>

<groupId>com.github.jaxb-xew-plugin.sample</groupId>
<artifactId>jaxws-maven-plugin-exclude</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
Expand Down
3 changes: 1 addition & 2 deletions samples/jaxws-maven-plugin-visitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

<modelVersion>4.0.0</modelVersion>

<groupId>com.github.jaxb-xew-plugin.sample</groupId>
<artifactId>jaxws-maven-plugin-visitor</artifactId>
<artifactId>jaxws-maven-plugin-visitor</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

Expand Down
1 change: 0 additions & 1 deletion samples/maven-jaxb2-plugin-basics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

<modelVersion>4.0.0</modelVersion>

<groupId>com.github.jaxb-xew-plugin.sample</groupId>
<artifactId>maven-jaxb2-plugin-basics</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
Expand Down
1 change: 0 additions & 1 deletion samples/maven-jaxb2-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

<modelVersion>4.0.0</modelVersion>

<groupId>com.github.jaxb-xew-plugin.sample</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/sun/tools/xjc/addon/xew/Candidate.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public final class Candidate {
private final JDefinedClass fieldParametrisationImpl;

// Order matters (value Object Factory is first):
private final Map<String, JDefinedClass> objectFactoryClasses = new LinkedHashMap<String, JDefinedClass>();
private final Map<String, JDefinedClass> objectFactoryClasses = new LinkedHashMap<>();

private final boolean valueObjectDisabled;

private final Map<String, ScopedElementInfo> scopedElementInfos = new HashMap<String, ScopedElementInfo>();
private final Map<String, ScopedElementInfo> scopedElementInfos = new HashMap<>();

/**
* By default the candidate is marked for removal unless something prevents it from being removed.
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/sun/tools/xjc/addon/xew/CommonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static boolean isHiddenClass(JClass clazz) {

/**
* Returns <code>true</code> of the given <code>type</code> is {@link JClass} and contains <code>classToCheck</code>
* in the list of parametrisations.
* in the list of parametrisation.
*/
public static boolean isListedAsParametrisation(JClass classToCheck, JType type) {
return type instanceof JClass && ((JClass) type).getTypeParameters().contains(classToCheck);
Expand All @@ -55,7 +55,7 @@ public static boolean isListedAsParametrisation(JClass classToCheck, JType type)
//

/**
* Returns the annotation for the given field. This method has side effect as it initailizes the lazy list of
* Returns the annotation for the given field. This method has side effect as it initializes the lazy list of
* annotations on the given {@code annotatable}.
*/
public static JAnnotationUse getAnnotation(JAnnotatable annotatable, JClass annotationClass) {
Expand Down Expand Up @@ -101,7 +101,7 @@ public static JExpression getAnnotationMemberExpression(JAnnotationUse annotatio
// FIXME: Pending for https://java.net/jira/browse/JAXB-878
try {
// In most cases the value is some expression...
return (JExpression) getPrivateField(annotationValue, "value");
return getPrivateField(annotationValue, "value");
}
catch (IllegalArgumentException e) {
// ... and in some cases (like enum) do the conversion from JGenerable to JExpression
Expand Down Expand Up @@ -156,7 +156,7 @@ public static boolean hasPropertyNameCustomization(CPropertyInfo fieldPropertyIn
/**
* Returns the string value of passed argument.
*/
public static final String generableToString(JGenerable generable) {
public static String generableToString(JGenerable generable) {
// There is hardly any clean universal way to get the value from e.g. JExpression except of serializing it.
// Compare JStringLiteral and JExp#dotclass().
Writer w = new StringWriter();
Expand Down
Loading