Skip to content

Commit 95c9b79

Browse files
authored
[generator] Avoid 'error (…):' construct in diagnostic messages (#851)
Context: #850 When a parsing issue is hit when importing Javadoc info, an "error" is printed out like this: Error (31:41): Syntax error, expected: #PCDATA, <tt>, <TT>, <i>, <I>, {@code, {@docroot}, {@inheritdoc}, {@link, {@linkplain, {@literal, {@value}, {@value, UnknownHtmlElementStart, </tt>, </TT>, </i>, </I>, </p>, </P>, <p>, <P>, <pre>, <PRE>, @author, @apiSince, @deprecated, @deprecatedSince, @exception, @param, @return, @see, @Serialdata, @serialField, @SInCE, @throws, @[unknown], @Version {@link #getCurrentTrackSelections()}}.</li> This is intended to be informational, but this output format triggers the MSBuild error parsing regex, and is interpreted as an actual error, causing the build to fail. Avoid the error by prepending `JavadocImport-` to the `LogMessage.Level` enum value, so that MSBuild doesn't interpret the string as an error and the build can successfully complete: JavadocImport-Error (31:41): Syntax error, expected: #PCDATA, <tt>, <TT>, <i>, <I>, {@code, {@docroot}, {@inheritdoc}, {@link, {@linkplain, {@literal, {@value}, {@value, UnknownHtmlElementStart, </tt>, </TT>, </i>, </I>, </p>, </P>, <p>, <P>, <pre>, <PRE>, @author, @apiSince, @deprecated, @deprecatedSince, @exception, @param, @return, @see, @Serialdata, @serialField, @SInCE, @throws, @[unknown], @Version {@link #getCurrentTrackSelections()}}.</li>
1 parent 7c4f7db commit 95c9b79

File tree

1 file changed

+1
-1
lines changed
  • tools/generator/Java.Interop.Tools.Generator.ObjectModel

1 file changed

+1
-1
lines changed

tools/generator/Java.Interop.Tools.Generator.ObjectModel/JavadocInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static void PrintMessages (ParseTree tree, TextWriter writer)
186186
{
187187
var lines = GetLines (tree.SourceText);
188188
foreach (var m in tree.ParserMessages) {
189-
writer.WriteLine ($"{m.Level} {m.Location}: {m.Message}");
189+
writer.WriteLine ($"JavadocImport-{m.Level} {m.Location}: {m.Message}");
190190
writer.WriteLine (lines [m.Location.Line]);
191191
writer.Write (new string (' ', m.Location.Column));
192192
writer.WriteLine ("^");

0 commit comments

Comments
 (0)