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.
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 ObjectFactory.java. It makes no difference if I include the JAXB 2.1 library in the project settings or not.
Created attachment 72894 [details] Main.java source file to unmarshal the xml file
Created attachment 72895 [details] Test schema
Created attachment 72896 [details] Test XML file to unmarshal
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.
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 Main.java. 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.
Overtake.
We have the "generated sources" concept in NB 6.7, could it help with this issue?
Reassigning all moonko's java/source bugs to myself.
JAXB gurus can you please re-evaluate this --- its been a while since this was reported ...
Created attachment 95207 [details] Project with JAXB
The issue still exists. See the attached project. To reproduce : - Open project - Clean project - open Main.java in editor - invoke Run (Context action) from editor (Main.java)
*** Bug 163169 has been marked as a duplicate of this bug. ***
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
I've created a new issue #194446 to track the second problem.
The java part (problem 1) fixed in jet-main 126f763ff741
Integrated into 'main-golden', will be available in build *201101220001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/126f763ff741 User: Tomas Zezula <tzezula@netbeans.org> Log: #151845:JAXB class regeneration and clean/build different
The first (java) part might not be fixed or back again, at least the remedy (unselect "compile on save") is the same, see: http://stackoverflow.com/q/18406268/203657 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).