Uploaded image for project: 'ProtoStream'
  1. ProtoStream
  2. IPROTO-185

Annotation processor should not process classes in other modules or without annotations

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 4.4.0.Alpha4
    • None
    • False
    • False
    • Undefined

      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:

      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)
      

      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.

              anistor Adrian Nistor (Inactive)
              dberinde@redhat.com Dan Berindei (Inactive)
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Archived: