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 58119 - [editorhints] created method always "returns" void
Summary: [editorhints] created method always "returns" void
Status: VERIFIED FIXED
Alias: None
Product: contrib
Classification: Unclassified
Component: Code (show other bugs)
Version: 4.x
Hardware: All All
: P4 blocker (vote)
Assignee: _ leonchiver
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-20 19:54 UTC by Martin Krauskopf
Modified: 2005-09-05 09:54 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Krauskopf 2005-04-20 19:54:38 UTC
e.g. Action quitAction = GUIUtilities.createQuitAction();

Generates (previously non-existet method) createQuitAction() 

static void createQuitAction() {....

So original class remains uncompilable.

"static Action createQuitAction() {...." would be nice. Or "static Object..."
with selected Object like with the newly created (e.g.) fields.

Filing as enhancement since it is still much, much better than nothing.

PS: This one for Leon next one for Honza ;)
Comment 1 Jan Lahoda 2005-04-20 20:48:22 UTC
"void" for methods and "Object" for fields is the fallback (it means "I have no
idea of what type this should be."). It is trivial to make it "Object" for both.
But, in the described case, it is possible to guess the type, so it should
better propose the correct type.
Comment 2 _ leonchiver 2005-04-21 06:57:12 UTC
i guess it's not hard. will take care of it these days
Comment 3 _ leonchiver 2005-04-21 09:38:06 UTC
fixed. some functional tests to follow

Checking in CreateElementJavaHint.java;
/cvs/contrib/editorhints/java/src/org/netbeans/modules/java/hints/CreateElementJavaHint.java,v
 <--  CreateElementJavaHint.java
new revision: 1.13; previous revision: 1.12
done
Comment 4 Martin Krauskopf 2005-04-21 09:48:13 UTC
It's much better, thanks.
Comment 5 Martin Krauskopf 2005-04-27 21:43:05 UTC
It's fixed only for method created in _this_ class.

int a = createIntReturningMethod(); // works fine - creates method returning int

int a = OtherClassThanThis.createIntReturningMethod(); // this still creates
"static void". Should be "static int"
Comment 6 _ leonchiver 2005-04-28 17:36:15 UTC
so, it's hopefully fixed better now. added some more tests. please shoot if it
doesn't :)
Comment 7 Martin Krauskopf 2005-04-28 18:03:48 UTC
Am I too "gluttonous"? Feel free to close as WONTFIX ;)

class AA {
    static int getSomeInt() {
        return AA.pleasePleaseReturnInt();
    }
}

newly created method pleasePleaseReturnInt() should return int :)

But great work, thanks lot for a contribution to all hints-coders. I can't live
without it anymore!
Comment 8 _ leonchiver 2005-04-29 08:44:18 UTC
fixed (alltogether with some more usecases):

for example if you have:

existingMethod(int i)

and you write existingMethod(unexistingMethod()), the return type of
unexistingMethod should be int. 

thanks for reporting
Comment 9 Martin Krauskopf 2005-04-29 08:53:37 UTC
Yes, it seems that everything works now. Really fast. Thanks.