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

特网云(1050元),IP数5 个可用 IP (/29) ,美国高防御服务器 无视攻击

特网云特网云为您提供高速、稳定、安全、弹性的云计算服务计算、存储、监控、安全,完善的云产品满足您的一切所需,深耕云计算领域10余年;我们拥有前沿的核心技术,始终致力于为政府机构、企业组织和个人开发者提供稳定、安全、可靠、高性价比的云计算产品与服务。官方网站:https://www.56dr.com/ 10年老品牌 值得信赖 有需要的请联系======================特网云美国高防御...

PIGYun月付14.4元起,美国洛杉矶/韩国VPS七月6折

PIGYun是成立于2019年的国人商家,提供香港、韩国和美西CUVIP-9929等机房线路基于KVM架构的VPS主机,本月商家针对韩国首尔、美国洛杉矶CUVIP-AS29、GIA回程带防御等多条线路VPS提供6-8.5折优惠码,优惠后韩国首尔CN2混合BGP特惠型/美国洛杉矶GIA回程带10Gbps攻击防御VPS主机最低每月14.4元起。下面列出几款不同机房VPS主机配置信息,请留意不同优惠码。...

HostYun全场9折,韩国VPS月付13.5元起,日本东京IIJ线路月付22.5元起

HostYun是一家成立于2008年的VPS主机品牌,原主机分享组织(hostshare.cn),商家以提供低端廉价VPS产品而广为人知,是小成本投入学习练手首选,主要提供基于XEN和KVM架构VPS主机,数据中心包括中国香港、日本、德国、韩国和美国的多个地区,大部分机房为国内直连或者CN2等优质线路。本月商家全场9折优惠码仍然有效,以KVM架构产品为例,优惠后韩国VPS月付13.5元起,日本东京...

cn163.net为你推荐
1前言2区块链应用产业发展现状请各矿将表填好后于2017年3月1日前发至zhxsh411@163.com邮箱.设备ipad支持ipad支持ipadms17-010win10pybaen.10.的硬币是哪国的再中国至多少钱css3按钮如何在html添加一个搜索框和一个按钮迅雷下载速度迅雷限制下载速度要设置多少google分析google分析里的数据包括搜索引擎爬虫的数据吗?迅雷雷鸟雷鸟手机怎么样
美国独立服务器 bluehost wavecom 便宜建站 老左博客 wdcp hostker idc是什么 世界测速 中国网通测速 常州联通宽带 web服务器是什么 独立主机 测试网速命令 阿里云邮箱个人版 789电视剧网 .htaccess cpu使用率过高怎么办 symantec wannacry勒索病毒 更多