Re: PR libgcj/35020: Class.getSimpleName() differs from Sun Java

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Andrew,

please take a look at my proposed patch and mauve testcase for this:
http://developer.classpath.org/pipermail/classpath-patches/2008-April/005991.html

Regards,
  Sebastian

Andrew Haley schrieb:
> Andrew Haley wrote:
>> 2008-05-22  Andrew Haley  <aph@xxxxxxxxxx>
>>
>>         PR libgcj/35020
>>         * java/lang/Class.java (getSimpleName): Import from GNU Classpath.
> 
> Hmph.  It looks like the GNU Classpath version of Class.getSimpleName()
> was just as bad as the libgcj version.  Fixed thusly.
> 
> Andrew.
> 
> 
> 2008-05-22  Andrew Haley  <aph@xxxxxxxxxx>
> 
> 	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.
> 
> Index: java/lang/Class.java
> ===================================================================
> *** java/lang/Class.java        (revision 135771)
> --- java/lang/Class.java        (working copy)
> ***************
> *** 1090,1099 ****
>         ++pos;
>         while (Character.isDigit(fullName.charAt(pos)))
>           ++pos;
>         }
> !     int packagePos = fullName.lastIndexOf(".", pos);
>       if (packagePos == -1)
> !       return fullName.substring(pos);
>       else
>         return fullName.substring(packagePos + 1);
>     }
> --- 1090,1101 ----
>         ++pos;
>         while (Character.isDigit(fullName.charAt(pos)))
>           ++pos;
> +       fullName = fullName.substring(pos);
>         }
> ! 
> !     int packagePos = fullName.lastIndexOf(".");
>       if (packagePos == -1)
> !       return fullName;
>       else
>         return fullName.substring(packagePos + 1);
>     }
> Index: testsuite/libjava.lang/PR35020.java
> ===================================================================
> *** testsuite/libjava.lang/PR35020.java (revision 0)
> --- testsuite/libjava.lang/PR35020.java (revision 0)
> ***************
> *** 0 ****
> --- 1,21 ----
> + public class PR35020
> + {
> +    class inner
> +    {
> +    }
> +    public static void main(String[] args)
> +    {
> +       System.out.println(inner.class.getSimpleName());
> +       System.out.println(PR35020.class.getSimpleName());
> +       System.out.println(Class.class.getSimpleName());
> +       System.out.println((new int[7]).getClass().getSimpleName());
> +       System.out.println((new Object[1][1][1][1][1][1][1][1]).getClass().getSimpleName());
> +       System.out.println((new java.security.PrivilegedAction() 
> +       {
> +         public Object run() {
> +           return null;
> +         }
> +       }).getClass().getSimpleName());
> +    }
> + }
> + 
> Index: testsuite/libjava.lang/PR35020.out
> ===================================================================
> *** testsuite/libjava.lang/PR35020.out  (revision 0)
> --- testsuite/libjava.lang/PR35020.out  (revision 0)
> ***************
> *** 0 ****
> --- 1,6 ----
> + inner
> + PR35020
> + Class
> + int[]
> + Object[][][][][][][][]
> + 
> 

- --
tarent Gesellschaft für Softwareentwicklung und IT-Beratung mbH

Heilsbachstr. 24, 53123 Bonn    | Poststr. 4-5, 10178 Berlin
fon: +49(228) / 52675-0         | fon: +49(30) / 27594853
fax: +49(228) / 52675-25        | fax: +49(30) / 78709617
durchwahl: +49(228) / 52675-17  | mobil: +49(171) / 7673249

Geschäftsführer:
Boris Esser, Elmar Geese, Thomas Müller-Ackermann
HRB AG Bonn 5168
Ust-ID: DE122264941
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFINtW3sMJ2Yk81wE0RAl0HAJ9bLnrTLumH7GhXLljpYSYUdNmvNACfY7E8
V5VpD+pK/2e6UjvE4GOmmEo=
=nGNT
-----END PGP SIGNATURE-----



[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux