Comment #2 on issue 293 by phopkins: MoreTypes#toString(Type)  
double-qualifies parameterized inner classes
http://code.google.com/p/google-guice/issues/detail?id=293

Ah. Thanks for the heads-up about the tests. I *think* that the JDK is  
wrong about this, but I understand that
it probably makes more sense to match the JDK behavior.

I filed a bug at bugs.sun.com. I'll fill this in with the bug ID if they  
accept it.

I tracked down what I think is the source code for ParameterizedTypeImpl  
here:  
http://www.docjar.com/html/api/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java.html

You can see the oddity about doing an instanceof on the ownerType. This  
actually means that the JDK has
different (and IMO correct) behavior in just the "parameterized containing  
class" case that you mention! (And
is inconsistent with MoreTypes.) Guice is consistently adding the  
ownerType, while the JDK doesn't do it if the
ownerType is a ParameterizedType. This comes up when the type is a  
parameterized, non-static inner type of
a parameterized type. E.g.:

class Outer<S> {
   class Inner<T> {}
}

I've attached a patch that adds a failing test to TypesTest that shows how  
Guice will be consistent and double
the Outer class's name, while the JDK will return the "correct,"  
non-doubled name. I don't expect that you'll
"fix" MoreTypes to match this rather odd JDK behavior, of course, but it  
does lend support to the buggy JDK
opinion. We'll see if I get a response from Sun.

This is no huge deal, though graphs of Injectors with parameterized inner  
types will look a bit uglier with the
duplication. (See the long row of interfaces in the middle of the graph.) :)

Attachments:
        more-tostring.patch  2.1 KB
        grapher-graph.png  190 KB

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to