From b399c7f67c68cd53cf837361fa14c08f7a16bb0e Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 25 Aug 2009 17:01:14 +0000 Subject: [PATCH] persistence --- .../org/aspectj/bridge/ISourceLocation.java | 96 +++++++++---------- .../org/aspectj/bridge/SourceLocation.java | 18 ++-- 2 files changed, 55 insertions(+), 59 deletions(-) diff --git a/bridge/src/org/aspectj/bridge/ISourceLocation.java b/bridge/src/org/aspectj/bridge/ISourceLocation.java index 502db15a7..7ad9423c2 100644 --- a/bridge/src/org/aspectj/bridge/ISourceLocation.java +++ b/bridge/src/org/aspectj/bridge/ISourceLocation.java @@ -11,66 +11,62 @@ * Xerox/PARC initial implementation * ******************************************************************/ - package org.aspectj.bridge; import java.io.File; /** - * Represent source location as a starting line/column and ending - * line in a source file. - * Implementations should be immutable. XXX why? + * Represent source location as a starting line/column and ending line in a source file. Implementations should be immutable. XXX + * why? + * * @see org.aspectj.lang.reflect.SourceLocation * @see org.aspectj.compiler.base.parser.SourceInfo * @see org.aspectj.tools.ide.SourceLine * @see org.aspectj.testing.harness.ErrorLine */ -public interface ISourceLocation { - static final int MAX_LINE = Integer.MAX_VALUE / 2; - static final int MAX_COLUMN = MAX_LINE; - - /** non-null but empty (nonexisting) File constant */ - static final File NO_FILE = new File("ISourceLocation.NO_FILE"); +public interface ISourceLocation extends java.io.Serializable { + static final int MAX_LINE = Integer.MAX_VALUE / 2; + static final int MAX_COLUMN = MAX_LINE; + + /** non-null but empty (nonexisting) File constant */ + static final File NO_FILE = new File("ISourceLocation.NO_FILE"); + + /** signal that column is not known */ + static final int NO_COLUMN = Integer.MIN_VALUE + 1; + + /** non-null but empty constant source location */ + static final ISourceLocation EMPTY = new SourceLocation(NO_FILE, 0, 0, 0); + + /** + * @return File source or NO_FILE if the implementation requires a non-null result or null otherwise + */ + File getSourceFile(); + + /** @return 0..MAX_LINE */ + int getLine(); + + /** + * @return int 0..MAX_COLUMN actual column or 0 if column input was ISourceLocation.NO_COLUMN + */ + int getColumn(); + + /** + * @return offset into file + */ + int getOffset(); + + /** @return getLine()..MAX_LINE */ + int getEndLine(); + + /** @return String application-specific context for source */ + String getContext(); - /** signal that column is not known */ - static final int NO_COLUMN = Integer.MIN_VALUE +1; + /** + * In the cases where getSourceFile().getName() returns a class file (for example when we have a binary aspect) this should + * return the name of the source file (for example BinaryAspect.aj) + * + * @return the name of the source file + */ + String getSourceFileName(); - /** non-null but empty constant source location */ - static final ISourceLocation EMPTY = new SourceLocation(NO_FILE, 0, 0, 0); - - /** - * @return File source or NO_FILE if the implementation requires - * a non-null result or null otherwise - */ - File getSourceFile(); - - /** @return 0..MAX_LINE */ - int getLine(); - - /** - * @return int 0..MAX_COLUMN actual column - * or 0 if column input was ISourceLocation.NO_COLUMN - */ - int getColumn(); - - /** - * @return offset into file - */ - int getOffset(); - - /** @return getLine()..MAX_LINE */ - int getEndLine(); - - /** @return String application-specific context for source */ - String getContext(); - - /** - * In the cases where getSourceFile().getName() returns a class file - * (for example when we have a binary aspect) this should return the - * name of the source file (for example BinaryAspect.aj) - * - * @return the name of the source file - */ - String getSourceFileName(); - } diff --git a/bridge/src/org/aspectj/bridge/SourceLocation.java b/bridge/src/org/aspectj/bridge/SourceLocation.java index 490eb65fb..e72673fde 100644 --- a/bridge/src/org/aspectj/bridge/SourceLocation.java +++ b/bridge/src/org/aspectj/bridge/SourceLocation.java @@ -35,6 +35,15 @@ public class SourceLocation implements ISourceLocation, java.io.Serializable { /** used when SourceLocation is not available */ public static final ISourceLocation UNKNOWN = new SourceLocation(ISourceLocation.NO_FILE, 0, 0, 0); + private final File sourceFile; + private final int startLine; + private final int column; + private final int endLine; + private int offset; + private final String context; + private boolean noColumn; + private String sourceFileName; + /** @throws IllegalArgumentException if the input would not be a valid line */ public static final void validLine(int line) { if (line < 0) { @@ -53,15 +62,6 @@ public class SourceLocation implements ISourceLocation, java.io.Serializable { } } - private final File sourceFile; - private final int startLine; - private final int column; - private final int endLine; - private int offset; - private final String context; - private boolean noColumn; - private String sourceFileName; - /** * Same as SourceLocation(file, line, line, 0), except that column is not rendered during toString() */ -- 2.39.5