METAGEN-14

This commit is contained in:
Hardy Ferentschik 2010-01-26 18:06:40 +00:00 committed by Strong Liu
parent 6f3b00354d
commit 19d68006f3
1 changed files with 2 additions and 6 deletions

View File

@ -39,7 +39,6 @@ public class ClassWriter {
public static void writeFile(MetaEntity entity, Context context) { public static void writeFile(MetaEntity entity, Context context) {
try { try {
String metaModelPackage = entity.getPackageName(); String metaModelPackage = entity.getPackageName();
StringBuffer body = generateBody( entity, context ); StringBuffer body = generateBody( entity, context );
FileObject fo = context.getProcessingEnvironment().getFiler().createSourceFile( FileObject fo = context.getProcessingEnvironment().getFiler().createSourceFile(
@ -49,11 +48,8 @@ public class ClassWriter {
PrintWriter pw = new PrintWriter( os ); PrintWriter pw = new PrintWriter( os );
pw.println( "package " + metaModelPackage + ";" ); pw.println( "package " + metaModelPackage + ";" );
pw.println(); pw.println();
pw.println( entity.generateImports() ); pw.println( entity.generateImports() );
pw.println( body ); pw.println( body );
pw.flush(); pw.flush();
@ -62,7 +58,7 @@ public class ClassWriter {
} }
catch ( FilerException filerEx ) { catch ( FilerException filerEx ) {
context.logMessage( context.logMessage(
Diagnostic.Kind.WARNING, "Problem with Processing Environment Filer: " + filerEx.getMessage() Diagnostic.Kind.ERROR, "Problem with Filer: " + filerEx.getMessage()
); );
} }
catch ( IOException ioEx ) { catch ( IOException ioEx ) {
@ -77,6 +73,7 @@ public class ClassWriter {
* Generate everything after import statements. * Generate everything after import statements.
* *
* @param entity The meta entity for which to write the body * @param entity The meta entity for which to write the body
* @param context The processing context
* *
* @return body content * @return body content
*/ */
@ -111,7 +108,6 @@ public class ClassWriter {
final TypeMirror superClass = entity.getTypeElement().getSuperclass(); final TypeMirror superClass = entity.getTypeElement().getSuperclass();
//superclass of Object is of NoType which returns some other kind //superclass of Object is of NoType which returns some other kind
String superclassDeclaration = "";
if ( superClass.getKind() == TypeKind.DECLARED ) { if ( superClass.getKind() == TypeKind.DECLARED ) {
//F..king Ch...t Have those people used their horrible APIs even once? //F..king Ch...t Have those people used their horrible APIs even once?
final Element superClassElement = ( ( DeclaredType ) superClass ).asElement(); final Element superClassElement = ( ( DeclaredType ) superClass ).asElement();