[OpenJDK 2D-Dev] [10] Review Request: 8183576 Synchronization in BufferedImage.setRGB(int x, int y, int rgb) is not necessary
Sergey Bylokhov
sergey.bylokhov at oracle.com
Wed Jul 5 17:31:26 UTC 2017
Hello,
Please review the fix for jdk10.
Bug: https://bugs.openjdk.java.net/browse/JDK-8183576
Webrev can be found at: http://cr.openjdk.java.net/~serb/8183576/webrev.00
The method setRGB(int x, int y, int rgb) in BufferedImage is synchronized, but all other methods in this class are not. For example the similar method:
setRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)
and get methods:
getRGB(int x, int y)
getRGB(int, int, int, int, int[], int, int).
Since the BufferedImage class is not thread-safe it is unclear why the only this method was marked as synchronized.
(Other possible fix: mark this class as a thread-safe and synchronize access to internal data in other methods).
CSR will created after technical review.
More information about the 2d-dev
mailing list