]> source.dussan.org Git - aspectj.git/commitdiff
remember handleIdentifier once calculated, use canonical file path map
authoracolyer <acolyer>
Thu, 11 Sep 2003 08:49:21 +0000 (08:49 +0000)
committeracolyer <acolyer>
Thu, 11 Sep 2003 08:49:21 +0000 (08:49 +0000)
asm/src/org/aspectj/asm/internal/ProgramElement.java

index 327a88d785d877965274a90688edc9314d073e18..b09bd79d090477fec825d30ecd4a8aa904ece02a 100644 (file)
@@ -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() {