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

Summary: Misleading error message for Introduce Method
Product: java Reporter: _ gtzabari <gtzabari>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: blocker CC: markiewb
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

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"