use of org.infinispan.protostream.annotations.impl.processor.types.MirrorTypeFactory in project protostream by infinispan.
the class CompileTimeProtoSchemaGenerator method getAdapterFor.
@Override
protected XClass getAdapterFor(XClass annotatedClass) {
ProtoAdapter protoAdapter;
try {
protoAdapter = annotatedClass.getAnnotation(ProtoAdapter.class);
if (protoAdapter == null) {
return null;
}
} catch (ClassCastException e) {
// javac soiling pants
throw new ProtoSchemaBuilderException("The class referenced by the ProtoAdapter annotation " + "does not exist, possibly due to compilation errors in your source code or due to " + "incremental compilation issues caused by your build system. Please try a clean rebuild.");
}
// TODO [anistor] also ensure that typeMirror is not part of current serCtxInit and is not scanned for @ProtoXyz annotations even if present
TypeMirror typeMirror = DangerousActions.getTypeMirror(protoAdapter, ProtoAdapter::value);
XClass target = ((MirrorTypeFactory) typeFactory).fromTypeMirror(typeMirror);
if (target == annotatedClass) {
throw new ProtoSchemaBuilderException(annotatedClass.getName() + " has an invalid @ProtoAdapter annotation pointing to self");
}
return target;
}
use of org.infinispan.protostream.annotations.impl.processor.types.MirrorTypeFactory in project protostream by infinispan.
the class AutoProtoSchemaBuilderAnnotationProcessor method init.
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
isDebugEnabled = Boolean.parseBoolean(processingEnv.getOptions().get(DEBUG_OPTION));
typeFactory = new MirrorTypeFactory(processingEnv);
types = processingEnv.getTypeUtils();
elements = processingEnv.getElementUtils();
filer = processingEnv.getFiler();
messager = processingEnv.getMessager();
generatedFilesWriter = new GeneratedFilesWriter(filer);
ensureRequiredEnv();
}
Aggregations