Maybe, maybe not. AFAIK inner classes should be ok. We're not qualifying
an inner class unless someone uses the type string in a field/param/etc
declaration, and that happens only when someone calls the API (say calls
method.getReturnType()), and it only happens when the parse for a class
is done (and we're iterating over methods for example). Right?

And judging from Frederick's stack:

   [xdoclet] java.lang.NullPointerException
   [xdoclet]     at 
xjavadoc.SimpleParser.FieldDeclaration(SimpleParser.java:657)
   [xdoclet]     at 
xjavadoc.SimpleParser.ClassBodyDeclaration(SimpleParser.java:390)
   [xdoclet]     at
xjavadoc.SimpleParser.ClassBody(SimpleParser.java:287)
   [xdoclet]     at 
xjavadoc.SimpleParser.UnmodifiedClassDeclaration(SimpleParser.java:249)
   [xdoclet]     at 
xjavadoc.SimpleParser.BlockStatement(SimpleParser.java:2768)
   [xdoclet]     at xjavadoc.SimpleParser.Block(SimpleParser.java:2659)
   [xdoclet]     at
xjavadoc.SimpleParser.Statement(SimpleParser.java:2531)
   [xdoclet]     at
xjavadoc.SimpleParser.IfStatement(SimpleParser.java:3060)
   [xdoclet]     at
xjavadoc.SimpleParser.Statement(SimpleParser.java:2566)
   [xdoclet]     at 
xjavadoc.SimpleParser.Method_BlockStatement(SimpleParser.java:2824)
   [xdoclet]     at
xjavadoc.SimpleParser.Method_Block(SimpleParser.java:2714)
   [xdoclet]     at 
xjavadoc.SimpleParser.MethodDeclaration(SimpleParser.java:1031)
   [xdoclet]     at 
xjavadoc.SimpleParser.ClassBodyDeclaration(SimpleParser.java:371)
   [xdoclet]     at
xjavadoc.SimpleParser.ClassBody(SimpleParser.java:287)
   [xdoclet]     at

In an if block inside a method an inner class is defined which has a
field and sourceClass.addField(fieldImpl); because sourceClass is null
because of line 1536 of the grammar file which passes null for the
sourceClass. Frederick, can you please find the part of the code with
these characteristics (inner class defined in a method->if block)? Am I
right?

So all method/switch/if/etc blocks should have a valid containing class.
So:

void BlockStatement(SourceClass sourceClass) :
{}
{
  LOOKAHEAD([ "final" ] Type() <IDENTIFIER>)
  LocalVariableDeclaration() ";"
|
  Statement()
|
  LOOKAHEAD( "class" | "interface" )
  {
     SourceClass innerClass = new SourceClass(sourceClass, null, null);
     sourceClass.addInnerClass( innerClass );
  }
  UnmodifiedClassDeclaration(innerClass)
|
  UnmodifiedInterfaceDeclaration(innerClass)
}

It will probably do the trick. Agree Aslak?
But now the problem is that we're calling BlockStatement() without any
parameter in the current code. So we should change it to pass a
sourceClass in. But duh! Look at these:

void Block() :
{}
{
  "{" ( BlockStatement() )* "}"
}

Ah, you see, many of these block nodes do not have sourceClass there to
pass on to BlockStatement! So we need a stack of sourceClasses in
SimpleParser. Put sourceClass on top of stack when a class is
created/found, pop when parsing that class is finished. When you
encounter an inner class, put it on top of stack and so on. Almost all
sourceClass method parameters will be gone this way. ContainingClass
will always be pick()-ed from stack.

What do you think? If you agree with this approach I'll handle it
tomorrow night.
 
Ara.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:xdoclet-user-
> [EMAIL PROTECTED]] On Behalf Of [EMAIL PROTECTED]
> Sent: Monday, June 24, 2002 1:58 PM
> To: Ara Abrahamian
> Cc: 'Frederick N. Brier'; [EMAIL PROTECTED]
> Subject: Re: RE: [Xdoclet-user] Nested classes running mbeaninterface
> subtask
> 
> Here is how to implement it (in SourceClass.java):
> 
> In qualify(String), when we instantiate an UnknownClass, we wrap it in
> a ProxyClass (we'll have to dig it out of the Attic) and return the
> ProxyClass instance. This instance is also kept in a class-mamber List
> of SourceClass
> 
> Every time an UnkownClass is instantiated in qualify(String), we store
> it in a List (class member of SourceClass). When parsing is complete,
> we go throug all the ProxyClasses in this list and try to re-qualify.
> This time we might be able to qualify some of the classes to inner
> classes (because they have now been parsed). If we do, we replace the
> ProxyClass' subject (which is an UnknownClass) with a reference to the
> SourceClass reresenting the inner class.
> 
> Does this sound ok?
> 
> Aslak
> 
> ----- Original Message -----
> From: "Ara Abrahamian" <[EMAIL PROTECTED]>
> Date: Monday, June 24, 2002 6:18 am
> Subject: RE: [Xdoclet-user] Nested classes running mbeaninterface
> subtask
> 
> > It's a known problem. I hope Aslak can fine some time to implement a
> > better system for handling inner classes :-) Btw if you move the
inner
> > class definition to the top of the outer class it works!
> >
> > Ara.
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] [mailto:xdoclet-
> > user-
> > > [EMAIL PROTECTED]] On Behalf Of Frederick N. Brier
> > > Sent: Monday, June 24, 2002 7:59 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [Xdoclet-user] Nested classes running mbeaninterface
> > subtask>
> > > I'm still having problems trying to build the JBoss messaging
> > module.I'm
> > > getting the exception below.  There is a message at the end of the
> > > exception, that leads me to believe there may be a problem with
> > nested> classes:
> > >
> > >    [xdoclet] org.jboss.mq.pm.file.PersistenceManager --> TxInfo
> > qualified
> > > to org.jboss.mq.pm.file.TxInfo
> > >    [xdoclet] org.jboss.mq.pm.rollinglogged.PersistenceManager -->
> > TxInfo
> > > qualified to org.jboss.mq.pm.rollinglogged.TxInfo
> > >
> > > TxInfo are is a nested static class inside PersistenceManager.
> > However
> > > the
> > > message says it is qualified to the same package,
> > > org.jboss.mq.pm.file.TxInfo, not
> > > org.jboss.mq.pm.file.PersistenceManager.TxInfo.  If the nested
class
> > is
> > > moved from towards the end of the class (in both classes) to the
> > > beginning,
> > > the above portion of the error message goes away, but the
> > exception is
> > > still thrown.  The weird thing is that there are other nested
static
> > > classes, but no specific error message is generated for them at
any
> > > point.  Is this a problem?
> > >
> > > I also noticed that a double semicolon also seemed to cause
xjavadoc
> > > heartburn (an exception).
> > >
> > > Thank you.
> > >
> > > Fred.
> > >
> > > compile-mbean-sources:
> > >      [mkdir] Created dir:
> > > D:\Multideck\JBoss3.1\jboss-all\messaging\output\gen-src
> > >    [xdoclet] (ModuleFinder.findModules            112 )
Registering
> > > XDoclet
> > > modules (searching for jars containing META-IN
> > >    [xdoclet] Running <mbeaninterface/>
> > >    [xdoclet] java.lang.NullPointerException
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.FieldDeclaration(SimpleParser.java:657)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.ClassBodyDeclaration(SimpleParser.java:390)
> > >    [xdoclet]     at
> > xjavadoc.SimpleParser.ClassBody(SimpleParser.java:287)
> > >    [xdoclet]     at
> > >
> > xjavadoc.SimpleParser.UnmodifiedClassDeclaration
> (SimpleParser.java:249)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.BlockStatement(SimpleParser.java:2768)
> > >    [xdoclet]     at
> > xjavadoc.SimpleParser.Block(SimpleParser.java:2659)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.Statement(SimpleParser.java:2531)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.IfStatement(SimpleParser.java:3060)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.Statement(SimpleParser.java:2566)
> > >    [xdoclet]     at
> > >
xjavadoc.SimpleParser.Method_BlockStatement(SimpleParser.java:2824)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.Method_Block(SimpleParser.java:2714)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.MethodDeclaration(SimpleParser.java:1031)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.ClassBodyDeclaration(SimpleParser.java:371)
> > >    [xdoclet]     at
> > xjavadoc.SimpleParser.ClassBody(SimpleParser.java:287)
> > >    [xdoclet]     at
> > >
> > xjavadoc.SimpleParser.UnmodifiedClassDeclaration
> (SimpleParser.java:249)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.ClassDeclaration(SimpleParser.java:208)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.TypeDeclaration(SimpleParser.java:137)
> > >    [xdoclet]     at
> > > xjavadoc.SimpleParser.CompilationUnit(SimpleParser.java:98)
> > >    [xdoclet]     at
xjavadoc.SourceClass.parse(SourceClass.java:231)
> > >    [xdoclet]     at
xjavadoc.XJavaDoc.scanAndPut(XJavaDoc.java:630)
> > >    [xdoclet]     at xjavadoc.XJavaDoc.getXClass(XJavaDoc.java:445)
> > >    [xdoclet]     at
> > xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:204)
> > >    [xdoclet]     at
> > xjavadoc.XJavaDoc.getSourceClasses(XJavaDoc.java:164)
> > >    [xdoclet]     at
> > >
> >
xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:600)
> >    [xdoclet]     at
> > > xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:551)
> > >    [xdoclet]     at
> > > xdoclet.TemplateSubTask.execute(TemplateSubTask.java:489)
> > >    [xdoclet]     at xdoclet.XDocletMain.start(XDocletMain.java:46)
> > >    [xdoclet]     at xdoclet.DocletTask.start(DocletTask.java:347)
> > >    [xdoclet]     at
> > > xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:66)
> > >    [xdoclet]     at
> > > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java)
> > >    [xdoclet]     at org.apache.tools.ant.Task.perform(Task.java)
> > >    [xdoclet]     at
org.apache.tools.ant.Target.execute(Target.java)
> > >    [xdoclet]     at
> > org.apache.tools.ant.Target.performTasks(Target.java)
> > >    [xdoclet]     at
> > > org.apache.tools.ant.Project.executeTarget(Project.java)
> > >    [xdoclet]     at
> > > org.apache.tools.ant.Project.executeTargets(Project.java)
> > >    [xdoclet]     at org.apache.tools.ant.Main.runBuild(Main.java)
> > >    [xdoclet]     at org.apache.tools.ant.Main.start(Main.java)
> > >    [xdoclet]     at org.apache.tools.ant.Main.main(Main.java)
> > >    [xdoclet] INFO:    Some classes refer to other classes that
were
> > not
> > > found among the sources or on the classpath.
> > >    [xdoclet]          (Perhaps the referred class doesn't exist?
> > Hasn't
> > > been generated yet?)
> > >    [xdoclet]          The referring classes do not import any the
> > fully
> > > qualified names of these classes.
> > >    [xdoclet]          However, since no packages are imported,
> > xjavadoc
> > > has
> > > assumed that the referred classes
> > >    [xdoclet]          belong to the same package as the referring
> > class.
> > > The classes are:
> > >    [xdoclet] org.jboss.mq.pm.file.PersistenceManager --> TxInfo
> > qualified
> > > to org.jboss.mq.pm.file.TxInfo
> > >    [xdoclet] org.jboss.mq.pm.rollinglogged.PersistenceManager -->
> > TxInfo
> > > qualified to org.jboss.mq.pm.rollinglogged.TxInfo
> > >
> > > BUILD FAILED
> > > D:\Multideck\JBoss3.1\jboss-all\messaging\build.xml:308:
Unexpected
> > error
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > Sponsored by:
> > > ThinkGeek at http://www.ThinkGeek.com/
> > > _______________________________________________
> > > Xdoclet-user mailing list
> > > [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > Sponsored by:
> > ThinkGeek at http://www.ThinkGeek.com/
> > _______________________________________________
> > Xdoclet-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> >
> 
> 
> 
> -------------------------------------------------------
> Sponsored by:
> ThinkGeek at http://www.ThinkGeek.com/
> _______________________________________________
> Xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user



-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to