model.generateCode( xjcOpts, errorReceiver );
MapVfsCodeWriter codeWriter = new MapVfsCodeWriter();
model.codeModel.build( xjcOpts.createCodeWriter( codeWriter ) );
MemoryResourceReader src = new MemoryResourceReader();
boolean useProjectClassLoader = kBuilder.getRootClassLoader() instanceof ProjectClassLoader;
List<String> classNames = new ArrayList<String>();
List<String> srcNames = new ArrayList<String>();
for ( Entry<String, byte[]> entry : codeWriter.getMap().entrySet() ) {
String name = entry.getKey();
int dotPos = name.lastIndexOf( '.' );
String pkgName = name.substring( 0, dotPos );
if ( !name.endsWith( "package-info.java" ) ) {
classNames.add( pkgName );
}
dotPos = pkgName.lastIndexOf( '.' );
if ( dotPos != -1 ) {
pkgName = pkgName.substring( 0, dotPos );
}
PackageRegistry pkgReg = kBuilder.getPackageRegistry( pkgName );
if ( pkgReg == null ) {
kBuilder.addPackage( new PackageDescr( pkgName ) );
pkgReg = kBuilder.getPackageRegistry( pkgName );
}
if (useProjectClassLoader) {
String srcName = convertToResource( entry.getKey() );
src.add( srcName, entry.getValue() );
srcNames.add( srcName );
} else {
JavaDialect dialect = (JavaDialect) pkgReg.getDialectCompiletimeRegistry().getDialect( "java" );
dialect.addSrc( convertToResource( entry.getKey() ),
entry.getValue() );