Skip to content

Commit d2c4c61

Browse files
committed
Remove overloaded newRealm method with 2 arguments for filtered realms
This removes ambiguity with the existing method when null is passed as 2nd argument
1 parent 0848de5 commit d2c4c61

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

src/main/java/org/codehaus/plexus/classworlds/ClassWorld.java

-15
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,6 @@ public ClassRealm newRealm( String id, ClassLoader classLoader )
7373
return newRealm( id, classLoader, null );
7474
}
7575

76-
/**
77-
* Shortcut for {@link #newRealm(String, ClassLoader, Predicate)} with the class loader of the current class.
78-
* @param id The identifier for this realm, must not be <code>null</code>.
79-
* @param filter a predicate to apply to each resource name to determine if it should be loaded through this class loader
80-
* @return the created class realm
81-
* @throws DuplicateRealmException in case a realm with the given id does already exist
82-
* @since 2.7.0
83-
* @see FilteredClassRealm
84-
*/
85-
public synchronized ClassRealm newRealm( String id, Predicate<String> filter )
86-
throws DuplicateRealmException
87-
{
88-
return newRealm( id, getClass().getClassLoader(), filter );
89-
}
90-
9176
/**
9277
* Adds a class realm with filtering.
9378
* Only resources/classes whose name matches a given predicate are exposed.

src/test/java/org/codehaus/plexus/classworlds/realm/FilteredClassRealmTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void setUp() throws DuplicateRealmException
4747
Set<String> allowedResourcePrefixes = new HashSet<>();
4848
allowedResourcePrefixes.add( "a." );
4949
allowedResourcePrefixes.add( "a/Aa" );
50-
realmA = this.world.newRealm( "realmA", s -> allowedResourcePrefixes.stream().anyMatch( s::startsWith ) );
50+
realmA = this.world.newRealm( "realmA", getClass().getClassLoader(), s -> allowedResourcePrefixes.stream().anyMatch( s::startsWith ) );
5151
}
5252

5353
@Test

0 commit comments

Comments
 (0)