After the last round of changes, I discovered that the new assertion in JField is actually getting
tripped when a JsniFieldRef is constructed. To get around this, I initialize the instance field to a
null literal during a JsniFieldRef's construction. I also mirrored these changed into JMethod and
JsniMethodRef.
Review by: mmendez
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@359 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodCall.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodCall.java
index cb878f6..a16e3aa 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodCall.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodCall.java
@@ -31,6 +31,7 @@
public JMethodCall(JProgram program, JSourceInfo info, JExpression instance,
JMethod method) {
super(program, info);
+ assert (instance != null || method.isStatic());
this.instance = instance;
this.method = method;
this.staticDispatchOnly = false;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniFieldRef.java b/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniFieldRef.java
index 32764df..9ead288 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniFieldRef.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniFieldRef.java
@@ -28,9 +28,10 @@
*/
public class JsniFieldRef extends JFieldRef {
- public JsniFieldRef(JProgram program, JSourceInfo info,
- JField field, JReferenceType enclosingType) {
- super(program, info, null, field, enclosingType);
+ public JsniFieldRef(JProgram program, JSourceInfo info, JField field,
+ JReferenceType enclosingType) {
+ super(program, info, field.isStatic() ? null : program.getLiteralNull(),
+ field, enclosingType);
}
public void traverse(JVisitor visitor, Context ctx) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodRef.java b/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodRef.java
index b5c20b8..c11c701 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodRef.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodRef.java
@@ -28,7 +28,9 @@
public class JsniMethodRef extends JMethodCall {
public JsniMethodRef(JProgram program, JSourceInfo info, JMethod method) {
- super(program, info, null, method);
+ // Just use a null literal as the qualifier on a non-static method
+ super(program, info, method.isStatic() ? null : program.getLiteralNull(),
+ method);
}
public void traverse(JVisitor visitor, Context ctx) {