False positive in case of exhaustive switches

Issue #76 new
Michael Eichberg repo owner created an issue
              try
                {
                    int inputInt = Integer.decode(input);

                    if (((inputInt >= NONE_ENTRY) && (inputInt <= BOTH_ENTRY)))
                    {
                        switch (inputInt)
                        {
                        case NONE_ENTRY: {
                            return KeyType.NONE;
                        }
                        case RSA_ENTRY: {
                            return KeyType.RSA;
                        }
                        case DSA_ENTRY: {
                            return KeyType.DSA;
                        }
                        case BOTH_ENTRY: {
466                      return KeyType.BOTH;
                        }
                        }
                    }
                    else
                    {
                        System.out.println("Invalid option...");
                    }
                }

summary

dead code found; the successor instruction is dead: pc=228 (line=466)
location
public final [SUPER] gui.local.commandline.views. GFTSNodeSecurityConfigOption { private GFTSSSHConfig$KeyType inputKeyType () [ pc=181 line=454 ] } 
The evaluation of the instruction never leads to the evaluation of the specified instruction.
switch int  [1,4] (case values: 1, 2, 3, 4 )
Local Variable State
Index   Name    Value
0   this    gui.local.commandline.views.GFTSNodeSecurityConfigOption[@-1;t=101]
1   NONE_ENTRY  int = 1
2   RSA_ENTRY   int = 2
3   DSA_ENTRY   int = 3
4   BOTH_ENTRY  int = 4
5   br  java.io.BufferedReader[@131;t=147]
6   input   {_ <: java.lang.String, null}[@152;t=151]
7   inputInt    int  [1,4]

Comments (3)

  1. Log in to comment