From c3eb841ce8ae349d9820dbf6c18884955e74254e Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Sun, 20 Nov 2016 00:02:50 +0100 Subject: Make every project use the new directory structure --- .../dotty/tools/dotc/interfaces/AbstractFile.java | 24 ++++++++++++ .../tools/dotc/interfaces/CompilerCallback.java | 28 ++++++++++++++ .../dotty/tools/dotc/interfaces/Diagnostic.java | 26 +++++++++++++ .../tools/dotc/interfaces/ReporterResult.java | 18 +++++++++ .../tools/dotc/interfaces/SimpleReporter.java | 15 ++++++++ .../dotty/tools/dotc/interfaces/SourceFile.java | 11 ++++++ .../tools/dotc/interfaces/SourcePosition.java | 45 ++++++++++++++++++++++ .../dotty/tools/dotc/interfaces/AbstractFile.java | 24 ------------ .../tools/dotc/interfaces/CompilerCallback.java | 28 -------------- .../dotty/tools/dotc/interfaces/Diagnostic.java | 26 ------------- .../tools/dotc/interfaces/ReporterResult.java | 18 --------- .../tools/dotc/interfaces/SimpleReporter.java | 15 -------- .../dotty/tools/dotc/interfaces/SourceFile.java | 11 ------ .../tools/dotc/interfaces/SourcePosition.java | 45 ---------------------- 14 files changed, 167 insertions(+), 167 deletions(-) create mode 100644 interfaces/src/dotty/tools/dotc/interfaces/AbstractFile.java create mode 100644 interfaces/src/dotty/tools/dotc/interfaces/CompilerCallback.java create mode 100644 interfaces/src/dotty/tools/dotc/interfaces/Diagnostic.java create mode 100644 interfaces/src/dotty/tools/dotc/interfaces/ReporterResult.java create mode 100644 interfaces/src/dotty/tools/dotc/interfaces/SimpleReporter.java create mode 100644 interfaces/src/dotty/tools/dotc/interfaces/SourceFile.java create mode 100644 interfaces/src/dotty/tools/dotc/interfaces/SourcePosition.java delete mode 100644 interfaces/src/main/java/dotty/tools/dotc/interfaces/AbstractFile.java delete mode 100644 interfaces/src/main/java/dotty/tools/dotc/interfaces/CompilerCallback.java delete mode 100644 interfaces/src/main/java/dotty/tools/dotc/interfaces/Diagnostic.java delete mode 100644 interfaces/src/main/java/dotty/tools/dotc/interfaces/ReporterResult.java delete mode 100644 interfaces/src/main/java/dotty/tools/dotc/interfaces/SimpleReporter.java delete mode 100644 interfaces/src/main/java/dotty/tools/dotc/interfaces/SourceFile.java delete mode 100644 interfaces/src/main/java/dotty/tools/dotc/interfaces/SourcePosition.java (limited to 'interfaces') diff --git a/interfaces/src/dotty/tools/dotc/interfaces/AbstractFile.java b/interfaces/src/dotty/tools/dotc/interfaces/AbstractFile.java new file mode 100644 index 000000000..286e7b2cf --- /dev/null +++ b/interfaces/src/dotty/tools/dotc/interfaces/AbstractFile.java @@ -0,0 +1,24 @@ +package dotty.tools.dotc.interfaces; + +import java.io.File; +import java.util.Optional; + +/** An abstract file may either be a file on disk or a virtual file. + * + * Do not rely on the identity of instances of this class. + * + * User code should not implement this interface, but it may have to + * manipulate objects of this type. + */ +public interface AbstractFile { + /** @return The name of this file, note that two files may have the same name. */ + String name(); + + /** @return The path of this file, this might be a virtual path of an unspecified format. */ + String path(); + + /** @return If this is a real file on disk, a `java.io.File` that corresponds to this file. + * Otherwise, an empty `Optional`. + */ + Optional jfile(); +} diff --git a/interfaces/src/dotty/tools/dotc/interfaces/CompilerCallback.java b/interfaces/src/dotty/tools/dotc/interfaces/CompilerCallback.java new file mode 100644 index 000000000..25696f740 --- /dev/null +++ b/interfaces/src/dotty/tools/dotc/interfaces/CompilerCallback.java @@ -0,0 +1,28 @@ +package dotty.tools.dotc.interfaces; + +/** Set of callbacks called in response to events during the compilation process. + * + * You should implement this interface if you want to react to one or more of + * these events. + * + * See the method `process` of `dotty.tools.dotc.Driver` for more information. + */ +public interface CompilerCallback { + /** Called when a class has been generated. + * + * @param source The source file corresponding to this class. + * Example: ./src/library/scala/collection/Seq.scala + * @param generatedClass The generated classfile for this class. + * Example: ./scala/collection/Seq$.class + * @param className The name of this class. + * Example: scala.collection.Seq$ + */ + default void onClassGenerated(SourceFile source, AbstractFile generatedClass, String className) {}; + + /** Called when every class for this file has been generated. + * + * @param source The source file. + * Example: ./src/library/scala/collection/Seq.scala + */ + default void onSourceCompiled(SourceFile source) {}; +} diff --git a/interfaces/src/dotty/tools/dotc/interfaces/Diagnostic.java b/interfaces/src/dotty/tools/dotc/interfaces/Diagnostic.java new file mode 100644 index 000000000..c46360afa --- /dev/null +++ b/interfaces/src/dotty/tools/dotc/interfaces/Diagnostic.java @@ -0,0 +1,26 @@ +package dotty.tools.dotc.interfaces; + +import java.util.Optional; + +/** A diagnostic is a message emitted during the compilation process. + * + * It can either be an error, a warning or an information. + * + * User code should not implement this interface, but it may have to + * manipulate objects of this type. + */ +public interface Diagnostic { + public static final int ERROR = 2; + public static final int WARNING = 1; + public static final int INFO = 0; + + /** @return The message to report */ + String message(); + + /** @return Level of the diagnostic, can be either ERROR, WARNING or INFO */ + int level(); + + /** @return The position in a source file of the code that caused this diagnostic + * to be emitted. */ + Optional position(); +} diff --git a/interfaces/src/dotty/tools/dotc/interfaces/ReporterResult.java b/interfaces/src/dotty/tools/dotc/interfaces/ReporterResult.java new file mode 100644 index 000000000..f75519db2 --- /dev/null +++ b/interfaces/src/dotty/tools/dotc/interfaces/ReporterResult.java @@ -0,0 +1,18 @@ +package dotty.tools.dotc.interfaces; + +/** Summary of the diagnostics emitted by a Reporter. + * + * User code should not implement this interface, but it may have to + * manipulate objects of this type. + */ +public interface ReporterResult { + /** @return Have we emitted any error? */ + boolean hasErrors(); + /** @return Number of errors that have been emitted */ + int errorCount(); + + /** @return Have we emitted any warning ? */ + boolean hasWarnings(); + /** @return Number of warnings that have been emitted */ + int warningCount(); +} diff --git a/interfaces/src/dotty/tools/dotc/interfaces/SimpleReporter.java b/interfaces/src/dotty/tools/dotc/interfaces/SimpleReporter.java new file mode 100644 index 000000000..f4c80c0cf --- /dev/null +++ b/interfaces/src/dotty/tools/dotc/interfaces/SimpleReporter.java @@ -0,0 +1,15 @@ +package dotty.tools.dotc.interfaces; + +/** Report errors, warnings and info messages during the compilation process + * + * You should implement this interface if you want to handle the diagnostics + * returned by the compiler yourself. + * + * See the method `process` of `dotty.tools.dotc.Driver` for more information. + */ +public interface SimpleReporter { + /** Report a diagnostic. + * @param diag the diagnostic message to report + */ + void report(Diagnostic diag); +} diff --git a/interfaces/src/dotty/tools/dotc/interfaces/SourceFile.java b/interfaces/src/dotty/tools/dotc/interfaces/SourceFile.java new file mode 100644 index 000000000..6c72a5125 --- /dev/null +++ b/interfaces/src/dotty/tools/dotc/interfaces/SourceFile.java @@ -0,0 +1,11 @@ +package dotty.tools.dotc.interfaces; + +/** A source file. + * + * User code should not implement this interface, but it may have to + * manipulate objects of this type. + */ +public interface SourceFile extends AbstractFile { + /** @return The content of this file as seen by the compiler. */ + char[] content(); +} diff --git a/interfaces/src/dotty/tools/dotc/interfaces/SourcePosition.java b/interfaces/src/dotty/tools/dotc/interfaces/SourcePosition.java new file mode 100644 index 000000000..d8afbf5f6 --- /dev/null +++ b/interfaces/src/dotty/tools/dotc/interfaces/SourcePosition.java @@ -0,0 +1,45 @@ +package dotty.tools.dotc.interfaces; + +/** A position in a source file. + * + * A position is a range between a start offset and an end offset, as well as a + * point inside this range. + * + * As a convenience, we also provide methods that return the line and the column + * corresponding to each offset. + * + * User code should not implement this interface, but it may have to + * manipulate objects of this type. + */ +public interface SourcePosition { + /** @return Content of the line which contains the point */ + String lineContent(); + + /** @return Offset to the point */ + int point(); + /** @return Line number of the point, starting at 0 */ + int line(); + /** @return Column number of the point, starting at 0 */ + int column(); + + /** @return Offset to the range start */ + int start(); + /** @return Line number of the range start, starting at 0 */ + int startLine(); + /** @return Column number of the range start, starting at 0 */ + int startColumn(); + + /** @return Offset to the range end */ + int end(); + /** @return Line number of the range end, starting at 0 */ + int endLine(); + /** @return Column number of the range end, starting at 0 */ + int endColumn(); + + /** The source file corresponding to this position. + * The values returned by `point()`, `start()` and `end()` + * are indices in the array returned by `source().content()`. + * @return source file for this position + */ + SourceFile source(); +} diff --git a/interfaces/src/main/java/dotty/tools/dotc/interfaces/AbstractFile.java b/interfaces/src/main/java/dotty/tools/dotc/interfaces/AbstractFile.java deleted file mode 100644 index 286e7b2cf..000000000 --- a/interfaces/src/main/java/dotty/tools/dotc/interfaces/AbstractFile.java +++ /dev/null @@ -1,24 +0,0 @@ -package dotty.tools.dotc.interfaces; - -import java.io.File; -import java.util.Optional; - -/** An abstract file may either be a file on disk or a virtual file. - * - * Do not rely on the identity of instances of this class. - * - * User code should not implement this interface, but it may have to - * manipulate objects of this type. - */ -public interface AbstractFile { - /** @return The name of this file, note that two files may have the same name. */ - String name(); - - /** @return The path of this file, this might be a virtual path of an unspecified format. */ - String path(); - - /** @return If this is a real file on disk, a `java.io.File` that corresponds to this file. - * Otherwise, an empty `Optional`. - */ - Optional jfile(); -} diff --git a/interfaces/src/main/java/dotty/tools/dotc/interfaces/CompilerCallback.java b/interfaces/src/main/java/dotty/tools/dotc/interfaces/CompilerCallback.java deleted file mode 100644 index 25696f740..000000000 --- a/interfaces/src/main/java/dotty/tools/dotc/interfaces/CompilerCallback.java +++ /dev/null @@ -1,28 +0,0 @@ -package dotty.tools.dotc.interfaces; - -/** Set of callbacks called in response to events during the compilation process. - * - * You should implement this interface if you want to react to one or more of - * these events. - * - * See the method `process` of `dotty.tools.dotc.Driver` for more information. - */ -public interface CompilerCallback { - /** Called when a class has been generated. - * - * @param source The source file corresponding to this class. - * Example: ./src/library/scala/collection/Seq.scala - * @param generatedClass The generated classfile for this class. - * Example: ./scala/collection/Seq$.class - * @param className The name of this class. - * Example: scala.collection.Seq$ - */ - default void onClassGenerated(SourceFile source, AbstractFile generatedClass, String className) {}; - - /** Called when every class for this file has been generated. - * - * @param source The source file. - * Example: ./src/library/scala/collection/Seq.scala - */ - default void onSourceCompiled(SourceFile source) {}; -} diff --git a/interfaces/src/main/java/dotty/tools/dotc/interfaces/Diagnostic.java b/interfaces/src/main/java/dotty/tools/dotc/interfaces/Diagnostic.java deleted file mode 100644 index c46360afa..000000000 --- a/interfaces/src/main/java/dotty/tools/dotc/interfaces/Diagnostic.java +++ /dev/null @@ -1,26 +0,0 @@ -package dotty.tools.dotc.interfaces; - -import java.util.Optional; - -/** A diagnostic is a message emitted during the compilation process. - * - * It can either be an error, a warning or an information. - * - * User code should not implement this interface, but it may have to - * manipulate objects of this type. - */ -public interface Diagnostic { - public static final int ERROR = 2; - public static final int WARNING = 1; - public static final int INFO = 0; - - /** @return The message to report */ - String message(); - - /** @return Level of the diagnostic, can be either ERROR, WARNING or INFO */ - int level(); - - /** @return The position in a source file of the code that caused this diagnostic - * to be emitted. */ - Optional position(); -} diff --git a/interfaces/src/main/java/dotty/tools/dotc/interfaces/ReporterResult.java b/interfaces/src/main/java/dotty/tools/dotc/interfaces/ReporterResult.java deleted file mode 100644 index f75519db2..000000000 --- a/interfaces/src/main/java/dotty/tools/dotc/interfaces/ReporterResult.java +++ /dev/null @@ -1,18 +0,0 @@ -package dotty.tools.dotc.interfaces; - -/** Summary of the diagnostics emitted by a Reporter. - * - * User code should not implement this interface, but it may have to - * manipulate objects of this type. - */ -public interface ReporterResult { - /** @return Have we emitted any error? */ - boolean hasErrors(); - /** @return Number of errors that have been emitted */ - int errorCount(); - - /** @return Have we emitted any warning ? */ - boolean hasWarnings(); - /** @return Number of warnings that have been emitted */ - int warningCount(); -} diff --git a/interfaces/src/main/java/dotty/tools/dotc/interfaces/SimpleReporter.java b/interfaces/src/main/java/dotty/tools/dotc/interfaces/SimpleReporter.java deleted file mode 100644 index f4c80c0cf..000000000 --- a/interfaces/src/main/java/dotty/tools/dotc/interfaces/SimpleReporter.java +++ /dev/null @@ -1,15 +0,0 @@ -package dotty.tools.dotc.interfaces; - -/** Report errors, warnings and info messages during the compilation process - * - * You should implement this interface if you want to handle the diagnostics - * returned by the compiler yourself. - * - * See the method `process` of `dotty.tools.dotc.Driver` for more information. - */ -public interface SimpleReporter { - /** Report a diagnostic. - * @param diag the diagnostic message to report - */ - void report(Diagnostic diag); -} diff --git a/interfaces/src/main/java/dotty/tools/dotc/interfaces/SourceFile.java b/interfaces/src/main/java/dotty/tools/dotc/interfaces/SourceFile.java deleted file mode 100644 index 6c72a5125..000000000 --- a/interfaces/src/main/java/dotty/tools/dotc/interfaces/SourceFile.java +++ /dev/null @@ -1,11 +0,0 @@ -package dotty.tools.dotc.interfaces; - -/** A source file. - * - * User code should not implement this interface, but it may have to - * manipulate objects of this type. - */ -public interface SourceFile extends AbstractFile { - /** @return The content of this file as seen by the compiler. */ - char[] content(); -} diff --git a/interfaces/src/main/java/dotty/tools/dotc/interfaces/SourcePosition.java b/interfaces/src/main/java/dotty/tools/dotc/interfaces/SourcePosition.java deleted file mode 100644 index d8afbf5f6..000000000 --- a/interfaces/src/main/java/dotty/tools/dotc/interfaces/SourcePosition.java +++ /dev/null @@ -1,45 +0,0 @@ -package dotty.tools.dotc.interfaces; - -/** A position in a source file. - * - * A position is a range between a start offset and an end offset, as well as a - * point inside this range. - * - * As a convenience, we also provide methods that return the line and the column - * corresponding to each offset. - * - * User code should not implement this interface, but it may have to - * manipulate objects of this type. - */ -public interface SourcePosition { - /** @return Content of the line which contains the point */ - String lineContent(); - - /** @return Offset to the point */ - int point(); - /** @return Line number of the point, starting at 0 */ - int line(); - /** @return Column number of the point, starting at 0 */ - int column(); - - /** @return Offset to the range start */ - int start(); - /** @return Line number of the range start, starting at 0 */ - int startLine(); - /** @return Column number of the range start, starting at 0 */ - int startColumn(); - - /** @return Offset to the range end */ - int end(); - /** @return Line number of the range end, starting at 0 */ - int endLine(); - /** @return Column number of the range end, starting at 0 */ - int endColumn(); - - /** The source file corresponding to this position. - * The values returned by `point()`, `start()` and `end()` - * are indices in the array returned by `source().content()`. - * @return source file for this position - */ - SourceFile source(); -} -- cgit v1.2.3