From c732808dbf2daf655dc1c9ce4cddb20b8c27ab1a Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 25 Mar 2009 16:19:48 +0000 Subject: [PATCH] 269912: dont build message contexts for messages that will be output in the IDE --- .../internal/core/builder/AjBuildManager.java | 2 +- .../core/builder/EclipseAdapterUtils.java | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) 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 15df3fc6e..9f763e26a 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 @@ -1082,7 +1082,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour if (unitResult.hasProblems() || unitResult.hasTasks()) { IProblem[] problems = unitResult.getAllProblems(); for (int i = 0; i < problems.length; i++) { - IMessage message = EclipseAdapterUtils.makeMessage(unitResult.compilationUnit, problems[i], getBcelWorld()); + IMessage message = EclipseAdapterUtils.makeMessage(unitResult.compilationUnit, problems[i], getBcelWorld(),progressListener); 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 d84e2d557..7c92b223e 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 @@ -16,6 +16,7 @@ package org.aspectj.ajdt.internal.core.builder; import java.io.File; import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.IProgressListener; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.Message; import org.aspectj.bridge.SourceLocation; @@ -107,24 +108,31 @@ public class EclipseAdapterUtils { /** * Extract source location file, start and end lines, and context. Column is not extracted correctly. + * @param progressListener * * @return ISourceLocation with correct file and lines but not column. */ - public static ISourceLocation makeSourceLocation(ICompilationUnit unit, IProblem problem) { + public static ISourceLocation makeSourceLocation(ICompilationUnit unit, IProblem problem, IProgressListener progressListener) { int line = problem.getSourceLineNumber(); File file = new File(new String(problem.getOriginatingFileName())); - String context = makeLocationContext(unit, problem); - // XXX 0 column is wrong but recoverable from makeLocationContext - return new SourceLocation(file, line, line, 0, context); + // cheat here...269912 - don't build the context if under IDE control + if (progressListener!=null) { + return new SourceLocation(file, line, line, 0, null); + } else { + String context = makeLocationContext(unit, problem); + // XXX 0 column is wrong but recoverable from makeLocationContext + return new SourceLocation(file, line, line, 0, context); + } } /** * Extract message text and source location, including context. * * @param world + * @param progressListener */ - public static IMessage makeMessage(ICompilationUnit unit, IProblem problem, World world) { - ISourceLocation sourceLocation = makeSourceLocation(unit, problem); + public static IMessage makeMessage(ICompilationUnit unit, IProblem problem, World world, IProgressListener progressListener) { + ISourceLocation sourceLocation = makeSourceLocation(unit, problem, progressListener); IProblem[] seeAlso = problem.seeAlso(); // If the user has turned off classfile line number gen, then we may not be able to tell them // about all secondary locations (pr209372) -- 2.39.5