public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/32862]  New: bug in EnumMap implementation
@ 2007-07-23  8:02 debian-gcc at lists dot debian dot org
  2007-07-23 16:11 ` [Bug java/32862] " tromey at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2007-07-23  8:02 UTC (permalink / raw)
  To: java-prs

[forwarded from http://bugs.debian.org/423160]

seen with trunk 20070720

The gij implementation of EnumMap class contains a flaw: it returns
strange java.lang.Object classes for missing elements. The error can be
demonstrated with this program:

=== Cut ===
import java.util.*;

public class Test {
        enum TestEnum {
                FIRST, SECOND
        }

        public static void main(String[] args) {
                Map<TestEnum, String> map = new EnumMap<TestEnum,
String>(TestEnum.class);
                map.put(TestEnum.FIRST, "first");
                System.out.println(map);
                System.out.println(map.containsKey(TestEnum.SECOND));
                System.out.println(map.get(TestEnum.SECOND));
        }
}

$ gcj -C Test.java

tmp $ gij Test
{FIRST=first}
false
Exception in thread "main" java.lang.ClassCastException:
java.lang.Object cannot be cast to java.lang.String
   at Test.main(Test.java:13)

tmp $ java Test
{FIRST=first}
false
null

=== Cut ===

As you can see, Sun Java (the last call) returns correct null, while
GNU libgcj returns bogus java.lang.Object.


-- 
           Summary: bug in EnumMap implementation
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32862


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug java/32862] bug in EnumMap implementation
  2007-07-23  8:02 [Bug java/32862] New: bug in EnumMap implementation debian-gcc at lists dot debian dot org
@ 2007-07-23 16:11 ` tromey at gcc dot gnu dot org
  2007-07-24 15:27 ` cvs-commit at developer dot classpath dot org
  2007-08-07 17:38 ` tromey at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-07-23 16:11 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from tromey at gcc dot gnu dot org  2007-07-23 16:11 -------
I have a fix I'm testing.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |tromey at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-23 16:11:28
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32862


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug java/32862] bug in EnumMap implementation
  2007-07-23  8:02 [Bug java/32862] New: bug in EnumMap implementation debian-gcc at lists dot debian dot org
  2007-07-23 16:11 ` [Bug java/32862] " tromey at gcc dot gnu dot org
@ 2007-07-24 15:27 ` cvs-commit at developer dot classpath dot org
  2007-08-07 17:38 ` tromey at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at developer dot classpath dot org @ 2007-07-24 15:27 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from cvs-commit at developer dot classpath dot org  2007-07-24 15:27 -------
Subject: Bug 32862

CVSROOT:        /cvsroot/classpath
Module name:    classpath
Changes by:     Tom Tromey <tromey>     07/07/24 15:26:36

Modified files:
        .              : ChangeLog 
        java/util      : EnumMap.java 

Log message:
                PR java/32862:
                * java/util/EnumMap.java (get): Special case emptySlot.
                (clone): Rewrote.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.9354&r2=1.9355
http://cvs.savannah.gnu.org/viewcvs/classpath/java/util/EnumMap.java?cvsroot=classpath&r1=1.4&r2=1.5


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32862


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug java/32862] bug in EnumMap implementation
  2007-07-23  8:02 [Bug java/32862] New: bug in EnumMap implementation debian-gcc at lists dot debian dot org
  2007-07-23 16:11 ` [Bug java/32862] " tromey at gcc dot gnu dot org
  2007-07-24 15:27 ` cvs-commit at developer dot classpath dot org
@ 2007-08-07 17:38 ` tromey at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-08-07 17:38 UTC (permalink / raw)
  To: java-prs



------- Comment #3 from tromey at gcc dot gnu dot org  2007-08-07 17:38 -------
Fixed via classpath import.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32862


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-07 17:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-23  8:02 [Bug java/32862] New: bug in EnumMap implementation debian-gcc at lists dot debian dot org
2007-07-23 16:11 ` [Bug java/32862] " tromey at gcc dot gnu dot org
2007-07-24 15:27 ` cvs-commit at developer dot classpath dot org
2007-08-07 17:38 ` tromey at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).