From ef280812570d55aa946ff8217066201288ec5bdf Mon Sep 17 00:00:00 2001 From: acolyer Date: Thu, 11 Sep 2003 08:49:21 +0000 Subject: [PATCH] remember handleIdentifier once calculated, use canonical file path map --- .../aspectj/asm/internal/ProgramElement.java | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/asm/src/org/aspectj/asm/internal/ProgramElement.java b/asm/src/org/aspectj/asm/internal/ProgramElement.java index 327a88d78..b09bd79d0 100644 --- a/asm/src/org/aspectj/asm/internal/ProgramElement.java +++ b/asm/src/org/aspectj/asm/internal/ProgramElement.java @@ -414,38 +414,31 @@ public class ProgramElement implements IProgramElement { return label; } - // TODO: determine if using canonical path incurrs performance overhead public static String createHandleIdentifier(File sourceFile, int line,int column) { -// try { StringBuffer sb = new StringBuffer(); - sb.append(sourceFile.getAbsolutePath()); + sb.append(AsmManager.getDefault().getCanonicalFilePath(sourceFile)); sb.append(ID_DELIM); sb.append(line); sb.append(ID_DELIM); sb.append(column); return sb.toString(); -// } catch (IOException ioe) { -// ioe.printStackTrace(); -// return null; -// } } + private String handle = null; public String getHandleIdentifier() { -// try { - StringBuffer sb = new StringBuffer(); - if (sourceLocation == null) { - return null; - } else { - sb.append(sourceLocation.getSourceFile().getAbsolutePath()); - sb.append(ID_DELIM); - sb.append(sourceLocation.getLine()); - sb.append(ID_DELIM); - sb.append(sourceLocation.getColumn()); - return sb.toString(); - } -// } catch (IOException ioe) { -// return null; -// } + if (null == handle) { + if (sourceLocation != null) { + StringBuffer sb = new StringBuffer(); + sb.append(AsmManager.getDefault() + .getCanonicalFilePath(sourceLocation.getSourceFile())); + sb.append(ID_DELIM); + sb.append(sourceLocation.getLine()); + sb.append(ID_DELIM); + sb.append(sourceLocation.getColumn()); + handle = sb.toString(); + } + } + return handle; } public List getParameterNames() { -- 2.39.5