diff options
author | aclement <aclement> | 2004-12-10 15:40:59 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-12-10 15:40:59 +0000 |
commit | 1575a175b511eadbae03fc760b0cd20edde6ae4e (patch) | |
tree | a135e948e9e293df3849b9ab45582125a3dd1590 /weaver/src | |
parent | 379eb69126a1d904c2f4a6a63a97c138a7712791 (diff) | |
download | aspectj-1575a175b511eadbae03fc760b0cd20edde6ae4e.tar.gz aspectj-1575a175b511eadbae03fc760b0cd20edde6ae4e.zip |
Support for 'offset' in source locations - enabling AJDT improvements. Not perfect - really the whole ISourceLocation thing needs sorting out ...
Diffstat (limited to 'weaver/src')
-rw-r--r-- | weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java | 26 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java | 5 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/ShadowMunger.java | 3 |
3 files changed, 23 insertions, 11 deletions
diff --git a/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java b/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java index d851d59ec..efa3482f9 100644 --- a/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java +++ b/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java @@ -46,12 +46,14 @@ public class AsmRelationshipProvider { String sourceHandle = ProgramElement.createHandleIdentifier( checker.getSourceLocation().getSourceFile(), checker.getSourceLocation().getLine(), - checker.getSourceLocation().getColumn()); + checker.getSourceLocation().getColumn(), + checker.getSourceLocation().getOffset()); String targetHandle = ProgramElement.createHandleIdentifier( shadow.getSourceLocation().getSourceFile(), shadow.getSourceLocation().getLine(), - shadow.getSourceLocation().getColumn()); + shadow.getSourceLocation().getColumn(), + shadow.getSourceLocation().getOffset()); IRelationshipMap mapper = AsmManager.getDefault().getRelationshipMap(); if (sourceHandle != null && targetHandle != null) { @@ -78,19 +80,22 @@ public class AsmRelationshipProvider { sourceHandle = ProgramElement.createHandleIdentifier( munger.getSourceLocation().getSourceFile(), munger.getSourceLocation().getLine(), - munger.getSourceLocation().getColumn()); + munger.getSourceLocation().getColumn(), + munger.getSourceLocation().getOffset()); } else { sourceHandle = ProgramElement.createHandleIdentifier( originatingAspect.getSourceLocation().getSourceFile(), originatingAspect.getSourceLocation().getLine(), - originatingAspect.getSourceLocation().getColumn()); + originatingAspect.getSourceLocation().getColumn(), + originatingAspect.getSourceLocation().getOffset()); } if (originatingAspect.getSourceLocation() != null) { String targetHandle = ProgramElement.createHandleIdentifier( onType.getSourceLocation().getSourceFile(), onType.getSourceLocation().getLine(), - onType.getSourceLocation().getColumn()); + onType.getSourceLocation().getColumn(), + onType.getSourceLocation().getOffset()); IRelationshipMap mapper = AsmManager.getDefault().getRelationshipMap(); if (sourceHandle != null && targetHandle != null) { @@ -107,7 +112,7 @@ public class AsmRelationshipProvider { public void addDeclareParentsRelationship(ISourceLocation decp,ResolvedTypeX targetType, List newParents) { - String sourceHandle = ProgramElement.createHandleIdentifier(decp.getSourceFile(),decp.getLine(),decp.getColumn()); + String sourceHandle = ProgramElement.createHandleIdentifier(decp.getSourceFile(),decp.getLine(),decp.getColumn(),decp.getOffset()); IProgramElement ipe = AsmManager.getDefault().getHierarchy().findElementForHandle(sourceHandle); @@ -115,7 +120,8 @@ public class AsmRelationshipProvider { String targetHandle = ProgramElement.createHandleIdentifier( targetType.getSourceLocation().getSourceFile(), targetType.getSourceLocation().getLine(), - targetType.getSourceLocation().getColumn()); + targetType.getSourceLocation().getColumn(), + targetType.getSourceLocation().getOffset()); IRelationshipMap mapper = AsmManager.getDefault().getRelationshipMap(); if (sourceHandle != null && targetHandle != null) { @@ -212,11 +218,13 @@ public class AsmRelationshipProvider { ISourceLocation sl = shadow.getSourceLocation(); +// XXX why not use shadow file? new SourceLocation(sl.getSourceFile(), sl.getLine()), + SourceLocation peLoc = new SourceLocation(enclosingNode.getSourceLocation().getSourceFile(),sl.getLine()); + peLoc.setOffset(sl.getOffset()); IProgramElement peNode = new ProgramElement( shadow.toString(), IProgramElement.Kind.CODE, - //XXX why not use shadow file? new SourceLocation(sl.getSourceFile(), sl.getLine()), - new SourceLocation(enclosingNode.getSourceLocation().getSourceFile(), sl.getLine()), + peLoc, 0, "", new ArrayList()); diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java b/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java index dedd32ef7..f28e87535 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java @@ -145,7 +145,7 @@ public abstract class ResolvedTypeMunger { protected static ISourceLocation readSourceLocation(DataInputStream s) throws IOException { if (!persistSourceLocation) return null; - ISourceLocation ret = null; + SourceLocation ret = null; ObjectInputStream ois = null; try { // This logic copes with the location missing from the attribute - an EOFException will @@ -155,7 +155,9 @@ public abstract class ResolvedTypeMunger { if (validLocation.booleanValue()) { File f = (File) ois.readObject(); Integer ii = (Integer)ois.readObject(); + Integer offset = (Integer)ois.readObject(); ret = new SourceLocation(f,ii.intValue()); + ret.setOffset(offset.intValue()); } } catch (EOFException eof) { return null; // This exception occurs if processing an 'old style' file where the @@ -180,6 +182,7 @@ public abstract class ResolvedTypeMunger { if (location !=null) { oos.writeObject(location.getSourceFile()); oos.writeObject(new Integer(location.getLine())); + oos.writeObject(new Integer(location.getOffset())); } oos.flush(); oos.close(); diff --git a/weaver/src/org/aspectj/weaver/ShadowMunger.java b/weaver/src/org/aspectj/weaver/ShadowMunger.java index 57c629ff2..36218cdb2 100644 --- a/weaver/src/org/aspectj/weaver/ShadowMunger.java +++ b/weaver/src/org/aspectj/weaver/ShadowMunger.java @@ -90,7 +90,8 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH handle = ProgramElement.createHandleIdentifier( sl.getSourceFile(), sl.getLine(), - sl.getColumn()); + sl.getColumn(), + sl.getOffset()); } } return handle; |