From fdfd022a623d3051b9d65073d675412364c1e044 Mon Sep 17 00:00:00 2001 From: Boris Wachtmeister Date: Sat, 14 Jan 2023 13:07:54 +0100 Subject: [PATCH 1/2] migrate to jakarta jaxb This disables the generation of the clone method which is something that jaxb2-basics now also is capable of doing. --- cc-xjc-it/pom.xml | 33 +++++----- .../ccxjc/it/ChoiceComplexTypeTest.java | 4 +- .../sourceforge/ccxjc/it/CommonHelper.java | 21 +++++++ .../ccxjc/it/MimeTypeXmlAdapter.java | 8 +-- .../sourceforge/ccxjc/it/ReferencedClass.java | 29 +++++---- .../SimpleTypeAttributesCollectionsTest.java | 33 ++++------ .../it/SimpleTypeAttributesIndexedTest.java | 24 ++++---- ...-it-collections-no-value-class-package.xjb | 4 +- ...-it-collections-no-value-class-private.xjb | 4 +- ...t-collections-no-value-class-protected.xjb | 4 +- ...c-it-collections-no-value-class-public.xjb | 4 +- .../jaxb/cc-xjc-it-collections-package.xjb | 4 +- .../jaxb/cc-xjc-it-collections-private.xjb | 4 +- .../jaxb/cc-xjc-it-collections-protected.xjb | 4 +- .../jaxb/cc-xjc-it-collections-public.xjb | 4 +- ...-xjc-it-indexed-no-value-class-package.xjb | 4 +- ...-xjc-it-indexed-no-value-class-private.xjb | 4 +- ...jc-it-indexed-no-value-class-protected.xjb | 4 +- ...c-xjc-it-indexed-no-value-class-public.xjb | 4 +- .../main/jaxb/cc-xjc-it-indexed-package.xjb | 4 +- .../main/jaxb/cc-xjc-it-indexed-private.xjb | 4 +- .../main/jaxb/cc-xjc-it-indexed-protected.xjb | 4 +- .../main/jaxb/cc-xjc-it-indexed-public.xjb | 4 +- cc-xjc-plugin/pom.xml | 18 ++---- .../net/sourceforge/ccxjc/PluginImpl.java | 27 +++++---- pom.xml | 60 +++++++++++++------ src/site/apt/index.apt | 2 +- 27 files changed, 175 insertions(+), 148 deletions(-) create mode 100644 cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/CommonHelper.java diff --git a/cc-xjc-it/pom.xml b/cc-xjc-it/pom.xml index 10f6c44..3f7af23 100644 --- a/cc-xjc-it/pom.xml +++ b/cc-xjc-it/pom.xml @@ -80,8 +80,8 @@ - org.jvnet.jaxb2.maven2 - maven-jaxb21-plugin + com.evolvedbinary.maven.jvnet + jaxb30-maven-plugin net.sourceforge.ccxjc @@ -89,9 +89,9 @@ ${project.version} - org.jvnet.jaxb2_commons - basic - 0.4.1.5 + codes.rafael.jaxb2_commons + jaxb2-basics + ${version.jaxb2_commons-basics} @@ -585,8 +585,8 @@ maven-dependency-plugin - org.jvnet.jaxb2.maven2 - maven-jaxb21-plugin + com.evolvedbinary.maven.jvnet + jaxb30-maven-plugin @@ -594,7 +594,7 @@ junit junit - 4.8.2 + 4.13.2 compile @@ -604,21 +604,18 @@ compile - org.jvnet.jaxb2_commons - basic - 0.4.1.5 - compile + codes.rafael.jaxb2_commons + jaxb2-basics + ${version.jaxb2_commons-basics} - javax.xml.bind - jaxb-api - 2.1 + org.glassfish.jaxb + jaxb-runtime provided - com.sun.xml.bind - jaxb-impl - 2.1.13 + jakarta.activation + jakarta.activation-api provided diff --git a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.java b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.java index 214f8d5..d68a3c8 100644 --- a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.java +++ b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ChoiceComplexTypeTest.java @@ -29,8 +29,8 @@ */ package net.sourceforge.ccxjc.it; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBElement; import net.sourceforge.ccxjc.it.model.priv.collections.valueclass.ccxjcit.ChoiceComplexType; import org.junit.Test; diff --git a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/CommonHelper.java b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/CommonHelper.java new file mode 100644 index 0000000..d621428 --- /dev/null +++ b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/CommonHelper.java @@ -0,0 +1,21 @@ +package net.sourceforge.ccxjc.it; + +import java.util.GregorianCalendar; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.Duration; +import javax.xml.datatype.XMLGregorianCalendar; + +final class CommonHelper { + static final double FLOAT_EPSILON = 0.001F; + static final double DOUBLE_EPSILON = 0.00000001D; + + static Duration createDurationFromMillis( long millis ) throws DatatypeConfigurationException { + return DatatypeFactory.newInstance().newDuration( millis ); + } + + static XMLGregorianCalendar now() throws DatatypeConfigurationException { + return DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()); + } +} diff --git a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/MimeTypeXmlAdapter.java b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/MimeTypeXmlAdapter.java index f48738b..f6650eb 100644 --- a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/MimeTypeXmlAdapter.java +++ b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/MimeTypeXmlAdapter.java @@ -29,10 +29,10 @@ */ package net.sourceforge.ccxjc.it; -import javax.activation.MimeType; -import javax.activation.MimeTypeParseException; -import javax.xml.bind.DataBindingException; -import javax.xml.bind.annotation.adapters.XmlAdapter; +import jakarta.activation.MimeType; +import jakarta.activation.MimeTypeParseException; +import jakarta.xml.bind.DataBindingException; +import jakarta.xml.bind.annotation.adapters.XmlAdapter; /** * {@code XmlAdapter} adapting {@code String} to {@code MimeType}. diff --git a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ReferencedClass.java b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ReferencedClass.java index 17cbf83..a75cdf8 100644 --- a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ReferencedClass.java +++ b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/ReferencedClass.java @@ -29,10 +29,11 @@ */ package net.sourceforge.ccxjc.it; -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.jvnet.jaxb2_commons.lang.builder.CopyBuilder; +import org.jvnet.jaxb2_commons.lang.CopyStrategy2; +import org.jvnet.jaxb2_commons.lang.EqualsStrategy2; +import org.jvnet.jaxb2_commons.lang.HashCodeStrategy2; +import org.jvnet.jaxb2_commons.lang.ToStringStrategy2; +import org.jvnet.jaxb2_commons.locator.ObjectLocator; /** * Class referenced by {@code <jaxb:class ref="net.sourceforge.ccxjc.it.ReferencedClass">} test customizations. @@ -54,11 +55,11 @@ public ReferencedClass( final ReferencedClass o ) } @Override - public ReferencedClass clone() + public Object clone() { try { - return (ReferencedClass) super.clone(); + return super.clone(); } catch ( final CloneNotSupportedException e ) { @@ -66,21 +67,19 @@ public ReferencedClass clone() } } - public void toString( final ToStringBuilder toStringBuilder ) - { + public StringBuilder appendFields( final ObjectLocator locator, final StringBuilder buffer, final ToStringStrategy2 strategy ) { + return buffer; } - public void equals( final Object object, final EqualsBuilder equalsBuilder ) - { + public boolean equals( final ObjectLocator thisLocator, final ObjectLocator thatLocator, final Object object, final EqualsStrategy2 strategy ) { + return true; } - public void hashCode( final HashCodeBuilder hashCodeBuilder ) - { + public int hashCode( final ObjectLocator locator, final HashCodeStrategy2 strategy ) { + return 0; } - public Object copyTo( final Object target, final CopyBuilder copyBuilder ) - { + public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) { return target; } - } diff --git a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java index 5e0d563..7d7847a 100644 --- a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java +++ b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesCollectionsTest.java @@ -32,15 +32,15 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.util.Arrays; +import java.util.Collections; import java.util.List; import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; -import junit.framework.Assert; import net.sourceforge.ccxjc.it.model.priv.collections.valueclass.ccxjcit.SimpleTypeAttributes; import org.apache.commons.lang.SerializationUtils; +import org.junit.Assert; import org.junit.Test; /** @@ -72,7 +72,7 @@ public XMLGregorianCalendar getTestCalendar() throws DatatypeConfigurationExcept { if ( this.testCalendar == null ) { - this.testCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(); + this.testCalendar = CommonHelper.now(); } return this.testCalendar; @@ -82,7 +82,7 @@ public Duration getTestDuration() throws DatatypeConfigurationException { if ( this.testDuration == null ) { - this.testDuration = DatatypeFactory.newInstance().newDuration( 1000L ); + this.testDuration = CommonHelper.createDurationFromMillis( 1000L ); } return this.testDuration; @@ -106,10 +106,7 @@ public List getTestEntities() { if ( this.testEntities == null ) { - this.testEntities = Arrays.asList( new String[] - { - "ENTITY 1", "ENTITY 2", "ENTITY 3" - } ); + this.testEntities = Arrays.asList( "ENTITY 1", "ENTITY 2", "ENTITY 3" ); } @@ -120,10 +117,7 @@ public List getTestIdRefs() { if ( this.testIdRefs == null ) { - this.testIdRefs = Arrays.asList( new Object[] - { - "ID" - } ); + this.testIdRefs = Collections.singletonList( "ID" ); } @@ -134,10 +128,7 @@ public List getTestTokens() { if ( this.testTokens == null ) { - this.testTokens = Arrays.asList( new String[] - { - "NMTOKEN 1", "NMTOKEN 2", "NMTOKEN 3" - } ); + this.testTokens = Arrays.asList( "NMTOKEN 1", "NMTOKEN 2", "NMTOKEN 3" ); } @@ -156,7 +147,7 @@ public QName getTestQName() public void assertTestBytes( final byte[] bytes ) { - Assert.assertTrue( Arrays.equals( this.getTestBytes(), bytes ) ); + Assert.assertArrayEquals(this.getTestBytes(), bytes); } public SimpleTypeAttributes getTestSimpleTypeAttributes() throws DatatypeConfigurationException @@ -199,7 +190,7 @@ public SimpleTypeAttributes getTestSimpleTypeAttributes() throws DatatypeConfigu t.setQName( this.getTestQName() ); t.setShort( (short) 100 ); t.setString( "String" ); - t.setTime( DatatypeFactory.newInstance().newXMLGregorianCalendar() ); + t.setTime( this.getTestCalendar() ); t.setToken( "Token" ); t.setUnsignedByte( (short) 100 ); t.setUnsignedInt( 100L ); @@ -218,16 +209,16 @@ public void assertTestSimpleTypeAttributes( final SimpleTypeAttributes a ) throw Assert.assertEquals( "any", a.getAnySimpleType() ); Assert.assertEquals( "anyURI", a.getAnyURI() ); this.assertTestBytes( a.getBase64Binary() ); - Assert.assertEquals( true, a.isBoolean() ); + Assert.assertTrue( a.isBoolean() ); Assert.assertEquals( 1, a.getByte() ); Assert.assertEquals( this.getTestCalendar(), a.getDate() ); Assert.assertEquals( this.getTestCalendar(), a.getDateTime() ); Assert.assertEquals( BigDecimal.TEN, a.getDecimal() ); - Assert.assertEquals( 100.0D, a.getDouble() ); + Assert.assertEquals(100.0D, a.getDouble(), CommonHelper.DOUBLE_EPSILON ); Assert.assertEquals( this.getTestDuration(), a.getDuration() ); Assert.assertEquals( this.getTestEntities(), a.getENTITIES() ); Assert.assertEquals( "ENTITY", a.getENTITY() ); - Assert.assertEquals( 100.0F, a.getFloat() ); + Assert.assertEquals(100.0F, a.getFloat(), CommonHelper.FLOAT_EPSILON ); Assert.assertEquals( this.getTestCalendar(), a.getGDay() ); Assert.assertEquals( this.getTestCalendar(), a.getGMonth() ); Assert.assertEquals( this.getTestCalendar(), a.getGMonthDay() ); diff --git a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java index 3159817..b8d2921 100644 --- a/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java +++ b/cc-xjc-it/src/main/java/net/sourceforge/ccxjc/it/SimpleTypeAttributesIndexedTest.java @@ -31,15 +31,13 @@ import java.math.BigDecimal; import java.math.BigInteger; -import java.util.Arrays; import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; -import junit.framework.Assert; import net.sourceforge.ccxjc.it.model.priv.indexed.valueclass.ccxjcit.SimpleTypeAttributes; import org.apache.commons.lang.SerializationUtils; +import org.junit.Assert; import org.junit.Test; /** @@ -71,7 +69,7 @@ public XMLGregorianCalendar getTestCalendar() throws DatatypeConfigurationExcept { if ( this.testCalendar == null ) { - this.testCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(); + this.testCalendar = CommonHelper.now(); } return this.testCalendar; @@ -81,7 +79,7 @@ public Duration getTestDuration() throws DatatypeConfigurationException { if ( this.testDuration == null ) { - this.testDuration = DatatypeFactory.newInstance().newDuration( 1000L ); + this.testDuration = CommonHelper.createDurationFromMillis( 1000L ); } return this.testDuration; @@ -155,22 +153,22 @@ public QName getTestQName() public void assertTestBytes( final byte[] bytes ) { - Assert.assertTrue( Arrays.equals( this.getTestBytes(), bytes ) ); + Assert.assertArrayEquals( this.getTestBytes(), bytes ); } public void assertTestEntities( final String[] entities ) { - Assert.assertTrue( Arrays.equals( this.getTestEntities(), entities ) ); + Assert.assertArrayEquals( this.getTestEntities(), entities ); } public void assertTestIdRefs( final Object[] idrefs ) { - Assert.assertTrue( Arrays.equals( this.getTestIdRefs(), idrefs ) ); + Assert.assertArrayEquals( this.getTestIdRefs(), idrefs ); } public void assertTestTokens( final String[] tokens ) { - Assert.assertTrue( Arrays.equals( this.getTestTokens(), tokens ) ); + Assert.assertArrayEquals( this.getTestTokens(), tokens ); } public SimpleTypeAttributes getTestSimpleTypeAttributes() throws DatatypeConfigurationException @@ -213,7 +211,7 @@ public SimpleTypeAttributes getTestSimpleTypeAttributes() throws DatatypeConfigu t.setQName( this.getTestQName() ); t.setShort( (short) 100 ); t.setString( "String" ); - t.setTime( DatatypeFactory.newInstance().newXMLGregorianCalendar() ); + t.setTime( this.getTestCalendar() ); t.setToken( "Token" ); t.setUnsignedByte( (short) 100 ); t.setUnsignedInt( 100L ); @@ -232,16 +230,16 @@ public void assertTestSimpleTypeAttributes( final SimpleTypeAttributes a ) throw Assert.assertEquals( "any", a.getAnySimpleType() ); Assert.assertEquals( "anyURI", a.getAnyURI() ); this.assertTestBytes( a.getBase64Binary() ); - Assert.assertEquals( true, a.isBoolean() ); + Assert.assertTrue( a.isBoolean() ); Assert.assertEquals( 1, a.getByte() ); Assert.assertEquals( this.getTestCalendar(), a.getDate() ); Assert.assertEquals( this.getTestCalendar(), a.getDateTime() ); Assert.assertEquals( BigDecimal.TEN, a.getDecimal() ); - Assert.assertEquals( 100.0D, a.getDouble() ); + Assert.assertEquals(100.0D, a.getDouble(), CommonHelper.DOUBLE_EPSILON ); Assert.assertEquals( this.getTestDuration(), a.getDuration() ); this.assertTestEntities( a.getENTITIES() ); Assert.assertEquals( "ENTITY", a.getENTITY() ); - Assert.assertEquals( 100.0F, a.getFloat() ); + Assert.assertEquals(100.0F, a.getFloat(), CommonHelper.FLOAT_EPSILON ); Assert.assertEquals( this.getTestCalendar(), a.getGDay() ); Assert.assertEquals( this.getTestCalendar(), a.getGMonth() ); Assert.assertEquals( this.getTestCalendar(), a.getGMonthDay() ); diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-package.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-package.xjb index 2cfe863..e0716f1 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-package.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-package.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-private.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-private.xjb index eb1603b..7c37e07 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-private.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-private.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-protected.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-protected.xjb index 4ccea97..b53e1ec 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-protected.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-protected.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-public.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-public.xjb index a005708..76e810d 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-public.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-no-value-class-public.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-package.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-package.xjb index 95aba3f..390bd94 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-package.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-package.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-private.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-private.xjb index e3ad68e..52653eb 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-private.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-private.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-protected.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-protected.xjb index 0fe487d..b123a96 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-protected.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-protected.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-public.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-public.xjb index c47ec73..4861449 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-public.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-collections-public.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-package.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-package.xjb index 4df9a9d..f2117d4 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-package.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-package.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-private.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-private.xjb index fbdbfef..d6d3a71 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-private.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-private.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-protected.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-protected.xjb index f298b7e..d4cd6a2 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-protected.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-protected.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-public.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-public.xjb index 07fdd66..22b912d 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-public.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-no-value-class-public.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-package.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-package.xjb index cda9fe2..f000683 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-package.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-package.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-private.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-private.xjb index d0a9df0..4be5f6d 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-private.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-private.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-protected.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-protected.xjb index 1f2b71b..7eaaa9c 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-protected.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-protected.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-public.xjb b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-public.xjb index 2d82b06..9a8bf6b 100644 --- a/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-public.xjb +++ b/cc-xjc-it/src/main/jaxb/cc-xjc-it-indexed-public.xjb @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - + diff --git a/cc-xjc-plugin/pom.xml b/cc-xjc-plugin/pom.xml index e8e52d5..7460396 100644 --- a/cc-xjc-plugin/pom.xml +++ b/cc-xjc-plugin/pom.xml @@ -96,22 +96,16 @@ - javax.xml.bind - jaxb-api - 2.0 - provided + org.glassfish.jaxb + jaxb-runtime - com.sun.xml.bind - jaxb-impl - 2.0.5 - provided + org.glassfish.jaxb + jaxb-xjc - com.sun.xml.bind - jaxb-xjc - 2.0.5 - provided + jakarta.activation + jakarta.activation-api diff --git a/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java b/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java index f9dc718..77db43b 100644 --- a/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java +++ b/cc-xjc-plugin/src/main/java/net/sourceforge/ccxjc/PluginImpl.java @@ -64,9 +64,6 @@ import com.sun.tools.xjc.outline.ClassOutline; import com.sun.tools.xjc.outline.FieldOutline; import com.sun.tools.xjc.outline.Outline; -import com.sun.xml.bind.v2.model.annotation.Locatable; -import com.sun.xml.bind.v2.model.core.ID; -import com.sun.xml.bind.v2.runtime.Location; import com.sun.xml.xsom.XSComponent; import com.sun.xml.xsom.XmlString; import java.io.BufferedReader; @@ -107,15 +104,20 @@ import java.util.TimeZone; import java.util.UUID; import java.util.logging.Level; -import javax.activation.MimeType; -import javax.xml.bind.JAXBElement; import javax.xml.datatype.Duration; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; + +import org.glassfish.jaxb.core.v2.model.annotation.Locatable; +import org.glassfish.jaxb.core.v2.model.core.ID; +import org.glassfish.jaxb.core.v2.runtime.Location; import org.w3c.dom.Element; import org.xml.sax.ErrorHandler; import org.xml.sax.Locator; +import jakarta.activation.MimeType; +import jakarta.xml.bind.JAXBElement; + /** * CC-XJC plugin implementation. * @@ -519,10 +521,10 @@ public boolean run( final Outline model, final Options options, final ErrorHandl this.log( Level.WARNING, "couldNotAddCopyCtor", clazz.implClass.binaryName() ); } - if ( this.getCloneMethod( clazz ) == null ) + /*if ( this.getCloneMethod( clazz ) == null ) { this.log( Level.WARNING, "couldNotAddMethod", "clone", clazz.implClass.binaryName() ); - } + }*/ } this.log( Level.INFO, "report", this.methodCount, this.constructorCount, this.expressionCount ); @@ -1093,7 +1095,7 @@ private JInvocation getCopyOfObjectInvocation( final ClassOutline clazz ) } objectNotNull._then()._if( o._instanceof( cloneable ) )._then()._return( - JExpr.invoke( JExpr.cast( cloneable, o ), ( "clone" ) ) ); + JExpr.cast(cloneable, JExpr.invoke( JExpr.cast( cloneable, o ), ( "clone" ) ) ) ); } @@ -2158,16 +2160,17 @@ private JExpression getClassInfoCopyExpression( final FieldOutline fieldOutline, final JBlock block, final JExpression sourceExpr, final boolean sourceMaybeNull ) { - block.directStatement( - "// CClassInfo: " + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); + final var typeClass = type.toType(fieldOutline.parent().parent(), Aspect.IMPLEMENTATION); + block.directStatement("// CClassInfo: " + typeClass.binaryName() ); + final var cloneExpr = JExpr.cast(typeClass, sourceExpr.invoke( "clone" )); if ( sourceMaybeNull ) { - return JOp.cond( sourceExpr.eq( JExpr._null() ), JExpr._null(), sourceExpr.invoke( "clone" ) ); + return JOp.cond( sourceExpr.eq( JExpr._null() ), JExpr._null(), cloneExpr ); } else { - return sourceExpr.invoke( "clone" ); + return cloneExpr; } } diff --git a/pom.xml b/pom.xml index c5a0278..6afe9d2 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,12 @@ JAXB 2.0 Schema to Java compiler plugin for adding a copy constructor to schema derived classes. http://ccxjc.sourceforge.net 2009 + + UTF-8 + UTF-8 + 11 + 3.0.0 + The CC-XJC Community http://ccxjc.sourceforge.net @@ -89,16 +95,40 @@ scm:svn:https://ccxjc.svn.sourceforge.net/svnroot/ccxjc/trunk http://ccxjc.svn.sourceforge.net/viewvc/ccxjc/trunk + + + + org.glassfish.jaxb + jaxb-runtime + 4.0.0 + + + org.glassfish.jaxb + jaxb-xjc + 4.0.0 + + + jakarta.activation + jakarta.activation-api + 2.1.1 + + + commons-beanutils + commons-beanutils + 1.9.4 + + + org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + 3.10.1 - 1.5 - 1.5 + ${java.version} + ${java.version} true true true @@ -108,12 +138,12 @@ org.apache.maven.plugins maven-site-plugin - 3.0 + 3.12.0 org.apache.maven.plugins maven-resources-plugin - 2.5 + 3.3.0 ${*} @@ -125,7 +155,7 @@ org.apache.maven.plugins maven-release-plugin - 2.2.2 + 2.5.3 false true @@ -137,7 +167,7 @@ org.apache.maven.plugins maven-jar-plugin - 2.4 + 3.3.0 true @@ -153,7 +183,7 @@ org.apache.maven.plugins maven-surefire-plugin - ${surefire.version} + 3.0.0-M7 true @@ -343,9 +373,9 @@ - org.jvnet.jaxb2.maven2 - maven-jaxb21-plugin - 0.8.1 + com.evolvedbinary.maven.jvnet + jaxb30-maven-plugin + 0.15.0 @@ -527,7 +557,7 @@ org.apache.maven.wagon wagon-ssh - ${wagon.version} + 3.5.2 @@ -606,10 +636,4 @@ - - UTF-8 - UTF-8 - 2.12 - 2.2 - diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt index 09b827f..3bcb6f2 100644 --- a/src/site/apt/index.apt +++ b/src/site/apt/index.apt @@ -195,7 +195,7 @@ CC-XJC * java.net.URL - * javax.activation.MimeType + * jakarta.activation.MimeType * Support From fc6ec3e7729e78b01edd762e8ac3c83f88ccd328 Mon Sep 17 00:00:00 2001 From: Boris Wachtmeister Date: Sat, 14 Jan 2023 13:12:50 +0100 Subject: [PATCH 2/2] enable github actions --- .github/dependabot.yml | 12 ++++++++++++ .github/workflows/build.yml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ca32753 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "weekly" + day: "saturday" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "saturday" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6d36536 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: CI + +on: + push: + branches: + - main + - boris/* + tags: + - '*' + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: 11 + distribution: 'temurin' + cache: 'maven' + - name: Build with Maven + run: mvn -B package --file pom.xml + - name: Archive installer + uses: actions/upload-artifact@v3 + with: + name: cc-xjc-plugin.jar + path: ./cc-xjc-plugin/target/cc-xjc-plugin-*.jar