File tree Expand file tree Collapse file tree
org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/symbols/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,8 +36,6 @@ public class SymbolIconProviderRegistry {
3636
3737 private static final String EXTENSION_POINT_ID = LanguageServerPlugin .PLUGIN_ID + ".symbolIconsProvider" ; //$NON-NLS-1$
3838
39- private static SymbolIconProviderRegistry INSTANCE = null ;
40-
4139 // default icon provider from LSP4E
4240 private final SymbolIconProvider defaultIconProvider = new SymbolIconProvider ();
4341
@@ -48,11 +46,17 @@ private SymbolIconProviderRegistry() {
4846 loadExtensions ();
4947 }
5048
49+ /**
50+ * Initialization-on-demand holder: the JVM guarantees that this nested class
51+ * is loaded and initialized exactly once, in a thread-safe manner, the first
52+ * time {@link #get()} is called.
53+ */
54+ private static final class Holder {
55+ static final SymbolIconProviderRegistry INSTANCE = new SymbolIconProviderRegistry ();
56+ }
57+
5158 private static SymbolIconProviderRegistry get () {
52- if (INSTANCE == null ) {
53- INSTANCE = new SymbolIconProviderRegistry ();
54- }
55- return INSTANCE ;
59+ return Holder .INSTANCE ;
5660 }
5761
5862 private void loadExtensions () {
You can’t perform that action at this time.
0 commit comments