About jSparrow

Java Refactoring for Eclipse IDE

About jSparrow

JSPARROW – YOUR JAVA REFACTORING PARTNER

To help developers refactor in Java, we have developed a tool called jSparrow. jSparrow is an IDE extension that aids Java developers in refactoring system-wide Java code with a rule-based approach.

You can for free install jSparrow to your Eclipse IDE and view all the refactorings on your project directly.

jSparrow the bird with pirate hat

Java Refactorings Available

See the table below to browse all the available refactorings. Note that all jSparrow rules have a Minimum Java Version, which means that a rule with (for example) a Minimum Java version of 1.1 can be used on Java version 1.1 and all Java versions after 1.1.

All jSparrow’s refactoring rules

Included in Trial:

Included in every package

Browse rules by tags

jSparrow in-depth

Other development environments are:

Maven, GitHub

jSparrow is a plugin for Eclipse IDE, Maven, and GitHub. However, jSparrow for Maven and GitHub is currently only available through contacting us. You’ll work tightly with one of our inhouse-developers because of potential library restrictions.

Additionally, we are currently working on introducing jSparrow to Visual Studio Code. This page ‘About jSparrow’ will only include the technical specification of the jSparrow Eclipse IDE plugin.

jSparrow’s Pipeline consists of:

  • Prepare to refactor
  • Perform refactoring on working copy
  • Commit refactoring on “finish”

For each selected Java source file, a new state is created. Each state consists of the original file and a working copy that is subsequently analyzed with the refactoring rules. jSparrow then iterates over all the states, parses each working copy, and applies all the selected rules to it.

The working copies are then parsed and adjusted after each rule execution. Important: on this step, the original sources remain intact. As a final step, the developer can (un)select changes and, when ready, click on “finish” the computed refactorings are persisted on the original sources.

Some refactoring rules have requirements e.g. minimum Java version, thus jSparrow’s pipeline contains functionalities to discard or recompute the refactoring of certain rules on certain files.

jSparrow UI description

The UI provides an interactive refactoring process at each step of the pipeline.

The UI components of the jSparrow Eclipse Plugin include:
• The jSparrow dashboard, which automatically opens as a tab and is a way for us to communicate new releases and special offers
• jSparrow extension points i.e. in the context menu, in the toolbox, and in the Eclipse preference page.
• (On file, right click) The jSparrow Select Rules wizard serves for choosing the rules for refactoring, or for providing the configuration required for Field Renaming, Standard Logger, or Removing Unused Code rule.
• (After applying rules) The Preview wizard serves for reviewing, selecting, or deselecting the computed refactoring. The Preview wizards includes a diff view so that you can review the original and the refactored files.
• (In the code editor) jSparrow markers and its refactoring suggestions.
• The jSparrow Preference page and its subpages, i.e., Profiles, License, and Markers.
• Other dialog boxes, e.g., informational dialog boxes.

Rule Profiles possibilities include:

Categorizing Rules

jSparrow Eclipse Plug-in gives users the ability to group rules in profiles for easier application of desired rules. This was created to allow individual preferences and to support companies’ standards.

Rules can be grouped into profiles to ease the search when applying. To create a new profile with desired rules choose the Preferences option in the Window menu.

To create a new profile choose the Selected profile option and click on the New… button. The field “Name” is mandatory and has to be unique. On the left side, a list of all the possible rules is displayed. Select and add all rules you want to have in your new profile. At least one rule has to be added.
How to add Profiles

Markers description:

Quick-fixes

The jSparrow Markers make use of the JDT support for so-called Quick Fixes. Markers give the users ability to click on and choose an automatic fix to various problems. The jSparrow Markers work like the Quick Fixes of Sonarlint and JDTSpelling.

There are currently 92 jSparrow Markers available. Markers are not enabled on default; To activate a marker go to Eclipse’s preference page -> Markers and then select markers you want. Markes are included for free in the base product and are available after restarting Eclipse IDE after installing jSparrow.

How to de-activate Markers

Logging description:

Interactive Rule

The ‘System out to logging’ rule is an interactive Rule and it introduces the replacement of System.out statements (println, error, e.printstacktrace) with a logging statement. This rule requires the configuration of a logging environment (log4j, slf4j).

Interactive Rules can only be used with a Premium License.

Configurations

Remove Unused Code description:

Interactive Rule

The ‘Remove Unused Methods ‘ rule is an interactive Rule which finds type of declarations that are never used and removes them. Users can choose to remove types that are only used in test sources, together with their corresponding tests. Any annotation except for @Deprecated and @SuppressWarnings prevents the type declaration from being considered unused.

Interactive Rules can only be used with a Premium License.

Configurations

Rename Fields description:

Interactive Rule

The ‘Rename Fields ‘ rule is an interactive Rule. This rule finds fields that do not comply with the Java Naming Conventions and renames them according to your choices.

Interactive Rules can only be used with a Premium License.

Configurations

Technical FAQs

Get Started with jSparrow

Captain jSparrow

Install jSparrow for first-hand experience

No hidden payments – no card required