JExtract: Recommending Automated Extract Method Refactorings

Danilo Silva1, Ricardo Terra2, Marco Tulio Valente1
1Department of Computer Science, UFMG, Brazil
2Department of Computer Science, UFLA, Brazil,,

JExtract is an Eclipse plug-in that analyses the source code of a method and recommends extract method refactoring opportunities.


JExtract 1.1.0 (latest) Binary Source Code


Although Extract Method is a key refactoring for improving program comprehension, refactoring tools for such purpose are often underused. To address this shortcoming, we present JExtract, a recommendation system based on structural similarity that identifies Extract Method refactoring opportunities that are directly automated by IDE-based refactoring tools. Our evaluation suggests that JExtract is far more effective (w.r.t. recall and precision) to identify misplaced code in methods than JDeodorant, a state-of-the-art tool.

Evaluation Data

The source code of the systems used in the evaluation and their corresponding Extract Method instances file (oracle.txt) are available here as Eclipse projects.

The oracle.txt files contain one Extract Method description per line, for example:

classes.CustomerAction	public java.lang.String find() throws java.lang.Exception	e2359:577;e2981:41;

In this example, the qualified class name is classes.CustomerAction, the method signature is public java.lang.String find() throws java.lang.Exception and the extracted statements are those enclosed by the char ranges e2359:577;e2981:41;. Char ranges are specified as e[start]:[length];.