add a test for #1590
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/jaxb-ri/runtime/impl/pom.xml b/jaxb-ri/runtime/impl/pom.xml
index 37f0a2f..4ff1e2a 100644
--- a/jaxb-ri/runtime/impl/pom.xml
+++ b/jaxb-ri/runtime/impl/pom.xml
@@ -34,6 +34,7 @@
<spotbugs.exclude>${project.basedir}/exclude-runtime.xml</spotbugs.exclude>
<argLine>
--add-opens org.glassfish.jaxb.runtime/org.glassfish.jaxb.runtime.v2=jakarta.xml.bind
+ --add-opens org.glassfish.jaxb.runtime/org.glassfish.jaxb.runtime.v2.runtime=jakarta.xml.bind
--add-opens org.glassfish.jaxb.runtime/org.glassfish.jaxb.runtime.v2=org.glassfish.jaxb.core
--add-opens org.glassfish.jaxb.runtime/org.glassfish.jaxb.runtime.v2.schemagen=org.glassfish.jaxb.core
--add-opens java.base/java.lang=org.glassfish.jaxb.runtime
diff --git a/jaxb-ri/runtime/impl/src/test/java/org/glassfish/jaxb/runtime/v2/runtime/ChildDTO.java b/jaxb-ri/runtime/impl/src/test/java/org/glassfish/jaxb/runtime/v2/runtime/ChildDTO.java
new file mode 100644
index 0000000..bd85b47
--- /dev/null
+++ b/jaxb-ri/runtime/impl/src/test/java/org/glassfish/jaxb/runtime/v2/runtime/ChildDTO.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package org.glassfish.jaxb.runtime.v2.runtime;
+
+import jakarta.xml.bind.annotation.XmlElement;
+import jakarta.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "child")
+public class ChildDTO extends ParentDTO {
+
+ @Override
+ @XmlElement(name="childName")
+ public String getName() {
+ return name;
+ }
+}
diff --git a/jaxb-ri/runtime/impl/src/test/java/org/glassfish/jaxb/runtime/v2/runtime/InheritanceTest.java b/jaxb-ri/runtime/impl/src/test/java/org/glassfish/jaxb/runtime/v2/runtime/InheritanceTest.java
new file mode 100644
index 0000000..b9f4363
--- /dev/null
+++ b/jaxb-ri/runtime/impl/src/test/java/org/glassfish/jaxb/runtime/v2/runtime/InheritanceTest.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package org.glassfish.jaxb.runtime.v2.runtime;
+
+import java.io.StringWriter;
+import jakarta.xml.bind.JAXBContext;
+import jakarta.xml.bind.Marshaller;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class InheritanceTest {
+
+ @Test
+ public void aTest() throws Throwable {
+ ChildDTO child = new ChildDTO();
+ child.setName("aaa");
+
+ final Marshaller marshaller = JAXBContext.newInstance(ChildDTO.class).createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ StringWriter stringWriter = new StringWriter();
+ marshaller.marshal(child, stringWriter);
+ String xmlAsString = stringWriter.toString();
+ Assert.assertFalse(xmlAsString.contains("parent"));
+ }
+}
diff --git a/jaxb-ri/runtime/impl/src/test/java/org/glassfish/jaxb/runtime/v2/runtime/ParentDTO.java b/jaxb-ri/runtime/impl/src/test/java/org/glassfish/jaxb/runtime/v2/runtime/ParentDTO.java
new file mode 100644
index 0000000..3667726
--- /dev/null
+++ b/jaxb-ri/runtime/impl/src/test/java/org/glassfish/jaxb/runtime/v2/runtime/ParentDTO.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0, which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+package org.glassfish.jaxb.runtime.v2.runtime;
+
+import jakarta.xml.bind.annotation.XmlElement;
+import jakarta.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "parent")
+public class ParentDTO {
+ protected String name;
+
+ @XmlElement(name="parentName")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}