From c871fe4d2ed97830868f3b8f5a96d3d3d49be0c1 Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Tue, 26 Nov 2024 14:31:10 +0100 Subject: [PATCH 1/4] LogError doesn't have MessageImportance --- src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs index 259b27dd0..fd83ff806 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs @@ -54,10 +54,10 @@ public async ValueTask ReceiveAsync(IkvmToolDiagnosticEvent @event, Cancellation logger.LogWarning(null, $"{@event.Id:D4}", null, null, @event.Location.StartLine, @event.Location.StartColumn, @event.Location.EndLine, @event.Location.EndColumn, @event.Message, @event.Args); break; case IkvmToolDiagnosticEventLevel.Error: - logger.LogError(null, $"{@event.Id:D4}", null, null, @event.Location.StartLine, @event.Location.StartColumn, @event.Location.EndLine, @event.Location.EndColumn, MessageImportance.Normal, @event.Message, @event.Args); + logger.LogError(null, $"{@event.Id:D4}", null, null, @event.Location.StartLine, @event.Location.StartColumn, @event.Location.EndLine, @event.Location.EndColumn, @event.Message, @event.Args); break; case IkvmToolDiagnosticEventLevel.Fatal: - logger.LogError(null, $"{@event.Id:D4}", null, null, @event.Location.StartLine, @event.Location.StartColumn, @event.Location.EndLine, @event.Location.EndColumn, MessageImportance.High, @event.Message, @event.Args); + logger.LogError(null, $"{@event.Id:D4}", null, null, @event.Location.StartLine, @event.Location.StartColumn, @event.Location.EndLine, @event.Location.EndColumn, @event.Message, @event.Args); break; } From 9179ddb90e1473ef35ca6d69362198937ff3d3db Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Wed, 27 Nov 2024 10:59:29 +0100 Subject: [PATCH 2/4] Fix bad formatted keys in SuppressWarnings set --- src/IKVM.Tools.Importer/ImportContext.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/IKVM.Tools.Importer/ImportContext.cs b/src/IKVM.Tools.Importer/ImportContext.cs index d0a2a78d5..7341ba770 100644 --- a/src/IKVM.Tools.Importer/ImportContext.cs +++ b/src/IKVM.Tools.Importer/ImportContext.cs @@ -569,7 +569,7 @@ void ContinueParseCommandLine(RuntimeContext context, StaticCompiler compiler, I if (options.NoWarn != null) foreach (var diagnostic in options.NoWarn) - compilerOptions.suppressWarnings.Add($"IKVM{diagnostic.Id:D4}"); + compilerOptions.suppressWarnings.Add(diagnostic.Id.ToString()); // TODO handle specific diagnostic IDs if (options.WarnAsError != null) @@ -578,7 +578,7 @@ void ContinueParseCommandLine(RuntimeContext context, StaticCompiler compiler, I compilerOptions.warnaserror = true; else foreach (var i in options.WarnAsError) - compilerOptions.errorWarnings.Add($"IKVM{i.Id:D4}"); + compilerOptions.errorWarnings.Add(i.Id.ToString()); } if (options.Runtime != null) From 8824ffd9bccaee79d4ddf0fd40f40d8b81ecd803 Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Wed, 27 Nov 2024 12:56:18 +0100 Subject: [PATCH 3/4] No MSBuild Error, when previous Warning has been ignored --- src/IKVM.Runtime/compiler.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/IKVM.Runtime/compiler.cs b/src/IKVM.Runtime/compiler.cs index 9efe8b734..c815f8ef3 100644 --- a/src/IKVM.Runtime/compiler.cs +++ b/src/IKVM.Runtime/compiler.cs @@ -2565,7 +2565,6 @@ void Compile(Block block, int startIndex) } var message = harderrors[instr.HardErrorMessageId]; - clazz.ClassLoader.Diagnostics.GenericCompilerError($"{exceptionType.Name}: {message}\n\tat {classFile.Name}.{m.Name}{m.Signature}"); ilGenerator.Emit(OpCodes.Ldstr, message); RuntimeJavaMethod method = exceptionType.GetMethodWrapper("", "(Ljava.lang.String;)V", false); method.Link(); From 05c39eb2cd1691638099b73a6992a0598451c413 Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Thu, 28 Nov 2024 11:01:39 +0100 Subject: [PATCH 4/4] Log HardError diagnostics during Runtime --- src/IKVM.Runtime/MethodAnalyzer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/IKVM.Runtime/MethodAnalyzer.cs b/src/IKVM.Runtime/MethodAnalyzer.cs index b6a1652c0..778974301 100644 --- a/src/IKVM.Runtime/MethodAnalyzer.cs +++ b/src/IKVM.Runtime/MethodAnalyzer.cs @@ -2485,7 +2485,7 @@ private void ConditionalPatchNoClassDefFoundError(ref ClassFile.Method.Instructi private void SetHardError(RuntimeClassLoader classLoader, ref ClassFile.Method.Instruction instruction, HardError hardError, string message, params object[] args) { string text = string.Format(message, args); -#if IMPORTER + switch (hardError) { case HardError.NoClassDefFoundError: @@ -2518,7 +2518,7 @@ private void SetHardError(RuntimeClassLoader classLoader, ref ClassFile.Method.I default: throw new InvalidOperationException(); } -#endif + instruction.SetHardError(hardError, AllocErrorMessage(text)); }