Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Daniele Futtorovic Newsgroups: comp.lang.java.programmer Subject: Re: it's Closeable, but I don't want to close() it yet. Date: Mon, 4 Mar 2019 12:26:59 +0100 Organization: A noiseless patient Spider Lines: 30 Message-ID: References: <709a1f3b-fc99-4bd0-a8b8-866092bb7ae9@googlegroups.com> <8e1597a2-5c18-4fd1-83a4-7667e4d11e77@googlegroups.com> <23a8128b-5c54-45ba-bfd0-2f7dda078517@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Mon, 4 Mar 2019 11:27:01 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="7fdfb9a28ccd66ef1c65ac6a44e3e609"; logging-data="6915"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19WTIzW06xxxGWSo8+84Zfu" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 Cancel-Lock: sha1:iwu1WkS7s1VvkUMu84jAW5IigkY= In-Reply-To: X-Antivirus-Status: Clean Content-Language: en-US X-Antivirus: AVG (VPS 190304-0, 03/04/2019), Outbound message Xref: csiph.com comp.lang.java.programmer:38785 On 2019-03-04 10:38, Andreas Leitgeb wrote: > Daniele Futtorovic wrote: >> On 2019-03-01 10:31, Andreas Leitgeb wrote: >>> private static void helper2(Context ctx) { >>> Entity ent = ctx.getEnt(); >>> if (ent instanceof EntityImpl) { >>> // the following line gets tagged by eclipse: >>> // "Resource leak: 'entImp' is never closed" >>> EntityImpl entImp = (EntityImpl)ent; >>> entImp.b(); >>> } >>> } >>> } >> Colour me agnostic, but that warning seems absolutely ridiculous to me. >> Are you sure that's the cause of it? Could EntityImpl#b perhaps be doing >> something funky? > > I did provide the implementation of b() in my posting. It was an SSCCE. > (Reminder: It was empty, except for a /* ... */ comment.) Hmmm. For the record, IntelliJ fires off no such warning (then again, its inspection profiles are configurable). Do you also get the warning if you used a try-with-resources in the main of your SSCCE? -- DF.