#55 Autoboxing/Unboxing problem

v1.0.0-m4
open
nobody
None
5
2013-11-14
2013-11-14
No

This java code does not translate correctly:

Integer i = 0;
System.out.println(++i);
System.out.println(i);
System.out.println(--i);
System.out.println(i);
System.out.println(i--);
System.out.println(i);
System.out.println(i++);
System.out.println(i);

Long l = 0L;
System.out.println(++l);
System.out.println(l);
System.out.println(--l);
System.out.println(l);
System.out.println(l--);
System.out.println(l);
System.out.println(l++);
System.out.println(l);

Character c = 0;
System.out.println(++c);
System.out.println(c);
System.out.println(--c);
System.out.println(c);
System.out.println(c--);
System.out.println(c);
System.out.println(c++);
System.out.println(c);

Byte b = 0;
System.out.println(++b);
System.out.println(b);
System.out.println(--b);
System.out.println(b);
System.out.println(b--);
System.out.println(b);
System.out.println(b++);
System.out.println(b);


javascript:

var i = new Integer (0);
System.out.println (++(i).intValue ());
System.out.println (i);
System.out.println (--(i).intValue ());
System.out.println (i);
System.out.println ((i).intValue ()--);
System.out.println (i);
System.out.println ((i).intValue ()++);
System.out.println (i);
var l = new Long (0);
System.out.println (++(l).longValue ());
System.out.println (l);
System.out.println (--(l).longValue ());
System.out.println (l);
System.out.println ((l).longValue ()--);
System.out.println (l);
System.out.println ((l).longValue ()++);
System.out.println (l);
var c = new Integer (0);
System.out.println (++(c).charValue ());
System.out.println (c);
System.out.println (--(c).charValue ());
System.out.println (c);
System.out.println ((c).charValue ()--);
System.out.println (c);
System.out.println ((c).charValue ()++);
System.out.println (c);
var b = new Integer (0);
System.out.println (++(b).byteValue ());
System.out.println (b);
System.out.println (--(b).byteValue ());
System.out.println (b);
System.out.println ((b).byteValue ()--);
System.out.println (b);
System.out.println ((b).byteValue ()++);
System.out.println (b);

1 Attachments

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks