Skip to content

mrjar: Set @Target({..., MODULE}) in the root, and move module-info out.#246

Merged
cpovirk merged 2 commits into
jspecify:mainfrom
cpovirk:module-scoped-nullmarked-in-root
May 13, 2022
Merged

mrjar: Set @Target({..., MODULE}) in the root, and move module-info out.#246
cpovirk merged 2 commits into
jspecify:mainfrom
cpovirk:module-scoped-nullmarked-in-root

Conversation

@cpovirk

@cpovirk cpovirk commented May 10, 2022

Copy link
Copy Markdown
Collaborator

Fixes #245. But introduces a compile warning for users targeting old versions of Java, and introduces runtime problems if a user tries to read the annotations on @NullMarked itself.

Fixes #172. I didn't really need to do this in the same commit. I just happened to get things working that way first, and we've talked about at least trying this change, so here goes....

It's clear that there's no great option for MODULE. But given that we've already encountered problems in the wild with our old approach, let's try this new approach instead.

…o` out.

Fixes jspecify#245. But introduces a
compile warning for users targeting old versions of Java, and introduces
[runtime problems](https://bugs.openjdk.java.net/browse/JDK-8247797) if
a user tries to read _the annotations on `@NullMarked` itself_.

Fixes jspecify#172. I didn't really
need to do this in the same commit. I just happened to get things
working that way first, and we've talked about at least trying this
change, so here goes....

It's clear that there's no great option for `MODULE`. But given that
we've already encountered problems in the wild with our old approach,
let's try this new approach instead.

@KengoTODA KengoTODA left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I've learned a lot from related discussions.
Also thank you making the build script more easy-to-understand!

Comment thread build.gradle
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' apply false
id 'com.diffplug.spotless' version '6.1.0'
id 'net.ltgt.errorprone' version '2.0.2'
id 'org.javamodularity.moduleplugin' version '1.8.9'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Better to stop depending on this plugin, it seems their development is not so active recently. I sent a PR two months ago and there is still no reaction 😂

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that is good to know :)

Comment thread gradle/mrjar.gradle
Comment on lines +37 to +42
/*
* As discussed above, we compiled all the classes again. But all
* that we want to include under META-INF/versions/9 is the
* module-info.
*/
include 'module-info.class'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Great comment, it will help us to understand the intention of this build script.

@cpovirk cpovirk merged commit 582473a into jspecify:main May 13, 2022
@cpovirk cpovirk deleted the module-scoped-nullmarked-in-root branch May 13, 2022 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make sure that our multi-release jar actually lets people use module-scope @NullMarked Move module-info.java to multi-release jar Java 9+ directory

2 participants