[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Proposal: 8302281 - ImageReader and ImageWrite should implement Closable
From:       "Markus Karg" <markus () headcrashing ! eu>
Date:       2023-03-25 17:58:39
Message-ID: 000301d95f43$6e340210$4a9c0630$ () eu
[Download RAW message or body]

I like to propose a small addition to ImageReader and ImageWrite, as it
makes using them a bit simpler and safer: ImageReader and ImageWriter should
implement the Closable interface
(https://bugs.openjdk.org/browse/JDK-8302281).

 

The reason for this proposal is that I noticed that people tend to not
dispose these instances using dispose(), because they simply did not
understand that they have to. People these days are used to just try out
try-with-resources and if the IDE complains that this is not supported, then
they (falsely and carelessly) assume that there is no need to dispose these
instances. Only few people actively check the Javadocs if there is any other
method besides close(), like in this case: dispose(). For those people it
would be convenient and safe if we implement Closable. Also, such a change
would allow to write safe code little a bit simpler. The change is backwards
compatible and does not imply big risk or effort, and I do not see a
relevant reason why we should abstain from this addition, but maybe I am
missing something?

 

Hence I kindly ask for constructive comments on this idea.

 

I have already opened a draft on Github to outline what I have in mind:
https://github.com/openjdk/jdk/pull/12098

 

With kinds regards

-Markus Karg

 

 


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type \
content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.E-MailFormatvorlage17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link=blue vlink=purple><div \
class=WordSection1><p class=MsoNormal>I like to propose a small addition to \
ImageReader and ImageWrite, as it makes using them a bit simpler and safer: \
ImageReader and ImageWriter should implement the Closable interface (<a \
href="https://bugs.openjdk.org/browse/JDK-8302281">https://bugs.openjdk.org/browse/JDK-8302281</a>).<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>The reason for this proposal \
is that I noticed that people tend to not dispose these instances using dispose(), \
because they simply did not understand that they have to. People these days are used \
to just try out try-with-resources and if the IDE complains that this is not \
supported, then they (falsely and carelessly) assume that there is no need to dispose \
these instances. Only few people actively check the Javadocs if there is any other \
method besides close(), like in this case: dispose(). For those people it would be \
convenient and safe if we implement Closable. Also, such a change would allow to \
write safe code little a bit simpler. The change is backwards compatible and does not \
imply big risk or effort, and I do not see a relevant reason why we should abstain \
from this addition, but maybe I am missing something?<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Hence I kindly ask for \
constructive comments on this idea.<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>I have already opened a draft \
on Github to outline what I have in mind: <a \
href="https://github.com/openjdk/jdk/pull/12098">https://github.com/openjdk/jdk/pull/12098</a><o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>With kinds \
regards<o:p></o:p></p><p class=MsoNormal>-Markus Karg<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic