I didn't know what I would start with this issue, but it seems to be pretty 
huge...

Changing stuff from toString() to getCommentBlock() was easy.

Then I started working out the toString() for JavaClass. For classes and 
interfaces no problems, but the primitives, void...

 

public void todo_testToStringVoid() {
cls.setName("com.MyClass");
cls.addMethod(new JavaMethod(Type.VOID, "doSomething"));
JavaMethod javaMethod = cls.getMethods()[0];
assertEquals("void", javaMethod.getReturns().getJavaClass().toString());
}

public void todo_testToStringInt() {
cls.setName("com.MyClass");
cls.addMethod(new JavaMethod(new Type("int"), "doSomething"));
JavaMethod javaMethod = cls.getMethods()[0];
assertEquals("int", javaMethod.getReturns().getJavaClass().toString());
}

 

in both cases getJavaClass() will return null.

 

On the other hand: watch this URL

 

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/reflect/Method.html#getReturnType()

 

aMethod.getReturnType().toString() will return for example the int, although 
getReturnType() returns a class. 

 

confusing or not?!?!

 

Robert


 
> Date: Sat, 28 Feb 2009 09:08:20 -0600
> From: [email protected]
> To: [email protected]
> Subject: [qdox-dev] [jira] Commented: (QDOX-151) introduce toString() 
> according to the Java Language Specification
> 
> 
> [ 
> http://jira.codehaus.org/browse/QDOX-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=167409#action_167409
>  ] 
> 
> Paul Hammant commented on QDOX-151:
> -----------------------------------
> 
> I'm for the getCodeBlock() change.
> 
> Its a very very niche case where someone uses the codeblock from toString() 
> and they should be able to change happily. Meanwhile a huge percentage of 
> folks watching QDox go by in an interactive debugger will be very pleased.
> 
> > introduce toString() according to the Java Language Specification
> > -----------------------------------------------------------------
> >
> > Key: QDOX-151
> > URL: http://jira.codehaus.org/browse/QDOX-151
> > Project: QDox
> > Issue Type: Improvement
> > Components: Java API
> > Affects Versions: 1.9
> > Reporter: Robert Scholte
> > Priority: Minor
> >
> > When calling the toString() on most of the model-Java* classes in qdox, 
> > it'll return the complete codeblock.
> > Their java.lang.reflect equivalent acts a bit different. For example 
> > http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Method.html#toString()
> >  
> > Nowhere is documented that toString() will return the complete codeblock.
> > two choices: keep the current toString(0 as it is and introduce another 
> > method ( toMethodString() or toSpecString() or ....)
> > or rename toString() (to getCodeblock() or ....) and implement the 
> > toString() according to tha javaAPI
> 
> -- 
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators: 
> http://jira.codehaus.org/secure/Administrators.jspa
> -
> For more information on JIRA, see: http://www.atlassian.com/software/jira
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
> http://xircles.codehaus.org/manage_email
> 
> 

_________________________________________________________________
See all the ways you can stay connected to friends and family
http://www.microsoft.com/windows/windowslive/default.aspx

Reply via email to