Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370701 - Resource leak warning should be 'potential' if reader/writer is passed
Summary: Resource leak warning should be 'potential' if reader/writer is passed
Status: VERIFIED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.8 M6   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-06 06:07 EST by Dani Megert CLA
Modified: 2012-03-13 02:22 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2012-02-06 06:07:18 EST
3.8 M5.

See org.eclipse.jdt.internal.ui.util.JavadocHelpContext.retrieveText(IJavaElement)

    reader= new HTML2TextReader(reader, null);

Adding
    reader.close()
does not get rid of the problem. I would expect that this would now only be reported as potential problem since normally, if a Writer/Reader takes another reader, the close() ripples through.
Comment 1 Stephan Herrmann CLA 2012-02-06 19:51:10 EST
Had we based bug 358903 on a general heuristic it would be exactly as
you expected. However, the agreement in bug 358903 comment 10 was to use
explicit white lists. HTML2TextReader is not on our white list,
so all the compiler sees is:
- reader is passed to some constructor, so the fresh object may / may not
  take over the responsibility
- the assignment drops the binding to the first reader so at this
  point we no longer have a direct reference

Ergo: we rank it equally to, e.g., this snippet:

   other.readSome(reader);
   return;

Do you still want this (as an enhancement)? If so, based on which heuristic,
exactly? Or can we close as WONTFIX?
Comment 2 Dani Megert CLA 2012-02-07 02:17:48 EST
(In reply to comment #1)
Fair enough.