Skip to content

QuickFixScoutTutorial

Yuriy Brun edited this page Jul 23, 2015 · 6 revisions
  • Install Quick Fix Scout. (See how to install Quick Fix Scout.)
  • Open Eclipse and create a new project called "QFS Tutorial".
  • Create a new class called QFSTutorial in the default package.
  • Copy and paste the following code:
  public class QFSTutorial 
  {
      private string name = "Hello World";
  }

You will see:

  • Note that:
    1. string is underlined, indicating a compilation error.
    2. On the left of line 3, a red icon with an X indicates that Eclipse can suggest fixes for this compilation error.
    3. At the top, a * precedes QFSTutorial, indicating the file is unsaved.
  • Invoke Quick Fix by clicking on the red icon with an X on the left of line 3. Quick Fix Scout will save the file (the * will disappear) and the Quick Fix dialog will open:
  • Note three changes as compared to the same dialog without Quick Fix Scout:
    1. Each Quick Fix suggestion has a number (in parentheses) on the left that indicates how many compilation error will remain after applying this suggestion. For example, the suggestion Change to 'String' will fix all compilation errors. ("N/A" or "?" indicate that Quick Fix Scout could not compute the number.)
    2. The suggestions are sorted by the number of errors they fix.
    3. Suggestions that fix at least one error are green. Suggestions that fix no errors are black. Suggestions that introduce new errors are red.

Quick Fix Scout can also add new suggestions:

  • Adding a method to QFSTutorial:
      public class QFSTutorial
    {
    private string name = "Hello World";

    public void setName(String newName) {
    name = newName;
    }
    }
You will see:
    • Invoke Quick Fix on the second compilation error by clicking on the red icon with an X on the left of line 6. The Quick Fix dialog will open:


    • The top suggestion is a new suggestion that you would not see without Quick Fix Scout. Quick Fix Scout found that this suggestion existed for elsewhere in the project, but fixed this error, and more errors than all other local suggestions. Quick Fix Scout makes it clear that this this suggestion is not local in two ways:
      1. adding the file name, line number, and character number (QFSTutorial.java:3:13) after the (0) to indicate from where the suggestion came. (If Quick Fix Scout has trouble computing this location, the (0) will be followed by "!".)
      2. adding extra context information. For example, here, instead of just saying "Change to 'String'", the suggestion says "Change 'string' to 'String'".
    • Select the "Change 'string' to 'String'" suggestion to fix all compilation errors and complete the tutorial. Congratulations, you have killed two birds (compilation errors) with one stone (suggestion)!

    Troubleshooting

Clone this wiki locally