Skip to content

Commit

Permalink
Remove overloaded newRealm method with 2 arguments for filtered realms
Browse files Browse the repository at this point in the history
This removes ambiguity with the existing method when null is passed as
2nd argument
  • Loading branch information
kwin committed Nov 11, 2022
1 parent 0848de5 commit d2c4c61
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
15 changes: 0 additions & 15 deletions src/main/java/org/codehaus/plexus/classworlds/ClassWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,6 @@ public ClassRealm newRealm( String id, ClassLoader classLoader )
return newRealm( id, classLoader, null );
}

/**
* Shortcut for {@link #newRealm(String, ClassLoader, Predicate)} with the class loader of the current class.
* @param id The identifier for this realm, must not be <code>null</code>.
* @param filter a predicate to apply to each resource name to determine if it should be loaded through this class loader
* @return the created class realm
* @throws DuplicateRealmException in case a realm with the given id does already exist
* @since 2.7.0
* @see FilteredClassRealm
*/
public synchronized ClassRealm newRealm( String id, Predicate<String> filter )
throws DuplicateRealmException
{
return newRealm( id, getClass().getClassLoader(), filter );
}

/**
* Adds a class realm with filtering.
* Only resources/classes whose name matches a given predicate are exposed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void setUp() throws DuplicateRealmException
Set<String> allowedResourcePrefixes = new HashSet<>();
allowedResourcePrefixes.add( "a." );
allowedResourcePrefixes.add( "a/Aa" );
realmA = this.world.newRealm( "realmA", s -> allowedResourcePrefixes.stream().anyMatch( s::startsWith ) );
realmA = this.world.newRealm( "realmA", getClass().getClassLoader(), s -> allowedResourcePrefixes.stream().anyMatch( s::startsWith ) );
}

@Test
Expand Down

0 comments on commit d2c4c61

Please sign in to comment.