Hello

I'm new to this list and rather new to JAXME, too, so please point me to 
an appropriate manual if I'm missing something. I did a quick look at the 
archive, but found nothing about this.
What I want to do is Java source reflection, with JaxMeJs, for proxy 
generation.

I noticed that the parser can't handle multidimensional arrays as input 
parameter for methods. Possibly also elsewhere, but I did only look at 
this specific subject.

public void testArray2Nested(de.ahring.generated.Test_InNested[][] foo2) 
throws RemoteException;

when I parse the source (js.parse), get the list of methods 
(js.getMethods), get the parameters of this method (method.getParams) and 
look at the returned type (param.getType) the type is 
de.ahring.generated.Text_InNested[] - so only one dimension is read.

I did a bit of debugging and found that in JavaParser.java, 
parseIdentifier(AST, StringBuffer) the JavaToken 'DOT' is used with a 
loop, getting all childelements, whereas the JavaToken 'ARRAY_DECLARATOR' 
only appends '[]' one time, then quits.

            case JavaTokenTypes.ARRAY_DECLARATOR:
                sb.append("[]");
                break;

The AST - without having looked into the complete source I assume this is 
the preparsed structure the ANTLR generates - does have the second '[', in 
the down-AST. So I changed it to:

            case JavaTokenTypes.ARRAY_DECLARATOR:
                sb.append("[]");
                // 08.07.2005 FAHRING Hack for multi dimension arrays
                for (AST child = pAST.getFirstChild();  child != null; 
child = child.getNextSibling()) {
                    parseIdentifier(child, sb);
                }
                // END HACK
                break;

Now it get's parsed correctly: type is [EMAIL PROTECTED], holding 
itself an [EMAIL PROTECTED] and only then the 
[EMAIL PROTECTED]

I have not yet checked what sideeffects this might have nor if it would be 
necessary to make other changes as well to fully support it.

I would like to hear your opinion of this. was it a missing feature (bug) 
or left out on purpose? Would my hack fix it or break things in other 
places? Feel free to comment.

If it's a good idea, commit it to the CVS. Frankly, I've no idea how to do 
this since I've never done it before :)

:Frederic:

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to