Share
Embed
Transcript
42 slides
-
OpenJDK JDK Project https://openjdk.org/projects/jdk/ のサブプロジェクト JDK Project: OpenJDK JDK 21
2023-09-19 JDK 20 2023-03-21 半年ごとのリリース JDK 他のサブプロジェクトをまとめて を開発 Oracle Java 21 は から 2 年周期 LTS Oracle は などのディストリビュータによる Note: OpenJDK LTS LTS には と非 の区別はない -
JEP: JDK Enhancement Proposal の機能を規定 JDK 新機能だけでなく、実装改善、機能の削除も含む Preview Standard 正式な機能
の種類 JEP Incubator Experimental プレビュー機能 実験的な機能 新しいモジュール ex. Records ex. HTTP Client ex. ZGC Note: Preview, Experimental, Incubator は最低 2 回 -
JEP: JDK Enhancement Proposal の機能を規定 JDK 新機能だけでなく、実装改善、機能の削除も含む Preview Standard 正式な機能
の種類 JEP Incubator Experimental プレビュー機能 実験的な機能 新しいモジュール ex. Records ex. HTTP Client ex. ZGC Note: Preview, Experimental, Incubator は最低 2 回 -
JEP: JDK Enhancement Proposal Java 18 400: UTF-8 by Default
408: Simple Web Server 413: Code Snippets in Java API Documentation 416: Reimplement Core Re ection with Method Handles 417: Vector API (Third Incubator) 418: Internet-Address Resolution SPI 419: Foreign Function & Memory API (Second Incubator) 420: Pattern Matching for switch (Second Preview) 421: Deprecate Finalization for Removal Java 19 405: Record Patterns (Preview) 422: Linux/RISC-V Port 424: Foreign Function & Memory API (Preview) 425: Virtual Threads (Preview) 426: Vector API (Fourth Incubator) 427: Pattern Matching for switch (Third Preview) 428: Structured Concurrency (Incubator) Java 20 429: Scoped Values (Incubator) 432: Record Patterns (Second Preview) 433: Pattern Matching for switch (Fourth Preview) 434: Foreign Function & Memory API (Second Preview) 436: Virtual Threads (Second Preview) 437: Structured Concurrency (Second Incubator) 438: Vector API (Fifth Incubator) Java 21 430: String Templates (Preview) 431: Sequenced Collections 442: Foreign Function & Memory API (Third Preview) 444: Virtual Threads . . . -
JEP: JDK Enhancement Proposal Java 18 400: UTF-8 by Default
408: Simple Web Server 413: Code Snippets in Java API Documentation 416: Reimplement Core Re ection with Method Handles 417: Vector API (Third Incubator) 418: Internet-Address Resolution SPI 419: Foreign Function & Memory API (Second Incubator) 420: Pattern Matching for switch (Second Preview) 421: Deprecate Finalization for Removal Java 19 405: Record Patterns (Preview) 422: Linux/RISC-V Port 424: Foreign Function & Memory API (Preview) 425: Virtual Threads (Preview) 426: Vector API (Fourth Incubator) 427: Pattern Matching for switch (Third Preview) 428: Structured Concurrency (Incubator) Java 20 429: Scoped Values (Incubator) 432: Record Patterns (Second Preview) 433: Pattern Matching for switch (Fourth Preview) 434: Foreign Function & Memory API (Second Preview) 436: Virtual Threads (Second Preview) 437: Structured Concurrency (Second Incubator) 438: Vector API (Fifth Incubator) Java 21 430: String Templates (Preview) 431: Sequenced Collections 442: Foreign Function & Memory API (Third Preview) 444: Virtual Threads . . . -
JEP 400: UTF-8 by default デフォルトファイルエンコーディングを に統一 UTF-8 java.io InputStreamReader,
FileReader, OutputStreamWriter, FileWriter, PrintStream java.util Formatter, Scanner java.net URLEncoder, URLDecoder 影響をうけるクラス でデフォルトエンコーディングで を 使用している場合、要注意 Windows Windows-31J -D le.encoding =COMPAT 従来通りのファイルエンコーディングを使用するには 起動オプション -
JEP 444: Virtual Threads by Project Loom が管理する軽量スレッド JVM 待ち時間を活用することでスループット向上
I/O アプリケーションなど通信を多用するシステムに効果的 Web 使い方は従来の とほぼ同じ Thread への対応 Virtual Treads なども対応予定 Spring Framework Helidon Nima Oracle JDBC Driver -
Project Amber 言語仕様の改良と拡張を行うプロジェクト 286: Local-Variable Type Inference (var) (10) 323:
Local-Variable Syntax for Lambda Parameters (11) 361: Switch Expressions (14) 378: Text Blocks (15) 394: Pattern Matching for instanceof (16) 395: Records (16) 409: Sealed Classes (17) 仕様策定完了 仕様策定中 430: String Templates (Preview) 440: Record Patterns 441: Pattern Matching for switch 443: Unnamed Patterns and Variables (Preview) 445: Flexible Main Methods and Anonymous Main Classes (Preview) 447: Statements before super() -
Project Amber 型 395: Records 409: Sealed Classes 447: Statements
before super() 361: Switch Expressions 394: Pattern Matching for instanceof 440: Record Patterns 441: Pattern Matching for switch 443: Unnamed Patterns and Variables (Preview) パターンマッチング 286: Local-Variable Type Inference (var) 323: Local-Variable Syntax for Lambda Parameters 378: Text Blocks 430: String Templates (Preview) 445: Flexible Main Methods and Anonymous Main Classes (Preview) その他 -
Sealed Class 継承を制限したクラス 例 図形を表すクラス で定義 sealed permitsでサブクラスを制限 サブクラスは同モジュールもしくは同パッケージ サブクラスは以下のいずれかで定義
nal sealed non-sealed 使用時 switch default句を省略できる -
Data Oriented Programming ドメインモデルの実装では ... データ 業務ルール データ指向プログラミングの原則 #1 は、
コードをデータから切り離すことである “データ指向プログラミング” より引用 -
Data Oriented Programming ドメインモデルの実装では ... データ 業務ルール リソース 値オブジェクト イベント
... ステートレスな処理 型として表現する モジュールとして表現する ( 型として扱う必要はない ) イミュータブルであることが重要 -
映画のチケットで考えてみる をさらに分解 Record 式で処理を分けるより switch テンプレートメソッドパターンで記述すればいいのでは? 業務ルールが複数のクラスに分散してしまい、 見通しが悪くなる データ間の関係 (
関連、コンポジッション ) と 処理間の関係 ( 使用 ) が混在しまい、複雑になりがち 業務ルールは処理によって必要とするデータも変化する -
Conclusion 月リリース予定 Java 21 LTS 9 Virtual Threads などが導入予定 パターンマッチングなどデータ指向プログラミングに向けた機能
Project Amber Java 21 String Templateが パターンマッチングはさらに拡張される予定 で Preview