summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2006-08-18 14:59:13 +0000
committeraclement <aclement>2006-08-18 14:59:13 +0000
commita562d831df36dd0ec0cbf6ff0c6526ebc8977432 (patch)
treed0ba32f7f0e595791bc17397aeb717f7bc6c545a /weaver
parent135173acd2c893e5bfbb420e9cccf493ba150bfe (diff)
downloadaspectj-a562d831df36dd0ec0cbf6ff0c6526ebc8977432.tar.gz
aspectj-a562d831df36dd0ec0cbf6ff0c6526ebc8977432.zip
141556: lint message sort out and memory leak resolution
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/Lint.java40
-rw-r--r--weaver/src/org/aspectj/weaver/LintMessage.java47
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java21
3 files changed, 64 insertions, 44 deletions
diff --git a/weaver/src/org/aspectj/weaver/Lint.java b/weaver/src/org/aspectj/weaver/Lint.java
index ab12e7aac..5dc5bf065 100644
--- a/weaver/src/org/aspectj/weaver/Lint.java
+++ b/weaver/src/org/aspectj/weaver/Lint.java
@@ -26,7 +26,6 @@ import java.util.Properties;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
-import org.aspectj.bridge.Message;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.weaver.tools.Trace;
import org.aspectj.weaver.tools.TraceFactory;
@@ -239,8 +238,10 @@ public class Lint {
WeaverMessages.format(WeaverMessages.XLINT_VALUE_ERROR,v));
return null;
}
-
-
+
+ public Kind fromKey(String lintkey) {
+ return (Lint.Kind)kinds.get(lintkey);
+ }
public class Kind {
private String name;
@@ -290,41 +291,12 @@ public class Lint {
public void signal(String[] infos, ISourceLocation location, ISourceLocation[] extraLocations) {
if (kind == null) return;
- String text = MessageFormat.format(message, infos );
+ String text = MessageFormat.format(message, (Object[])infos );
text += " [Xlint:" + name + "]";
world.getMessageHandler().handleMessage(
new LintMessage(text, kind, location,extraLocations,getLintKind(name)));
}
- }
-
- public class LintMessage extends Message {
-
- private Lint.Kind lintKind;
-
- public LintMessage(
- String message,
- IMessage.Kind messageKind,
- ISourceLocation location,
- ISourceLocation[] extraLocations,
- Lint.Kind lintKind) {
- super(message,"",messageKind,location,null,extraLocations);
- this.lintKind = lintKind;
- }
-
- /**
- * @return Returns the Lint kind of this message
- */
- public Lint.Kind getLintKind() {
- return lintKind;
- }
-
- /**
- * @return true if this message is a noGuardForLazyTjp xlint
- * message and false otherwise
- */
- public boolean isNoGuardForLazyTjp() {
- return lintKind.equals(noGuardForLazyTjp);
- }
+
}
}
diff --git a/weaver/src/org/aspectj/weaver/LintMessage.java b/weaver/src/org/aspectj/weaver/LintMessage.java
new file mode 100644
index 000000000..3a93af94e
--- /dev/null
+++ b/weaver/src/org/aspectj/weaver/LintMessage.java
@@ -0,0 +1,47 @@
+/* *******************************************************************
+ * Copyright (c) 2002-2006 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * PARC initial implementation
+ * AndyClement extracted as self contained type from Lint type (4-Aug-06)
+ * ******************************************************************/
+package org.aspectj.weaver;
+
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.Message;
+
+public class LintMessage extends Message {
+
+ // private Lint.Kind lintKind;
+ private String lintKind;
+
+ public LintMessage(
+ String message,
+ IMessage.Kind messageKind,
+ ISourceLocation location,
+ ISourceLocation[] extraLocations,
+ Lint.Kind lintKind) {
+ super(message,"",messageKind,location,null,extraLocations);
+ this.lintKind = lintKind.getName();
+ }
+
+ public LintMessage(String message, String extraDetails, org.aspectj.weaver.Lint.Kind kind2, Kind kind, ISourceLocation sourceLocation, Throwable object,
+ ISourceLocation[] seeAlsoLocations, boolean declared, int id, int sourceStart, int sourceEnd) {
+ super(message,extraDetails,kind,sourceLocation,object,seeAlsoLocations,declared,id,sourceStart,sourceEnd);
+ this.lintKind = kind2.getName();
+ }
+
+ /**
+ * @return Returns the Lint kind of this message
+ */
+ public String getLintKind() {
+ return lintKind;
+ }
+
+} \ No newline at end of file
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
index 64d439671..ab61031f6 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
@@ -58,7 +58,6 @@ public class BcelAdvice extends Advice {
private ExposedState exposedState;
private boolean hasMatchedAtLeastOnce = false;
- private boolean hasReportedNoGuardForLazyTJP = false;
public BcelAdvice(
AjAttribute.AdviceAttribute attribute,
@@ -86,6 +85,17 @@ public class BcelAdvice extends Advice {
suppressLintWarnings(world);
ShadowMunger ret = super.concretize(fromType, world, clause);
clearLintSuppressions(world,this.suppressedLintKinds);
+ IfFinder ifinder = new IfFinder();
+ ret.getPointcut().accept(ifinder,null);
+ boolean hasGuardTest = ifinder.hasIf && getKind() != AdviceKind.Around;
+ boolean isAround = getKind() == AdviceKind.Around;
+ if ((getExtraParameterFlags() & ThisJoinPoint) != 0) {
+ if (!isAround && !hasGuardTest && world.getLint().noGuardForLazyTjp.isEnabled()) {
+ // can't build tjp lazily, no suitable test...
+ // ... only want to record it once against the advice(bug 133117)
+ world.getLint().noGuardForLazyTjp.signal("",getSourceLocation());
+ }
+ }
return ret;
}
@@ -159,15 +169,6 @@ public class BcelAdvice extends Advice {
// collect up the problematic advice
((BcelShadow)shadow).addAdvicePreventingLazyTjp(this);
}
- if (!hasReportedNoGuardForLazyTJP && !isAround && !hasGuardTest && world.getLint().noGuardForLazyTjp.isEnabled()) {
- // can't build tjp lazily, no suitable test...
- // ... only want to record it once against the advice(bug 133117)
- world.getLint().noGuardForLazyTjp.signal(
- "",
- getSourceLocation()
- );
- hasReportedNoGuardForLazyTJP = true;
- }
}
if ((getExtraParameterFlags() & ThisEnclosingJoinPointStaticPart) != 0) {