XJC - non-deterministic codegeneration?
Hello,
when binding xml-to-java classes via the com.sun.tools.xjc.api-package I recognized that the code generated differs each time the build-job is started!
The content in general stays the same, but for example the method-, member-order or the order of annotations for a method varies....
The most significant changes happen in the ObjectFactory generated.
(The code even changes if I generate it twice a minute! Of course the use schema is not changed.)
This is a problem for me since I need to compare the generated classes to a CVS-checkout (binary-diff). Due to the changes in order a simple diff always fails and causes the CVS to throw everything away....
Until now I thought compilers were deterministic.... But I've been proven wrong!
E.g.
First run:
publicclass ObjectFactory{
public ObjectFactory(){
}
/**
* Create an instance of {@link XML.ENGINE.NONLLP }
*/
public XML.ENGINE.NONLLP createXMLENGINENONLLP(){
returnnew XML.ENGINE.NONLLP();
}
/**
* Create an instance of {@link XML }
*/
public XML createXML(){
returnnew XML();
}
/**
* Create an instance of {@link XML.HEADER }
*/
public XML.HEADER createXMLHEADER(){
returnnew XML.HEADER();
}
/**
* Create an instance of {@link XML.ENGINE.LLP }
*/
public XML.ENGINE.LLP createXMLENGINELLP(){
returnnew XML.ENGINE.LLP();
}
/**
* Create an instance of {@link XML.ENGINE }
*/
public XML.ENGINE createXMLENGINE(){
returnnew XML.ENGINE();
}
/**
* Create an instance of {@link XML.AIRCRAFT }
*/
public XML.AIRCRAFT createXMLAIRCRAFT(){
returnnew XML.AIRCRAFT();
}
}
Second run:
publicclass ObjectFactory{
public ObjectFactory(){
}
/**
* Create an instance of {@link XML.ENGINE.LLP }
*/
public XML.ENGINE.LLP createXMLENGINELLP(){
returnnew XML.ENGINE.LLP();
}
/**
* Create an instance of {@link XML.AIRCRAFT }
*/
public XML.AIRCRAFT createXMLAIRCRAFT(){
returnnew XML.AIRCRAFT();
}
/**
* Create an instance of {@link XML.ENGINE }
*/
public XML.ENGINE createXMLENGINE(){
returnnew XML.ENGINE();
}
/**
* Create an instance of {@link XML.ENGINE.NONLLP }
*/
public XML.ENGINE.NONLLP createXMLENGINENONLLP(){
returnnew XML.ENGINE.NONLLP();
}
/**
* Create an instance of {@link XML.HEADER }
*/
public XML.HEADER createXMLHEADER(){
returnnew XML.HEADER();
}
/**
* Create an instance of {@link XML }
*/
public XML createXML(){
returnnew XML();
}
}
Any ideas what might cause this strange behavior?
For me it looks a bit like a multi-threading effect...?
Any ideas how to solve that issue?
(Any parameters I could set or something like that?)

