01: /**
02: *
03: */package org.mozilla.javascript.tests;
04:
05: import junit.framework.TestCase;
06:
07: import org.mozilla.javascript.*;
08:
09: /**
10: * See https://bugzilla.mozilla.org/show_bug.cgi?id=409702
11: * @author Norris Boyd
12: */
13: public class Bug409702Test extends TestCase {
14:
15: public static abstract class Test {
16: public Test() {
17: }
18:
19: public abstract void a();
20:
21: public abstract int b();
22:
23: public static abstract class Subclass extends Test {
24:
25: @Override
26: public final void a() {
27: }
28: }
29: }
30:
31: public void testAdapter() {
32: final int value = 12;
33: String source = "var instance = " + " new JavaAdapter("
34: + getClass().getName() + ".Test.Subclass,"
35: + "{ b: function () { return " + value + "; } });"
36: + "instance.b();";
37:
38: Context cx = ContextFactory.getGlobal().enterContext();
39: try {
40: Scriptable scope = cx.initStandardObjects();
41: Object result = cx.evaluateString(scope, source, "source",
42: 1, null);
43: assertEquals(new Integer(value), result);
44: } finally {
45: Context.exit();
46: }
47: }
48: }
|