[Ikvm-commit] ikvm/ikvmc CompilerClassLoader.cs,1.92,1.93
Brought to you by:
jfrijters
From: Jeroen F. <jfr...@us...> - 2009-03-16 05:28:20
|
Update of /cvsroot/ikvm/ikvm/ikvmc In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29658/ikvmc Modified Files: CompilerClassLoader.cs Log Message: Added (limited) support for defining instance fields on remapped types. The fields will only be available on the actual implementation types, not the types they shadow (accessing the field on a shadow instance is undefined, but for reflection we'll at least guarantee that an exception is thrown (current java.lang.IllegalArgumentException)). Index: CompilerClassLoader.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/ikvmc/CompilerClassLoader.cs,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** CompilerClassLoader.cs 13 Mar 2009 05:05:26 -0000 1.92 --- CompilerClassLoader.cs 16 Mar 2009 05:28:11 -0000 1.93 *************** *** 1584,1590 **** fields.Add(new GetterFieldWrapper(this, GetClassLoader().FieldTypeWrapperFromSig(f.Sig), null, f.Name, f.Sig, new ExModifiers((Modifiers)f.Modifiers, false), (MethodInfo)method.GetMethod(), null)); } ! else if((f.Modifiers & IKVM.Internal.MapXml.MapModifiers.Static) != 0) { ! FieldAttributes attr = MapFieldAccessModifiers(f.Modifiers) | FieldAttributes.Static; if(f.Constant != null) { --- 1584,1590 ---- fields.Add(new GetterFieldWrapper(this, GetClassLoader().FieldTypeWrapperFromSig(f.Sig), null, f.Name, f.Sig, new ExModifiers((Modifiers)f.Modifiers, false), (MethodInfo)method.GetMethod(), null)); } ! else { ! FieldAttributes attr = MapFieldAccessModifiers(f.Modifiers); if(f.Constant != null) { *************** *** 1595,1598 **** --- 1595,1602 ---- attr |= FieldAttributes.InitOnly; } + if((f.Modifiers & IKVM.Internal.MapXml.MapModifiers.Static) != 0) + { + attr |= FieldAttributes.Static; + } FieldBuilder fb = tb.DefineField(f.Name, GetClassLoader().FieldTypeWrapperFromSig(f.Sig).TypeAsSignatureType, attr); if(f.Attributes != null) *************** *** 1623,1632 **** } } - else - { - // TODO we should support adding arbitrary instance fields (the runtime will have to use - // a weak identity hashtable to store the extra information for subclasses that don't extend our stub) - throw new NotImplementedException(this.Name + "." + f.Name + f.Sig); - } } } --- 1627,1630 ---- |