blackdrag commented on code in PR #2841:
URL: https://github.com/apache/groovy/pull/2841#discussion_r3884925854
##########
src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java:
##########
@@ -212,6 +213,7 @@ public static void commandLineCompile(String[] args,
boolean lookupUnnamedFiles)
*/
public static CommandLine configureParser(CompilationOptions options) {
CommandLine parser = new CommandLine(options);
+ parser.setCaseInsensitiveEnumValuesAllowed(true); // GROOVY-12312:
--error-format=short
Review Comment:
This looks like it does not belong in this PR really.
##########
src/main/java/org/codehaus/groovy/control/messages/Message.java:
##########
@@ -58,10 +60,54 @@ public static Message create(final SyntaxException error,
final SourceUnit owner
*/
public abstract void write(PrintWriter writer, Janitor janitor);
+ /**
+ * Writes this message to the specified {@link PrintWriter} in the
requested format.
+ * The default implementation ignores the format; subclasses which can
render a
+ * {@link ErrorFormat#SHORT} form override this (GROOVY-12312).
+ *
+ * @param writer the destination writer
+ * @param janitor the cleanup helper for temporary source access
+ * @param format how the message should be rendered
+ * @since 6.0.0
+ */
+ public void write(final PrintWriter writer, final Janitor janitor, final
ErrorFormat format) {
+ write(writer, janitor);
+ }
+
/**
* Writes this message to the specified {@link PrintWriter}.
*/
public final void write(final PrintWriter writer) {
write(writer, null);
}
+
+
//--------------------------------------------------------------------------
+
+ /**
+ * Renders one diagnostic as a single {@code file:line:column: severity:
message} line.
+ * Absent parts are dropped rather than guessed: a message with no source
unit omits the
+ * file, and one with no position omits the line and column.
+ */
+ static void writeShort(final PrintWriter writer, final String name, final
int line,
Review Comment:
Can we add the new API in a way that preserves the existing Message.write()
contract but keeps output-format-specific logic outside the message hierarchy?
Because next we may add a json output format to let AI read it better or a
different format I can not think of right now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]