From bd85862d023f3b8a7de01ffe3f5d2e2ef34fcaac Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 30 Apr 2009 19:51:48 +0000 Subject: [PATCH] 274558: use .class names in handles for binaries entries (faulted in aspects) --- .../weaver/model/AsmRelationshipProvider.java | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java b/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java index 164aa0d64..8cab5d57c 100644 --- a/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java +++ b/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java @@ -165,7 +165,7 @@ public class AsmRelationshipProvider { IRelationship back = mapper.get(targetHandle, IRelationship.Kind.DECLARE_INTER_TYPE, INTER_TYPE_DECLARED_BY, false, true); back.addTarget(sourceHandle); - if (sourceNode!=null && sourceNode.getSourceLocation() != null) { + if (sourceNode != null && sourceNode.getSourceLocation() != null) { // May have been a bug in the compiled aspect - so it didn't get put in the model model.addAspectInEffectThisBuild(sourceNode.getSourceLocation().getSourceFile()); } @@ -176,35 +176,36 @@ public class AsmRelationshipProvider { IHierarchy hierarchy = model.getHierarchy(); ISourceLocation sourceLocation = onType.getSourceLocation(); String canonicalFilePath = model.getCanonicalFilePath(sourceLocation.getSourceFile()); - int lineNumber = sourceLocation.getLine(); + int lineNumber = sourceLocation.getLine(); // Find the relevant source file node first IProgramElement node = hierarchy.findNodeForSourceFile(hierarchy.getRoot(), canonicalFilePath); if (node == null) { - // Does not exist in the model - probably an inpath + // Does not exist in the model - probably an inpath String bpath = onType.getBinaryPath(); - if (bpath==null) { - return model.getHandleProvider().createHandleIdentifier(createFileStructureNode(model,canonicalFilePath)); + if (bpath == null) { + return model.getHandleProvider().createHandleIdentifier(createFileStructureNode(model, canonicalFilePath)); } else { IProgramElement programElement = model.getHierarchy().getRoot(); // =Foo/,0 && ((ch=bpath.charAt(startPosition))!='/' && ch!='\\' && ch!='!')) { + while (startPosition > 0 && ((ch = bpath.charAt(startPosition)) != '/' && ch != '\\' && ch != '!')) { startPosition--; } - String classFile = bpath.substring(startPosition+1,dotClassPosition+6); + String classFile = bpath.substring(startPosition + 1, dotClassPosition + 6); phantomHandle.append(HandleProviderDelimiter.CLASSFILE.getDelimiter()).append(classFile); } - + // [G phantomHandle.append(HandleProviderDelimiter.TYPE.getDelimiter()).append(onType.getClassName()); - + return phantomHandle.toString(); } } else { @@ -238,9 +239,9 @@ public class AsmRelationshipProvider { return model.getHandleProvider().createHandleIdentifier(closernode); } } - + } - + public static IProgramElement createFileStructureNode(AsmManager asm, String sourceFilePath) { // SourceFilePath might have originated on windows on linux... int lastSlash = sourceFilePath.lastIndexOf('\\'); @@ -353,8 +354,9 @@ public class AsmRelationshipProvider { } // create the class file node - IProgramElement classFileNode = new ProgramElement(model, filenode.getName(), IProgramElement.Kind.FILE, - getBinarySourceLocation(aspect, aspect.getSourceLocation()), 0, null, null); + ISourceLocation binLocation = getBinarySourceLocation(aspect, aspect.getSourceLocation()); + String f = getBinaryFile(aspect).getName(); + IProgramElement classFileNode = new ProgramElement(model, f, IProgramElement.Kind.FILE, binLocation, 0, null, null); // create package ipe if one exists.... IProgramElement root = model.getHierarchy().getRoot(); -- 2.39.5