[JGIT PATCH] FindBugs: Superclass uses subclass during initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Matthias Sohn <matthias.sohn@xxxxxxx>

FindBugs reported the following problem with high priority:
/usr/src/egit/org.spearce.jgit/src/org/spearce/jgit/merge/MergeStrategy.java:58
Initialization of org.spearce.jgit.merge.MergeStrategy accesses class
org.spearce.jgit.merge.StrategySimpleTwoWayInCore, which isn't
initialized yet.

To fix this problem move instantiation from StrategySimpleTwoWayInCore
up to the abstract superclass MergeStrategy.

Signed-off-by: Matthias Sohn <matthias.sohn@xxxxxxx>
---
 .../src/org/spearce/jgit/merge/MergeStrategy.java  |    2 +-
 .../jgit/merge/StrategySimpleTwoWayInCore.java     |    2 --
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/MergeStrategy.java b/org.spearce.jgit/src/org/spearce/jgit/merge/MergeStrategy.java
index 5439e5c..f5ced72 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/merge/MergeStrategy.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/MergeStrategy.java
@@ -55,7 +55,7 @@
 	public static final MergeStrategy THEIRS = new StrategyOneSided("theirs", 1);
 
 	/** Simple strategy to merge paths, without simultaneous edits. */
-	public static final ThreeWayMergeStrategy SIMPLE_TWO_WAY_IN_CORE = StrategySimpleTwoWayInCore.INSTANCE;
+	public static final ThreeWayMergeStrategy SIMPLE_TWO_WAY_IN_CORE = new StrategySimpleTwoWayInCore();
 
 	private static final HashMap<String, MergeStrategy> STRATEGIES = new HashMap<String, MergeStrategy>();
 
diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java b/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
index 5d4447c..626fe06 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
@@ -61,8 +61,6 @@
  * file contents.
  */
 public class StrategySimpleTwoWayInCore extends ThreeWayMergeStrategy {
-	static final ThreeWayMergeStrategy INSTANCE = new StrategySimpleTwoWayInCore();
-
 	/** Create a new instance of the strategy. */
 	protected StrategySimpleTwoWayInCore() {
 		//
-- 
1.6.3.1.30.g55524

��.n��������+%������w��{.n��������n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�m


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]