8181586: DateTimeTextProvider.getInstance() returns a new instance every time
Reviewed-by: rriggs
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeTextProvider.java Tue Jun 06 01:33:53 2017 -0700
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeTextProvider.java Tue Jun 06 10:34:21 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -112,6 +112,9 @@
}
};
+ // Singleton instance
+ private static final DateTimeTextProvider INSTANCE = new DateTimeTextProvider();
+
DateTimeTextProvider() {}
/**
@@ -120,7 +123,7 @@
* @return the provider, not null
*/
static DateTimeTextProvider getInstance() {
- return new DateTimeTextProvider();
+ return INSTANCE;
}
/**