Java SE 17 e lokolloa

Kamora likhoeli tse ts'eletseng tsa nts'etsopele, Oracle e ile ea lokolla Java SE 17 (Java Platform, Standard Edition 17), e sebelisang projeke ea OpenJDK e bulehileng e le ts'ebetso ea litšupiso. Ntle le ho tlosoa ha likarolo tse ling tse sa sebetseng, Java SE 17 e boloka ho lumellana le morao-rao le likhatiso tse fetileng tsa sethala sa Java - merero ea Java e ngotsoeng pele e tla sebetsa ntle le liphetoho ha e tsamaisoa tlas'a mofuta o mocha. Mehaho e ikemiselitseng ho kenya Java SE 17 (JDK, JRE le Server JRE) e lokiselitsoe Linux (x86_64, AArch64), Windows (x86_64) le macOS (x86_64, AArch64). E ntlafalitsoe ke projeke ea OpenJDK, ts'ebetsong ea litšupiso tsa Java 17 ke mohloli o bulehileng ka botlalo tlasa laesense ea GPLv2, ntle le mekhelo ea GNU ClassPath e lumellang khokahano e matla le lihlahisoa tsa khoebo.

Java SE 17 e thathamisitsoe e le tokollo ea nako e telele ea tšehetso (LTS), e tla tsoelapele ho fumana lintlafatso ho fihlela 2029. Lintlafatso tsa tokollo e fetileng ea Java 16 li emisitsoe. Lekala la pele la LTS la Java 11 le tla tšehetsoa ho fihlela 2026. Tokollo e latelang ea LTS e reriloe ka Loetse 2024. A re u hopotse hore ho qala ka tokollo ea Java 10, morero o fetohetse ts'ebetsong e ncha ea nts'etsopele, e bolelang potoloho e khuts'oane ea ho theoa ha likhatiso tse ncha. Ts'ebetso e ncha e se e ntlafalitsoe lekaleng le le leng le lecha le ntlafalitsoeng khafetsa, le kenyelletsang liphetoho tse seng li entsoe le moo makala a hlophisoang ka mor'a likhoeli tse ling le tse ling tse tšeletseng ho tsitsisa likhatiso tse ncha.

Likarolo tse ncha ho Java 17 li kenyelletsa:

  • Ho khothaletsoa ts'ebetsong ea liteko tsa mokhoa oa ho bapisa polelong ea "switch", e lumellang hore ho se sebelisoe litekanyetso tse nepahetseng "tabeng", empa litempele tse feto-fetohang tse koahelang letoto la boleng ka nako e le 'ngoe, tseo pele ho neng ho hlokahala ho li sebelisa. diketane tsa dipolelo tsa “haeba ... ho seng jwalo”. Ho phaella moo, "switch" e na le bokhoni ba ho sebetsana le litekanyetso tsa NULL. Ntho o = 123L; Khoele e hlophisitsoeng = switjha (o) { case Integer i -> String.format("int %d", i); case Long l -> String.format("long%d", l); case Double d -> String.format("habeli %f", d); case String s -> String.format("String %s", s); kamehla -> o.toString(); };
  • Tšehetso e tsitsitseng bakeng sa lihlopha tse tiisitsoeng le li-interfaces, tse ke keng tsa sebelisoa ke lihlopha tse ling le li-interfaces ho rua, ho atolosa, kapa ho hlokomoloha ts'ebetsong. Litlelase tse tiisitsoeng li boetse li fana ka mokhoa o hlakileng haholoanyane oa ho thibela ts'ebeliso ea sehlopha sa maemo a holimo ho feta mokhoa oa ho fihlella, ho ipapisitse le ho thathamisa ka ho hlaka lihlotšoana tse lumelletsoeng ho atolosoa. sephutheloana com.mohlala.geometry; sehlopha se tiisitsoeng sa sechaba Litumello tsa sebopeho com.example.polar.Circle, com.example.quad.Rectangle, com.example.quad.simple.Square {…}
  • Ho hlahisoa ponelo-pele ea bobeli ea Vector API, e fanang ka lits'ebetso bakeng sa lipalo tsa vector tse sebelisoang ho sebelisoa litaelo tsa vector ho li-processor tsa x86_64 le AArch64 le ho lumella lits'ebetso hore li sebelisoe ka nako e le 'ngoe ho litekanyetso tse ngata (SIMD). Ho fapana le bokhoni bo fanoeng ho HotSpot JIT compiler bakeng sa auto-vectorization ea scalar operations, API e ncha e etsa hore ho khonehe ho laola vectorization ka ho hlaka bakeng sa ts'ebetso ea data e tšoanang.
  • E kentse ponelopele ea Mosebetsi oa Kantle ho Naha & Memory API, e lumellang lits'ebetso ho sebelisana le khoutu le data ntle le nako ea Java. API e ncha e u lumella ho letsetsa mesebetsi e seng ea JVM le ho fihlella memori e sa laoloang ke JVM. Mohlala, o ka letsetsa lits'ebetso ho tsoa lilaebraring tse arolelanoang kantle le ho fihlella data ea ts'ebetso ntle le ho sebelisa JNI.
  • Enjene ea ho fana ka macOS e matlafatsang Java 2D API, eo hape e matlafatsang Swing API, e fetotsoe ho sebelisa Metal graphics API. Sethala sa macOS se ntse se tsoela pele ho sebelisa OpenGL ka ho sa feleng, 'me ho nolofalletsa tšehetso ea Metal ho hloka ho beha "-Dsun.java2d.metal=true" le bonyane ho tsamaisa macOS 10.14.x.
  • E kentse boema-kepe bakeng sa sethala sa macOS/AArch64 (lik'homphieutha tsa Apple tse thehiloeng ho li-chips tse ncha tsa Apple M1). Karolo e ikhethang ea boema-kepe ke ts'ehetso ea ts'ireletso ea memori ea W^X (Ngola XOR Execute), eo ho eona maqephe a memori a ke keng a fumaneha ka nako e le 'ngoe bakeng sa ho ngola le ho e sebelisa. (khoutu e ka etsoa feela ka mor'a hore ho ngola ho holofatsoe, 'me ho ngolla leqephe la memori ho ka khoneha feela ka mor'a hore ts'ebetso e koetsoe).
  • E khutliselitsoe ho sebelisoa feela semantics e thata ea fp bakeng sa mantsoe a ntlha a phaphametseng. Tšehetso ea "default" semantics, e fumanehang ho tloha ha ho lokolloa Java 1.2, e khaotsoe, ho kenyelletsa le ho nolofatsa ho sebetsa lits'ebetsong tse nang le li-coprocessor tsa lipalo tsa x87 tsa khale (kamora ho fihla ha litaelo tsa SSE2, tlhoko ea semantics e eketsehileng e ile ea nyamela).
  • Mefuta e mecha ea li-interfaces ho lijenereithara tsa linomoro tsa pseudorandom e kentsoe ts'ebetsong, 'me li-algorithms tse ling li kentsoe ts'ebetsong bakeng sa tlhahiso e ntle ea linomoro tse sa reroang. Likopo li fuoa monyetla oa ho khetha algorithm bakeng sa ho hlahisa linomoro tsa pseudorandom. Tšehetso e ntlafetseng bakeng sa ho hlahisa lintho tse sa tloaelehang.
  • E qobelleha ho kenya letsoho ka thata ho bohle ba ka hare ho JDK, ntle le li-API tsa bohlokoa joalo ka sun.misc.Unsafe. Encapsulation e tiileng e thibela liteko ho tsoa ho khoutu ho fihlella litlelase tsa kahare, mekhoa le masimo. Nakong e fetileng, mokhoa o thata oa ho koala o ne o ka emisoa ho sebelisoa khetho ea "-illegal-access=permit", empa hona joale ha e sa sebetsa. Lisebelisoa tse hlokang ho fihlella litlelase tsa ka hare, mekhoa, le likarolo li lokela ho li hlalosa ka ho hlaka ho sebelisa khetho ea --add-opens kapa tšobotsi ea Add-Opens ho faele ea ponahalo.
  • Likopo li fuoa bokhoni ba ho hlalosa li-filters tsa deserialization tsa data, tse ka bang hlokolosi le ho khethoa ka matla ho ipapisitse le ts'ebetso e itseng ea deserialization. Li-filters tse boletsoeng li sebetsa ho mochine oohle oa sebele (JVM-wide), ke hore. ha se koahele feela ts'ebeliso ka boyona, empa le lilaebrari tsa mokha oa boraro tse sebelisoang ts'ebelisong.
  • Swing o kentse mokhoa oa javax.swing.filechooser.FileSystemView.getSystemIcon ho kenya litšoantšo tse kholo ho ntlafatsa UI ho li-skrini tse phahameng tsa DPI.
  • The java.net.DatagramSocket API e fana ka ts'ehetso bakeng sa ho hokahanya le lihlopha tsa Multicast ntle le tlhokahalo ea java.net.MulticastSocket API e arohaneng.
  • Sesebelisoa sa IGV (Ideal Graph Visualizer) se ntlafalitsoe, se fana ka pono e kopanetsoeng ea boemeli ba khoutu ea mahareng ho motlalehi oa HotSpot VM C2 JIT.
  • Ho JavaDoc, ka papiso le moqapi oa javac, ha phoso e hlahisoa, palo ea mohala o nang le bothata faeleng ea mohloli le sebaka sa phoso se bonts'itsoe.
  • E kentse thepa ea native.encoding, e bonts'ang lebitso la khouto ea litlhaku tsa sistimi (UTF-8, koi8-r, cp1251, joalo-joalo).
  • Khokahano ea java.time.InstantSource e kentsoe, e lumellang ho laola nako ntle le ho supa sebaka sa nako.
  • E kenyellelitsoe java.util.HexFormat API bakeng sa ho fetolela ho boemeli ba hexadecimal le ka tsela e fapaneng.
  • Mokhoa oa blackhole o kenyelelitsoe ho compiler, e thibelang ts'ebetso ea ho felisa khoutu e shoeleng, e ka sebelisoang ha ho etsoa liteko tsa ts'ebetso.
  • E kenyellelitsoe "-Xlog: async" khetho ho Runtime ho rekota lits'oants'o ka mokhoa oa asynchronous.
  • Ha ho thehoa likhokahano tse sireletsehileng, TLS 1.3 e lumelloa ka mokhoa oa kamehla (pele TLS 1.2 e ne e sebelisoa).
  • Applet API e neng e phatlalalitsoe pele e sa sebetse (java.applet.Applet*, javax.swing.JApplet), e neng e sebelisetsoa ho tsamaisa lits'ebetso tsa Java ho sebatli, e fetiselitsoe ho sehlopha sa tse reretsoeng ho tlosoa (se sa sebetseng kamora ho fela ha tšehetso. bakeng sa plugin ea Java bakeng sa libatli).
  • Motsamaisi oa Ts'ireletso, eo e seng e le khale e lahlehetsoe ke bohlokoa ba eona 'me ea bonahala e sa tsejoe ka mor'a ho fela ha tšehetso bakeng sa plugin ea sebatli, e isitsoe sehlopheng sa tse reretsoeng ho tlosoa.
  • Mochini oa RMI Activation o tlositsoe, o seng o siiloe ke nako, o behiloe sehlopheng sa khetho ho Java 8 mme ha o so sebelisoe mehleng ea sejoale-joale.
  • Moqapi oa liteko o tšehetsang JIT (ka nako feela) bakeng sa ho bokelloa ka matla ha khoutu ea Java bakeng sa HotSpot JVM, hammoho le mokhoa oa ho bokella ka tebello (AOT, pele ho nako) ea litlelase ka khoutu ea mochini pele o qala mochini o sebetsang. , e tlositsoe ho SDK. Moqapi o ngotsoe ka Java mme o ipapisitse le mosebetsi oa projeke ea Graal. Hoa hlokomeloa hore tlhokomelo ea li-compiler e hloka mosebetsi o mongata, o sa lokelang ha ho se na tlhokahalo e tsoang ho bahlahisi.

Source: opennet.ru

Eketsa ka tlhaloso