Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/IKVM.ByteCode/ClassFormatVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public record struct ClassFormatVersion(ushort Major, ushort Minor) : IComparabl
/// <summary>Java 25 (class file 69.0)</summary>
public static readonly ClassFormatVersion Java25 = new(69, 0);

/// <summary>The latest class file format version supported by this library.</summary>
public static readonly ClassFormatVersion Latest = Java25;

/// <summary>
/// Implicitly converts a major version number to a <see cref="ClassFormatVersion"/> with a minor version of <c>0</c>.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/IKVM.ByteCode/Decoding/ClassFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static bool TryMeasure(ref ClassFormatReader reader, ref int size)
if (reader.TryReadU2(out ushort majorVersion) == false)
return false;

if (majorVersion > 63)
if (majorVersion > ClassFormatVersion.Latest.Major)
throw new UnsupportedClassVersionException(new ClassFormatVersion(majorVersion, minorVersion));

if (ConstantTable.TryMeasure(ref reader, ref size) == false)
Expand Down Expand Up @@ -252,7 +252,7 @@ public static bool TryRead(ref ClassFormatReader reader, out ClassFile? clazz, I
if (reader.TryReadU2(out ushort majorVersion) == false)
return false;

if (majorVersion > 63)
if (majorVersion > ClassFormatVersion.Latest.Major)
throw new UnsupportedClassVersionException(new ClassFormatVersion(majorVersion, minorVersion));

var version = new ClassFormatVersion(majorVersion, minorVersion);
Expand Down
Loading