Skip to content

Commit

Permalink
Fix JAnalysisDecoratedType regarding JsInterop.
Browse files Browse the repository at this point in the history
JAnalysisDecoratedType was supposed to forward most
of the methods to the underlying type, however it
was inheriting the default implementation of some of
the methods introduced for JsInterop from JType.

Change-Id: I9b377d680ce1c0b395067680638d4eb676cbe63f
  • Loading branch information
rluble authored and Gerrit Code Review committed Dec 11, 2015
1 parent 67b5552 commit 848af07
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 24 deletions.
20 changes: 20 additions & 0 deletions dev/core/src/com/google/gwt/dev/jjs/ast/JArrayType.java
Expand Up @@ -58,6 +58,11 @@ public String getJsniSignatureName() {
return "[" + elementType.getJsniSignatureName(); return "[" + elementType.getJsniSignatureName();
} }


@Override
public JEnumType isEnumOrSubclass() {
return null;
}

public JType getLeafType() { public JType getLeafType() {
if (leafType == null) { if (leafType == null) {
if (elementType instanceof JArrayType) { if (elementType instanceof JArrayType) {
Expand Down Expand Up @@ -94,6 +99,16 @@ public boolean canBeImplementedExternally() {
return getLeafType().canBeImplementedExternally(); return getLeafType().canBeImplementedExternally();
} }


@Override
public boolean isJsType() {
return false;
}

@Override
public boolean isJsFunction() {
return false;
}

@Override @Override
public boolean isJsNative() { public boolean isJsNative() {
return getLeafType().isJsNative(); return getLeafType().isJsNative();
Expand All @@ -110,6 +125,11 @@ public boolean canBeReferencedExternally() {
&& !getLeafType().isJavaLangObject(); && !getLeafType().isJavaLangObject();
} }


@Override
public boolean isJavaLangObject() {
return false;
}

@Override @Override
public boolean replaces(JType originalType) { public boolean replaces(JType originalType) {
return (originalType instanceof JArrayType) return (originalType instanceof JArrayType)
Expand Down
5 changes: 5 additions & 0 deletions dev/core/src/com/google/gwt/dev/jjs/ast/JDeclaredType.java
Expand Up @@ -365,6 +365,11 @@ public Iterable<JMember> getMembers() {
return Iterables.<JMember>concat(fields, methods); return Iterables.<JMember>concat(fields, methods);
} }


@Override
public boolean isArrayType() {
return false;
}

@Override @Override
public boolean isJsType() { public boolean isJsType() {
return isJsType; return isJsType;
Expand Down
10 changes: 10 additions & 0 deletions dev/core/src/com/google/gwt/dev/jjs/ast/JInterfaceType.java
Expand Up @@ -76,6 +76,16 @@ public boolean isJsoType() {
return false; return false;
} }


@Override
public boolean isJavaLangObject() {
return false;
}

@Override
public JEnumType isEnumOrSubclass() {
return null;
}

public boolean hasDefaultMethods() { public boolean hasDefaultMethods() {
assert !isExternal(); assert !isExternal();
return Iterables.any(getMethods(), new Predicate<JMethod>() { return Iterables.any(getMethods(), new Predicate<JMethod>() {
Expand Down
35 changes: 35 additions & 0 deletions dev/core/src/com/google/gwt/dev/jjs/ast/JPrimitiveType.java
Expand Up @@ -74,6 +74,31 @@ public boolean canBeNull() {
return false; return false;
} }


@Override
public boolean isArrayType() {
return false;
}

@Override
public boolean isJsType() {
return false;
}

@Override
public boolean isJsFunction() {
return false;
}

@Override
public boolean isJsNative() {
return false;
}

@Override
public boolean canBeImplementedExternally() {
return false;
}

@Override @Override
public boolean canBeSubclass() { public boolean canBeSubclass() {
return false; return false;
Expand All @@ -98,6 +123,11 @@ public String getJsniSignatureName() {
return signatureName; return signatureName;
} }


@Override
public JEnumType isEnumOrSubclass() {
return null;
}

public String getWrapperTypeName() { public String getWrapperTypeName() {
return wrapperTypeName; return wrapperTypeName;
} }
Expand All @@ -117,6 +147,11 @@ public boolean canBeReferencedExternally() {
return this != JPrimitiveType.LONG; return this != JPrimitiveType.LONG;
} }


@Override
public boolean isJavaLangObject() {
return false;
}

@Override @Override
public void traverse(JVisitor visitor, Context ctx) { public void traverse(JVisitor visitor, Context ctx) {
if (visitor.visit(this, ctx)) { if (visitor.visit(this, ctx)) {
Expand Down
70 changes: 70 additions & 0 deletions dev/core/src/com/google/gwt/dev/jjs/ast/JReferenceType.java
Expand Up @@ -40,6 +40,11 @@ public String getJsniSignatureName() {
return "N"; return "N";
} }


@Override
public JEnumType isEnumOrSubclass() {
return null;
}

@Override @Override
public boolean isAbstract() { public boolean isAbstract() {
return false; return false;
Expand All @@ -55,11 +60,46 @@ public boolean isJsoType() {
return false; return false;
} }


@Override
public boolean isArrayType() {
return false;
}

@Override @Override
public boolean isNullType() { public boolean isNullType() {
return true; return true;
} }


@Override
public boolean isJsType() {
return false;
}

@Override
public boolean isJsFunction() {
return false;
}

@Override
public boolean isJsNative() {
return false;
}

@Override
public boolean canBeImplementedExternally() {
return false;
}

@Override
public boolean canBeReferencedExternally() {
return false;
}

@Override
public boolean isJavaLangObject() {
return false;
}

@Override @Override
public void traverse(JVisitor visitor, Context ctx) { public void traverse(JVisitor visitor, Context ctx) {
if (visitor.visit(this, ctx)) { if (visitor.visit(this, ctx)) {
Expand Down Expand Up @@ -145,11 +185,41 @@ public boolean isArrayType() {
return ref.isArrayType(); return ref.isArrayType();
} }


@Override
public boolean isJsType() {
return ref.isJsType();
}

@Override
public boolean isJsFunction() {
return ref.isJsFunction();
}

@Override @Override
public boolean isJsoType() { public boolean isJsoType() {
return ref.isJsoType(); return ref.isJsoType();
} }


@Override
public boolean isJsNative() {
return ref.isJsNative();
}

@Override
public boolean canBeImplementedExternally() {
return ref.canBeImplementedExternally();
}

@Override
public boolean canBeReferencedExternally() {
return ref.canBeReferencedExternally();
}

@Override
public boolean isJavaLangObject() {
return ref.isJavaLangObject();
}

@Override @Override
public boolean isExternal() { public boolean isExternal() {
return ref.isExternal(); return ref.isExternal();
Expand Down
32 changes: 8 additions & 24 deletions dev/core/src/com/google/gwt/dev/jjs/ast/JType.java
Expand Up @@ -62,9 +62,7 @@ public JType(SourceInfo info, String name) {
*/ */
public abstract boolean canBeNull(); public abstract boolean canBeNull();


public boolean isArrayType() { public abstract boolean isArrayType();
return false;
}


/** /**
* Returns {@code true} if this is {@link JReferenceType.JNullType.INSTANCE}. * Returns {@code true} if this is {@link JReferenceType.JNullType.INSTANCE}.
Expand All @@ -73,29 +71,17 @@ public boolean isNullType() {
return false; return false;
} }


public boolean isJsType() { public abstract boolean isJsType();
return false;
}


public boolean isJsFunction() { public abstract boolean isJsFunction();
return false;
}


public boolean isJsNative() { public abstract boolean isJsNative();
return false;
}


public boolean canBeImplementedExternally() { public abstract boolean canBeImplementedExternally();
return false;
}


public boolean canBeReferencedExternally() { public abstract boolean canBeReferencedExternally();
return false;
}


public boolean isJavaLangObject() { public abstract boolean isJavaLangObject();
return false;
}


/** /**
* Returns {@code true} if this is a JavaScriptObject type. * Returns {@code true} if this is a JavaScriptObject type.
Expand Down Expand Up @@ -161,9 +147,7 @@ public String getPackageName() {
* Returns the (closest) enum supertype if the type is a subclass of an enum; it returns * Returns the (closest) enum supertype if the type is a subclass of an enum; it returns
* {@code this} if {@code this} is a {@link JEnumType} and {@code null} otherwise. * {@code this} if {@code this} is a {@link JEnumType} and {@code null} otherwise.
*/ */
public JEnumType isEnumOrSubclass() { public abstract JEnumType isEnumOrSubclass();
return null;
}


/** /**
* Binary name of the type. * Binary name of the type.
Expand Down

0 comments on commit 848af07

Please sign in to comment.