Goktug Gokdogan has uploaded a new change for review.
https://gwt-review.googlesource.com/3230
Change subject: Fixes JRawType#getImplementedMethods to return correct
signature for inherited methods
......................................................................
Fixes JRawType#getImplementedMethods to return correct signature for
inherited methods
Original author forgot to override some methods which was causing
getImplementedMethods
to not erase the types for the methods inherited from superclasses.
Bugs: Issue 8177
Change-Id: I7e2c4cf3d2d0bc1e50ecab1e257a6ac1d0e496d0
---
M dev/core/src/com/google/gwt/core/ext/typeinfo/JGenericType.java
M dev/core/src/com/google/gwt/dev/javac/typemodel/JRawType.java
M dev/core/test/com/google/gwt/dev/javac/typemodel/JRawTypeTest.java
A dev/core/test/com/google/gwt/dev/javac/typemodel/test/MyArrayList.java
4 files changed, 53 insertions(+), 3 deletions(-)
diff --git
a/dev/core/src/com/google/gwt/core/ext/typeinfo/JGenericType.java
b/dev/core/src/com/google/gwt/core/ext/typeinfo/JGenericType.java
index 83700ef..bdbe1a0 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JGenericType.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JGenericType.java
@@ -22,5 +22,10 @@
JParameterizedType asParameterizedByWildcards();
+ /**
+ * Returns the raw type for this generic type. The raw type removes
all 'generics' information
+ * from the class. i.e. {@code void a1(List<T>)} & {@code void
a2(List<String>)} becomes
+ * {@code void a1(List)} & {@code void a2(List))} respectively.
+ */
JRawType getRawType();
}
diff --git a/dev/core/src/com/google/gwt/dev/javac/typemodel/JRawType.java
b/dev/core/src/com/google/gwt/dev/javac/typemodel/JRawType.java
index 4770000..585cb7f 100644
--- a/dev/core/src/com/google/gwt/dev/javac/typemodel/JRawType.java
+++ b/dev/core/src/com/google/gwt/dev/javac/typemodel/JRawType.java
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* Represents a raw type; that is a generic type with no type arguments.
@@ -104,6 +105,18 @@
}
@Override
+ protected void getInheritableMethodsOnSuperclassesAndThisClass(
+ Map<String, JMethod> methodsBySignature) {
+
members.getInheritableMethodsOnSuperclassesAndThisClass(methodsBySignature);
+ }
+
+ @Override
+ protected void
getInheritableMethodsOnSuperinterfacesAndMaybeThisInterface(
+ Map<String, JMethod> methodsBySignature) {
+
members.getInheritableMethodsOnSuperinterfacesAndMaybeThisInterface(methodsBySignature);
+ }
+
+ @Override
public JMethod[] getInheritableMethods() {
return members.getInheritableMethods();
}
diff --git
a/dev/core/test/com/google/gwt/dev/javac/typemodel/JRawTypeTest.java
b/dev/core/test/com/google/gwt/dev/javac/typemodel/JRawTypeTest.java
index 919ee08..072e64e 100644
--- a/dev/core/test/com/google/gwt/dev/javac/typemodel/JRawTypeTest.java
+++ b/dev/core/test/com/google/gwt/dev/javac/typemodel/JRawTypeTest.java
@@ -18,6 +18,7 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.NotFoundException;
+import com.google.gwt.dev.javac.typemodel.test.MyArrayList;
import com.google.gwt.dev.javac.typemodel.test.MyCustomList;
import com.google.gwt.dev.javac.typemodel.test.MyIntegerList;
import com.google.gwt.dev.javac.typemodel.test.MyList;
@@ -49,8 +50,25 @@
}
@Override
- public void testGetInheritableMethods() {
- // TODO Auto-generated method stub
+ public void testGetInheritableMethods() throws NotFoundException {
+ JMethod addMethod = null;
+ JMethod indexedAddMethod = null;
+ for (JMethod jMethod : getTestType().getInheritableMethods()) {
+ if (jMethod.getName().equals("add")) {
+ if (jMethod.getParameters().length == 1) {
+ assertNull(addMethod);
+ addMethod = jMethod;
+ } else {
+ assertEquals(2, jMethod.getParameters().length);
+ assertNull(indexedAddMethod);
+ indexedAddMethod = jMethod;
+ }
+ }
+ }
+
+ JClassType javaLangObject =
moduleContext.getOracle().getJavaLangObject();
+ assertEquals(javaLangObject, addMethod.getParameters()[0].getType());
+ assertEquals(javaLangObject,
indexedAddMethod.getParameters()[1].getType());
}
@Override
@@ -111,7 +129,7 @@
@Override
protected JRawType getTestType() throws NotFoundException {
TypeOracle oracle = moduleContext.getOracle();
- JClassType testType = oracle.getType(ArrayList.class.getName());
+ JClassType testType = oracle.getType(MyArrayList.class.getName());
return testType.isGenericType().getRawType();
}
}
diff --git
a/dev/core/test/com/google/gwt/dev/javac/typemodel/test/MyArrayList.java
b/dev/core/test/com/google/gwt/dev/javac/typemodel/test/MyArrayList.java
new file mode 100644
index 0000000..26a5756
--- /dev/null
+++ b/dev/core/test/com/google/gwt/dev/javac/typemodel/test/MyArrayList.java
@@ -0,0 +1,14 @@
+package com.google.gwt.dev.javac.typemodel.test;
+
+import java.util.ArrayList;
+
+/**
+ * A subtype of ArrayList.
+ */
+public class MyArrayList<T> extends ArrayList<T> {
+
+ @Override
+ public boolean add(T o) {
+ return super.add(o);
+ }
+}
--
To view, visit https://gwt-review.googlesource.com/3230
To unsubscribe, visit https://gwt-review.googlesource.com/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e2c4cf3d2d0bc1e50ecab1e257a6ac1d0e496d0
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Goktug Gokdogan <[email protected]>
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
---
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.