Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8199653

Wrong order of access modifiers in generated ObjectFactory.java

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      java -version
      java version "1.8.0_92"
      Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      3.0.101-107-default #1 SMP Thu Jun 22 14:37:55 UTC 2017 (414ea9f) x86_64 x86_64 x86_64 GNU/Linux

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      xjc -version
      xjc 2.3.0-b170531.0717


      A DESCRIPTION OF THE PROBLEM :
      When generating Java-classes with jaxb (xjc) the generated ObjectFactory contains fields with wrong order of access modifiers: "private final static" instead of "private static final", which results in SonarQube violation: "Reorder the modifiers to comply with the Java Language Specification."

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Generate java-classes from an xsd with xjc

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      private static final QName _Item_QNAME = new QName("", "item");


      ACTUAL -
       private final static QName _Item_QNAME = new QName("", "item");



      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      SonarQube violation: "Reorder the modifiers to comply with the Java Language Specification."

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      <?xml version="1.0" encoding="UTF-8" ?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="qualified">

      <xs:element name="item" type="xs:string">
      </xs:element>

      </xs:schema>
      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            • Assignee:
              zli Zheng Jun Li
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: