-
Notifications
You must be signed in to change notification settings - Fork 700
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
SOLR-17321: Bump minimum required Java version to 21 #2497
Conversation
For now two things pending
Feel free to push changes to this branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RE URL: If you have IntelliJ Ultimate edition (not sure if Community), you could do "Structural Replace" to find & replace systematically everywhere.
FYI as an ASF committer, you can get that edition for free -- https://www.jetbrains.com/shop/eform/apache?product=ALL
@@ -23,14 +23,14 @@ allprojects { prj -> | |||
prj.apply plugin: 'ca.cutterslade.analyze' | |||
|
|||
analyzeClassesDependencies { | |||
warnUsedUndeclared = false // means fail build if UsedUndeclared found | |||
warnUnusedDeclared = false // means fail build if UnusedDeclared found | |||
warnUsedUndeclared = true // means fail build if UsedUndeclared found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you updated booleans but not the explanatory comment. Why change this any way?
@@ -210,6 +211,7 @@ public void testAppendParam() { | |||
} | |||
|
|||
@Test | |||
@SuppressForbidden(reason = "java.net.URL ctors deprecated since Java 20") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be put at the class level once instead of most tests?
solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
Outdated
Show resolved
Hide resolved
solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
Outdated
Show resolved
Hide resolved
solr/core/src/test/org/apache/solr/response/transform/TestSubQueryTransformerDistrib.java
Outdated
Show resolved
Hide resolved
Ideally those are addressed for real, otherwise they will continue to linger. Could be a separate JIRA/PR. |
build.gradle
Outdated
rootProject.ext.minJavaVersionDefault = JavaVersion.VERSION_11 | ||
rootProject.ext.minJavaVersionSolrJ = JavaVersion.VERSION_11 | ||
rootProject.ext.minJavaVersionDefault = JavaVersion.VERSION_21 | ||
rootProject.ext.minJavaVersionSolrJ = JavaVersion.VERSION_21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Java 17 for SolrJ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see movement. I would prefer to see the Java deprecations fixed versus more suppress annotations!!! Excited for this.
+ URLEncoder.encode(url.toString(), UTF_8) | ||
+ "&literal.url=" | ||
+ URLEncoder.encode(url.toString(), UTF_8))); | ||
new URI( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you run tidy do some white space changes go away?
@@ -815,7 +820,7 @@ public void postFile(File file, OutputStream output, String type) throws Malform | |||
urlStr = | |||
appendParam(urlStr, "literal.id=" + URLEncoder.encode(file.getAbsolutePath(), UTF_8)); | |||
} | |||
url = new URL(urlStr); | |||
url = URI.create(urlStr).toURL(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious if using a URI would be better than constantly converting back to string? Maybe another pr...
Like always, Thanks for the air support. "Structural Replace" is a Game Changer! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be too much to ask to separate all this URL conversion stuff to a separate PR, ultimately being its own commit focused on exactly that? Needn't be another JIRA; needn't touch CHANGES.txt in that commit. If I had to do this, I'd start with the trick of taking a GitHub PR URL and adding the ".patch" (or maybe it's ".diff" for a different format) and then copy-paste into IntellIJ "Apply patch from Clipboard" and selectively exclude stuff unrelated at that point (or after).
@@ -102,8 +104,9 @@ public static String buildRequestUrl( | |||
return basePath + path; | |||
} | |||
|
|||
@SuppressForbidden(reason = "java.net.URL ctors deprecated since Java 20") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer need this suppress.
I need to learn that! Looks amazing! |
So SuppressForbidden is okay for now, and later on (Just after this one!) deal with removing it in a different PR? |
I suggest flipping the order. Prep the code for Java 21 compatibility
first so that we don't go adding SupressForbidden to many classes to only
then fix the issue later. i.e. visit these classes once not twice. You
know exactly how to fix it and have even starting doing so; it's not a
tricky matter. Again, IntelliJ will do much of the work.
…On Wed, Jun 5, 2024 at 8:55 AM Sanjay Dutt ***@***.***> wrote:
Would it be too much to ask to separate all this URL conversion stuff to a
separate PR, ultimately being its own commit focused on exactly that?
Needn't be another JIRA; needn't touch CHANGES.txt in that commit. If I had
to do this, I'd start with the trick of taking a GitHub PR URL and adding
the ".patch" (or maybe it's ".diff" for a different format) and then
copy-paste into IntellIJ "Apply patch from Clipboard" and selectively
exclude stuff unrelated at that point (or after).
So SuppressForbidden is okay for now, and later on (Just after this one!)
deal with removing it in a different PR?
—
Reply to this email directly, view it on GitHub
<#2497 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC4DTZJTS2ICJN2TM6AJZLZF4C77AVCNFSM6AAAAABIY26TRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBZG44TCMZZGA>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
Test case failing, on main branch as well!
|
References to JavaVersion (a Gradle class) like Searching for "Java 17" or "JDK 17" or similar searches or other versions can reveal stuff where maybe a change is needed. |
Setting different Java version for main and SolrJ resulting in error. Currently,
The api test cases not able to access the class,
Output
The version has changed for SolrJ and for api as well. However, as @dsmiley pointed out before that test classes for both of these project should point to 21. Still looking for a way How we can achieve that. |
https://issues.apache.org/jira/browse/SOLR-17321
We are upgrading the minimum Java version for Solr main branch to 21. However, at the same, It has been suggested to be not so aggressive with SolrJ (and thus solr-api, a dependency) Java version – setting it to 17.
Depreciated API
To not make any extra code changes below annotation were used:
However, at few places, for demonstration purpose, URL has been created via new suggested way instead of using the ctors:
Or,
Also, Bump up the ecj version to 3.37 and ca.cutterslade.analyze to 1.9.2.
Checklist
Please review the following and check all that apply:
main
branch../gradlew check
.