Migrate remaining use of ClassLoader.loadClass to Class.forName

Closes gh-19824
This commit is contained in:
Stephane Nicoll
2020-01-23 13:15:45 +01:00
parent 820c671ddd
commit e044817fe7
6 changed files with 13 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (name.startsWith("org.junit") || name.startsWith("org.hamcrest")) {
return this.junitLoader.loadClass(name);
return Class.forName(name, false, this.junitLoader);
}
return super.loadClass(name);
}