jSparrow plug-in developed for Java refactoring
jSparrow is an IDE extension that helps you detect and fix quality problems as you write code. jSparrow flags errors, similar to a spell checker, indicating that they can be fixed with jSparrow before committing code.
The jSparrow IDE extension adds 118 rules and 3 interactive rules: Standard output methods to Logger, Remove Unused Code, and Rename Fields to Java Conventions. 94 of the rules have markers, which you can use during your development directly.
On Install Includes
- The 20 free rules (see below)
- All markers i.e. quick-fixes
jSparrow was designed to refactor 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.
In simple, jSparrow analyzes your Java project to find quality issues and suggests automated refactorings to improve the sources.
For any questions or feedback please feel free to send us a message: https://jsparrow.io/contact-form/
Discover more at: https://jsparrow.io/
The 20 Free Rules
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 are available after installation.
Rules included to get started:
- Collapse If Statements
- Replace equals() on Enum Constants
- Replace For-Loop with Enhanced-For-Loop
- Replace Expression Lambda with Method Reference
- Split Multiple Variable Declarations
- Use Optional::filter
- Organize Imports
- Use @Override Annotation
- Remove Boxing for String Conversions
- Remove Double Negations
- Remove Unnecessary Semicolons
- Remove Null-Checks Before Instanceof
- Remove Unnecessary Thrown Exceptions on Method Signatures
- Remove toString() on String
- Reorder String Equality Check
- Replace Inefficient Constructors with valueOf()
- Use Try-With-Resource
- Replace Equality Check with isEmpty()
- Use Offset Based String Methods
- Use SecureRandom
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.
-
Refactoring Steps:
- 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 jSparrow page to see the refactoring process of jSparrow in more detail.
Sonarlint-like quick-fixes
94 of the rules have markers; The jSparrow markers work like the quick fixes found in Sonarlint and JDTSpelling.
Builds upon Checkstyle Plugin's Motto
Checkstyle is a well-beloved inspecting tool that helps you adhere to coding standards. One of jSparrow's objectives is to build upon this motto and help developers adhere to coding standards through automated refactoring. One of our most worked-on tags is the "Coding Conventions" tag, currently including 38 refactorings. Like Checkstyle, you'll get notified about potential refactoring possibilities through markers which are available right after installation. Three rule examples: Hide Default Constructor In Utility Classes, Collapse If Statements, and Remove Null-Checks before Instance of.
Alternative to PMD with Selection Wizard
PMD is a joy to use to remove unused Java code. Built on this idea and from feedback from our users, jSparrow now includes an interactive wizard to remove unused code, whether they are fields, methods, or classes, jSparrow can remove them including their test cases, if wanted, in the whole workspace or selected projects.
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:
- Replace JUnit 3 Tests
- Replace JUnit 4 Annotations with JUnit Jupiter
- Replace JUnit 4 Assertions with JUnit Jupiter
- Replace JUnit 4 Assumptions with JUnit Jupiter
- Replace JUnit 4 Category with JUnit Jupiter Tag
- Replace JUnit Assumptions with Hamcrest Junit
- Replace JUnit Expected Annotation Property with assertThrows
- Replace JUnit ExpectedException with assertThrows
- Replace JUnit Timeout Annotation Property with assertTimeout
- Replace JUnit assertThat with Hamcrest
- Use Dedicated Assertions
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
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
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
Java Loops
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
Improve Readability
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
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
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
Testing
jSparrow rules having this tag encourage using best practices in the test code.
Rules with tag: https://jsparrow.github.io/tags/#testing
AssertJ
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
Spring
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
Free Tag
Rules with the Free tag are free to use.
Rules with tag: https://jsparrow.github.io/tags/#free
jSparrow links
jSparrow Updates
Latest version release
89
jSparrow Eclipse IDE plug-in latest version: 4.19.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
New Rule - jSparrow Eclipse IDE plug-in 2024-06
Categories: Source Code Analyzer, Tools
Tags: java, refactoring, static analysis, quality, security, JUnit refactoring, Java Code Analyzer, statc code analysis, code quality, Security Analysis, jSparrow, Software Quality, bugs, coding style
Additional Details
Eclipse Versions: 2024-03 (4.31), 2023-12 (4.30), 2023-09 (4.29), 2023-06 (4.28), 2023-03 (4.27), 2022-12 (4.26), 2022-09 (4.25), 2022-06 (4.24), 2022-03 (4.23), 2024-06 (4.32), 2024-09 (4.33), 2021-12 (4.22), 2021-09 (4.21), 2021-06 (4.20), 2021-03 (4.19), 2020-12 (4.18), 2020-09 (4.17), 2020-06 (4.16), 2020-03 (4.15), 2019-12 (4.14), 2019-09 (4.13), 2019-06 (4.12)
Platform Support: Windows, Mac, Linux/GTK
Organization Name: Splendit IT-Consulting GmbH, Vienna
Development Status: Production/Stable
Date Created: Tuesday, June 20, 2017 - 11:34
License: Other
Date Updated: Friday, April 5, 2024 - 08:41
Submitted by: Michaela Prehofer
Date | Ranking | Installs | Clickthroughs |
---|---|---|---|
October 2024 | 155/479 | 18 | 1 |
September 2024 | 150/642 | 169 | 12 |
August 2024 | 160/641 | 128 | 23 |
July 2024 | 159/663 | 137 | 24 |
June 2024 | 147/681 | 188 | 27 |
May 2024 | 122/682 | 272 | 24 |
April 2024 | 132/687 | 250 | 25 |
March 2024 | 187/694 | 144 | 16 |
February 2024 | 194/687 | 117 | 18 |
January 2024 | 172/691 | 149 | 21 |
December 2023 | 165/671 | 168 | 18 |
November 2023 | 168/686 | 196 | 26 |
Unsuccessful Installs
Unsuccessful Installs in the last 7 Days: 3
Count | Error Message |
---|---|
2 | Cannot complete the install because one or more required items could not be… |
1 | Cannot complete the install because one or more required items could not be… |
Reviews Add new review
correction of update site
Submitted by Michaela Prehofer on Tue, 10/25/2022 - 09:58
correction of update site
correct update site
Submitted by Michaela Prehofer on Tue, 10/25/2022 - 09:51
correct update site
Can you add a rule for me?
Submitted by Thomas Kozlowski on Mon, 02/07/2022 - 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, 02/17/2022 - 13:16
In reply to Can you add a rule for me? by Thomas Kozlowski
Hello,
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, 06/02/2021 - 05:06
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, 02/28/2018 - 08:24
How do we get license for that to apply the rules.
Re: Need License !!!
Submitted by Michaela Prehofer on Wed, 02/28/2018 - 09:39
In reply to Need License !!! by Arunkumar P
Hello Arunkumar!
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/
BR
Michaela
The "free" version is a read
Submitted by George Lindholm on Wed, 11/22/2017 - 14:20
The "free" version is a read only version. It doesn't make any changes.
Not free!
Re: The "free" version is a read
Submitted by Michaela Prehofer on Thu, 11/23/2017 - 10:39
In reply to The "free" version is a read by George Lindholm
Hello George!
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.
Best Regards
License required
Submitted by user user on Thu, 10/19/2017 - 10:28
"The jSparrow license server cannot be reached..."
Re: License required
Submitted by Ludwig Werzowa on Mon, 10/23/2017 - 09:17
In reply to License required by user user
Hi User,
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.
BR,
Ludwig
JSparrow always disabled Finish button on Eclipse Oxygen 4.7
Submitted by Alex K on Tue, 09/26/2017 - 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, 09/29/2017 - 04:16
In reply to JSparrow always disabled Finish button on Eclipse Oxygen 4.7 by Alex K
Hello Alex,
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.
BR
Michaela
Cannot complete the install because one or more required item...
Submitted by Martin Huter on Wed, 07/12/2017 - 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.
Best Regards
Martin Huter