QDox
  1. QDox
  2. QDOX-37

Problem parsing the com.sun.java.swing.plaf.gtk.SynthButtonListener class

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.4
    • Component/s: Java API
    • Labels:
      None
    • Environment:
      Lastest 1.4 snapshot
      Java 1.4.2_01
      WinXp
    • Number of attachments :
      0

      Description

      There is a strange behaviour with the method getImplementedInterfaces().

      According to the Java API sources, this class implements seven interfaces :

      • MouseListener,
      • MouseMotionListener,
      • FocusListener,
      • ChangeListener,
      • PropertyChangeListener,
      • SynthEventListener,
      • LazyActionMap.Loader.

      So the result to the getImplementedInterfaces() metho call returns an array with seven JavaClasses slots. However the first slot is null.

      It appear that the six following JavaClasses slots represent the first six interfaces (MouseListener, MouseMotionListener,FocusListener, ChangeListener, PropertyChangeListener and SynthEventListener)

      It means that the DefaultClassLoader cannot find the LazyActionMap.Loader interface located in the same package as the SynthButtonListener. That is to say com.sun.java.swing.plaf.gtk.

      It may be cause of the fact the Loader interface is an inner interface.

      Is there a solution ?

        Activity

        Hide
        Mike Williams added a comment -

        Most likely because it's an inner-class; inner-class resolution is slightly broken right now (see QDOX-29).

        Show
        Mike Williams added a comment - Most likely because it's an inner-class; inner-class resolution is slightly broken right now (see QDOX-29 ).
        Mike Williams made changes -
        Field Original Value New Value
        Assignee Mike Williams [ mdub ]
        Mike Williams made changes -
        Fix Version/s 1.4 [ 10304 ]
        Component/s Java API [ 10125 ]
        Hide
        Konstantin Pribluda added a comment -

        Patch attached to qdox-36 may help you.

        Show
        Konstantin Pribluda added a comment - Patch attached to qdox-36 may help you.
        Hide
        Aslak Hellesøy added a comment -

        This is most likely not parser related.

        It is most likely classloader related because of some '.' not being correctly converted to '$' before attempting to load the inner class/interface.

        Type.getJavaClass() (or some of the methods it calls) needs more information.

        Which brings up a more general question about naming standards for inner classes.

        Consider:

        package a;
        class B {
        class C {}
        class D extends C {}
        }

        Which one of these should pass?

        a) assertTrue( d.isA("a.B.C") );
        b) assertTrue( d.isA("a.B$C") );

        In my opinion, a) should fail and b) should pass. The proper class name of inner classes does use '$' instead of '.' (It is only in java source imports that the '$' is replaced with '.' - for some stupid reason that causes too much confusion).

        Show
        Aslak Hellesøy added a comment - This is most likely not parser related. It is most likely classloader related because of some '.' not being correctly converted to '$' before attempting to load the inner class/interface. Type.getJavaClass() (or some of the methods it calls) needs more information. Which brings up a more general question about naming standards for inner classes. Consider: package a; class B { class C {} class D extends C {} } Which one of these should pass? a) assertTrue( d.isA("a.B.C") ); b) assertTrue( d.isA("a.B$C") ); In my opinion, a) should fail and b) should pass. The proper class name of inner classes does use '$' instead of '.' (It is only in java source imports that the '$' is replaced with '.' - for some stupid reason that causes too much confusion).
        Hide
        Aslak Hellesøy added a comment -

        This is most likely because the inner class' name contains '.' where there should actually be '$'.

        We should avoid the use of '.' for inner classes everywhere. It is evil.

        Sun decided to let developers use the dotted syntax instead of $ for referring to inner classes/interfaces in source code. This must have been to please the developers eyes and keep backward compatibility on the language (lexical) level. In fact, they just introduced a new source of confusion.)

        I think QDox should expect inner classes to be named with $ everywhere.

        Show
        Aslak Hellesøy added a comment - This is most likely because the inner class' name contains '.' where there should actually be '$'. We should avoid the use of '.' for inner classes everywhere. It is evil. Sun decided to let developers use the dotted syntax instead of $ for referring to inner classes/interfaces in source code. This must have been to please the developers eyes and keep backward compatibility on the language (lexical) level. In fact, they just introduced a new source of confusion.) I think QDox should expect inner classes to be named with $ everywhere.
        Hide
        Eric Dechaux added a comment -

        And in the cases where QDOX fails to resolve a class.inner class/interface could it be possible to tell QDOX trying again with the last "." in the class name replaced by a "$".

        That is to say when QDOX fails to resolve the LazyActionMap.Loader interface, it tries again to resolve LazyActionMap$Loader...

        I'm sure it is not the best way to fix, but it may work, isn't it ?

        Show
        Eric Dechaux added a comment - And in the cases where QDOX fails to resolve a class.inner class/interface could it be possible to tell QDOX trying again with the last "." in the class name replaced by a "$". That is to say when QDOX fails to resolve the LazyActionMap.Loader interface, it tries again to resolve LazyActionMap$Loader... I'm sure it is not the best way to fix, but it may work, isn't it ?
        Hide
        Mike Williams added a comment -

        Eric, I've fixed the inner-class type-resolution issue (QDOX-29).

        However, I'm not entirely confident that this solves your problem. Were you actually trying to parse the Swing sources with QDox?

        In any case, might you be able to (A) try again with the CVS HEAD version of QDox, and let us know how it goes, and/or (B) provide a minimal failing test-case (e.g. one or two source-files that demonstrate the problem).

        Thanks.

        Show
        Mike Williams added a comment - Eric, I've fixed the inner-class type-resolution issue ( QDOX-29 ). However, I'm not entirely confident that this solves your problem. Were you actually trying to parse the Swing sources with QDox? In any case, might you be able to (A) try again with the CVS HEAD version of QDox, and let us know how it goes, and/or (B) provide a minimal failing test-case (e.g. one or two source-files that demonstrate the problem). Thanks.
        Hide
        Eric Dechaux added a comment -

        Thanks Mike. Your correction solves my problem

        As you guessed, I am actually writing a navigator for java sources (school project :/). QDOX behaves wonderfully

        I think you can close this bug now.

        Show
        Eric Dechaux added a comment - Thanks Mike. Your correction solves my problem As you guessed, I am actually writing a navigator for java sources (school project :/). QDOX behaves wonderfully I think you can close this bug now.
        Hide
        Mike Williams added a comment -

        Thanks Eric.

        Show
        Mike Williams added a comment - Thanks Eric.
        Mike Williams made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]

          People

          • Assignee:
            Mike Williams
            Reporter:
            Eric Dechaux
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: