Allow getters named "debugger" declare void as the return type.
Change-Id: Ied5f15b92fba97131e30b4237608c013c6d7c0f8
diff --git a/dev/core/src/com/google/gwt/dev/javac/JsInteropUtil.java b/dev/core/src/com/google/gwt/dev/javac/JsInteropUtil.java
index 0db2245..137770a 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JsInteropUtil.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JsInteropUtil.java
@@ -144,12 +144,19 @@
private static JsMemberType getJsPropertyAccessorType(JMethod method) {
if (method.getParams().size() == 1 && method.getType() == JPrimitiveType.VOID) {
return JsMemberType.SETTER;
- } else if (method.getParams().isEmpty() && method.getType() != JPrimitiveType.VOID) {
+ } else if (method.getParams().isEmpty()
+ && (method.getType() != JPrimitiveType.VOID || isDebugger(method))) {
return JsMemberType.GETTER;
}
return JsMemberType.UNDEFINED_ACCESSOR;
}
+ private static boolean isDebugger(JMethod method) {
+ return method.isStatic()
+ && method.getName().equals("debugger")
+ && (method.isJsNative() || method.isAbstract());
+ }
+
private static AnnotationBinding getInteropAnnotation(Annotation[] annotations, String name) {
return JdtUtil.getAnnotationByName(annotations, "jsinterop.annotations." + name);
}
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java
index cf2e147..9e9af72 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/JsInteropRestrictionCheckerTest.java
@@ -168,9 +168,10 @@
addSnippetImport("jsinterop.annotations.JsProperty");
addSnippetClassDecl(
"@JsType",
- "public interface Buggy {",
- " @JsProperty(name = \"x\") int x();",
- " @JsProperty(name = \"x\") void x(int x);",
+ "public static abstract class Buggy {",
+ " @JsProperty(name = \"x\") abstract int x();",
+ " @JsProperty(name = \"x\") abstract void x(int x);",
+ " @JsProperty(name = \"debugger\") static native void debugger();",
"}");
assertBuggySucceeds();