vazexqi / CodingSpectator

Watches and analyzes code edits in the Eclipse IDE non-invasively
http://codingspectator.cs.illinois.edu
Other
20 stars 14 forks source link

Some navigation histories contain just a single event #292

Closed reprogrammer closed 13 years ago

reprogrammer commented 13 years ago

Every navigation history should contain at least two items: the invocation of the refactoring and the termination of it. However, I found 35 refactorings whose navigation history just captures the beginning of the refactoring. I found these refactorings while trying to compute the duration of time spent on configuring each refactoring.

I executed the following query against our database of events:

DROP TABLE "PUBLIC"."INCOMPLETE_NAVIGATION_HISTORIES" IF EXISTS;

CREATE TABLE "PUBLIC"."INCOMPLETE_NAVIGATION_HISTORIES" (
  "REFACTORING_ID" VARCHAR(1000),
  "REFACTORING_KIND" VARCHAR(50),
  "INVOKED_BY_QUICKASSIST" VARCHAR(20),
  "INVOKED_THROUGH_STRUCTURED_SELECTION" VARCHAR(20)
);

INSERT INTO "PUBLIC"."INCOMPLETE_NAVIGATION_HISTORIES" (
  "REFACTORING_ID",
  "REFACTORING_KIND",
  "INVOKED_BY_QUICKASSIST",
  "INVOKED_THROUGH_STRUCTURED_SELECTION"
)
SELECT
"PUBLIC"."ALL_DATA"."id" AS "REFACTORING_ID",
"PUBLIC"."ALL_DATA"."refactoring kind" AS "REFACTORING_KIND",
"PUBLIC"."ALL_DATA"."invoked-by-quickassist" AS "INVOKED_BY_QUICKASSIST",
"PUBLIC"."ALL_DATA"."invoked-through-structured-selection" AS "INVOKED_THROUGH_STRUCTURED_SELECTION"
FROM "PUBLIC"."ALL_DATA"
WHERE
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Local Variable,BEGIN_REFACTORING,1309954040630],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Local Variable,BEGIN_REFACTORING,1309954028186],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Move Method,BEGIN_REFACTORING,1309952831998],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Move Method,BEGIN_REFACTORING,1309952829670],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Move Method,BEGIN_REFACTORING,1309934149786],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Inline Local Variable,BEGIN_REFACTORING,1309850423426],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Type,BEGIN_REFACTORING,1309425304036],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Inline Method,BEGIN_REFACTORING,1309421517347],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Move Method,BEGIN_REFACTORING,1309419191191],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Interface,BEGIN_REFACTORING,1309418217443],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Change Method Signature,BEGIN_REFACTORING,1309262797778],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Type,BEGIN_REFACTORING,1309252331491],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Type,BEGIN_REFACTORING,1309159437847],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1307135462618],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1307134227235],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311034201897],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311032084373],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311032061791],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1312326861824],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Local Variable,BEGIN_REFACTORING,1312148179530],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1312146633794],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311800385935],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311779560790],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1308255959625],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Method,BEGIN_REFACTORING,1311215735219],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Interface,BEGIN_REFACTORING,1311015867840],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Package,BEGIN_REFACTORING,1310163142688],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Java Project,BEGIN_REFACTORING,1307927660097],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Java Project,BEGIN_REFACTORING,1307927086594],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Java Project,BEGIN_REFACTORING,1308687458150],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Local Variable,BEGIN_REFACTORING,1307886734408],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Inline Method,BEGIN_REFACTORING,1307885859456],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Inline Method,BEGIN_REFACTORING,1307742824432],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308268632464],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308733798398],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308733759024],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308733693767],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308733621605],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308733600472],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308721007951],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1307463514097],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Local Variable,BEGIN_REFACTORING,1308472392651],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311476703859],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1310959938994],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1310166631724],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Local Variable,BEGIN_REFACTORING,1309954040630],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Local Variable,BEGIN_REFACTORING,1309954028186],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Move Method,BEGIN_REFACTORING,1309952831998],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Move Method,BEGIN_REFACTORING,1309952829670],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Move Method,BEGIN_REFACTORING,1309934149786],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Inline Local Variable,BEGIN_REFACTORING,1309850423426],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Type,BEGIN_REFACTORING,1309425304036],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Inline Method,BEGIN_REFACTORING,1309421517347],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Move Method,BEGIN_REFACTORING,1309419191191],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Interface,BEGIN_REFACTORING,1309418217443],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Change Method Signature,BEGIN_REFACTORING,1309262797778],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Type,BEGIN_REFACTORING,1309252331491],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Type,BEGIN_REFACTORING,1309159437847],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1307135462618],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1307134227235],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311034201897],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311032084373],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311032061791],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1312326861824],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Local Variable,BEGIN_REFACTORING,1312148179530],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1312146633794],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311800385935],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311779560790],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1308255959625],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Method,BEGIN_REFACTORING,1311215735219],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Interface,BEGIN_REFACTORING,1311015867840],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Package,BEGIN_REFACTORING,1310163142688],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Java Project,BEGIN_REFACTORING,1307927660097],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Java Project,BEGIN_REFACTORING,1307927086594],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Java Project,BEGIN_REFACTORING,1308687458150],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Local Variable,BEGIN_REFACTORING,1307886734408],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Inline Method,BEGIN_REFACTORING,1307885859456],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Inline Method,BEGIN_REFACTORING,1307742824432],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308268632464],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308733798398],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308733759024],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308733693767],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308733621605],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308733600472],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Rename Compilation Unit,BEGIN_REFACTORING,1308721007951],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1307463514097],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Local Variable,BEGIN_REFACTORING,1308472392651],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1311476703859],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1310959938994],}' OR
"PUBLIC"."ALL_DATA"."navigation-history" = '{[Extract Method,BEGIN_REFACTORING,1310166631724],}';

* *DSV_TARGET_FILE=IncompleteNavigationHistories.csv

\x "PUBLIC"."INCOMPLETE_NAVIGATION_HISTORIES"

The above query produced the following results.

REFACTORING_ID|REFACTORING_KIND|INVOKED_BY_QUICKASSIST|INVOKED_THROUGH_STRUCTURED_SELECTION
org.eclipse.jdt.ui.rename.compilationunit|CANCELLED|false|true
org.eclipse.jdt.ui.rename.compilationunit|CANCELLED|false|true
org.eclipse.jdt.ui.rename.compilationunit|CANCELLED|false|true
org.eclipse.jdt.ui.rename.compilationunit|CANCELLED|false|true
org.eclipse.jdt.ui.rename.compilationunit|CANCELLED|false|true
org.eclipse.jdt.ui.rename.compilationunit|CANCELLED|false|true
org.eclipse.jdt.ui.rename.compilationunit|CANCELLED|false|true
org.eclipse.jdt.ui.rename.java.project|CANCELLED|false|true
org.eclipse.jdt.ui.rename.java.project|CANCELLED|false|true
org.eclipse.jdt.ui.rename.package|CANCELLED|false|true
org.eclipse.jdt.ui.rename.java.project|CANCELLED|false|true
org.eclipse.jdt.ui.extract.method|CANCELLED|false|false
org.eclipse.jdt.ui.extract.method|CANCELLED|false|false
org.eclipse.jdt.ui.extract.temp|CANCELLED|false|false
org.eclipse.jdt.ui.inline.method|CANCELLED|false|false
org.eclipse.jdt.ui.inline.method|CANCELLED|false|false
org.eclipse.jdt.ui.extract.method|CANCELLED|false|false
org.eclipse.jdt.ui.extract.temp|CANCELLED|false|false
org.eclipse.jdt.ui.extract.interface|CANCELLED|false|false
org.eclipse.jdt.ui.extract.method|CANCELLED|false|false
org.eclipse.jdt.ui.extract.method|CANCELLED|false|false
org.eclipse.jdt.ui.extract.method|CANCELLED|false|false
org.eclipse.jdt.ui.extract.temp|CANCELLED|false|false
org.eclipse.jdt.ui.extract.temp|CANCELLED|false|false
org.eclipse.jdt.ui.move.method|CANCELLED|false|false
org.eclipse.jdt.ui.move.method|CANCELLED|false|false
org.eclipse.jdt.ui.move.method|CANCELLED|false|false
org.eclipse.jdt.ui.inline.temp|CANCELLED|false|false
org.eclipse.jdt.ui.rename.type|CANCELLED|false|true
org.eclipse.jdt.ui.inline.method|CANCELLED|false|true
org.eclipse.jdt.ui.move.method|CANCELLED|false|false
org.eclipse.jdt.ui.extract.interface|CANCELLED|false|false
org.eclipse.jdt.ui.change.method.signature|CANCELLED|false|false
org.eclipse.jdt.ui.rename.type|CANCELLED|false|true
org.eclipse.jdt.ui.rename.type|CANCELLED|false|true
reprogrammer commented 13 years ago

@vazexqi:

All of the wrong navigation histories belong to cancelled refactorings that are not invoked by Quick Assist, and some of them are captured by the most recent version of CodingSpectator (v1.0.0.201107172337). We need to investigate this problem further and find the root cause of it.

reprogrammer commented 13 years ago

@rajkuma1: The classes org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog and org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2 are two of the main classes that CodingSpectator instruments to record the navigation histories.

vazexqi commented 13 years ago

@rajkuma1, @reprogrammer

Problem: We capture when the user explicitly presses one of the buttons of the wizard e.g. Next, Previous, Cancel, etc but not when the user closes the dialog by hitting ESC or by clicking 'X' on the window.

Steps to reproduce:

  1. Invoke any of the refactorings. In particular from analyzing the CSV logs it seems that inline, extract, rename are the ones that exhibit this behavior most frequently.
  2. When the dialog pops-up, hit ESC or close the window using the 'X' button on the dialog.
  3. Check the refactoring.history file. Noticed that we don't record that the dialog was closed.

This failure to capture CLOSE_EVENTs means that we don't know how long the user has been starring at the dialog. However, the status of it being a canceled refactoring is still correct. So we can still correctly use this information in our analysis.

reprogrammer commented 13 years ago

Test extractmethod.T07 failed frequently on my laptop because it didn't generate some of the log files. I need to repeat the test on another machine to see if the problem persists.

reprogrammer commented 13 years ago

Sometimes, the automated GUI tests fail even on my desktop machine because the actual logs are missing. I believe this problem is due to the timing issues of tests. However, I expected that the use of wait statements instead of sleep statements would fix this issue, but, apparently the tests are still fragile (See issue #226).