Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Andreas Leitgeb Newsgroups: comp.lang.java.programmer Subject: it's Closeable, but I don't want to close() it yet. Date: Wed, 27 Feb 2019 15:51:52 -0000 (UTC) Organization: A noiseless patient Spider Lines: 15 Message-ID: Reply-To: avl@logic.at Injection-Date: Wed, 27 Feb 2019 15:51:52 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="bb077191349627e6d7efbb06e52b68a2"; logging-data="1709"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zFepe6RR13mhbdrVOrPV9" User-Agent: slrn/1.0.3 (Linux) Cancel-Lock: sha1:ju4ab5xO2LY38Ky0u8KbHWYXfgw= Xref: csiph.com comp.lang.java.programmer:38739 In my application there exists an entity that is Closeable. It is kept in some class, and other parts of my application request a ref to the entity and do actions on it, then drop their ref, leaving the entity intact. Everything runs fine, except eclipse warns me about spots where the entity is requested, used, and then dropped. Eclipse thinks it might need to be close()d. Apart from ignoring the warning per eclipse settings or adding @SuppressWarnings, is there maybe a way to tell the compiler that a certain ref is not meant to be close()d? Letting it know that - despite the entity's ultimate fate of being eventually closed - this is not yet the time&place for it?