Dan Berindei created IPROTO-185:
-----------------------------------
Summary: Annotation processor should not process classes in other modules or
without annotations
Key: IPROTO-185
URL:
https://issues.redhat.com/browse/IPROTO-185
Project: Infinispan ProtoStream
Issue Type: Enhancement
Affects Versions: 4.4.0.Alpha4
Reporter: Dan Berindei
If I have a {{@ProtoField}} method returning an {{Object}}, the processor should log any
error saying that {{java.lang.Object}} is not marshallable.
Instead, it generates a marshaller for {{java.lang.Object}}.
But post-Jigsaw JVMs do not load {{java.lang}} classes from application jars, leading to
confusing runtime errors like this:
{noformat}
java.lang.NoClassDefFoundError:
java/lang/Object$___Marshaller_7cfc5a759c8f8d76ba63b427d975ad253085d80aa05aa8e1121221ae7d5d35cd
at
org.infinispan.spring.common.provider.PersistenceContextInitializerImpl.registerMarshallers(PersistenceContextInitializerImpl.java:56)
at
org.infinispan.marshall.protostream.impl.SerializationContextRegistryImpl$MarshallerContext.lambda$update$0(SerializationContextRegistryImpl.java:148)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at
org.infinispan.marshall.protostream.impl.SerializationContextRegistryImpl$MarshallerContext.update(SerializationContextRegistryImpl.java:146)
at
org.infinispan.marshall.protostream.impl.SerializationContextRegistryImpl.lambda$addContextInitializer$3(SerializationContextRegistryImpl.java:85)
at
org.infinispan.marshall.protostream.impl.SerializationContextRegistryImpl.update(SerializationContextRegistryImpl.java:105)
at
org.infinispan.marshall.protostream.impl.SerializationContextRegistryImpl.addContextInitializer(SerializationContextRegistryImpl.java:85)
{noformat}
I see 2 different problems:
1. {{java.lang.Object}} does not have any Protostream annotations, but the annotation
processor still creates a marshaller for it.
Creating marshallers for classes without annotations means when compiling a module
it's impossible to know which classes in that module will ever have marshallers.
2. Split packages do not work with Jigsaw modules.
Creating a marshaller in the same package but in a different jar is a problem not only for
{{java.lang.Object}} and {{java.util}} collection classes, but also for application
classes when using modular jars.
--
This message was sent by Atlassian Jira
(v8.13.1#813001)