JEP: Extending generics to support primitive type arguments

Stephen Colebourne scolebourne at joda.org
Mon Jul 7 16:47:15 UTC 2014


Sometimes compatibility can go too far. This might be one of those
times. Anyone relying on the identity of Integer is being very very
dumb (not just a little dumb), and breaking their code seems like it
could be a reasonable trade off compared with the potential benefits.
Stephen


On 7 July 2014 17:25, Brian Goetz <brian.goetz at oracle.com> wrote:
> We couldn't possibly remove it; that could break existing code.  (Just
> because its dumb to rely on the identity of an Integer, doesn't mean people
> haven't.)  All we can do is hope to obsolete it.
>
> Compatibility is a harsh mistress.
>
>
> On 7/6/2014 9:35 AM, Martijn Verburg wrote:
>>
>> Hi Brian,
>>
>> I'll echo Paul and add "Good Luck" :-). My only real comment is that I'm
>> not sure the question of: "Is there any impact / change / removal
>> required for the existing autoboxing/unboxing functionality"?
>>
>> Cheers,
>> Martijn
>>
>>
>> On 26 June 2014 19:20, Paul Benedict <pbenedict at apache.org
>> <mailto:pbenedict at apache.org>> wrote:
>>
>>     Brian, what a puzzler! This might be the most complex proposed
>>     feature yet.
>>     It will be a treat to see how others solve the problem.
>>
>>     Here is my first comment...
>>     Given T=int, I would like to see the JVM magically substitute in an
>>     "object" that's backed by the primitive. I use "object" in quotes
>>     because I
>>     am not referring to something that's instantiated per primitive value
>> --
>>     but some sort of synthetic singleton where all int primitives point
>>     to the
>>     same one. Since there is no other state in this "object" but the value
>>     itself, this seems okay. The primitive value is actually the "this"
>>     pointer
>>     in the virtual method call.
>>
>>
>>
>>
>>     Cheers,
>>     Paul
>>
>>
>>     On Fri, Jun 20, 2014 at 8:41 PM, Brian Goetz <brian.goetz at oracle.com
>>     <mailto:brian.goetz at oracle.com>> wrote:
>>
>>      > I've submitted the following JEP for extending generics to support
>>      > primitive type arguments:
>>      >
>>      > https://bugs.openjdk.java.net/browse/JDK-8046267
>>      >
>>      > Comments welcome!
>>      >
>>      >
>>
>>
>


More information about the platform-jep-discuss mailing list