Bug 218500 - [dom] bug in ITypeBinding.getQualifiedName for member of local type
Summary: [dom] bug in ITypeBinding.getQualifiedName for member of local type
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 218437
  Show dependency tree
 
Reported: 2008-02-11 09:09 EST by Martin Aeschlimann CLA
Modified: 2008-08-06 12:43 EDT (History)
4 users (show)

See Also:


Attachments
screenshot of AST View (28.29 KB, image/png)
2008-07-21 04:54 EDT, Martin Aeschlimann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2008-02-11 09:09:32 EST
Build ID: M20071023-1652

- Open the code example from bug 218437 in the AST View.
- Look at the type binding of 'Bug' on 'line 27'.
- The qualified name is '<Type>.Row'
It should be the empty name as spec'ed in the Javadoc of TypeBinding.getQualifiedName

'Local types (including anonymous classes) and members of local types do
not have a fully qualified name. For these types, and array types thereof,
this method returns an empty string.'

--------------------- Bug.java -------------------
import org.eclipse.swt.widgets.*;

class Bug{
        {
                abstract class LeafPage<Type extends Short>{

                        abstract class Row{

                                final Button radio;
                                final Control[]children;

Row(final Composite left,final String name,
                final Composite rite,
                final boolean lastFocus,final Control...kids){
                                        children=kids;
        (radio=new Button(left,0)).getBackground();
                                        radio.setText(name+':');
                                        radio.setData(this);
                                }
                        }

                        Combo pickWay;

public void createControl(final Composite parent){
final Composite a=new Composite(parent,0);
//////////////
new Row(a,"",a,true,(Control)null){} //// LINE 27 ////
/////////////
.children[0]=pickWay=new Combo(a,0);
        }
}}}
Comment 1 Olivier Thomann CLA 2008-07-14 15:01:31 EDT
If you look at the qualified name for the binding that corresponds to the anonymous type, then it is an empty name.
If you look at the qualified name for the simple name "Row", then it is the qualified name of the member type "Row" and it looks ok.
Am I missing something ?
Comment 2 Martin Aeschlimann CLA 2008-07-21 04:54:44 EDT
Created attachment 107906 [details]
screenshot of AST View

Isn't 'Row' a local type (inside an initializer) and should also have the empty qualified name? See screenshot for what I see in 3.4.
Comment 3 Olivier Thomann CLA 2008-07-28 10:04:46 EDT
(In reply to comment #2)
> Isn't 'Row' a local type (inside an initializer) and should also have the empty
> qualified name? See screenshot for what I see in 3.4.
Sorry, but I disagree. Row is a member type. What is the local type is the type binding that corresponds to the anonymous class declaration.
So if you want the empty name, you either look at the type binding of the class instance creation or you look at the type binding of the anonymous class declaration that is part of the class instance creation.
I don't think we can change anything here. It definitely looks ok to me.
Comment 4 Markus Keller CLA 2008-07-28 13:03:50 EDT
*** Bug 242252 has been marked as a duplicate of this bug. ***
Comment 5 Markus Keller CLA 2008-07-28 13:28:04 EDT
(In reply to comment #4)
> *** Bug 242252 has been marked as a duplicate of this bug. ***
Sorry, not a dup of this bug.

(In reply to comment #3)
I agree with Olivier that there's a difference between
a) the type binding of the ClassInstanceCreation (a local type, which correctly
has no qualified name), and
b) the type binding of the CIC's type (a reference to the type Row, which is a
member type of the local type LeafPage)

But I also agree with Martin that the CIC's type "Row" in "new Row(...){}"
should have an empty qualified name, since the spec cited in comment 0 says:
"[..] and members of local types do not have a fully qualified name."
          ^^^^^^^^^^^^^^^^^^^^^^
Comment 6 Olivier Thomann CLA 2008-07-28 15:06:13 EDT
Sorry, I missed the initializer.
I'll look at it again.
Comment 7 Olivier Thomann CLA 2008-07-28 19:42:25 EDT
Released for 3.5M1.
Added regression test org.eclipse.jdt.core.tests.dom.ASTConverter15Test#test0318
Comment 8 Kent Johnson CLA 2008-08-06 12:43:10 EDT
Verified for 3.5M1 using I20080805-1307