Easily Remove Unused Fields

We are happy to announce that jSparrow February release introduces a new rule and adds 15 jSparrow markers for existing rules.

Remove Unused Fields

This rule finds and removes field declarations that are never used. A dedicated configuration wizard allows users to choose the kind of fields they want to analyze and remove.

If users choose to remove public fields, the following class:

public class UnusedFieldSample {

public String publicUsedField = “”;

public String publicUnusedReassignedField = “”;

private String privateUsedField = “”;

void foo() {

publicUnusedReassignedField = “”;

BlackHole blackHole = new BlackHole();

blackHole.use(publicUsedField);

blackHole.use(privateUsedField);

}

}

is transformed to:

public class UnusedFieldSample {

public String publicUsedField = “”;

private String privateUsedField = “”;

void foo() {

BlackHole blackHole = new BlackHole();

blackHole.use(publicUsedField);

blackHole.use(privateUsedField);

}

}

More jSparrow Markers

Fifteen new markers for existing rules to jSparrow. Thus, brining the total number of jSparrow markers to 56.

jSparrow provides now a total of 109 automatic refactoring rules.

Find out more information in the Release Notes for jSparrow Eclipse!

“Low-level programming is good for the programmer’s soul.” ― John Carmack

Happy Coding!

Leave a Reply

Your email address will not be published.