11/*
2- * Copyright 2002-2023 the original author or authors.
2+ * Copyright 2002-2024 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -568,7 +568,7 @@ protected Resource[] findPathMatchingResources(String locationPattern) throws IO
568568 String rootDirPath = determineRootDir (locationPattern );
569569 String subPattern = locationPattern .substring (rootDirPath .length ());
570570 Resource [] rootDirResources = getResources (rootDirPath );
571- Set <Resource > result = new LinkedHashSet <>(16 );
571+ Set <Resource > result = new LinkedHashSet <>(64 );
572572 for (Resource rootDirResource : rootDirResources ) {
573573 rootDirResource = resolveRootDirResource (rootDirResource );
574574 URL rootDirUrl = rootDirResource .getURL ();
@@ -726,7 +726,7 @@ protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource,
726726 // The Sun JRE does not return a slash here, but BEA JRockit does.
727727 rootEntryPath = rootEntryPath + "/" ;
728728 }
729- Set <Resource > result = new LinkedHashSet <>(8 );
729+ Set <Resource > result = new LinkedHashSet <>(64 );
730730 for (Enumeration <JarEntry > entries = jarFile .entries (); entries .hasMoreElements ();) {
731731 JarEntry entry = entries .nextElement ();
732732 String entryPath = entry .getName ();
@@ -777,7 +777,7 @@ protected JarFile getJarFile(String jarFileUrl) throws IOException {
777777 protected Set <Resource > doFindPathMatchingFileResources (Resource rootDirResource , String subPattern )
778778 throws IOException {
779779
780- Set <Resource > result = new LinkedHashSet <>();
780+ Set <Resource > result = new LinkedHashSet <>(64 );
781781 URI rootDirUri ;
782782 try {
783783 rootDirUri = rootDirResource .getURI ();
@@ -886,7 +886,7 @@ protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource
886886 * @see PathMatcher#match(String, String)
887887 */
888888 protected Set <Resource > findAllModulePathResources (String locationPattern ) throws IOException {
889- Set <Resource > result = new LinkedHashSet <>(16 );
889+ Set <Resource > result = new LinkedHashSet <>(64 );
890890
891891 // Skip scanning the module path when running in a native image.
892892 if (NativeDetector .inNativeImage ()) {
@@ -987,7 +987,7 @@ private static class PatternVirtualFileVisitor implements InvocationHandler {
987987
988988 private final String rootPath ;
989989
990- private final Set <Resource > resources = new LinkedHashSet <>();
990+ private final Set <Resource > resources = new LinkedHashSet <>(64 );
991991
992992 public PatternVirtualFileVisitor (String rootPath , String subPattern , PathMatcher pathMatcher ) {
993993 this .subPattern = subPattern ;
@@ -1000,15 +1000,17 @@ public PatternVirtualFileVisitor(String rootPath, String subPattern, PathMatcher
10001000 public Object invoke (Object proxy , Method method , Object [] args ) throws Throwable {
10011001 String methodName = method .getName ();
10021002 if (Object .class == method .getDeclaringClass ()) {
1003- switch (methodName ) {
1004- case "equals" :
1003+ switch (methodName ) {
1004+ case "equals" -> {
10051005 // Only consider equal when proxies are identical.
10061006 return (proxy == args [0 ]);
1007- case "hashCode" :
1007+ }
1008+ case "hashCode" -> {
10081009 return System .identityHashCode (proxy );
1010+ }
10091011 }
10101012 }
1011- return switch (methodName ) {
1013+ return switch (methodName ) {
10121014 case "getAttributes" -> getAttributes ();
10131015 case "visit" -> {
10141016 visit (args [0 ]);
0 commit comments