diff options
author | Stephan Herrmann | 2012-01-16 16:08:07 +0000 |
---|---|---|
committer | Stephan Herrmann | 2012-01-16 16:08:07 +0000 |
commit | 2dc8c8168c71292aca0a9b4cb34971871475b18a (patch) | |
tree | 5425e65e8a98556f37e52eaca1253a4fa6f5c73f /org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java | |
parent | 96ef6a1342ca74d72728b34641d9caf80d6d6997 (diff) | |
download | eclipse.jdt.core-2dc8c8168c71292aca0a9b4cb34971871475b18a.tar.gz eclipse.jdt.core-2dc8c8168c71292aca0a9b4cb34971871475b18a.tar.xz eclipse.jdt.core-2dc8c8168c71292aca0a9b4cb34971871475b18a.zip |
HEAD - Fixed bug 368709: Endless loop in
FakedTrackingVariable.markPassedToOutside
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java')
-rw-r--r-- | org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java | 16 |
1 files changed, 13 insertions, 3 deletions
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 46ac85d000..6343221f66 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 @@ -186,7 +186,12 @@ public class FakedTrackingVariable extends LocalDeclaration { } if (closeTracker != null) { closeTracker.currentAssignment = location; - ((AllocationExpression)rhs).closeTracker = closeTracker; + AllocationExpression allocation = (AllocationExpression)rhs; + allocation.closeTracker = closeTracker; + if (allocation.arguments != null && allocation.arguments.length > 0) { + // also push into nested allocations, see https://bugs.eclipse.org/368709 + preConnectTrackerAcrossAssignment(location, local, allocation.arguments[0]); + } } } } @@ -209,8 +214,13 @@ public class FakedTrackingVariable extends LocalDeclaration { // find the wrapped resource represented by its tracking var: FakedTrackingVariable innerTracker = findCloseTracker(scope, flowInfo, allocation.arguments[0]); if (innerTracker != null) { - if (innerTracker == allocation.closeTracker) - return; // self wrap (res = new Res(res)) -> neither change (here) nor remove (below) + FakedTrackingVariable currentInner = innerTracker; + do { + if (currentInner == allocation.closeTracker) + return; // self wrap (res = new Res(res)) -> neither change (here) nor remove (below) + // also check for indirect cycles, see https://bugs.eclipse.org/368709 + currentInner = currentInner.innerTracker; + } while (currentInner != null); int newStatus = FlowInfo.NULL; if (allocation.closeTracker == null) { allocation.closeTracker = new FakedTrackingVariable(scope, allocation); // no local available, closeable is unassigned |