This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 151845 - JAXB class regeneration and clean/build different
Summary: JAXB class regeneration and clean/build different
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker with 1 vote (vote)
Assignee: Tomas Zezula
: 163169 (view as bug list)
Depends on:
Blocks: 152191 188614
  Show dependency tree
Reported: 2008-10-30 12:04 UTC by dlatt
Modified: 2013-08-24 08:04 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Attachments source file to unmarshal the xml file (679 bytes, text/plain)
2008-10-30 12:06 UTC, dlatt
Test schema (797 bytes, text/plain)
2008-10-30 12:07 UTC, dlatt
Test XML file to unmarshal (304 bytes, text/plain)
2008-10-30 12:08 UTC, dlatt
Project with JAXB (18.19 KB, application/octet-stream)
2010-03-15 17:38 UTC, Milan Kuchtiak

Note You need to log in before you can comment on or make changes to this bug.
Description dlatt 2008-10-30 12:04:20 UTC
In NB 6.5 RC1 using Sun JDK 1.6.0_07, I created a JAXB binding with the wizard using the attached schema. After
unmarshalling the attached XML file using the attached java source, I expect the size of the list of Es to be 3. This is
the case when the JAXB classes are freshly created. After hitting clean and build, however, the list size is 0 (zero)!
After refreshing the schema in the project JAXB bindings node and regenerating the java code, unmarshalling works
correctly again.

The only difference between the 4 generated classes is the different order of createA and createAttString in

It makes no difference if I include the JAXB 2.1 library in the project settings or not.
Comment 1 dlatt 2008-10-30 12:06:45 UTC
Created attachment 72894 [details] source file to unmarshal the xml file
Comment 2 dlatt 2008-10-30 12:07:43 UTC
Created attachment 72895 [details]
Test schema
Comment 3 dlatt 2008-10-30 12:08:38 UTC
Created attachment 72896 [details]
Test XML file to unmarshal
Comment 4 dlatt 2008-10-30 16:10:57 UTC
The new 6.5 RC2 behaves differently, it depends on "Build on save".

With "Build on save" off, everything seems to work correctly.
With "Build on save" on, I cannot perform a "clean and build" because the JAXB class nt.A is not found at compile time.
The editor doesn't flag this error, however.
Comment 5 _ gmpatil 2008-10-30 21:26:40 UTC
With latest 6.5 RC build I am able to run after clean and build as "...niltest..." classes are in build directory.

Runtime results are interesting between "build on save" mode and normal mode!

When file is run in "Compile on Save mode", seems like "package-info.class" is created w/o actual annotation in it.

Just add below code to

Annotation[] as = A.class.getPackage().getAnnotations();
for (Annotation ann: as){
    System.out.println("Annotation:" + ann.toString());

Assigning to JavaSE project team to take a look at it.
Comment 6 Rastislav Komara 2009-02-03 10:58:13 UTC
Comment 7 Petr Jiricka 2009-05-14 10:31:46 UTC
We have the "generated sources" concept in NB 6.7, could it help with this issue?
Comment 8 Jan Lahoda 2009-08-20 10:01:36 UTC
Reassigning all moonko's java/source bugs to myself.
Comment 9 David Strupl 2010-03-15 16:16:49 UTC
JAXB gurus can you please re-evaluate this --- its been a while since this was reported ...
Comment 10 Milan Kuchtiak 2010-03-15 17:38:44 UTC
Created attachment 95207 [details]
Project with JAXB
Comment 11 Milan Kuchtiak 2010-03-15 17:41:58 UTC
The issue still exists. See the attached project.

To reproduce :

- Open project
- Clean project
- open in editor
- invoke Run (Context action) from editor (
Comment 12 Tomas Zezula 2011-01-18 10:37:08 UTC
*** Bug 163169 has been marked as a duplicate of this bug. ***
Comment 13 Tomas Zezula 2011-01-18 19:32:12 UTC
In fact there are two issues.

1st) The java.source - after running the cleaned project the java.source does not correctly recalculate errors. So it runs it and throws NoClassDefFound. Instead it should show the dialog that the project is broken and ask user if (s)he wants to run the project anyway. 

2nd) The jaxb issue - the jaxb generates files to build folder which are deleted during clean and obviously the run file (CoS run) does not success as the part of the project is missing. The java cannot help with this part. It's responsibilito of the Jaxb support to handle it. It can either disable the compile on save (like groovy) or it can implement it's own JavaRunner and generate these generated classes before build. This will slow down the CoS so the simpler solution (disable CoS) is probably better.

I am fixing the 1st problem as it's reported on Java. The second one should be reported to JaxB, but I don't know where it should belong. Please Petre create a new issue on it. Thanks
Comment 14 Tomas Zezula 2011-01-18 19:35:12 UTC
I've created a new issue #194446 to track the second problem.
Comment 15 Tomas Zezula 2011-01-18 19:40:41 UTC
The java part (problem 1) fixed in jet-main 126f763ff741
Comment 16 Quality Engineering 2011-01-22 06:17:19 UTC
Integrated into 'main-golden', will be available in build *201101220001* on (upload may still be in progress)
User: Tomas Zezula <>
Log: #151845:JAXB class regeneration and clean/build different
Comment 17 kleopatra 2013-08-24 08:04:53 UTC
The first (java) part might not be fixed or back again, at least the remedy (unselect "compile on save") is the same, see:

Standard javaSE project in Netbeans 7.4 beta, bundle from 14.7.2013, jdk-8-ea-bin-b102-windows-i586-08_aug_2013.exe - doesn't run if new java8 feature (lambda expression).