aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2004-12-07 10:12:16 +0000
committeraclement <aclement>2004-12-07 10:12:16 +0000
commitcf858230583bd35bc49534c894930bd547682965 (patch)
tree76725d30d795aee43c3e8594675ff3589dda2113 /weaver
parent4273a2ddbf02819eb52e4fbbbe84a1e0ee4059ae (diff)
downloadaspectj-cf858230583bd35bc49534c894930bd547682965.tar.gz
aspectj-cf858230583bd35bc49534c894930bd547682965.zip
Finally ... type mungers now remember where they came from in their attributes. So during binary weaving we can determine the source of the declarations. We will still understand the old form of attribute that is missing the source location.
(This means incremental compilation of ITDs will work properly for the IDE.)
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java b/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java
index aa1ff7223..dedd32ef7 100644
--- a/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java
+++ b/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java
@@ -15,6 +15,7 @@ package org.aspectj.weaver;
import java.io.DataInputStream;
import java.io.DataOutputStream;
+import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -38,7 +39,7 @@ public abstract class ResolvedTypeMunger {
protected Kind kind;
protected ResolvedMember signature;
- public static transient boolean persistSourceLocation = false;
+ public static transient boolean persistSourceLocation = true;
private Set /* resolvedMembers */ superMethodsCalled = Collections.EMPTY_SET;
@@ -145,20 +146,29 @@ public abstract class ResolvedTypeMunger {
protected static ISourceLocation readSourceLocation(DataInputStream s) throws IOException {
if (!persistSourceLocation) return null;
ISourceLocation ret = null;
- ObjectInputStream ois = new ObjectInputStream(s);
+ ObjectInputStream ois = null;
try {
+ // This logic copes with the location missing from the attribute - an EOFException will
+ // occur on the next line and we ignore it.
+ ois = new ObjectInputStream(s);
Boolean validLocation = (Boolean)ois.readObject();
if (validLocation.booleanValue()) {
File f = (File) ois.readObject();
Integer ii = (Integer)ois.readObject();
ret = new SourceLocation(f,ii.intValue());
}
+ } catch (EOFException eof) {
+ return null; // This exception occurs if processing an 'old style' file where the
+ // type munger attributes don't include the source location.
} catch (IOException ioe) {
- // Something went wrong, maybe this is an 'old style' file that doesnt attach locations to mungers
+ // Something went wrong, maybe this is an 'old style' file that doesnt attach locations to mungers?
+ // (but I thought that was just an EOFException?)
ioe.printStackTrace();
return null;
- } catch (ClassNotFoundException e) { }
- ois.close();
+ } catch (ClassNotFoundException e) {
+ } finally {
+ if (ois!=null) ois.close();
+ }
return ret;
}