public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/34444]  New: Class.getEnclosingClass() returns null on enclosed class
@ 2007-12-12 10:49 gcc-bugzilla at matthew dot ath dot cx
  2007-12-12 16:29 ` [Bug java/34444] " tromey at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gcc-bugzilla at matthew dot ath dot cx @ 2007-12-12 10:49 UTC (permalink / raw)
  To: java-prs

Class.getEnclosingClass() returns null on enclosed class.

Specifically:

   c = class org.freedesktop.DBus$Local$Disconnected
   c.getEnclosingClass() = null

   (followed by a null pointer exception on the next line)

Code which prints that:

   if (Debug.debug) Debug.print(Debug.VERBOSE, "c = "+c);
        if (Debug.debug) Debug.print(Debug.VERBOSE, "c.getEnclosingClass() =
"+c.getEnclosingClass());
        if (Debug.debug) Debug.print(Debug.VERBOSE,
"c.getEnclosingClass().getAnnotation(DBusInterfaceName.class) =
"+c.getEnclosingClass().getAnnotation(DBusInterfaceName.class));
         if (null !=
c.getEnclosingClass().getAnnotation(DBusInterfaceName.class))

Source for DBus$Local$Disconnected:

public interface DBus extends DBusInterface
{

 ....

   /**
    * Messages generated locally in the application.
    */
   public interface Local extends DBusInterface
   {
      public class Disconnected extends DBusSignal
      {
         public Disconnected(String path) throws DBusException
         {
            super(path);
         }
      }
   }

  ....
}

GCC version:

gcc (GCC) 4.2.3 20071123 (prerelease) (Debian 4.2.2-4)

(Also happens in 4.2.2)

This code works as expected in Sun JDK 5 and 6

Matt


-- 
           Summary: Class.getEnclosingClass() returns null on enclosed class
           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
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


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


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

* [Bug java/34444] Class.getEnclosingClass() returns null on enclosed class
  2007-12-12 10:49 [Bug java/34444] New: Class.getEnclosingClass() returns null on enclosed class gcc-bugzilla at matthew dot ath dot cx
@ 2007-12-12 16:29 ` tromey at gcc dot gnu dot org
  2008-01-04 14:42 ` aph at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-12-12 16:29 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from tromey at gcc dot gnu dot org  2007-12-12 16:28 -------
Here's a complete test case.
The .class file does have the InnerClasses attribute,
we just don't seem to read it properly.

public class p
{
  public interface DBI { }

  public interface Local extends DBI {
    public class Disconnected
    {
      public Disconnected()
      {
      }
    }
  }

  public static void main(String[] args) throws Throwable {
    Class c = Local.Disconnected.class;
    System.out.println(c.getEnclosingClass());
  }
}


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-12 16:28:59
               date|                            |


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


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

* [Bug java/34444] Class.getEnclosingClass() returns null on enclosed class
  2007-12-12 10:49 [Bug java/34444] New: Class.getEnclosingClass() returns null on enclosed class gcc-bugzilla at matthew dot ath dot cx
  2007-12-12 16:29 ` [Bug java/34444] " tromey at gcc dot gnu dot org
@ 2008-01-04 14:42 ` aph at gcc dot gnu dot org
  2008-01-04 17:19 ` [Bug libgcj/34444] " aph at gcc dot gnu dot org
  2008-01-04 17:19 ` aph at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: aph at gcc dot gnu dot org @ 2008-01-04 14:42 UTC (permalink / raw)
  To: java-prs



-- 

aph at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |aph at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-12-12 16:28:59         |2008-01-04 14:42:41
               date|                            |


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


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

* [Bug libgcj/34444] Class.getEnclosingClass() returns null on enclosed class
  2007-12-12 10:49 [Bug java/34444] New: Class.getEnclosingClass() returns null on enclosed class gcc-bugzilla at matthew dot ath dot cx
  2007-12-12 16:29 ` [Bug java/34444] " tromey at gcc dot gnu dot org
  2008-01-04 14:42 ` aph at gcc dot gnu dot org
@ 2008-01-04 17:19 ` aph at gcc dot gnu dot org
  2008-01-04 17:19 ` aph at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: aph at gcc dot gnu dot org @ 2008-01-04 17:19 UTC (permalink / raw)
  To: java-prs



------- Comment #3 from aph at gcc dot gnu dot org  2008-01-04 17:19 -------
Subject: Bug 34444

Author: aph
Date: Fri Jan  4 17:18:56 2008
New Revision: 131326

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

        PR libgcj/34444
        * java/lang/natClass.cc (Class::getEnclosingClass): Call
        getDeclaringClass().

Modified:
    trunk/libjava/ChangeLog
    trunk/libjava/java/lang/natClass.cc


-- 


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


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

* [Bug libgcj/34444] Class.getEnclosingClass() returns null on enclosed class
  2007-12-12 10:49 [Bug java/34444] New: Class.getEnclosingClass() returns null on enclosed class gcc-bugzilla at matthew dot ath dot cx
                   ` (2 preceding siblings ...)
  2008-01-04 17:19 ` [Bug libgcj/34444] " aph at gcc dot gnu dot org
@ 2008-01-04 17:19 ` aph at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: aph at gcc dot gnu dot org @ 2008-01-04 17:19 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from aph at gcc dot gnu dot org  2008-01-04 17:19 -------
Another case where Sun's javadoc was rather vague.


-- 

aph at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
          Component|java                        |libgcj
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-01-04 17:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-12 10:49 [Bug java/34444] New: Class.getEnclosingClass() returns null on enclosed class gcc-bugzilla at matthew dot ath dot cx
2007-12-12 16:29 ` [Bug java/34444] " tromey at gcc dot gnu dot org
2008-01-04 14:42 ` aph at gcc dot gnu dot org
2008-01-04 17:19 ` [Bug libgcj/34444] " aph at gcc dot gnu dot org
2008-01-04 17:19 ` 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).