зеркало из https://github.com/mono/ikvm-fork.git
- Removed .NET 1.1 specific code
- Removed conditional compilation of .NET 2.0 specific code
This commit is contained in:
Родитель
83c6e5105d
Коммит
3072c89696
|
@ -1065,11 +1065,7 @@ namespace ikvm.awt
|
||||||
|
|
||||||
public override string[] getAvailableFontFamilyNames(Locale locale)
|
public override string[] getAvailableFontFamilyNames(Locale locale)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
int language = CultureInfo.GetCultureInfo(locale.toString()).LCID;
|
int language = CultureInfo.GetCultureInfo(locale.toString()).LCID;
|
||||||
#else
|
|
||||||
int language = new CultureInfo(locale.toString()).LCID;
|
|
||||||
#endif
|
|
||||||
return getAvailableFontFamilyNames(language);
|
return getAvailableFontFamilyNames(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ namespace ikvm.awt
|
||||||
|
|
||||||
public int getRGBPixel(int x, int y)
|
public int getRGBPixel(int x, int y)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
Bitmap bitmap = new Bitmap(1, 1);
|
Bitmap bitmap = new Bitmap(1, 1);
|
||||||
Graphics g = Graphics.FromImage(bitmap);
|
Graphics g = Graphics.FromImage(bitmap);
|
||||||
g.CopyFromScreen( x, y, 0, 0, new Size(1,1));
|
g.CopyFromScreen( x, y, 0, 0, new Size(1,1));
|
||||||
|
@ -56,14 +55,10 @@ namespace ikvm.awt
|
||||||
Color color = bitmap.GetPixel(0,0);
|
Color color = bitmap.GetPixel(0,0);
|
||||||
bitmap.Dispose();
|
bitmap.Dispose();
|
||||||
return color.ToArgb();
|
return color.ToArgb();
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getRGBPixels(java.awt.Rectangle r)
|
public int[] getRGBPixels(java.awt.Rectangle r)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
int width = r.width;
|
int width = r.width;
|
||||||
int height = r.height;
|
int height = r.height;
|
||||||
Bitmap bitmap = new Bitmap(width, height);
|
Bitmap bitmap = new Bitmap(width, height);
|
||||||
|
@ -80,9 +75,6 @@ namespace ikvm.awt
|
||||||
}
|
}
|
||||||
bitmap.Dispose();
|
bitmap.Dispose();
|
||||||
return pixels;
|
return pixels;
|
||||||
#else
|
|
||||||
return null;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte MapKeyCode(int keyCode)
|
private byte MapKeyCode(int keyCode)
|
||||||
|
|
|
@ -459,7 +459,7 @@ namespace ikvm.awt
|
||||||
|
|
||||||
public override void beep()
|
public override void beep()
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
Console.Beep();
|
Console.Beep();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
<Reference Include="System">
|
<Reference Include="System">
|
||||||
<Name>System</Name>
|
<Name>System</Name>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.configuration" />
|
||||||
<Reference Include="System.Xml">
|
<Reference Include="System.Xml">
|
||||||
<Name>System.XML</Name>
|
<Name>System.XML</Name>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -79,6 +80,9 @@
|
||||||
<Compile Include="ikvmc\remapper.cs">
|
<Compile Include="ikvmc\remapper.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="runtime\attributes.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="runtime\BigEndianBinaryReader.cs">
|
<Compile Include="runtime\BigEndianBinaryReader.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -112,6 +116,7 @@
|
||||||
<Compile Include="runtime\profiler.cs">
|
<Compile Include="runtime\profiler.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="runtime\tracer.cs" />
|
||||||
<Compile Include="runtime\TypeWrapper.cs">
|
<Compile Include="runtime\TypeWrapper.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -122,12 +127,6 @@
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="runtime\IKVM.Runtime.8.csproj">
|
|
||||||
<Project>{F5C7B588-0403-4AF2-A4DE-5697DE21BC2C}</Project>
|
|
||||||
<Name>IKVM.Runtime.8</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
|
|
|
@ -24,15 +24,12 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
#if WHIDBEY
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#endif
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Security.Permissions;
|
using System.Security.Permissions;
|
||||||
using IKVM.Runtime;
|
|
||||||
using IKVM.Attributes;
|
using IKVM.Attributes;
|
||||||
|
|
||||||
using ILGenerator = IKVM.Internal.CountingILGenerator;
|
using ILGenerator = IKVM.Internal.CountingILGenerator;
|
||||||
|
|
|
@ -96,11 +96,7 @@ class IkvmcCompiler
|
||||||
|
|
||||||
static int RealMain(string[] args)
|
static int RealMain(string[] args)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
|
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
|
||||||
#else
|
|
||||||
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
|
|
||||||
#endif
|
|
||||||
System.Threading.Thread.CurrentThread.Name = "compiler";
|
System.Threading.Thread.CurrentThread.Name = "compiler";
|
||||||
Tracer.EnableTraceForDebug();
|
Tracer.EnableTraceForDebug();
|
||||||
CompilerOptions options = new CompilerOptions();
|
CompilerOptions options = new CompilerOptions();
|
||||||
|
@ -787,205 +783,13 @@ class IkvmcCompiler
|
||||||
{
|
{
|
||||||
// make sure all the referenced assemblies are visible (they are loaded with LoadFrom, so
|
// make sure all the referenced assemblies are visible (they are loaded with LoadFrom, so
|
||||||
// they end up in the LoadFrom context [unless they happen to be available in one of the probe paths])
|
// they end up in the LoadFrom context [unless they happen to be available in one of the probe paths])
|
||||||
#if WHIDBEY
|
|
||||||
foreach(Assembly a in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies())
|
foreach(Assembly a in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies())
|
||||||
#else
|
|
||||||
foreach(Assembly a in AppDomain.CurrentDomain.GetAssemblies())
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if(args.Name.StartsWith(a.GetName().Name + ", "))
|
if(args.Name.StartsWith(a.GetName().Name + ", "))
|
||||||
{
|
{
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if WHIDBEY
|
|
||||||
return Assembly.ReflectionOnlyLoad(args.Name);
|
return Assembly.ReflectionOnlyLoad(args.Name);
|
||||||
#else
|
|
||||||
return null;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class LZOutputStream : Stream
|
|
||||||
{
|
|
||||||
private static readonly int[] hashSize = { 499, 997, 2179, 4297 };
|
|
||||||
private int[] codes;
|
|
||||||
private int[] values;
|
|
||||||
private int table_size;
|
|
||||||
private int count;
|
|
||||||
private int bitOffset;
|
|
||||||
private int bitBuffer;
|
|
||||||
private int prev = -1;
|
|
||||||
private int bits;
|
|
||||||
private Stream s;
|
|
||||||
|
|
||||||
public LZOutputStream(Stream s)
|
|
||||||
{
|
|
||||||
this.s = s;
|
|
||||||
bitOffset = 0;
|
|
||||||
count = 0;
|
|
||||||
table_size = 256;
|
|
||||||
bits = 9;
|
|
||||||
codes = new int[hashSize[0]];
|
|
||||||
values = new int[hashSize[0]];
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WriteByte(byte b)
|
|
||||||
{
|
|
||||||
if (prev != -1)
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
int p = (prev << 8) + b;
|
|
||||||
c = p % codes.Length;
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
int e = codes[c];
|
|
||||||
if (e == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (e == p)
|
|
||||||
{
|
|
||||||
prev = values[c];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
c++;
|
|
||||||
if(c == codes.Length)
|
|
||||||
{
|
|
||||||
c = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
outcode(prev);
|
|
||||||
if (count < table_size)
|
|
||||||
{
|
|
||||||
codes[c] = p;
|
|
||||||
values[c] = count + 256;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// table is full. Flush and rebuild
|
|
||||||
if (bits == 12)
|
|
||||||
{
|
|
||||||
table_size = 256;
|
|
||||||
bits = 9;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bits++;
|
|
||||||
table_size = (1 << bits) - 256;
|
|
||||||
}
|
|
||||||
count = 0;
|
|
||||||
int newsize = hashSize[bits - 9];
|
|
||||||
if(codes.Length >= newsize)
|
|
||||||
{
|
|
||||||
Array.Clear(codes, 0, codes.Length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
codes = new int[newsize];
|
|
||||||
values = new int[newsize];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prev = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Flush()
|
|
||||||
{
|
|
||||||
bitBuffer |= prev << bitOffset;
|
|
||||||
bitOffset += bits + 7;
|
|
||||||
while (bitOffset >= 8)
|
|
||||||
{
|
|
||||||
s.WriteByte((byte)bitBuffer);
|
|
||||||
bitBuffer >>= 8;
|
|
||||||
bitOffset -= 8;
|
|
||||||
}
|
|
||||||
prev = -1;
|
|
||||||
s.Flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void outcode(int c)
|
|
||||||
{
|
|
||||||
bitBuffer |= c << bitOffset;
|
|
||||||
bitOffset += bits;
|
|
||||||
while (bitOffset >= 8)
|
|
||||||
{
|
|
||||||
s.WriteByte((byte)bitBuffer);
|
|
||||||
bitBuffer >>= 8;
|
|
||||||
bitOffset -= 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Write(byte[] buffer, int off, int len)
|
|
||||||
{
|
|
||||||
while(--len >= 0)
|
|
||||||
{
|
|
||||||
WriteByte(buffer[off++]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanRead
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanSeek
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanWrite
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Length
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Position
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Seek(long offset, SeekOrigin origin)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetLength(long value)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int Read(byte[] buffer, int offset, int count)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Close()
|
|
||||||
{
|
|
||||||
s.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ using System.Text.RegularExpressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using IKVM.Attributes;
|
using IKVM.Attributes;
|
||||||
using IKVM.Runtime;
|
|
||||||
|
|
||||||
using ILGenerator = IKVM.Internal.CountingILGenerator;
|
using ILGenerator = IKVM.Internal.CountingILGenerator;
|
||||||
using Label = IKVM.Internal.CountingLabel;
|
using Label = IKVM.Internal.CountingLabel;
|
||||||
|
@ -120,11 +119,7 @@ namespace IKVM.Internal
|
||||||
name.KeyPair = new StrongNameKeyPair(keycontainer);
|
name.KeyPair = new StrongNameKeyPair(keycontainer);
|
||||||
}
|
}
|
||||||
name.Version = new Version(version);
|
name.Version = new Version(version);
|
||||||
#if WHIDBEY
|
|
||||||
assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.ReflectionOnly, assemblyDir);
|
assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.ReflectionOnly, assemblyDir);
|
||||||
#else
|
|
||||||
assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Save, assemblyDir);
|
|
||||||
#endif
|
|
||||||
ModuleBuilder moduleBuilder;
|
ModuleBuilder moduleBuilder;
|
||||||
moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName, assemblyFile, this.EmitDebugInfo);
|
moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName, assemblyFile, this.EmitDebugInfo);
|
||||||
if(this.EmitStackTraceInfo)
|
if(this.EmitStackTraceInfo)
|
||||||
|
@ -383,7 +378,6 @@ namespace IKVM.Internal
|
||||||
if(buf.Length > 0)
|
if(buf.Length > 0)
|
||||||
{
|
{
|
||||||
string name = JVM.MangleResourceName((string)d.Key);
|
string name = JVM.MangleResourceName((string)d.Key);
|
||||||
#if WHIDBEY
|
|
||||||
MemoryStream mem = new MemoryStream();
|
MemoryStream mem = new MemoryStream();
|
||||||
if(compressedResources)
|
if(compressedResources)
|
||||||
{
|
{
|
||||||
|
@ -399,18 +393,6 @@ namespace IKVM.Internal
|
||||||
}
|
}
|
||||||
mem.Position = 0;
|
mem.Position = 0;
|
||||||
moduleBuilder.DefineManifestResource(name, mem, ResourceAttributes.Public);
|
moduleBuilder.DefineManifestResource(name, mem, ResourceAttributes.Public);
|
||||||
#else
|
|
||||||
if(compressedResources)
|
|
||||||
{
|
|
||||||
MemoryStream mem = new MemoryStream();
|
|
||||||
LZOutputStream lz = new LZOutputStream(mem);
|
|
||||||
lz.Write(buf, 0, buf.Length);
|
|
||||||
lz.Flush();
|
|
||||||
buf = mem.ToArray();
|
|
||||||
}
|
|
||||||
IResourceWriter writer = moduleBuilder.DefineResource(name, "");
|
|
||||||
writer.AddResource(compressedResources ? "lz" : "ikvm", buf);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2101,25 +2083,24 @@ namespace IKVM.Internal
|
||||||
internal static int Compile(CompilerOptions options)
|
internal static int Compile(CompilerOptions options)
|
||||||
{
|
{
|
||||||
Tracer.Info(Tracer.Compiler, "JVM.Compile path: {0}, assembly: {1}", options.path, options.assembly);
|
Tracer.Info(Tracer.Compiler, "JVM.Compile path: {0}, assembly: {1}", options.path, options.assembly);
|
||||||
#if WHIDBEY
|
try
|
||||||
|
{
|
||||||
if(options.runtimeAssembly == null)
|
if(options.runtimeAssembly == null)
|
||||||
{
|
{
|
||||||
StaticCompiler.runtimeAssembly = Assembly.ReflectionOnlyLoadFrom(typeof(ByteCodeHelper).Assembly.Location);
|
// HACK based on our assembly name we create the default runtime assembly name
|
||||||
|
Assembly compilerAssembly = typeof(CompilerClassLoader).Assembly;
|
||||||
|
StaticCompiler.runtimeAssembly = Assembly.ReflectionOnlyLoad(compilerAssembly.FullName.Replace(compilerAssembly.GetName().Name, "IKVM.Runtime"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StaticCompiler.runtimeAssembly = Assembly.ReflectionOnlyLoadFrom(options.runtimeAssembly);
|
StaticCompiler.runtimeAssembly = Assembly.ReflectionOnlyLoadFrom(options.runtimeAssembly);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if(options.runtimeAssembly == null)
|
|
||||||
{
|
|
||||||
StaticCompiler.runtimeAssembly = typeof(ByteCodeHelper).Assembly;
|
|
||||||
}
|
}
|
||||||
else
|
catch(FileNotFoundException)
|
||||||
{
|
{
|
||||||
StaticCompiler.runtimeAssembly = Assembly.LoadFrom(options.runtimeAssembly);
|
Console.Error.WriteLine("Error: unable to load runtime assembly");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
Tracer.Info(Tracer.Compiler, "Loaded runtime assembly: {0}", StaticCompiler.runtimeAssembly.FullName);
|
Tracer.Info(Tracer.Compiler, "Loaded runtime assembly: {0}", StaticCompiler.runtimeAssembly.FullName);
|
||||||
AssemblyName runtimeAssemblyName = StaticCompiler.runtimeAssembly.GetName();
|
AssemblyName runtimeAssemblyName = StaticCompiler.runtimeAssembly.GetName();
|
||||||
bool allReferencesAreStrongNamed = IsSigned(StaticCompiler.runtimeAssembly);
|
bool allReferencesAreStrongNamed = IsSigned(StaticCompiler.runtimeAssembly);
|
||||||
|
@ -2128,37 +2109,17 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
Assembly reference = Assembly.ReflectionOnlyLoadFrom(r);
|
Assembly reference = Assembly.ReflectionOnlyLoadFrom(r);
|
||||||
if(AttributeHelper.IsDefined(reference, StaticCompiler.GetType("IKVM.Attributes.RemappedClassAttribute")))
|
if(AttributeHelper.IsDefined(reference, StaticCompiler.GetType("IKVM.Attributes.RemappedClassAttribute")))
|
||||||
{
|
{
|
||||||
JVM.CoreAssembly = reference;
|
JVM.CoreAssembly = reference;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
AssemblyName name = AssemblyName.GetAssemblyName(r);
|
|
||||||
Assembly reference;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
reference = Assembly.Load(name);
|
|
||||||
}
|
|
||||||
catch(FileNotFoundException)
|
|
||||||
{
|
|
||||||
// MONOBUG mono fails to use the codebase inside the AssemblyName,
|
|
||||||
// so now we try again explicitly loading from the codebase
|
|
||||||
reference = Assembly.LoadFrom(name.CodeBase);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if(reference == null)
|
if(reference == null)
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine("Error: reference not found: {0}", r);
|
Console.Error.WriteLine("Error: reference not found: {0}", r);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
references.Add(reference);
|
references.Add(reference);
|
||||||
// HACK if we explictly referenced the core assembly, make sure we register it as such
|
|
||||||
if(reference.GetType("java.lang.Object") != null)
|
|
||||||
{
|
|
||||||
JVM.CoreAssembly = reference;
|
|
||||||
}
|
|
||||||
allReferencesAreStrongNamed &= IsSigned(reference);
|
allReferencesAreStrongNamed &= IsSigned(reference);
|
||||||
Tracer.Info(Tracer.Compiler, "Loaded reference assembly: {0}", reference.FullName);
|
Tracer.Info(Tracer.Compiler, "Loaded reference assembly: {0}", reference.FullName);
|
||||||
// if it's an IKVM compiled assembly, make sure that it was compiled
|
// if it's an IKVM compiled assembly, make sure that it was compiled
|
||||||
|
@ -2227,7 +2188,6 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if WHIDBEY
|
|
||||||
// If the "System" assembly wasn't explicitly referenced, load it automatically
|
// If the "System" assembly wasn't explicitly referenced, load it automatically
|
||||||
bool systemIsLoaded = false;
|
bool systemIsLoaded = false;
|
||||||
foreach(Assembly asm in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies())
|
foreach(Assembly asm in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies())
|
||||||
|
@ -2242,7 +2202,6 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
Assembly.ReflectionOnlyLoadFrom(typeof(System.ComponentModel.EditorBrowsableAttribute).Assembly.Location);
|
Assembly.ReflectionOnlyLoadFrom(typeof(System.ComponentModel.EditorBrowsableAttribute).Assembly.Location);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
ArrayList assemblyAnnotations = new ArrayList();
|
ArrayList assemblyAnnotations = new ArrayList();
|
||||||
Hashtable baseClasses = new Hashtable();
|
Hashtable baseClasses = new Hashtable();
|
||||||
Hashtable h = new Hashtable();
|
Hashtable h = new Hashtable();
|
||||||
|
@ -2424,11 +2383,20 @@ namespace IKVM.Internal
|
||||||
Console.Error.WriteLine("Error: runtime assembly doesn't reference core assembly");
|
Console.Error.WriteLine("Error: runtime assembly doesn't reference core assembly");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if WHIDBEY
|
try
|
||||||
|
{
|
||||||
|
JVM.CoreAssembly = Assembly.ReflectionOnlyLoad(coreAssemblyName.FullName);
|
||||||
|
}
|
||||||
|
catch(FileNotFoundException)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
JVM.CoreAssembly = Assembly.ReflectionOnlyLoadFrom(StaticCompiler.runtimeAssembly.CodeBase + "\\..\\" + coreAssemblyName.Name + ".dll");
|
JVM.CoreAssembly = Assembly.ReflectionOnlyLoadFrom(StaticCompiler.runtimeAssembly.CodeBase + "\\..\\" + coreAssemblyName.Name + ".dll");
|
||||||
#else
|
}
|
||||||
JVM.CoreAssembly = Assembly.Load(coreAssemblyName);
|
catch(FileNotFoundException)
|
||||||
#endif
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
if(JVM.CoreAssembly == null)
|
if(JVM.CoreAssembly == null)
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine("Error: bootstrap classes missing and core assembly not found");
|
Console.Error.WriteLine("Error: bootstrap classes missing and core assembly not found");
|
||||||
|
@ -2436,7 +2404,6 @@ namespace IKVM.Internal
|
||||||
}
|
}
|
||||||
loader.AddReference(ClassLoaderWrapper.GetAssemblyClassLoader(JVM.CoreAssembly));
|
loader.AddReference(ClassLoaderWrapper.GetAssemblyClassLoader(JVM.CoreAssembly));
|
||||||
allReferencesAreStrongNamed &= IsSigned(JVM.CoreAssembly);
|
allReferencesAreStrongNamed &= IsSigned(JVM.CoreAssembly);
|
||||||
StaticCompiler.IssueMessage(Message.AutoAddRef, JVM.CoreAssembly.Location);
|
|
||||||
// we need to scan again for remapped types, now that we've loaded the core library
|
// we need to scan again for remapped types, now that we've loaded the core library
|
||||||
ClassLoaderWrapper.LoadRemappedTypes();
|
ClassLoaderWrapper.LoadRemappedTypes();
|
||||||
}
|
}
|
||||||
|
@ -2685,7 +2652,6 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
return runtimeAssembly.GetType(name);
|
return runtimeAssembly.GetType(name);
|
||||||
}
|
}
|
||||||
#if WHIDBEY
|
|
||||||
foreach(Assembly asm in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies())
|
foreach(Assembly asm in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies())
|
||||||
{
|
{
|
||||||
Type t = asm.GetType(name, false);
|
Type t = asm.GetType(name, false);
|
||||||
|
@ -2696,21 +2662,6 @@ namespace IKVM.Internal
|
||||||
}
|
}
|
||||||
// try mscorlib as well
|
// try mscorlib as well
|
||||||
return typeof(object).Assembly.GetType(name, throwOnError);
|
return typeof(object).Assembly.GetType(name, throwOnError);
|
||||||
#else
|
|
||||||
foreach(Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
|
|
||||||
{
|
|
||||||
Type t = asm.GetType(name, false);
|
|
||||||
if(t != null)
|
|
||||||
{
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(throwOnError)
|
|
||||||
{
|
|
||||||
throw new TypeLoadException(name);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Hashtable suppressWarnings = new Hashtable();
|
private static Hashtable suppressWarnings = new Hashtable();
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<include name="Compiler.cs" />
|
<include name="Compiler.cs" />
|
||||||
<include name="CompilerClassLoader.cs" />
|
<include name="CompilerClassLoader.cs" />
|
||||||
<include name="remapper.cs" />
|
<include name="remapper.cs" />
|
||||||
|
<include name="../runtime/attributes.cs" />
|
||||||
<include name="../runtime/BigEndianBinaryReader.cs" />
|
<include name="../runtime/BigEndianBinaryReader.cs" />
|
||||||
<include name="../runtime/ByteCode.cs" />
|
<include name="../runtime/ByteCode.cs" />
|
||||||
<include name="../runtime/ClassFile.cs" />
|
<include name="../runtime/ClassFile.cs" />
|
||||||
|
@ -27,12 +28,12 @@
|
||||||
<include name="../runtime/JavaException.cs" />
|
<include name="../runtime/JavaException.cs" />
|
||||||
<include name="../runtime/MemberWrapper.cs" />
|
<include name="../runtime/MemberWrapper.cs" />
|
||||||
<include name="../runtime/profiler.cs" />
|
<include name="../runtime/profiler.cs" />
|
||||||
|
<include name="../runtime/tracer.cs" />
|
||||||
<include name="../runtime/TypeWrapper.cs" />
|
<include name="../runtime/TypeWrapper.cs" />
|
||||||
<include name="../runtime/verifier.cs" />
|
<include name="../runtime/verifier.cs" />
|
||||||
<include name="../runtime/vm.cs" />
|
<include name="../runtime/vm.cs" />
|
||||||
</sources>
|
</sources>
|
||||||
<references>
|
<references>
|
||||||
<include name="../bin/IKVM.Runtime.dll" asis="true" />
|
|
||||||
<include name="../bin/ICSharpCode.SharpZipLib.dll" asis="true" />
|
<include name="../bin/ICSharpCode.SharpZipLib.dll" asis="true" />
|
||||||
</references>
|
</references>
|
||||||
</csc>
|
</csc>
|
||||||
|
|
|
@ -79,29 +79,8 @@ public class NetExp
|
||||||
}
|
}
|
||||||
if(file != null && file.Exists)
|
if(file != null && file.Exists)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomain_ReflectionOnlyAssemblyResolve);
|
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomain_ReflectionOnlyAssemblyResolve);
|
||||||
assembly = Assembly.ReflectionOnlyLoadFrom(assemblyNameOrPath);
|
assembly = Assembly.ReflectionOnlyLoadFrom(assemblyNameOrPath);
|
||||||
#else
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// If the same assembly can be found in the "Load" context, we prefer to use that
|
|
||||||
// http://blogs.gotdotnet.com/suzcook/permalink.aspx/d5c5e14a-3612-4af1-a9b7-0a144c8dbf16
|
|
||||||
// We use AssemblyName.FullName, because otherwise the assembly will be loaded in the
|
|
||||||
// "LoadFrom" context using the path inside the AssemblyName object.
|
|
||||||
assembly = Assembly.Load(AssemblyName.GetAssemblyName(assemblyNameOrPath).FullName);
|
|
||||||
Console.Error.WriteLine("Warning: Assembly loaded from {0} instead", assembly.Location);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
if(assembly == null)
|
|
||||||
{
|
|
||||||
// since we're loading the assembly in the LoadFrom context, we need to hook the AssemblyResolve event
|
|
||||||
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
|
|
||||||
assembly = Assembly.LoadFrom(assemblyNameOrPath);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -160,7 +139,6 @@ public class NetExp
|
||||||
Environment.Exit(rc);
|
Environment.Exit(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WHIDBEY
|
|
||||||
private static Assembly CurrentDomain_ReflectionOnlyAssemblyResolve(object sender, ResolveEventArgs args)
|
private static Assembly CurrentDomain_ReflectionOnlyAssemblyResolve(object sender, ResolveEventArgs args)
|
||||||
{
|
{
|
||||||
foreach(Assembly a in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies())
|
foreach(Assembly a in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies())
|
||||||
|
@ -185,7 +163,6 @@ public class NetExp
|
||||||
Console.WriteLine("Loading referenced assembly: " + path);
|
Console.WriteLine("Loading referenced assembly: " + path);
|
||||||
return Assembly.ReflectionOnlyLoadFrom(path);
|
return Assembly.ReflectionOnlyLoadFrom(path);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
private static void WriteClass(java.lang.Class c)
|
private static void WriteClass(java.lang.Class c)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +196,6 @@ public class NetExp
|
||||||
// NOTE we can't use getClassFromTypeHandle for ReflectionOnly assemblies
|
// NOTE we can't use getClassFromTypeHandle for ReflectionOnly assemblies
|
||||||
// (because Type.TypeHandle is not supported by ReflectionOnly types), but this
|
// (because Type.TypeHandle is not supported by ReflectionOnly types), but this
|
||||||
// isn't a problem because mscorlib is never loaded in the ReflectionOnly context.
|
// isn't a problem because mscorlib is never loaded in the ReflectionOnly context.
|
||||||
#if WHIDBEY
|
|
||||||
if(assembly.ReflectionOnly)
|
if(assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
c = ikvm.runtime.Util.getFriendlyClassFromType(t);
|
c = ikvm.runtime.Util.getFriendlyClassFromType(t);
|
||||||
|
@ -228,9 +204,6 @@ public class NetExp
|
||||||
{
|
{
|
||||||
c = ikvm.runtime.Util.getClassFromTypeHandle(t.TypeHandle);
|
c = ikvm.runtime.Util.getClassFromTypeHandle(t.TypeHandle);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
c = ikvm.runtime.Util.getClassFromTypeHandle(t.TypeHandle);
|
|
||||||
#endif
|
|
||||||
if(c != null)
|
if(c != null)
|
||||||
{
|
{
|
||||||
AddToExportList(c);
|
AddToExportList(c);
|
||||||
|
@ -265,7 +238,6 @@ public class NetExp
|
||||||
|
|
||||||
private static bool IsGenericType(java.lang.Class c)
|
private static bool IsGenericType(java.lang.Class c)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
System.Type t = ikvm.runtime.Util.getInstanceTypeFromClass(c);
|
System.Type t = ikvm.runtime.Util.getInstanceTypeFromClass(c);
|
||||||
while(t == null && c.getDeclaringClass() != null)
|
while(t == null && c.getDeclaringClass() != null)
|
||||||
{
|
{
|
||||||
|
@ -274,9 +246,6 @@ public class NetExp
|
||||||
t = ikvm.runtime.Util.getInstanceTypeFromClass(c);
|
t = ikvm.runtime.Util.getInstanceTypeFromClass(c);
|
||||||
}
|
}
|
||||||
return t.IsGenericType;
|
return t.IsGenericType;
|
||||||
#else
|
|
||||||
return c.getName().IndexOf("$$0060") > 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddToExportListIfNeeded(java.lang.Class c)
|
private static void AddToExportListIfNeeded(java.lang.Class c)
|
||||||
|
@ -345,16 +314,4 @@ public class NetExp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
|
|
||||||
{
|
|
||||||
foreach(Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
|
|
||||||
{
|
|
||||||
if(asm.FullName == args.Name)
|
|
||||||
{
|
|
||||||
return asm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -600,13 +600,13 @@ namespace IKVM.Runtime
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !WHIDBEY || COMPACT_FRAMEWORK
|
#if COMPACT_FRAMEWORK
|
||||||
private static readonly object volatileLock = new object();
|
private static readonly object volatileLock = new object();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public static long VolatileRead(ref long v)
|
public static long VolatileRead(ref long v)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
return Interlocked.Read(ref v);
|
return Interlocked.Read(ref v);
|
||||||
#else
|
#else
|
||||||
lock(volatileLock)
|
lock(volatileLock)
|
||||||
|
@ -618,7 +618,7 @@ namespace IKVM.Runtime
|
||||||
|
|
||||||
public static void VolatileWrite(ref long v, long newValue)
|
public static void VolatileWrite(ref long v, long newValue)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
Interlocked.Exchange(ref v, newValue);
|
Interlocked.Exchange(ref v, newValue);
|
||||||
#else
|
#else
|
||||||
lock(volatileLock)
|
lock(volatileLock)
|
||||||
|
@ -630,7 +630,7 @@ namespace IKVM.Runtime
|
||||||
|
|
||||||
public static double VolatileRead(ref double v)
|
public static double VolatileRead(ref double v)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
return Interlocked.CompareExchange(ref v, 0.0, 0.0);
|
return Interlocked.CompareExchange(ref v, 0.0, 0.0);
|
||||||
#else
|
#else
|
||||||
lock(volatileLock)
|
lock(volatileLock)
|
||||||
|
@ -642,7 +642,7 @@ namespace IKVM.Runtime
|
||||||
|
|
||||||
public static void VolatileWrite(ref double v, double newValue)
|
public static void VolatileWrite(ref double v, double newValue)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
Interlocked.Exchange(ref v, newValue);
|
Interlocked.Exchange(ref v, newValue);
|
||||||
#else
|
#else
|
||||||
lock(volatileLock)
|
lock(volatileLock)
|
||||||
|
|
|
@ -25,7 +25,6 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using IKVM.Attributes;
|
using IKVM.Attributes;
|
||||||
using IKVM.Runtime;
|
|
||||||
|
|
||||||
namespace IKVM.Internal
|
namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,6 @@ using System.Collections;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using IKVM.Attributes;
|
using IKVM.Attributes;
|
||||||
using IKVM.Runtime;
|
|
||||||
|
|
||||||
namespace IKVM.Internal
|
namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
|
@ -958,7 +957,7 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
return GetGenericClassLoaderByName(name);
|
return GetGenericClassLoaderByName(name);
|
||||||
}
|
}
|
||||||
#if WHIDBEY && STATIC_COMPILER
|
#if STATIC_COMPILER
|
||||||
return ClassLoaderWrapper.GetAssemblyClassLoader(Assembly.ReflectionOnlyLoad(name));
|
return ClassLoaderWrapper.GetAssemblyClassLoader(Assembly.ReflectionOnlyLoad(name));
|
||||||
#else
|
#else
|
||||||
return ClassLoaderWrapper.GetAssemblyClassLoader(Assembly.Load(name));
|
return ClassLoaderWrapper.GetAssemblyClassLoader(Assembly.Load(name));
|
||||||
|
@ -1303,9 +1302,7 @@ namespace IKVM.Internal
|
||||||
private Assembly assembly;
|
private Assembly assembly;
|
||||||
private AssemblyName[] references;
|
private AssemblyName[] references;
|
||||||
private AssemblyClassLoader[] delegates;
|
private AssemblyClassLoader[] delegates;
|
||||||
#if WHIDBEY
|
|
||||||
private bool isReflectionOnly;
|
private bool isReflectionOnly;
|
||||||
#endif // WHIDBEY
|
|
||||||
private bool[] isJavaModule;
|
private bool[] isJavaModule;
|
||||||
private Module[] modules;
|
private Module[] modules;
|
||||||
private Hashtable nameMap;
|
private Hashtable nameMap;
|
||||||
|
@ -1323,9 +1320,7 @@ namespace IKVM.Internal
|
||||||
modules = assembly.GetModules(false);
|
modules = assembly.GetModules(false);
|
||||||
isJavaModule = new bool[modules.Length];
|
isJavaModule = new bool[modules.Length];
|
||||||
this.hasCustomClassLoader = hasCustomClassLoader;
|
this.hasCustomClassLoader = hasCustomClassLoader;
|
||||||
#if WHIDBEY
|
|
||||||
isReflectionOnly = assembly.ReflectionOnly;
|
isReflectionOnly = assembly.ReflectionOnly;
|
||||||
#endif // WHIDBEY
|
|
||||||
for(int i = 0; i < modules.Length; i++)
|
for(int i = 0; i < modules.Length; i++)
|
||||||
{
|
{
|
||||||
object[] attr = AttributeHelper.GetJavaModuleAttributes(modules[i]);
|
object[] attr = AttributeHelper.GetJavaModuleAttributes(modules[i]);
|
||||||
|
@ -1614,13 +1609,11 @@ namespace IKVM.Internal
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO consider throttling the Load attempts (or caching failure)
|
// TODO consider throttling the Load attempts (or caching failure)
|
||||||
#if WHIDBEY
|
|
||||||
if(isReflectionOnly)
|
if(isReflectionOnly)
|
||||||
{
|
{
|
||||||
asm = Assembly.ReflectionOnlyLoad(references[i].FullName);
|
asm = Assembly.ReflectionOnlyLoad(references[i].FullName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
asm = Assembly.Load(references[i]);
|
asm = Assembly.Load(references[i]);
|
||||||
}
|
}
|
||||||
|
@ -1680,13 +1673,11 @@ namespace IKVM.Internal
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO consider throttling the Load attempts (or caching failure)
|
// TODO consider throttling the Load attempts (or caching failure)
|
||||||
#if WHIDBEY
|
|
||||||
if(isReflectionOnly)
|
if(isReflectionOnly)
|
||||||
{
|
{
|
||||||
asm = Assembly.ReflectionOnlyLoad(references[i].FullName);
|
asm = Assembly.ReflectionOnlyLoad(references[i].FullName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
asm = Assembly.Load(references[i]);
|
asm = Assembly.Load(references[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,10 +42,6 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
sealed class DynamicClassLoader : TypeWrapperFactory
|
sealed class DynamicClassLoader : TypeWrapperFactory
|
||||||
{
|
{
|
||||||
#if !WHIDBEY
|
|
||||||
internal static bool arrayConstructionHack;
|
|
||||||
internal static readonly object arrayConstructionLock = new object();
|
|
||||||
#endif // !WHIDBEY
|
|
||||||
private static readonly char[] specialCharacters = { '\\', '+', ',', '[', ']', '*', '&', '\u0000' };
|
private static readonly char[] specialCharacters = { '\\', '+', ',', '[', ']', '*', '&', '\u0000' };
|
||||||
private static readonly string specialCharactersString = new String(specialCharacters);
|
private static readonly string specialCharactersString = new String(specialCharacters);
|
||||||
#if !STATIC_COMPILER
|
#if !STATIC_COMPILER
|
||||||
|
@ -81,16 +77,6 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
private static Assembly OnTypeResolve(object sender, ResolveEventArgs args)
|
private static Assembly OnTypeResolve(object sender, ResolveEventArgs args)
|
||||||
{
|
{
|
||||||
#if !WHIDBEY
|
|
||||||
lock(arrayConstructionLock)
|
|
||||||
{
|
|
||||||
Tracer.Info(Tracer.ClassLoading, "OnTypeResolve: {0} (arrayConstructionHack = {1})", args.Name, arrayConstructionHack);
|
|
||||||
if(arrayConstructionHack)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // !WHIDBEY
|
|
||||||
TypeWrapper type = (TypeWrapper)Instance.dynamicTypes[args.Name];
|
TypeWrapper type = (TypeWrapper)Instance.dynamicTypes[args.Name];
|
||||||
if(type == null)
|
if(type == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,7 +113,6 @@
|
||||||
<Compile Include="MemberWrapper.cs">
|
<Compile Include="MemberWrapper.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="netinf.cs" />
|
|
||||||
<Compile Include="openjdk.cs" />
|
<Compile Include="openjdk.cs" />
|
||||||
<Compile Include="profiler.cs">
|
<Compile Include="profiler.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using IKVM.Runtime;
|
|
||||||
using IKVM.Internal;
|
using IKVM.Internal;
|
||||||
|
|
||||||
abstract class RetargetableJavaException : ApplicationException
|
abstract class RetargetableJavaException : ApplicationException
|
||||||
|
|
|
@ -435,6 +435,7 @@ namespace IKVM.Runtime
|
||||||
ClassLoaderWrapper prevLoader = f.Enter(loader);
|
ClassLoaderWrapper prevLoader = f.Enter(loader);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// TODO on Whidbey we should be able to use Marshal.GetDelegateForFunctionPointer to call OnLoad
|
||||||
version = ikvm_CallOnLoad(onload, JavaVM.pJavaVM, null);
|
version = ikvm_CallOnLoad(onload, JavaVM.pJavaVM, null);
|
||||||
Tracer.Info(Tracer.Jni, "JNI_OnLoad returned: 0x{0:X8}", version);
|
Tracer.Info(Tracer.Jni, "JNI_OnLoad returned: 0x{0:X8}", version);
|
||||||
}
|
}
|
||||||
|
@ -473,6 +474,7 @@ namespace IKVM.Runtime
|
||||||
|
|
||||||
unsafe class VtableBuilder
|
unsafe class VtableBuilder
|
||||||
{
|
{
|
||||||
|
// TODO on Whidbey we should use generics to cut down on the number of delegates needed
|
||||||
delegate int pf_int_IntPtr(JNIEnv* pEnv, IntPtr p);
|
delegate int pf_int_IntPtr(JNIEnv* pEnv, IntPtr p);
|
||||||
delegate IntPtr pf_IntPtr_IntPtr(JNIEnv* pEnv, IntPtr p);
|
delegate IntPtr pf_IntPtr_IntPtr(JNIEnv* pEnv, IntPtr p);
|
||||||
delegate void pf_void_IntPtr(JNIEnv* pEnv, IntPtr p);
|
delegate void pf_void_IntPtr(JNIEnv* pEnv, IntPtr p);
|
||||||
|
@ -566,6 +568,7 @@ namespace IKVM.Runtime
|
||||||
{
|
{
|
||||||
if(vtableDelegates[i] != null)
|
if(vtableDelegates[i] != null)
|
||||||
{
|
{
|
||||||
|
// TODO on Whidbey we can use Marshal.GetFunctionPointerForDelegate
|
||||||
p[i] = JniHelper.ikvm_MarshalDelegate(vtableDelegates[i]);
|
p[i] = JniHelper.ikvm_MarshalDelegate(vtableDelegates[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -30,7 +30,6 @@ using ILGenerator = IKVM.Internal.CountingILGenerator;
|
||||||
#endif
|
#endif
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using IKVM.Attributes;
|
using IKVM.Attributes;
|
||||||
using IKVM.Runtime;
|
|
||||||
|
|
||||||
namespace IKVM.Internal
|
namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
|
@ -904,12 +903,7 @@ namespace IKVM.Internal
|
||||||
private static Hashtable cache;
|
private static Hashtable cache;
|
||||||
private static ModuleBuilder module;
|
private static ModuleBuilder module;
|
||||||
|
|
||||||
private class KeyGen :
|
private class KeyGen : IEqualityComparer
|
||||||
#if WHIDBEY
|
|
||||||
IEqualityComparer
|
|
||||||
#else
|
|
||||||
IHashCodeProvider, IComparer
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
public int GetHashCode(object o)
|
public int GetHashCode(object o)
|
||||||
{
|
{
|
||||||
|
@ -949,11 +943,7 @@ namespace IKVM.Internal
|
||||||
static NonvirtualInvokeHelper()
|
static NonvirtualInvokeHelper()
|
||||||
{
|
{
|
||||||
KeyGen keygen = new KeyGen();
|
KeyGen keygen = new KeyGen();
|
||||||
#if WHIDBEY
|
|
||||||
cache = new Hashtable(keygen);
|
cache = new Hashtable(keygen);
|
||||||
#else
|
|
||||||
cache = new Hashtable(keygen, keygen);
|
|
||||||
#endif
|
|
||||||
AssemblyName name = new AssemblyName();
|
AssemblyName name = new AssemblyName();
|
||||||
name.Name = "NonvirtualInvoker";
|
name.Name = "NonvirtualInvoker";
|
||||||
AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly(name, JVM.IsSaveDebugImage ? AssemblyBuilderAccess.RunAndSave : AssemblyBuilderAccess.Run);
|
AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly(name, JVM.IsSaveDebugImage ? AssemblyBuilderAccess.RunAndSave : AssemblyBuilderAccess.Run);
|
||||||
|
@ -1366,18 +1356,7 @@ namespace IKVM.Internal
|
||||||
if(field.IsLiteral)
|
if(field.IsLiteral)
|
||||||
{
|
{
|
||||||
ReflectionOnConstant.IssueWarning(field);
|
ReflectionOnConstant.IssueWarning(field);
|
||||||
#if WHIDBEY
|
|
||||||
val = field.GetRawConstantValue();
|
val = field.GetRawConstantValue();
|
||||||
#else
|
|
||||||
try
|
|
||||||
{
|
|
||||||
val = field.GetValue(null);
|
|
||||||
}
|
|
||||||
catch(TargetInvocationException x)
|
|
||||||
{
|
|
||||||
throw x.InnerException;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if(field.FieldType.IsEnum)
|
if(field.FieldType.IsEnum)
|
||||||
{
|
{
|
||||||
val = DotNetTypeWrapper.EnumValueFieldWrapper.GetEnumPrimitiveValue(Enum.GetUnderlyingType(field.FieldType), val);
|
val = DotNetTypeWrapper.EnumValueFieldWrapper.GetEnumPrimitiveValue(Enum.GetUnderlyingType(field.FieldType), val);
|
||||||
|
@ -1580,37 +1559,7 @@ namespace IKVM.Internal
|
||||||
FieldBuilder fb = field as FieldBuilder;
|
FieldBuilder fb = field as FieldBuilder;
|
||||||
if(fb != null)
|
if(fb != null)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
field = DeclaringType.TypeAsTBD.Module.ResolveField(fb.GetToken().Token);
|
field = DeclaringType.TypeAsTBD.Module.ResolveField(fb.GetToken().Token);
|
||||||
#else
|
|
||||||
// first do a name based lookup as that is much faster than doing a token based lookup
|
|
||||||
BindingFlags bindings = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly;
|
|
||||||
if(this.IsStatic)
|
|
||||||
{
|
|
||||||
bindings |= BindingFlags.Static;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bindings |= BindingFlags.Instance;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FieldInfo fi = DeclaringType.TypeAsTBD.GetField(field.Name, bindings);
|
|
||||||
// now check that we've got the right field by comparing the tokens
|
|
||||||
ModuleBuilder module = DeclaringType.GetClassLoader().GetTypeWrapperFactory().ModuleBuilder;
|
|
||||||
if(module.GetFieldToken(fi).Token != fb.GetToken().Token)
|
|
||||||
{
|
|
||||||
fi = TokenBasedLookup(bindings, fb.GetToken().Token);
|
|
||||||
}
|
|
||||||
field = fi;
|
|
||||||
}
|
|
||||||
catch(AmbiguousMatchException)
|
|
||||||
{
|
|
||||||
// .NET 2.0 will throw this exception if there are multiple fields
|
|
||||||
// with the same name (.NET 1.1 will simply return one of them)
|
|
||||||
field = TokenBasedLookup(bindings, fb.GetToken().Token);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1956,7 +1905,6 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
if(constant == null)
|
if(constant == null)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
FieldInfo field = GetField();
|
FieldInfo field = GetField();
|
||||||
#if !STATIC_COMPILER
|
#if !STATIC_COMPILER
|
||||||
if(field.FieldType.IsEnum && !field.DeclaringType.IsEnum)
|
if(field.FieldType.IsEnum && !field.DeclaringType.IsEnum)
|
||||||
|
@ -1972,9 +1920,6 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
constant = field.GetRawConstantValue();
|
constant = field.GetRawConstantValue();
|
||||||
}
|
}
|
||||||
#else // WHIDBEY
|
|
||||||
constant = GetField().GetValue(null);
|
|
||||||
#endif // WHIDBEY
|
|
||||||
}
|
}
|
||||||
return constant;
|
return constant;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
#if WHIDBEY
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#endif
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
#if !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
|
@ -35,7 +33,6 @@ using Label = IKVM.Internal.CountingLabel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Security.Permissions;
|
using System.Security.Permissions;
|
||||||
using IKVM.Runtime;
|
|
||||||
using IKVM.Attributes;
|
using IKVM.Attributes;
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,7 +181,6 @@ namespace IKVM.Internal
|
||||||
}
|
}
|
||||||
else if(tw.TypeAsTBD.IsEnum)
|
else if(tw.TypeAsTBD.IsEnum)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
if(tw.TypeAsTBD.Assembly.ReflectionOnly)
|
if(tw.TypeAsTBD.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
// TODO implement full parsing semantics
|
// TODO implement full parsing semantics
|
||||||
|
@ -195,7 +191,6 @@ namespace IKVM.Internal
|
||||||
}
|
}
|
||||||
return field.GetRawConstantValue();
|
return field.GetRawConstantValue();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return Enum.Parse(tw.TypeAsTBD, val);
|
return Enum.Parse(tw.TypeAsTBD, val);
|
||||||
}
|
}
|
||||||
else if(tw.TypeAsTBD == typeof(Type))
|
else if(tw.TypeAsTBD == typeof(Type))
|
||||||
|
@ -756,7 +751,7 @@ namespace IKVM.Internal
|
||||||
return IsDefined(type, typeofExceptionIsUnsafeForMappingAttribute);
|
return IsDefined(type, typeofExceptionIsUnsafeForMappingAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
// this method compares t1 and t2 by name
|
// this method compares t1 and t2 by name
|
||||||
// if the type name and assembly name (ignoring the version and strong name) match
|
// if the type name and assembly name (ignoring the version and strong name) match
|
||||||
// the type are considered the same
|
// the type are considered the same
|
||||||
|
@ -769,7 +764,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static object GetConstantValue(FieldInfo field)
|
internal static object GetConstantValue(FieldInfo field)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || field.DeclaringType.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || field.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(field))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(field))
|
||||||
|
@ -794,7 +789,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static ModifiersAttribute GetModifiersAttribute(Type type)
|
internal static ModifiersAttribute GetModifiersAttribute(Type type)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
||||||
|
@ -818,7 +813,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static ExModifiers GetModifiers(MethodBase mb, bool assemblyIsPrivate)
|
internal static ExModifiers GetModifiers(MethodBase mb, bool assemblyIsPrivate)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || mb.DeclaringType.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || mb.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(mb))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(mb))
|
||||||
|
@ -899,7 +894,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static ExModifiers GetModifiers(FieldInfo fi, bool assemblyIsPrivate)
|
internal static ExModifiers GetModifiers(FieldInfo fi, bool assemblyIsPrivate)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || fi.DeclaringType.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || fi.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(fi))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(fi))
|
||||||
|
@ -954,12 +949,10 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
modifiers |= Modifiers.Static;
|
modifiers |= Modifiers.Static;
|
||||||
}
|
}
|
||||||
#if WHIDBEY
|
|
||||||
if(Array.IndexOf(fi.GetRequiredCustomModifiers(), typeof(System.Runtime.CompilerServices.IsVolatile)) != -1)
|
if(Array.IndexOf(fi.GetRequiredCustomModifiers(), typeof(System.Runtime.CompilerServices.IsVolatile)) != -1)
|
||||||
{
|
{
|
||||||
modifiers |= Modifiers.Volatile;
|
modifiers |= Modifiers.Volatile;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return new ExModifiers(modifiers, false);
|
return new ExModifiers(modifiers, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,7 +1157,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static NameSigAttribute GetNameSig(FieldInfo field)
|
internal static NameSigAttribute GetNameSig(FieldInfo field)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || field.DeclaringType.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || field.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(field))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(field))
|
||||||
|
@ -1184,7 +1177,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static NameSigAttribute GetNameSig(MethodBase method)
|
internal static NameSigAttribute GetNameSig(MethodBase method)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || method.DeclaringType.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || method.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(method))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(method))
|
||||||
|
@ -1202,7 +1195,7 @@ namespace IKVM.Internal
|
||||||
return attr.Length == 1 ? (NameSigAttribute)attr[0] : null;
|
return attr.Length == 1 ? (NameSigAttribute)attr[0] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
internal static T[] DecodeArray<T>(CustomAttributeTypedArgument arg)
|
internal static T[] DecodeArray<T>(CustomAttributeTypedArgument arg)
|
||||||
{
|
{
|
||||||
IList<CustomAttributeTypedArgument> elems = (IList<CustomAttributeTypedArgument>)arg.Value;
|
IList<CustomAttributeTypedArgument> elems = (IList<CustomAttributeTypedArgument>)arg.Value;
|
||||||
|
@ -1217,7 +1210,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static ImplementsAttribute GetImplements(Type type)
|
internal static ImplementsAttribute GetImplements(Type type)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
||||||
|
@ -1237,7 +1230,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static ThrowsAttribute GetThrows(MethodBase mb)
|
internal static ThrowsAttribute GetThrows(MethodBase mb)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || mb.DeclaringType.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || mb.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(mb))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(mb))
|
||||||
|
@ -1257,7 +1250,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static string[] GetNonNestedInnerClasses(Type t)
|
internal static string[] GetNonNestedInnerClasses(Type t)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || t.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || t.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
List<string> list = new List<string>();
|
List<string> list = new List<string>();
|
||||||
|
@ -1283,7 +1276,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static string GetNonNestedOuterClasses(Type t)
|
internal static string GetNonNestedOuterClasses(Type t)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || t.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || t.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
List<string> list = new List<string>();
|
List<string> list = new List<string>();
|
||||||
|
@ -1304,7 +1297,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static SignatureAttribute GetSignature(MethodBase mb)
|
internal static SignatureAttribute GetSignature(MethodBase mb)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || mb.DeclaringType.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || mb.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(mb))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(mb))
|
||||||
|
@ -1324,7 +1317,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static SignatureAttribute GetSignature(Type type)
|
internal static SignatureAttribute GetSignature(Type type)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
||||||
|
@ -1346,7 +1339,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static SignatureAttribute GetSignature(FieldInfo fi)
|
internal static SignatureAttribute GetSignature(FieldInfo fi)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || fi.DeclaringType.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || fi.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(fi))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(fi))
|
||||||
|
@ -1366,7 +1359,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static InnerClassAttribute GetInnerClass(Type type)
|
internal static InnerClassAttribute GetInnerClass(Type type)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
||||||
|
@ -1386,7 +1379,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static RemappedInterfaceMethodAttribute[] GetRemappedInterfaceMethods(Type type)
|
internal static RemappedInterfaceMethodAttribute[] GetRemappedInterfaceMethods(Type type)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
List<RemappedInterfaceMethodAttribute> attrs = new List<RemappedInterfaceMethodAttribute>();
|
List<RemappedInterfaceMethodAttribute> attrs = new List<RemappedInterfaceMethodAttribute>();
|
||||||
|
@ -1409,7 +1402,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static RemappedTypeAttribute GetRemappedType(Type type)
|
internal static RemappedTypeAttribute GetRemappedType(Type type)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
||||||
|
@ -1429,7 +1422,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static RemappedClassAttribute[] GetRemappedClasses(Assembly coreAssembly)
|
internal static RemappedClassAttribute[] GetRemappedClasses(Assembly coreAssembly)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || coreAssembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || coreAssembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
List<RemappedClassAttribute> attrs = new List<RemappedClassAttribute>();
|
List<RemappedClassAttribute> attrs = new List<RemappedClassAttribute>();
|
||||||
|
@ -1452,7 +1445,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static string GetAnnotationAttributeType(Type type)
|
internal static string GetAnnotationAttributeType(Type type)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
||||||
|
@ -1475,7 +1468,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static bool IsDefined(Module mod, Type attribute)
|
internal static bool IsDefined(Module mod, Type attribute)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || mod.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || mod.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(mod))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(mod))
|
||||||
|
@ -1494,7 +1487,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static bool IsDefined(Assembly asm, Type attribute)
|
internal static bool IsDefined(Assembly asm, Type attribute)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || asm.ReflectionOnly)
|
if(JVM.IsStaticCompiler || asm.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(asm))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(asm))
|
||||||
|
@ -1512,7 +1505,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static bool IsDefined(Type type, Type attribute)
|
internal static bool IsDefined(Type type, Type attribute)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || type.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(type))
|
||||||
|
@ -1531,7 +1524,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static bool IsDefined(ParameterInfo pi, Type attribute)
|
internal static bool IsDefined(ParameterInfo pi, Type attribute)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || pi.Member.DeclaringType.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || pi.Member.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(pi))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(pi))
|
||||||
|
@ -1550,7 +1543,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static bool IsDefined(MemberInfo member, Type attribute)
|
internal static bool IsDefined(MemberInfo member, Type attribute)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || member.DeclaringType.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || member.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(member))
|
foreach(CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(member))
|
||||||
|
@ -1574,7 +1567,7 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static object[] GetJavaModuleAttributes(Module mod)
|
internal static object[] GetJavaModuleAttributes(Module mod)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && !COMPACT_FRAMEWORK
|
#if !COMPACT_FRAMEWORK
|
||||||
if(JVM.IsStaticCompiler || mod.Assembly.ReflectionOnly)
|
if(JVM.IsStaticCompiler || mod.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
ArrayList attrs = new ArrayList();
|
ArrayList attrs = new ArrayList();
|
||||||
|
@ -3031,13 +3024,11 @@ namespace IKVM.Internal
|
||||||
MethodBase mb = mw.GetMethod();
|
MethodBase mb = mw.GetMethod();
|
||||||
if(mb != null)
|
if(mb != null)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
if(mb.DeclaringType.Assembly.ReflectionOnly)
|
if(mb.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endif // WHIDBEY
|
|
||||||
object[] attr = mb.GetCustomAttributes(typeof(AnnotationDefaultAttribute), false);
|
object[] attr = mb.GetCustomAttributes(typeof(AnnotationDefaultAttribute), false);
|
||||||
if(attr.Length == 1)
|
if(attr.Length == 1)
|
||||||
{
|
{
|
||||||
|
@ -4615,31 +4606,21 @@ namespace IKVM.Internal
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if WHIDBEY
|
|
||||||
Type[] modreq = Type.EmptyTypes;
|
Type[] modreq = Type.EmptyTypes;
|
||||||
if(fld.IsVolatile)
|
if(fld.IsVolatile)
|
||||||
{
|
{
|
||||||
modreq = new Type[] { typeof(System.Runtime.CompilerServices.IsVolatile) };
|
modreq = new Type[] { typeof(System.Runtime.CompilerServices.IsVolatile) };
|
||||||
}
|
}
|
||||||
field = typeBuilder.DefineField(isWrappedFinal ? "__<>" + fieldName : fieldName, type, modreq, Type.EmptyTypes, attribs);
|
|
||||||
#else // WHIDBEY
|
|
||||||
// MONOBUG the __<> prefix for wrapped final fields is to work around a bug in mcs 1.1.17
|
// MONOBUG the __<> prefix for wrapped final fields is to work around a bug in mcs 1.1.17
|
||||||
// it crashes when it tries to lookup the property with the same name as the privatescope field
|
// it crashes when it tries to lookup the property with the same name as the privatescope field
|
||||||
// http://bugzilla.ximian.com/show_bug.cgi?id=79451
|
// http://bugzilla.ximian.com/show_bug.cgi?id=79451
|
||||||
field = typeBuilder.DefineField(isWrappedFinal ? "__<>" + fieldName : fieldName, type, attribs);
|
field = typeBuilder.DefineField(isWrappedFinal ? "__<>" + fieldName : fieldName, type, modreq, Type.EmptyTypes, attribs);
|
||||||
#endif // WHIDBEY
|
|
||||||
if(fld.IsTransient)
|
if(fld.IsTransient)
|
||||||
{
|
{
|
||||||
CustomAttributeBuilder transientAttrib = new CustomAttributeBuilder(typeof(NonSerializedAttribute).GetConstructor(Type.EmptyTypes), new object[0]);
|
CustomAttributeBuilder transientAttrib = new CustomAttributeBuilder(typeof(NonSerializedAttribute).GetConstructor(Type.EmptyTypes), new object[0]);
|
||||||
field.SetCustomAttribute(transientAttrib);
|
field.SetCustomAttribute(transientAttrib);
|
||||||
}
|
}
|
||||||
#if STATIC_COMPILER
|
#if STATIC_COMPILER
|
||||||
#if !WHIDBEY
|
|
||||||
if(fld.IsVolatile)
|
|
||||||
{
|
|
||||||
setModifiers = true;
|
|
||||||
}
|
|
||||||
#endif // !WHIDBEY
|
|
||||||
// Instance fields can also have a ConstantValue attribute (and are inlined by the compiler),
|
// Instance fields can also have a ConstantValue attribute (and are inlined by the compiler),
|
||||||
// and ikvmstub has to export them, so we have to add a custom attribute.
|
// and ikvmstub has to export them, so we have to add a custom attribute.
|
||||||
if(constantValue != null)
|
if(constantValue != null)
|
||||||
|
@ -6110,7 +6091,11 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
private class JniBuilder
|
private class JniBuilder
|
||||||
{
|
{
|
||||||
|
#if STATIC_COMPILER
|
||||||
|
private static readonly Type localRefStructType = StaticCompiler.GetType("IKVM.Runtime.JNI.Frame");
|
||||||
|
#else
|
||||||
private static readonly Type localRefStructType = JVM.LoadType(typeof(IKVM.Runtime.JNI.Frame));
|
private static readonly Type localRefStructType = JVM.LoadType(typeof(IKVM.Runtime.JNI.Frame));
|
||||||
|
#endif
|
||||||
private static readonly MethodInfo jniFuncPtrMethod = localRefStructType.GetMethod("GetFuncPtr");
|
private static readonly MethodInfo jniFuncPtrMethod = localRefStructType.GetMethod("GetFuncPtr");
|
||||||
private static readonly MethodInfo enterLocalRefStruct = localRefStructType.GetMethod("Enter");
|
private static readonly MethodInfo enterLocalRefStruct = localRefStructType.GetMethod("Enter");
|
||||||
private static readonly MethodInfo leaveLocalRefStruct = localRefStructType.GetMethod("Leave");
|
private static readonly MethodInfo leaveLocalRefStruct = localRefStructType.GetMethod("Leave");
|
||||||
|
@ -6961,9 +6946,7 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
AttributeHelper.SetEditorBrowsableNever((MethodBuilder)method);
|
AttributeHelper.SetEditorBrowsableNever((MethodBuilder)method);
|
||||||
}
|
}
|
||||||
#if WHIDBEY
|
// TODO on WHIDBEY apply CompilerGeneratedAttribute
|
||||||
// TODO apply CompilerGeneratedAttribute
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if(m.DeprecatedAttribute)
|
if(m.DeprecatedAttribute)
|
||||||
{
|
{
|
||||||
|
@ -7982,7 +7965,7 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
ArrayList methods = new ArrayList();
|
ArrayList methods = new ArrayList();
|
||||||
ArrayList fields = new ArrayList();
|
ArrayList fields = new ArrayList();
|
||||||
MemberInfo[] members = FilterDuplicates(type.GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance));
|
MemberInfo[] members = type.GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
|
||||||
foreach(MemberInfo m in members)
|
foreach(MemberInfo m in members)
|
||||||
{
|
{
|
||||||
if(!AttributeHelper.IsHideFromJava(m))
|
if(!AttributeHelper.IsHideFromJava(m))
|
||||||
|
@ -8488,40 +8471,12 @@ namespace IKVM.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MemberInfo[] FilterDuplicates(MemberInfo[] members)
|
|
||||||
{
|
|
||||||
#if !WHIDBEY
|
|
||||||
// FXBUG on .NET 1.1 methods that explicitly override another method are returned twice, so we filter them here
|
|
||||||
for(int i = 1; i < members.Length; i++)
|
|
||||||
{
|
|
||||||
MethodBase m1 = members[i] as MethodBase;
|
|
||||||
if(m1 != null)
|
|
||||||
{
|
|
||||||
for(int j = 0; j < i; j++)
|
|
||||||
{
|
|
||||||
MethodBase m2 = members[j] as MethodBase;
|
|
||||||
if(m2 != null && m1.MethodHandle.Value == m2.MethodHandle.Value)
|
|
||||||
{
|
|
||||||
MemberInfo[] newArray = new MemberInfo[members.Length - 1];
|
|
||||||
Array.Copy(members, newArray, i);
|
|
||||||
Array.Copy(members, i + 1, newArray, i, newArray.Length - i);
|
|
||||||
members = newArray;
|
|
||||||
i--;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return members;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LazyPublishMembers()
|
protected override void LazyPublishMembers()
|
||||||
{
|
{
|
||||||
clinitMethod = type.GetMethod("__<clinit>", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
|
clinitMethod = type.GetMethod("__<clinit>", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
|
||||||
ArrayList methods = new ArrayList();
|
ArrayList methods = new ArrayList();
|
||||||
ArrayList fields = new ArrayList();
|
ArrayList fields = new ArrayList();
|
||||||
MemberInfo[] members = FilterDuplicates(type.GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance));
|
MemberInfo[] members = type.GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
|
||||||
foreach(MemberInfo m in members)
|
foreach(MemberInfo m in members)
|
||||||
{
|
{
|
||||||
if(!AttributeHelper.IsHideFromJava(m))
|
if(!AttributeHelper.IsHideFromJava(m))
|
||||||
|
@ -8849,39 +8804,33 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal override object[] GetDeclaredAnnotations()
|
internal override object[] GetDeclaredAnnotations()
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
if(type.Assembly.ReflectionOnly)
|
if(type.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO on Whidbey this must be implemented
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endif // WHIDBEY
|
|
||||||
return type.GetCustomAttributes(false);
|
return type.GetCustomAttributes(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override object[] GetMethodAnnotations(MethodWrapper mw)
|
internal override object[] GetMethodAnnotations(MethodWrapper mw)
|
||||||
{
|
{
|
||||||
MethodBase mb = mw.GetMethod();
|
MethodBase mb = mw.GetMethod();
|
||||||
#if WHIDBEY
|
|
||||||
if(mb.DeclaringType.Assembly.ReflectionOnly)
|
if(mb.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO on Whidbey this must be implemented
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endif // WHIDBEY
|
|
||||||
return mb.GetCustomAttributes(false);
|
return mb.GetCustomAttributes(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override object[][] GetParameterAnnotations(MethodWrapper mw)
|
internal override object[][] GetParameterAnnotations(MethodWrapper mw)
|
||||||
{
|
{
|
||||||
MethodBase mb = mw.GetMethod();
|
MethodBase mb = mw.GetMethod();
|
||||||
#if WHIDBEY
|
|
||||||
if(mb.DeclaringType.Assembly.ReflectionOnly)
|
if(mb.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO on Whidbey this must be implemented
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endif // WHIDBEY
|
|
||||||
ParameterInfo[] parameters = mb.GetParameters();
|
ParameterInfo[] parameters = mb.GetParameters();
|
||||||
int skip = 0;
|
int skip = 0;
|
||||||
if(mb.IsStatic && !mw.IsStatic && mw.Name != "<init>")
|
if(mb.IsStatic && !mw.IsStatic && mw.Name != "<init>")
|
||||||
|
@ -8901,25 +8850,21 @@ namespace IKVM.Internal
|
||||||
FieldInfo field = fw.GetField();
|
FieldInfo field = fw.GetField();
|
||||||
if(field != null)
|
if(field != null)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
if (field.DeclaringType.Assembly.ReflectionOnly)
|
if (field.DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO on Whidbey this must be implemented
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endif // WHIDBEY
|
|
||||||
return field.GetCustomAttributes(false);
|
return field.GetCustomAttributes(false);
|
||||||
}
|
}
|
||||||
GetterFieldWrapper getter = fw as GetterFieldWrapper;
|
GetterFieldWrapper getter = fw as GetterFieldWrapper;
|
||||||
if(getter != null)
|
if(getter != null)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
if (getter.GetGetter().DeclaringType.Assembly.ReflectionOnly)
|
if (getter.GetGetter().DeclaringType.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO on Whidbey this must be implemented
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endif // WHIDBEY
|
|
||||||
return getter.GetGetter().GetCustomAttributes(false);
|
return getter.GetGetter().GetCustomAttributes(false);
|
||||||
}
|
}
|
||||||
return new object[0];
|
return new object[0];
|
||||||
|
@ -10292,7 +10237,6 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
private AttributeUsageAttribute GetAttributeUsage()
|
private AttributeUsageAttribute GetAttributeUsage()
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
AttributeTargets validOn = AttributeTargets.All;
|
AttributeTargets validOn = AttributeTargets.All;
|
||||||
bool allowMultiple = false;
|
bool allowMultiple = false;
|
||||||
bool inherited = true;
|
bool inherited = true;
|
||||||
|
@ -10321,14 +10265,6 @@ namespace IKVM.Internal
|
||||||
attr.AllowMultiple = allowMultiple;
|
attr.AllowMultiple = allowMultiple;
|
||||||
attr.Inherited = inherited;
|
attr.Inherited = inherited;
|
||||||
return attr;
|
return attr;
|
||||||
#else // WHIDBEY
|
|
||||||
object[] attr = attributeType.GetCustomAttributes(typeof(AttributeUsageAttribute), false);
|
|
||||||
if(attr.Length == 1)
|
|
||||||
{
|
|
||||||
return (AttributeUsageAttribute)attr[0];
|
|
||||||
}
|
|
||||||
return new AttributeUsageAttribute(AttributeTargets.All);
|
|
||||||
#endif // WHIDBEY
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !STATIC_COMPILER
|
#if !STATIC_COMPILER
|
||||||
|
@ -10969,11 +10905,7 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
name = "_" + name;
|
name = "_" + name;
|
||||||
}
|
}
|
||||||
#if WHIDBEY
|
|
||||||
object val = EnumValueFieldWrapper.GetEnumPrimitiveValue(underlyingType, fields[i].GetRawConstantValue());
|
object val = EnumValueFieldWrapper.GetEnumPrimitiveValue(underlyingType, fields[i].GetRawConstantValue());
|
||||||
#else
|
|
||||||
object val = EnumValueFieldWrapper.GetEnumPrimitiveValue(fields[i].GetValue(null));
|
|
||||||
#endif
|
|
||||||
fieldsList.Add(new ConstantFieldWrapper(this, fieldType, name, fieldType.SigName, Modifiers.Public | Modifiers.Static | Modifiers.Final, fields[i], val, MemberFlags.None));
|
fieldsList.Add(new ConstantFieldWrapper(this, fieldType, name, fieldType.SigName, Modifiers.Public | Modifiers.Static | Modifiers.Final, fields[i], val, MemberFlags.None));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11601,31 +11533,29 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal override object[] GetDeclaredAnnotations()
|
internal override object[] GetDeclaredAnnotations()
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
if(type.Assembly.ReflectionOnly)
|
if(type.Assembly.ReflectionOnly)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO on Whidbey this must be implemented
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return type.GetCustomAttributes(false);
|
return type.GetCustomAttributes(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override object[] GetFieldAnnotations(FieldWrapper fw)
|
internal override object[] GetFieldAnnotations(FieldWrapper fw)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO on Whidbey this must be implemented
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override object[] GetMethodAnnotations(MethodWrapper mw)
|
internal override object[] GetMethodAnnotations(MethodWrapper mw)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO on Whidbey this must be implemented
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override object[][] GetParameterAnnotations(MethodWrapper mw)
|
internal override object[][] GetParameterAnnotations(MethodWrapper mw)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO on Whidbey this must be implemented
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11766,7 +11696,6 @@ namespace IKVM.Internal
|
||||||
|
|
||||||
internal static Type MakeArrayType(Type type, int dims)
|
internal static Type MakeArrayType(Type type, int dims)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
// NOTE this is not just an optimization, but it is also required to
|
// NOTE this is not just an optimization, but it is also required to
|
||||||
// make sure that ReflectionOnly types stay ReflectionOnly types
|
// make sure that ReflectionOnly types stay ReflectionOnly types
|
||||||
// (in particular instantiations of generic types from mscorlib that
|
// (in particular instantiations of generic types from mscorlib that
|
||||||
|
@ -11776,39 +11705,6 @@ namespace IKVM.Internal
|
||||||
type = type.MakeArrayType();
|
type = type.MakeArrayType();
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
#else // WHIDBEY
|
|
||||||
string name = type.FullName + "[]";
|
|
||||||
for(int i = 1; i < dims; i++)
|
|
||||||
{
|
|
||||||
name += "[]";
|
|
||||||
}
|
|
||||||
#if !COMPACT_FRAMEWORK
|
|
||||||
ModuleBuilder mb = type.Module as ModuleBuilder;
|
|
||||||
if(mb != null)
|
|
||||||
{
|
|
||||||
// FXBUG ModuleBuilder.GetType() is broken on .NET 1.1, it fires a TypeResolveEvent when
|
|
||||||
// you try to construct an array type from an unfinished type. I don't think it should
|
|
||||||
// do that. We have to work around that by setting a global flag (yuck) to prevent us
|
|
||||||
// from responding to the TypeResolveEvent.
|
|
||||||
lock(DynamicClassLoader.arrayConstructionLock)
|
|
||||||
{
|
|
||||||
DynamicClassLoader.arrayConstructionHack = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return mb.GetType(name);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
DynamicClassLoader.arrayConstructionHack = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif // !COMPACT_FRAMEWORK
|
|
||||||
{
|
|
||||||
return type.Assembly.GetType(name, true);
|
|
||||||
}
|
|
||||||
#endif // WHIDBEY
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ using System.Reflection;
|
||||||
|
|
||||||
namespace IKVM.Attributes
|
namespace IKVM.Attributes
|
||||||
{
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Delegate)]
|
||||||
public sealed class SourceFileAttribute : Attribute
|
public sealed class SourceFileAttribute : Attribute
|
||||||
{
|
{
|
||||||
private string file;
|
private string file;
|
||||||
|
@ -44,6 +45,7 @@ namespace IKVM.Attributes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor)]
|
||||||
public sealed class LineNumberTableAttribute : Attribute
|
public sealed class LineNumberTableAttribute : Attribute
|
||||||
{
|
{
|
||||||
private byte[] table;
|
private byte[] table;
|
||||||
|
@ -367,7 +369,7 @@ namespace IKVM.Attributes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Assembly)]
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Assembly)]
|
||||||
public sealed class NoPackagePrefixAttribute : Attribute
|
public sealed class NoPackagePrefixAttribute : Attribute
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,206 +48,6 @@ using jlrField = java.lang.reflect.Field;
|
||||||
|
|
||||||
namespace IKVM.NativeCode.gnu.java.net.protocol.ikvmres
|
namespace IKVM.NativeCode.gnu.java.net.protocol.ikvmres
|
||||||
{
|
{
|
||||||
#if !WHIDBEY
|
|
||||||
class LZInputStream : Stream
|
|
||||||
{
|
|
||||||
private Stream inp;
|
|
||||||
private int[] ptr_tbl;
|
|
||||||
private int[] char_tbl;
|
|
||||||
private int[] stack;
|
|
||||||
private int table_size;
|
|
||||||
private int count;
|
|
||||||
private int bitoff;
|
|
||||||
private int bitbuf;
|
|
||||||
private int prev = -1;
|
|
||||||
private int bits;
|
|
||||||
private int cc;
|
|
||||||
private int fc;
|
|
||||||
private int sp;
|
|
||||||
|
|
||||||
public LZInputStream(Stream inp)
|
|
||||||
{
|
|
||||||
this.inp = inp;
|
|
||||||
bitoff = 0;
|
|
||||||
count = 0;
|
|
||||||
table_size = 256;
|
|
||||||
bits = 9;
|
|
||||||
ptr_tbl = new int[table_size];
|
|
||||||
char_tbl = new int[table_size];
|
|
||||||
stack = new int[table_size];
|
|
||||||
sp = 0;
|
|
||||||
cc = prev = incode();
|
|
||||||
stack[sp++] = cc;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int read()
|
|
||||||
{
|
|
||||||
if (sp == 0)
|
|
||||||
{
|
|
||||||
if (stack.Length != table_size)
|
|
||||||
{
|
|
||||||
stack = new int[table_size];
|
|
||||||
}
|
|
||||||
int ic = cc = incode();
|
|
||||||
if (cc == -1)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (count >= 0 && cc >= count + 256)
|
|
||||||
{
|
|
||||||
stack[sp++] = fc;
|
|
||||||
cc = prev;
|
|
||||||
ic = find(prev, fc);
|
|
||||||
}
|
|
||||||
while (cc >= 256)
|
|
||||||
{
|
|
||||||
stack[sp++] = char_tbl[cc - 256];
|
|
||||||
cc = ptr_tbl[cc - 256];
|
|
||||||
}
|
|
||||||
stack[sp++] = cc;
|
|
||||||
fc = cc;
|
|
||||||
if (count >= 0)
|
|
||||||
{
|
|
||||||
ptr_tbl[count] = prev;
|
|
||||||
char_tbl[count] = fc;
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
if (count == table_size)
|
|
||||||
{
|
|
||||||
count = -1;
|
|
||||||
if (bits == 12)
|
|
||||||
{
|
|
||||||
table_size = 256;
|
|
||||||
bits = 9;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bits++;
|
|
||||||
table_size = (1 << bits) - 256;
|
|
||||||
}
|
|
||||||
ptr_tbl = null;
|
|
||||||
char_tbl = null;
|
|
||||||
ptr_tbl = new int[table_size];
|
|
||||||
char_tbl= new int[table_size];
|
|
||||||
}
|
|
||||||
prev = ic;
|
|
||||||
}
|
|
||||||
return stack[--sp] & 0xFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int find(int p, int c)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
if (ptr_tbl[i] == p && char_tbl[i] == c)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return i + 256;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int incode()
|
|
||||||
{
|
|
||||||
while (bitoff < bits)
|
|
||||||
{
|
|
||||||
int v = inp.ReadByte();
|
|
||||||
if (v == -1)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
bitbuf |= (v & 0xFF) << bitoff;
|
|
||||||
bitoff += 8;
|
|
||||||
}
|
|
||||||
bitoff -= bits;
|
|
||||||
int result = bitbuf;
|
|
||||||
bitbuf >>= bits;
|
|
||||||
result -= bitbuf << bits;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int Read(byte[] b, int off, int len)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
for (; i < len ; i++)
|
|
||||||
{
|
|
||||||
int r = read();
|
|
||||||
if(r == -1)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
b[off + i] = (byte)r;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanRead
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanSeek
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanWrite
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Flush()
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Length
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Position
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Seek(long offset, SeekOrigin origin)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetLength(long value)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Write(byte[] buffer, int offset, int count)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // !WHIDBEY
|
|
||||||
|
|
||||||
public class Handler
|
public class Handler
|
||||||
{
|
{
|
||||||
public static Stream ReadResourceFromAssemblyImpl(Assembly asm, string resource)
|
public static Stream ReadResourceFromAssemblyImpl(Assembly asm, string resource)
|
||||||
|
@ -260,7 +60,6 @@ namespace IKVM.NativeCode.gnu.java.net.protocol.ikvmres
|
||||||
{
|
{
|
||||||
return asm.GetManifestResourceStream(mangledName);
|
return asm.GetManifestResourceStream(mangledName);
|
||||||
}
|
}
|
||||||
#if WHIDBEY
|
|
||||||
Stream s = asm.GetManifestResourceStream(mangledName);
|
Stream s = asm.GetManifestResourceStream(mangledName);
|
||||||
if(s == null)
|
if(s == null)
|
||||||
{
|
{
|
||||||
|
@ -279,39 +78,6 @@ namespace IKVM.NativeCode.gnu.java.net.protocol.ikvmres
|
||||||
Tracer.Error(Tracer.ClassLoading, "Resource \"{0}\" in {1} has an unsupported encoding", resource, asm.FullName);
|
Tracer.Error(Tracer.ClassLoading, "Resource \"{0}\" in {1} has an unsupported encoding", resource, asm.FullName);
|
||||||
throw new IOException("Unsupported resource encoding for resource " + resource + " found in assembly " + asm.FullName);
|
throw new IOException("Unsupported resource encoding for resource " + resource + " found in assembly " + asm.FullName);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
using(Stream s = asm.GetManifestResourceStream(mangledName))
|
|
||||||
{
|
|
||||||
if(s == null)
|
|
||||||
{
|
|
||||||
Tracer.Warning(Tracer.ClassLoading, "Resource \"{0}\" not found in {1}", resource, asm.FullName);
|
|
||||||
throw new FileNotFoundException("resource " + resource + " not found in assembly " + asm.FullName);
|
|
||||||
}
|
|
||||||
using(System.Resources.ResourceReader r = new System.Resources.ResourceReader(s))
|
|
||||||
{
|
|
||||||
foreach(DictionaryEntry de in r)
|
|
||||||
{
|
|
||||||
if((string)de.Key == "lz")
|
|
||||||
{
|
|
||||||
Tracer.Info(Tracer.ClassLoading, "Reading compressed resource \"{0}\" from {1}", resource, asm.FullName);
|
|
||||||
return new LZInputStream(new MemoryStream((byte[])de.Value));
|
|
||||||
}
|
|
||||||
else if((string)de.Key == "ikvm")
|
|
||||||
{
|
|
||||||
Tracer.Info(Tracer.ClassLoading, "Reading resource \"{0}\" from {1}", resource, asm.FullName);
|
|
||||||
return new MemoryStream((byte[])de.Value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Tracer.Error(Tracer.ClassLoading, "Resource \"{0}\" in {1} has an unsupported encoding", resource, asm.FullName);
|
|
||||||
throw new IOException("Unsupported resource encoding " + de.Key + " for resource " + resource + " found in assembly " + asm.FullName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Tracer.Error(Tracer.ClassLoading, "Resource \"{0}\" in {1} is invalid", resource, asm.FullName);
|
|
||||||
throw new IOException("Invalid resource " + resource + " found in assembly " + asm.FullName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static object LoadClassFromAssembly(Assembly asm, string className)
|
public static object LoadClassFromAssembly(Assembly asm, string className)
|
||||||
|
@ -326,12 +92,10 @@ namespace IKVM.NativeCode.gnu.java.net.protocol.ikvmres
|
||||||
|
|
||||||
public static Assembly LoadAssembly(string name)
|
public static Assembly LoadAssembly(string name)
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
if(name.EndsWith("[ReflectionOnly]"))
|
if(name.EndsWith("[ReflectionOnly]"))
|
||||||
{
|
{
|
||||||
return Assembly.ReflectionOnlyLoad(name.Substring(0, name.Length - 16));
|
return Assembly.ReflectionOnlyLoad(name.Substring(0, name.Length - 16));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return Assembly.Load(name);
|
return Assembly.Load(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ using System.Reflection;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.SymbolStore;
|
using System.Diagnostics.SymbolStore;
|
||||||
using IKVM.Runtime;
|
|
||||||
using IKVM.Attributes;
|
using IKVM.Attributes;
|
||||||
using IKVM.Internal;
|
using IKVM.Internal;
|
||||||
|
|
||||||
|
@ -82,7 +81,7 @@ class ByteCodeHelperMethods
|
||||||
#if STATIC_COMPILER
|
#if STATIC_COMPILER
|
||||||
Type typeofByteCodeHelper = StaticCompiler.GetType("IKVM.Runtime.ByteCodeHelper");
|
Type typeofByteCodeHelper = StaticCompiler.GetType("IKVM.Runtime.ByteCodeHelper");
|
||||||
#else
|
#else
|
||||||
Type typeofByteCodeHelper = typeof(ByteCodeHelper);
|
Type typeofByteCodeHelper = typeof(IKVM.Runtime.ByteCodeHelper);
|
||||||
#endif
|
#endif
|
||||||
GetClassFromTypeHandle = typeofByteCodeHelper.GetMethod("GetClassFromTypeHandle");
|
GetClassFromTypeHandle = typeofByteCodeHelper.GetMethod("GetClassFromTypeHandle");
|
||||||
multianewarray = typeofByteCodeHelper.GetMethod("multianewarray");
|
multianewarray = typeofByteCodeHelper.GetMethod("multianewarray");
|
||||||
|
@ -3361,10 +3360,7 @@ class Compiler
|
||||||
}
|
}
|
||||||
if(type == null
|
if(type == null
|
||||||
|| !type.IsValueType
|
|| !type.IsValueType
|
||||||
#if WHIDBEY
|
|| type.StructLayoutAttribute.Pack != 1 || type.StructLayoutAttribute.Size != length)
|
||||||
|| type.StructLayoutAttribute.Pack != 1 || type.StructLayoutAttribute.Size != length
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// the type that we found doesn't match (must mean we've compiled a Java type with that name),
|
// the type that we found doesn't match (must mean we've compiled a Java type with that name),
|
||||||
// so we fall back to the string approach
|
// so we fall back to the string approach
|
||||||
|
|
|
@ -1,393 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (C) 2007 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
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !WHIDBEY
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Management;
|
|
||||||
using IPAddress = System.Net.IPAddress;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is a .NET 1.1 compatible partial implementation of the .NET 2.0 System.Net.NetworkInformation namespace.
|
|
||||||
* It only provides the APIs needed by the NetworkInterface class in openjdk.cs.
|
|
||||||
* It uses WMI (through the System.Management assembly) to query the relevant information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace System.Net.NetworkInformation
|
|
||||||
{
|
|
||||||
enum NetworkInterfaceType
|
|
||||||
{
|
|
||||||
Unknown = -1,
|
|
||||||
Ethernet = 0,
|
|
||||||
TokenRing = 1,
|
|
||||||
Fddi = 2,
|
|
||||||
Loopback = -2,
|
|
||||||
Ppp = 3,
|
|
||||||
Slip = -3
|
|
||||||
}
|
|
||||||
|
|
||||||
enum OperationalStatus
|
|
||||||
{
|
|
||||||
Unknown,
|
|
||||||
Up
|
|
||||||
}
|
|
||||||
|
|
||||||
class UnicastIPAddressInformation
|
|
||||||
{
|
|
||||||
private IPAddress address;
|
|
||||||
|
|
||||||
internal UnicastIPAddressInformation(IPAddress address)
|
|
||||||
{
|
|
||||||
this.address = address;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal IPAddress Address
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class UnicastIPAddressInformationCollection
|
|
||||||
{
|
|
||||||
private IPAddress[] addresses;
|
|
||||||
|
|
||||||
internal UnicastIPAddressInformationCollection(IPAddress[] addresses)
|
|
||||||
{
|
|
||||||
this.addresses = addresses;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal UnicastIPAddressInformation this[int index]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new UnicastIPAddressInformation(addresses[index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal int Count
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return addresses.Length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class IPAddressCollection : IEnumerable
|
|
||||||
{
|
|
||||||
private IPAddress[] addresses;
|
|
||||||
|
|
||||||
internal IPAddressCollection(IPAddress[] addresses)
|
|
||||||
{
|
|
||||||
this.addresses = addresses;
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
|
||||||
{
|
|
||||||
return addresses.GetEnumerator();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class IPInterfaceProperties
|
|
||||||
{
|
|
||||||
private UnicastIPAddressInformationCollection addresses;
|
|
||||||
internal IPv4InterfaceProperties v4props;
|
|
||||||
private IPAddressCollection dnsservers;
|
|
||||||
private string dnssuffix;
|
|
||||||
|
|
||||||
internal IPInterfaceProperties(IPAddress[] addresses, int mtu, string dnssuffix, IPAddress[] dnsservers)
|
|
||||||
{
|
|
||||||
this.addresses = new UnicastIPAddressInformationCollection(addresses);
|
|
||||||
this.v4props = new IPv4InterfaceProperties(mtu);
|
|
||||||
this.dnsservers = new IPAddressCollection(dnsservers);
|
|
||||||
this.dnssuffix = dnssuffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal UnicastIPAddressInformationCollection UnicastAddresses
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return addresses;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal IPv4InterfaceProperties GetIPv4Properties()
|
|
||||||
{
|
|
||||||
return v4props;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal IPAddressCollection DnsAddresses
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return dnsservers;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal string DnsSuffix
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return dnssuffix;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class IPv4InterfaceProperties
|
|
||||||
{
|
|
||||||
private int mtu;
|
|
||||||
|
|
||||||
internal IPv4InterfaceProperties(int mtu)
|
|
||||||
{
|
|
||||||
this.mtu = mtu;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal int Mtu
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return mtu;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class PhysicalAddress
|
|
||||||
{
|
|
||||||
private byte[] mac;
|
|
||||||
|
|
||||||
internal PhysicalAddress(byte[] mac)
|
|
||||||
{
|
|
||||||
this.mac = mac;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal byte[] GetAddressBytes()
|
|
||||||
{
|
|
||||||
return mac == null ? null : (byte[])mac.Clone();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class NetworkInterface
|
|
||||||
{
|
|
||||||
private uint interfaceIndex;
|
|
||||||
private string description;
|
|
||||||
private IPInterfaceProperties props;
|
|
||||||
private NetworkInterfaceType type = NetworkInterfaceType.Unknown;
|
|
||||||
private OperationalStatus status = OperationalStatus.Unknown;
|
|
||||||
private byte[] mac;
|
|
||||||
|
|
||||||
private NetworkInterface(uint interfaceIndex, string description, IPAddress[] addresses, int mtu, byte[] mac, string dnssuffix, IPAddress[] dnsservers)
|
|
||||||
{
|
|
||||||
this.interfaceIndex = interfaceIndex;
|
|
||||||
this.description = description;
|
|
||||||
this.props = new IPInterfaceProperties(addresses, mtu, dnssuffix, dnsservers);
|
|
||||||
this.mac = mac;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static NetworkInterface[] GetAllNetworkInterfaces()
|
|
||||||
{
|
|
||||||
NetworkInterface[] netif;
|
|
||||||
using (ManagementClass mgmt = new ManagementClass("Win32_NetworkAdapterConfiguration"))
|
|
||||||
{
|
|
||||||
ArrayList ifaces = new ArrayList();
|
|
||||||
// loopback isn't reported, so we make it up
|
|
||||||
NetworkInterface loopback = new NetworkInterface(0xFFFFFFFF, "Software Loopback Interface 1", new IPAddress[] { IPAddress.Loopback }, -1, new byte[0], "", new IPAddress[0]);
|
|
||||||
loopback.type = NetworkInterfaceType.Loopback;
|
|
||||||
loopback.status = OperationalStatus.Up;
|
|
||||||
ifaces.Add(loopback);
|
|
||||||
using (ManagementObjectCollection moc = mgmt.GetInstances())
|
|
||||||
{
|
|
||||||
foreach (ManagementObject obj in moc)
|
|
||||||
{
|
|
||||||
PropertyDataCollection props = obj.Properties;
|
|
||||||
PropertyData ipaddress = props["IPAddress"];
|
|
||||||
string[] addresses = (string[])ipaddress.Value;
|
|
||||||
IPAddress[] addr;
|
|
||||||
if (addresses != null)
|
|
||||||
{
|
|
||||||
addr = new IPAddress[addresses.Length];
|
|
||||||
for (int i = 0; i < addresses.Length; i++)
|
|
||||||
{
|
|
||||||
addr[i] = IPAddress.Parse(addresses[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
addr = new IPAddress[0];
|
|
||||||
}
|
|
||||||
int mtu = -1;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// TODO this doesn't work, the MTU value is always null
|
|
||||||
mtu = (int)(uint)props["MTU"].Value;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
byte[] mac = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mac = ParseMacAddress((string)props["MACAddress"].Value);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
string dnssuffix = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dnssuffix = ((string[])props["DNSDomainSuffixSearchOrder"].Value)[0];
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
IPAddress[] dnsservers;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string[] dnsaddresses = (string[])props["DNSServerSearchOrder"].Value;
|
|
||||||
dnsservers = new IPAddress[dnsaddresses.Length];
|
|
||||||
for (int i = 0; i < dnsaddresses.Length; i++)
|
|
||||||
{
|
|
||||||
dnsservers[i] = IPAddress.Parse(dnsaddresses[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
dnsservers = new IPAddress[0];
|
|
||||||
}
|
|
||||||
ifaces.Add(new NetworkInterface((uint)props["InterfaceIndex"].Value, (string)props["Description"].Value, addr, mtu, mac, dnssuffix, dnsservers));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
netif = (NetworkInterface[])ifaces.ToArray(typeof(NetworkInterface));
|
|
||||||
}
|
|
||||||
using (ManagementClass mgmt = new ManagementClass("Win32_NetworkAdapter"))
|
|
||||||
{
|
|
||||||
using (ManagementObjectCollection moc = mgmt.GetInstances())
|
|
||||||
{
|
|
||||||
foreach (ManagementObject obj in moc)
|
|
||||||
{
|
|
||||||
PropertyDataCollection props = obj.Properties;
|
|
||||||
uint interfaceIndex = (uint)props["InterfaceIndex"].Value;
|
|
||||||
NetworkInterfaceType type = NetworkInterfaceType.Unknown;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
type = (NetworkInterfaceType)(ushort)props["AdapterTypeID"].Value;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
OperationalStatus status = OperationalStatus.Unknown;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((ushort)props["NetConnectionStatus"].Value == 2)
|
|
||||||
{
|
|
||||||
status = OperationalStatus.Up;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
for (int i = 0; i < netif.Length; i++)
|
|
||||||
{
|
|
||||||
if (netif[i].interfaceIndex == interfaceIndex)
|
|
||||||
{
|
|
||||||
netif[i].type = type;
|
|
||||||
netif[i].status = status;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return netif;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] ParseMacAddress(string mac)
|
|
||||||
{
|
|
||||||
string[] split = mac.Split(':');
|
|
||||||
byte[] bytes = new byte[split.Length];
|
|
||||||
for (int i = 0; i < split.Length; i++)
|
|
||||||
{
|
|
||||||
const string digits = "0123456789ABCDEF";
|
|
||||||
if (split[i].Length != 2)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
int d0 = digits.IndexOf(char.ToUpper(split[i][0]));
|
|
||||||
int d1 = digits.IndexOf(char.ToUpper(split[i][1]));
|
|
||||||
if (d0 == -1 || d1 == -1)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
bytes[i] = (byte)(d0 * 16 + d1);
|
|
||||||
}
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal string Description
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal NetworkInterfaceType NetworkInterfaceType
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal IPInterfaceProperties GetIPProperties()
|
|
||||||
{
|
|
||||||
return props;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal OperationalStatus OperationalStatus
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal bool SupportsMulticast
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// TODO I don't know how to query this
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal PhysicalAddress GetPhysicalAddress()
|
|
||||||
{
|
|
||||||
return new PhysicalAddress(mac);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // !WHIDBEY
|
|
|
@ -121,56 +121,11 @@ using ssaGetPropertyAction = sun.security.action.GetPropertyAction;
|
||||||
using sndResolverConfigurationImpl = sun.net.dns.ResolverConfigurationImpl;
|
using sndResolverConfigurationImpl = sun.net.dns.ResolverConfigurationImpl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WHIDBEY
|
|
||||||
sealed class DynamicMethodSupport
|
sealed class DynamicMethodSupport
|
||||||
{
|
{
|
||||||
// MONOBUG as of Mono 1.2.5.1, DynamicMethod is too broken to be used
|
// MONOBUG as of Mono 1.2.5.1, DynamicMethod is too broken to be used
|
||||||
internal static readonly bool Enabled = Type.GetType("Mono.Runtime") == null;
|
internal static readonly bool Enabled = Type.GetType("Mono.Runtime") == null;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
sealed class DynamicMethodSupport
|
|
||||||
{
|
|
||||||
internal static readonly bool Enabled = Environment.Version.Major >= 2 && Type.GetType("Mono.Runtime") == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class DynamicMethod
|
|
||||||
{
|
|
||||||
private static ConstructorInfo ctor1;
|
|
||||||
private static ConstructorInfo ctor2;
|
|
||||||
private static MethodInfo createMethod;
|
|
||||||
private static MethodInfo getILGenMethod;
|
|
||||||
private object dm;
|
|
||||||
|
|
||||||
static DynamicMethod()
|
|
||||||
{
|
|
||||||
Type type = Type.GetType("System.Reflection.Emit.DynamicMethod", true);
|
|
||||||
ctor1 = type.GetConstructor(new Type[] { typeof(string), typeof(MethodAttributes), typeof(CallingConventions), typeof(Type), typeof(Type[]), typeof(Module), typeof(bool) });
|
|
||||||
ctor2 = type.GetConstructor(new Type[] { typeof(string), typeof(Type), typeof(Type[]), typeof(Type) });
|
|
||||||
createMethod = type.GetMethod("CreateDelegate", new Type[] { typeof(Type) });
|
|
||||||
getILGenMethod = type.GetMethod("GetILGenerator", new Type[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal DynamicMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Module owner, bool skipVisibility)
|
|
||||||
{
|
|
||||||
dm = ctor1.Invoke(new object[] { name, attributes, callingConvention, returnType, parameterTypes, owner, skipVisibility });
|
|
||||||
}
|
|
||||||
|
|
||||||
internal DynamicMethod(string name, Type returnType, Type[] parameterTypes, Type owner)
|
|
||||||
{
|
|
||||||
dm = ctor2.Invoke(new object[] { name, returnType, parameterTypes, owner });
|
|
||||||
}
|
|
||||||
|
|
||||||
internal ILGenerator GetILGenerator()
|
|
||||||
{
|
|
||||||
return (ILGenerator)getILGenMethod.Invoke(dm, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Delegate CreateDelegate(Type delegateType)
|
|
||||||
{
|
|
||||||
return (Delegate)createMethod.Invoke(dm, new object[] { delegateType });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace IKVM.Runtime
|
namespace IKVM.Runtime
|
||||||
{
|
{
|
||||||
|
@ -4563,11 +4518,7 @@ namespace IKVM.NativeCode.java
|
||||||
#else
|
#else
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
System.Net.IPAddress[] addr = System.Net.Dns.GetHostAddresses(hostname);
|
System.Net.IPAddress[] addr = System.Net.Dns.GetHostAddresses(hostname);
|
||||||
#else
|
|
||||||
System.Net.IPAddress[] addr = System.Net.Dns.Resolve(hostname).AddressList;
|
|
||||||
#endif
|
|
||||||
ArrayList addresses = new ArrayList();
|
ArrayList addresses = new ArrayList();
|
||||||
for (int i = 0; i < addr.Length; i++)
|
for (int i = 0; i < addr.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -4682,11 +4633,7 @@ namespace IKVM.NativeCode.java
|
||||||
#else
|
#else
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
System.Net.IPAddress[] addr = System.Net.Dns.GetHostAddresses(hostname);
|
System.Net.IPAddress[] addr = System.Net.Dns.GetHostAddresses(hostname);
|
||||||
#else
|
|
||||||
System.Net.IPAddress[] addr = System.Net.Dns.Resolve(hostname).AddressList;
|
|
||||||
#endif
|
|
||||||
jnInetAddress[] addresses = new jnInetAddress[addr.Length];
|
jnInetAddress[] addresses = new jnInetAddress[addr.Length];
|
||||||
for (int i = 0; i < addr.Length; i++)
|
for (int i = 0; i < addr.Length; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
<include name="JavaException.cs" />
|
<include name="JavaException.cs" />
|
||||||
<include name="JniInterface.cs" />
|
<include name="JniInterface.cs" />
|
||||||
<include name="MemberWrapper.cs" />
|
<include name="MemberWrapper.cs" />
|
||||||
<include unless="${classpath}" name="netinf.cs" />
|
|
||||||
<include unless="${classpath}" name="openjdk.cs" />
|
<include unless="${classpath}" name="openjdk.cs" />
|
||||||
<include name="profiler.cs" />
|
<include name="profiler.cs" />
|
||||||
<include name="tracer.cs" />
|
<include name="tracer.cs" />
|
||||||
|
|
|
@ -27,9 +27,6 @@ using System.Diagnostics;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
#if WHIDBEY
|
|
||||||
using ConfigurationSettings = System.Configuration.ConfigurationManager;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace IKVM.Internal
|
namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
|
@ -83,7 +80,7 @@ namespace IKVM.Internal
|
||||||
Trace.AutoFlush = true;
|
Trace.AutoFlush = true;
|
||||||
Trace.Listeners.Add(new MyTextWriterTraceListener(Console.Error));
|
Trace.Listeners.Add(new MyTextWriterTraceListener(Console.Error));
|
||||||
/* If the app config file gives some method trace - add it */
|
/* If the app config file gives some method trace - add it */
|
||||||
string trace = ConfigurationSettings.AppSettings["Traced Methods"];
|
string trace = ConfigurationManager.AppSettings["Traced Methods"];
|
||||||
if(trace != null)
|
if(trace != null)
|
||||||
{
|
{
|
||||||
methodtraces.Add(trace);
|
methodtraces.Add(trace);
|
||||||
|
|
|
@ -26,7 +26,6 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using IKVM.Runtime;
|
|
||||||
using IKVM.Internal;
|
using IKVM.Internal;
|
||||||
using InstructionFlags = IKVM.Internal.ClassFile.Method.InstructionFlags;
|
using InstructionFlags = IKVM.Internal.ClassFile.Method.InstructionFlags;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Security.Permissions;
|
using System.Security.Permissions;
|
||||||
using IKVM.Attributes;
|
|
||||||
using IKVM.Internal;
|
using IKVM.Internal;
|
||||||
|
|
||||||
#if !STATIC_COMPILER && !COMPACT_FRAMEWORK
|
#if !STATIC_COMPILER && !COMPACT_FRAMEWORK
|
||||||
|
@ -182,12 +181,7 @@ namespace IKVM.Internal
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if WHIDBEY
|
|
||||||
return Environment.OSVersion.Platform == PlatformID.Unix;
|
return Environment.OSVersion.Platform == PlatformID.Unix;
|
||||||
#else
|
|
||||||
PlatformID pid = Environment.OSVersion.Platform;
|
|
||||||
return pid != PlatformID.Win32NT && pid != PlatformID.Win32S && pid != PlatformID.Win32Windows && pid != PlatformID.WinCE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,11 +225,7 @@ namespace IKVM.Internal
|
||||||
messageBox = winForms.GetType("System.Windows.Forms.MessageBox");
|
messageBox = winForms.GetType("System.Windows.Forms.MessageBox");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
new ReflectionPermission(ReflectionPermissionFlag.MemberAccess
|
new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Assert();
|
||||||
#if !WHIDBEY
|
|
||||||
| ReflectionPermissionFlag.TypeInformation
|
|
||||||
#endif
|
|
||||||
).Assert();
|
|
||||||
message = String.Format("****** Critical Failure: {1} ******{0}{0}" +
|
message = String.Format("****** Critical Failure: {1} ******{0}{0}" +
|
||||||
"PLEASE FILE A BUG REPORT FOR IKVM.NET WHEN YOU SEE THIS MESSAGE{0}{0}" +
|
"PLEASE FILE A BUG REPORT FOR IKVM.NET WHEN YOU SEE THIS MESSAGE{0}{0}" +
|
||||||
(messageBox != null ? "(on Windows you can use Ctrl+C to copy the contents of this message to the clipboard){0}{0}" : "") +
|
(messageBox != null ? "(on Windows you can use Ctrl+C to copy the contents of this message to the clipboard){0}{0}" : "") +
|
||||||
|
@ -280,7 +270,7 @@ namespace IKVM.Internal
|
||||||
// with can be different from the one we're compiling against.)
|
// with can be different from the one we're compiling against.)
|
||||||
internal static Type LoadType(Type type)
|
internal static Type LoadType(Type type)
|
||||||
{
|
{
|
||||||
#if WHIDBEY && STATIC_COMPILER
|
#if STATIC_COMPILER
|
||||||
return StaticCompiler.GetType(type.FullName);
|
return StaticCompiler.GetType(type.FullName);
|
||||||
#else
|
#else
|
||||||
return type;
|
return type;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче