JetBrains / java-annotations

Annotations for JVM-based languages.
Apache License 2.0
404 stars 47 forks source link

Unify the module names of java8 and java5 modules #44

Closed Glavo closed 3 years ago

Glavo commented 3 years ago

Currently, java5 modules use different module name (org.jetbrains.annotations.java5).

This actually doesn't make any sense to the user——jigswa module names are only used in Java 9 or later, and the same package can only belong to one module. Using a unified module name can reduce the user's troubles without any negative impact.

amaembo commented 3 years ago

Java 9+ projects still can use old java5 annotations. For example, because migration to newer ones still has non-zero cost. Are different module names cause any troubles in your project? Could you provide more details why this change is necessary for you?

Glavo commented 3 years ago

A year ago, when I developed a Multi-Release Jar (Compatible with Java 5), this brought me a lot of problems. I can't remember the details of these problems, but it eventually forced me to release an internal version of java-annotations with a modified module name to solve these problems.

Using different module names has no value but also improves the cost of migration. In jigsaw, a package name should correspond to only one module name.

I think the cost of unifying the module name of java5 should be negligible, because until I open PR #19, java5 modules are not available in modular programs, and no one else raised this issue, which means that few users should rely on this behavior.

amaembo commented 3 years ago

Ok, implemented via e1f9f35d61521652abcb65d29cd3637ed4a344a1. It would be nice if you test the snapshot on your setup before we release a new version. Thanks.

1951FDG commented 3 years ago

This change however introduces a warning in Android Studio 4.1.3 when running gradle app:check

Error processing ~/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/21.0.1/3d8aebff2ddbcdcfab2c29e5975fc4cdf3bb9640/annotations-21.0.1.jar:META-INF/versions/9/module-info.class: broken class file? (This feature requires ASM6)

Can this warning be ignored? I've reverted to version 20.1.0 in the meantime.

amaembo commented 3 years ago

@1951FDG googling your error message yields this SO answer: https://stackoverflow.com/a/60719508/4856258 Hope this helps.