1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -568,7 +568,7 @@ protected Resource[] findPathMatchingResources(String locationPattern) throws IO
568
568
String rootDirPath = determineRootDir (locationPattern );
569
569
String subPattern = locationPattern .substring (rootDirPath .length ());
570
570
Resource [] rootDirResources = getResources (rootDirPath );
571
- Set <Resource > result = new LinkedHashSet <>(16 );
571
+ Set <Resource > result = new LinkedHashSet <>(64 );
572
572
for (Resource rootDirResource : rootDirResources ) {
573
573
rootDirResource = resolveRootDirResource (rootDirResource );
574
574
URL rootDirUrl = rootDirResource .getURL ();
@@ -726,7 +726,7 @@ protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource,
726
726
// The Sun JRE does not return a slash here, but BEA JRockit does.
727
727
rootEntryPath = rootEntryPath + "/" ;
728
728
}
729
- Set <Resource > result = new LinkedHashSet <>(8 );
729
+ Set <Resource > result = new LinkedHashSet <>(64 );
730
730
for (Enumeration <JarEntry > entries = jarFile .entries (); entries .hasMoreElements ();) {
731
731
JarEntry entry = entries .nextElement ();
732
732
String entryPath = entry .getName ();
@@ -777,7 +777,7 @@ protected JarFile getJarFile(String jarFileUrl) throws IOException {
777
777
protected Set <Resource > doFindPathMatchingFileResources (Resource rootDirResource , String subPattern )
778
778
throws IOException {
779
779
780
- Set <Resource > result = new LinkedHashSet <>();
780
+ Set <Resource > result = new LinkedHashSet <>(64 );
781
781
URI rootDirUri ;
782
782
try {
783
783
rootDirUri = rootDirResource .getURI ();
@@ -886,7 +886,7 @@ protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource
886
886
* @see PathMatcher#match(String, String)
887
887
*/
888
888
protected Set <Resource > findAllModulePathResources (String locationPattern ) throws IOException {
889
- Set <Resource > result = new LinkedHashSet <>(16 );
889
+ Set <Resource > result = new LinkedHashSet <>(64 );
890
890
891
891
// Skip scanning the module path when running in a native image.
892
892
if (NativeDetector .inNativeImage ()) {
@@ -987,7 +987,7 @@ private static class PatternVirtualFileVisitor implements InvocationHandler {
987
987
988
988
private final String rootPath ;
989
989
990
- private final Set <Resource > resources = new LinkedHashSet <>();
990
+ private final Set <Resource > resources = new LinkedHashSet <>(64 );
991
991
992
992
public PatternVirtualFileVisitor (String rootPath , String subPattern , PathMatcher pathMatcher ) {
993
993
this .subPattern = subPattern ;
@@ -1000,15 +1000,17 @@ public PatternVirtualFileVisitor(String rootPath, String subPattern, PathMatcher
1000
1000
public Object invoke (Object proxy , Method method , Object [] args ) throws Throwable {
1001
1001
String methodName = method .getName ();
1002
1002
if (Object .class == method .getDeclaringClass ()) {
1003
- switch (methodName ) {
1004
- case "equals" :
1003
+ switch (methodName ) {
1004
+ case "equals" -> {
1005
1005
// Only consider equal when proxies are identical.
1006
1006
return (proxy == args [0 ]);
1007
- case "hashCode" :
1007
+ }
1008
+ case "hashCode" -> {
1008
1009
return System .identityHashCode (proxy );
1010
+ }
1009
1011
}
1010
1012
}
1011
- return switch (methodName ) {
1013
+ return switch (methodName ) {
1012
1014
case "getAttributes" -> getAttributes ();
1013
1015
case "visit" -> {
1014
1016
visit (args [0 ]);
0 commit comments