diff --git a/doc/legacy/tools/ikvmc.md b/doc/legacy/tools/ikvmc.md index 68056cd23e..15b1e29bbd 100644 --- a/doc/legacy/tools/ikvmc.md +++ b/doc/legacy/tools/ikvmc.md @@ -4,14 +4,14 @@ The `ikvmc` tool converts Java bytecode to .NET DLL and EXE files. -- [Usage](#usage) -- [Options](#options) -- [Notes](#notes) -- [Examples](#examples) - - [Single jar file](#single-jar-file) - - [jar file and class files to a single exe](#jar-file-and-class-files-to-a-single-exe) - - [jar file to dll and class files to an exe](#jar-file-to-dll-and-class-files-to-an-exe) -- [Warnings](#warnings) +- [Usage] +- [Options] +- [Notes] +- [Examples] + - [Single jar file] + - [jar file and class files to a single exe] + - [jar file to dll and class files to an exe] +- [Warnings] ## Usage @@ -146,7 +146,7 @@ When processing multiple input `.jar` files that contain duplicate classes / res - When converting a Java application with `ikvmc`, for best results, list the `.jar`s on the `ikvmc` command line in the same order that they appear in the Java application's classpath. See also the concepts of [ClassLoader](../class-loader.md). -- [ikvmc messages](ikvmc-messages.md) +- [ikvmc messages] ## Examples diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationTypeArgumentTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationTypeArgumentTargetRecord.cs index 69eb461987..bc0f3453b0 100644 --- a/src/IKVM.ByteCode/Parsing/TypeAnnotationTypeArgumentTargetRecord.cs +++ b/src/IKVM.ByteCode/Parsing/TypeAnnotationTypeArgumentTargetRecord.cs @@ -1,7 +1,7 @@ namespace IKVM.ByteCode.Parsing { - internal sealed record TypeAnnotationTypeArgumentTargetRecord(ushort Offset, ushort TypeArgumentIndex) : TypeAnnotationTargetRecord + internal sealed record TypeAnnotationTypeArgumentTargetRecord(ushort Offset, byte TypeArgumentIndex) : TypeAnnotationTargetRecord { public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo) @@ -10,7 +10,7 @@ public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTarge if (reader.TryReadU2(out ushort offset) == false) return false; - if (reader.TryReadU2(out ushort typeArgumentIndex) == false) + if (reader.TryReadU1(out byte typeArgumentIndex) == false) return false; targetInfo = new TypeAnnotationTypeArgumentTargetRecord(offset, typeArgumentIndex); @@ -25,7 +25,7 @@ public override int GetSize() { var length = 0; length += sizeof(ushort); - length += sizeof(ushort); + length += sizeof(byte); return length; } @@ -38,7 +38,7 @@ public override bool TryWrite(ref ClassFormatWriter writer) { if (writer.TryWriteU2(Offset) == false) return false; - if (writer.TryWriteU2(TypeArgumentIndex) == false) + if (writer.TryWriteU1(TypeArgumentIndex) == false) return false; return true; diff --git a/src/IKVM.MSBuild.Tasks/IkvmReferenceItemPrepare.cs b/src/IKVM.MSBuild.Tasks/IkvmReferenceItemPrepare.cs index 448dd6a617..2fedec3e22 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmReferenceItemPrepare.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmReferenceItemPrepare.cs @@ -442,8 +442,8 @@ static Version ToAssemblyVersion(ModuleVersion version) // only include major and minor by default var major = GetAssemblyVersionComponent(version, 0); var minor = GetAssemblyVersionComponent(version, 1); - if (minor is not null && major is not null) - return new Version(major ?? 0, minor ?? 0, 0, 0); + if (major is not null) + return new Version((int)major, minor ?? 0, 0, 0); return null; } @@ -456,7 +456,7 @@ static Version ToAssemblyVersion(ModuleVersion version) /// static int? GetAssemblyVersionComponent(ModuleVersion version, int index) { - return version.Number.Count > index && version.Number[index] is int i ? i : null; + return version.Number.Count > index && version.Number[index] is int i ? Math.Min(i, ushort.MaxValue) : null; } /// diff --git a/src/IKVM.Tools.Importer/StaticCompiler.cs b/src/IKVM.Tools.Importer/StaticCompiler.cs index f999c12450..5ac4b49161 100644 --- a/src/IKVM.Tools.Importer/StaticCompiler.cs +++ b/src/IKVM.Tools.Importer/StaticCompiler.cs @@ -25,12 +25,9 @@ Jeroen Frijters using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Diagnostics; using System.IO; -using System.IO.Pipelines; using System.Reflection.Metadata; using System.Reflection.PortableExecutable; -using System.Security.Cryptography.Xml; using IKVM.Reflection; using IKVM.Runtime; @@ -223,7 +220,7 @@ internal void SuppressWarning(CompilerOptions options, Message message, string n internal void IssueMessage(Message msgId, params string[] values) { - IssueMessage(msgId, values); + IssueMessage(rootTarget, msgId, values); } internal void IssueMessage(CompilerOptions options, Message msgId, params string[] values) diff --git a/src/ikvmc/ikvmc.csproj b/src/ikvmc/ikvmc.csproj index 549ed8f260..97087a3833 100644 --- a/src/ikvmc/ikvmc.csproj +++ b/src/ikvmc/ikvmc.csproj @@ -1,7 +1,7 @@  Exe - net472;net6.0 + net6.0;net472 $(_SupportedToolRuntimes)