smallrye / smallrye-common

Common utilities for SmallRye

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

smallrye-common-annotation should expose a module-info

jponge opened this issue · comments

When compiling with the library as a dependency to Mutiny then I get the following warning because there is an auto-module:

[WARNING] *************************************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [smallrye-common-annotation-1.11.0.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] *************************************************************************************************************************************************************

I tried adding a simple module-info.java but then I got into problems with javax.

Note that I cannot omit referencing the annotations module from Mutiny or else Mutiny won't compile.

In the interim having an automatic module might do the job: #148

What kind of problem did you have with javax? Could you resolve it using requires static?

Also: I would recommend against using module-info.java. Maven does not process these properly; the JDK relies on the JAR tool to rewrite the corresponding module-info.class but Maven does not use the JAR tool. If we do provide a module descriptor, it should be done separately from javac using a tool like my module-info tool.

If I try adding:

module io.smallrye.common.annotation {
    exports io.smallrye.common.annotation;
}

then I get such compilation errors because of javax.enterprise:

[ERROR] /Users/jponge/Code/smallrye-common/annotation/src/main/java/io/smallrye/common/annotation/Identifier.java:[9,24] package javax.enterprise.util is not visible
  (package javax.enterprise.util is declared in the unnamed module, but module io.smallrye.common.annotation does not read it)
[ERROR] /Users/jponge/Code/smallrye-common/annotation/src/main/java/io/smallrye/common/annotation/Identifier.java:[10,13] package javax.inject is not visible
  (package javax.inject is declared in the unnamed module, but module io.smallrye.common.annotation does not read it)
[ERROR] /Users/jponge/Code/smallrye-common/annotation/src/main/java/io/smallrye/common/annotation/Identifier.java:[34,11] io.smallrye.common.annotation.Identifier.Literal is not abstract and does not override abstract method annotationType() in java.lang.annotation.Annotation

The project also needs to be bumped to Java 11 for the Maven compiler plugin, and the imports sorting plugin needs to be told to be Java 11 compliant.

If there's no easy way to have module info in that project without facing dependencies issues I'll just drop the dependency and re-internalize the 2 annotations we have in Mutiny.

I believe this is fixed with #155; if I'm wrong, please reopen.