| Summary: | [compiler][resource] restore the default for resource leak warnings | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Stephan Herrmann <stephan.herrmann> |
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | amj87.iitr, daniel_megert, deepakazad, markus.kell.r, satyam.kandula, srikanth_sankaran |
| Version: | 3.8 | ||
| Target Milestone: | 3.8 M6 | ||
| Hardware: | Other | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Stephan Herrmann
(In reply to comment #0) > I think we should do this within the Juno cycle +1 M6 looks good, if everyone is on the same page (In reply to comment #0) > Meanwhile bug 358903 has been fixed including its successor bug 368546. I think this feature has seen a good deal of scrutiny in terms of code reviews, white box and black box testing, verification etc. Thanks to Deepak, Satyam, Ayush and Markus for all the support and of course to Stephan for very prompt follow ups to issues raised. > In order to dispel remaining fears about bugs in the implementation I offer to > add more early checks to the code. This way, should the analysis trigger a bug > in the compiler a user can still work around the bug by disabling the warning. Code implementing an optional feature should ideally be under a flag so there is an effective escape hatch. Obviously we need to be judicious in this principle - we don't want to cause excess code clutter by checking for option being turned on all over the place. We also need to bear in the cost of these checks. The author of the feature can figure what constitutes a reasonable measure of defensive coding and implement it that way. In that spirit, Appreciate your offer to look into this. Thanks. With that concern behind us, M6 looks good as the inflection point. I set them to 'Error' in my big source workspace which results in 3 errors for resource leaks and 63 errors for potential resource leaks. The errors for resource leaks are either correct or an appearance of bug 370702. For the potential resource leaks, those I sanity checked could be potential ones but in fact aren't. Also, most of them are in jdt.ui i.e. other components aren't affected heavily. ==> OK to change the default for 'UnclosedCloseable' to 'warning' ==> - UnclosedCloseable: warning - PotentiallyUnclosedCloseable: ignore - ExplicitlyClosedAutoCloseable: ignore (In reply to comment #3) > ... We also need to bear in > the cost of these checks. The fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=370182 makes looking up compiler options very cheap from various scopes. Code that retrieves options from a scope instance would automatically stand to benefit. Resolved for 3.8 M6 via commit e67d1dc6830648c83fdb0e0b83b59925424638d8 When checking the documentation I found that JavaCore was still at the previous state => no change required. OTOH, in jdt.doc.user ref-preferences-errors-warnings.htm these options were still lacking, fixed via commit d9b7b2fe0e0e034d4f95826842f5e776ae60eb7e (w3c validator said OK) Additionally, I added the mentioned checks to avoid the analysis when all these options are set to ignore. I double checked this with the following result: When compiling the Eclipse SDK with all resource warnings disabled, no instance of FakedTrackingVariable was ever created, which is the center piece in this analysis. Verified for 3.8 M6 using Build id: I20120306-0800 |