Skip to content

Generated classes invoke undefined constructor Object(String) #80

@mvglasow

Description

@mvglasow

After generating a set of Java classes from an XSD with Castor, I see some (not all) of them cause a compiler error for invoking a non-existent constructor

java.lang.Object(String)

The XSD was downloaded from https://datex2.eu/schema/2/2_0/DATEXIISchema_2_2_3.xsd and then converted with the command line

java -cp "*" org.exolab.castor.builder.SourceGeneratorMain -i DATEXIISchema_2_2_3.xsd -types j2

Content of castorbuilder.properties:

org.exolab.castor.builder.javaclassmapping=type
org.exolab.castor.builder.javaVersion=5.0
org.exolab.castor.builder.nspackages=\
   http://example.com/schema/foo=com.example.schema.foo
org.exolab.castor.builder.primitivetowrapper=true

This affects almost exclusively classes whose name begins with an underscore, where the offending code looks like this:

/**
 * Field targetClass.
 */
private java.lang.Object targetClass = new java.lang.Object("ContactDetails");

public _ContactDetailsVersionedReference() {
    super();
    setTargetClass(new java.lang.Object("ContactDetails"));
}

The root element, D2LogicalModelfor the XSD mentioned, is also affected, though here it is the modelBaseVersion property.

Tested on 1.4.1 as downloaded from Maven Central.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions