From: aclement Date: Tue, 7 Dec 2004 10:12:16 +0000 (+0000) Subject: Finally ... type mungers now remember where they came from in their attributes. ... X-Git-Tag: Root_AspectJ5_Development~194 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cf858230583bd35bc49534c894930bd547682965;p=aspectj.git 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.) --- 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; }