http://gwt-code-reviews.appspot.com/1351801/diff/1/2
File dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java (right):

http://gwt-code-reviews.appspot.com/1351801/diff/1/2#newcode585
dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java:585:
(getSingleJsoImpl(refType) != null && !isDualJsoInterface(refType));
On 2011/02/09 01:19:08, scottb wrote:
Can we factor "getSingleJsoImpl(refType) != null" into a
"isSingleJsoInterface"
here (and elsewhere)?

Done.

http://gwt-code-reviews.appspot.com/1351801/diff/1/2#newcode585
dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java:585:
(getSingleJsoImpl(refType) != null && !isDualJsoInterface(refType));
On 2011/02/09 01:19:08, scottb wrote:
Can we factor "getSingleJsoImpl(refType) != null" into a
"isSingleJsoInterface"
here (and elsewhere)?

Done.

http://gwt-code-reviews.appspot.com/1351801/diff/1/2#newcode618
dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java:618: // for any
concrete type not a JSO, check if it implements a JSO interface
On 2011/02/09 01:19:08, scottb wrote:
I was going to make several comments, because some of the logic isn't
clear
here.  But then I thought maybe there's a simpler way to do this...

nextDual : for (Iterator<JInterfaceType> it = dualImpls.iterator();
it.hasNext();) {
   JInterfaceType dualIntf = it.next();
   Set<JClassType> implementors = get(isImplementedMap, dualIntf);
   for (JClassType implementor : implementors) {
     if (instantiatedTypes.contains(implementor)
         && !program.isJavaScriptObject(implementor)) {
       // This dual is still implemented by a Java class.
       continue nextDual;
     }
   }
   // No Java implementors.
   it.remove();
}


Done.

http://gwt-code-reviews.appspot.com/1351801/diff/1/2#newcode618
dev/core/src/com/google/gwt/dev/jjs/ast/JTypeOracle.java:618: // for any
concrete type not a JSO, check if it implements a JSO interface
On 2011/02/09 01:19:08, scottb wrote:
I was going to make several comments, because some of the logic isn't
clear
here.  But then I thought maybe there's a simpler way to do this...

nextDual : for (Iterator<JInterfaceType> it = dualImpls.iterator();
it.hasNext();) {
   JInterfaceType dualIntf = it.next();
   Set<JClassType> implementors = get(isImplementedMap, dualIntf);
   for (JClassType implementor : implementors) {
     if (instantiatedTypes.contains(implementor)
         && !program.isJavaScriptObject(implementor)) {
       // This dual is still implemented by a Java class.
       continue nextDual;
     }
   }
   // No Java implementors.
   it.remove();
}


Done.

http://gwt-code-reviews.appspot.com/1351801/diff/1/4
File
dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java
(right):

http://gwt-code-reviews.appspot.com/1351801/diff/1/4#newcode92
dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java:92:
return src != null && (isNonStringJavaObject(src) || isJavaString(src));

Reverted.

On 2011/02/09 01:53:46, cromwellian wrote:
On 2011/02/09 01:19:08, scottb wrote:
> Can you explain this change a bit?

Sure. JSOs can legally dispatch on null values, e.g.

final public class Null extends JavaScriptObject {
    protected Null() {}
    public static Null create() /*-{
       return null;
    }-*/;

    public void someMethod() { ... }
}

This works, but if you hide 'Null' behind an interface, the
JsoVirtualizer will
generate code that throws an NPE, since Util.getTypeMarker(null) will
be a null
deref.

Being able to do this makes the Json API very clean and orthogonal in
Elemental,
and absolutely efficient in terms of output.   This reminds me that I
need to
update JsoVirtualizer since if a dual-interface isn't really a dual,
it
shouldn't devirtualize with a trampoline.



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

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

Reply via email to