diff --git a/core/src/com/google/zxing/common/BitSource.java b/core/src/com/google/zxing/common/BitSource.java index f74d97365..a61ac5105 100755 --- a/core/src/com/google/zxing/common/BitSource.java +++ b/core/src/com/google/zxing/common/BitSource.java @@ -20,7 +20,8 @@ package com.google.zxing.common; *

This provides an easy abstraction to read bits at a time from a sequence of bytes, where the * number of bits read is not often a multiple of 8.

* - *

This class is not thread-safe.

+ *

This class is thread-safe but not reentrant. Unless the caller modifies the bytes array + * it passed in, in which case all bets are off.

* * @author Sean Owen */ diff --git a/core/src/com/google/zxing/common/BlackPointEstimator.java b/core/src/com/google/zxing/common/BlackPointEstimator.java index 0520d1064..7ef79d65f 100644 --- a/core/src/com/google/zxing/common/BlackPointEstimator.java +++ b/core/src/com/google/zxing/common/BlackPointEstimator.java @@ -27,7 +27,7 @@ import com.google.zxing.ReaderException; *

For an interesting discussion of this issue, see * this paper.

* - * NOTE: This class is not threadsafe. + * NOTE: This class is not thread-safe. * * @author Sean Owen * @author dswitkin@google.com (Daniel Switkin) diff --git a/core/src/com/google/zxing/common/GridSampler.java b/core/src/com/google/zxing/common/GridSampler.java index 4cf27763c..e15dd03fb 100644 --- a/core/src/com/google/zxing/common/GridSampler.java +++ b/core/src/com/google/zxing/common/GridSampler.java @@ -34,7 +34,7 @@ import com.google.zxing.ReaderException; */ public abstract class GridSampler { - private static GridSampler gridSampler = null; + private static GridSampler gridSampler = new DefaultGridSampler(); /** * Sets the implementation of {@link GridSampler} used by the library. One global @@ -43,7 +43,7 @@ public abstract class GridSampler { * in the whole lifetime of the JVM. For instance, an Android activity can swap in * an implementation that takes advantage of native platform libraries. * - * @param newGridSampler + * @param newGridSampler The platform-specific object to install. */ public static void setGridSampler(GridSampler newGridSampler) { if (newGridSampler == null) { @@ -56,11 +56,6 @@ public abstract class GridSampler { * @return the current implementation of {@link GridSampler} */ public static GridSampler getInstance() { - // No real point in trying to make this thread-safe; - // doesn't matter if a second instance is created - if (gridSampler == null) { - gridSampler = new DefaultGridSampler(); - } return gridSampler; } diff --git a/core/src/com/google/zxing/multi/qrcode/detector/MultiFinderPatternFinder.java b/core/src/com/google/zxing/multi/qrcode/detector/MultiFinderPatternFinder.java index c8766868b..4588df540 100644 --- a/core/src/com/google/zxing/multi/qrcode/detector/MultiFinderPatternFinder.java +++ b/core/src/com/google/zxing/multi/qrcode/detector/MultiFinderPatternFinder.java @@ -35,6 +35,7 @@ import java.util.Vector; * markers at three corners of a QR Code.

* *

This class is not thread-safe and should not be reused.

+ * TODO(dswitkin): Is this comment still true? I don't see any global variables for example. * *

In contrast to {@link FinderPatternFinder}, this class will return an array of all possible * QR code locations in the image.

diff --git a/core/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java b/core/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java index 52e7896ef..9bc2423e0 100644 --- a/core/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java +++ b/core/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java @@ -33,6 +33,7 @@ import java.util.Vector; * some code.

* *

This class is not thread-safe.

+ * TODO(dswitkin): Is this still true? * * @author Sean Owen */ diff --git a/core/src/com/google/zxing/qrcode/detector/FinderPatternFinder.java b/core/src/com/google/zxing/qrcode/detector/FinderPatternFinder.java index e0b0dc9f2..23730bff0 100755 --- a/core/src/com/google/zxing/qrcode/detector/FinderPatternFinder.java +++ b/core/src/com/google/zxing/qrcode/detector/FinderPatternFinder.java @@ -32,6 +32,7 @@ import java.util.Vector; * markers at three corners of a QR Code.

* *

This class is not thread-safe and should not be reused.

+ * TODO(dswitkin): Is this still true? * * @author Sean Owen */