Skip to content

Commit e027ad0

Browse files
skysrdrzwitserloot
authored andcommitted
refactored to ShadowClassLoader use Collections::enumeration instead of Vector
1 parent cb6704b commit e027ad0

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/launch/lombok/launch/ShadowClassLoader.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import java.util.Map;
4444
import java.util.Map.Entry;
4545
import java.util.Set;
46-
import java.util.Vector;
4746
import java.util.WeakHashMap;
4847
import java.util.concurrent.ConcurrentHashMap;
4948
import java.util.concurrent.ConcurrentMap;
@@ -444,33 +443,33 @@ private String toSclResourceName(String name) {
444443
// * We need to return an enumeration.
445444
// * We can't make one on the fly.
446445
// * ArrayList can't make these.
447-
Vector<URL> vector = new Vector<URL>();
446+
List<URL> urls = new ArrayList<>();
448447

449448
for (File ce : override) {
450449
URL url = getResourceFromLocation(name, altName, ce);
451-
if (url != null) vector.add(url);
450+
if (url != null) urls.add(url);
452451
}
453452

454453
if (override.isEmpty()) {
455454
URL fromSelf = getResourceFromLocation(name, altName, SELF_BASE_FILE);
456-
if (fromSelf != null) vector.add(fromSelf);
455+
if (fromSelf != null) urls.add(fromSelf);
457456
}
458457

459458
Enumeration<URL> sec = super.getResources(name);
460459
while (sec.hasMoreElements()) {
461460
URL item = sec.nextElement();
462-
if (isPartOfShadowSuffix(item.toString(), name, sclSuffix)) vector.add(item);
461+
if (isPartOfShadowSuffix(item.toString(), name, sclSuffix)) urls.add(item);
463462
}
464463

465464
if (altName != null) {
466465
Enumeration<URL> tern = super.getResources(altName);
467466
while (tern.hasMoreElements()) {
468467
URL item = tern.nextElement();
469-
if (isPartOfShadowSuffix(item.toString(), altName, sclSuffix)) vector.add(item);
468+
if (isPartOfShadowSuffix(item.toString(), altName, sclSuffix)) urls.add(item);
470469
}
471470
}
472471

473-
return vector.elements();
472+
return Collections.enumeration(urls);
474473
}
475474

476475
@Override public URL getResource(String name) {

0 commit comments

Comments
 (0)