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 158869 - Misleading error message for Introduce Method
Summary: Misleading error message for Introduce Method
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-20 04:30 UTC by _ gtzabari
Modified: 2013-09-02 14:22 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 _ gtzabari 2009-02-20 04:30:21 UTC
1) Select the following text:

--------------
        if (postArray.equals("byte"))
          return "B";
        if (postArray.equals("char"))
          return "C";
        if (postArray.equals("double"))
          return "D";
        if (postArray.equals("float"))
          return "F";
        if (postArray.equals("int"))
          return "I";
        if (postArray.equals("long"))
          return "J";
        if (postArray.equals("short"))
          return "S";
        if (postArray.equals("boolean"))
          return "Z";
        if (postArray.equals("void"))
          return "V";
-----------

2) Select "Introduce Method"
3) Netbeans complains "Different return values" when in fact all expressions are returning a String. The real source of
the error is that the method is missing a return value if all conditionals evaluate to false. Adding a non-condiitonal
"return" statement to the end of the block solves the problem.

I am expecting Netbeans to give a clearer error message such as: "Missing return statement"