Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 209464 Details for
Bug 358903
Filter practically unimportant resource leak warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
incremental change 7
Bug_358903_v0.9.6-update7.patch (text/plain), 3.86 KB, created by
Stephan Herrmann
on 2012-01-13 11:33:12 EST
(
hide
)
Description:
incremental change 7
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2012-01-13 11:33:12 EST
Size:
3.86 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java >index b39419e..7c2121e 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java >@@ -202,6 +202,7 @@ public class FakedTrackingVariable extends LocalDeclaration { > allocation.closeTracker = null; > } > } else if (((ReferenceBinding)allocation.resolvedType).hasTypeBit(TypeIds.BitWrapperCloseable)) { >+ boolean isWrapper = true; > if (allocation.arguments != null && allocation.arguments.length > 0) { > // find the wrapped resource represented by its tracking var: > FakedTrackingVariable innerTracker = findCloseTracker(scope, flowInfo, allocation, allocation.arguments[0]); >@@ -231,28 +232,44 @@ public class FakedTrackingVariable extends LocalDeclaration { > currentTracker = currentTracker.innerTracker; > } > } >- return; // keep chaining wrapper >+ return; // keep chaining wrapper (by avoiding to fall through to removeTrackingVar below) >+ } else { >+ if (!isAnyCloseable(allocation.arguments[0].resolvedType)) { >+ isWrapper = false; // argument is not closeable >+ } > } >+ } else { >+ isWrapper = false; // no argument > } >- // remove unnecessary attempts (wrapper has no relevant inner) >- if (allocation.closeTracker != null) { >- scope.removeTrackingVar(allocation.closeTracker); >- allocation.closeTracker = null; >- } >- } else { // regular resource >- FakedTrackingVariable presetTracker = allocation.closeTracker; >- if (presetTracker != null && presetTracker.originalBinding != null) { >- int closeStatus = flowInfo.nullStatus(presetTracker.binding); >- if (closeStatus != FlowInfo.NON_NULL >- && closeStatus != FlowInfo.UNKNOWN >- && !flowInfo.isDefinitelyNull(presetTracker.originalBinding) >- && !(presetTracker.currentAssignment instanceof LocalDeclaration)) >- allocation.closeTracker.recordErrorLocation(presetTracker.currentAssignment, closeStatus); >+ // successful wrapper detection has exited above, let's see why that failed >+ if (isWrapper) { >+ // remove unnecessary attempts (wrapper has no relevant inner) >+ if (allocation.closeTracker != null) { >+ scope.removeTrackingVar(allocation.closeTracker); >+ allocation.closeTracker = null; >+ } > } else { >- allocation.closeTracker = new FakedTrackingVariable(scope, allocation); // no local available, closeable is unassigned >+ // allocation does not provide a resource as the first argument -> don't treat as a wrapper >+ handleRegularResource(scope, flowInfo, allocation); > } >- flowInfo.markAsDefinitelyNull(allocation.closeTracker.binding); >+ } else { // regular resource >+ handleRegularResource(scope, flowInfo, allocation); >+ } >+ } >+ >+ private static void handleRegularResource(BlockScope scope, FlowInfo flowInfo, AllocationExpression allocation) { >+ FakedTrackingVariable presetTracker = allocation.closeTracker; >+ if (presetTracker != null && presetTracker.originalBinding != null) { >+ int closeStatus = flowInfo.nullStatus(presetTracker.binding); >+ if (closeStatus != FlowInfo.NON_NULL >+ && closeStatus != FlowInfo.UNKNOWN >+ && !flowInfo.isDefinitelyNull(presetTracker.originalBinding) >+ && !(presetTracker.currentAssignment instanceof LocalDeclaration)) >+ allocation.closeTracker.recordErrorLocation(presetTracker.currentAssignment, closeStatus); >+ } else { >+ allocation.closeTracker = new FakedTrackingVariable(scope, allocation); // no local available, closeable is unassigned > } >+ flowInfo.markAsDefinitelyNull(allocation.closeTracker.binding); > } > > /** Find an existing tracking variable for the argument of an allocation for a resource wrapper. */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 358903
:
208899
|
209082
|
209107
|
209169
|
209179
|
209232
|
209234
|
209276
|
209373
|
209374
|
209384
|
209409
|
209457
|
209460
|
209464
|
209472
|
209482