-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restore the old way of resolving classes from the classpath
I measured this and found no noticeable performance impact. Thus I think it is safer to still use the current Classloader to resolve class files as well. In the end we will ignore duplicates in the set of locations anyway, and if the lookup time has no real impact, we are still safer in case there is some other quirk (like the manifest classpath that I forgot about when I refactored this to fix the Android problem). Signed-off-by: Peter Gafert <[email protected]>
- Loading branch information
1 parent
bc353f4
commit 8f882df
Showing
3 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
archunit/src/test/java/com/tngtech/archunit/testutil/ContextClassLoaderRule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.tngtech.archunit.testutil; | ||
|
||
import org.junit.rules.ExternalResource; | ||
|
||
public class ContextClassLoaderRule extends ExternalResource { | ||
private ClassLoader contextClassLoader; | ||
|
||
@Override | ||
public void before() { | ||
contextClassLoader = Thread.currentThread().getContextClassLoader(); | ||
} | ||
|
||
@Override | ||
public void after() { | ||
Thread.currentThread().setContextClassLoader(contextClassLoader); | ||
} | ||
} |