Remove explicit initialization of default values

Default values are false for boolean, 0 for int and char, and null
for object references.

Explicitly initializing a variable to the default value causes it
to be initialized twice.

Enable the Checkstyle warning, and fix occurences of it.

Change-Id: I1971e438fc506c18458b1402fcb01e43fa61ff8c
This commit is contained in:
David Pursehouse 2016-04-12 16:17:54 +09:00
parent d79c03a7f6
commit 60ebcdb18e
8 changed files with 10 additions and 9 deletions

View File

@ -62,7 +62,7 @@ public abstract class BinaryResult implements Closeable {
private Charset characterEncoding;
private long contentLength = -1;
private boolean gzip = true;
private boolean base64 = false;
private boolean base64;
private String attachmentName;
/** @return the MIME type of the result, for HTTP clients. */

View File

@ -28,8 +28,8 @@ import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
class DocTable extends NavigationTable<DocInfo> {
private static final int C_TITLE = 1;
private int rows = 0;
private int dataBeginRow = 0;
private int rows;
private int dataBeginRow;
DocTable() {
super(Util.C.docItemHelp());

View File

@ -35,7 +35,7 @@ public abstract class CommentedActionDialog extends AutoCenterDialogBox
protected final FlowPanel contentPanel;
protected FocusWidget focusOn;
protected boolean sent = false;
protected boolean sent;
public CommentedActionDialog(final String title, final String heading) {
super(/* auto hide */false, /* modal */true);

View File

@ -52,7 +52,7 @@ public class Init extends BaseInit {
private boolean noAutoStart;
@Option(name = "--skip-plugins", usage = "Don't install plugins")
private boolean skipPlugins = false;
private boolean skipPlugins;
@Option(name = "--list-plugins", usage = "List available plugins")
private boolean listPlugins;

View File

@ -473,8 +473,8 @@ public class RefControl {
}
private static class AllowedRange {
private int allowMin = 0;
private int allowMax = 0;
private int allowMin;
private int allowMax;
private int blockMin = Integer.MIN_VALUE;
private int blockMax = Integer.MAX_VALUE;

View File

@ -81,7 +81,7 @@ final class AdminSetParent extends SshCommand {
@Inject
private Provider<ListChildProjects> listChildProjects;
private Project.NameKey newParentKey = null;
private Project.NameKey newParentKey;
@Override
protected void run() throws Failure {

@ -1 +1 @@
Subproject commit 32b238a2ff9625b17d9dc44e145de269ec833736
Subproject commit 9286b87ba7936af7f66b6562adb54e8d276cb5cb

View File

@ -95,6 +95,7 @@ edited to remove noisy warnings.
</module>
<module name="RedundantImport"/>
<module name="RedundantModifier"/>
<module name="ExplicitInitialization"/>
</module>
<module name="FileTabCharacter">
<property name="severity" value="ignore"/>