diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..bed39eaac
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,3 @@
+language: java
+jdk:
+- oraclejdk8
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 5d5aad950..328ea677e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -23,3 +23,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are those
+of the authors and should not be interpreted as representing official policies,
+either expressed or implied, of the FreeBSD Project.
diff --git a/README.md b/README.md
index 7dc659da7..a2ec3c79a 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
# JAXB Maven Plugin #
Welcome to the `org.jvnet.jaxb:jaxb-maven-plugin`, the most advanced and feature-full Maven plugin for XML Schema compilation.
@@ -137,3 +138,275 @@ Parse Java annotations from text or XML resources.
assertEquals(String.class, xannotation.getFieldsMap().get("name").getType());
assertEquals("##default", xannotation.getFieldsMap().get("namespace").getResult());
```
+=======
+[](https://github.com/highsource/jaxb2-annotate-plugin)
+
+jaxb2-annotate-plugin
+=====================
+
+JAXB2 Annotate Plugin is capable of adding or removing arbitrary annotations to/from the generated sources.
+
+Usage overview
+--------------
+
+* Annotate your schema using binding files or directly in schema
+* Add the plugin to the XJC classpath.
+* Add your annotation classes to the XJC classpath.
+* Activate the plugin using `-Xannotate`-switch.
+
+Providing annotations
+---------------------
+
+You can annotate your schema-derived elements using normal Java annotation syntax.
+([Old XML syntax](http://confluence.highsource.org/display/J2B/Annotate+Plugin) is still supported but no longer recommended.)
+
+**Current limitations:**
+* Annotation classes must be known in compile time. I.e. annotation classes must be made available in the XJC classpath.
+If you want to use your own annotations, you have to pre-compile them and add your annotation classes to the XJC classpath.
+* As a consequence, currently you can't use schema-derived enums in your annotations. Since you have to compile annotations
+before compiling the schema - and as your enums are first generated from the schema, this is a chicken-and-egg-problem.
+* All class names (classes of annotations or classes you use as values in annotations) must be fully qualified.
+Inner classes should use the dot (`.`) as delimiter (not `$`).
+
+You can put your annotations directly in schema:
+
+````xml
+
+
+
+
+
+
+
+ @java.lang.SuppressWarnings({"unchecked","rawtypes"})
+ @javax.annotation.Generated({"XJC","JAXB2 Annotate Plugin"})
+
+
+
+
+
+
+
+ @java.lang.SuppressWarnings({"unchecked","rawtypes"})
+ @java.lang.Deprecated
+ @java.lang.Deprecated
+ @java.lang.Deprecated
+ @java.lang.Deprecated
+ @java.lang.Deprecated
+
+
+
+
+
+
+
+
+
+ @java.lang.Deprecated
+
+
+
+
+
+
+
+
+
+
+````
+
+Or in binding files:
+
+````xml
+
+
+
+
+
+ @javax.xml.bind.annotation.XmlRootElement(name="IssueJIIB39CType")
+
+
+ @javax.xml.bind.annotation.XmlAttribute(required=false, name="test")
+
+
+
+
+````
+
+You can use the following customization elements in the `http://annox.dev.java.net` namespace:
+* `annotate` with the optional `target` attribute
+ * `package`
+ * `class`
+ * `getter`
+ * `setter`
+ * `setter-parameter`
+ * `field`
+ * `enum-value-method`
+ * `enum-fromValue-method`
+* `annotateProperty`
+* `annotatePackage`
+* `annotateClass`
+* `annotateElement`
+* `annotateEnum`
+* `annotateEnumConstant`
+* `annotateEnumValueMethod` - annotate the `value()` method of the enum
+* `annotateEnumFromValueMethod` - annotate the `fromValue(String)` method of the enum
+
+The `http://annox.dev.java.net` namespace must be declared in the `jaxb:extensionBindingPrefixes` attribute via prefix, ex.:
+
+````
+xmlns:annox="http://annox.dev.java.net"
+jaxb:extensionBindingPrefixes="xjc annox"
+````
+
+Note: yes, I know that `http://annox.dev.java.net` no longer exists. Changing this namespace would break old builds.
+This is just a namespace, there must not necessarily be content there. Treat it as a logical identifier, nothing else.
+
+Removing annotations
+--------------
+
+* Customize your schema using binding files or directly in schema
+* Add the plugin to the XJC classpath.
+* Activate the plugin using `-XremoveAnnotation`-switch.
+
+You can remove annotations using customizations directly in schema:
+
+````xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+````
+
+Or in binding files:
+
+````xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+````
+
+You can use the following customization elements in the `http://annox.dev.java.net` namespace:
+* `removeAnnotation` with the optional `target` attribute:
+ * `package`
+ * `class`
+ * `getter`
+ * `setter`
+ * `setter-parameter`
+ * `field`
+ * `enum-value-method`
+ * `enum-fromValue-method`
+* `removeAnnotationFromProperty`
+* `removeAnnotationFromPackage`
+* `removeAnnotationFromClass`
+* `removeAnnotationFromElement`
+* `removeAnnotationFromeEnum`
+* `removeAnnotationFromEnumConstant`
+* `removeAnnotationFromEnumValueMethod` - removes annotation from the `value()` method of the enum
+* `removeAnnotationFromEnumFromValueMethod` - removes annotation from the `fromValue(String)` method of the enum
+
+The `http://annox.dev.java.net` namespace must be declared in the `jaxb:extensionBindingPrefixes` attribute via prefix, ex.:
+
+````
+xmlns:annox="http://annox.dev.java.net"
+jaxb:extensionBindingPrefixes="xjc annox"
+````
+
+Note: yes, I know that `http://annox.dev.java.net` no longer exists. Changing this namespace would break old builds.
+This is just a namespace, there must not necessarily be content there. Treat it as a logical identifier, nothing else.
+
+
+Using JAXB2 Annotate Plugin with Maven
+--------------------------------------
+
+* Add `org.jvnet.jaxb2_commons:jaxb2-basics-annotate` as XJC plugin
+* Turn on the plugin using `-Xannotate` or `-XremoveAnnotation`switch
+* Add artifact with your annotations as another XJC plugin
+
+Example:
+
+````xml
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+
+ true
+
+ -Xannotate
+ -XremoveAnnotation
+
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-annotate
+
+
+
+ com.acme.foo
+ my-custom-annotations
+
+
+
+
+````
+See [this example](https://github.com/highsource/jaxb2-annotate-plugin/tree/master/tests/annox).
+
+Note that annotations are first compiled in the `annotations` module and the added to the classpath of the `maven-jaxb2-plugin` in the `schema` module:
+
+Using JAXB2 Annotate Plugin with Ant
+------------------------------------
+See [this example](https://github.com/highsource/jaxb2-annotate-plugin/blob/master/samples/annotate/project-build.xml).
+>>>>>>> jaxb2-annotate-plugin/master
diff --git a/full-build-9.bat b/full-build-9.bat
deleted file mode 100644
index eff5ecd09..000000000
--- a/full-build-9.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-setlocal
-echo Setting JAVA_HOME to %JAVA9_HOME%.
-set JAVA_HOME=%JAVA9_HOME%
-call mvn clean install --fail-at-end -DperformRelease -Pall,sonatype-oss-release
-endlocal
diff --git a/jaxb-annotate-parent/plugin/.gitignore b/jaxb-annotate-parent/plugin/.gitignore
new file mode 100644
index 000000000..4874fbf33
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/.gitignore
@@ -0,0 +1,4 @@
+/target
+.classpath
+.project
+.settings
diff --git a/jaxb-annotate-parent/plugin/pom.xml b/jaxb-annotate-parent/plugin/pom.xml
new file mode 100644
index 000000000..74f869429
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/pom.xml
@@ -0,0 +1,72 @@
+
+
+ 4.0.0
+
+ org.jvnet.jaxb
+ jaxb-annotate-plugin-parent
+ 2.0.5-SNAPSHOT
+ ../pom.xml
+
+ jaxb-basics-annotate
+ jar
+ JAXB Tools :: Annotate :: Plugin
+
+
+ org.jvnet.jaxb
+ jaxb2-basics-tools
+ ${project.version}
+
+
+ org.apache.commons
+ commons-lang3
+
+
+ org.jvnet.jaxb
+ jaxb2-basics-runtime
+
+
+
+
+ org.glassfish.jaxb
+ jaxb-xjc
+ provided
+
+
+
+ org.jvnet.jaxb
+ jaxb-annox
+ ${project.version}
+
+
+
diff --git a/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/AnnotationTarget.java b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/AnnotationTarget.java
new file mode 100644
index 000000000..a84d8f9cc
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/AnnotationTarget.java
@@ -0,0 +1,363 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin;
+
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.lang3.Validate;
+import org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin;
+import org.jvnet.jaxb2_commons.plugin.removeannotation.RemoveAnnotationPlugin;
+import org.jvnet.jaxb2_commons.util.FieldAccessorUtils;
+import org.jvnet.jaxb2_commons.util.OutlineUtils;
+import org.w3c.dom.Element;
+
+import com.sun.codemodel.JAnnotatable;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JFieldVar;
+import com.sun.codemodel.JMethod;
+import com.sun.codemodel.JType;
+import com.sun.codemodel.JVar;
+import com.sun.tools.xjc.model.CEnumLeafInfo;
+import com.sun.tools.xjc.outline.ClassOutline;
+import com.sun.tools.xjc.outline.ElementOutline;
+import com.sun.tools.xjc.outline.EnumConstantOutline;
+import com.sun.tools.xjc.outline.EnumOutline;
+import com.sun.tools.xjc.outline.FieldOutline;
+import com.sun.tools.xjc.outline.Outline;
+
+public enum AnnotationTarget {
+
+ //
+ PACKAGE("package", AnnotatePlugin.ANNOTATE_PACKAGE_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ FieldOutline fieldOutline) {
+ return fieldOutline.parent().ref._package();
+ }
+
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ ClassOutline classOutline) throws IllegalArgumentException,
+ UnsupportedOperationException {
+ return classOutline.ref._package();
+ }
+
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ ElementOutline elementOutline) throws IllegalArgumentException,
+ UnsupportedOperationException {
+ return elementOutline.implClass._package();
+ }
+
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ EnumConstantOutline enumConstantOutline)
+ throws IllegalArgumentException, UnsupportedOperationException {
+ final CEnumLeafInfo enclosingClass = enumConstantOutline.target
+ .getEnclosingClass();
+ return getAnnotatable(outline, outline.getEnum(enclosingClass));
+ }
+
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ EnumOutline enumOutline) throws IllegalArgumentException,
+ UnsupportedOperationException {
+ return enumOutline.clazz._package();
+ }
+ },
+ //
+ CLASS("class", AnnotatePlugin.ANNOTATE_CLASS_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ FieldOutline fieldOutline) {
+ return fieldOutline.parent().ref;
+ }
+
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ ClassOutline classOutline) throws IllegalArgumentException,
+ UnsupportedOperationException {
+ return classOutline.ref;
+ }
+
+ },
+ //
+ PROPERTY_GETTER("getter", AnnotatePlugin.ANNOTATE_PROPERTY_GETTER_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ FieldOutline fieldOutline) {
+ final JMethod _getter = FieldAccessorUtils.getter(fieldOutline);
+ if (_getter == null) {
+ throw new IllegalArgumentException(
+ MessageFormat
+ .format("Could not annotate the getter of the field outline [{0}], getter method could not be found.",
+ OutlineUtils.getFieldName(fieldOutline)));
+ }
+ return _getter;
+ }
+ },
+ //
+ PROPERTY_SETTER("setter", AnnotatePlugin.ANNOTATE_PROPERTY_SETTER_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ FieldOutline fieldOutline) {
+ final JMethod _setter = FieldAccessorUtils.setter(fieldOutline);
+ if (_setter == null) {
+ throw new IllegalArgumentException(
+ MessageFormat
+ .format("Could not annotate the setter of the field outline [{0}], setter method could not be found.",
+
+ OutlineUtils.getFieldName(fieldOutline)));
+ }
+ return _setter;
+ }
+ },
+ //
+ PROPERTY_FIELD("field", AnnotatePlugin.ANNOTATE_PROPERTY_FIELD_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ FieldOutline fieldOutline) {
+
+ // Ok
+ final JFieldVar _field = FieldAccessorUtils.field(fieldOutline);
+ if (_field == null) {
+ throw new IllegalArgumentException(
+ MessageFormat
+ .format("Could not annotate the field of the field outline [{0}] since it could not be found.",
+
+ OutlineUtils.getFieldName(fieldOutline)));
+ }
+ return _field;
+ }
+ },
+ //
+ PROPERTY_SETTER_PARAMETER("setter-parameter",
+ AnnotatePlugin.ANNOTATE_PROPERTY_SETTER_PARAMETER_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ FieldOutline fieldOutline) {
+ final JMethod _setter = FieldAccessorUtils.setter(fieldOutline);
+
+ if (_setter == null) {
+ throw new IllegalArgumentException(
+ MessageFormat
+ .format("Could not annotate the setter parameter of the field outline [{0}], setter method could not be found.",
+
+ OutlineUtils.getFieldName(fieldOutline)));
+ } else {
+ final JVar[] params = _setter.listParams();
+ if (params.length != 1) {
+ throw new IllegalArgumentException(
+ MessageFormat
+ .format("Could not annotate the setter parameter of the field outline [{0}], setter method must have a single parameter(this setter has {1}).",
+
+ OutlineUtils.getFieldName(fieldOutline),
+ params.length));
+ } else {
+ return params[0];
+ }
+ }
+ }
+ },
+ //
+ ENUM("enum", AnnotatePlugin.ANNOTATE_ENUM_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ EnumConstantOutline enumConstantOutline)
+ throws IllegalArgumentException, UnsupportedOperationException {
+ final CEnumLeafInfo enclosingClass = enumConstantOutline.target
+ .getEnclosingClass();
+ return getAnnotatable(outline, outline.getEnum(enclosingClass));
+ }
+
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ EnumOutline enumOutline) throws IllegalArgumentException,
+ UnsupportedOperationException {
+ return enumOutline.clazz;
+ }
+ },
+ //
+ ENUM_CONSTANT("enum-constant", AnnotatePlugin.ANNOTATE_ENUM_CONSTANT_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ EnumConstantOutline enumConstantOutline)
+ throws IllegalArgumentException, UnsupportedOperationException {
+ return enumConstantOutline.constRef;
+ }
+ },
+ //
+ ENUM_VALUE_METHOD("enum-value-method", AnnotatePlugin.ANNOTATE_ENUM_VALUE_METHOD_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ EnumOutline enumOutline)
+ throws IllegalArgumentException, UnsupportedOperationException {
+ final JMethod valueMethod = enumOutline.clazz.getMethod("value", new JType[0]);
+ if (null == valueMethod) {
+ throw new IllegalArgumentException(
+ MessageFormat
+ .format("Could not annotate the value() method of the enum [{0}] since it could not be found.",
+ enumOutline.clazz.name()));
+ }
+ return valueMethod;
+ }
+ },
+ //
+ ENUM_FROM_VALUE_METHOD("enum-fromValue-method", AnnotatePlugin.ANNOTATE_ENUM_FROM_VALUE_METHOD_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ EnumOutline enumOutline)
+ throws IllegalArgumentException, UnsupportedOperationException {
+ final JCodeModel codeModel = enumOutline.clazz.owner();
+ final JType jTypeString = codeModel._ref(String.class);
+ final JMethod fromValueMethod = enumOutline.clazz.getMethod("fromValue", new JType[]{jTypeString});
+ if (null == fromValueMethod) {
+ throw new IllegalArgumentException(
+ MessageFormat
+ .format("Could not annotate the fromValue(String) method of the enum [{0}] since it could not be found.",
+ enumOutline.clazz.name()));
+
+ }
+ return fromValueMethod;
+ }
+ },
+ //
+ ELEMENT("element", AnnotatePlugin.ANNOTATE_ELEMENT_QNAME) {
+ @Override
+ public JAnnotatable getAnnotatable(Outline outline,
+ ElementOutline elementOutline) throws IllegalArgumentException,
+ UnsupportedOperationException {
+ return elementOutline.implClass;
+ }
+ };
+
+ private final String target;
+ private final Set names;
+
+ AnnotationTarget(String target, QName... names) {
+ this.target = target;
+ this.names = Collections.unmodifiableSet(new HashSet(Arrays.asList(names)));
+ }
+
+ public Set getNames() {
+ return names;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ public JAnnotatable getAnnotatable(Outline outline, EnumOutline enumOutline)
+ throws IllegalArgumentException, UnsupportedOperationException {
+ throw new UnsupportedOperationException(MessageFormat.format(
+ "Annotation target [{0}] cannot be applied to an enum.",
+ getTarget()));
+ }
+
+ public JAnnotatable getAnnotatable(Outline outline,
+ EnumConstantOutline enumConstantOutline)
+ throws IllegalArgumentException, UnsupportedOperationException {
+ throw new UnsupportedOperationException(
+ MessageFormat
+ .format("Annotation target [{0}] cannot be applied to an enum constant.",
+ getTarget()));
+ }
+
+ public JAnnotatable getAnnotatable(Outline outline,
+ ClassOutline classOutline) throws IllegalArgumentException,
+ UnsupportedOperationException {
+ throw new UnsupportedOperationException(MessageFormat.format(
+ "Annotation target [{0}] cannot be applied to a class.",
+ getTarget()));
+ }
+
+ public JAnnotatable getAnnotatable(Outline outline,
+ FieldOutline fieldOutline) throws IllegalArgumentException,
+ UnsupportedOperationException {
+ throw new UnsupportedOperationException(MessageFormat.format(
+ "Annotation target [{0}] cannot be applied to a field.",
+ getTarget()));
+ }
+
+ public JAnnotatable getAnnotatable(Outline outline,
+ ElementOutline elementOutline) throws IllegalArgumentException,
+ UnsupportedOperationException {
+ throw new UnsupportedOperationException(MessageFormat.format(
+ "Annotation target [{0}] cannot be applied to an element.",
+ getTarget()));
+ }
+
+ public static AnnotationTarget getAnnotationTarget(final Element element,
+ AnnotationTarget defaultAnnotationTarget) {
+ Validate.notNull(element);
+ Validate.notNull(defaultAnnotationTarget);
+
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+
+ if (AnnotatePlugin.ANNOTATE_QNAME.equals(name)
+ || AnnotatePlugin.ANNOTATE_PROPERTY_QNAME.equals(name)
+ || RemoveAnnotationPlugin.REMOVE_ANNOTATION_QNAME.equals(name)
+ || RemoveAnnotationPlugin.REMOVE_ANNOTATION_FROM_PROPERTY_QNAME.equals(name)) {
+ final String target = element.getAttribute("target");
+ if (target == null || "".equals(target)) {
+ return defaultAnnotationTarget;
+ } else {
+ return AnnotationTarget.getAnnotationTarget(target);
+ }
+ } else {
+ for (AnnotationTarget possibleAnnotationTarget : AnnotationTarget
+ .values()) {
+ if (possibleAnnotationTarget.names.contains(name)) {
+ return possibleAnnotationTarget;
+ }
+ }
+ throw new IllegalArgumentException(MessageFormat.format(
+ "Unknown annotation element name [{0}].", name));
+ }
+
+ }
+
+ public static AnnotationTarget getAnnotationTarget(final String target) {
+ for (AnnotationTarget possibleAnnotationTarget : AnnotationTarget
+ .values()) {
+ if (possibleAnnotationTarget.getTarget().equals(target)) {
+ return possibleAnnotationTarget;
+ }
+ }
+ throw new IllegalArgumentException(MessageFormat.format(
+ "Unknown annotation target [{0}].", target));
+ }
+}
diff --git a/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java
new file mode 100644
index 000000000..7509be4fc
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatePlugin.java
@@ -0,0 +1,427 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.lang3.StringUtils;
+import org.jvnet.annox.Constants;
+import org.jvnet.annox.model.XAnnotation;
+import org.jvnet.annox.parser.XAnnotationParser;
+import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin;
+import org.jvnet.jaxb2_commons.plugin.AnnotationTarget;
+import org.jvnet.jaxb2_commons.plugin.removeannotation.RemoveAnnotationPlugin;
+import org.jvnet.jaxb2_commons.util.CustomizationUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import com.sun.codemodel.JAnnotatable;
+import com.sun.codemodel.JCodeModel;
+import com.sun.tools.xjc.Options;
+import com.sun.tools.xjc.model.CCustomizations;
+import com.sun.tools.xjc.model.CElementInfo;
+import com.sun.tools.xjc.model.CPluginCustomization;
+import com.sun.tools.xjc.outline.ClassOutline;
+import com.sun.tools.xjc.outline.ElementOutline;
+import com.sun.tools.xjc.outline.EnumConstantOutline;
+import com.sun.tools.xjc.outline.EnumOutline;
+import com.sun.tools.xjc.outline.FieldOutline;
+import com.sun.tools.xjc.outline.Outline;
+
+public class AnnotatePlugin extends AbstractParameterizablePlugin {
+
+ public static final QName ANNOTATE_PROPERTY_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotateProperty");
+ public static final QName ANNOTATE_PROPERTY_GETTER_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotatePropertyGetter");
+ public static final QName ANNOTATE_PROPERTY_SETTER_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotatePropertySetter");
+ public static final QName ANNOTATE_PROPERTY_FIELD_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotatePropertyField");
+ public static final QName ANNOTATE_PROPERTY_SETTER_PARAMETER_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotatePropertySetterParameter");
+ public static final QName ANNOTATE_PACKAGE_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotatePackage");
+ public static final QName ANNOTATE_CLASS_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotateClass");
+ public static final QName ANNOTATE_ELEMENT_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotateElement");
+ public static final QName ANNOTATE_ENUM_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotateEnum");
+ public static final QName ANNOTATE_ENUM_CONSTANT_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotateEnumConstant");
+ public static final QName ANNOTATE_ENUM_VALUE_METHOD_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotateEnumValueMethod");
+ public static final QName ANNOTATE_ENUM_FROM_VALUE_METHOD_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotateEnumFromValueMethod");
+ public static final QName ANNOTATE_QNAME = new QName(
+ Constants.NAMESPACE_URI, "annotate");
+
+ public static final Set CUSTOMIZATION_ELEMENT_QNAMES = Collections.unmodifiableSet(
+ new HashSet(Arrays.asList(
+ ANNOTATE_QNAME,
+ ANNOTATE_PACKAGE_QNAME,
+ ANNOTATE_CLASS_QNAME,
+ ANNOTATE_ELEMENT_QNAME,
+ ANNOTATE_PROPERTY_QNAME,
+ ANNOTATE_PROPERTY_FIELD_QNAME,
+ ANNOTATE_PROPERTY_GETTER_QNAME,
+ ANNOTATE_PROPERTY_SETTER_QNAME,
+ ANNOTATE_PROPERTY_SETTER_PARAMETER_QNAME,
+ ANNOTATE_ENUM_QNAME,
+ ANNOTATE_ENUM_CONSTANT_QNAME,
+ ANNOTATE_ENUM_VALUE_METHOD_QNAME,
+ ANNOTATE_ENUM_FROM_VALUE_METHOD_QNAME)));
+
+
+ @Override
+ public String getOptionName() {
+ return "Xannotate";
+ }
+
+ @Override
+ public String getUsage() {
+ return "TBD";
+ }
+
+ private String defaultFieldTarget = "getter";
+
+ public String getDefaultFieldTarget() {
+ return defaultFieldTarget;
+ }
+
+ public void setDefaultFieldTarget(String defaultFieldTarget) {
+ if ("getter".equals(defaultFieldTarget)
+ || "setter".equals(defaultFieldTarget)
+ || "setter-parameter".equals(defaultFieldTarget)
+ || "field".equals(defaultFieldTarget)) {
+ this.defaultFieldTarget = defaultFieldTarget;
+ } else {
+ throw new IllegalArgumentException("Invalid default field target.");
+ }
+ }
+
+ private XAnnotationParser annotationParser = XAnnotationParser.INSTANCE;
+
+ public XAnnotationParser getAnnotationParser() {
+ return annotationParser;
+ }
+
+ public void setAnnotationParser(XAnnotationParser annotationParser) {
+ this.annotationParser = annotationParser;
+ }
+
+ private Annotator annotator = new Annotator();
+
+ public Annotator getAnnotator() {
+ return annotator;
+ }
+
+ public void setAnnotator(Annotator annotator) {
+ this.annotator = annotator;
+ }
+
+ @Override
+ public boolean run(Outline outline, Options options,
+ ErrorHandler errorHandler) {
+
+ for (final CElementInfo elementInfo : outline.getModel()
+ .getAllElements()) {
+ final ElementOutline elementOutline = outline
+ .getElement(elementInfo);
+ if (elementOutline != null) {
+ processElementOutline(elementOutline, options, errorHandler);
+ }
+ }
+
+ for (final ClassOutline classOutline : outline.getClasses()) {
+ processClassOutline(classOutline, options, errorHandler);
+ }
+ for (final EnumOutline enumOutline : outline.getEnums()) {
+ processEnumOutline(enumOutline, options, errorHandler);
+ }
+ return true;
+ }
+
+ protected void processElementOutline(ElementOutline elementOutline,
+ Options options, ErrorHandler errorHandler) {
+
+ final CCustomizations customizations = CustomizationUtils
+ .getCustomizations(elementOutline);
+
+ annotateElementOutline(elementOutline.implClass.owner(),
+ elementOutline, customizations, errorHandler);
+ }
+
+ protected void processEnumOutline(EnumOutline enumOutline, Options options,
+ ErrorHandler errorHandler) {
+ final CCustomizations customizations = CustomizationUtils
+ .getCustomizations(enumOutline);
+ annotateEnumOutline(enumOutline.clazz.owner(), enumOutline,
+ customizations, errorHandler);
+
+ for (final EnumConstantOutline enumConstantOutline : enumOutline.constants) {
+ processEnumConstantOutline(enumOutline, enumConstantOutline,
+ options, errorHandler);
+ }
+
+ }
+
+ protected void processClassOutline(ClassOutline classOutline,
+ Options options, ErrorHandler errorHandler) {
+
+ final CCustomizations customizations = CustomizationUtils
+ .getCustomizations(classOutline);
+
+ annotateClassOutline(classOutline.ref.owner(), classOutline,
+ customizations, errorHandler);
+
+ for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
+ processFieldOutline(classOutline, fieldOutline, options,
+ errorHandler);
+ }
+
+ }
+
+ protected void processFieldOutline(ClassOutline classOutline,
+ FieldOutline fieldOutline, Options options,
+ ErrorHandler errorHandler) {
+ final CCustomizations customizations = CustomizationUtils
+ .getCustomizations(fieldOutline);
+ annotateFieldOutline(fieldOutline.parent().ref.owner(), fieldOutline,
+ customizations, errorHandler);
+ }
+
+ protected void processEnumConstantOutline(EnumOutline enumOutline,
+ EnumConstantOutline enumConstantOutline, Options options,
+ ErrorHandler errorHandler) {
+
+ final CCustomizations customizations = CustomizationUtils
+ .getCustomizations(enumConstantOutline);
+
+ annotateEnumConstantOutline(enumOutline.parent().getCodeModel(),
+ enumOutline.parent(), enumConstantOutline, customizations,
+ errorHandler);
+ }
+
+ protected void annotateElementOutline(final JCodeModel codeModel,
+ final ElementOutline elementOutline,
+ final CCustomizations customizations,
+ final ErrorHandler errorHandler) {
+ for (final CPluginCustomization customization : customizations) {
+ final Element element = customization.element;
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+ if (isCustomizationElementName(name)) {
+ customization.markAsAcknowledged();
+ final AnnotationTarget annotationTarget = AnnotationTarget
+ .getAnnotationTarget(element, AnnotationTarget.ELEMENT);
+ try {
+ final JAnnotatable annotatable = annotationTarget
+ .getAnnotatable(elementOutline.parent(),
+ elementOutline);
+ annotate(codeModel, errorHandler, customization, element,
+ annotatable);
+ } catch (IllegalArgumentException iaex) {
+ logger.error("Error applying the annotation.", iaex);
+ }
+ }
+ }
+ }
+
+ protected void annotateEnumOutline(final JCodeModel codeModel,
+ final EnumOutline enumOutline,
+ final CCustomizations customizations,
+ final ErrorHandler errorHandler) {
+ for (final CPluginCustomization customization : customizations) {
+ final Element element = customization.element;
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+ if (isCustomizationElementName(name)) {
+ customization.markAsAcknowledged();
+ final AnnotationTarget annotationTarget = AnnotationTarget
+ .getAnnotationTarget(element, AnnotationTarget.ENUM);
+ try {
+ final JAnnotatable annotatable = annotationTarget
+ .getAnnotatable(enumOutline.parent(), enumOutline);
+ annotate(codeModel, errorHandler, customization, element,
+ annotatable);
+ } catch (IllegalArgumentException iaex) {
+ logger.error("Error applying the annotation.", iaex);
+ }
+ }
+ }
+ }
+
+ protected void annotateEnumConstantOutline(final JCodeModel codeModel,
+ final Outline outline,
+ final EnumConstantOutline enumConstantOutline,
+ final CCustomizations customizations,
+ final ErrorHandler errorHandler) {
+ for (final CPluginCustomization customization : customizations) {
+ final Element element = customization.element;
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+ if (isCustomizationElementName(name)) {
+ customization.markAsAcknowledged();
+ final AnnotationTarget annotationTarget = AnnotationTarget
+ .getAnnotationTarget(element,
+ AnnotationTarget.ENUM_CONSTANT);
+ try {
+ final JAnnotatable annotatable = annotationTarget
+ .getAnnotatable(outline, enumConstantOutline);
+ annotate(codeModel, errorHandler, customization, element,
+ annotatable);
+ } catch (IllegalArgumentException iaex) {
+ logger.error("Error applying the annotation.", iaex);
+ }
+
+ }
+ }
+ }
+
+ protected void annotateClassOutline(final JCodeModel codeModel,
+ final ClassOutline classOutline,
+ final CCustomizations customizations, ErrorHandler errorHandler) {
+ for (final CPluginCustomization customization : customizations) {
+ final Element element = customization.element;
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+ if (isCustomizationElementName(name)) {
+ customization.markAsAcknowledged();
+ final AnnotationTarget annotationTarget = AnnotationTarget
+ .getAnnotationTarget(element, AnnotationTarget.CLASS);
+ try {
+ final JAnnotatable annotatable = annotationTarget
+ .getAnnotatable(classOutline.parent(), classOutline);
+ annotate(codeModel, errorHandler, customization, element,
+ annotatable);
+ } catch (IllegalArgumentException iaex) {
+ logger.error("Error applying the annotation.", iaex);
+ }
+ }
+ }
+ }
+
+ protected void annotateFieldOutline(final JCodeModel codeModel,
+ final FieldOutline fieldOutline,
+ final CCustomizations customizations, ErrorHandler errorHandler) {
+ for (final CPluginCustomization customization : customizations) {
+ final Element element = customization.element;
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+ if (isCustomizationElementName(name)) {
+ customization.markAsAcknowledged();
+
+ final AnnotationTarget annotationTarget = AnnotationTarget
+ .getAnnotationTarget(element, AnnotationTarget
+ .getAnnotationTarget(getDefaultFieldTarget()));
+
+ try {
+ final JAnnotatable annotatable = annotationTarget
+ .getAnnotatable(fieldOutline.parent().parent(),
+ fieldOutline);
+ annotate(codeModel, errorHandler, customization, element,
+ annotatable);
+ } catch (IllegalArgumentException iaex) {
+ logger.error("Error applying the annotation.", iaex);
+ }
+
+ }
+ }
+ }
+
+ private void annotate(final JCodeModel codeModel,
+ ErrorHandler errorHandler,
+ final CPluginCustomization customization, final Element element,
+ final JAnnotatable annotatable) {
+ final NodeList elements = element.getChildNodes();
+ for (int index = 0; index < elements.getLength(); index++) {
+ final Node node = elements.item(index);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ final Element child = (Element) node;
+
+ try {
+ final XAnnotation> annotation = getAnnotationParser()
+ .parse(child);
+ getAnnotator().annotate(codeModel, annotatable, annotation);
+ } catch (Exception ex) {
+ try {
+ errorHandler.error(new SAXParseException(
+ "Error parsing annotation.",
+ customization.locator, ex));
+ } catch (SAXException ignored) {
+ // Nothing to do
+ }
+ }
+ } else if (node.getNodeType() == Node.TEXT_NODE) {
+ final String nodeValue = node.getNodeValue();
+ if (nodeValue != null && StringUtils.isNotBlank(nodeValue)) {
+ try {
+ final XAnnotation> annotation = getAnnotationParser()
+ .parse(nodeValue);
+ getAnnotator().annotate(codeModel, annotatable,
+ annotation);
+
+ } catch (Exception ex) {
+ try {
+ errorHandler.error(new SAXParseException(
+ "Error parsing annotation.",
+ customization.locator, ex));
+ } catch (SAXException ignored) {
+ // Nothing to do
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private boolean isCustomizationElementName(final QName name) {
+ return name != null &&
+ Constants.NAMESPACE_URI.equals(name.getNamespaceURI()) &&
+ !RemoveAnnotationPlugin.CUSTOMIZATION_ELEMENT_QNAMES.contains(name);
+ }
+
+ @Override
+ public Collection getCustomizationElementNames() {
+ return CUSTOMIZATION_ELEMENT_QNAMES;
+ }
+
+}
diff --git a/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatingArrayValueVisitor.java b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatingArrayValueVisitor.java
new file mode 100644
index 000000000..859e65109
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatingArrayValueVisitor.java
@@ -0,0 +1,176 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate;
+
+import org.jvnet.annox.model.XAnnotation;
+import org.jvnet.annox.model.annotation.field.XAnnotationField;
+import org.jvnet.annox.model.annotation.value.XAnnotationValueVisitor;
+import org.jvnet.annox.model.annotation.value.XArrayClassAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XBooleanAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XByteAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XCharAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XClassAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XClassByNameAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XDoubleAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XEnumAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XEnumByNameAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XFloatAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XIntAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XLongAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XShortAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XStringAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XXAnnotationAnnotationValue;
+import org.jvnet.jaxb2_commons.util.CodeModelUtils;
+
+import com.sun.codemodel.JAnnotationArrayMember;
+import com.sun.codemodel.JAnnotationUse;
+import com.sun.codemodel.JClass;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JExpressionImpl;
+import com.sun.codemodel.JFormatter;
+import com.sun.codemodel.JType;
+
+public class AnnotatingArrayValueVisitor implements
+ XAnnotationValueVisitor {
+
+ private final JCodeModel codeModel;
+ private final JAnnotationArrayMember annotationArrayMember;
+
+ public AnnotatingArrayValueVisitor(JCodeModel codeModel,
+ JAnnotationArrayMember annotationArrayMember) {
+ this.codeModel = codeModel;
+ this.annotationArrayMember = annotationArrayMember;
+ }
+
+// public JAnnotationArrayMember visit(XAnnotationAnnotationValue> value) {
+//
+// final XAnnotation> xannotation = value.getXAnnotation();
+// final JAnnotationUse annotationUse = annotationArrayMember
+// .annotate(xannotation.getAnnotationClass());
+//
+// for (final XAnnotationField> field : xannotation.getFieldsList()) {
+// field.accept(new AnnotatingVisitor(this.codeModel, annotationUse));
+// }
+//
+// return this.annotationArrayMember;
+// }
+
+ public JAnnotationArrayMember visit(XXAnnotationAnnotationValue> value) {
+ final XAnnotation> xannotation = value.getXAnnotation();
+ // TODO illegal call to getAnnotationClass(), use
+ // getAnnotationClassName();
+ final JAnnotationUse annotationUse = annotationArrayMember
+ .annotate(xannotation.getAnnotationClass());
+
+ for (final XAnnotationField> field : xannotation.getFieldsList()) {
+ field.accept(new AnnotatingVisitor(this.codeModel, annotationUse));
+ }
+
+ return this.annotationArrayMember;
+ }
+
+ public JAnnotationArrayMember visit(XBooleanAnnotationValue value) {
+ return annotationArrayMember.param(value.getValue());
+ }
+
+ public JAnnotationArrayMember visit(XByteAnnotationValue value) {
+ return annotationArrayMember.param(value.getValue());
+ }
+
+ public JAnnotationArrayMember visit(XCharAnnotationValue value) {
+ return annotationArrayMember.param(value.getValue());
+ }
+
+ public JAnnotationArrayMember visit(XDoubleAnnotationValue value) {
+ return annotationArrayMember.param(value.getValue());
+ }
+
+ public JAnnotationArrayMember visit(XFloatAnnotationValue value) {
+ return annotationArrayMember.param(value.getValue());
+ }
+
+ public JAnnotationArrayMember visit(XIntAnnotationValue value) {
+ return annotationArrayMember.param(value.getValue());
+ }
+
+ public JAnnotationArrayMember visit(XLongAnnotationValue value) {
+ return annotationArrayMember.param(value.getValue());
+ }
+
+ public JAnnotationArrayMember visit(XShortAnnotationValue value) {
+ return annotationArrayMember.param(value.getValue());
+ }
+
+ public JAnnotationArrayMember visit(XStringAnnotationValue value) {
+ return annotationArrayMember.param(value.getValue());
+ }
+
+ public JAnnotationArrayMember visit(XEnumAnnotationValue> value) {
+ final Enum> e = value.getValue();
+ return annotationArrayMember.param(e);
+ }
+
+ public JAnnotationArrayMember visit(XEnumByNameAnnotationValue> value) {
+ final JClass type = (JClass) CodeModelUtils.ref(this.codeModel,
+ value.getEnumClassName());
+ return annotationArrayMember.param(type.staticRef(value.getName()));
+ }
+
+ public JAnnotationArrayMember visit(XClassAnnotationValue> value) {
+ final JType type = this.codeModel._ref(value.getValue());
+ return param(type);
+ }
+
+ public JAnnotationArrayMember visit(XClassByNameAnnotationValue> value) {
+ final JType ref = CodeModelUtils.ref(codeModel, value.getClassName());
+ return param(ref);
+ }
+
+ public JAnnotationArrayMember visit(XArrayClassAnnotationValue, ?> value) {
+ JType type = CodeModelUtils.ref(this.codeModel,
+ value.getItemClassName());
+ for (int index = 0; index < value.getDimension(); index++) {
+ type = type.array();
+ }
+ return param(type);
+ }
+
+ private JAnnotationArrayMember param(final JType type) {
+ if (type instanceof JClass) {
+ return annotationArrayMember.param((JClass) type);
+ } else {
+ return annotationArrayMember.param(new JExpressionImpl() {
+ public void generate(JFormatter f) {
+ f.g(type).p(".class");
+ }
+ });
+ }
+ }
+
+}
diff --git a/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatingSingleValueVisitor.java b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatingSingleValueVisitor.java
new file mode 100644
index 000000000..bd5a255f3
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatingSingleValueVisitor.java
@@ -0,0 +1,175 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate;
+
+import org.jvnet.annox.model.XAnnotation;
+import org.jvnet.annox.model.annotation.field.XAnnotationField;
+import org.jvnet.annox.model.annotation.value.XAnnotationValueVisitor;
+import org.jvnet.annox.model.annotation.value.XArrayClassAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XBooleanAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XByteAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XCharAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XClassAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XClassByNameAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XDoubleAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XEnumAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XEnumByNameAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XFloatAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XIntAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XLongAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XShortAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XStringAnnotationValue;
+import org.jvnet.annox.model.annotation.value.XXAnnotationAnnotationValue;
+import org.jvnet.jaxb2_commons.util.CodeModelUtils;
+
+import com.sun.codemodel.JAnnotationUse;
+import com.sun.codemodel.JClass;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JExpressionImpl;
+import com.sun.codemodel.JFormatter;
+import com.sun.codemodel.JType;
+
+public class AnnotatingSingleValueVisitor implements
+ XAnnotationValueVisitor {
+
+ private final JCodeModel codeModel;
+ private final String name;
+ private final JAnnotationUse annotationUse;
+
+ public AnnotatingSingleValueVisitor(JCodeModel codeModel, String name,
+ JAnnotationUse annotationUse) {
+ this.codeModel = codeModel;
+ this.name = name;
+ this.annotationUse = annotationUse;
+ }
+
+// public JAnnotationUse visit(XAnnotationAnnotationValue> value) {
+// final XAnnotation> xannotation = value.getXAnnotation();
+//
+// final JAnnotationUse annotationUse = this.annotationUse
+// .annotationParam(this.name, xannotation.getAnnotationClass());
+//
+// for (final XAnnotationField> field : xannotation.getFieldsList()) {
+// field.accept(new AnnotatingVisitor(this.codeModel, annotationUse));
+// }
+// return annotationUse;
+// }
+
+ public JAnnotationUse visit(XXAnnotationAnnotationValue> value) {
+ final XAnnotation> xannotation = value.getXAnnotation();
+
+ // TODO The call to getAnnotationClass is illegal here
+ final JAnnotationUse annotationUse = this.annotationUse
+ .annotationParam(this.name, xannotation.getAnnotationClass());
+
+ for (final XAnnotationField> field : xannotation.getFieldsList()) {
+ field.accept(new AnnotatingVisitor(this.codeModel, annotationUse));
+ }
+ return annotationUse;
+ }
+
+ public JAnnotationUse visit(XBooleanAnnotationValue value) {
+ return annotationUse.param(this.name, value.getValue());
+ }
+
+ public JAnnotationUse visit(XByteAnnotationValue value) {
+ return annotationUse.param(this.name, value.getValue());
+ }
+
+ public JAnnotationUse visit(XCharAnnotationValue value) {
+ return annotationUse.param(this.name, value.getValue());
+ }
+
+ public JAnnotationUse visit(XDoubleAnnotationValue value) {
+ return annotationUse.param(this.name, value.getValue());
+ }
+
+ public JAnnotationUse visit(XFloatAnnotationValue value) {
+ return annotationUse.param(this.name, value.getValue());
+ }
+
+ public JAnnotationUse visit(XIntAnnotationValue value) {
+ return annotationUse.param(this.name, value.getValue());
+ }
+
+ public JAnnotationUse visit(XLongAnnotationValue value) {
+ return annotationUse.param(this.name, value.getValue());
+ }
+
+ public JAnnotationUse visit(XShortAnnotationValue value) {
+ return annotationUse.param(this.name, value.getValue());
+ }
+
+ public JAnnotationUse visit(XStringAnnotationValue value) {
+ return annotationUse.param(this.name, value.getValue());
+ }
+
+ public JAnnotationUse visit(XEnumAnnotationValue> value) {
+ final Enum> e = value.getValue();
+ return annotationUse.param(this.name, e);
+ }
+
+ public JAnnotationUse visit(XEnumByNameAnnotationValue> value) {
+ final JClass type = (JClass) CodeModelUtils.ref(this.codeModel,
+ value.getEnumClassName());
+ return annotationUse.param(this.name, type.staticRef(value.getName()));
+ }
+
+ public JAnnotationUse visit(XClassAnnotationValue> value) {
+ final JType type = this.codeModel._ref(value.getValue());
+ return param(type);
+ }
+
+ public JAnnotationUse visit(XClassByNameAnnotationValue> value) {
+ JType type = CodeModelUtils.ref(this.codeModel, value.getClassName());
+ return param(type);
+ }
+
+ public JAnnotationUse visit(XArrayClassAnnotationValue, ?> value) {
+ JType type = CodeModelUtils.ref(this.codeModel,
+ value.getItemClassName());
+ for (int index = 0; index < value.getDimension(); index++) {
+ type = type.array();
+ }
+ return param(type);
+ }
+
+ private JAnnotationUse param(final JType type) {
+ if (type instanceof JClass) {
+ return annotationUse.param(this.name, (JClass) type);
+ } else {
+ return annotationUse.param(this.name, new JExpressionImpl() {
+ public void generate(JFormatter f) {
+ f.g(type).p(".class");
+ }
+ });
+ }
+ }
+
+}
diff --git a/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatingVisitor.java b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatingVisitor.java
new file mode 100644
index 000000000..5b44155a9
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/AnnotatingVisitor.java
@@ -0,0 +1,74 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate;
+
+import org.jvnet.annox.model.XAnnotationFieldVisitor;
+import org.jvnet.annox.model.annotation.field.XArrayAnnotationField;
+import org.jvnet.annox.model.annotation.field.XSingleAnnotationField;
+import org.jvnet.annox.model.annotation.value.XAnnotationValue;
+
+import com.sun.codemodel.JAnnotationArrayMember;
+import com.sun.codemodel.JAnnotationUse;
+import com.sun.codemodel.JCodeModel;
+
+public class AnnotatingVisitor implements
+ XAnnotationFieldVisitor {
+
+ private final JCodeModel codeModel;
+ private final JAnnotationUse annotationUse;
+
+ public AnnotatingVisitor(JCodeModel codeModel, JAnnotationUse annotationUse) {
+ this.codeModel = codeModel;
+ this.annotationUse = annotationUse;
+ }
+
+ public JAnnotationUse visitSingleAnnotationField(
+ XSingleAnnotationField> field) {
+ final XAnnotationValue> annotationValue = field.getAnnotationValue();
+ annotationValue.accept(new AnnotatingSingleValueVisitor(this.codeModel,
+ field.getName(), this.annotationUse));
+ return this.annotationUse;
+ }
+
+ public JAnnotationUse visitArrayAnnotationField(
+ XArrayAnnotationField> field) {
+
+ String fieldName = field.getName();
+ final JAnnotationArrayMember annotationArrayMember = this.annotationUse
+ .paramArray(fieldName);
+
+ for (final XAnnotationValue> annotationValue : field
+ .getAnnotationValues()) {
+ annotationValue.accept(new AnnotatingArrayValueVisitor(
+ this.codeModel, annotationArrayMember));
+ }
+ return this.annotationUse;
+ }
+
+}
diff --git a/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java
new file mode 100644
index 000000000..7ae95437b
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/Annotator.java
@@ -0,0 +1,82 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate;
+
+import java.util.Collection;
+
+import org.jvnet.annox.model.XAnnotation;
+import org.jvnet.annox.model.XAnnotationFieldVisitor;
+import org.jvnet.annox.model.annotation.field.XAnnotationField;
+
+import com.sun.codemodel.JAnnotatable;
+import com.sun.codemodel.JAnnotationUse;
+import com.sun.codemodel.JClass;
+import com.sun.codemodel.JCodeModel;
+
+public class Annotator {
+
+ public static final Annotator INSTANCE = new Annotator();
+
+ public void annotate(JCodeModel codeModel, JAnnotatable annotatable,
+ Collection> xannotations) {
+ for (final XAnnotation> xannotation : xannotations) {
+ if (xannotation != null) {
+ annotate(codeModel, annotatable, xannotation);
+ }
+ }
+ }
+
+ public void annotate(JCodeModel codeModel, JAnnotatable annotatable,
+ XAnnotation> xannotation) {
+ final JClass annotationClass = codeModel.ref(xannotation
+ .getAnnotationClass());
+ JAnnotationUse annotationUse = null;
+ for (JAnnotationUse annotation : annotatable.annotations()) {
+ if (annotationClass.equals(annotation.getAnnotationClass())) {
+ annotationUse = annotation;
+ }
+ }
+ if (annotationUse == null) {
+ annotationUse = annotatable.annotate(annotationClass);
+ }
+ final XAnnotationFieldVisitor> visitor = createAnnotationFieldVisitor(
+ codeModel, annotationUse);
+ for (XAnnotationField> field : xannotation.getFieldsList()) {
+ field.accept(visitor);
+ }
+ }
+
+ protected XAnnotationFieldVisitor> createAnnotationFieldVisitor(
+ JCodeModel codeModel, final JAnnotationUse annotationUse) {
+ final XAnnotationFieldVisitor> visitor = new AnnotatingVisitor(
+ codeModel, annotationUse);
+ return visitor;
+ }
+
+}
diff --git a/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/removeannotation/RemoveAnnotationPlugin.java b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/removeannotation/RemoveAnnotationPlugin.java
new file mode 100644
index 000000000..600cee60a
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/main/java/org/jvnet/jaxb2_commons/plugin/removeannotation/RemoveAnnotationPlugin.java
@@ -0,0 +1,401 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.removeannotation;
+
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.lang3.StringUtils;
+import org.jvnet.annox.Constants;
+import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin;
+import org.jvnet.jaxb2_commons.plugin.AnnotationTarget;
+import org.jvnet.jaxb2_commons.util.CustomizationUtils;
+import org.w3c.dom.Element;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import com.sun.codemodel.JAnnotatable;
+import com.sun.codemodel.JAnnotationUse;
+import com.sun.codemodel.JClass;
+import com.sun.codemodel.JCodeModel;
+import com.sun.tools.xjc.Options;
+import com.sun.tools.xjc.model.CCustomizations;
+import com.sun.tools.xjc.model.CElementInfo;
+import com.sun.tools.xjc.model.CPluginCustomization;
+import com.sun.tools.xjc.outline.ClassOutline;
+import com.sun.tools.xjc.outline.ElementOutline;
+import com.sun.tools.xjc.outline.EnumConstantOutline;
+import com.sun.tools.xjc.outline.EnumOutline;
+import com.sun.tools.xjc.outline.FieldOutline;
+import com.sun.tools.xjc.outline.Outline;
+
+public class RemoveAnnotationPlugin extends AbstractParameterizablePlugin {
+
+ public static final QName REMOVE_ANNOTATION_FROM_PROPERTY_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromProperty");
+ public static final QName REMOVE_ANNOTATION_FROM_PROPERTY_GETTER_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromPropertyGetter");
+ public static final QName REMOVE_ANNOTATION_FROM_PROPERTY_SETTER_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromPropertySetter");
+ public static final QName REMOVE_ANNOTATION_FROM_PROPERTY_FIELD_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromPropertyField");
+ public static final QName REMOVE_ANNOTATION_FROM_PROPERTY_SETTER_PARAMETER_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromPropertySetterParameter");
+ public static final QName REMOVE_ANNOTATION_FROM_PACKAGE_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromPackage");
+ public static final QName REMOVE_ANNOTATION_FROM_CLASS_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromClass");
+ public static final QName REMOVE_ANNOTATION_FROM_ELEMENT_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromElement");
+ public static final QName REMOVE_ANNOTATION_FROM_ENUM_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromEnum");
+ public static final QName REMOVE_ANNOTATION_FROM_ENUM_CONSTANT_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromEnumConstant");
+ public static final QName REMOVE_ANNOTATION_FROM_ENUM_VALUE_METHOD_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromEnumValueMethod");
+ public static final QName REMOVE_ANNOTATION_FROM_ENUM_FROM_VALUE_METHOD_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotationFromEnumFromValueMethod");
+ public static final QName REMOVE_ANNOTATION_QNAME = new QName(
+ Constants.NAMESPACE_URI, "removeAnnotation");
+
+ public static final Set CUSTOMIZATION_ELEMENT_QNAMES = Collections.unmodifiableSet(
+ new HashSet(Arrays.asList(
+ REMOVE_ANNOTATION_QNAME,
+ REMOVE_ANNOTATION_FROM_PACKAGE_QNAME,
+ REMOVE_ANNOTATION_FROM_CLASS_QNAME,
+ REMOVE_ANNOTATION_FROM_ELEMENT_QNAME,
+ REMOVE_ANNOTATION_FROM_PROPERTY_QNAME,
+ REMOVE_ANNOTATION_FROM_PROPERTY_FIELD_QNAME,
+ REMOVE_ANNOTATION_FROM_PROPERTY_GETTER_QNAME,
+ REMOVE_ANNOTATION_FROM_PROPERTY_SETTER_QNAME,
+ REMOVE_ANNOTATION_FROM_PROPERTY_SETTER_PARAMETER_QNAME,
+ REMOVE_ANNOTATION_FROM_ENUM_QNAME,
+ REMOVE_ANNOTATION_FROM_ENUM_CONSTANT_QNAME,
+ REMOVE_ANNOTATION_FROM_ENUM_VALUE_METHOD_QNAME,
+ REMOVE_ANNOTATION_FROM_ENUM_FROM_VALUE_METHOD_QNAME)));
+
+ public static final String CLASS_ATTRIBUTE_NAME = "class";
+
+ @Override
+ public String getOptionName() {
+ return "XremoveAnnotation";
+ }
+
+ @Override
+ public String getUsage() {
+ return "TBD";
+ }
+
+ private String defaultFieldTarget = "getter";
+
+ public String getDefaultFieldTarget() {
+ return defaultFieldTarget;
+ }
+
+ public void setDefaultFieldTarget(String defaultFieldTarget) {
+ if ("getter".equals(defaultFieldTarget)
+ || "setter".equals(defaultFieldTarget)
+ || "setter-parameter".equals(defaultFieldTarget)
+ || "field".equals(defaultFieldTarget)) {
+ this.defaultFieldTarget = defaultFieldTarget;
+ } else {
+ throw new IllegalArgumentException("Invalid default field target.");
+ }
+ }
+
+ @Override
+ public boolean run(Outline outline, Options options,
+ ErrorHandler errorHandler) {
+
+ for (final CElementInfo elementInfo : outline.getModel()
+ .getAllElements()) {
+ final ElementOutline elementOutline = outline
+ .getElement(elementInfo);
+ if (elementOutline != null) {
+ processElementOutline(elementOutline, options, errorHandler);
+ }
+ }
+
+ for (final ClassOutline classOutline : outline.getClasses()) {
+ processClassOutline(classOutline, options, errorHandler);
+ }
+ for (final EnumOutline enumOutline : outline.getEnums()) {
+ processEnumOutline(enumOutline, options, errorHandler);
+ }
+ return true;
+ }
+
+ protected void processElementOutline(ElementOutline elementOutline,
+ Options options, ErrorHandler errorHandler) {
+
+ final CCustomizations customizations = CustomizationUtils
+ .getCustomizations(elementOutline);
+
+ removeAnnotationFromElementOutline(elementOutline.implClass.owner(),
+ elementOutline, customizations, errorHandler);
+ }
+
+ protected void processEnumOutline(EnumOutline enumOutline, Options options,
+ ErrorHandler errorHandler) {
+ final CCustomizations customizations = CustomizationUtils
+ .getCustomizations(enumOutline);
+ removeAnnotationFromEnumOutline(enumOutline.clazz.owner(), enumOutline,
+ customizations, errorHandler);
+
+ for (final EnumConstantOutline enumConstantOutline : enumOutline.constants) {
+ processEnumConstantOutline(enumOutline, enumConstantOutline,
+ options, errorHandler);
+ }
+
+ }
+
+ protected void processClassOutline(ClassOutline classOutline,
+ Options options, ErrorHandler errorHandler) {
+
+ final CCustomizations customizations = CustomizationUtils
+ .getCustomizations(classOutline);
+
+ removeAnnotationFromClassOutline(classOutline.ref.owner(), classOutline,
+ customizations, errorHandler);
+
+ for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
+ processFieldOutline(classOutline, fieldOutline, options,
+ errorHandler);
+ }
+
+ }
+
+ protected void processFieldOutline(ClassOutline classOutline,
+ FieldOutline fieldOutline, Options options,
+ ErrorHandler errorHandler) {
+ final CCustomizations customizations = CustomizationUtils
+ .getCustomizations(fieldOutline);
+ removeAnnotationFromFieldOutline(fieldOutline.parent().ref.owner(), fieldOutline,
+ customizations, errorHandler);
+ }
+
+ protected void processEnumConstantOutline(EnumOutline enumOutline,
+ EnumConstantOutline enumConstantOutline, Options options,
+ ErrorHandler errorHandler) {
+
+ final CCustomizations customizations = CustomizationUtils
+ .getCustomizations(enumConstantOutline);
+
+ removeAnnotationFromEnumConstantOutline(enumOutline.parent().getCodeModel(),
+ enumOutline.parent(), enumConstantOutline, customizations,
+ errorHandler);
+ }
+
+ protected void removeAnnotationFromElementOutline(final JCodeModel codeModel,
+ final ElementOutline elementOutline,
+ final CCustomizations customizations,
+ final ErrorHandler errorHandler) {
+ for (final CPluginCustomization customization : customizations) {
+ final Element element = customization.element;
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+ if (isCustomizationElementName(name)) {
+ customization.markAsAcknowledged();
+ final AnnotationTarget annotationTarget = AnnotationTarget
+ .getAnnotationTarget(element, AnnotationTarget.ELEMENT);
+ try {
+ final JAnnotatable annotatable = annotationTarget
+ .getAnnotatable(elementOutline.parent(),
+ elementOutline);
+ removeAnnotation(codeModel, errorHandler, customization, element,
+ annotatable);
+ } catch (IllegalArgumentException iaex) {
+ logger.error("Error applying the annotation.", iaex);
+ }
+ }
+ }
+ }
+
+ protected void removeAnnotationFromEnumOutline(final JCodeModel codeModel,
+ final EnumOutline enumOutline,
+ final CCustomizations customizations,
+ final ErrorHandler errorHandler) {
+ for (final CPluginCustomization customization : customizations) {
+ final Element element = customization.element;
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+ if (isCustomizationElementName(name)) {
+ customization.markAsAcknowledged();
+ final AnnotationTarget annotationTarget = AnnotationTarget
+ .getAnnotationTarget(element, AnnotationTarget.ENUM);
+ try {
+ final JAnnotatable annotatable = annotationTarget
+ .getAnnotatable(enumOutline.parent(), enumOutline);
+ removeAnnotation(codeModel, errorHandler, customization, element,
+ annotatable);
+ } catch (IllegalArgumentException iaex) {
+ logger.error("Error applying the annotation.", iaex);
+ }
+ }
+ }
+ }
+
+ protected void removeAnnotationFromEnumConstantOutline(final JCodeModel codeModel,
+ final Outline outline,
+ final EnumConstantOutline enumConstantOutline,
+ final CCustomizations customizations,
+ final ErrorHandler errorHandler) {
+ for (final CPluginCustomization customization : customizations) {
+ final Element element = customization.element;
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+ if (isCustomizationElementName(name)) {
+ customization.markAsAcknowledged();
+ final AnnotationTarget annotationTarget = AnnotationTarget
+ .getAnnotationTarget(element,
+ AnnotationTarget.ENUM_CONSTANT);
+ try {
+ final JAnnotatable annotatable = annotationTarget
+ .getAnnotatable(outline, enumConstantOutline);
+ removeAnnotation(codeModel, errorHandler, customization, element,
+ annotatable);
+ } catch (IllegalArgumentException iaex) {
+ logger.error("Error applying the annotation.", iaex);
+ }
+
+ }
+ }
+ }
+
+ protected void removeAnnotationFromClassOutline(final JCodeModel codeModel,
+ final ClassOutline classOutline,
+ final CCustomizations customizations, ErrorHandler errorHandler) {
+ for (final CPluginCustomization customization : customizations) {
+ final Element element = customization.element;
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+ if (isCustomizationElementName(name)) {
+ customization.markAsAcknowledged();
+ final AnnotationTarget annotationTarget = AnnotationTarget
+ .getAnnotationTarget(element, AnnotationTarget.CLASS);
+ try {
+ final JAnnotatable annotatable = annotationTarget
+ .getAnnotatable(classOutline.parent(), classOutline);
+ removeAnnotation(codeModel, errorHandler, customization, element,
+ annotatable);
+ } catch (IllegalArgumentException iaex) {
+ logger.error("Error applying the annotation.", iaex);
+ }
+ }
+ }
+ }
+
+ protected void removeAnnotationFromFieldOutline(final JCodeModel codeModel,
+ final FieldOutline fieldOutline,
+ final CCustomizations customizations, ErrorHandler errorHandler) {
+ for (final CPluginCustomization customization : customizations) {
+ final Element element = customization.element;
+ final QName name = new QName(element.getNamespaceURI(),
+ element.getLocalName());
+ if (isCustomizationElementName(name)) {
+ customization.markAsAcknowledged();
+
+ final AnnotationTarget annotationTarget = AnnotationTarget
+ .getAnnotationTarget(element, AnnotationTarget
+ .getAnnotationTarget(getDefaultFieldTarget()));
+
+ try {
+ final JAnnotatable annotatable = annotationTarget
+ .getAnnotatable(fieldOutline.parent().parent(),
+ fieldOutline);
+ removeAnnotation(codeModel, errorHandler, customization, element,
+ annotatable);
+ } catch (IllegalArgumentException iaex) {
+ logger.error("Error removing the annotation.", iaex);
+ }
+
+ }
+ }
+ }
+
+ private void removeAnnotation(final JCodeModel codeModel,
+ ErrorHandler errorHandler,
+ final CPluginCustomization customization,
+ final Element element,
+ final JAnnotatable annotatable) {
+
+ final String aClass = element.getAttribute(CLASS_ATTRIBUTE_NAME);
+ if (StringUtils.isBlank(aClass)) {
+ try {
+ errorHandler.error(new SAXParseException(
+ "Could not remove the annotation, annotation class is not specified. "
+ + "Annotation class must be specified using the class attribute of the customization element.",
+ customization.locator));
+ } catch (SAXException ignored) {
+ // Nothing to do
+ }
+ }
+ else {
+ JClass annotationClass = codeModel.ref(aClass);
+
+ JAnnotationUse annotationUse = null;
+ for (JAnnotationUse annotation : annotatable.annotations()) {
+ if (annotationClass.equals(annotation.getAnnotationClass())) {
+ annotationUse = annotation;
+ }
+ }
+ if (annotationUse == null) {
+ try {
+ errorHandler.warning(new SAXParseException(
+ MessageFormat.format(
+ "Could not remove the annotation, target element is not annotated with annotation class [{0}].",
+ annotationClass),
+ customization.locator));
+ } catch (SAXException ignored) {
+ // Nothing to do
+ }
+ }
+ else {
+ annotatable.removeAnnotation(annotationUse);
+ }
+ }
+ }
+
+ private boolean isCustomizationElementName(final QName name) {
+ return RemoveAnnotationPlugin.CUSTOMIZATION_ELEMENT_QNAMES.contains(name);
+ }
+
+ @Override
+ public Collection getCustomizationElementNames() {
+ return CUSTOMIZATION_ELEMENT_QNAMES;
+ }
+
+}
diff --git a/jaxb-annotate-parent/plugin/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin b/jaxb-annotate-parent/plugin/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin
new file mode 100644
index 000000000..a8a111d4d
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/main/resources/META-INF/services/com.sun.tools.xjc.Plugin
@@ -0,0 +1,2 @@
+org.jvnet.jaxb2_commons.plugin.annotate.AnnotatePlugin
+org.jvnet.jaxb2_commons.plugin.removeannotation.RemoveAnnotationPlugin
\ No newline at end of file
diff --git a/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java b/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java
new file mode 100644
index 000000000..e58a4ee8e
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/A.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+/**
+ *
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface A {
+ long longField();
+
+ int intField();
+
+ short shortField();
+
+ char charField();
+
+ byte byteField();
+
+ double doubleField();
+
+ float floatField();
+
+ boolean booleanField();
+
+ String stringField();
+
+ E enumField();
+
+ Class> classField();
+
+ Class> anotherClassField() default String.class;
+
+ B annotationField();
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java b/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java
new file mode 100644
index 000000000..174ed16de
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/B.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+/**
+ *
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface B {
+
+ long[] longArrayField();
+
+ int[] intArrayField();
+
+ short[] shortArrayField();
+
+ char[] charArrayField();
+
+ byte[] byteArrayField();
+
+ double[] doubleArrayField();
+
+ float[] floatArrayField();
+
+ boolean[] booleanArrayField();
+
+ String[] stringArrayField();
+
+ E[] enumArrayField();
+
+ Class>[] classArrayField();
+
+ Class>[] anotherClassArrayField() default { String.class, Boolean.class };
+
+ B.C[] annotationArrayField();
+
+ @Retention(RetentionPolicy.RUNTIME)
+ public static @interface C {
+ }
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java b/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java
new file mode 100644
index 000000000..dedc6d892
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/D.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface D {
+
+}
diff --git a/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java b/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java
new file mode 100644
index 000000000..0d4724cd6
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/E.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+/**
+ *
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests;
+
+public enum E {
+
+ ONE, TWO, THREE, FOUR;
+
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java b/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java
new file mode 100644
index 000000000..a6a7e1e81
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/test/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/F.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface F {
+ String value();
+
+}
diff --git a/jaxb-annotate-parent/plugin/src/test/resources/schema.xsd b/jaxb-annotate-parent/plugin/src/test/resources/schema.xsd
new file mode 100644
index 000000000..e4bbc0a8a
--- /dev/null
+++ b/jaxb-annotate-parent/plugin/src/test/resources/schema.xsd
@@ -0,0 +1,295 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.A(
+ booleanField = false,
+ byteField = 0,
+ charField = 'a',
+ classField = java.lang.String[][][].class,
+ anotherClassField=org.jvnet.jaxb2_commons.plugin.annotate.tests.One.class,
+ doubleField = 1,
+ enumField = org.jvnet.jaxb2_commons.plugin.annotate.tests.E.ONE,
+ floatField = 2.3f,
+ intField = 4,
+ longField = 5,
+ shortField = 6,
+ stringField = "7",
+ annotationField = @org.jvnet.jaxb2_commons.plugin.annotate.tests.B(
+ booleanArrayField = { false, true },
+ byteArrayField = { 0, 1 },
+ charArrayField = { 'a', 'b' },
+ classArrayField = { java.lang.String.class, java.lang.Boolean.class },
+ anotherClassArrayField= {org.jvnet.jaxb2_commons.plugin.annotate.tests.One.class, org.jvnet.jaxb2_commons.plugin.annotate.tests.Two.class },
+ doubleArrayField = { 2, 3 },
+ enumArrayField = { org.jvnet.jaxb2_commons.plugin.annotate.tests.E.ONE, org.jvnet.jaxb2_commons.plugin.annotate.tests.E.TWO },
+ floatArrayField = { 4.5f, 6.7f },
+ intArrayField = { 8, 9 },
+ longArrayField = { 10, -9223372036854775808L },
+ shortArrayField = { 12, 13 },
+ stringArrayField = { "14", "15", "16", "17" },
+ annotationArrayField = { @org.jvnet.jaxb2_commons.plugin.annotate.tests.B.C, @org.jvnet.jaxb2_commons.plugin.annotate.tests.B.C }))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/pom.xml b/jaxb-annotate-parent/pom.xml
new file mode 100644
index 000000000..2512fc3a6
--- /dev/null
+++ b/jaxb-annotate-parent/pom.xml
@@ -0,0 +1,107 @@
+
+
+ 4.0.0
+
+ org.jvnet.jaxb
+ jaxb-tools-project
+ 2.0.5-SNAPSHOT
+ ../pom.xml
+
+ jaxb-annotate-plugin-parent
+ pom
+ JAXB Tools :: Annotate :: Parent
+ JAXB Annotate Plugin adds arbitrary annotations to Java classes generated by JAXB/XJC.
+
+ plugin
+
+
+
+ disable-java8-doclint
+
+ [1.8,)
+
+
+ -Xdoclint:none
+
+
+
+ all
+
+
+ all
+
+
+
+ samples
+ tests
+
+
+
+ samples
+
+
+ samples
+
+
+
+ samples
+
+
+
+ tests
+
+
+ tests
+
+
+
+ tests
+
+
+
+
+
+ junit
+ junit
+ test
+
+
+
+
diff --git a/jaxb-annotate-parent/samples/.gitignore b/jaxb-annotate-parent/samples/.gitignore
new file mode 100644
index 000000000..4874fbf33
--- /dev/null
+++ b/jaxb-annotate-parent/samples/.gitignore
@@ -0,0 +1,4 @@
+/target
+.classpath
+.project
+.settings
diff --git a/jaxb-annotate-parent/samples/annotate/.gitignore b/jaxb-annotate-parent/samples/annotate/.gitignore
new file mode 100644
index 000000000..804dd1d1b
--- /dev/null
+++ b/jaxb-annotate-parent/samples/annotate/.gitignore
@@ -0,0 +1,4 @@
+/target
+.settings
+.project
+.classpath
diff --git a/jaxb-annotate-parent/samples/annotate/pom.xml b/jaxb-annotate-parent/samples/annotate/pom.xml
new file mode 100644
index 000000000..ddefb5bea
--- /dev/null
+++ b/jaxb-annotate-parent/samples/annotate/pom.xml
@@ -0,0 +1,131 @@
+
+
+ 4.0.0
+
+ org.jvnet.jaxb
+ jaxb-annotate-plugin-samples
+ 2.0.5-SNAPSHOT
+ ../pom.xml
+
+ jaxb-annotate-plugin-sample-annotate
+ pom
+ JAXB Tools :: Annotate :: Sample [annotate]
+
+
+ org.glassfish.jaxb
+ jaxb-xjc
+
+
+ org.jvnet.jaxb
+ jaxb-basics-annotate
+ ${project.version}
+
+
+ commons-logging
+ commons-logging
+
+
+ org.jvnet.jaxb
+ jaxb2-basics-ant
+ ${project.version}
+
+
+ org.apache.logging.log4j
+ log4j-jcl
+
+
+
+ org.glassfish.jaxb
+ jaxb-runtime
+
+
+ com.sun.activation
+ jakarta.activation
+
+
+
+ org.hibernate
+ hibernate-search
+ 4.1.1.Final
+
+
+ junit
+ junit
+
+
+
+ install
+
+
+ maven-assembly-plugin
+
+
+ maven-assembly
+ package
+
+
+ ant-assembly
+ package
+
+
+
+
+ maven-antrun-plugin
+
+
+ maven-unpack
+ pre-integration-test
+
+
+ ant-unpack
+ pre-integration-test
+
+
+ ant-integration-test
+ integration-test
+
+
+
+
+ maven-invoker-plugin
+
+
+ maven-integration-test
+ integration-test
+
+
+
+
+
+
diff --git a/jaxb-annotate-parent/samples/annotate/project-build.xml b/jaxb-annotate-parent/samples/annotate/project-build.xml
new file mode 100644
index 000000000..9d380a876
--- /dev/null
+++ b/jaxb-annotate-parent/samples/annotate/project-build.xml
@@ -0,0 +1,187 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/samples/annotate/project-pom.xml b/jaxb-annotate-parent/samples/annotate/project-pom.xml
new file mode 100644
index 000000000..7133a52fe
--- /dev/null
+++ b/jaxb-annotate-parent/samples/annotate/project-pom.xml
@@ -0,0 +1,99 @@
+
+
+ 4.0.0
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-sample-annotate-maven
+ ${project.version}
+ jar
+ JAXB2 Annotate Plugin - Sample [annotate-maven]
+
+
+ org.glassfish.jaxb
+ jaxb-runtime
+ ${jaxb.version}
+ provided
+
+
+ org.hibernate
+ hibernate-search
+ 4.1.1.Final
+ provided
+
+
+
+ test
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+ ${maven-jaxb2-plugin.version}
+
+
+
+ generate
+
+
+
+
+ true
+
+ -Xannotate
+
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-annotate
+ ${project.version}
+
+
+
+
+
+ org.hibernate
+ hibernate-search
+ 4.1.1.Final
+
+
+
+
+ true
+ maven-compiler-plugin
+
+ 1.6
+ 1.6
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/samples/annotate/src/main/java/.placeholder b/jaxb-annotate-parent/samples/annotate/src/main/java/.placeholder
new file mode 100644
index 000000000..e69de29bb
diff --git a/jaxb-annotate-parent/samples/annotate/src/main/resources/bindings.xjb b/jaxb-annotate-parent/samples/annotate/src/main/resources/bindings.xjb
new file mode 100644
index 000000000..b4f3fa82c
--- /dev/null
+++ b/jaxb-annotate-parent/samples/annotate/src/main/resources/bindings.xjb
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+ @org.hibernate.search.annotations.Field(store=org.hibernate.search.annotations.Store.COMPRESS)
+
+
+
+
+
diff --git a/jaxb-annotate-parent/samples/annotate/src/main/resources/schema.xsd b/jaxb-annotate-parent/samples/annotate/src/main/resources/schema.xsd
new file mode 100644
index 000000000..376db85de
--- /dev/null
+++ b/jaxb-annotate-parent/samples/annotate/src/main/resources/schema.xsd
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/samples/annotate/src/test/java/.placeholder b/jaxb-annotate-parent/samples/annotate/src/test/java/.placeholder
new file mode 100644
index 000000000..e69de29bb
diff --git a/jaxb-annotate-parent/samples/annotate/src/test/resources/.placeholder b/jaxb-annotate-parent/samples/annotate/src/test/resources/.placeholder
new file mode 100644
index 000000000..e69de29bb
diff --git a/jaxb-annotate-parent/samples/pom.xml b/jaxb-annotate-parent/samples/pom.xml
new file mode 100644
index 000000000..2da52993e
--- /dev/null
+++ b/jaxb-annotate-parent/samples/pom.xml
@@ -0,0 +1,155 @@
+
+
+ 4.0.0
+
+ org.jvnet.jaxb
+ jaxb-annotate-plugin-parent
+ 2.0.5-SNAPSHOT
+ ../pom.xml
+
+ jaxb-annotate-plugin-samples
+ pom
+ JAXB Tools :: Annotate :: Samples
+
+ annotate
+
+
+ install
+
+
+ maven-assembly-plugin
+
+
+ maven-assembly
+
+ none
+
+ single
+
+
+
+ ../src/main/assembly/maven-src.xml
+
+ \
+
+
+
+ ant-assembly
+
+ none
+
+ single
+
+
+
+ ../src/main/assembly/ant-src.xml
+
+ \
+
+
+
+
+
+ maven-antrun-plugin
+
+
+ maven-unpack
+
+ none
+
+
+
+
+
+
+
+ run
+
+
+
+ ant-unpack
+
+ none
+
+
+
+
+
+
+ run
+
+
+
+ ant-integration-test
+
+ none
+
+
+
+
+
+
+ run
+
+
+
+
+
+ maven-invoker-plugin
+
+
+ maven-integration-test
+
+ none
+
+ run
+
+
+ true
+ ${basedir}/target/test-maven-assembly
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+
+
+
+
diff --git a/jaxb-annotate-parent/samples/src/main/assembly/ant-src.xml b/jaxb-annotate-parent/samples/src/main/assembly/ant-src.xml
new file mode 100644
index 000000000..4ea2c8194
--- /dev/null
+++ b/jaxb-annotate-parent/samples/src/main/assembly/ant-src.xml
@@ -0,0 +1,60 @@
+
+
+ ant-src
+
+ zip
+
+
+
+
+ README*
+ LICENSE*
+ NOTICE*
+ build.xml
+
+
+
+ src
+
+
+
+
+ lib
+
+
+
+
+ ${basedir}/project-build.xml
+ build.xml
+
+
+
diff --git a/jaxb-annotate-parent/samples/src/main/assembly/maven-src.xml b/jaxb-annotate-parent/samples/src/main/assembly/maven-src.xml
new file mode 100644
index 000000000..c9181cfc3
--- /dev/null
+++ b/jaxb-annotate-parent/samples/src/main/assembly/maven-src.xml
@@ -0,0 +1,61 @@
+
+
+ maven-src
+
+ zip
+
+
+
+
+ README*
+ LICENSE*
+ NOTICE*
+
+
+
+ src
+
+
+ a
+
+
+ b
+
+
+
+
+ ${basedir}/project-pom.xml
+ pom.xml
+ true
+
+
+
diff --git a/jaxb-annotate-parent/tests/.gitignore b/jaxb-annotate-parent/tests/.gitignore
new file mode 100644
index 000000000..f66a28914
--- /dev/null
+++ b/jaxb-annotate-parent/tests/.gitignore
@@ -0,0 +1,4 @@
+/target
+.settings
+.project
+.classpath
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annotate/.gitignore b/jaxb-annotate-parent/tests/annotate/.gitignore
new file mode 100644
index 000000000..f66a28914
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotate/.gitignore
@@ -0,0 +1,4 @@
+/target
+.settings
+.project
+.classpath
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annotate/pom.xml b/jaxb-annotate-parent/tests/annotate/pom.xml
new file mode 100644
index 000000000..0ae1cbd63
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotate/pom.xml
@@ -0,0 +1,77 @@
+
+
+ 4.0.0
+
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-tests
+ 1.1.1-SNAPSHOT
+ ../pom.xml
+
+ jaxb2-annotate-plugin-test-annotate
+ jar
+ JAXB2 Annotate Plugin - Test [annotate]
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin-testing
+ test
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-annotate
+
+
+
+ test
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+
+ true
+
+ -Xannotate
+ -Xannotate-defaultFieldTarget=setter
+
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-annotate
+
+
+
+
+
+
+
diff --git a/jaxb-annotate-parent/tests/annotate/src/main/resources/bindings.xjb b/jaxb-annotate-parent/tests/annotate/src/main/resources/bindings.xjb
new file mode 100644
index 000000000..c243151a7
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotate/src/main/resources/bindings.xjb
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+ @javax.xml.bind.annotation.XmlRootElement(name="IssueJIIB39CType")
+
+
+ @javax.xml.bind.annotation.XmlAttribute(required=false, name="test")
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annotate/src/main/resources/schema.xsd b/jaxb-annotate-parent/tests/annotate/src/main/resources/schema.xsd
new file mode 100644
index 000000000..6cd8de990
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotate/src/main/resources/schema.xsd
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @java.lang.SuppressWarnings({"unchecked","rawtypes"})
+
+ @javax.xml.bind.annotation.XmlSchema(
+ elementFormDefault = javax.xml.bind.annotation.XmlNsForm.UNQUALIFIED,
+ xmlns = {
+ @javax.xml.bind.annotation.XmlNs(prefix = "a", namespaceURI = "")
+ })
+
+
+
+
+
+
+
+
+ @java.lang.SuppressWarnings({"unchecked","rawtypes"})
+ @java.lang.Deprecated
+ @java.lang.Deprecated
+ @java.lang.Deprecated
+ @java.lang.Deprecated
+ @java.lang.Deprecated
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java b/jaxb-annotate-parent/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java
new file mode 100644
index 000000000..f958324d2
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotate/src/test/java/org/jvnet/jaxb2_commons/tests/annotate/RunAnnotatePlugin.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.annotate;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo;
+import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo;
+
+public class RunAnnotatePlugin extends RunXJC2Mojo {
+
+ @Override
+ protected void configureMojo(AbstractXJC2Mojo mojo) {
+ super.configureMojo(mojo);
+ mojo.setExtension(true);
+ mojo.setForceRegenerate(true);
+ }
+
+ @Override
+ public List getArgs() {
+ final List args = new ArrayList(super.getArgs());
+ args.add("-Xannotate");
+ return args;
+ }
+
+}
diff --git a/jaxb-annotate-parent/tests/annotations/.gitignore b/jaxb-annotate-parent/tests/annotations/.gitignore
new file mode 100644
index 000000000..f66a28914
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotations/.gitignore
@@ -0,0 +1,4 @@
+/target
+.settings
+.project
+.classpath
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annotations/pom.xml b/jaxb-annotate-parent/tests/annotations/pom.xml
new file mode 100644
index 000000000..1affd2e9a
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotations/pom.xml
@@ -0,0 +1,44 @@
+
+
+ 4.0.0
+
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-tests
+ 1.1.1-SNAPSHOT
+ ../pom.xml
+
+ jaxb2-annotate-plugin-test-annotations
+ jar
+ JAXB2 Annotate Plugin - Test [annotations]
+
diff --git a/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/A.java b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/A.java
new file mode 100644
index 000000000..51b36585d
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/A.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface A {
+ long longField();
+
+ int intField();
+
+ short shortField();
+
+ char charField();
+
+ byte byteField();
+
+ double doubleField();
+
+ float floatField();
+
+ boolean booleanField();
+
+ String stringField();
+
+ E enumField();
+
+ Class> classField();
+
+ Class> anotherClassField() default String.class;
+
+ B annotationField();
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/Alpha.java b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/Alpha.java
new file mode 100644
index 000000000..737cf4bd6
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/Alpha.java
@@ -0,0 +1,60 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Alpha {
+ long longField() default 1;
+
+ int intField() default 2;
+
+ short shortField() default 3;
+
+ char charField() default 'f';
+
+ byte byteField() default 5;
+
+ double doubleField() default 6.0;
+
+ float floatField() default 7.0f;
+
+ boolean booleanField() default true;
+
+ Digits enumField() default Digits.EIGHT;
+
+ String stringField() default "nine";
+
+ @SuppressWarnings("unchecked")
+ Class classField() default String.class;
+
+ // B annotationField();
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/B.java b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/B.java
new file mode 100644
index 000000000..6195926a8
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/B.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface B {
+
+ long[] longArrayField();
+
+ int[] intArrayField();
+
+ short[] shortArrayField();
+
+ char[] charArrayField();
+
+ byte[] byteArrayField();
+
+ double[] doubleArrayField();
+
+ float[] floatArrayField();
+
+ boolean[] booleanArrayField();
+
+ String[] stringArrayField();
+
+ E[] enumArrayField();
+
+ Class>[] classArrayField();
+
+ Class>[] anotherClassArrayField() default { String.class, Boolean.class };
+
+ B.C[] annotationArrayField();
+
+ @Retention(RetentionPolicy.RUNTIME)
+ public static @interface C {
+ }
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/D.java b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/D.java
new file mode 100644
index 000000000..0412ea2c5
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/D.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface D {
+
+}
diff --git a/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/Digits.java b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/Digits.java
new file mode 100644
index 000000000..8de303ca0
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/Digits.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations;
+
+public enum Digits {
+
+ ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE;
+
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/E.java b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/E.java
new file mode 100644
index 000000000..4ed93c0e9
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/E.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations;
+
+public enum E {
+
+ ONE, TWO, THREE, FOUR;
+
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/F.java b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/F.java
new file mode 100644
index 000000000..e4214b262
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/F.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface F {
+ String value();
+
+}
diff --git a/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/Marked.java b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/Marked.java
new file mode 100644
index 000000000..60899542c
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annotations/src/main/java/org/jvnet/jaxb2_commons/plugin/annotate/tests/annotations/Marked.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Marked {
+ String value();
+}
diff --git a/jaxb-annotate-parent/tests/annox/.gitignore b/jaxb-annotate-parent/tests/annox/.gitignore
new file mode 100644
index 000000000..f66a28914
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annox/.gitignore
@@ -0,0 +1,4 @@
+/target
+.settings
+.project
+.classpath
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annox/pom.xml b/jaxb-annotate-parent/tests/annox/pom.xml
new file mode 100644
index 000000000..32fc5af1d
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annox/pom.xml
@@ -0,0 +1,76 @@
+
+
+ 4.0.0
+
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-tests
+ 1.1.1-SNAPSHOT
+ ../pom.xml
+
+ jaxb2-annotate-plugin-test-annox
+ jar
+ JAXB2 Annotate Plugin - Test [annox]
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-test-annotations
+ ${project.version}
+
+
+
+ test
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+
+ true
+
+ -Xannotate
+
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-annotate
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-test-annotations
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/annox/src/main/resources/binding.xjb b/jaxb-annotate-parent/tests/annox/src/main/resources/binding.xjb
new file mode 100644
index 000000000..7a5f2dc85
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annox/src/main/resources/binding.xjb
@@ -0,0 +1,50 @@
+
+
+
+ jaxb:extensionBindingPrefixes="annox"
+
+
+
+
+
+ 0
+ 3
+
+
+
+
+
diff --git a/jaxb-annotate-parent/tests/annox/src/main/resources/schema.xsd b/jaxb-annotate-parent/tests/annox/src/main/resources/schema.xsd
new file mode 100644
index 000000000..652ea82b9
--- /dev/null
+++ b/jaxb-annotate-parent/tests/annox/src/main/resources/schema.xsd
@@ -0,0 +1,299 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 17
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.A(
+ booleanField = false,
+ byteField = 0,
+ charField = 'a',
+ classField = double.class,
+ anotherClassField=org.jvnet.jaxb2_commons.plugin.annotate.test.annox.schema.One.class,
+ doubleField = 1,
+ enumField = org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.E.ONE,
+ floatField = 2.3f,
+ intField = 4,
+ longField = 5,
+ shortField = 6,
+ stringField = "7",
+ annotationField = @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.B(
+ booleanArrayField = { false, true },
+ byteArrayField = { 0, 1 },
+ charArrayField = { 'a', 'b' },
+ classArrayField = { java.lang.String.class, java.lang.Boolean.class, java.lang.String[][][].class, double.class },
+ anotherClassArrayField= {org.jvnet.jaxb2_commons.plugin.annotate.test.annox.schema.One.class, org.jvnet.jaxb2_commons.plugin.annotate.test.annox.schema.Two.class },
+ doubleArrayField = { 2, 3 },
+ enumArrayField = { org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.E.ONE, org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.E.TWO },
+ floatArrayField = { 4.5f, 6.7f },
+ intArrayField = { 8, 9 },
+ longArrayField = { 10, -9223372036854775808L },
+ shortArrayField = { 12, 13 },
+ stringArrayField = { "14", "15", "16", "17" },
+ annotationArrayField = { @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.B.C, @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.B.C }))
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/.gitignore b/jaxb-annotate-parent/tests/issues/.gitignore
new file mode 100644
index 000000000..f66a28914
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/.gitignore
@@ -0,0 +1,4 @@
+/target
+.settings
+.project
+.classpath
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/pom.xml b/jaxb-annotate-parent/tests/issues/pom.xml
new file mode 100644
index 000000000..8a91ad605
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/pom.xml
@@ -0,0 +1,105 @@
+
+
+ 4.0.0
+
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-tests
+ 1.1.1-SNAPSHOT
+ ../pom.xml
+
+ jaxb2-annotate-plugin-test-issues
+ jar
+ JAXB2 Annotate Plugin - Test [issues]
+
+ 1.0.0
+
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin-testing
+ test
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-annotate
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-test-annotations
+ ${project.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ 2.8.6
+
+
+
+ test
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+
+ true
+
+ -Xcustomizations
+ -Xcustomizations-directory=${basedir}/src/main/resources
+ -Xcustomizations-verbose=true
+ -Xannotate
+ -XremoveAnnotation
+
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-annotate
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-test-annotations
+
+
+
+
+
+
+
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/binding.xjb b/jaxb-annotate-parent/tests/issues/src/main/resources/binding.xjb
new file mode 100644
index 000000000..eb6ca2206
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/binding.xjb
@@ -0,0 +1,64 @@
+
+
+
+
+
+ @javax.xml.bind.annotation.XmlRootElement("someElement")
+ @javax.xml.bind.annotation.XmlSchema(elementFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("XJC")
+
+
+
+
+
+
+
+
+
+
+
+ @com.fasterxml.jackson.annotation.JsonView(java.lang.Object.class)
+
+
+
+
+
+ @javax.xml.bind.annotation.XmlType(name="gh51TypeNew")
+
+
+
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/class-annotate-target-package.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/class-annotate-target-package.xsd
new file mode 100644
index 000000000..8708a2629
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/class-annotate-target-package.xsd
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("class.annotate.target.package")
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/class-annotatePackage.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/class-annotatePackage.xsd
new file mode 100644
index 000000000..bfe32a715
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/class-annotatePackage.xsd
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("class.annotatePackage")
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/class.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/class.xsd
new file mode 100644
index 000000000..770b90ad7
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/class.xsd
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate")
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotateClass")
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.class")
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.class")
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotateClass")
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotateProperty.target.class")
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/element-annotate-target-package.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/element-annotate-target-package.xsd
new file mode 100644
index 000000000..b20eb0aa9
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/element-annotate-target-package.xsd
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("element.annotate.target.package")
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/element-annotatePackage.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/element-annotatePackage.xsd
new file mode 100644
index 000000000..175eb8019
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/element-annotatePackage.xsd
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("element.annotatePackage")
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/element.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/element.xsd
new file mode 100644
index 000000000..daee06c67
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/element.xsd
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate")
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.element")
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotateElement")
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotate-target-enum-fromValue-method.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotate-target-enum-fromValue-method.xsd
new file mode 100644
index 000000000..5aa1b8e44
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotate-target-enum-fromValue-method.xsd
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.enum-fromValue-method")
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotate-target-enum-value-method.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotate-target-enum-value-method.xsd
new file mode 100644
index 000000000..59fcb3346
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotate-target-enum-value-method.xsd
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.enum-value-method")
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotate-target-package.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotate-target-package.xsd
new file mode 100644
index 000000000..ada0b0b4b
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotate-target-package.xsd
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("enum.annotate.target.package")
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotateFromValueMethod.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotateFromValueMethod.xsd
new file mode 100644
index 000000000..5b9a29447
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotateFromValueMethod.xsd
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotateEnumFromValueMethod")
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotatePackage.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotatePackage.xsd
new file mode 100644
index 000000000..da6a3a0bb
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotatePackage.xsd
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("enum.annotatePackage")
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotateValueMethod.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotateValueMethod.xsd
new file mode 100644
index 000000000..cafa0a161
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-annotateValueMethod.xsd
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotateEnumValueMethod")
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/enum-constant-annotate-target-package.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-constant-annotate-target-package.xsd
new file mode 100644
index 000000000..7c29ae8ca
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-constant-annotate-target-package.xsd
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("enumConstant.annotate.target.package")
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/enum-constant-annotatePackage.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-constant-annotatePackage.xsd
new file mode 100644
index 000000000..3381455c7
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-constant-annotatePackage.xsd
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("enumConstant.annotatePackage")
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/enum-constant.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-constant.xsd
new file mode 100644
index 000000000..9276d70c0
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/enum-constant.xsd
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate")
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.enumConstant")
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotateEnumConstant")
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/enum.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/enum.xsd
new file mode 100644
index 000000000..aafc467c3
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/enum.xsd
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate")
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.enum")
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotateEnum")
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.enum")
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotateEnum")
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/field-annotate-target-package.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/field-annotate-target-package.xsd
new file mode 100644
index 000000000..a6eeb9751
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/field-annotate-target-package.xsd
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("field.annotate.target.package")
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/field-annotatePackage.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/field-annotatePackage.xsd
new file mode 100644
index 000000000..a895c630b
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/field-annotatePackage.xsd
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("field.annotatePackage")
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/field.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/field.xsd
new file mode 100644
index 000000000..4b95cbc3d
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/field.xsd
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate")
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.field")
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.getter")
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.setter")
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotate.target.setter-parameter")
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotatePropertyField")
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotatePropertyGetter")
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotatePropertySetter")
+
+
+
+
+
+
+
+
+
+
+ @org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("annotatePropertySetterParameter")
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/org/jvnet/jaxb2_commons/tests/issues/Gh24Type.value.xml b/jaxb-annotate-parent/tests/issues/src/main/resources/org/jvnet/jaxb2_commons/tests/issues/Gh24Type.value.xml
new file mode 100644
index 000000000..89cf44776
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/org/jvnet/jaxb2_commons/tests/issues/Gh24Type.value.xml
@@ -0,0 +1,31 @@
+
+@org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked("jaxb2-annotate-plugin")
diff --git a/jaxb-annotate-parent/tests/issues/src/main/resources/schema.xsd b/jaxb-annotate-parent/tests/issues/src/main/resources/schema.xsd
new file mode 100644
index 000000000..bcac7c7eb
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/main/resources/schema.xsd
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/Gh26Test.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/Gh26Test.java
new file mode 100644
index 000000000..62aea0899
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/Gh26Test.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.issues;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Field;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import org.junit.Test;
+
+public class Gh26Test {
+
+ @Test
+ public void fiedlYIsNotAnnotated() throws Exception {
+
+ Field yField = Gh26Type.class.getDeclaredField("y");
+ assertThat(yField.getAnnotation(XmlElement.class), is(nullValue()));
+ }
+}
diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/Gh36Test.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/Gh36Test.java
new file mode 100644
index 000000000..1bba055eb
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/Gh36Test.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.issues;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Method;
+
+import org.junit.Test;
+
+import com.fasterxml.jackson.annotation.JsonView;
+
+public class Gh36Test {
+
+ @Test
+ public void getAttrMethodIsCorrectlyAnnotated() throws Exception {
+
+ Method getAttrMethod = Gh36Type.class.getDeclaredMethod("getAttr");
+ JsonView actualAnnotation = getAttrMethod.getAnnotation(JsonView.class);
+
+ assertThat(actualAnnotation, is(notNullValue()));
+ assertThat(actualAnnotation.value(), is(equalTo(new Class[]{Object.class})));
+ }
+}
diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotate/target/enum_fromValue_method/IssueGH11AnnotateTargetEnumFromValueMethodTest.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotate/target/enum_fromValue_method/IssueGH11AnnotateTargetEnumFromValueMethodTest.java
new file mode 100644
index 000000000..fd7f05a08
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotate/target/enum_fromValue_method/IssueGH11AnnotateTargetEnumFromValueMethodTest.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.issues._enum.annotate.target.enum_fromValue_method;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Method;
+
+import org.junit.Test;
+import org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked;
+
+public class IssueGH11AnnotateTargetEnumFromValueMethodTest {
+
+ @Test
+ public void fromValueMethodShouldBeAnnotated() throws Exception {
+ String expectedValue = "annotate.target.enum-fromValue-method";
+
+ Method fromValueMethod = IssueGH11AnnotateTargetEnumFromValueMethodType.class.getDeclaredMethod("fromValue", String.class);
+ Marked actualAnnotation = fromValueMethod.getAnnotation(Marked.class);
+
+ assertThat(actualAnnotation, is(notNullValue()));
+ assertThat(actualAnnotation.value(), is(equalTo(expectedValue)));
+ }
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotate/target/enum_value_method/IssueGH11AnnotateTargetEnumValueMethodTest.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotate/target/enum_value_method/IssueGH11AnnotateTargetEnumValueMethodTest.java
new file mode 100644
index 000000000..4b620fd77
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotate/target/enum_value_method/IssueGH11AnnotateTargetEnumValueMethodTest.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.issues._enum.annotate.target.enum_value_method;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Method;
+
+import org.junit.Test;
+import org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked;
+
+public class IssueGH11AnnotateTargetEnumValueMethodTest {
+
+ @Test
+ public void valueMethodShouldBeAnnotated() throws Exception {
+ String expectedValue = "annotate.target.enum-value-method";
+
+ Method valueMethod = IssueGH11AnnotateTargetEnumValueMethodType.class.getDeclaredMethod("value");
+ Marked actualAnnotation = valueMethod.getAnnotation(Marked.class);
+
+ assertThat(actualAnnotation, is(notNullValue()));
+ assertThat(actualAnnotation.value(), is(equalTo(expectedValue)));
+ }
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotateEnumFromValueMethod/IssueGH11AnnotateEnumFromValueMethodTypeTest.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotateEnumFromValueMethod/IssueGH11AnnotateEnumFromValueMethodTypeTest.java
new file mode 100644
index 000000000..8d6b31c6a
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotateEnumFromValueMethod/IssueGH11AnnotateEnumFromValueMethodTypeTest.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.issues._enum.annotateEnumFromValueMethod;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Method;
+
+import org.junit.Test;
+import org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked;
+
+public class IssueGH11AnnotateEnumFromValueMethodTypeTest {
+
+ @Test
+ public void fromValueMethodShouldBeAnnotated() throws Exception {
+ String expectedValue = "annotateEnumFromValueMethod";
+
+ Method fromValueMethod = IssueGH11AnnotateEnumFromValueMethodType.class.getDeclaredMethod("fromValue", String.class);
+ Marked actualAnnotation = fromValueMethod.getAnnotation(Marked.class);
+
+ assertThat(actualAnnotation, is(notNullValue()));
+ assertThat(actualAnnotation.value(), is(equalTo(expectedValue)));
+ }
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotateEnumValueMethod/IssueGH11AnnotateEnumValueMethodTypeTest.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotateEnumValueMethod/IssueGH11AnnotateEnumValueMethodTypeTest.java
new file mode 100644
index 000000000..80b3d961c
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/_enum/annotateEnumValueMethod/IssueGH11AnnotateEnumValueMethodTypeTest.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.issues._enum.annotateEnumValueMethod;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Method;
+
+import org.junit.Test;
+import org.jvnet.jaxb2_commons.plugin.annotate.tests.annotations.Marked;
+
+public class IssueGH11AnnotateEnumValueMethodTypeTest {
+
+ @Test
+ public void valueMethodShouldBeAnnotated() throws Exception {
+ String expectedValue = "annotateEnumValueMethod";
+
+ Method valueMethod = IssueGH11AnnotateEnumValueMethodType.class.getDeclaredMethod("value");
+ Marked actualAnnotation = valueMethod.getAnnotation(Marked.class);
+
+ assertThat(actualAnnotation, is(notNullValue()));
+ assertThat(actualAnnotation.value(), is(equalTo(expectedValue)));
+ }
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/tests/Issue1Test.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/tests/Issue1Test.java
new file mode 100644
index 000000000..bee0e103f
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/tests/Issue1Test.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.issues.tests;
+
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.jvnet.jaxb2_commons.tests.issues.ObjectFactory;
+
+public class Issue1Test {
+
+ @Test
+ public void testPackageInfoIsAnnotated() {
+ final XmlSchema xmlSchema = ObjectFactory.class.getPackage()
+ .getAnnotation(XmlSchema.class);
+ Assert.assertEquals(XmlNsForm.QUALIFIED, xmlSchema.elementFormDefault());
+ }
+
+}
diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/tests/RunIssuesPlugin.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/tests/RunIssuesPlugin.java
new file mode 100644
index 000000000..fd1d68a44
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/tests/RunIssuesPlugin.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.issues.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo;
+import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo;
+
+public class RunIssuesPlugin extends RunXJC2Mojo {
+
+ @Override
+ protected void configureMojo(AbstractXJC2Mojo mojo) {
+ super.configureMojo(mojo);
+ mojo.setExtension(true);
+ mojo.setForceRegenerate(true);
+ }
+
+ @Override
+ public List getArgs() {
+ final List args = new ArrayList(super.getArgs());
+ args.add("-Xannotate");
+ return args;
+ }
+
+}
diff --git a/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/tests/RunPlugins.java b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/tests/RunPlugins.java
new file mode 100644
index 000000000..596feebfd
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/tests/RunPlugins.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.issues.tests;
+
+import java.io.File;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.sun.codemodel.JCodeModel;
+import com.sun.tools.xjc.ConsoleErrorReporter;
+import com.sun.tools.xjc.ModelLoader;
+import com.sun.tools.xjc.Options;
+import com.sun.tools.xjc.model.Model;
+
+public class RunPlugins {
+
+ @Before
+ public void setUp() {
+ System.setProperty("javax.xml.accessExternalSchema", "all");
+ }
+
+ @Test
+ public void compilesSchema() throws Exception {
+
+ new File("target/generated-sources/xjc").mkdirs();
+
+ String schemaDirectory = new File(getClass().getResource("/schema.xsd")
+ .toURI()).getParentFile().getAbsolutePath();
+ String bindingDirectory = new File(getClass().getResource(
+ "/binding.xjb").toURI()).getParentFile().getAbsolutePath();
+ final String[] arguments = new String[] { "-xmlschema",
+ schemaDirectory, "-b", bindingDirectory, "-d",
+ "target/generated-sources/xjc", "-extension", "-Xannotate"
+
+ };
+
+ Options options = new Options();
+ options.parseArguments(arguments);
+ ConsoleErrorReporter receiver = new ConsoleErrorReporter();
+ Model model = ModelLoader.load(options, new JCodeModel(), receiver);
+ model.generateCode(options, receiver);
+ com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
+ model.codeModel.build(cw);
+ }
+}
diff --git a/jaxb-annotate-parent/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml b/jaxb-annotate-parent/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml
new file mode 100644
index 000000000..9d9c6c689
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_0.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml b/jaxb-annotate-parent/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml
new file mode 100644
index 000000000..2158c0617
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_1.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml b/jaxb-annotate-parent/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml
new file mode 100644
index 000000000..f2e24edd4
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/resources/org/jvnet/jaxb2_commons/tests/issues/issueJIIB44_2.xml
@@ -0,0 +1,38 @@
+
+
+ a
+ b
+ 0
+ c
+ 1
+ 2
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/issues/src/test/samples/issue16[0].xml b/jaxb-annotate-parent/tests/issues/src/test/samples/issue16[0].xml
new file mode 100644
index 000000000..916fdef48
--- /dev/null
+++ b/jaxb-annotate-parent/tests/issues/src/test/samples/issue16[0].xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/one/.gitignore b/jaxb-annotate-parent/tests/one/.gitignore
new file mode 100644
index 000000000..f66a28914
--- /dev/null
+++ b/jaxb-annotate-parent/tests/one/.gitignore
@@ -0,0 +1,4 @@
+/target
+.settings
+.project
+.classpath
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/one/pom.xml b/jaxb-annotate-parent/tests/one/pom.xml
new file mode 100644
index 000000000..4bac8677a
--- /dev/null
+++ b/jaxb-annotate-parent/tests/one/pom.xml
@@ -0,0 +1,75 @@
+
+
+ 4.0.0
+
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-tests
+ 1.1.1-SNAPSHOT
+
+ jaxb2-annotate-plugin-test-one
+ jar
+ JAXB2 Annotate Plugin - Test [one]
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin-testing
+ test
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-annotate
+
+
+
+ test
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+
+ true
+
+ -Xannotate
+
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-annotate
+
+
+
+
+
+
+
diff --git a/jaxb-annotate-parent/tests/one/src/main/java/org/jvnet/jaxb2_commons/tests/one/CustomBooleanAdapter.java b/jaxb-annotate-parent/tests/one/src/main/java/org/jvnet/jaxb2_commons/tests/one/CustomBooleanAdapter.java
new file mode 100644
index 000000000..8151b0f07
--- /dev/null
+++ b/jaxb-annotate-parent/tests/one/src/main/java/org/jvnet/jaxb2_commons/tests/one/CustomBooleanAdapter.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.one;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+public class CustomBooleanAdapter extends XmlAdapter {
+ @Override
+ public Boolean unmarshal(String s) {
+ if("true".equals(s) || "false".equals(s)){
+ return Boolean.valueOf(s);
+ }
+ return null;
+
+ }
+
+ @Override
+ public String marshal(Boolean c) {
+ return c == null ? null : c.toString();
+ }
+}
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/one/src/main/resources/binding.xjb b/jaxb-annotate-parent/tests/one/src/main/resources/binding.xjb
new file mode 100644
index 000000000..a67123031
--- /dev/null
+++ b/jaxb-annotate-parent/tests/one/src/main/resources/binding.xjb
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxb-annotate-parent/tests/one/src/main/resources/schema.xsd b/jaxb-annotate-parent/tests/one/src/main/resources/schema.xsd
new file mode 100644
index 000000000..84cb77ff6
--- /dev/null
+++ b/jaxb-annotate-parent/tests/one/src/main/resources/schema.xsd
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @javax.xml.bind.annotation.XmlElement(type=java.lang.Boolean.class)
+ @javax.xml.bind.annotation.XmlSchemaType(name="boolean")
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/JavaTypeExampleTest.java b/jaxb-annotate-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/JavaTypeExampleTest.java
new file mode 100644
index 000000000..c31807796
--- /dev/null
+++ b/jaxb-annotate-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/JavaTypeExampleTest.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.one;
+
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class JavaTypeExampleTest {
+
+ @Test
+ public void rountripsBoolean() throws JAXBException {
+ final JAXBContext context = JAXBContext
+ .newInstance(JavaTypeExample.class);
+
+ final JavaTypeExample value = new JavaTypeExample();
+ value.setCustomBooleanProperty(true);
+ final StringWriter sw = new StringWriter();
+ context.createMarshaller().marshal(
+ new JAXBElement(new QName("test"),
+ JavaTypeExample.class, value), sw);
+ Assert.assertTrue(sw.toString().contains(">true<"));
+// System.out.println(sw.toString());
+ }
+}
diff --git a/jaxb-annotate-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java b/jaxb-annotate-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java
new file mode 100644
index 000000000..6f2e9cdab
--- /dev/null
+++ b/jaxb-annotate-parent/tests/one/src/test/java/org/jvnet/jaxb2_commons/tests/one/RunOnePlugin.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright © 2005-2015, Alexey Valikov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those
+ * of the authors and should not be interpreted as representing official policies,
+ * either expressed or implied, of the FreeBSD Project.
+ */
+package org.jvnet.jaxb2_commons.tests.one;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jvnet.jaxb2.maven2.AbstractXJC2Mojo;
+import org.jvnet.jaxb2.maven2.test.RunXJC2Mojo;
+
+public class RunOnePlugin extends RunXJC2Mojo {
+
+ @Override
+ protected void configureMojo(AbstractXJC2Mojo mojo) {
+ super.configureMojo(mojo);
+ mojo.setExtension(true);
+ mojo.setForceRegenerate(true);
+ mojo.setDebug(false);
+ }
+
+ @Override
+ public List getArgs() {
+ final List args = new ArrayList(super.getArgs());
+ args.add("-XtoString");
+ args.add("-Xequals");
+ args.add("-XhashCode");
+ args.add("-Xcopyable");
+ args.add("-Xmergeable");
+ args.add("-Xinheritance");
+ args.add("-Xsetters");
+ args.add("-Xwildcard");
+ return args;
+ }
+
+}
diff --git a/jaxb-annotate-parent/tests/one/src/test/resources/log4j.properties b/jaxb-annotate-parent/tests/one/src/test/resources/log4j.properties
new file mode 100644
index 000000000..68586ddbd
--- /dev/null
+++ b/jaxb-annotate-parent/tests/one/src/test/resources/log4j.properties
@@ -0,0 +1,34 @@
+#
+# Copyright © 2005-2015, Alexey Valikov
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# The views and conclusions contained in the software and documentation are those
+# of the authors and should not be interpreted as representing official policies,
+# either expressed or implied, of the FreeBSD Project.
+#
+
+log4j.rootCategory=DEBUG, stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.target=system.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
\ No newline at end of file
diff --git a/jaxb-annotate-parent/tests/pom.xml b/jaxb-annotate-parent/tests/pom.xml
new file mode 100644
index 000000000..91dbd1729
--- /dev/null
+++ b/jaxb-annotate-parent/tests/pom.xml
@@ -0,0 +1,102 @@
+
+
+ 4.0.0
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-tests
+ pom
+ JAXB2 Annotate Plugin - Tests
+
+ org.jvnet.jaxb2_commons
+ jaxb2-annotate-plugin-project
+ 1.1.1-SNAPSHOT
+ ../pom.xml
+
+
+ annotations
+ annox
+ annotate
+ issues
+ one
+
+
+
+ org.glassfish.jaxb
+ jaxb-core
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-runtime
+
+
+ org.jvnet.jaxb2_commons
+ jaxb2-basics-testing
+ test
+
+
+
+ test
+
+
+
+ org.jvnet.jaxb2.maven2
+ maven-jaxb2-plugin
+
+
+ generate
+
+ generate
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index b5aaad79a..e3472bffa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,7 @@
jaxb-bom-parent
+ jaxb-annotate-parent
jaxb-annox-parent
maven-plugin
basics
diff --git a/qrelease.bat b/qrelease.bat
new file mode 100644
index 000000000..423faea60
--- /dev/null
+++ b/qrelease.bat
@@ -0,0 +1,108 @@
+@REM
+@REM Copyright © 2005-2015, Alexey Valikov
+@REM All rights reserved.
+@REM
+@REM Redistribution and use in source and binary forms, with or without
+@REM modification, are permitted provided that the following conditions are met:
+@REM
+@REM 1. Redistributions of source code must retain the above copyright notice, this
+@REM list of conditions and the following disclaimer.
+@REM 2. Redistributions in binary form must reproduce the above copyright notice,
+@REM this list of conditions and the following disclaimer in the documentation
+@REM and/or other materials provided with the distribution.
+@REM
+@REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+@REM ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+@REM WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+@REM DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+@REM ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+@REM (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+@REM LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+@REM ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+@REM (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+@REM SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+@REM
+@REM The views and conclusions contained in the software and documentation are those
+@REM of the authors and should not be interpreted as representing official policies,
+@REM either expressed or implied, of the FreeBSD Project.
+@REM
+
+setlocal
+echo Setting JAVA_HOME to %JAVA9_HOME%.
+set JAVA_HOME=%JAVA9_HOME%
+
+echo Performing a full clean build.
+rem pause
+call mvn clean install -Pall,sonatype-oss-release -DperformRelease
+echo Full clean build completed.
+rem pause
+
+echo Setting new version to %1.
+rem pause
+call mvn versions:set -Pall -DnewVersion=%1
+echo Version was set to %1.
+rem pause
+call mvn versions:commit -Pall
+echo Version %1 committed.
+rem pause
+
+echo Performing a full clean build.
+rem pause
+call mvn clean install -Pall,sonatype-oss-release -DperformRelease
+echo Full clean build completed.
+rem pause
+
+echo Checking in version %1.
+rem pause
+git commit -a -m "Version %1"
+echo Version %1 was checked in.
+rem pause
+
+echo Tagging version %1.
+rem pause
+git tag -a %1 -m "Version %1"
+echo Version %1 was tagged.
+rem pause
+
+echo Pushing version %1.
+rem pause
+git push origin master
+git push --tags origin master
+echo Version %1 was pushed.
+rem pause
+
+echo Performing full clean deploy.
+rem pause
+call mvn -DperformRelease -Pall,sonatype-oss-release clean deploy
+echo Full clean deploy done.
+rem pause
+
+echo Setting new version to %2.
+rem pause
+call mvn versions:set -Pall -DnewVersion=%2
+echo Version was set to %2.
+rem pause
+call mvn versions:commit -Pall
+echo Version %2 was committed.
+rem pause
+
+echo Performing a full clean build.
+rem pause
+call mvn clean install -DperformRelease -Pall,sonatype-oss-release
+echo Full clean build completed.
+rem pause
+
+echo Checking in version %2.
+rem pause
+git commit -a -m "Version %2"
+echo Version %2 was checked in.
+rem pause
+
+echo Pushing version %2.
+rem pause
+git push origin master
+git push --tags origin master
+echo Version %2 was pushed.
+rem pause
+
+endlocal
\ No newline at end of file