jSparrow plug-in developed for Java refactoring
jSparrow is an IDE extension for refactoring Java code with a rule-based approach. A jSparrow rule is a definition of many small composed refactoring steps performed by the plug-in; one rule, when selected, can by itself refactor a very specific area within your system-wide code. jSparrow analyzes your Java project to find quality issues and suggests automated refactorings.
The jSparrow IDE extension adds 117 rules including 3 interactive rules: Standard output methods to Logger, Remove Unused Code, and Rename Fields to Java Conventions.
Additionally, 92 of the rules have markers; The jSparrow markers work like the quick fixes found in Sonarlint and JDTSpelling.
What is refactoring?
Refactoring is a process of system-wide code restructuring and reordering without affecting the system's external forms of action and behavior. In simpler terms, refactoring is improving software's code without affecting the software's user interfaces and experiences.
- Create working copies of selected Java files
- Analyse refactoring possibilities
- Apply the refactoring
- Compare working copies with original sources
- Persist wanted refactoring to original sources
Please visit our About jSparrow page to see the refactoring process of jSparrow in more detail.
Refactor JUnit Test Cases
JUnit is an open-source unit testing framework for Java. The goal of unit testing or unit test cases is to test individual units of software and validate expected performance. Since 2022 junit.org has released the next generation of JUnit: Junit 5. To help Java developers with the migration from JUnit 3 and JUnit 4 to JUnit 5, this plug-in includes ten JUnit refactoring rules:
The plug-in documentation shows Java and JUnit test case examples that get refactored.
Other jSparrow Tags
JUnit is a tag that we use for the JUnit refactor rules. Tags describe properties of jSparrow rules with the intent of grouping similar rules together and making them easier to find and search for. Below are all our current tags:
Minimum Java Versions
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.
Rules with tag: https://jsparrow.github.io/tags/#java-version-tags
Version tags quick-links: Java 1.1, Java 1.2, Java 1.3, Java 1.4, Java 5, Java 6, Java 7, Java 8, Java 9, Java 10, Java 11, Java 14, Java 15, and Java 16
Coding conventions for Java
Coding conventions for Java consist of a set of recommended code styles and best practices. Rules with the Coding Conventionstag will alter source code parts to follow guides, such as the Google Java Style Guide.
Rules with tag: https://jsparrow.github.io/tags/#coding-conventions
I/O operations provided by java.io or java.nio
The I/O operations tag marks rules that deal with I/O operations provided by java.io or java.nio.
Rules with tag: https://jsparrow.github.io/tags/#io-operations
Lambda expressions are anonymous and unnamed functions that enable you to treat functionality as a method argument or code as data. Lambda expressions are an integral part of the java.util.stream API. Whenever a rule has this tag, it means that either a lambda expression is introduced or manipulated.
Rules with tag: https://jsparrow.github.io/tags/#lambda
Logging frameworks ease and standardize the process of logging for the Java platform. In particular, they provide flexibility by avoiding explicit output to the console. The location where logs are written becomes independent of the code and can be customized at runtime. Rules marked with this tag either introduce logging or improve aspects of the same.
Rules with tag: https://jsparrow.github.io/tags/#logging
A loop is an instruction that repeats until a specified condition is reached. Examples would be for, while, or forEach loops. Respectively, rules with the Loop tag will interact with such loops.
Rules with tag: https://jsparrow.github.io/tags/#Loop
Old Java Language Constructs
jSparrow rules having the Old Language Constructs tag replace old constructs with more up-to-date alternatives.
Rules with tag: https://jsparrow.github.io/tags/#old-language-constructs
Performance improving rules
The Performance tag indicates that a code fragment is replaced by a more performant one.
Rules with tag: https://jsparrow.github.io/tags/#performance
Rules marked with the Readability tag improve the ease with which a human reader can comprehend the purpose, control flow, and operation of source code. It affects aspects of quality, including portability, usability, and most importantly maintainability.
Rules with tag: https://jsparrow.github.io/tags/#readability
Security issues refer to vulnerabilities that can be exploited by an attacker to perform unauthorized actions within a computer program. Rules marked with this tag replace vulnerable code fragments with secure alternatives.
Rules with tag: https://jsparrow.github.io/tags/#security
String manipulation is the process of creating, parsing, or changing String variables or literals. Typical operations on strings include a concatenation of values or the creation of a String output based on the input of another type. jSparrow rules having this tag will therefore be related to such String operations.
Rules with tag: https://jsparrow.github.io/tags/#string-manipulation
jSparrow rules having this tag encourage using best practices in the test code.
Rules with tag: https://jsparrow.github.io/tags/#testing
jSparrow rules having this tag encourage best practices on using the AssertJ library for writing fluent assertions in unit tests.
Rules with tag: https://jsparrow.github.io/tags/#assertj
jSparrow rules having this tag encourage best practices on using the Spring library for writing web applications.
Rules with tag: https://jsparrow.github.io/tags/#Spring
Rules with the Free tag are free to use.
Rules with tag: https://jsparrow.github.io/tags/#free
Get Started with jSparrow
We want to help developers optimize the way they can fix Java code and refactor Java code. To get started, we offer 20 free forever rules which you can acquire through our website: https://jsparrow.io/try-free/
Rules included to get started:
Latest version release
jSparrow Eclipse IDE plug-in latest version: 4.15.0
jSparrow Maven plug-in latest version: 3.20.0
Our release policy
We will release at least one new rule in March, June, September, and December.
Bugfixes will be released each Thursday.
Hotfix Releases can be deployed at any time when urgent.
Next jSparrow Release
Reviews Sign in to post reviews
correction of update site
Submitted by Michaela Prehofer on Tue, 2022-10-25 09:58
correction of update site
correct update site
Submitted by Michaela Prehofer on Tue, 2022-10-25 09:51
correct update site
Can you add a rule for me?
Submitted by Thomas Kozlowski on Mon, 2022-02-07 08:43
Hi! Would it be possible to add the rule of deleting dead code?
Also i would have several other ideas for rules, are you guys open to hear them?
Re: Can you add a rule for me?
Submitted by Ardit Ymeri on Thu, 2022-02-17 13:16
please note the new jSparrow version 4.8.0 (released on 17th February 2022) introduced a rule for finding and removing unused fields. It provides a dedicated configuration wizard where you can choose which unused fields to analyze and remove based on their access modifier. You can also choose how to handle fields that are initialized with expressions that may have side effects. For more details, please check 'Remove Unused Fields' in our documentation space and give it a try for yourself. Any feedback is highly appreciated.
We plan to continue implementing more rules that find and remove unused code. So, stay tuned!
Needles to say, we are always open to accepting feedback and new ideas for refactoring rules.
Very good Tool
Submitted by Thomas Kozlowski on Wed, 2021-06-02 05:05
Downloaded the Jsparrow tool several months ago -started with the free trial but quickly saw that i need all the other rules. Safed a lot of time with it. Also was communicating with the team to help me on some topics.
Keep up the great work
Need License !!!
Submitted by Arunkumar P on Wed, 2018-02-28 08:40
How do we get license for that to apply the rules.
Re: Need License !!!
Submitted by Michaela Prehofer on Wed, 2018-02-28 09:39
Thanks for your interest in jSparrow, we are glad you like it.
You can get a license on our webpage: https://jsparrow.eu/license-2/
The "free" version is a read
Submitted by George Lindholm on Wed, 2017-11-22 14:20
The "free" version is a read only version. It doesn't make any changes.
Re: The "free" version is a read
Submitted by Michaela Prehofer on Thu, 2017-11-23 10:39
The free version allows you to run all rules on your sources. After the run of jSparrow, it shows you how the quality of your sources can be improved. jSparrow delivers a solution for each found old language construct or threat and shows exactly how to solve it. You can run the rules through your whole sources and review issues and their solutions according to best practices.
If you want to resovle the issues automatically you have to use the full version. We think that the fee for the full version, which is less than "two hours manual work" and includes all new releases for one year, is a fair contribution for our ongoing development.
For 2018 we plan various new rules, espacially to support the upgrade to Java 9.
And as we are no public institution and have no big "influencers", we have to refinance the jSparrow development. (But we are thinking about providing student versions in 2018.)
We are sure that jSparrow´s functionality in both versions provides a good solution to support developers within their daily work in increasing software quality and maintaining Legacy Java.
Submitted by User User on Thu, 2017-10-19 10:27
"The jSparrow license server cannot be reached..."
Re: License required
Submitted by Ludwig Werzowa on Mon, 2017-10-23 09:17
thank you for your interest in jSparrow.
Please make sure that you are using the latest version of jSparrow.
For the purpose of license validation, jSparrow needs to be able to establish a connection to the Internet.
In case you are using a proxy, please make sure that you have proxy settings for HTTPS configured within Eclipse.
Please contact us, if the problems remain.
JSparrow always disabled Finish button on Eclipse Oxygen 4.7
Submitted by Alex K on Tue, 2017-09-26 19:18
I am selecting one java class -> Right Click -> JSparrow -> Select Rules to Apply -> ... -> Showing the Window of JSparow where it shows the code comparization before and after .
The plugin seems to work like charm except that finish button...
1)The Finish button is disabled , even if i click next ... next ... next 500 times the Finish Button remains disabled .
2)I have Eclipse Darkest Dark Theme 2017 CI 8 (in case that creates a problem )
I like a lot this Plugin please Fix it !!! :)
Re: JSparrow ....
Submitted by Michaela Prehofer on Fri, 2017-09-29 04:16
thanks for your interest in jSparrow.
jSparrow is available in two versions. A free version and a commercial one.
We expect you are using the free version. This version has unlimited functionality to run all rules on any of your projects. You will get a list of all findings and jSparrow suggestions to correct these.
You have to swap versions, if you want the tool to correct the coding issues automatically.
Cannot complete the install because one or more required item...
Submitted by Martin Huter on Wed, 2017-07-12 06:34
This Error occurs if you try to install jSparrow in an Eclipse version prior to Mars. (https://marketplace.eclipse.org/content/error/report/3539883)
A Eclipse version pior to Mars isn't tested nor supported from our side therefore the dependencies to eclipse core components are set as a minimum to the Eclipse Mars target platform.