John Stalcup has uploaded a new change for review.
https://gwt-review.googlesource.com/3320
Change subject: fixes a compiler crash when parsing illegal runAsync
definitions
......................................................................
fixes a compiler crash when parsing illegal runAsync definitions
Change-Id: I3d3feb378a9595e1c3be091b2adf033df9ccae39
---
M dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncs.java
M
dev/core/test/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncsErrorMessagesTest.java
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncs.java
b/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncs.java
index 2e9222a..983c972 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncs.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncs.java
@@ -112,7 +112,10 @@
} else {
callbackMethod =
program.getIndexedMethod("RunAsyncCallback.onSuccess");
}
- assert callbackMethod != null;
+ if (callbackMethod == null) {
+ error(x.getSourceInfo(), "Only a RunAsyncCallback with a defined
onSuccess() can "
+ + "be passed to runAsync().");
+ }
JMethodCall onSuccessCall = new JMethodCall(info, asyncCallback,
callbackMethod);
JRunAsync runAsyncNode = new JRunAsync(info, splitPoint, name,
runAsyncCall, onSuccessCall);
diff --git
a/dev/core/test/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncsErrorMessagesTest.java
b/dev/core/test/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncsErrorMessagesTest.java
index 68044bc..af77749 100644
---
a/dev/core/test/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncsErrorMessagesTest.java
+++
b/dev/core/test/com/google/gwt/dev/jjs/impl/ReplaceRunAsyncsErrorMessagesTest.java
@@ -52,18 +52,48 @@
});
addSnippetImport("test.SplitPoint3");
+ expectError("Errors in 'test/EntryPoint.java'");
expectError("Line 8: Multiple runAsync calls are named
test.SplitPoint1");
expectError("One call is at 'test/SplitPoint1.java:5'");
expectError("One call is at 'test/SplitPoint3.java:5'");
testSnippet("RunAsyncCode.runAsyncCode(SplitPoint1.class);");
}
+ public void testMissingOnSuccess() {
+ sourceOracle.addOrReplace(new MockJavaResource("test.SplitPoint4") {
+ @Override
+ public CharSequence getContent() {
+ StringBuffer code = new StringBuffer();
+ code.append("package test;\n");
+ code.append("import com.google.gwt.core.client.GWT;\n");
+ code.append("import
com.google.gwt.core.client.RunAsyncCallback;\n");
+ code.append("public class SplitPoint4 {\n");
+ code.append(
+ " public abstract class AbstractRunAsyncCallback implements
RunAsyncCallback {\n");
+ code.append(" public void run() {\n");
+ code.append(" GWT.runAsync(this);\n");
+ code.append(" }\n");
+ code.append(" }\n");
+ code.append("}\n");
+ return code;
+ }
+ });
+
+ addSnippetImport("test.SplitPoint4");
+ expectError("Errors in 'test/SplitPoint4.java'");
+ expectError("Line 7: Only a RunAsyncCallback with a defined
onSuccess() can "
+ + "be passed to runAsync().");
+ testSnippet("new SplitPoint4();");
+ }
+
public void testNonClassLiteral() {
+ expectError("Errors in 'test/EntryPoint.java'");
expectError("Line 7: Only a class literal may be passed to
runAsyncCode");
testSnippet("RunAsyncCode.runAsyncCode(new
SplitPoint1().getClass());");
}
public void testNonExistentSplitPoint() {
+ expectError("Errors in 'test/EntryPoint.java'");
expectError("Line 7: No runAsync call is named java.lang.String");
testSnippet("RunAsyncCode.runAsyncCode(String.class);");
}
@@ -111,7 +141,6 @@
private void initializeTestLoggerBuilder() {
testLoggerBuilder = new UnitTestTreeLogger.Builder();
testLoggerBuilder.setLowestLogLevel(TreeLogger.ERROR);
- expectError("Errors in 'test/EntryPoint.java'");
}
private void testSnippet(String codeSnippet) {
--
To view, visit https://gwt-review.googlesource.com/3320
To unsubscribe, visit https://gwt-review.googlesource.com/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d3feb378a9595e1c3be091b2adf033df9ccae39
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: John Stalcup <[email protected]>
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
---
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.