}
if (type.isNovel()) {
String fullName = typeDescr.getType().getFullName();
JavaDialectRuntimeData dialect = (JavaDialectRuntimeData) pkgRegistry.getDialectRuntimeRegistry().getDialectData( "java" );
switch ( type.getKind() ) {
case TRAIT :
try {
ClassBuilder tb = ClassBuilderFactory.getTraitBuilderService();
byte[] d = tb.buildClass( def );
dialect.write( JavaDialectRuntimeData.convertClassToResourcePath( fullName ),
d );
} catch (Exception e) {
this.results.add( new TypeDeclarationError( "Unable to compile declared trait " + fullName +
": " +
e.getMessage() +
";",
typeDescr.getLine() ) );
}
break;
case ENUM :
try {
ClassBuilder eb = ClassBuilderFactory.getEnumClassBuilderService();
byte[] d = eb.buildClass( def );
dialect.write( JavaDialectRuntimeData.convertClassToResourcePath( fullName ),
d );
} catch ( Exception e ) {
e.printStackTrace();
this.results.add( new TypeDeclarationError( "Unable to compile declared enum " + fullName + ": " + e.getMessage() + ";",
typeDescr.getLine() ) );
}
break;
case CLASS :
default :
try {
ClassBuilder cb = ClassBuilderFactory.getBeanClassBuilderService();
byte[] d = cb.buildClass( def );
dialect.write( JavaDialectRuntimeData.convertClassToResourcePath( fullName ),
d );
} catch (Exception e) {
this.results.add( new TypeDeclarationError(
"Unable to create a class for declared type " + fullName +