From 27ee20bd6d29a42619afd9a3b0627b1ac9eeba43 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 24 Sep 2008 20:09:17 +0000 Subject: 247742:c27 --- .../internal/core/builder/AsmHierarchyBuilder.java | 83 +++++++++++----------- 1 file changed, 42 insertions(+), 41 deletions(-) (limited to 'org.aspectj.ajdt.core') diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java index 06d3191fd..3b1248002 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java @@ -214,50 +214,52 @@ public class AsmHierarchyBuilder extends ASTVisitor { ImportReference unitPackage = unit.currentPackage; - if (null == unitPackage) { - // Is there a sourceFolder to stick in? - if (sourceFolder == null) { - addToNode = structureModel.getRoot(); - } else { - addToNode = findOrCreateChildSourceFolder(sourceFolder, structureModel); - } + // if (null == unitPackage) { + // // Is there a sourceFolder to stick in? + // if (sourceFolder == null) { + // addToNode = structureModel.getRoot(); + // } else { + // addToNode = findOrCreateChildSourceFolder(sourceFolder, structureModel); + // } + // } else { + + IProgramElement rootForSource = structureModel.getRoot(); + if (sourceFolder != null) { + rootForSource = findOrCreateChildSourceFolder(sourceFolder, structureModel); + } + String pkgName; + if (unitPackage == null) { + pkgName = ""; } else { - - IProgramElement rootForSource = structureModel.getRoot(); - if (sourceFolder != null) { - rootForSource = findOrCreateChildSourceFolder(sourceFolder, structureModel); - } - String pkgName; - { - StringBuffer nameBuffer = new StringBuffer(); - final char[][] importName = unitPackage.getImportName(); - final int last = importName.length - 1; - for (int i = 0; i < importName.length; i++) { - nameBuffer.append(new String(importName[i])); - if (i < last) { - nameBuffer.append('.'); - } + StringBuffer nameBuffer = new StringBuffer(); + final char[][] importName = unitPackage.getImportName(); + final int last = importName.length - 1; + for (int i = 0; i < importName.length; i++) { + nameBuffer.append(new String(importName[i])); + if (i < last) { + nameBuffer.append('.'); } - pkgName = nameBuffer.toString(); } + pkgName = nameBuffer.toString(); + } - IProgramElement pkgNode = null; - if (structureModel != null && structureModel.getRoot() != null && rootForSource.getChildren() != null) { - for (Iterator it = rootForSource.getChildren().iterator(); it.hasNext();) { - IProgramElement currNode = (IProgramElement) it.next(); - if (pkgName.equals(currNode.getName())) { - pkgNode = currNode; - break; - } + IProgramElement pkgNode = null; + if (structureModel != null && structureModel.getRoot() != null && rootForSource.getChildren() != null) { + for (Iterator it = rootForSource.getChildren().iterator(); it.hasNext();) { + IProgramElement currNode = (IProgramElement) it.next(); + if (pkgName.equals(currNode.getName())) { + pkgNode = currNode; + break; } } - if (pkgNode == null) { - // note packages themselves have no source location - pkgNode = new ProgramElement(pkgName, IProgramElement.Kind.PACKAGE, new ArrayList()); - rootForSource.addChild(pkgNode); - } - addToNode = pkgNode; } + if (pkgNode == null) { + // note packages themselves have no source location + pkgNode = new ProgramElement(pkgName, IProgramElement.Kind.PACKAGE, new ArrayList()); + rootForSource.addChild(pkgNode); + } + addToNode = pkgNode; + // } } return addToNode; } @@ -281,13 +283,12 @@ public class AsmHierarchyBuilder extends ASTVisitor { if (Arrays.equals(annotation.type.getTypeBindingPublic(scope).signature(), "Lorg/aspectj/lang/annotation/Aspect;" .toCharArray())) { kind = IProgramElement.Kind.ASPECT; - } else if(annotation.resolvedType != null) { + } else if (annotation.resolvedType != null) { // Fix for the case where in a privileged aspect a parent declaration : - // declare parents: (@A C+) implements (B); + // declare parents: (@A C+) implements (B); // is causing the resolvedType to be null when it shouldn't // for the aspect and privileged annotation of that aspect. - - + // Creating the char[][] needed for ImportReference String[] temp = (new String(annotation.resolvedType.constantPoolName())).split("/"); if (temp.length > 1) { -- cgit v1.2.3