Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jaxb-dev] Issue with XmlAdapter class

Hi,

I am not 100% sure where to post this, so thought I would start here. We are upgrading to JAVA 11 and are using gradle with the com.sun.tools.jxc.SchemaGenTask to generate an .xsd file from the annotated JAVA classes.

The SchemaGenTask checks all classes in the path for public no-arg constructors. But it fails for our classes which extend XmlAdapter, since the XmlAdapter's constructor is marked as protected.

I do not understand the reason to mark an abstract class's default constructor as protected since the class can anyway not be instantiated without being extended.

See the XmlAdapter code below:

    public abstract class XmlAdapter<ValueType,BoundType> {
        // Do-nothing constructor for the derivedclasses.
        protected XmlAdapter() {}

        // Convert a value type to a bound type.
        public abstract BoundType unmarshal(ValueType v);

        // Convert a bound type to a value type.
        public abstract ValueType marshal(BoundType v);
    }

How do I generate .xsd from annotated JAVA classes?

Kind regards,

Joe Potgieter
Sortware Developer - BBD South Africa
+27 83 543-2153

Back to the top