Skip to content

Commit 3453cdf

Browse files
authored
Merge pull request #351 from code-dot-org/molly/easymock
Add access to EasyMock
2 parents 18f6613 + 21d6eac commit 3453cdf

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

org-code-javabuilder/lib/src/main/java/org/code/javabuilder/UserClassLoader.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
import java.lang.invoke.LambdaMetafactory;
66
import java.lang.invoke.StringConcatFactory;
7+
import java.lang.reflect.InvocationTargetException;
8+
import java.lang.reflect.Method;
79
import java.net.URL;
810
import java.net.URLClassLoader;
911
import java.util.HashSet;
@@ -112,7 +114,11 @@ private boolean isInAllowedPackage(String[] allowedPackageList, String name) {
112114
String.class.getName(),
113115
StringBuffer.class.getName(),
114116
StringBuilder.class.getName(),
115-
Throwable.class.getName());
117+
Throwable.class.getName(),
118+
ThreadLocal.class.getName(), // EasyMock support
119+
CloneNotSupportedException.class.getName(), // EasyMock support
120+
Method.class.getName(), // EasyMock support
121+
InvocationTargetException.class.getName()); // EasyMock support
116122

117123
// Allowed packages (any individual class is allowed from these classes)
118124
private static final String[] allowedPackages =
@@ -126,7 +132,9 @@ private boolean isInAllowedPackage(String[] allowedPackageList, String name) {
126132
"org.code.media.",
127133
"org.code.neighborhood.",
128134
"org.code.theater.",
129-
"org.code.lang"
135+
"org.code.lang",
136+
"org.easymock.",
137+
"jdk.internal.reflect.SerializationConstructorAccessorImpl" // EasyMock support
130138
};
131139

132140
// Allowed packages for code with elevated permissions, such as validation code.

org-code-javabuilder/studentlib/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ java {
1414
dependencies {
1515
// Required to compile student unit tests
1616
implementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
17+
// https://mvnrepository.com/artifact/org.easymock/easymock
18+
implementation group: 'org.easymock', name: 'easymock', version: '4.3'
19+
1720
}
1821

1922
test {

0 commit comments

Comments
 (0)