Skip to content
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

Rewrite Java Doc logic with JDK 17 compatible APIs #902

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

JoeJoe1989
Copy link
Contributor

@JoeJoe1989 JoeJoe1989 commented May 8, 2023

Currently RestLi is using com.sun.javadoc APIs to generate Java Doc. However these APIs are removed in JDK 17, making RestLi and its consumers incompatible with JDK 17. This PR aims to address the issue by rewriting Java Doc related logic with JDK 17 compatible APIs based on migration doc.

Given that the current RestLi is built in JDK 8 while the replacement APIs were introduced in JDK 9 (and remain compatible through JDK 17), we would need to build RestLi in newer JDK version to leverage the replacement APIs. More specifically, JDK 11 is chosen for the build since it is the next LTS version after JDK 9. This would also require a major version bump of RestLi because of the use of APIs after JDK 8 and the resulting compatibility with JDK 8 consumers.

Build passed locally:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk11.0.13.8-msft.jdk/Contents/Home/
./gradle build

Also tested the local snapshot of RestLi against Java 11 and Java 17 consumers.

Yan Zhou and others added 5 commits May 8, 2023 10:35
… spec.

Fixing it to not override the content-length if the request is HEADER type.
It is possible to cause a `ConcurrentModificationException` in the
`RequestContext` because we synchronize it by using
`Collections.synchronizedMap()`, which only synchronizes individual
reads/writes. When making a `RequestContext` copy we must iterate over
the collection, allowing other threads to interrupt it by modifying the
map during the operation.

This fix synchronizes the whole copy operation as well. The default
mutex used for synchronizing in a `SynchronizedMap` is `this`, so
synchronizing on the map itself guards against modification.
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.

3 participants