Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 241508

Summary: [spec] Method org.eclipse.jdt.core.Signature.toString(String, String, String[], boolean, boolean) should better specify fullyQualifyTypeNames
Product: [Eclipse Project] JDT Reporter: Raffi Khatchadourian <raffi.khatchadourian>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, raffi.khatchadourian
Version: 3.3.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Raffi Khatchadourian CLA 2008-07-21 04:54:38 EDT
The boolean parameter "fullyQualifiedTypeNames" in the method org.eclipse.jdt.core.Signature.toString(String, String, String[], boolean, boolean) is never read and thus names returned are not fully qualified.
Comment 1 Olivier Thomann CLA 2008-07-21 12:01:53 EDT
I checked the source code and the argument is used.
The method body is:
	return toString(methodSignature, methodName, parameterNames, fullyQualifyTypeNames, includeReturnType, false);

And then it is passed into:
	toCharArray(methodSignature.toCharArray(), methodName == null ? null : methodName.toCharArray(), params, fullyQualifyTypeNames, includeReturnType, isVarArgs)

where it ends up being used appropriately.

Would you have an example of a wrong result?

Decreasing severity to normal.
Comment 2 Raffi Khatchadourian CLA 2008-07-21 16:15:05 EDT
 (In reply to comment #1)
> I checked the source code and the argument is used.

Is the version I listed above?

> The method body is:
> return toString(methodSignature, methodName, parameterNames,
> fullyQualifyTypeNames, includeReturnType, false);

Yup, sounds right.

> And then it is passed into:
> toCharArray(methodSignature.toCharArray(), methodName == null ? null :
> methodName.toCharArray(), params, fullyQualifyTypeNames, includeReturnType,
> isVarArgs)

Ok.

> where it ends up being used appropriately.

Hm, I'm afraid you'd need to define what appropriately means in this context :) I'll explain below.

> Would you have an example of a wrong result?

Sure! 

Input:
methodSignature	"(QString;QString;)QString;"	
methodName	"p.A.m2"	
parameterNames	null	
fullyQualifyTypeNames	true	
includeReturnType	true	

Expecting result:
"java.lang.String p.A.m2(java.lang.String, java.lang.String)"	

Actual result:
"String p.A.m2(String, String)"
Comment 3 Jerome Lanneluc CLA 2008-08-14 05:31:55 EDT
QString; is an unresolved signature. It would most likely resolve to Ljava.lang.String; but it could also resolve to Lmy.pack.String; if you defined a type String in my.pack

So fullyQualifyTypeNames applies only if a qualified signature is passed in.

I will clarify that in the Javadoc. Changing title accordingly.
Comment 4 Raffi Khatchadourian CLA 2008-08-14 05:50:20 EDT
(In reply to comment #3)
> QString; is an unresolved signature. It would most likely resolve to
> Ljava.lang.String; but it could also resolve to Lmy.pack.String; if you defined
> a type String in my.pack
> 
> So fullyQualifyTypeNames applies only if a qualified signature is passed in.
> 
> I will clarify that in the Javadoc. Changing title accordingly.
> 

Gotcha, thanks!
Comment 5 Eclipse Genie CLA 2020-01-28 16:45:00 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.