diff --git a/core/src/main/java/com/moparisthebest/mirror/apt/ConvertAnnotationProcessorEnvironment.java b/core/src/main/java/com/moparisthebest/mirror/apt/ConvertAnnotationProcessorEnvironment.java index 0c38a3b..0a69be4 100755 --- a/core/src/main/java/com/moparisthebest/mirror/apt/ConvertAnnotationProcessorEnvironment.java +++ b/core/src/main/java/com/moparisthebest/mirror/apt/ConvertAnnotationProcessorEnvironment.java @@ -70,6 +70,7 @@ public class ConvertAnnotationProcessorEnvironment implements AnnotationProcesso elements = internal.getElementUtils(); ConvertDeclaration.elements = elements; ConvertTypeMirror.types = internal.getTypeUtils(); + ConvertDeclaration.messager = ConvertTypeMirror.messager = internal.getMessager(); // now calculate options once, since they are sort-of expensive // real apt passes them back like so: diff --git a/core/src/main/java/com/moparisthebest/mirror/declaration/ConvertDeclaration.java b/core/src/main/java/com/moparisthebest/mirror/declaration/ConvertDeclaration.java index 4aa7bab..562fed6 100755 --- a/core/src/main/java/com/moparisthebest/mirror/declaration/ConvertDeclaration.java +++ b/core/src/main/java/com/moparisthebest/mirror/declaration/ConvertDeclaration.java @@ -26,13 +26,16 @@ import com.sun.mirror.util.DeclarationVisitor; import com.sun.mirror.util.SourcePosition; import com.moparisthebest.mirror.log.Debug; +import javax.annotation.processing.Messager; import javax.lang.model.element.*; import javax.lang.model.util.Elements; +import javax.tools.Diagnostic; import java.lang.annotation.Annotation; import java.util.*; public class ConvertDeclaration extends Convertable implements com.sun.mirror.declaration.Declaration { + public static Messager messager = null; public static Elements elements = null; protected final javax.lang.model.element.Element internalElement; @@ -106,12 +109,9 @@ public class ConvertDeclaration extends Convertable implem return (T) new ConvertParameterDeclaration((VariableElement) from); case FIELD: return (T) new ConvertFieldDeclaration((VariableElement) from); - default: - System.err.println("FATAL ERROR, REACHED DEFAULT!"); - System.exit(1); - //throw new RuntimeException("FATAL ERROR, REACHED DEFAULT!"); } // shouldn't ever get here + messager.printMessage(Diagnostic.Kind.ERROR, "ConvertDeclaration reached default for kind: " + from.getKind(), from); return (T) new ConvertDeclaration(from); } diff --git a/core/src/main/java/com/moparisthebest/mirror/type/ConvertTypeMirror.java b/core/src/main/java/com/moparisthebest/mirror/type/ConvertTypeMirror.java index 5c20e63..ee53bfc 100755 --- a/core/src/main/java/com/moparisthebest/mirror/type/ConvertTypeMirror.java +++ b/core/src/main/java/com/moparisthebest/mirror/type/ConvertTypeMirror.java @@ -22,12 +22,15 @@ import com.moparisthebest.mirror.convert.Convertable; import com.sun.mirror.util.TypeVisitor; import com.moparisthebest.mirror.log.Debug; +import javax.annotation.processing.Messager; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Types; +import javax.tools.Diagnostic; public class ConvertTypeMirror extends Convertable implements com.sun.mirror.type.TypeMirror { protected final javax.lang.model.type.TypeMirror internalTypeMirror; + public static Messager messager = null; public static Types types = null; protected ConvertTypeMirror(javax.lang.model.type.TypeMirror internalTypeMirror) { @@ -100,17 +103,15 @@ public class ConvertTypeMirror extends Convertable