####### Schema #########
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
elementFormDefault="qualified"
targetNamespace="
http://test"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns="
http://test"
>
<xs:element name="root" type="rootType" />
<xs:complexType name="rootType">
<xs:sequence>
<xs:element name="items" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
######## Bindings File #############
<?xml version="1.0" encoding="UTF-8"?>
<bindings version="2.1"
xmlns="
http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="
http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
>
<bindings schemaLocation="test.xsd" node="/xs:schema">
<bindings node="//xs:complexType[@name='rootType']">
<bindings node="//xs:element[@name='items']">
<property>
<baseType>
<xjc:javaType adapter="ListAdapter"
name="java.util.List<String>" />
</baseType>
</property>
</bindings>
</bindings>
</bindings>
</bindings>
###### Output #####
import java.util.List<String>; <--- Problem
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
*
*
*
public class RootType {
@XmlElement(required = true, type = String.class)
@XmlJavaTypeAdapter(ListAdapter.class)
protected List<String>items;
*
*
*
So.. The problem is pretty obvious, when XJC adds the import for the
external type it doesn't remove the generic part. If I switch to
<xjc:javaType adapter="ListAdapter" name="java.util.List" />
it compiles, but has raw type warnings.
This is even a rather trivial example since String is imported by default.
What about java.util.List<java.util.Map<String, java.utli.Map<java.util.Set,
java.util.List<String>>>> or similar?
So... am I missing something? Its similar to
https://jaxb.dev.java.net/issues/show_bug.cgi?id=234 .. but not quite, this
is a bit more basic than that.
I am using the maven-jaxb2-plugin
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
Thank You,
-Josh