Skip to content

Commit

Permalink
fixed stupid memleak in PatchExtensionMethod.. sorry my bad..
Browse files Browse the repository at this point in the history
  • Loading branch information
peichhorn committed Jul 5, 2012
1 parent 39a7638 commit 5f8aa2e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import static lombok.eclipse.handlers.EclipseHandlerUtil.createAnnotation;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -66,35 +67,37 @@ static class Extension {

private static class PostponedNoMethodError implements PostponedError {
private final ProblemReporter problemReporter;
private final MessageSend messageSend;
private final WeakReference<MessageSend> messageSendRef;
private final TypeBinding recType;
private final TypeBinding[] params;

PostponedNoMethodError(ProblemReporter problemReporter, MessageSend messageSend, TypeBinding recType, TypeBinding[] params) {
this.problemReporter = problemReporter;
this.messageSend = messageSend;
this.messageSendRef = new WeakReference<MessageSend>(messageSend);
this.recType = recType;
this.params = params;
}

public void fire() {
problemReporter.errorNoMethodFor(messageSend, recType, params);
MessageSend messageSend = messageSendRef.get();
if (messageSend != null) problemReporter.errorNoMethodFor(messageSend, recType, params);
}
}

private static class PostponedInvalidMethodError implements PostponedError {
private final ProblemReporter problemReporter;
private final MessageSend messageSend;
private final WeakReference<MessageSend> messageSendRef;
private final MethodBinding method;

PostponedInvalidMethodError(ProblemReporter problemReporter, MessageSend messageSend, MethodBinding method) {
this.problemReporter = problemReporter;
this.messageSend = messageSend;
this.messageSendRef = new WeakReference<MessageSend>(messageSend);
this.method = method;
}

public void fire() {
problemReporter.invalidMethod(messageSend, method);
MessageSend messageSend = messageSendRef.get();
if (messageSend != null) problemReporter.invalidMethod(messageSend, method);
}
}

Expand Down Expand Up @@ -277,7 +280,4 @@ private static NameReference createNameRef(TypeBinding typeBinding, ASTNode sour
return new QualifiedNameReference(sources, poss, source.sourceStart, source.sourceEnd);
}
}



}

0 comments on commit 5f8aa2e

Please sign in to comment.