Skip to content

Commit 6e402a2

Browse files
committed
Java 21 deprecation fixes
1 parent 5d71e17 commit 6e402a2

File tree

3 files changed

+9
-14
lines changed
  • ant/org.eclipse.ant.tests.core/test plugin/org/eclipse/ant/tests/core/testplugin
  • team
    • examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml
    • tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests

3 files changed

+9
-14
lines changed

ant/org.eclipse.ant.tests.core/test plugin/org/eclipse/ant/tests/core/testplugin/AntTestPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2006 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
@@ -54,7 +54,7 @@ public static void enableAutobuild(boolean enable) throws CoreException {
5454
public File getFileInPlugin(IPath path) {
5555
try {
5656
Bundle bundle = getDefault().getBundle();
57-
URL installURL = new URL(bundle.getEntry("/"), path.toString()); //$NON-NLS-1$
57+
URL installURL = bundle.getEntry("/" + path.toString()); //$NON-NLS-1$
5858
URL localURL = FileLocator.toFileURL(installURL);
5959
return new File(localURL.getFile());
6060
}

team/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2008 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
@@ -13,7 +13,6 @@
1313
*******************************************************************************/
1414
package org.eclipse.compare.examples.xml;
1515

16-
import java.net.MalformedURLException;
1716
import java.net.URL;
1817
import java.util.ArrayList;
1918
import java.util.HashMap;
@@ -114,12 +113,8 @@ protected ImageDescriptor getImageDescriptor(String relativePath) {
114113

115114
URL installURL= fgXMLPlugin.getBundle().getEntry("/"); //$NON-NLS-1$
116115
if (installURL != null) {
117-
try {
118-
URL url= new URL(installURL, "icons/full/" + relativePath); //$NON-NLS-1$
119-
return ImageDescriptor.createFromURL(url);
120-
} catch (MalformedURLException e) {
121-
Assert.isTrue(false);
122-
}
116+
URL url = fgXMLPlugin.getBundle().getEntry("/icons/full/" + relativePath); //$NON-NLS-1$
117+
return ImageDescriptor.createFromURL(url);
123118
}
124119
return null;
125120
}
@@ -252,8 +247,8 @@ public void setIdMaps(HashMap IdMap, HashMap IdExtensionToName, HashMap OrderedE
252247

253248
if (refresh) {
254249
Object[] viewers = fViewers.getListeners();
255-
for (int i = 0; i < viewers.length; ++i) {
256-
XMLStructureViewer viewer = (XMLStructureViewer) viewers[i];
250+
for (Object viewer2 : viewers) {
251+
XMLStructureViewer viewer = (XMLStructureViewer) viewer2;
257252
viewer.updateIdMaps();
258253
viewer.contentChanged();
259254
}

team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2009, 2018 IBM Corporation and others.
2+
* Copyright (c) 2009, 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
@@ -163,7 +163,7 @@ public static String asString(InputStream exptStream) throws IOException {
163163
public static InputStream asInputStream(String name) {
164164
IPath path = IPath.fromOSString(PATCHDATA).append(name);
165165
try {
166-
URL url = new URL(getBundle().getEntry("/"), path.toString());
166+
URL url = getBundle().getEntry("/" + path.toString());
167167
return url.openStream();
168168
} catch (IOException e) {
169169
throw new IllegalStateException("failed while reading " + name, e);

0 commit comments

Comments
 (0)