Skip to content

[20+] fix warning 'The constructor Locale is deprecated since version 20'#1406

Closed
jukzi wants to merge 2 commits intoeclipse-platform:masterfrom
jukzi:Locale
Closed

[20+] fix warning 'The constructor Locale is deprecated since version 20'#1406
jukzi wants to merge 2 commits intoeclipse-platform:masterfrom
jukzi:Locale

Conversation

@jukzi
Copy link
Copy Markdown
Contributor

@jukzi jukzi commented Jun 4, 2024

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 4, 2024

Test Results

1 262 files   -   631  1 262 suites   - 631   57m 10s ⏱️ - 33m 39s
4 381 tests ±    0  4 333 ✅  -    24   48 💤 +24  0 ❌ ±0 
8 762 runs   - 4 381  8 643 ✅  - 4 333  119 💤  - 48  0 ❌ ±0 

Results for commit 61faa7c. ± Comparison against base commit 4ed0923.

This pull request skips 24 tests.
AutomatedResourceTests AllAliasTests BasicAliasTest ‑ testBug198571
AutomatedResourceTests AllFileSystemTests SymlinkTest ‑ testSymlinkPutHidden
AutomatedResourceTests AllLocalStoreTests MoveTest ‑ testMoveFileAcrossVolumes
AutomatedResourceTests AllLocalStoreTests MoveTest ‑ testMoveFolderAcrossVolumes
AutomatedResourceTests AllRegressionTests Bug_025457 ‑ testFile
AutomatedResourceTests AllRegressionTests Bug_025457 ‑ testFolder
AutomatedResourceTests AllRegressionTests Bug_025457 ‑ testProject
AutomatedResourceTests AllRegressionTests Bug_026294 ‑ testDeleteClosedProjectWindows
AutomatedResourceTests AllRegressionTests Bug_026294 ‑ testDeleteFolderWindows
AutomatedResourceTests AllRegressionTests Bug_026294 ‑ testDeleteOpenProjectWindows
…

♻️ This comment has been updated with latest results.

@jukzi jukzi changed the title fix warning 'The constructor Locale is deprecated since version 20' [20+] fix warning 'The constructor Locale is deprecated since version 20' Jun 4, 2024
@jukzi
Copy link
Copy Markdown
Contributor Author

jukzi commented Jun 13, 2024

i guess this has to wait until BREE>=20

@jukzi jukzi force-pushed the Locale branch 2 times, most recently from 2e62459 to 5d8f341 Compare January 13, 2025 10:36
jukzi pushed a commit to jukzi/eclipse.platform that referenced this pull request Jan 13, 2025
for
[20+] fix warning 'The constructor Locale is deprecated since version
20'
eclipse-platform#1406
@jukzi
Copy link
Copy Markdown
Contributor Author

jukzi commented Jan 14, 2025

@akurtakov how do we handle PRs where upgrading BREEE shows new warnings? here 30 * "The constructor URL(URL, String) is deprecated since version 20"

@akurtakov
Copy link
Copy Markdown
Member

akurtakov commented Jan 14, 2025

As long as the person merging/contributing plans to work on these new failures in the short term it should be fine as having huge PRs is also not nice for review. E.g. I merged #1676 and I'm now cleaning up after myself #1682.
I understand there will be cases that would not be fixable in the short term but these should be the exception not the norm.

@jukzi
Copy link
Copy Markdown
Contributor Author

jukzi commented Jan 14, 2025

I had already tried to work on URL(URL, String) but it introduced more regression then doing good. I think its because eclipse typically uses whitespace in URLs instead of %20 (#35).

@akurtakov
Copy link
Copy Markdown
Member

Getting rid of legacy mistakes is very lengthy process and most of the time it is not straightforward find and replace but requires some rearrangement of the code to make it better.
As there is no "silver bullet" - take an instanceof a problem, figure out a proper fix /repeat is what gives better results in so many ways like easier to figure what exactly broke, smaller patch to revert (if/when it comes to that) , easier to get suggestions on PR and learn smth (more people will look at a smaller patch and grasp it and will give up on huge one, @HannesWell gave me a very good suggestion in one such "minor PR" that I just make use of now to fix the ant.tests.ui warnings too) .
It's really slow this way and requires extra effort (I know it very well!) but it also generates less mistakes and helps us preserve the stability expected from Eclipse Platform while still advancing the project.
P.S. I would never chose this approach for leaf project like https://github.com/eclipse-linuxtools/org.eclipse.linuxtools/ but being in different place in the stack requires (totally) different workflow.

@merks
Copy link
Copy Markdown
Contributor

merks commented Jan 14, 2025

Yes, every time I see people wanting to replace the old URL constructor I need to warn them that it can and generally does cause problems because of URI being fussy about characters like the space and URL not caring at all. In EMF I just gave up on that and introduced this method so that the warning is in one place and if it ever needs to be fixed (they are not marked at to be removed) can be fixed in that one place:

  /**
   * Creates a URL.
   * @param literal the url literal.
   * @return the corresponding new URL.
   * @throws MalformedURLException
   *
   * @since 2.40
   */
  public static URL newURL(String literal) throws MalformedURLException
  {
    @SuppressWarnings("deprecation")
    URL url = new URL(literal);
    return url;
  }

@jukzi
Copy link
Copy Markdown
Contributor Author

jukzi commented Jan 14, 2025

introduced this method so that the warning is in one place

seems legit to me

@laeubi
Copy link
Copy Markdown
Contributor

laeubi commented Jan 14, 2025

Getting rid of legacy mistakes is very lengthy process and most of the time it is not straightforward find and replace but requires some rearrangement of the code to make it better.

I can only strongly second that. "Upgrading" to java 21 (or any future version) is not replacing one string constant with another it should include:

  1. Update project setting and JRE / BREE is just the simplest preparation
  2. Apply new cleanups so we can get rid of old code and really benefit from the upgrade
  3. Fix new warnings to not leave that daunting task to other for a quick win.

regarding the URL problem, the main issue is that URL is used where URI or even Path has to be used, String concatenation is used instead of proper resolve and escaping. So the best is to take the change to evaluate those places if an URL is really needed and properly used.

Beside that we have several URIUtil / URLUtil already in platform lingering around.

akurtakov pushed a commit to jukzi/eclipse.platform that referenced this pull request Mar 12, 2025
for
[20+] fix warning 'The constructor Locale is deprecated since version
20'
eclipse-platform#1406
@eclipse-platform-bot
Copy link
Copy Markdown
Contributor

eclipse-platform-bot commented Mar 12, 2025

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

update/org.eclipse.update.configurator/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From e8c7db66889bf973c1bce715d5e7e71f20db1a14 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Fri, 6 Jun 2025 09:00:58 +0000
Subject: [PATCH] Version bump(s) for 4.37 stream


diff --git a/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF b/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF
index d4025ed4a5..f106d88a29 100644
--- a/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF
+++ b/update/org.eclipse.update.configurator/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.update.configurator; singleton:=true
-Bundle-Version: 3.5.700.qualifier
+Bundle-Version: 3.5.800.qualifier
 Bundle-Activator: org.eclipse.update.internal.configurator.ConfigurationActivator
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
-- 
2.49.0

Further information are available in Common Build Issues - Missing version increments.

akurtakov pushed a commit to jukzi/eclipse.platform that referenced this pull request Jun 6, 2025
for
[20+] fix warning 'The constructor Locale is deprecated since version
20'
eclipse-platform#1406
Jörg Kubitz added 2 commits June 9, 2025 07:52
@akurtakov
Copy link
Copy Markdown
Member

This has conflicts with master now. I'm closing it and will prepare a separate PR to fix these.

@akurtakov akurtakov closed this Jun 25, 2025
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.

6 participants