javaee / jaxb-v2

Other
211 stars 101 forks source link

XJC extension creates JDefinedClass for JVM-wide class #958

Open glassfishrobot opened 11 years ago

glassfishrobot 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]

glassfishrobot commented 11 years ago

Reported by dma_k

glassfishrobot commented 11 years ago

Was assigned to yaroska

glassfishrobot commented 7 years ago

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