Skip to content

Commit

Permalink
add changes to changelog, reformat code
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Oct 6, 2023
1 parent d1c27f9 commit 91eb4d4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
<listitem><para>
<link xlink:href="https://github.com/eclipse-ee4j/jaxb-ri/issues/1742">#1742</link>: Unexpected form=qualified Attribute in XSD Elements
</para></listitem>
<listitem><para>
<link xlink:href="https://github.com/eclipse-ee4j/jaxb-ri/issues/1748">#1748</link>: xjc: ElementOutlineImpl produces raw type
</para></listitem>
<listitem><para>
<link xlink:href="https://github.com/eclipse-ee4j/jaxb-ri/issues/1750">#1750</link>: xjc: ElementOutlineImpl omits serialVersionUID
</para></listitem>
</itemizedlist>
</para></listitem>
</itemizedlist>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023 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
Expand Down Expand Up @@ -93,24 +93,19 @@ public BeanGenerator parent() {
*
* @see <a href="https://github.com/eclipse-ee4j/jaxb-ri/issues/1750">Issue #1750</a>
*/
private void serializableOption(BeanGenerator bg, JDefinedClass implClass)
{
if (bg.getModel().serializable)
{
private void serializableOption(BeanGenerator bg, JDefinedClass implClass) {
if (bg.getModel().serializable) {
JClass serRef = bg.getCodeModel().ref(Serializable.class);
if ( !serRef.isAssignableFrom(implClass) )
if (!serRef.isAssignableFrom(implClass)) {
implClass._implements(Serializable.class);

if ( !implClass.fields().containsKey("serialVersionUID") )
{
if (bg.getModel().serialVersionUID != null)
{
}
if (!implClass.fields().containsKey("serialVersionUID") && (bg.getModel().serialVersionUID != null)) {
implClass.field(
JMod.PRIVATE | JMod.STATIC | JMod.FINAL,
bg.getCodeModel().LONG,
"serialVersionUID",
JExpr.lit(bg.getModel().serialVersionUID));
}
JMod.PRIVATE | JMod.STATIC | JMod.FINAL,
bg.getCodeModel().LONG,
"serialVersionUID",
JExpr.lit(bg.getModel().serialVersionUID));

}
}
}
Expand Down
10 changes: 4 additions & 6 deletions jaxb-ri/xjc/src/test/java/com/sun/tools/xjc/CodeGenTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023 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
Expand Down Expand Up @@ -82,16 +82,15 @@ public void testGh1460_Gh1064_jaxb21() throws Throwable {
}

/**
* Test issues #1748 and #1750 for {@link ElementOutlineImpl}.
* Test issues #1748 and #1750 for {@code com.sun.tools.xjc.generator.bean.ElementOutlineImpl}.
*
* @throws FileNotFoundException When the test schema file cannot be read.
* @throws URISyntaxException When the test {@link InputSource} cannot be parsed.
*
* @see <a href="https://github.com/eclipse-ee4j/jaxb-ri/issues/1748">Issue #1748</a>
* @see <a href="https://github.com/eclipse-ee4j/jaxb-ri/issues/1750">Issue #1750</a>
*/
public void testIssue1750() throws FileNotFoundException, URISyntaxException
{
public void testIssue1750() throws FileNotFoundException, URISyntaxException {
String schemaFileName = "/schemas/issue1750/schema.xsd";
String packageName = "org.example.issue1750";
String someClassName = packageName + ".SomeJAXBElement";
Expand All @@ -116,8 +115,7 @@ public void testIssue1750() throws FileNotFoundException, URISyntaxException

// Assert Class includes narrow type
Iterator<JMethod> conIter = dc.constructors();
while ( conIter.hasNext() )
{
while (conIter.hasNext()) {
JMethod con = conIter.next();
assertTrue(toString(con).contains("java.lang.Class<java.lang.String>"));
}
Expand Down
12 changes: 12 additions & 0 deletions jaxb-ri/xjc/src/test/resources/schemas/issue1750/schema.xsd
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (c) 2023 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
-->

<!-- See https://github.com/eclipse-ee4j/jaxb-ri/issues/1748 -->
<!-- See https://github.com/eclipse-ee4j/jaxb-ri/issues/1750 -->
<xs:schema
Expand Down

0 comments on commit 91eb4d4

Please sign in to comment.