Remove reflection from run-test 825-unbalanced-lock.
We compile Java sources against all jasmin classes since
https://android-review.googlesource.com/1978318
and therefore we can reference jasmin classes directly
instead of using reflection.
Test: testrunner.py --host --optimizing -t 825
Change-Id: I95c410c637a4b08d141a30bf0397eedb827de306
diff --git a/test/825-unbalanced-lock/src/Main.java b/test/825-unbalanced-lock/src/Main.java
index f25f5ca..7f5e4a7 100644
--- a/test/825-unbalanced-lock/src/Main.java
+++ b/test/825-unbalanced-lock/src/Main.java
@@ -14,20 +14,12 @@
* limitations under the License.
*/
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
public class Main {
public static void main(String[] args) throws Exception {
- Class<?> cls = Class.forName("Unbalanced");
- Object o = cls.newInstance();
try {
- cls.getMethod("unbalanced").invoke(o);
+ new Unbalanced().unbalanced();
throw new Error("Expected IllegalMonitorStateException");
- } catch (InvocationTargetException e) {
- if (!(e.getCause() instanceof IllegalMonitorStateException)) {
- throw new Error("Expected IllegalMonitorStateException");
- }
+ } catch (IllegalMonitorStateException expected) {
}
}
}