eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
201 stars 110 forks source link

XJC extension creates JDefinedClass for JVM-wide class #958

Open Tomas-Kraus opened 11 years ago

Tomas-Kraus commented 11 years ago

When following customization is enabled:

<jaxb:globalBindings generateValueClass="false">
    <xjc:superInterface name="java.lang.Cloneable" />
</jaxb:globalBindings>

XJC generates JDefinedClass for super interface java.lang.Cloneable. However by contract JDefinedClass objects should be created for generated classes.

Expected: java.lang.Cloneable should be a JClass created by JCodeModel.ref(Class) or JDirectClass created by JCodeModel.directClass(String).

The confusion is generally caused by the use of JDefinedClass.hide(). This effect and should be better implemented by making a common class of JDefinedClass and JDirectClass. Then JDefinedClass is always generated class, while JDirectClass is always hidden.

The same should be applied to super class:

<jaxb:globalBindings>
    <xjc:superClass name="com.mycompany.CommonBean" />
</jaxb:globalBindings>

Problematic code: BIGlobalBinding.getSuperClass(), BIGlobalBinding.getSuperInterface().

Affected Versions

[2.2.4u1]

Tomas-Kraus commented 5 years ago
Tomas-Kraus commented 11 years ago

@glassfishrobot Commented Reported by dma_k

Tomas-Kraus commented 11 years ago

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-958