Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into jdktool
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Oct 30, 2023
2 parents 7e5a747 + e4ff205 commit 61d1d4f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
18 changes: 9 additions & 9 deletions doc/legacy/tools/ikvmc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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);
Expand All @@ -25,7 +25,7 @@ public override int GetSize()
{
var length = 0;
length += sizeof(ushort);
length += sizeof(ushort);
length += sizeof(byte);
return length;
}

Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/IKVM.MSBuild.Tasks/IkvmReferenceItemPrepare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -456,7 +456,7 @@ static Version ToAssemblyVersion(ModuleVersion version)
/// <returns></returns>
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;
}

/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions src/IKVM.Tools.Importer/StaticCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/ikvmc/ikvmc.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0;net472</TargetFrameworks>
<RuntimeIdentifiers>$(_SupportedToolRuntimes)</RuntimeIdentifiers>
</PropertyGroup>

Expand Down

0 comments on commit 61d1d4f

Please sign in to comment.