JavaLookupTests.st
branchdevelopment
changeset 1893 167f2898b9ad
parent 1886 746919e0fc34
child 1898 51de40865b71
--- a/JavaLookupTests.st	Sun Dec 16 14:08:27 2012 +0100
+++ b/JavaLookupTests.st	Sun Dec 16 14:16:59 2012 +0100
@@ -99,10 +99,11 @@
 
     md := self javaTestClass methodDictionary.
     md copy keysAndValuesDo:[:sel :m|
-        m isSynthetic ifTrue:[md removeKey: sel]
+        m isProxyMethod ifTrue:[md removeKey: sel]
     ].
 
     "Created: / 03-12-2012 / 17:50:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-12-2012 / 13:35:52 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
 ! !
 
 !JavaLookupTests methodsFor:'support'!
@@ -212,6 +213,19 @@
     "Created: / 30-08-2011 / 22:06:16 / Jan Kurs <kursjan@fit.cvut.cz>"
 !
 
+testInterfaceMethodsWithNarrowerReturnType
+    "when a class A implements an interface I, and overridden method has narrower 
+    return type (e.g. method in I should return java.lang.Object, but overridden 
+    method in A declares return type of java.lang.String), java compiler generates
+    synthetic method with the same name and return type declared in I, which just
+    delegates to overridden method. This situation should not be considered
+    as error case, instead, one of the methods should be returned."
+
+self assert: (self javaTestClass new getMethodReturningObject) = 'working'.
+
+    "Created: / 16-12-2012 / 12:56:01 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
+!
+
 testMultipleParameters
     "test multiple parameters"