summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
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 /org.aspectj.ajdt.core
parent135173acd2c893e5bfbb420e9cccf493ba150bfe (diff)
downloadaspectj-a562d831df36dd0ec0cbf6ff0c6526ebc8977432.tar.gz
aspectj-a562d831df36dd0ec0cbf6ff0c6526ebc8977432.zip
141556: lint message sort out and memory leak resolution
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java5
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java19
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java35
3 files changed, 44 insertions, 15 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java
index f0f26f325..a57c61f1a 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/WeaverMessageHandler.java
@@ -26,6 +26,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.Compiler;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
import org.aspectj.org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
import org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
+import org.aspectj.weaver.LintMessage;
/**
* @author colyer
@@ -127,6 +128,10 @@ public class WeaverMessageHandler implements IMessageHandler {
if (message.getDeclared()) {
details.append("[deow=true]");
}
+ if (message instanceof LintMessage) {
+ String lintMessageName = ((LintMessage)message).getLintKind();
+ details.append("[Xlint:").append(lintMessageName).append("]");
+ }
if (details.length()!=0) {
problem.setSupplementaryMessageInfo(details.toString());
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
index efdefe0d1..c87a226d8 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
@@ -693,6 +693,15 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
state.setWeaver(bcelWeaver);
state.clearBinarySourceFiles();
+ if (buildConfig.getLintMode().equals(AjBuildConfig.AJLINT_DEFAULT)) {
+ bcelWorld.getLint().loadDefaultProperties();
+ } else {
+ bcelWorld.getLint().setAll(buildConfig.getLintMode());
+ }
+ if (buildConfig.getLintSpecFile() != null) {
+ bcelWorld.getLint().setFromProperties(buildConfig.getLintSpecFile());
+ }
+
for (Iterator i = buildConfig.getAspectpath().iterator(); i.hasNext();) {
File f = (File) i.next();
if (!f.exists()) {
@@ -705,15 +714,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
// String lintMode = buildConfig.getLintMode();
- if (buildConfig.getLintMode().equals(AjBuildConfig.AJLINT_DEFAULT)) {
- bcelWorld.getLint().loadDefaultProperties();
- } else {
- bcelWorld.getLint().setAll(buildConfig.getLintMode());
- }
- if (buildConfig.getLintSpecFile() != null) {
- bcelWorld.getLint().setFromProperties(buildConfig.getLintSpecFile());
- }
//??? incremental issues
for (Iterator i = buildConfig.getInJars().iterator(); i.hasNext(); ) {
@@ -957,7 +958,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
IProblem[] problems = unitResult.getAllProblems();
for (int i=0; i < problems.length; i++) {
IMessage message =
- EclipseAdapterUtils.makeMessage(unitResult.compilationUnit, problems[i]);
+ EclipseAdapterUtils.makeMessage(unitResult.compilationUnit, problems[i],getBcelWorld());
handler.handleMessage(message);
}
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
index d9a75b79f..a9c853bec 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
@@ -21,10 +21,9 @@ import org.aspectj.bridge.Message;
import org.aspectj.bridge.SourceLocation;
import org.aspectj.org.eclipse.jdt.core.compiler.IProblem;
import org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
+import org.aspectj.weaver.LintMessage;
+import org.aspectj.weaver.World;
-/**
- *
- */
public class EclipseAdapterUtils {
//XXX some cut-and-paste from eclipse sources
@@ -127,8 +126,9 @@ public class EclipseAdapterUtils {
/**
* Extract message text and source location, including context.
+ * @param world
*/
- public static IMessage makeMessage(ICompilationUnit unit, IProblem problem) {
+ public static IMessage makeMessage(ICompilationUnit unit, IProblem problem, World world) {
ISourceLocation sourceLocation = makeSourceLocation(unit, problem);
IProblem[] seeAlso = problem.seeAlso();
ISourceLocation[] seeAlsoLocations = new ISourceLocation[seeAlso.length];
@@ -143,10 +143,18 @@ public class EclipseAdapterUtils {
// in the extraDetails.
String extraDetails = problem.getSupplementaryMessageInfo();
boolean declared = false;
+ boolean isLintMessage = false;
+ String lintkey = null;
if (extraDetails!=null && extraDetails.endsWith("[deow=true]")) {
declared = true;
extraDetails = extraDetails.substring(0,extraDetails.length()-"[deow=true]".length());
}
+ if (extraDetails!=null && extraDetails.indexOf("[Xlint:")!=-1) {
+ isLintMessage = true;
+ lintkey = extraDetails.substring(extraDetails.indexOf("[Xlint:"));
+ lintkey = lintkey.substring("[Xlint:".length());
+ lintkey = lintkey.substring(0,lintkey.indexOf("]"));
+ }
// If the 'problem' represents a TO DO kind of thing then use the message kind that
// represents this so AJDT sees it correctly.
@@ -157,7 +165,21 @@ public class EclipseAdapterUtils {
if (problem.isError()) { kind = IMessage.ERROR; }
else { kind = IMessage.WARNING; }
}
- IMessage msg = new Message(problem.getMessage(),
+ IMessage msg = null;
+ if (isLintMessage) {
+ msg = new LintMessage(
+ problem.getMessage(),
+ extraDetails,
+ world.getLint().fromKey(lintkey),
+ kind,
+ sourceLocation,
+ null,
+ seeAlsoLocations,
+ declared,
+ problem.getID(),
+ problem.getSourceStart(),problem.getSourceEnd());
+ } else {
+ msg = new Message(problem.getMessage(),
extraDetails,
kind,
sourceLocation,
@@ -166,7 +188,8 @@ public class EclipseAdapterUtils {
declared,
problem.getID(),
problem.getSourceStart(),problem.getSourceEnd());
- return msg;
+ }
+ return msg;
}
public static IMessage makeErrorMessage(ICompilationUnit unit, String text, Exception ex) {