Allow passing arrays of (arrays of...) longs into and out of JSNI methods.
Review by: mmendez (desk check)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2353 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jdt/LongFromJSNIChecker.java b/dev/core/src/com/google/gwt/dev/jdt/LongFromJSNIChecker.java
index 1c89410..158c65a 100644
--- a/dev/core/src/com/google/gwt/dev/jdt/LongFromJSNIChecker.java
+++ b/dev/core/src/com/google/gwt/dev/jdt/LongFromJSNIChecker.java
@@ -136,8 +136,8 @@
}
/**
- * Check whether the argument type is long or an array of (arrays of...)
- * long. If the argument is <code>null</code>, returns <code>false</code>.
+ * Check whether the argument type is the <code>long</code> primitive
+ * type. If the argument is <code>null</code>, returns <code>false</code>.
*/
private boolean containsLong(TypeBinding type) {
if (type instanceof BaseTypeBinding) {
@@ -147,13 +147,6 @@
}
}
- if (type instanceof ArrayBinding) {
- ArrayBinding ab = (ArrayBinding) type;
- if (containsLong(ab.elementsType())) {
- return true;
- }
- }
-
return false;
}
diff --git a/dev/core/test/com/google/gwt/dev/jdt/LongFromJSNITest.java b/dev/core/test/com/google/gwt/dev/jdt/LongFromJSNITest.java
index fb1c5b2..d100f34 100644
--- a/dev/core/test/com/google/gwt/dev/jdt/LongFromJSNITest.java
+++ b/dev/core/test/com/google/gwt/dev/jdt/LongFromJSNITest.java
@@ -38,6 +38,11 @@
"Referencing field 'Buggy.x': type 'long' is not safe to access in JSNI code");
}
+ /**
+ * The proper behavior here is a close call. In hosted mode, Java arrays are
+ * completely unusable in JavaScript, so the current reasoning is to allow
+ * them.
+ */
public void testLongArray() throws UnableToCompleteException {
StringBuffer code = new StringBuffer();
code.append("class Buggy {\n");
@@ -46,10 +51,7 @@
code.append(" $wnd.alert(this.@Buggy::m()()); }-*/;\n");
code.append("}\n");
- shouldGenerateError(
- code,
- 3,
- "Referencing method \'Buggy.m\': return type 'long[]' is not safe to access in JSNI code");
+ shouldGenerateNoError(code);
}
public void testLongParameter() throws UnableToCompleteException {