* }
* </pre>
*/
- protected Function resolve = new Function() {
+ public Function resolve = new Function() {
public void f() {
dfd.resolve(arguments);
};
* }
* </pre>
*/
- protected Function reject = new Function() {
+ public Function reject = new Function() {
public void f() {
dfd.reject(arguments);
};
public abstract class FunctionDeferred extends Function {
protected Deferred dfd;
+ public Function resolve, reject;
/**
* This function is called once the the previous promise in the
public final Object f(Object... args) {
return new PromiseFunction() {
public void f(Deferred dfd) {
+ FunctionDeferred.this.resolve = resolve;
+ FunctionDeferred.this.reject = reject;
FunctionDeferred.this.dfd = dfd;
FunctionDeferred.this.f(dfd);
}
});
}
+
+ public void testProtected() {
+ delayTestFinish(20);
+ GQuery.when(new PromiseFunction() {
+ public void f(final Deferred dfd) {
+ GQuery.when(new Function() {
+ public void f() {
+ // This causes an '...IllegalAccessError: tried to access class ...Deferred$DeferredPromiseImpl ...'
+ // in dev-mode when resolve is protected. It works in JRE and production though.
+ resolve.f();
+ }
+ });
+ }
+ }).then(new FunctionDeferred() {
+ protected void f(Deferred dfd) {
+ GQuery.when(new Function() {
+ public void f() {
+ resolve.f();
+ }
+ });
+ }
+ }).done(new Function() {
+ public void f() {
+ finishTest();
+ }
+ });
+ }
+
}