This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 206052 - "Change return type" and "Change type" hints for generic types generate unformatted code
Summary: "Change return type" and "Change type" hints for generic types generate unfor...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.1
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-07 08:51 UTC by dbell
Modified: 2013-06-24 16:46 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dbell 2011-12-07 08:51:41 UTC
[ BUILD # : 201112012200 ]
[ JDK VERSION : 1.7.1 ]

Consider the following class:

class MyClass<T> {
    Map<Map<?, ?>, ?> myMap = new HashMap<Map<?, ?>, Object>();
    
    Set<Map<? super T, ?>> getLists() {
        return myMap.keySet();|
    }
    
    void assignLists() {
        Set<Map<? super T, ?>> lists = myMap.keySet();|
    }
}


Observed Behaviour

Pressing Ctrl-Enter (show hints) at the first carat position shows one hint:

        "Change method return type to Set>" (note the trailing angle bracket)

Invoking the hint changes the first method signature as follows:

        Set<Map< ?,   ?>> getLists() {  (note the spaces inside the angle
brackets)


Pressing Ctrl-Enter (show hints) at the second carat position shows one hint:

        "Change type of lists to Set<Map<?,?>>"

Invoking the hint changes the variable assignment in the second method
signature as follows:

        Set<Map< ?,       ?>> lists = myMap.keySet();  (note the spaces inside
the angle brackets)




Expected Behaviour:

The first hint should read something like "Change method return type to
Set<Map<?, ?>>" (adding the type argument of Set), and produce the same code
but without extra spaces within the angle brackets (i.e.  the method signature
should be "Set<Map<?, ?>> getLists() {" ). The second hint should produce the
same code but without the angle brackets (i.e. the variable assignment should
be " Set<Map<?, ?>> lists = myMap.keySet();")
Comment 1 Jan Lahoda 2012-11-28 14:09:40 UTC
The display name fixed by:
http://hg.netbeans.org/jet-main/rev/fbffc200d896

The rest is a bug in the code generator.
Comment 2 Quality Engineering 2012-11-30 02:39:53 UTC
Integrated into 'main-golden', will be available in build *201211300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/fbffc200d896
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #206052: fix display name must escape '<'.
Comment 3 Jan Lahoda 2013-06-24 16:46:28 UTC
I tried a recent trunk build, at it seems it is working OK now. There were 10+ changes in the related areas, so presumably some of these fixed this problem as well. Please reopen if it still happens to you. Thanks.