From 8d420f8e53a7b8803955c827b2f7f5e813be34bb Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sat, 18 Jan 2025 13:14:48 -0600 Subject: [PATCH] Bunch of formatting. Add in a ClassFileParseOption for StaticImport so we can start cutting down on the ifdefs. --- src/IKVM.Runtime/ClassFile.BootstrapMethod.cs | 14 ++--- src/IKVM.Runtime/ClassFile.Constant.cs | 51 ----------------- .../ClassFile.ConstantPoolItemClass.cs | 55 +++++++------------ .../ClassFile.ConstantPoolItemDouble.cs | 1 + .../ClassFile.ConstantPoolItemFMI.cs | 32 +++-------- .../ClassFile.ConstantPoolItemFieldref.cs | 16 +++--- ...File.ConstantPoolItemInterfaceMethodref.cs | 9 ++- ...ClassFile.ConstantPoolItemInvokeDynamic.cs | 22 ++------ .../ClassFile.ConstantPoolItemLiveObject.cs | 1 + .../ClassFile.ConstantPoolItemMI.cs | 17 +++--- .../ClassFile.ConstantPoolItemMethodHandle.cs | 35 +++--------- .../ClassFile.ConstantPoolItemMethodType.cs | 24 ++------ .../ClassFile.ConstantPoolItemUtf8.cs | 1 + src/IKVM.Runtime/ClassFile.ConstantType.cs | 4 ++ src/IKVM.Runtime/ClassFile.InnerClass.cs | 2 + src/IKVM.Runtime/ClassFile.Method.cs | 1 - src/IKVM.Runtime/ClassFileParseOptions.cs | 1 + src/IKVM.Runtime/RuntimeClassLoader.cs | 2 +- src/IKVM.Tools.Importer/ImportClassLoader.cs | 4 +- src/IKVM.Tools.Importer/ImportContext.cs | 4 +- 20 files changed, 80 insertions(+), 216 deletions(-) delete mode 100644 src/IKVM.Runtime/ClassFile.Constant.cs diff --git a/src/IKVM.Runtime/ClassFile.BootstrapMethod.cs b/src/IKVM.Runtime/ClassFile.BootstrapMethod.cs index 5690a2cd1b..066a595d15 100644 --- a/src/IKVM.Runtime/ClassFile.BootstrapMethod.cs +++ b/src/IKVM.Runtime/ClassFile.BootstrapMethod.cs @@ -33,8 +33,8 @@ sealed partial class ClassFile internal struct BootstrapMethod { - private MethodHandleConstantHandle method; - private ConstantHandle[] args; + MethodHandleConstantHandle method; + ConstantHandle[] args; internal BootstrapMethod(MethodHandleConstantHandle method, ConstantHandle[] args) { @@ -42,15 +42,9 @@ internal BootstrapMethod(MethodHandleConstantHandle method, ConstantHandle[] arg this.args = args; } - internal MethodHandleConstantHandle BootstrapMethodIndex - { - get { return method; } - } + internal MethodHandleConstantHandle BootstrapMethodIndex => method; - internal int ArgumentCount - { - get { return args.Length; } - } + internal int ArgumentCount => args.Length; internal ConstantHandle GetArgument(int index) { diff --git a/src/IKVM.Runtime/ClassFile.Constant.cs b/src/IKVM.Runtime/ClassFile.Constant.cs deleted file mode 100644 index 24b31f28eb..0000000000 --- a/src/IKVM.Runtime/ClassFile.Constant.cs +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2002-2015 Jeroen Frijters - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jeroen Frijters - jeroen@frijters.net - -*/ - -namespace IKVM.Runtime -{ - - sealed partial class ClassFile - { - - internal enum Constant - { - Utf8 = 1, - Integer = 3, - Float = 4, - Long = 5, - Double = 6, - Class = 7, - String = 8, - Fieldref = 9, - Methodref = 10, - InterfaceMethodref = 11, - NameAndType = 12, - MethodHandle = 15, - MethodType = 16, - InvokeDynamic = 18, - } - - } - -} diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemClass.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemClass.cs index b7a207aed1..43591a6660 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemClass.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemClass.cs @@ -81,36 +81,33 @@ internal override void Resolve(ClassFile classFile, string[] utf8_cp, ClassFileP #if !IMPORTER if (classFile.MajorVersion < 49 && (options & ClassFileParseOptions.RelaxedClassNameValidation) == 0) { - char prev = name[0]; - if (Char.IsLetter(prev) || prev == '$' || prev == '_' || prev == '[' || prev == '/') + var prev = name[0]; + if (char.IsLetter(prev) || prev == '$' || prev == '_' || prev == '[' || prev == '/') { int skip = 1; int end = name.Length; if (prev == '[') { if (!IsValidFieldSig(name)) - { - goto barf; - } + throw new ClassFormatError("Invalid class name \"{0}\"", name); + while (name[skip] == '[') - { skip++; - } + if (name.EndsWith(";")) - { end--; - } } + for (int i = skip; i < end; i++) { - char c = name[i]; - if (!Char.IsLetterOrDigit(c) && c != '$' && c != '_' && (c != '/' || prev == '/')) - { - goto barf; - } + var c = name[i]; + if (!char.IsLetterOrDigit(c) && c != '$' && c != '_' && (c != '/' || prev == '/')) + throw new ClassFormatError("Invalid class name \"{0}\"", name); + prev = c; } - name = String.Intern(name.Replace('/', '.')); + + name = string.Intern(name.Replace('/', '.')); return; } } @@ -123,34 +120,26 @@ internal override void Resolve(ClassFile classFile, string[] utf8_cp, ClassFileP if (name[0] == '[') { if (!IsValidFieldSig(name)) - { - goto barf; - } + throw new ClassFormatError("Invalid class name \"{0}\"", name); + // the semicolon is only allowed at the end and IsValidFieldSig enforces this, // but since invalidJava15Characters contains the semicolon, we decrement end // to make the following check against invalidJava15Characters ignore the // trailing semicolon. if (name[end - 1] == ';') - { end--; - } + while (name[start] == '[') - { start++; - } } if (name.IndexOfAny(invalidJava15Characters, start, end - start) >= 0) - { - goto barf; - } + throw new ClassFormatError("Invalid class name \"{0}\"", name); name = string.Intern(name.Replace('/', '.')); return; } } - barf: - throw new ClassFormatError("Invalid class name \"{0}\"", name); } internal override void MarkLinkRequired() @@ -168,7 +157,8 @@ internal override void Link(RuntimeJavaType thisType, LoadMode mode) if (typeWrapper == Context.VerifierJavaTypeFactory.Null) { var tw = thisType.ClassLoader.LoadClass(name, mode | LoadMode.WarnClassNotFound); -#if !IMPORTER && !FIRST_PASS + +#if IMPORTER == false && FIRST_PASS == false if (!tw.IsUnloadable) { try @@ -181,17 +171,12 @@ internal override void Link(RuntimeJavaType thisType, LoadMode mode) } } #endif + typeWrapper = tw; } } - internal string Name - { - get - { - return name; - } - } + internal string Name => name; internal RuntimeJavaType GetClassType() { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemDouble.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemDouble.cs index 97c86ccaa6..b8ccb588f2 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemDouble.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemDouble.cs @@ -24,6 +24,7 @@ Jeroen Frijters using System; +using IKVM.ByteCode; using IKVM.ByteCode.Decoding; namespace IKVM.Runtime diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemFMI.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemFMI.cs index fea72e0112..54ca42319f 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemFMI.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemFMI.cs @@ -61,14 +61,12 @@ internal override void Resolve(ClassFile classFile, string[] utf8_cp, ClassFileP clazz = (ConstantPoolItemClass)classFile.GetConstantPoolItem(clazzHandle); // if the constant pool items referred to were strings, GetConstantPoolItem returns null if (name_and_type == null || clazz == null) - { throw new ClassFormatError("Bad index in constant pool"); - } - name = String.Intern(classFile.GetConstantPoolUtf8String(utf8_cp, name_and_type.NameHandle)); + name = string.Intern(classFile.GetConstantPoolUtf8String(utf8_cp, name_and_type.NameHandle)); descriptor = classFile.GetConstantPoolUtf8String(utf8_cp, name_and_type.DescriptorHandle); Validate(name, descriptor, classFile.MajorVersion); - descriptor = String.Intern(descriptor.Replace('/', '.')); + descriptor = string.Intern(descriptor.Replace('/', '.')); } protected abstract void Validate(string name, string descriptor, int majorVersion); @@ -83,29 +81,11 @@ internal override void Link(RuntimeJavaType thisType, LoadMode mode) clazz.Link(thisType, mode); } - internal string Name - { - get - { - return name; - } - } + internal string Name => name; - internal string Signature - { - get - { - return descriptor; - } - } + internal string Signature => descriptor; - internal string Class - { - get - { - return clazz.Name; - } - } + internal string Class => clazz.Name; internal RuntimeJavaType GetClassType() { @@ -113,7 +93,9 @@ internal RuntimeJavaType GetClassType() } internal abstract RuntimeJavaMember GetMember(); + } + } } diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemFieldref.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemFieldref.cs index 4a52b5cf7c..0095405393 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemFieldref.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemFieldref.cs @@ -67,18 +67,14 @@ internal override void Link(RuntimeJavaType thisType, LoadMode mode) { base.Link(thisType, mode); lock (this) - { if (fieldTypeWrapper != null) - { return; - } - } + RuntimeJavaField fw = null; - RuntimeJavaType wrapper = GetClassType(); + var wrapper = GetClassType(); if (wrapper == null) - { return; - } + if (!wrapper.IsUnloadable) { fw = wrapper.GetFieldWrapper(Name, Signature); @@ -87,8 +83,10 @@ internal override void Link(RuntimeJavaType thisType, LoadMode mode) fw.Link(mode); } } - RuntimeClassLoader classLoader = thisType.ClassLoader; - RuntimeJavaType fld = classLoader.FieldTypeWrapperFromSig(this.Signature, mode); + + var classLoader = thisType.ClassLoader; + var fld = classLoader.FieldTypeWrapperFromSig(this.Signature, mode); + lock (this) { if (fieldTypeWrapper == null) diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemInterfaceMethodref.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemInterfaceMethodref.cs index aea2883701..b4b5eeea66 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemInterfaceMethodref.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemInterfaceMethodref.cs @@ -47,22 +47,21 @@ internal ConstantPoolItemInterfaceMethodref(RuntimeContext context, InterfaceMet internal override void Link(RuntimeJavaType thisType, LoadMode mode) { base.Link(thisType, mode); - RuntimeJavaType wrapper = GetClassType(); + + var wrapper = GetClassType(); if (wrapper != null) { if (!wrapper.IsUnloadable) - { method = wrapper.GetInterfaceMethod(Name, Signature); - } + if (method == null) { // NOTE vmspec 5.4.3.4 clearly states that an interfacemethod may also refer to a method in Object method = thisType.Context.JavaBase.TypeOfJavaLangObject.GetMethodWrapper(Name, Signature, false); } + if (method != null) - { method.Link(mode); - } } } diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemInvokeDynamic.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemInvokeDynamic.cs index 0da5ef78a1..1f977bda87 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemInvokeDynamic.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemInvokeDynamic.cs @@ -21,8 +21,6 @@ Jeroen Frijters jeroen@frijters.net */ -using System; - using IKVM.ByteCode; using IKVM.ByteCode.Decoding; @@ -31,6 +29,7 @@ namespace IKVM.Runtime sealed partial class ClassFile { + internal sealed class ConstantPoolItemInvokeDynamic : ConstantPoolItem { @@ -67,12 +66,8 @@ internal override void Resolve(ClassFile classFile, string[] utf8_cp, ClassFileP internal override void Link(RuntimeJavaType thisType, LoadMode mode) { lock (this) - { if (argTypeWrappers != null) - { return; - } - } var classLoader = thisType.ClassLoader; var args = classLoader.ArgJavaTypeListFromSig(descriptor, mode); @@ -98,20 +93,11 @@ internal RuntimeJavaType GetRetType() return retTypeWrapper; } - internal string Name - { - get { return name; } - } + internal string Name => name; - internal string Signature - { - get { return descriptor; } - } + internal string Signature => descriptor; - internal ushort BootstrapMethod - { - get { return bootstrapMethodAttributeIndex; } - } + internal ushort BootstrapMethod => bootstrapMethodAttributeIndex; } diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemLiveObject.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemLiveObject.cs index f35da8d0bd..2697005b97 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemLiveObject.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemLiveObject.cs @@ -45,6 +45,7 @@ internal override ConstantType GetConstantType() { return ConstantType.LiveObject; } + } } diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMI.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMI.cs index fa8b36218f..b3c500743e 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMI.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMI.cs @@ -53,19 +53,15 @@ internal ConstantPoolItemMI(RuntimeContext context, ClassConstantHandle clazz, N protected override void Validate(string name, string descriptor, int majorVersion) { if (!IsValidMethodSig(descriptor)) - { throw new ClassFormatError("Method {0} has invalid signature {1}", name, descriptor); - } + if (!IsValidMethodName(name, new ClassFormatVersion((ushort)majorVersion, 0))) { if (!ReferenceEquals(name, StringConstants.INIT)) - { throw new ClassFormatError("Invalid method name \"{0}\"", name); - } + if (!descriptor.EndsWith("V")) - { throw new ClassFormatError("Method {0} has invalid signature {1}", name, descriptor); - } } } @@ -79,9 +75,10 @@ internal override void Link(RuntimeJavaType thisType, LoadMode mode) return; } } - RuntimeClassLoader classLoader = thisType.ClassLoader; - RuntimeJavaType[] args = classLoader.ArgJavaTypeListFromSig(this.Signature, mode); - RuntimeJavaType ret = classLoader.RetTypeWrapperFromSig(this.Signature, mode); + + var classLoader = thisType.ClassLoader; + var args = classLoader.ArgJavaTypeListFromSig(this.Signature, mode); + var ret = classLoader.RetTypeWrapperFromSig(this.Signature, mode); lock (this) { if (argTypeWrappers == null) @@ -116,7 +113,9 @@ internal override RuntimeJavaMember GetMember() { return method; } + } + } } diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodHandle.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodHandle.cs index 6a0fb79437..76b262b039 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodHandle.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodHandle.cs @@ -85,35 +85,17 @@ internal override void MarkLinkRequired() cpi.MarkLinkRequired(); } - internal string Class - { - get { return cpi.Class; } - } + internal string Class => cpi.Class; - internal string Name - { - get { return cpi.Name; } - } + internal string Name => cpi.Name; - internal string Signature - { - get { return cpi.Signature; } - } + internal string Signature => cpi.Signature; - internal ConstantPoolItemFMI MemberConstantPoolItem - { - get { return cpi; } - } + internal ConstantPoolItemFMI MemberConstantPoolItem => cpi; - internal MethodHandleKind Kind - { - get { return data.Kind; } - } + internal MethodHandleKind Kind => data.Kind; - internal RuntimeJavaMember Member - { - get { return cpi.GetMember(); } - } + internal RuntimeJavaMember Member => cpi.GetMember(); internal RuntimeJavaType GetClassType() { @@ -125,10 +107,7 @@ internal override void Link(RuntimeJavaType thisType, LoadMode mode) cpi.Link(thisType, mode); } - internal override ConstantType GetConstantType() - { - return ConstantType.MethodHandle; - } + internal override ConstantType GetConstantType() => ConstantType.MethodHandle; } diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodType.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodType.cs index edf4cee7cf..8786287eaf 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodType.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodType.cs @@ -62,12 +62,8 @@ internal override void Resolve(ClassFile classFile, string[] utf8_cp, ClassFileP internal override void Link(RuntimeJavaType thisType, LoadMode mode) { lock (this) - { if (argTypeWrappers != null) - { return; - } - } var classLoader = thisType.ClassLoader; var args = classLoader.ArgJavaTypeListFromSig(descriptor, mode); @@ -83,25 +79,13 @@ internal override void Link(RuntimeJavaType thisType, LoadMode mode) } } - internal string Signature - { - get { return descriptor; } - } + internal string Signature => descriptor; - internal RuntimeJavaType[] GetArgTypes() - { - return argTypeWrappers; - } + internal RuntimeJavaType[] GetArgTypes() => argTypeWrappers; - internal RuntimeJavaType GetRetType() - { - return retTypeWrapper; - } + internal RuntimeJavaType GetRetType() => retTypeWrapper; - internal override ConstantType GetConstantType() - { - return ConstantType.MethodType; - } + internal override ConstantType GetConstantType() => ConstantType.MethodType; } diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemUtf8.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemUtf8.cs index 1fb0a269fe..9250d247d2 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemUtf8.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemUtf8.cs @@ -45,6 +45,7 @@ internal override object GetRuntimeValue() { return str; } + } } diff --git a/src/IKVM.Runtime/ClassFile.ConstantType.cs b/src/IKVM.Runtime/ClassFile.ConstantType.cs index 3fd0bee94f..8cac752973 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantType.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantType.cs @@ -27,8 +27,10 @@ namespace IKVM.Runtime sealed partial class ClassFile { + internal enum ConstantType { + Integer, Long, Float, @@ -38,7 +40,9 @@ internal enum ConstantType MethodHandle, MethodType, LiveObject, // used by anonymous class constant pool patching + } + } } diff --git a/src/IKVM.Runtime/ClassFile.InnerClass.cs b/src/IKVM.Runtime/ClassFile.InnerClass.cs index ba903051aa..d36bab6c21 100644 --- a/src/IKVM.Runtime/ClassFile.InnerClass.cs +++ b/src/IKVM.Runtime/ClassFile.InnerClass.cs @@ -32,10 +32,12 @@ sealed partial class ClassFile internal struct InnerClass { + internal ClassConstantHandle innerClass; // ConstantPoolItemClass internal ClassConstantHandle outerClass; // ConstantPoolItemClass internal Utf8ConstantHandle name; // ConstantPoolItemUtf8 internal Modifiers accessFlags; + } } diff --git a/src/IKVM.Runtime/ClassFile.Method.cs b/src/IKVM.Runtime/ClassFile.Method.cs index f4baf9da07..4edbcf54a2 100644 --- a/src/IKVM.Runtime/ClassFile.Method.cs +++ b/src/IKVM.Runtime/ClassFile.Method.cs @@ -26,7 +26,6 @@ Jeroen Frijters using IKVM.ByteCode.Decoding; using IKVM.CoreLib.Diagnostics; - #if IMPORTER using IKVM.Tools.Importer; #endif diff --git a/src/IKVM.Runtime/ClassFileParseOptions.cs b/src/IKVM.Runtime/ClassFileParseOptions.cs index a7fc6c9a95..becd1a8485 100644 --- a/src/IKVM.Runtime/ClassFileParseOptions.cs +++ b/src/IKVM.Runtime/ClassFileParseOptions.cs @@ -36,6 +36,7 @@ enum ClassFileParseOptions RelaxedClassNameValidation = 4, TrustedAnnotations = 8, RemoveAssertions = 16, + StaticImport = 32, } diff --git a/src/IKVM.Runtime/RuntimeClassLoader.cs b/src/IKVM.Runtime/RuntimeClassLoader.cs index 8f7f29d52c..b46fa99a9d 100644 --- a/src/IKVM.Runtime/RuntimeClassLoader.cs +++ b/src/IKVM.Runtime/RuntimeClassLoader.cs @@ -949,7 +949,7 @@ internal ClassFileParseOptions ClassFileParseOptions get { #if IMPORTER - var cfp = ClassFileParseOptions.LocalVariableTable; + var cfp = ClassFileParseOptions.LocalVariableTable | ClassFileParseOptions.StaticImport; if (EmitStackTraceInfo) cfp |= ClassFileParseOptions.LineNumberTable; if (context.ClassLoaderFactory.bootstrapClassLoader is ImportClassLoader) diff --git a/src/IKVM.Tools.Importer/ImportClassLoader.cs b/src/IKVM.Tools.Importer/ImportClassLoader.cs index 56db4e156f..3f3b0fb6da 100644 --- a/src/IKVM.Tools.Importer/ImportClassLoader.cs +++ b/src/IKVM.Tools.Importer/ImportClassLoader.cs @@ -2659,7 +2659,7 @@ static int CreateCompiler(RuntimeContext context, StaticCompiler compiler, IDiag { try { - using var f = new IKVM.Runtime.ClassFile(context, diagnostics, IKVM.ByteCode.Decoding.ClassFile.Read(assemblyType.GetData()), null, ClassFileParseOptions.None, null); + using var f = new IKVM.Runtime.ClassFile(context, diagnostics, IKVM.ByteCode.Decoding.ClassFile.Read(assemblyType.GetData()), null, ClassFileParseOptions.StaticImport, null); // NOTE the "assembly" type in the unnamed package is a magic type // that acts as the placeholder for assembly attributes @@ -2690,7 +2690,7 @@ static int CreateCompiler(RuntimeContext context, StaticCompiler compiler, IDiag { try { - using var f = new IKVM.Runtime.ClassFile(context, diagnostics, IKVM.ByteCode.Decoding.ClassFile.Read(h[className].GetData()), null, ClassFileParseOptions.None, null); + using var f = new IKVM.Runtime.ClassFile(context, diagnostics, IKVM.ByteCode.Decoding.ClassFile.Read(h[className].GetData()), null, ClassFileParseOptions.StaticImport, null); if (f.Name == className) { foreach (var m in f.Methods) diff --git a/src/IKVM.Tools.Importer/ImportContext.cs b/src/IKVM.Tools.Importer/ImportContext.cs index 38cf31d52b..644c892de6 100644 --- a/src/IKVM.Tools.Importer/ImportContext.cs +++ b/src/IKVM.Tools.Importer/ImportContext.cs @@ -946,7 +946,7 @@ static bool EmitStubWarning(RuntimeContext context, StaticCompiler compiler, Imp { try { - cf = new IKVM.Runtime.ClassFile(context, diagnostics, IKVM.ByteCode.Decoding.ClassFile.Read(buf), "", ClassFileParseOptions.None, null); + cf = new IKVM.Runtime.ClassFile(context, diagnostics, IKVM.ByteCode.Decoding.ClassFile.Read(buf), "", ClassFileParseOptions.StaticImport, null); } catch (ClassFormatError) { @@ -1205,7 +1205,7 @@ static void ProcessAttributeAnnotationsClass(RuntimeContext context, IDiagnostic try { using var file = File.OpenRead(filename); - var cf = new IKVM.Runtime.ClassFile(context, diagnostics, IKVM.ByteCode.Decoding.ClassFile.Read(file), null, ClassFileParseOptions.None, null); + var cf = new IKVM.Runtime.ClassFile(context, diagnostics, IKVM.ByteCode.Decoding.ClassFile.Read(file), null, ClassFileParseOptions.StaticImport, null); ArrayAppend(ref annotations, cf.Annotations); } catch (Exception x)