Bug 22148 - Qlfd. vs. unqlfd. Name from IField.getTypeSignature
Summary: Qlfd. vs. unqlfd. Name from IField.getTypeSignature
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-04 06:17 EDT by Stefan Braun CLA
Modified: 2002-09-19 07:30 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Braun CLA 2002-08-04 06:17:14 EDT
IField.getTypeSignature is returning different results for me, depending on if 
I use it on a binary or source type. For source types, it returns 
e.g. "QObject;" where for binary types it would return "Qjava.lang.Object;" 
(which is what I would prefer).

To reproduce, create a package called "pckg" and a class called Test in your 
runtime workspace:

package pckg;
public class Test {
	Object value;
}

E.g. in an editor part's setInput insert the following statements

IFile file = ((IFileEditorInput)input).getFile();
IProject project = file.getProject();
IJavaProject jp = JavaCore.create(project);

try {
	org.eclipse.jdt.core.IType tp = jp.findType("pckg.Test");
	org.eclipse.jdt.core.IField[] fields = tp.getFields();
	String signature = fields[0].getTypeSignature();
} catch (JavaModelException e) {
}

The string signature should be "QObject;". Now go and rename the package to 
pckg2 and you will see that signature contains "Qjava.lang.Object;".

I am using build 200206271827. Thanks for your help!
Comment 1 Jerome Lanneluc CLA 2002-08-20 07:38:17 EDT
getTypeSignature doesn't resolve names. The returned info is as it is found in 
the java element. So for binary types, this info is already resolved (in the 
class file) but for source types, it is not (unless the field is specified as:
java.lang.Object field;)

To resolve this name, use IType.resolveType(String).

Ok to close?
Comment 2 Stefan Braun CLA 2002-08-21 08:40:29 EDT
Thanks for the explanation. OK to close. 
Maybe the documentation could be improved on. 
Comment 3 Jerome Lanneluc CLA 2002-09-19 07:29:20 EDT
Reopening to mark as WORKSFORME.
Comment 4 Jerome Lanneluc CLA 2002-09-19 07:30:05 EDT
Works as designed.