Skip to content

Sources are missing for java 21 classes in MR-JAR structure #32119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andreiamariei opened this issue Jan 25, 2024 · 8 comments
Closed

Sources are missing for java 21 classes in MR-JAR structure #32119

andreiamariei opened this issue Jan 25, 2024 · 8 comments

Comments

@andreiamariei
Copy link

As part of #30241, java 21 classes were added following MR-JAR structure, e.g. org.springframework.core.task.VirtualThreadDelegate.

While these classes are part of the regular compiled .jar, they are missing from the sources/javadoc jars, making IDEs show the java 17 content, which is confusing.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 25, 2024
@bclozel
Copy link
Member

bclozel commented Jan 25, 2024

Thanks for the suggestion. That's not something we considered at all so far.

Can you share a link to the sources jar format expected by tools? Do you know which IDEs support this feature? Alternatively, pointing to another project that ships sources jars that are supported in your IDE would be a good start.

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label Jan 25, 2024
@andreiamariei
Copy link
Author

I'm new to Multi-Release jars, originally I reported this issue as the v21 .java file was missing from sources.jar, but .class file is present in regular .jar under META-INF/versions/21/... .

I investigated a bit more, and IntelliJ IDEA 2024.1 EAP adds some support for Multi-Release jars. For example, I can open with it the v21 VirtualThreadDelegate, just that it's showing the decompiled structure because of the missing java file. After manually adding the .java file to the sources.jar, IDEA 2024.1 EAP picked it up.

I think spring sources.jar should contain the .java file in the same directory structure where regular jar stores the classes. It might be limitation of the gradle plugin me.champeau.mrjar though

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 25, 2024
@snicoll snicoll changed the title Sources/Javadocs are missing for java 21 classes in MR-JAR structure Sources are missing for java 21 classes in MR-JAR structure Feb 2, 2024
@snicoll
Copy link
Member

snicoll commented Feb 2, 2024

As far as I can see there are no MR-JAR structure for source and/or javadoc that are concepts built on top of the regular archive. Maven doesn't seem to have any support for that, and so isn't Gradle. That said, given you've tested it, it wouldn't hurt to include the source there with the same structure.

@snicoll snicoll added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Feb 2, 2024
@snicoll snicoll added this to the 6.x Backlog milestone Feb 2, 2024
@simonbasle simonbasle self-assigned this Feb 5, 2024
@simonbasle
Copy link
Contributor

@andreiamariei can you clarify exactly how and where you manually added the Java 21 source file ?
I was able to quickly produce a -sources.jar which includes JDK 21-specific sources in META-INF/versions/21/ but IntelliJ 2024.1 EAP doesn't seem to pick it up. It does decompile the correct 21-specific .class though:
image

@simonbasle simonbasle added the status: waiting-for-feedback We need additional information before we can continue label Feb 5, 2024
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Feb 12, 2024
@spring-projects-issues
Copy link
Collaborator

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2024
@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Feb 19, 2024
@snicoll snicoll removed this from the 6.x Backlog milestone Feb 19, 2024
@snicoll snicoll removed the type: task A general task label Feb 19, 2024
@andreiamariei
Copy link
Author

I manually added the .java file into the .jar file using Total Commander, you can see the screenshot below how Intellij 2024.1 EAP shows the 21 version for me. Underlined in red is the location of the .java file. The blue selection is how Intellij navigates to it, which looks like a bug in Intellij. Could you update it to the latest version and try again?

image

@simonbasle
Copy link
Contributor

simonbasle commented Feb 22, 2024

I still cannot reproduce with version 2024.1 EAP (build 12662.62). I'm really not sure there's any intentional support in IDEA, could be a glitch or perfect circumstances that make it appear to work from your perspective...

In any case, there's no official specification for multi-release source jars so until we can refer to anything documented (on IDEA or Java side), we'll set this issue aside.

Feel free to re-open or create a new issue if some kind of official support is announced and documented in the future.

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

No branches or pull requests

5 participants