I have tried to create a JUnit test for the AssignabilityChecker class, but 
that's not so easy. So I run the test from the JUnit test provided by the 
mvp4g project. You can easily reproduce the error. Just check out the mvp4g 
code from trunk, delete the AssignabilityChecker class and run the method 
testPath method from ServiceAnnotationsLoaderTest.

I am using the isAssignable method from AssignabilityChecker class. The 
value of the from parameter is something the SimpleService interface of 
mvp4g. The value of the to parameter is "java.lang.object". The 
"isAssignable" method calls "isAssignableFromRaw". 

The first thing this method does is to call "isJavaLangObject(to)". 

The code of the "isJavaLangObject" method looks like this:

private static boolean isJavaLangObject(JClassType type) {
  return type == type.getOracle().getJavaLangObject();
}


type.getOracle().getJavaLangObject() returns "java.lang.Object<>". If this 
is compared to the raw type "java.lang.Object" the compare will fail. I 
have added two Screenshots. p02.png will show the value as the 
isAssignableFromRaw is called and p03.png will show the value which is 
returned by the method getJavaLangObject.

Will you be at the GWT.create in Munich?  If yes, I can show you the 
problem.
  
The screenshots can be downloaded here:

http://www.hossfeld-solutions.de/downloads/p02.png
http://www.hossfeld-solutions.de/downloads/p03.png


Am Dienstag, 20. Januar 2015 21:53:03 UTC+1 schrieb Goktug Gokdogan:
>
> I tried to reproduce the problem in GWT. I added following to 
> JParameterizedTypeTest
>     assertType("Object").isAssignableFrom("List");
>     assertType("Object").isAssignableFrom("Integer");
>
> and both cases doesn't fail.
>
> I also don't understand what you mean about converting java.lang.Object to 
> raw type. java.lang.Object is not a generic type so it cannot have a raw 
> type.
>
> Can you provide the exact types that your are passing or better reproduce 
> the problem in JParameterizedTypeTest so we can take a look at the issue?
>
>
> On Mon, Jan 19, 2015 at 2:07 AM, Frank Hossfeld <frank.h...@googlemail.com 
> <javascript:>> wrote:
>
>> Please can you prove that it is a bug or am I doing something wrong? I 
>> make an update to the AssignabilityChecker (this time with less code 
>> changes). If it is a bug, the changes should solve it.
>>
>> Am Samstag, 17. Januar 2015 14:34:36 UTC+1 schrieb Frank Hossfeld:
>>
>>> It look like that there is a bug inside the AssignabilityChecker class 
>>> of GWT 2.7.0.
>>>
>>> If you use the method isAssignableFromRaw(JClassType from, JClassType 
>>> to) to check weather something is assignable to the „to“ parameter or not, 
>>> the method will always fail if the value of the parameter „to“ is 
>>> „java.lang.object“. 
>>>
>>> The first thing this method does is to check if the „to“-parameter is 
>>> the java.lang.object type. Therefor the method calls the method 
>>> „isJavaLangObject(JClassType type)“. This method compares parameter type 
>>> with  type.getOracle().getJavaLangObject(). But 
>>> type.getOracle().getJavaLangObject() 
>>> does not return a raw type. To solve this problem, the value of 
>>> type.getOracle().getJavaLangObject() must be converted to a raw type.
>>>
>>> The method is used to times. Once it is called from 
>>> isAssignableFromGenericArrayType(JarrayType from, JClassType to), where 
>>> the method isJavaLangObject(to) will work correct The second call is the 
>>> one from isAssignableFromRaw, where the compare will fail.
>>>
>>> To solve this problem, I have created a another method:
>>>
>>> *private static boolean isJavaLangObjectRawType(JClassType rawType) {*
>>>
>>> *   return rawType == 
>>> convertToRawIfGeneric(rawType.getOracle().getJvaLangObject());*
>>>
>>> *}*
>>>
>>> and call this method from isAssignableFromRaw. Using this patch, 
>>> everything works correct.
>>>
>>> To test this error, you can download the mvp4g framework (trunk) from
>>>
>>> *https://code.google.com/p/mvp4g/source/checkout 
>>> <https://code.google.com/p/mvp4g/source/checkout>*
>>>
>>> and run the method:
>>>
>>> *testGeneratedClass*
>>>
>>> from the class:
>>>
>>> *com.mvp4g.rebind.config.loader.annotation.ServicesAnnotationsLoaderTest*
>>>
>>> I have created a patch and assigned it. Using the patch, the test will 
>>> behave in the same way as it does with GWT 2.6.1.
>>>
>>> Frank
>>>
>>>  
>>>
>>> Enviorement: OS X 10.10.1, Java 1.7, IntelliJ Ultimate Editition 14.0.2
>>>
>>>  
>>>
>>>  
>>>
>>  -- 
>> 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 google-web-toolkit-contributors+unsubscr...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-web-toolkit-contributors/3895a392-dd05-4450-813e-eceaf447adea%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/3895a392-dd05-4450-813e-eceaf447adea%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/fa42088b-e9ab-48dd-b252-618fee582a1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to