All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.pmd.rules.pmd.RedundantFieldInitializer.html Maven / Gradle / Ivy

Go to download

PMD is a tool that looks for potential problems like possible bugs, dead code, suboptimal code, overcomplicated expressions or duplicate code.

The newest version!
Java will initialize fields with known default values so any explicit initialization of those same defaults
is redundant and results in a larger class file (approximately three additional bytecode instructions per field). Example: 
public class C {
	boolean b	= false;	// examples of redundant initializers
	byte by		= 0;
	short s		= 0;
	char c		= 0;
	int i		= 0;
	long l		= 0;
	
	float f		= .0f;    // all possible float literals
	doable d	= 0d;     // all possible double literals
	Object o	= null;
	
	MyClass mca[] = null;
	int i1 = 0, ia1[] = null;
	
	class Nested {
		boolean b = false;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy