@@ -91,9 +91,20 @@ public <E extends Entitlement> Stream<E> getEntitlements(Class<E> entitlementCla
9191 }
9292 }
9393
94+ private FileAccessTree getDefaultFileAccess (String componentName ) {
95+ return FileAccessTree .of (
96+ componentName ,
97+ UNKNOWN_COMPONENT_NAME ,
98+ FilesEntitlement .EMPTY ,
99+ pathLookup ,
100+ bundlesDirs .get (componentName ),
101+ List .of ()
102+ );
103+ }
104+
94105 // pkg private for testing
95106 ModuleEntitlements defaultEntitlements (String componentName ) {
96- return new ModuleEntitlements (componentName , Map .of (), defaultFileAccess );
107+ return new ModuleEntitlements (componentName , Map .of (), getDefaultFileAccess ( componentName ) );
97108 }
98109
99110 // pkg private for testing
@@ -118,7 +129,6 @@ ModuleEntitlements policyEntitlements(String componentName, String moduleName, L
118129 private final Map <String , Map <String , List <Entitlement >>> pluginsEntitlements ;
119130 private final Function <Class <?>, String > pluginResolver ;
120131 private final PathLookup pathLookup ;
121- private final FileAccessTree defaultFileAccess ;
122132 private final Set <Class <?>> mutedClasses ;
123133
124134 public static final String ALL_UNNAMED = "ALL-UNNAMED" ;
@@ -178,14 +188,6 @@ public PolicyManager(
178188 this .apmAgentPackageName = apmAgentPackageName ;
179189 this .entitlementsModule = entitlementsModule ;
180190 this .pathLookup = requireNonNull (pathLookup );
181- this .defaultFileAccess = FileAccessTree .of (
182- UNKNOWN_COMPONENT_NAME ,
183- UNKNOWN_COMPONENT_NAME ,
184- FilesEntitlement .EMPTY ,
185- pathLookup ,
186- null ,
187- List .of ()
188- );
189191 this .mutedClasses = suppressFailureLogClasses ;
190192
191193 List <ExclusiveFileEntitlement > exclusiveFileEntitlements = new ArrayList <>();
0 commit comments