Fix for AsyncProxy of top-level types, for which isStatic()
returns false. Only non-static *member* types should error.
See http://gwt-code-reviews.appspot.com/149801
Review by: bobv@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7602 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/rebind/AsyncProxyGenerator.java b/user/src/com/google/gwt/user/rebind/AsyncProxyGenerator.java
index 4bc1d21..ab6ace3 100644
--- a/user/src/com/google/gwt/user/rebind/AsyncProxyGenerator.java
+++ b/user/src/com/google/gwt/user/rebind/AsyncProxyGenerator.java
@@ -323,8 +323,8 @@
}
// Must be able to GWT.create()
- if (!concreteType.isStatic()) {
- logger.log(TreeLogger.ERROR, "Expecting concrete type"
+ if (concreteType.isMemberType() && !concreteType.isStatic()) {
+ logger.log(TreeLogger.ERROR, "Expecting concrete type "
+ concreteType.getQualifiedSourceName() + " to be static.");
throw new UnableToCompleteException();
}
diff --git a/user/test/com/google/gwt/user/client/AsyncProxyTest.java b/user/test/com/google/gwt/user/client/AsyncProxyTest.java
index 94f7474..2488c1d 100644
--- a/user/test/com/google/gwt/user/client/AsyncProxyTest.java
+++ b/user/test/com/google/gwt/user/client/AsyncProxyTest.java
@@ -1,12 +1,12 @@
/*
* Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -120,6 +120,12 @@
}
}
+ @AllowNonVoid
+ @ConcreteType(AsyncProxyTestTopLevelImpl.class)
+ @DefaultValue(intValue = 42, longValue = 42)
+ interface TopLevelProxy extends AsyncProxy<Test>, Test {
+ }
+
private static final int TEST_FINISH_DELAY_MILLIS = 10000;
private static AsyncProxyTest testInstance;
@@ -193,4 +199,9 @@
delayTestFinish(TEST_FINISH_DELAY_MILLIS);
proxy.two();
}
+
+ public void testProxyOfTopLevel() {
+ Test proxy = GWT.create(TopLevelProxy.class);
+ assertTrue(proxy instanceof AsyncProxy);
+ }
}
diff --git a/user/test/com/google/gwt/user/client/AsyncProxyTestTopLevelImpl.java b/user/test/com/google/gwt/user/client/AsyncProxyTestTopLevelImpl.java
new file mode 100644
index 0000000..4257632
--- /dev/null
+++ b/user/test/com/google/gwt/user/client/AsyncProxyTestTopLevelImpl.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.user.client;
+
+/**
+ * Used by AsyncProxyTest to validate that a top-level class can be an AsyncProxy.
+ */
+public class AsyncProxyTestTopLevelImpl implements AsyncProxyTest.Test {
+
+ public boolean defaultBool() {
+ return false;
+ }
+
+ public byte defaultByte() {
+ return 3;
+ }
+
+ public char defaultChar() {
+ return 0;
+ }
+
+ public double defaultDouble() {
+ return 0;
+ }
+
+ public float defaultFloat() {
+ return 0;
+ }
+
+ public int defaultInt() {
+ return 0;
+ }
+
+ public long defaultLong() {
+ return 0;
+ }
+
+ public Object defaultObject() {
+ return null;
+ }
+
+ public short defaultShort() {
+ return 0;
+ }
+
+ public String defaultString() {
+ return null;
+ }
+
+ public void one() {
+ }
+
+ public void three() {
+ }
+
+ public void two() {
+ }
+
+}