Exposingcn163

cn163.net  时间:2021-03-02  阅读:()
IKVM.
NETBuildingaJavaVMonthe.
NETFrameworkJeroenFrijtersWhoamIJeroenFrijters/YeroonFrighters/Co-founderofasmallISVinTheNetherlandsLeaddeveloperofIKVM.
NETanOpenSourceJVMfor.
NETWhatisIKVM.
NETJavaVMontopof.
NET&Mono–JITcompilertotranslateJavabytecodeintoMSIL–Reflection–Etc.
StaticcompilerthattranslatesJavaclasses/jarsinto.
NETassemblies–BasicallyaheadoftimecompilerforabovementionedJIT.
NETportofOpenJDKclasslibrary–Somegaps,butmostAPIspartof"Java"areavailableWhyisIKVM.
NETStartedinthespringof2002asanexperimentMyblogonJune19th,2002:"IhavealargeJavaapplicationthatIwouldliketoslowlymigrateto.
NET,inordertobeabletodothat,IneedawaytointeroperatewithJavacode,theexistingsolutionsIhavelookedatareinadequate.
Besides,It'slotsoffuntobuildsomethinglikethis:-)"CompatibilityJava7–BasedOpenJDKclasslibrarywithoutthenativecode.
–Swing/AWT/Fonts/Graphics/Printingnotsupported.
TherearesomeminorVMlevelincompatibilities,butsofarthesearejusttheoretical.
Practicalsourcesofincompatibilities:–sun.
*packages–"Theclassloaderproblem"[System|IKVM].
ReflectionThankstoAppDomain.
TypeResolveeventitispossibletobuildamanaged"JIT".
But,System.
Reflectionhassomeseriouslimitationsforcompilers.
IKVM.
Reflectionisnowusedbyikvmc,MonoC#compiler,Scala.
NETandothers.
TypeSystemcli.
System.
Objectextendsjava.
lang.
Objectjava.
lang.
Object:System.
Objectjava.
lang.
Stringisonlyacontainerforstaticmethods.
InstancesarealwaysSystem.
String.
cli.
System.
Exceptionsextendsjava.
lang.
Throwablejava.
lang.
Throwable:System.
Exception(checkedexceptions)TypeSystemcont.
java.
lang.
Comparable:System.
IComparablejava.
lang.
Cloneable,java.
io.
Serializable&java.
lang.
CharSequenceneedtobespecialcased(stringsandarrays)Exposing.
NETfeaturestoJavaDelegatesByRefmethodargumentsCustomattributesValueTypesEnumsProperties&EventsDelegatesinJavapublicfinalclassRunnableDelegateextendscli.
System.
MulticastDelegateimplementsRunnable{publicRunnableDelegate(Methodm){}publicnativevoidInvoke();publicinterfaceMethod{voidInvoke();}publicvoidrun(){Invoke();}}DelegatesinJavapackageikvm.
runtime;publicfinalclassDelegates{publicstaticRunnabletoRunnable(RunnableDelegatedelegate){returndelegate;}}java.
lang.
Threadthread=newjava.
lang.
Thread(ikvm.
runtime.
Delegates.
toRunnable(delegate{Console.
WriteLine("HelloWorld");}));thread.
start();ByRefMethodArgumentsSameasinJava,hackitwithanarrayWouldliketousegenerics,buterasuremakesthishard(duetoinabilitytodomethodoverloading)CustomAttributesExposingthemasannotationsworks(mostofthetime)packagesun.
misc;classUnsafe{@SecurityPermissionAttribute.
Annotation(value=SecurityAction.
__Enum.
LinkDemand,UnmanagedCode=true)@cli.
System.
Security.
SecurityCriticalAttribute.
AnnotationpublicvoidfreeMemory(longaddress){Marshal.
FreeHGlobal(IntPtr.
op_Explicit(address));}}ValueTypesWeaksupport:–YoucanonlyusethemfromJava,notdefinethem.
–Willusuallybeboxed.
EnumsWouldliketheabilitytodomethodoverloadingbasedonenumtypeNeedabilityto"bittwiddle"Usableincustomattributeannotationspackagecli.
System;publicfinalclassDayOfWeekextendscli.
System.
Enum{publicstaticfinalintSunday=0;publicstaticfinalintMonday=1;…publicfinalintValue;publicstaticnativeDayOfWeekwrap(inti);}Properties&EventsNospecialsupportDirectlyusetheunderlyingmethodsimportcli.
System.
Windows.
Forms.
*;classDemo{publicstaticvoidmain(String[]args){Formform=newForm();form.
set_Width(400);form.
set_Height(400);form.
add_FormClosing(newFormClosingEventHandler(newFormClosingEventHandler.
Method(){publicvoidInvoke(Objectsender,FormClosingEventArgsargs){System.
out.
println("Closing.
.
.
");}}));Application.
Run(form);}}ExposingJavato.
NETKeepingIntelliSensecleanStaticfieldsininterfacesAnnotationsGenericsWorkaroundsExposingJavato.
NETKeepingIntelliSensecleanStaticfieldsininterfacesAnnotationsGenericsWorkarounds__WorkaroundBaseClass__publicabstractclassBase{protectedabstractvoidM();}publicabstractclassDerived:Base{publicoverridevoidM(){}}classProgram:Derived{}errorCS0534:'Program'doesnotimplementinheritedabstractmember'Base.
M()'publicabstractclassBase{protectedabstractvoidM();}[HideFromJava][EditorBrowsable(EditorBrowsableState.
Never)]publicabstract__WorkaroundBaseClass__Derived:Base{protectedoverridevoidM(){thrownewAbstractMethodError();}}publicabstractclassDerived:__WorkaroundBaseClass__Derived{publicoverridevoidM(){}}__WorkaroundBaseClass__classProgram:Derived{}Interop"Magic"Limitedsupportforautomagic.
NETserializationsupportforJavaserializableclasses.
NETexceptionsareserializedascom.
sun.
xml.
internal.
ws.
developer.
ServerSideExceptionjava.
io.
Closeable=>System.
IDisposablejava.
lang.
Iterable=>System.
IEnumerablejava.
lang.
AutoCloseableSystem.
IDisposable"JarHell"HardtodeterminejardependenciesCirculardepenciesoccurmoreoftenthanyou'dthinkikvmc{foo.
jar-out:Foo.
dll}{bar.
jar-out:Bar.
dll}PerformanceTypicallyprettygood.
NEToftenwinsonstringprocessingExceptionheavycodesuffersDon't"benchmark"underthedebugger!
UsersSeveralcommercialandopensourceapplicationsuseIKVM.
NET"AtmycompanywearestillamazedtoseelargepartofourJavasystemsuccessfullyrunningon.
NETplatformthankstoIKVM.
"AndyMalakov,DeltixLab,Inc.
"WeareveryhappywithIKVM.
ItenablesustodevelopourcorelibrariesinJavaandcompileforusein.
NET.
TheIKVMteamisveryresponsiveandknowledgeableabouttheissueswewerefacing.
"ShamusNeville,eTradingandAnalyticsGroupatHSBC"HavingusedIKVMforoverayear,wehavefoundIKVMtoworkreliablyandofferproductionqualityoperation.
Theonetimewherewedidrunintosomespecificproblem,theopensourcenatureofIKVMallowedustoquicklytrackdownthebugandverifythecauseoftheproblem.
Wehadafixfortheproblemtheverysameday.
"OttoPerdeck,ChordiantSoftwareMoreathttp://www.
ikvm.
net/stories.
htmlQuestionsMoreInformationProjectWebsite:http://www.
ikvm.
net/jeroen@frijters.
nethttp://weblog.
ikvm.
net/@JeroenFrijters

Hostodo:4款便宜美国vps七折优惠低至$13/年;NVMe阵列1Gbps带宽,免费DirectAdmin授权

hostodo怎么样?快到了7月4日美国独立日,hostodo现在推出了VPS大促销活动,提供4款Hostodo美国独立日活动便宜VPS,相当于7折,低至$13/年,续费同价。Hostodo美国独立日活动结束时间不定,活动机售完即止。Hostodo商家支持加密数字货币、信用卡、PayPal、支付宝、银联等付款。Hostodo美国独立日活动VPS基于KVM虚拟,NVMe阵列,1Gbps带宽,自带一个...

新网,域名7月盛夏1核心2G内存.COM域名仅19.9元/首年,主机9.9元/月,企业邮箱0元体验

新网好不好?新网域名便宜吗?新网怎么样?新网是国内老牌知名域名注册商,企业正规化运营,资质齐全,与阿里云万网和腾讯云DNSPOD同为国内服务商巨头。近日新网发布了最新的七月放价季优惠活动,主要针对域名、云主机、企业邮箱、SSL证书等多款云产品推送了超值的优惠,其中.com顶级域名仅19.9元/首年,.cn域名仅16元/首年,云主机1核心2G内存3Mbps带宽仅9.9元/月,企业邮箱更是免费送1年,...

Buyvm:VPS/块存储补货1Gbps不限流量/$2起/月

BuyVM测评,BuyVM怎么样?BuyVM好不好?BuyVM,2010年成立的国外老牌稳定商家,Frantech Solutions旗下,主要提供基于KVM的VPS服务器,数据中心有拉斯维加斯、纽约、卢森堡,付费可选强大的DDOS防护(月付3美金),特色是1Gbps不限流量,稳定商家,而且卢森堡不限版权。1G或以上内存可以安装Windows 2012 64bit,无需任何费用,所有型号包括免费的...

cn163.net为你推荐
aplicaios中國信託商業銀行模块ios8VTLHiosiphone连不上wifi为什么苹果手机连不上wifi微信都发不出去?tcpip上的netbiostcpip上的netbios是什么用的,有安全隐患吗?开启还是关上迅雷下载速度迅雷下载快慢和什么有关迅雷下载速度迅雷限制下载速度要设置多少联通合约机iphone5想咨询一下联通iphone5合约机和裸机的区别?google统计怎样获得google ga 统计代码
鲨鱼机 128m内存 服务器日志分析 国外网站代理服务器 申请个人网站 亚马逊香港官网 qq云端 网通服务器托管 1元域名 中国联通宽带测速 可外链的相册 云服务是什么意思 ssl加速 阿里云邮箱怎么注册 石家庄服务器 免费获得q币 forwarder 宿主机 网络时间服务器 dns服务器是什么 更多