Revision: 9152
Author: p...@google.com
Date: Tue Oct 26 08:27:01 2010
Log: Cherry picking changes from trunk into release branch: 1056801
http://code.google.com/p/google-web-toolkit/source/detail?r=9152
Modified:
/releases/2.1/user/src/com/google/gwt/requestfactory/server/RequestFactoryInterfaceValidator.java
/releases/2.1/user/test/com/google/gwt/requestfactory/server/RequestFactoryInterfaceValidatorTest.java
=======================================
---
/releases/2.1/user/src/com/google/gwt/requestfactory/server/RequestFactoryInterfaceValidator.java
Mon Oct 25 10:19:59 2010
+++
/releases/2.1/user/src/com/google/gwt/requestfactory/server/RequestFactoryInterfaceValidator.java
Tue Oct 26 08:27:01 2010
@@ -286,6 +286,10 @@
@Override
public MethodVisitor visitMethod(int access, String name, String desc,
String signature, String[] exceptions) {
+ // Ignore initializers
+ if ("<clinit>".equals(name) || "<init>".equals(name)) {
+ return null;
+ }
RFMethod method = new RFMethod(name, desc);
method.setDeclaredStatic((access & Opcodes.ACC_STATIC) != 0);
method.setDeclaredSignature(signature);
=======================================
---
/releases/2.1/user/test/com/google/gwt/requestfactory/server/RequestFactoryInterfaceValidatorTest.java
Mon Oct 25 10:19:59 2010
+++
/releases/2.1/user/test/com/google/gwt/requestfactory/server/RequestFactoryInterfaceValidatorTest.java
Tue Oct 26 08:27:01 2010
@@ -21,17 +21,53 @@
import com.google.gwt.requestfactory.shared.ProxyFor;
import com.google.gwt.requestfactory.shared.Request;
import com.google.gwt.requestfactory.shared.RequestContext;
+import com.google.gwt.requestfactory.shared.RequestFactory;
import com.google.gwt.requestfactory.shared.Service;
import com.google.gwt.requestfactory.shared.SimpleRequestFactory;
import junit.framework.TestCase;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
* JRE tests for {...@link RequestFactoryInterfaceValidator}.
*/
public class RequestFactoryInterfaceValidatorTest extends TestCase {
+ static class ClinitEntity {
+ static ClinitEntity request() {
+ return null;
+ }
+
+ Object OBJECT = new Object();
+
+ String getId() {
+ return null;
+ }
+
+ int getVersion() {
+ return 0;
+ }
+ }
+
+ @ProxyFor(ClinitEntity.class)
+ interface ClinitEntityProxy extends EntityProxy {
+ Object OBJECT = new Object();
+ }
+
+ @Service(ClinitEntity.class)
+ interface ClinitRequestContext extends RequestContext {
+ Object OBJECT = new Object();
+
+ Request<ClinitEntityProxy> request();
+ }
+
+ interface ClinitRequestFactory extends RequestFactory {
+ Object OBJECT = new Object();
+
+ ClinitRequestContext context();
+ }
+
static class Domain {
static int fooStatic(int a) {
return 0;
@@ -106,6 +142,14 @@
}
RequestFactoryInterfaceValidator v;
+
+ /**
+ * Ensure that the <clinit> methods don't interfere with validation.
+ */
+ public void testIntecfacesWithClinits() {
+ v.validateRequestFactory(ClinitRequestFactory.class.getName());
+ assertFalse(v.isPoisoned());
+ }
public void testMismatchedArity() {
v.validateRequestContext(ServiceRequestMismatchedArity.class.getName());
@@ -131,11 +175,6 @@
v.validateEntityProxy(DomainProxyMissingAnnotation.class.getName());
assertTrue(v.isPoisoned());
}
-
- public void testMissingServiceAnnotations() {
-
v.validateRequestContext(RequestContextMissingAnnotation.class.getName());
- assertTrue(v.isPoisoned());
- }
public void testMissingIdAndVersion() {
v.validateEntityProxy(DomainProxy.class.getName());
@@ -146,6 +185,11 @@
v.validateRequestContext(ServiceRequestMissingMethod.class.getName());
assertTrue(v.isPoisoned());
}
+
+ public void testMissingServiceAnnotations() {
+
v.validateRequestContext(RequestContextMissingAnnotation.class.getName());
+ assertTrue(v.isPoisoned());
+ }
public void testOverloadedMethod() {
v.validateEntityProxy(DomainWithOverloadsProxy.class.getName());
@@ -163,6 +207,7 @@
@Override
protected void setUp() throws Exception {
Logger logger = Logger.getLogger("");
+ logger.setLevel(Level.OFF);
v = new RequestFactoryInterfaceValidator(logger, new ClassLoaderLoader(
Thread.currentThread().getContextClassLoader()));
}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors