[gwt-contrib] RR : Fix JsoRestrictionsChecker bug with abstract JSO types (issue495801)

16 views
Skip to first unread message

bo...@google.com

unread,
May 7, 2010, 12:47:14 PM5/7/10
to sco...@google.com, rj...@google.com, google-web-tool...@googlegroups.com, re...@gwt-code-reviews.appspotmail.com
Reviewers: scottb,

Message:
Review requested.

Description:
This patch fixes a missing corner case in JsoRestrictionsChecker. It's
possible to declare a JSO subtype that is abstract, implements
non-trivial interfaces, but fails to declare a method defined by the
interface.

Example:
interface I {
void method();
}
abstract class MyJso extends JavaScriptObject implements I {
protected MyJso() {}
// no mention of method();
}

Please review this at http://gwt-code-reviews.appspot.com/495801/show

Affected files:
M dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java
M dev/core/test/com/google/gwt/dev/javac/JSORestrictionsTest.java


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

sco...@google.com

unread,
May 12, 2010, 4:19:43 PM5/12/10
to bo...@google.com, rj...@google.com, google-web-tool...@googlegroups.com, re...@gwt-code-reviews.appspotmail.com
Mostly LG, concerned about generics though. I'm 99% sure the code in
GenerateJavaAST is correct.


http://gwt-code-reviews.appspot.com/495801/diff/1/2
File dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java
(right):

http://gwt-code-reviews.appspot.com/495801/diff/1/2#newcode275
dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java:275:
private boolean implementsMethod(ReferenceBinding implType,
Generally speaking, are you sure this handles generics correctly?
Compare with the code in
GenerateJavaAST.JavaASTGenerationVisitor.tryFindUpRefsRecursive(JMethod,
MethodBinding, ReferenceBinding).

Two key things it does:

1)

/*
* Always look for uprefs in the original, so we can correctly compare
* erased signatures. The general design for uprefs is to model what the
* JVM does in terms of matching up overrides based on binary match.
*/
searchThisType = (ReferenceBinding) searchThisType.original();

2)

if (binding.returnType.erasure() == tryMethod.returnType.erasure()
&& binding.areParameterErasuresEqual(tryMethod)) {

http://gwt-code-reviews.appspot.com/495801/show

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
Reply all
Reply to author
Forward
0 new messages