public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/35020]  New: Class.getSimpleName() differs from Sun Java
@ 2008-01-29 20:28 gcc-bugzilla at matthew dot ath dot cx
  2008-01-29 20:35 ` [Bug java/35020] " mark at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gcc-bugzilla at matthew dot ath dot cx @ 2008-01-29 20:28 UTC (permalink / raw)
  To: java-prs

Test Code:

public class test
{
   class inner
   {
   }
   public static void main(String[] args)
   {
      System.out.println(inner.class.getSimpleName());
   }
}

Result with GCJ:

root@hecate:/root# java test
test$inner

Result with Sun:

mjj29@hecate:/opt/sid/root $ sudo java test
inner

GCJ version 4.3-20080116-1

Sun version 1.6.0.00


-- 
           Summary: Class.getSimpleName() differs from Sun Java
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc-bugzilla at matthew dot ath dot cx


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


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

* [Bug java/35020] Class.getSimpleName() differs from Sun Java
  2008-01-29 20:28 [Bug java/35020] New: Class.getSimpleName() differs from Sun Java gcc-bugzilla at matthew dot ath dot cx
@ 2008-01-29 20:35 ` mark at gcc dot gnu dot org
  2008-01-29 21:02 ` mark at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mark at gcc dot gnu dot org @ 2008-01-29 20:35 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from mark at gcc dot gnu dot org  2008-01-29 20:35 -------
GNU Classpath contains:

2007-08-20  Andrew John Hughes  <gnu_andrew@member.fsf.org>

        * vm/reference/java/lang/VMClass.java:
        (getCanonicalName(Class)): Fix handling of member
        classes so we don't fall out of the if block.
        (getSimpleName(Class)): Handle class names which include
        the $ sign to break up anonymous/inner/member classes.

And with cacao and current classpath CVS you get:

$ cacao test
inner


-- 


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


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

* [Bug java/35020] Class.getSimpleName() differs from Sun Java
  2008-01-29 20:28 [Bug java/35020] New: Class.getSimpleName() differs from Sun Java gcc-bugzilla at matthew dot ath dot cx
  2008-01-29 20:35 ` [Bug java/35020] " mark at gcc dot gnu dot org
@ 2008-01-29 21:02 ` mark at gcc dot gnu dot org
  2008-05-22 16:21 ` [Bug libgcj/35020] " aph at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mark at gcc dot gnu dot org @ 2008-01-29 21:02 UTC (permalink / raw)
  To: java-prs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 908 bytes --]



------- Comment #2 from mark at gcc dot gnu dot org  2008-01-29 21:02 -------
Note that the libgcj and classpath versions of getSimpleName() were written
independently.

Although the classpath implementation might help in the short run. It is based
on syntactically reconstructing the simple name. The correct fix would use the
out class InnerClasses bytecode attribute.

inner_name_index
     If C is anonymous, the value of the inner_name_index item must be zero.
Otherwise, the value of the inner_name_index item must be a valid index into
the constant_pool table, and the entry at that index must be a
CONSTANT_Utf8_info (§4.4.7) structure that represents the original simple name
of C, as given in the source code from which this class file was compiled.

See
http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#79996


-- 


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


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

* [Bug libgcj/35020] Class.getSimpleName() differs from Sun Java
  2008-01-29 20:28 [Bug java/35020] New: Class.getSimpleName() differs from Sun Java gcc-bugzilla at matthew dot ath dot cx
  2008-01-29 20:35 ` [Bug java/35020] " mark at gcc dot gnu dot org
  2008-01-29 21:02 ` mark at gcc dot gnu dot org
@ 2008-05-22 16:21 ` aph at gcc dot gnu dot org
  2008-05-23 13:05 ` aph at gcc dot gnu dot org
  2008-05-23 13:05 ` aph at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: aph at gcc dot gnu dot org @ 2008-05-22 16:21 UTC (permalink / raw)
  To: java-prs



------- Comment #3 from aph at gcc dot gnu dot org  2008-05-22 16:21 -------
Subject: Bug 35020

Author: aph
Date: Thu May 22 16:20:55 2008
New Revision: 135771

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135771
Log:
2008-05-22  Andrew Haley  <aph@redhat.com>

        PR libgcj/35020
        * java/lang/Class.java (getSimpleName): Import from GNU Classpath.


Modified:
    trunk/libjava/ChangeLog
    trunk/libjava/classpath/lib/java/lang/Class$1.class
    trunk/libjava/classpath/lib/java/lang/Class.class
    trunk/libjava/java/lang/Class.java


-- 


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


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

* [Bug libgcj/35020] Class.getSimpleName() differs from Sun Java
  2008-01-29 20:28 [Bug java/35020] New: Class.getSimpleName() differs from Sun Java gcc-bugzilla at matthew dot ath dot cx
                   ` (3 preceding siblings ...)
  2008-05-23 13:05 ` aph at gcc dot gnu dot org
@ 2008-05-23 13:05 ` aph at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: aph at gcc dot gnu dot org @ 2008-05-23 13:05 UTC (permalink / raw)
  To: java-prs



------- Comment #5 from aph at gcc dot gnu dot org  2008-05-23 13:05 -------
Fixed.


-- 

aph at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug libgcj/35020] Class.getSimpleName() differs from Sun Java
  2008-01-29 20:28 [Bug java/35020] New: Class.getSimpleName() differs from Sun Java gcc-bugzilla at matthew dot ath dot cx
                   ` (2 preceding siblings ...)
  2008-05-22 16:21 ` [Bug libgcj/35020] " aph at gcc dot gnu dot org
@ 2008-05-23 13:05 ` aph at gcc dot gnu dot org
  2008-05-23 13:05 ` aph at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: aph at gcc dot gnu dot org @ 2008-05-23 13:05 UTC (permalink / raw)
  To: java-prs



------- Comment #4 from aph at gcc dot gnu dot org  2008-05-23 13:05 -------
Subject: Bug 35020

Author: aph
Date: Fri May 23 13:04:18 2008
New Revision: 135801

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135801
Log:
2008-05-22  Andrew Haley  <aph@redhat.com>

        PR libgcj/35020
        * java/lang/Class.java (getSimpleName): Replace incorrect use of
        String.lastIndexOf(String, int) with String.substring.
        * testsuite/libjava.lang/PR35020.java: New file.
        * testsuite/libjava.lang/PR35020.out: New file.


Added:
    trunk/libjava/testsuite/libjava.lang/PR35020.jar   (with props)
    trunk/libjava/testsuite/libjava.lang/PR35020.java
    trunk/libjava/testsuite/libjava.lang/PR35020.out
Modified:
    trunk/libjava/ChangeLog
    trunk/libjava/classpath/lib/java/lang/Class$1.class
    trunk/libjava/classpath/lib/java/lang/Class.class
    trunk/libjava/java/lang/Class.java

Propchange: trunk/libjava/testsuite/libjava.lang/PR35020.jar
            ('svn:mime-type' added)


-- 


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


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

end of thread, other threads:[~2008-05-23 13:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-29 20:28 [Bug java/35020] New: Class.getSimpleName() differs from Sun Java gcc-bugzilla at matthew dot ath dot cx
2008-01-29 20:35 ` [Bug java/35020] " mark at gcc dot gnu dot org
2008-01-29 21:02 ` mark at gcc dot gnu dot org
2008-05-22 16:21 ` [Bug libgcj/35020] " aph at gcc dot gnu dot org
2008-05-23 13:05 ` aph at gcc dot gnu dot org
2008-05-23 13:05 ` aph 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).