Skip to content

Commit aede341

Browse files
committed
Java 21 deprecation fixes
* new Locale - Locale.of * Thread.getId -> Thread.threadId
1 parent a629637 commit aede341

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultTextDoubleClickStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2021 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -252,7 +252,7 @@ private BreakIterator getWordBreakIterator() {
252252
*/
253253
private BreakIterator getPOSIXWordBreakIterator() {
254254
if (fPOSIXWordBreakIterator == null) {
255-
fPOSIXWordBreakIterator= BreakIterator.getWordInstance(new Locale("en", "US", "POSIX")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
255+
fPOSIXWordBreakIterator= BreakIterator.getWordInstance(Locale.of("en", "US", "POSIX")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
256256
}
257257
return fPOSIXWordBreakIterator;
258258
}

bundles/org.eclipse.ui.monitoring/src/org/eclipse/ui/internal/monitoring/EventLoopMonitorThread.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (C) 2014, 2015 Google Inc and others.
2+
* Copyright (C) 2014, 2025 Google Inc and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -384,7 +384,7 @@ public EventLoopMonitorThread(Parameters args) throws IllegalArgumentException {
384384
setDaemon(true);
385385
setPriority(NORM_PRIORITY + 1);
386386
display = getDisplay();
387-
uiThreadId = this.display.getThread().getId();
387+
uiThreadId = this.display.getThread().threadId();
388388
longEventWarningThreshold = Math.max(args.longEventWarningThreshold, 3);
389389
longEventErrorThreshold = Math.max(args.longEventErrorThreshold, longEventWarningThreshold);
390390
maxLoggedStackSamples = Math.max(args.maxStackSamples, 0);
@@ -458,7 +458,7 @@ public void run() {
458458
MonitoringPlugin.logWarning(Messages.EventLoopMonitorThread_logging_disabled_error);
459459
}
460460

461-
monitoringThreadId = Thread.currentThread().getId();
461+
monitoringThreadId = Thread.currentThread().threadId();
462462
threadMXBean = ManagementFactory.getThreadMXBean();
463463
dumpLockedMonitors = threadMXBean.isObjectMonitorUsageSupported();
464464
dumpLockedSynchronizers = threadMXBean.isSynchronizerUsageSupported();

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/UILockListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2003, 2015 IBM Corporation and others.
2+
* Copyright (c) 2003, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -205,11 +205,11 @@ private void reportInterruption(Runnable runnable) {
205205
MultiStatus main = new MultiStatus(WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, msg, null);
206206

207207
ThreadInfo[] threads = ManagementFactory.getThreadMXBean()
208-
.getThreadInfo(new long[] { nonUiThread.getId(), display.getThread().getId() }, true, true);
208+
.getThreadInfo(new long[] { nonUiThread.threadId(), display.getThread().threadId() }, true, true);
209209

210210
for (ThreadInfo info : threads) {
211211
String childMsg;
212-
if (info.getThreadId() == nonUiThread.getId()) {
212+
if (info.getThreadId() == nonUiThread.threadId()) {
213213
// see org.eclipse.core.internal.jobs.LockManager.isLockOwner()
214214
childMsg = nonUiThread.getName() + " thread is an instance of Worker or owns an ILock"; //$NON-NLS-1$
215215
} else {

tests/org.eclipse.ui.monitoring.tests/src/org/eclipse/ui/internal/monitoring/DefaultLoggerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (C) 2014, 2015 Google Inc and others.
2+
* Copyright (C) 2014, 2025 Google Inc and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -61,7 +61,7 @@ private void createLogListener() {
6161

6262
private UiFreezeEvent createFreezeEvent() {
6363
ThreadMXBean jvmThreadManager = ManagementFactory.getThreadMXBean();
64-
thread = jvmThreadManager.getThreadInfo(Thread.currentThread().getId(), Integer.MAX_VALUE);
64+
thread = jvmThreadManager.getThreadInfo(Thread.currentThread().threadId(), Integer.MAX_VALUE);
6565

6666
StackSample[] samples = { new StackSample(TIME, new ThreadInfo[] { thread }) };
6767
return new UiFreezeEvent(TIME, DURATION, samples, false, false, false);

tests/org.eclipse.ui.monitoring.tests/src/org/eclipse/ui/internal/monitoring/FilterHandlerTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (C) 2014, 2022 Google Inc and others.
2+
* Copyright (C) 2014, 2025 Google Inc and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -35,12 +35,12 @@ public class FilterHandlerTests {
3535
"org.eclipse.ui.internal.monitoring.FilterHandlerTests.createFilteredStackSamples"
3636
+ ",org.eclipse.ui.internal.monitoring.SomeClass.someMethod"
3737
+ ",org.eclipse.ui.internal.monitoring.OtherClass.otherMethod";
38-
private static final long THREAD_ID = Thread.currentThread().getId();
38+
private static final long THREAD_ID = Thread.currentThread().threadId();
3939

4040
private StackSample[] createStackSamples() throws Exception {
4141
ThreadMXBean jvmThreadManager = ManagementFactory.getThreadMXBean();
4242
ThreadInfo threadInfo =
43-
jvmThreadManager.getThreadInfo(Thread.currentThread().getId(), Integer.MAX_VALUE);
43+
jvmThreadManager.getThreadInfo(Thread.currentThread().threadId(), Integer.MAX_VALUE);
4444
return new StackSample[] { new StackSample(0, new ThreadInfo[] { threadInfo }) };
4545
}
4646

@@ -77,7 +77,7 @@ public void testWildcardFilter() throws Exception {
7777
FilterHandler filterHandler = new FilterHandler("*.FilterHandlerTests.testW?ld*Filter");
7878
ThreadMXBean jvmThreadManager = ManagementFactory.getThreadMXBean();
7979
ThreadInfo threadInfo =
80-
jvmThreadManager.getThreadInfo(Thread.currentThread().getId(), Integer.MAX_VALUE);
80+
jvmThreadManager.getThreadInfo(Thread.currentThread().threadId(), Integer.MAX_VALUE);
8181
boolean matched = false;
8282
for (StackTraceElement element : threadInfo.getStackTrace()) {
8383
if (filterHandler.matchesFilter(element)) {

0 commit comments

Comments
 (0)