[patch] 6646584 Compound assignment with Byte, Short and Character
Dmytro Sheyko
dmytro_sheyko at hotmail.com
Thu Jan 3 07:39:39 PST 2008
Well...
Is there any reason to reject following statement
B += 1;
where 'B' is a variable of wrapper type 'java.lang.Byte' and accept in the same time following statements
b += 1;
++B;
where 'b' a variable of primitive type 'int'? Of course, besides that it is implied by JLS. I don't think that JLS was written so as intentionally reject compound assignments with some wrapper types. And current behavior seems inconsistent for me.If you like, this is RFE to JLS rather than bug in javac.
> CC: compiler-dev at openjdk.java.net> From: peter at ahe.dk> To: dmytro_sheyko at hotmail.com> Subject: Re: [patch] 6646584 Compound assignment with Byte, Short and Character> Date: Thu, 3 Jan 2008 15:22:53 +0100> > It is not a bug. See http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.26.2 > and http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7 > . There is no unboxing conversion from int to, for example, Short. I > think this is deliberate, as it would require a narrowing primitive > conversion from int to short and a possible loss of information. See: http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.3> > See also: http://blogs.sun.com/ahe/entry/contributing_to_javac> > Cheers,> Peter> > On Jan 3, 2008, at 2:12 PM, Dmytro Sheyko wrote:> > > Sure,> > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6646584> >> > From: peter.ahe at gmail.com> > To: dmytro_sheyko at hotmail.com> > Subject: Re: [patch] 6646584 Compound assignment with Byte, Short > > and Character> > Date: Thu, 3 Jan 2008 13:57:52 +0100> > CC: compiler-dev at openjdk.java.net> >> > I cannot access the bug report. Could someone provide a link?> >> > Cheers,> > Peter> >> > Sent from my iPhone> >> > On Jan 3, 2008, at 13:35, Dmytro Sheyko <dmytro_sheyko at hotmail.com> > > wrote:> >> > Hi,> >> > Attached patch that is to fix bug#6646584> >> > Problem description:> > Javac forbids compound assignment if lhs is of type Byte, Short, > > Character.> >> > Express yourself instantly with MSN Messenger! MSN Messenger>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20080103/b028c713/attachment.html
More information about the compiler-dev
mailing list