Fix a potential bug in initialization found by findbugs
Review at http://gwt-code-reviews.appspot.com/325802
Review by: rjrjr@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7909 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKeyProcessor.java b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKeyProcessor.java
index 4994c29..b0ce7b1 100644
--- a/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKeyProcessor.java
+++ b/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ExpensesKeyProcessor.java
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -41,9 +41,10 @@
private static Set<ExpensesKey<?>> get() {
if (instance == null) {
- instance = new HashSet<ExpensesKey<?>>();
- instance.add(ReportKey.get());
- instance.add(EmployeeKey.get());
+ HashSet<ExpensesKey<?>> newInstance = new HashSet<ExpensesKey<?>>();
+ newInstance.add(ReportKey.get());
+ newInstance.add(EmployeeKey.get());
+ instance = newInstance;
}
return instance;
}