Permalink
Browse files

Fixed some "incorrect lazy initialization" warnings from FindBugs

  • Loading branch information...
1 parent ae9e780 commit 44d0ae4fbdade1d51e4027b585973fba15b84c2d @Medo42 Medo42 committed with rpjohnst Jan 6, 2012
@@ -29,7 +29,7 @@
CHANGED,DELETED
}
- private static ScheduledExecutorService monitorService;
+ private static ScheduledExecutorService monitorService = Executors.newSingleThreadScheduledExecutor();
public final File file;
public final Executor executor;
@@ -47,7 +47,6 @@ public FileChangeMonitor(File f, Executor e)
executor = e;
changedRunnable = new UpdateRunnable(new FileUpdateEvent(updateSource,Flag.CHANGED));
deletedRunnable = new UpdateRunnable(new FileUpdateEvent(updateSource,Flag.DELETED));
- if (monitorService == null) monitorService = Executors.newSingleThreadScheduledExecutor();
lastModified = file.lastModified();
length = file.length();
future = monitorService.scheduleWithFixedDelay(this,POLL_INTERVAL,POLL_INTERVAL,
@@ -154,17 +154,18 @@ public static KeywordMap getKeywords()
{
if (gmlKeywords == null)
{
- gmlKeywords = new KeywordMap(false);
+ KeywordMap newGmlKeywords = new KeywordMap(false);
for (GMLKeywords.Construct keyword : GMLKeywords.CONSTRUCTS)
- gmlKeywords.add(keyword.getName(),Token.KEYWORD1);
+ newGmlKeywords.add(keyword.getName(),Token.KEYWORD1);
for (GMLKeywords.Operator keyword : GMLKeywords.OPERATORS)
- gmlKeywords.add(keyword.getName(),Token.OPERATOR);
+ newGmlKeywords.add(keyword.getName(),Token.OPERATOR);
for (GMLKeywords.Constant keyword : GMLKeywords.CONSTANTS)
- gmlKeywords.add(keyword.getName(),Token.LITERAL2);
+ newGmlKeywords.add(keyword.getName(),Token.LITERAL2);
for (GMLKeywords.Variable keyword : GMLKeywords.VARIABLES)
- gmlKeywords.add(keyword.getName(),Token.KEYWORD2);
+ newGmlKeywords.add(keyword.getName(),Token.KEYWORD2);
for (GMLKeywords.Function keyword : GMLKeywords.FUNCTIONS)
- gmlKeywords.add(keyword.getName(),Token.LABEL);
+ newGmlKeywords.add(keyword.getName(),Token.LABEL);
+ gmlKeywords = newGmlKeywords;
}
return gmlKeywords;
}
@@ -54,29 +54,30 @@ public static TextAreaDefaults getDefaults()
{
if (defaults == null)
{
- defaults = new TextAreaDefaults();
+ TextAreaDefaults newDefaults = new TextAreaDefaults();
- defaults.inputHandler = new DefaultInputHandler();
- defaults.inputHandler.addDefaultKeyBindings();
- defaults.document = new SyntaxDocument();
- defaults.editable = true;
+ newDefaults.inputHandler = new DefaultInputHandler();
+ newDefaults.inputHandler.addDefaultKeyBindings();
+ newDefaults.document = new SyntaxDocument();
+ newDefaults.editable = true;
- defaults.caretVisible = true;
- defaults.caretBlinks = true;
- defaults.electricScroll = 3;
+ newDefaults.caretVisible = true;
+ newDefaults.caretBlinks = true;
+ newDefaults.electricScroll = 3;
- defaults.cols = 80;
- defaults.rows = 25;
- defaults.styles = SyntaxUtilities.getDefaultSyntaxStyles();
- defaults.caretColor = Color.red;
- defaults.selectionColor = new Color(0xccccff);
- defaults.lineHighlightColor = new Color(0xe0e0e0);
- defaults.lineHighlight = true;
- defaults.bracketHighlightColor = Color.black;
- defaults.bracketHighlight = true;
- defaults.eolMarkerColor = new Color(0x009999);
- defaults.eolMarkers = true;
- defaults.paintInvalid = true;
+ newDefaults.cols = 80;
+ newDefaults.rows = 25;
+ newDefaults.styles = SyntaxUtilities.getDefaultSyntaxStyles();
+ newDefaults.caretColor = Color.red;
+ newDefaults.selectionColor = new Color(0xccccff);
+ newDefaults.lineHighlightColor = new Color(0xe0e0e0);
+ newDefaults.lineHighlight = true;
+ newDefaults.bracketHighlightColor = Color.black;
+ newDefaults.bracketHighlight = true;
+ newDefaults.eolMarkerColor = new Color(0x009999);
+ newDefaults.eolMarkers = true;
+ newDefaults.paintInvalid = true;
+ defaults = newDefaults;
}
return defaults;

0 comments on commit 44d0ae4

Please sign in to comment.