JDK-8149506 : jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java generates files in source directory
  • Type: Bug
  • Component: xml
  • Sub-Component: jaxb
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2016-02-10
  • Updated: 2016-05-25
  • Resolved: 2016-05-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Description
This test generates files in the test source directory, which is generally a bad thing to do.

Test:
jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java

Files:
$ hg status -R jdk
? test/javax/xml/bind/xjc/8032884/generated/Foo.java
? test/javax/xml/bind/xjc/8032884/generated/ObjectFactory.java
? test/javax/xml/bind/xjc/8032884/generated/package-info.java

In particular, as shown, they show up as unknown files for Mercurial. Yes, they could be .hgignore'd, but it would be better to follow the normal rules and write temporary files to the scratch directory.

The problem is in this script:
jdk/test/javax/xml/bind/xjc/8032884/compile-schema.sh
which contains these lines:

echo "compiling [optional-property-schema.xsd] schema ..."
$TESTJAVA/bin/xjc -p generated -d ${TESTSRC} ${TESTSRC}/optional-property-schema.xsd

It may be writing the files to the ${TESTSRC} directory in order to leverage jtreg's ability to compile the classes and run them with the test.  The easiest workaround is to compile the generated classes, and compile and run the test classes from the script.  A better solution would be to eliminate the script and do everything in a test class written in Java.