← 回到首頁

每日新聞摘要

2025年11月26日

選擇語言 / Select Language

中文 English 简体中文
今日收集到 22 篇文章摘要

Future-Proofing Your Android Career: Skills, Libraries & Mindset for 2025+

Future-Proofing Your Android Career: Skills, Libraries & Mindset for 2025+
Kotlin, Compose, and backend architecture are key to staying relevant in Android development and commanding higher salaries.

重點摘要

Adopt Kotlin as the primary Android language
Use Jetpack Compose for modern UI development
Learn backend architecture to increase market value
Kotlin, Jetpack Compose, and an understanding of backend architecture are presented as core strategies for Android developers who want to remain relevant and command higher salaries. The piece argues that adopting Kotlin and the modern Compose UI toolkit streamlines development and aligns developers with current platform standards, while backend knowledge helps engineers contribute across the stack and communicate better with server teams. Together these skills increase employability and market value. The article also emphasizes a growth-oriented mindset: keep learning, follow platform trends, and integrate architectural thinking into app design. This approach positions developers for senior roles and cross-functional collaboration, and helps them adapt to evolving platform APIs, modern libraries, and industry demands. In short, combining language, UI toolkit, backend literacy, and a learning mindset is the recommended path for Android careers into 2025 and beyond.
为你的 Android 职业做长远准备:2025 年及以后需要的技能、库与心态
Kotlin、Compose 与后端架构是让 Android 开发者保持相关性并获得更高薪资的关键。

重點摘要

以 Kotlin 作为主要 Android 开发语言
采用 Jetpack Compose 构建现代化 UI
了解后端架构以提升市场价值
文章提出 Kotlin、Jetpack Compose 与后端架构知识,作为 Android 开发者在 2025 年及以后保持竞争力并争取更高薪资的核心做法。採用 Kotlin 与 Compose 可提升开发效率、与平台标准接轨;了解后端架构有助于跨团队协作与系统化思考。文章强调持续学习、拓展技能组合,不应局限于旧 API 或单一专长;通过掌握语言、现代 UI 工具与架构思维,开发者能提升就业价值、胜任更资深或跨职能的角色,并更容易应对平台与行业的变化。
為你的 Android 職涯築起防護:2025 年後的技能、函式庫與心態
Kotlin、Compose 與後端架構是讓 Android 開發者保持相關性並獲得更高薪資的關鍵。

重點摘要

以 Kotlin 作為主要 Android 開發語言
採用 Jetpack Compose 建構現代化 UI
理解後端架構以提升市場價值
Kotlin、Jetpack Compose 與後端架構知識被提出為 Android 開發者在 2025 年及以後維持競爭力並爭取較高薪資的核心策略。採用 Kotlin 和 Compose 可提升開發效率並與平台現況接軌;理解後端架構則有利於跨團隊協作與完整系統思考。文章強調持續學習與拓展技能組合、避免侷限於舊有 API 或單一專長,透過掌握語言、現代 UI 工具與架構思維,開發者能提升就業價值、取得資深或跨職能角色,並更容易因應平台與產業變化。

Automating Android Dev Workflows: CI/CD, Code Gen & Productivity Hacks

Automating Android Dev Workflows: CI/CD, Code Gen & Productivity Hacks
Stop manually testing — let your pipeline run tests and validate changes automatically.

重點摘要

Advocates shifting manual testing into automated CI/CD pipelines
Suggests using code generation to reduce boilerplate and speed development
Presents productivity-oriented workflow changes and automation hacks
This article argues for automating Android development workflows by moving manual tasks—especially testing—into automated pipelines. It emphasizes establishing CI/CD processes that run builds and tests on each change so developers no longer rely on ad hoc local checks. The piece highlights code generation as a way to eliminate repetitive boilerplate, reduce human error, and accelerate implementation of common patterns. Combined automation and productivity tweaks can streamline feedback loops, increase confidence in releases, and free engineers to focus on higher‑value work. Rather than testing manually, the recommended approach is to design pipelines that validate functionality, run unit and integration checks, and gate merges. Overall the guidance centers on practical automation: improve developer efficiency and product quality by delegating routine verification and repetitive code tasks to CI/CD and generation tools.
自动化 Android 开发流程:CI/CD、代码生成与效率技巧
停止手动测试,让你的流水线自动执行测试与验证。

重點摘要

将手动测试移入自动化 CI/CD 流程
利用代码生成功能减少样板代码与重复劳动
通过流程与自动化提高反馈速度与开发效率
本文主张通过自动化优化 Android 开发流程,重点是把手动测试交由 CI/CD 流水线执行,避免依赖零散的本地检查。文章强调建立能在每次变更时自动构建与测试的机制,从而缩短反馈周期并提升发布信心;同时建议使用代码生成来消除重复样板代码、减少人为错误并加快常见模式的实现。将这些自动化与效率技巧结合起来,可以让团队将时间放在更高价值的任务上,让例行验证和重复代码交给工具与流水线处理,从而整体提升产品质量与开发效率。
自動化 Android 開發流程:CI/CD、程式碼生成功能與生產力技巧
停止手動測試,讓你的 CI/CD 管線自動替你跑測試與驗證。

重點摘要

把手動測試移入自動化 CI/CD 管線
以程式碼生成功能減少樣板碼與重複工作
透過流程與自動化提升回饋速度與開發效率
本文主張透過自動化來優化 Android 開發流程,尤其是將手動測試交由 CI/CD 管線執行,以免依賴零散的本機檢查。作者強調建立能在每次變更時自動建置與測試的流程,藉此縮短回饋循環並提升發布信心;同時建議採用程式碼生成功能來消除重複樣板碼、降低人為錯誤並加速常見模式的實作。結合這些自動化與生產力技巧,可以讓團隊把時間留給更有價值的工作,讓例行驗證與重複性程式碼交由工具與管線處理,整體提升產品品質與開發效率。

Ship Android, iOS & Web Apps in Days with Compose Multiplatform: The Ultimate GTM Stack

Ship Android, iOS & Web Apps in Days with Compose Multiplatform: The Ultimate GTM Stack
Part 1: Master configuration-driven UI with Kotlin Multiplatform + Compose — positioned as a React Native & Flutter killer.

重點摘要

Use Kotlin Multiplatform + Compose to share UI logic across Android, iOS and Web.
Emphasizes configuration-driven UI to reduce duplication and speed delivery.
Outlines a go-to-market (GTM) stack for rapid cross-platform app shipping.
This article, Part 1 of a series, explains how Kotlin Multiplatform combined with Compose Multiplatform can be used to build configuration-driven user interfaces that let teams ship Android, iOS, and web applications in days. It argues that centralizing UI configuration and sharing Kotlin-based UI logic via Compose reduces cross-platform duplication, shortens development and release cycles, and improves maintainability and UX consistency. The post frames Compose Multiplatform as a compelling alternative to React Native and Flutter and presents the idea of an ultimate go-to-market stack to accelerate delivery. Focused on mastering configuration-driven UI patterns, the piece introduces practical rationale, suggested tooling and workflow considerations, and prepares readers for deeper implementation details in subsequent installments.
使用 Compose Multiplatform 在数日内交付 Android、iOS 与 Web 应用:终极 GTM 技术栈
第 1 部分:掌握以配置驱动的 UI,结合 Kotlin Multiplatform 与 Compose — 被定位为 React Native 与 Flutter 的竞争替代方案。

重點摘要

通过 Kotlin Multiplatform + Compose 共享跨平台 UI 逻辑。
以配置驱动的 UI 降低重复,提高交付速度。
提出用于快速上线的 GTM(Go‑To‑Market)技术栈思路。
本文为系列的第一部分,介绍如何利用 Kotlin Multiplatform 与 Compose Multiplatform 构建以配置驱动的 UI,从而在数日内将 Android、iOS 与 Web 应用交付上线。文章认为,通过集中化的 UI 配置与共享 Kotlin 的 UI 逻辑,团队可以减少跨平台重复工作、缩短开发与发布周期,并提升可维护性与用户体验一致性。文中将 Compose Multiplatform 定位为一个可与 React Native 和 Flutter 竞争的替代方案,概述了加速交付的 GTM 技术栈与工作流建议,为后续章节的实施细节做好铺垫。
使用 Compose Multiplatform 在數日內交付 Android、iOS 與 Web 應用:終極 GTM 技術堆疊
第一部分:掌握以設定驅動的 UI,使用 Kotlin Multiplatform 與 Compose — 被定位為 React Native 與 Flutter 的競爭替代方案。

重點摘要

以 Kotlin Multiplatform + Compose 共享跨平台 UI 邏輯。
透過設定驅動 UI 減少重複並加速交付時程。
提出加速上線的 GTM(Go‑To‑Market)技術堆疊構想。
本文為系列的第一部分,說明如何透過 Kotlin Multiplatform 與 Compose Multiplatform 建構以設定為驅動的 UI,快速將 Android、iOS 與 Web 應用上線。文章主張透過集中化的 UI 設定與共享 Kotlin UI 邏輯,團隊可減少跨平台重複、縮短開發與發布時間,並將 Compose Multiplatform 定位為能與 React Native、Flutter 競爭的替代方案。內容聚焦於掌握設定驅動 UI 模式,並提出一套關鍵的 GTM(Go‑To‑Market)技術堆疊與實務建議,為後續章節的實作細節奠定基礎。

Async/Await with Room & Local Storage: The Android Developer’s Guide to Safe Concurrency

Async/Await with Room & Local Storage: The Android Developer’s Guide to Safe Concurrency
Master safe, non-blocking database operations with Kotlin’s async/await and Room to build faster, more responsive Android apps.

重點摘要

Use Kotlin async/await to keep database work off the main thread
Combine Room for structured local storage with coroutine-based concurrency
Reduce UI jank and improve responsiveness via safe, non-blocking DB operations
This guide explains how Android developers can use Kotlin’s async/await together with the Room persistence library to perform safe, non‑blocking local database operations. By moving DB work off the main thread and coordinating it with coroutine-based async/await patterns, apps can avoid blocking calls that cause UI jank and unresponsiveness. The article positions this approach as a practical way to integrate Room’s structured local storage with modern concurrency constructs, emphasizing safe concurrency practices when accessing and updating local data. The result is guidance aimed at helping developers build faster, more responsive Android applications through careful use of asynchronous operations and Room’s abstractions for persistent storage.
Async/Await 与 Room 的本地存储:Android 开发者的安全并发指南
利用 Kotlin 的 async/await 与 Room 实现安全且非阻塞的数据库操作,构建更快、更响应的 Android 应用。

重點摘要

用 async/await 将数据库操作移出主线程
将 Room 的本地存储与协程并发模式结合
通过非阻塞数据库访问降低 UI 卡顿并提升响应性
本文介绍了 Android 开发者如何将 Kotlin 的 async/await 与 Room 持久化库结合,进行安全、非阻塞的本地数据库操作。通过把数据库工作放到主线程之外并使用协程管理异步流程,可以避免阻塞调用导致的 UI 卡顿,从而提升应用的响应性。文章将这种方法作为实用指南,强调在访问和更新本地数据时应注意的并发安全要点,帮助开发者利用现代异步模式与 Room 的数据抽象构建更快速、更流畅的 Android 应用。
使用 async/await 與 Room 管理本機儲存:Android 開發者的安全併發指南
以 Kotlin 的 async/await 結合 Room,掌握安全且不阻塞的資料庫操作,打造更快速、更順暢的 Android 應用。

重點摘要

用 async/await 將資料庫工作移出主執行緒
結合 Room 提供結構化的本機儲存與協同程式併發
透過非阻塞的資料庫操作降低 UI 卡頓、提升回應性
本文說明 Android 開發者如何把 Kotlin 的 async/await 與 Room 持久化庫結合,以進行安全且不阻塞的本機資料庫操作。透過將資料存取與處理移出主執行緒並以協同程式(coroutines)協調非同步流程,可以避免阻塞呼叫造成的 UI 卡頓,提升應用回應性。文章將此方法定位為實務指南,強調在存取與更新本機資料時的安全併發做法與考量,協助開發者以現代非同步模式與 Room 的資料抽象,建立更快速、更順暢的 Android 應用程式。

MVVM Clean Architecture in Android

MVVM Clean Architecture in Android
Building maintainable, scalable, and testable Android applications requires a solid architectural foundation.

重點摘要

Stresses the need for a solid architecture to support maintainability.
Links architectural choices to scalability as apps grow.
Emphasizes design decisions that improve testability.
This comprehensive guide argues that building maintainable, scalable, and testable Android applications requires a solid architectural foundation. It presents the combination of the MVVM pattern with Clean Architecture principles as an approach to separate concerns, isolate business logic, and reduce coupling between layers. By using a layered, dependency‑rule‑oriented design, developers can make codebases easier to understand, modify, and test, which in turn supports long‑term project evolution. The guide highlights the motivations and benefits of such structures—clearer separation between UI and domain logic, improved ability to write automated tests for core rules, and greater capacity to scale as features expand—making architecture a practical tool for sustaining and evolving Android apps.
Android 中的 MVVM 与 Clean Architecture
要构建可维护、可扩展且易于测试的 Android 应用,需要坚实的架构基础。

重點摘要

强调稳固架构对可维护性的必要性。
指出架构选择与应用可扩展性之间的关系。
重视通过设计提升系统的可测试性。
这篇综合性指南指出,要构建可维护、可扩展且易于测试的 Android 应用,必须建立坚实的架构基础。文章提出将 MVVM 模式与 Clean Architecture 原则结合的思路,通过分层与关注点分离来隔离业务逻辑、降低耦合,从而提高测试性与扩展性。内容集中讨论架构设计的动机与好处,帮助开发者在长期演进的项目中保持代码可读性与可修改性,并将架构视为改善测试流程和系统维护的实用工具。
Android 中的 MVVM 與 Clean Architecture
要建立可維護、可擴充且易於測試的 Android 應用,需有堅實的架構基礎。

重點摘要

強調穩固架構對可維護性的必要性。
指出架構選擇與應用擴充性間的關聯。
重視透過設計提升系統的可測試性。
這篇綜合性指南指出,要打造可維護、可擴展且易於測試的 Android 應用,必須建立穩固的架構基礎。文章說明將 MVVM 模式與 Clean Architecture 原則結合的思路,透過分層與關注點分離來隔離商業邏輯並降低耦合,從而提升測試性與擴展性。內容聚焦於架構設計的動機與益處,協助開發者在長期演進的專案中維持程式碼可讀性與可修改性,並以架構作為改善測試流程與系統維護的工具。

Kotlin Symbol Processing (KSP): The Future of Code Generation Is Here

Kotlin Symbol Processing (KSP): The Future of Code Generation Is Here
Stop wrestling with annotations — discover the 2x compilation speed improvement that KSP brings along with simple compile-time solutions.

重點摘要

KSP offers a 2x improvement in compilation speed
Simplifies compile-time code generation compared to annotation-based approaches
Aims to reduce developer friction when generating code
This short piece introduces Kotlin Symbol Processing (KSP) as a modern alternative for compile-time code generation, emphasizing that it can double compilation speed and simplify the developer experience. Rather than continuing to struggle with annotation-processing workflows, KSP presents straightforward compile-time solutions that aim to make generated code handling faster and less cumbersome. The article highlights the key benefit — roughly a twofold build-speed improvement — and frames KSP as a practical way to reduce friction around annotations and generation tasks in Kotlin projects. Readers are encouraged to explore KSP as a performance-focused tool for streamlining build-time generation, maintaining that it addresses common pain points encountered with traditional annotation processing.
Kotlin 符号处理(KSP):代码生成的未来已到来
别再为注解头疼——KSP 带来约 2 倍的编译速度提升,并提供简明的编译期解决方案。

重點摘要

KSP 可实现约 2 倍的编译速度提升
比传统注解处理更简化的编译期代码生成方式
旨在减少开发者在生成代码与注解处理上的摩擦
本文简要介绍了 Kotlin Symbol Processing(KSP),将其作为一种现代化的编译期代码生成替代方案,强调 KSP 可带来约 2 倍的编译速度提升并简化开发者体验。作者指出,与继续与注解处理流程纠缠不同,KSP 提供更直接的编译期解决办法,使生成代码的流程更快、更不繁琐。文章将 KSP 描述为一个侧重性能与便利性的实用工具,建议开发者考虑在 Kotlin 项目中采用,以缓解传统注解处理带来的常见痛点。
Kotlin 符號處理(KSP):程式碼生成的未來已到來
別再為註解苦惱──KSP 帶來約 2 倍的編譯速度提升,並提供簡潔的編譯期解決方案。

重點摘要

KSP 可帶來約 2 倍的編譯速度提升
比傳統註解處理更簡化的編譯期程式碼生成
降低開發者在生成程式碼與註解間的摩擦
本文介紹 Kotlin Symbol Processing(KSP)作為一種現代化的編譯期程式碼生成替代方案,重點指出 KSP 可提升約 2 倍的編譯速度,並能簡化開發流程。文章主張,與持續與註解處理系統抗爭不同,KSP 提供更直接的編譯期解法,能讓程式碼生成處理更快速且不那麼繁瑣。整體上,作者將 KSP 描述為一個著重效能與開發便利性的工具,建議開發者考慮在 Kotlin 專案中採用,以減少傳統註解處理所帶來的痛點。

Android Animations in Compose: The Beginner’s Guide (Part 1: Simple State Transitions)

Android Animations in Compose: The Beginner’s Guide — Simple State Transitions (Part 1)
Mastering animate*AsState — the essential, state-driven API for beautiful and effortless single-property transitions.

重點摘要

Introduces animate*AsState as Compose's basic animation API
Focuses on simple, state-driven single-property transitions
Aimed at beginners seeking practical, easy-to-follow guidance
This beginner-focused article introduces animate*AsState, the core state-driven animation API in Jetpack Compose for handling single-property transitions. It explains why animate*AsState is useful for creating smooth, declarative animations tied to state changes and shows how it simplifies common tasks such as animating values when a state flips. The piece is Part 1 of a series and concentrates on simple transitions, offering conceptual clarity and practical examples to help developers replace manual, imperative animation code with concise, readable Compose patterns. By mastering animate*AsState, readers can achieve visually pleasing, predictable animations with minimal code and better integration into Compose's reactive model.
Android 在 Compose 的动画:初学者指南 — 简单状态过渡(第1部分)
掌握 animate*AsState——这一以状态驱动的核心 API,可轻松实现单一属性的优雅过渡。

重點摘要

介绍 Compose 中的 animate*AsState 基本概念
侧重简单的状态驱动单属性过渡示例
为初学者提供实用且易于理解的指导
本文为系列第一篇,介绍 Jetpack Compose 中的 animate*AsState,这是一个以状态为驱动、用于实现单一属性动画(如数值或颜色变化)的核心 API。文章说明 animate*AsState 如何在状态变化时自动生成平滑过渡,使开发者能够以声明式、简洁的方式替代繁复的命令式动画代码。内容侧重概念讲解与实作示例,旨在帮助初学者快速掌握在 Compose 中创建可预测且美观的动画效果。
Android 在 Compose 的動畫:初學者指南 — 簡單狀態轉換(第一部)
掌握 animate*AsState──這個以狀態驅動的核心 API,可輕鬆實現單一屬性的美觀過渡。

重點摘要

介紹 Compose 中的 animate*AsState 基本用法
聚焦於簡單的狀態驅動單屬性過渡
為初學者提供實務且易懂的指引
本文為系列的第一篇,介紹 Jetpack Compose 中的 animate*AsState,這是以狀態為驅動、用來實現單一屬性動畫(如數值或顏色變化)的核心 API。文章說明 animate*AsState 如何在狀態變更時自動產生流暢的過渡,讓開發者以宣告式、簡潔的寫法取代冗長的命令式動畫程式碼。內容強調概念與實作範例,幫助初學者快速上手在 Compose 中建立可預測且美觀的動畫效果。

Jetpack Compose 1.9.2 vs 1.8 — The Evolution That Actually Matters

Jetpack Compose 1.9.2 vs 1.8 — The Evolution That Actually Matters
From performance headaches to drop-shadow perfection: here's what makes Compose 1.9.2 the release Android developers have been waiting for.

重點摘要

Addresses long-standing performance issues in Compose
Improves visual rendering including drop-shadow quality
Represents a meaningful upgrade for everyday Android development
This article examines why Jetpack Compose 1.9.2 is a notable step forward compared to 1.8, arguing that the release resolves important developer pain points. It highlights improvements that go beyond incremental changes — from eliminating performance headaches to refining visual details like drop shadows — and explains how these refinements translate into a smoother, more reliable development experience. The piece frames 1.9.2 as the version Android developers have been waiting for, emphasizing practical benefits such as better rendering fidelity and fewer performance regressions. Rather than focusing on surface-level updates, the article presents 1.9.2 as a substantive evolution that positively impacts real-world app development and developer productivity.
Jetpack Compose 1.9.2 与 1.8 —— 真正重要的演进
从性能问题到投影阴影的完美:这就是让 Compose 1.9.2 成为 Android 开发者期待已久的版本的原因。

重點摘要

解决长期存在的性能困扰
提升渲染质量与阴影表现
为日常 Android 开发带来实际改进
本文探讨了为何 Jetpack Compose 1.9.2 相较于 1.8 是一次重要的升级,指出该版本解决了许多开发者关心的痛点,并在视觉呈现上有显著改进。文章从性能优化切入,延伸到渲染细节(例如投影阴影)的完善,说明这些改动如何带来更流畅、更可靠的开发体验。作者认为 1.9.2 不只是小幅更新,而是对真实项目开发和开发效率具有实质影响的演进,因此被视为许多 Android 开发者期待的发布。
Jetpack Compose 1.9.2 與 1.8 —— 真正重要的演進
從效能頭痛到投影陰影的完美:這就是讓 Compose 1.9.2 成為 Android 開發者期待已久的版本的原因。

重點摘要

解決長期存在的效能問題
改進視覺呈現與陰影效果
對日常 Android 開發帶來實質性提升
本文說明為何 Jetpack Compose 1.9.2 相較於 1.8 是一個值得關注的版本,指出此版本解決了開發者長期遇到的痛點,並在畫面細節上帶來明顯改進。文章從效能優化談起,延伸到渲染品質的提升(例如投影陰影的表現),說明這些改進如何轉化為更順暢且穩定的開發體驗。作者強調,1.9.2 並非僅是表面更新,而是能實際影響真實專案開發與工作效率的重要演進,因此被視為開發者一直在等待的版本。

Cross-Platform Integration of the Box2D v3 Physics Engine in Kotlin Multiplatform via JNI and C…

Cross-Platform Integration of the Box2D v3 Physics Engine in Kotlin Multiplatform via JNI and C…
The article describes integrating Box2D v3 into Kotlin Multiplatform by bridging native C code through JNI and C interop.

重點摘要

Integrates Box2D v3 with Kotlin Multiplatform
Uses JNI and native C interop to bridge the engine
Discusses trade-offs and practical guidance for cross-platform use
This Medium article by Hasan Tunçay outlines an approach to integrating the Box2D v3 physics engine into a Kotlin Multiplatform project by leveraging JNI and native C interop. It frames the motivation for reusing a proven C/C++ physics library from Kotlin targets, and highlights general challenges and considerations when combining native and managed code—such as performance, portability, and maintenance trade-offs. The post aims to provide practical guidance for exposing native engine functionality to Kotlin modules, building and packaging native components, and handling cross-platform interoperability. The author includes the aphorism “Docendo discimus” (“by teaching, we learn”), underlining the intent to share concrete experience and lessons for developers tackling physics engine integration across platforms.
在 Kotlin Multiplatform 中通过 JNI 与 C 将 Box2D v3 物理引擎跨平台集成
本文介绍如何通过 JNI 与原生 C 互通将 Box2D v3 集成到 Kotlin Multiplatform 项目中。

重點摘要

将 Box2D v3 集成到 Kotlin Multiplatform
使用 JNI 与 C 原生互通桥接引擎
讨论跨平台使用时的权衡与实践建议
Hasan Tunçay 在 Medium 的文章介绍了如何将 Box2D v3 物理引擎集成到 Kotlin Multiplatform 项目中,借助 JNI 与原生 C 互通在多平台复用成熟的 C/C++ 引擎。文章概述了整合的动机、涉及的跨平台互操作性挑战,以及在性能、可移植性与维护之间的权衡与实践建议。作者引用了「Docendo discimus(教学即是学习)」一语,表明通过分享经验为需要在不同平台调用原生物理引擎的开发者提供参考。
在 Kotlin Multiplatform 中透過 JNI 與 C 將 Box2D v3 物理引擎跨平台整合
文章說明如何透過 JNI 與原生 C 互通將 Box2D v3 整合到 Kotlin Multiplatform 專案中。

重點摘要

將 Box2D v3 整合進 Kotlin Multiplatform
透過 JNI 與 C 原生互通橋接引擎
說明效能、可攜性與維護的取捨與實作建議
Hasan Tunçay 在 Medium 的文章說明如何將 Box2D v3 物理引擎整合進 Kotlin Multiplatform,透過 JNI 與原生 C 互通來在多平台使用成熟的 C/C++ 引擎。文章說明整合動機、可能遇到的跨平台與原生互操作性挑戰,以及在效能、可攜性與維護間的取捨與實作建議。作者以「Docendo discimus(教學即學習)」作為引述,表達分享經驗與教學的目的,為需要在不同平台調用原生物理引擎的開發者提供參考。

Day 1 — Why Error Handling in Kotlin Coroutines Matters — Understanding Failures Inside launch {}

Day 1 — Why Error Handling in Kotlin Coroutines Matters — Understanding Failures Inside launch {}
Kotlin coroutines made asynchronous programming clean and structured, but error handling is where most developers struggle.

重點摘要

Kotlin coroutines simplify asynchronous programming structure.
Handling errors in coroutines remains a common developer challenge.
Understanding failures inside launch {} is essential for robust code.
Kotlin coroutines have streamlined asynchronous programming by providing a clean, structured approach, yet many developers still find error handling difficult. This article highlights why managing exceptions in coroutine contexts matters, focusing on failures that occur inside the launch {} builder. It emphasizes that while coroutines improve code organization and concurrency control, exceptions propagate differently than in synchronous code, and incorrect handling can lead to silent failures or unexpected application behavior. The piece encourages readers to learn how launch {} behaves with thrown exceptions, to recognize common pitfalls, and to apply proper strategies for observing, propagating, or containing coroutine failures so that asynchronous systems remain predictable and maintainable.
第 1 天 — 为什么 Kotlin 协程中的错误处理很重要 — 理解 launch {} 内的失败
Kotlin 协程使异步编程更清晰有结构,但错误处理仍是大多数开发者的难题。

重點摘要

Kotlin 协程简化了异步编程的结构。
协程中的错误处理对开发者来说具有挑战性。
需要理解 launch {} 内异常的行为以避免隐性失败。
Kotlin 协程为异步编程带来更清晰的结构与控制,但错误处理仍是常见痛点。文章强调在协程上下文中,异常的传播与同步代码不同,尤其在使用 launch {} 时,失败可能不会如预期被观察或传递,从而导致应用出现隐性错误或不稳定行为。作者建议开发者理解 launch {} 的失败处理机制,识别常见陷阱,并采用合适策略来观察、传播或隔离协程中的错误,以使异步系统更可预期并便于维护。
第 1 天 — 為何 Kotlin 協程中的錯誤處理很重要 — 理解 launch {} 內的失敗
Kotlin 協程讓非同步程式結構化且乾淨,但錯誤處理仍是多數開發者的難題。

重點摘要

Kotlin 協程簡化了非同步程式設計。
協程中的錯誤處理對開發者來說具挑戰性。
需理解 launch {} 內例外的行為以避免隱性失敗。
Kotlin 協程為非同步程式帶來更清晰的結構與控制,但錯誤處理仍是常見的痛點。文章指出在協程上下文中,例外的傳播與同步程式不同,特別是在使用 launch {} 時,失敗可能不會如預期被觀察或傳遞,導致應用出現隱性錯誤或行為不穩。作者提醒開發者理解 launch {} 的失敗處理機制,辨識常見陷阱,並採取適當策略來觀察、傳播或隔離協程中的錯誤,從而讓非同步系統更可預期與易於維護。

Building AI Agents in Kotlin – Part 2: A Deeper Dive Into Tools 

Building AI Agents in Kotlin — Part 2: A Deeper Dive Into Tools
We build an ExecuteShellCommandTool so the agent can run code, observe failures, and iterate using real output to close the engineering feedback loop.

重點摘要

Koog tools require a name, description, Args and Result classes, and an execute() method.
ExecuteShellCommandTool supports confirmation handlers (prompt or brave mode) and configurable executors with timeout handling.
Running and testing code improved agent performance (from 249/500 to 279/500) and highlights the need for better logging and observability.
This article demonstrates how to extend Koog-based Kotlin agents by implementing an ExecuteShellCommandTool that enables agents to run shell commands and use real execution feedback to improve code. It outlines the required tool anatomy—name, description, Args/Result classes, and an execute() method—and shows how the execute flow requests confirmation, runs the command, captures output and exit codes, and returns results to the LLM. Safety options include interactive confirmation or a Brave mode for automated approval. The CommandExecutor handles timeouts by preserving partial output and forcibly terminating overdue processes. Integrating the tool required minimal agent changes (including a BRAVE_MODE toggle and an enhanced “definition of done” prompt encouraging tests). Benchmarks show execution capability increased success from 50% to 56%. The next article will cover logging and tracing to improve visibility and iteration.
在 Kotlin 构建 AI 代理 — 第 2 部分:深入工具功能
示範如何实现 ExecuteShellCommandTool,让代理能够运行代码、观察失败并基于真实输出迭代改进,闭合工程反馈回路。

重點摘要

Koog 工具需定义名称、说明、Args 与 Result 类以及 execute() 方法。
ExecuteShellCommandTool 提供确认处理(交互或 Brave 模式)和可配置的执行器与超时策略。
允许运行与测试代码可提升代理表现(从 249/500 上升到 279/500),并需加强日志与可观测性。
文章展示了如何为 Koog 框架扩展工具功能,以 ExecuteShellCommandTool 为例使代理具备运行 shell 命令并利用执行反馈改进代码的能力。说明了工具的要素:名称、描述、Args/Result 类别与 execute() 的实现流程——请求确认、执行命令、收集输出与退出码,并把信息传回给 LLM。为降低风险,提供交互式确认或可通过环境变量启用的 Brave 模式;执行器通过超时机制在保留尽可能多的输出后强制结束长时进程。将工具集成到代理只需少量代码变更(含 BRAVE_MODE 切换与增强的「完成定义」,鼓励写测试)。基准结果显示执行能力能提高成功率,下一步将聚焦日志与追踪以改善可视化和调优。
在 Kotlin 建置 AI 代理 — 第二部分:深入探討工具
我們實作 ExecuteShellCommandTool,使代理能執行程式、觀察錯誤,並以實際輸出反覆改進,完成工程上的回饋迴路。

重點摘要

Koog 工具需提供名稱、描述、Args 與 Result 類別,以及 execute() 方法。
ExecuteShellCommandTool 支援確認處理(互動或 Brave 模式)與可配置的指令執行器與逾時處理。
執行與測試功能可提升代理表現(由 249/500 提升至 279/500),同時需加強日誌與可觀察性。
本文說明如何在 Koog 框架中新增工具,以 ExecuteShellCommandTool 為例讓代理能執行 shell 指令並回饋輸出。文章詳述工具結構:名稱、描述、Args/Result 類別與 execute() 實作流程,包含請求使用者確認、執行指令、擷取輸出與退出碼,並將結果回傳給 LLM。針對安全提供互動確認或自動核准的 Brave 模式;逾時機制則嘗試保留部分輸出再強制終止,以利 LLM 分析。整合上只需少量修改(加入 BRAVE_MODE 與強化「完成定義」以促使撰寫測試)。基準測試顯示新增執行能力能明顯改善成功率,後續將聚焦日誌與追蹤以提升可觀察性。

Kodee’s Kotlin Roundup: Too Many News to Keep Quiet About

Kodee’s Kotlin Roundup: Too Many News to Keep Quiet About
Kotlin 2.3.0-RC is out, documentation and Multiplatform resources got a fresh home on kotlinlang.org, and a host of community events and learning opportunities are available now.

重點摘要

Kotlin 2.3.0-RC released with new features and improvements
Kotlin Multiplatform docs moved to kotlinlang.org with Language/Multiplatform toggle
Multiple community events and learning programs: Reddit AMA, four-week KMP course, livestreams, KotlinConf’26 offers and GSoC 2025 projects
This roundup collects November Kotlin news and resources: Kotlin 2.3.0-RC has arrived, inviting users to explore new features before the stable release. Kotlin Multiplatform documentation now lives on kotlinlang.org with a toggle to switch between Language and Multiplatform views, improving navigation and clarity. The Kotlin team will host a week-long Reddit AMA where developers can ask about language design and tooling. Learning opportunities include a four-week Kotlin Multiplatform program (Nov 10–Dec 8), a December 3 livestream for Android developers transitioning to full‑stack KMP, and KotlinConf’26 announcements (20% Black Friday ticket discount and an imminent Call for Speakers deadline). Other items: an expanding Kotlin adoption guide series, a Ktor user survey, Exposed 1.0.0-rc-3 refinements, highlights of Google Summer of Code 2025 projects, and a Compose Multiplatform for web poll — plus curated links and YouTube highlights for further exploration.
Kodee 的 Kotlin 摘要:太多消息不能沉默
Kotlin 2.3.0-RC 已发布;Multiplatform 文档迁移到 kotlinlang.org 并加上 Language/Multiplatform 切换;还有许多学习与社区活动可参与。

重點摘要

Kotlin 2.3.0-RC 发布,包含多项改进与新功能
Kotlin Multiplatform 文档搬到 kotlinlang.org,导航更顺畅
丰富的学习与社区活动:Reddit AMA、四周 KMP 课程、直播、KotlinConf 与 GSoC 成果展示
本篇汇总了十一月的 Kotlin 要闻与资源:Kotlin 2.3.0-RC 已上线,欢迎开发者尝鲜并了解新功能;Kotlin Multiplatform 文档迁移到 kotlinlang.org,新增语言/多平台切换,阅读与查找更便利。社区活动涵盖一周的 JetBrains Reddit AMA、自 11 月 10 日开始的为期四周 KMP 学习营(至 12 月 8 日)、12 月 3 日面向 Android 开发者的实作直播,以及 KotlinConf’26 的黑五票券折扣与即将截止的征稿。其他亮点包括 Kotlin 采用指南系列、Ktor 年度问卷、Exposed 1.0.0-rc-3 的修整、Google Summer of Code 2025 项目展示,以及关于 Compose Multiplatform for web 的快速投票与多项延伸阅读与视频。
Kodee 的 Kotlin 快訊:太多消息無法悄悄放過
Kotlin 2.3.0-RC 已推出;Multiplatform 文件移至 kotlinlang.org 並新增 Language/Multiplatform 切換;同時有多場學習與社群活動可參與。

重點摘要

Kotlin 2.3.0-RC 推出,邀請使用者試用新功能
Kotlin Multiplatform 文件搬到 kotlinlang.org,導覽與結構更流暢
眾多學習與社群活動:Reddit AMA、四週 KMP 課程、直播、KotlinConf 與 GSoC 專案亮點
本期快訊彙整十一月 Kotlin 重要更新與資源:Kotlin 2.3.0-RC 已釋出,鼓勵開發者探索即將到來的穩定版功能;Kotlin Multiplatform 文件正式移至 kotlinlang.org,新增語言與多平台檢視切換,查找資訊更方便。社群活動方面,Kotlin 團隊在 Reddit 舉辦為期一週的 AMA,開放提問;同時有為期四週的 KMP 學習旅程(11/10–12/08)、面向 Android 開發者的 12/03 實作直播,以及 KotlinConf’26 的黑色星期五票券折扣與即將截止的講者徵稿。其他重點還包括 Kotlin 採用指南系列、Ktor 使用者問卷、Exposed 1.0.0-rc-3 改良以及 GSoC 2025 的專案成果與網頁/YouTube 推薦資源。

Java Weekly, Issue 621

Java Weekly, Issue 621
Spring Framework 7.0 is now generally available, adding Java 25 and Jakarta EE 11 support, a Java 17 baseline, programmatic bean registration, core resilience features, and improved null safety.

重點摘要

Spring Framework 7.0 reaches GA with Java 25 and Jakarta EE 11 support
Wide set of Spring and JVM ecosystem releases (Quarkus, Micronaut, Helidon, WildFly, Elasticsearch, etc.)
Curated technical reads on scaling, distributed systems, and Baeldung Black Friday All Access sale
This issue highlights the general availability of Spring Framework 7.0, which brings support for Java 25 and Jakarta EE 11 while maintaining a Java 17 baseline, and introduces features like programmatic bean registration, core resilience enhancements, and stronger null safety. Immediate IntelliJ IDEA 2025.3 support is noted, and commentary points to modern Java library choices that reduce boilerplate. The roundup lists numerous Spring-related GA releases (Spring Data, Spring AI, Spring for GraphQL, Spring for Apache Kafka, Vault, REST Docs) and broader JVM ecosystem updates including Quarkus, Micronaut, Helidon, WildFly, Payara, Netflix components, and Elasticsearch. The newsletter also curates technical and engineering articles on container scaling, event-driven patterns, distributed graph storage, and personalized models, and closes with a Pick of the Week promoting Baeldung’s Black Friday All Access course sale.
Java Weekly,第 621 期
Spring Framework 7.0 已正式发布,新增对 Java 25 与 Jakarta EE 11 的支持、以 Java 17 为基线,并引入程序化 bean 注册、核心弹性特性与增强的 null 安全。

重點摘要

Spring Framework 7.0 正式发布,支持 Java 25 与 Jakarta EE 11
大量 Spring 及 JVM 生态系统更新(Quarkus、Micronaut、Helidon、WildFly、Elasticsearch 等)
精选技术阅读涵盖容器扩展、事件驱动与分布式图存储,并有 Baeldung 黑五 All Access 优惠
本期重点报道 Spring Framework 7.0 的 GA 发布:支持 Java 25 与 Jakarta EE 11、维持 Java 17 基线,并带来程序化 bean 注册、核心弹性增强与更严格的 null 安全。文中同时提到 IntelliJ IDEA 2025.3 已立即提供支持,并引用讨论现代 Java 精简样板代码的文章。汇整了多项 Spring 生态及相关框架的新版本与发布(如 Spring Data、Spring AI、Spring for GraphQL、Kafka、Vault、REST Docs),以及 Quarkus、Micronaut、Helidon、WildFly、Payara、Netflix 组件和 Elasticsearch 的更新。技术与随笔板块推荐了关于容器扩展、事件重试、分布式图存储与个性化模型整合的文章,结尾推广 Baeldung 的黑五 All Access 课程优惠。
Java Weekly,第 621 期
Spring Framework 7.0 已正式釋出,新增對 Java 25 與 Jakarta EE 11 的支援、以 Java 17 為基線,並導入程式化 bean 註冊、核心韌性功能與加強的 null 安全性。

重點摘要

Spring Framework 7.0 正式發布,支援 Java 25 與 Jakarta EE 11
大量 Spring 與 JVM 生態系更新及版本釋出(Quarkus、Micronaut、Helidon、WildFly 等)
技術文章精選涵蓋容器擴展、事件驅動、分散式圖儲存,並有 Baeldung 黑色星期五 All Access 優惠
本期聚焦 Spring Framework 7.0 的 GA 發行:支援 Java 25 與 Jakarta EE 11、維持 Java 17 為基線,並帶來程式化 bean 註冊、核心韌性功能與更嚴格的 null 安全。文章並提到 IntelliJ IDEA 2025.3 已同步支援,與一篇討論現代 Java 減少樣板程式碼的推薦閱讀。稿中匯整多項 Spring 生態與相關框架的更新(如 Spring Data、Spring AI、Spring for GraphQL、Kafka、Vault、REST Docs),以及 Quarkus、Micronaut、Helidon、WildFly、Payara、Netflix 組件與 Elasticsearch 的版本資訊。技術與省思專欄包含容器擴展、事件重排、分散式圖存儲與個人化模型整合等主題,最後推薦 Baeldung 的黑五 All Access 方案。

SecureRandom Generator on Linux – Blocking or Not Blocking?

SecureRandom Generator on Linux – Blocking or Not Blocking?
On modern Linux kernels (5.19+), /dev/urandom provides sufficient entropy and does not block, making NativePRNGNonBlocking suitable for practical use.

重點摘要

/dev/random is traditionally blocking while /dev/urandom is non-blocking, but kernel 5.19+ makes blocking unlikely after early boot.
Java exposes multiple SecureRandom algorithms (e.g., NativePRNG, NativePRNGBlocking, NativePRNGNonBlocking) chosen by java.security settings or getInstance().
Benchmarking (20,000 samples of 256 bytes) showed negligible time difference between blocking and non-blocking NativePRNG implementations (~96 ms each).
This article explains how Java SecureRandom interacts with Linux entropy sources and whether blocking is a practical concern. SecureRandom can use several algorithms (NativePRNG, NativePRNGBlocking, NativePRNGNonBlocking and others) chosen by JVM settings or explicit getInstance() calls; requesting a missing algorithm throws NoSuchAlgorithmException. Linux provides /dev/random (blocking) and /dev/urandom (non-blocking), but since kernel 5.19 the system gathers enough entropy after early boot so blocking is unlikely and /dev/urandom is considered safe for practical cryptographic use. The author also benchmarks NativePRNGBlocking vs NativePRNGNonBlocking with JMH, generating 20,000 samples of 256 bytes; both finish in about 95–96 ms, showing no meaningful performance difference. The conclusion: NativePRNGNonBlocking is sufficient for most applications on modern Linux.
Linux 上的 SecureRandom 生成器 — 会阻塞吗?
在现代 Linux(5.19 及以上)中,/dev/urandom 已具备足够熵且不会阻塞,因此可以放心使用 NativePRNGNonBlocking。

重點摘要

/dev/random 传统上会阻塞,/dev/urandom 为非阻塞,但自 5.19 内核后除早期启动外阻塞情况罕见。
Java 提供多种 SecureRandom 算法(如 NativePRNG、NativePRNGBlocking、NativePRNGNonBlocking),可通过 java.security 或 getInstance() 指定。
JMH 基准测试(20,000 个 256 字节样本)显示阻塞与非阻塞实现耗时相近,均约 95–96 ms,差异可忽略。
本文讨论 Java SecureRandom 如何依赖 Linux 的熵源以及是否会因熵耗尽而阻塞。SecureRandom 的默认算法由 JVM、java.security 配置或 java.security.egd 决定,也可用 getInstance() 指定特定算法,若不存在则抛出 NoSuchAlgorithmException。Linux 提供 /dev/random(会阻塞)和 /dev/urandom(非阻塞),但自内核 5.19 起,除开机早期外系统可获得足够熵,因此阻塞已不太可能,/dev/urandom 的随机性亦足够实际使用。作者用 JMH 对 NativePRNGBlocking 与 NativePRNGNonBlocking 做了基准(20,000 个 256 字节样本),两者均约 95–96 ms,结论是非阻塞版本对大多数应用已足够。
Linux 上的 SecureRandom 產生器 — 會阻塞嗎?
在現代 Linux(5.19 以上)中,/dev/urandom 已具足夠熵且不會阻塞,因此可安全使用 NativePRNGNonBlocking。

重點摘要

Linux 的 /dev/random 傳統上會阻塞,/dev/urandom 則為非阻塞,但 5.19 以後在啟動階段之外阻塞情況不太可能發生。
Java 提供多種 SecureRandom 演算法(如 NativePRNG、NativePRNGBlocking、NativePRNGNonBlocking),可由 java.security 設定或 getInstance() 選用。
用 JMH 對比 20,000 個 256 字節樣本的測試顯示,阻塞與非阻塞版本執行時間都約為 95–96 ms,差異可忽略。
本文說明 SecureRandom 如何使用 Linux 的隨機來源以及是否會遇到阻塞問題。SecureRandom 可由 JVM 預設或透過 getInstance() 指定不同演算法,若所請求的演算法不存在會拋出 NoSuchAlgorithmException。Linux 有 /dev/random(會阻塞)與 /dev/urandom(非阻塞),但自核心 5.19 起,除開機早期外系統可取得足夠熵,因此阻塞情況不太可能,/dev/urandom 對實務應用已足夠安全。作者以 JMH 針對 NativePRNGBlocking 與 NativePRNGNonBlocking 做效能測試(20,000 個 256 字節樣本),兩者約同為 95–96 ms,結論是非阻塞版本對大多數應用已足夠。

Key Encapsulation Mechanism API in Java

Key Encapsulation Mechanism API in Java
JEP 452 adds a standardized KEM API to Java 21, providing a provider-neutral way to establish shared symmetric keys using public-key cryptography.

重點摘要

JEP 452 introduces a standardized KEM API into Java 21 (javax.crypto).
KEM defines key pair generation, encapsulation, and decapsulation for shared secret establishment.
Java's KEM supports RSA-KEM, ECIES, DHKEM and allows providers to add algorithms (including post‑quantum KEMs).
JEP 452 adds a standardized Key Encapsulation Mechanism (KEM) API to Java 21, filling a gap in the Java Cryptography Architecture by providing a provider-neutral, single API for establishing shared symmetric keys using public-key cryptography. A KEM abstracts key pair generation, encapsulation (producing a shared secret and an encapsulation blob), and decapsulation (recovering the secret from the blob and private key), avoiding format and padding pitfalls and supporting both classical and post‑quantum algorithms. The JDK implementation includes RSA-KEM, ECIES, and DHKEM (RFC 9180), and providers can add others like Kyber. The tutorial shows encapsulation and decapsulation utility methods, a KemResult record to hold the shared key and encapsulation, and unit tests that verify matching secrets and that decapsulation fails with the wrong private key.
Java 中的密钥封装机制 (KEM) API
JEP 452 在 Java 21 中引入了标准化的 KEM API(javax.crypto),为使用公钥加密安全建立共享对称密钥提供与提供者无关的方式。

重點摘要

JEP 452 将标准化的 KEM API 集成到 Java 21(javax.crypto)。
KEM 包括密钥对生成、封装(生成共享密钥与封装数据)与解封装三部分。
实现支持 RSA‑KEM、ECIES 与 DHKEM,且允许提供者添加后量子等新 KEM。
JEP 452 将 Key Encapsulation Mechanism (KEM) API 并入 Java 21,弥补 Java 加密架构中长期存在的空白,提供一个单一、与提供者中立的接口来通过公钥密码学安全地建立共享对称密钥。KEM 将密钥对生成、封装(发送方用接收方公钥产生共享密钥与封装 blob)和解封装(接收方用私钥与封装还原共享密钥)三者标准化,避免直接使用 Cipher 时的格式与填充问题,并支持传统与后量子算法。文章演示了封装/解封装的工具实现、KemResult 容器及单元测试,验证密钥一致性并确保错误私钥无法解封装。
Java 的金鑰封裝機制 (KEM) API
JEP 452 在 Java 21 中將標準化的 KEM API(javax.crypto)納入平台,提供一個與供應者無關的方式以公鑰加密建立共享對稱金鑰。

重點摘要

JEP 452 在 Java 21 引入標準化的 KEM API,整合於 javax.crypto。
KEM 包含金鑰產生、封裝(產生共享金鑰與封裝資料)與解封裝三個步驟。
實作支援 RSA‑KEM、ECIES 與 DHKEM,供應者可新增(例如後量子 Kyber)。
JEP 452 將 Key Encapsulation Mechanism (KEM) API 納入 Java 21,解決過去需混用 Cipher、KeyAgreement 或 KeyGenerator 的碎片化作法,提供一個單一且與供應者無關的介面來以公鑰安全建立共享對稱金鑰。KEM 定義金鑰對生成、封裝(由收件人公鑰產生共享金鑰與封裝 blob)及解封裝(用私鑰與封裝資料還原共享金鑰),避免格式與填充問題,適用於傳統與後量子演算法。文章示範了封裝與解封裝的 KemUtils 實作、KemResult 記錄類型,以及模擬正確與錯誤私鑰情況的單元測試,以驗證秘密金鑰匹配且錯誤私鑰會導致解封裝失敗。

Introduction to the Chicory Native JVM WebAssembly Runtime

Introduction to the Chicory Native JVM WebAssembly Runtime
Chicory is a JVM-native WebAssembly runtime written entirely in Java that loads .wasm binaries, exposes their exports as Java APIs, and removes the need for JNI or external native dependencies.

重點摘要

Chicory runs .wasm modules inside the JVM and exposes exports as Java APIs.
Imports are provided via Java HostFunction instances registered in a Store and resolved at instantiation.
Calls cross a long-only boundary: parameters as long and results as long[], with special handling for floats and memory-based non-numeric data.
Chicory is a JVM-native WebAssembly runtime implemented entirely in Java that loads .wasm binaries into the JVM, exposes exported functions as Java APIs, and avoids JNI or native dependencies. The tutorial shows a Maven quickstart: add the Chicory runtime dependency, compile a minimal add.wat to add.wasm (using wat2wasm), and run a JUnit 5 test that parses the module, instantiates it, and calls the exported add function. It then demonstrates imports by defining a Java HostFunction (double), registering it in a Store, instantiating the module through that store, and invoking an exported useDouble helper. The article explains value-type mapping—calls cross a long-only boundary (parameters as long, results as long[]), how to pass floating-point values and non-numeric data via linear memory, and common errors (unresolved imports at instantiation and missing exports at call time). Full code is available on GitHub.
Chicory 原生 JVM WebAssembly 运行时简介
Chicory 是用纯 Java 编写的 JVM 原生 WebAssembly 运行时,可在 JVM 中加载 .wasm 二进制并将其导出暴露为 Java API,从而无需 JNI 或外部原生依赖。

重點摘要

在 JVM 内加载并运行 .wasm 模块,将导出映射为 Java 可调用的 API。
通过 HostFunction 和 Store 提供并解析模块所需的导入接口。
调用通过 long 唯一边界传递参数与返回值(参数为 long,结果为 long[]);浮点和非数值需额外打包或通过线性内存处理。
本文介绍 Chicory:一个纯 Java 实现的 JVM 原生 WebAssembly 运行时,展示如何在 Maven 项目中快速上手并使用 JUnit 5 运行示例。步骤包括添加 Chicory 运行时依赖、使用 wat2wasm 将简单的 add.wat 编译为 add.wasm、通过 Parser 将二进制解析为模块并实例化以调用其 add 导出。接着演示如何在 Java 中定义 HostFunction(如 double)、将其注册到 Store 并通过该 Store 实例化模块以满足导入。文章还说明了值类型映射:调用跨越 long 边界,浮点需位级打包,非数值通过线性内存传递,并讨论了常见错误(实例化时未解析的导入与调用时缺失的导出)。完整代码托管于 GitHub。
Chicory 原生 JVM WebAssembly 執行時介紹
Chicory 是以純 Java 實作的 JVM 原生 WebAssembly 執行時,能在 JVM 中載入 .wasm 二進位並將匯出暴露為 Java API,免除 JNI 或外部原生相依。

重點摘要

在 JVM 內執行 .wasm 模組,將匯出轉為可由 Java 呼叫的 API。
以 HostFunction 與 Store 提供並解析模組所需的匯入。
呼叫跨越 long 唯一邊界(參數以 long 傳入、結果為 long[]),浮點與非數值需額外序列化或透過記憶體交換。
本文介紹 Chicory——一個以 Java 完整實作、能在 JVM 內載入並執行 .wasm 的原生 WebAssembly 執行時,並透過範例示範如何在 Maven 專案與 JUnit 5 中運行。內容包括加入 Chicory 依賴、以 wat2wasm 將簡單的 add.wat 編譯為 add.wasm、用 Parser 與 Instance 實例化模組並呼叫其 add 匯出;接著示範如何用 HostFunction 在 Store 中提供匯入(例如 double),以及說明值型別對應:呼叫以 long 為邊界傳遞參數與回傳陣列,浮點須以位元打包,非數值資料透過線性記憶體交換。最後列出常見錯誤(匯入未解析與匯出名稱錯誤)與修正方式,完整原始碼可在 GitHub 找到。

Find Out What Keystore the JVM Is Using

Find Out What Keystore the JVM Is Using
This tutorial shows multiple ways to determine which keystore the JVM is using, including checking JAVA_HOME, the user keystore, and Java system properties.

重點摘要

Use JAVA_HOME to locate the system-wide cacerts at lib/security/cacerts
A user-specific keystore (.keystore) resides in the user's home directory
Programmatically query System.getProperty and javax.net.ssl.trustStore at runtime
This article explains three practical methods to discover which keystore a running JVM uses. First, the JAVA_HOME environment variable points to the Java installation where the default truststore (cacerts) is located under lib/security/cacerts, which is useful for manual tasks. Second, when keytool runs without an explicit keystore path, Java uses a user-specific keystore (typically ~/.keystore) in the user's home directory for private keys and certificates. Third, the most reliable approach is programmatic: use Java system properties such as System.getProperty("java.home"), System.getProperty("user.home"), and check System.getProperty("javax.net.ssl.trustStore") to construct and verify keystore paths at runtime. The article also notes that java.home (the running JVM) can differ from the JAVA_HOME environment variable on systems with multiple Java installs, and recommends the programmatic method for deployed applications.
查找 JVM 正在使用的 Keystore
本教程介绍多种方式来确定 JVM 正在使用哪个 keystore,包括检查 JAVA_HOME、用户 keystore,以及通过 Java 系统属性获取位置。

重點摘要

使用 JAVA_HOME 可定位系统级 cacerts(位于 lib/security/cacerts)
未指定 keystore 时,Java 会在用户主目录使用或生成 .keystore(存放个人密钥)
通过 System.getProperty 和 javax.net.ssl.trustStore 在运行时程序化检测最可靠
文章介绍了三种查找 JVM keystore 的方法:首先,可通过 JAVA_HOME 环境变量快速定位到安装目录下的 lib/security/cacerts 来找到系统信任库;其次,若使用 keytool 未指定 keystore,会在用户主目录生成或使用 .keystore,通常用于存放个人私钥与证书;最后,推荐在运行时以程序方式读取 System.getProperty("java.home")、System.getProperty("user.home") 及 System.getProperty("javax.net.ssl.trustStore"),根据这些属性构建并验证 keystore 路径。这种程序化方式在多 Java 版本或部署环境中最为可靠,因为 java.home(运行时 JVM)可能与环境变量 JAVA_HOME 不同。
找出 JVM 使用的 Keystore
本教程示範多種方法來判斷 JVM 使用哪個 keystore,包括檢查 JAVA_HOME、使用者 keystore,以及透過 Java 系統屬性取得位置。

重點摘要

透過 JAVA_HOME 可快速定位系統層級的 cacerts(lib/security/cacerts)
未指定 keystore 時會在使用者目錄產生或使用 .keystore(個人金鑰)
以 System.getProperty 查詢 java.home、user.home 與 javax.net.ssl.trustStore 最為可靠
文章說明三種找出 JVM keystore 的實務方法:一是利用 JAVA_HOME 環境變數,快速組出安裝目錄下的 lib/security/cacerts 以找到系統預設的 truststore;二是留意 keytool 若未指定檔案,會在使用者主目錄建立或使用 .keystore,該檔案通常存放個人私鑰與憑證;三是以程式方式在執行時透過 System.getProperty 讀取 java.home、user.home 及 javax.net.ssl.trustStore,然後檢查檔案是否存在,這種方法在部署環境中最可靠,也能避免 java.home 與系統中 JAVA_HOME 不一致的問題。

A Guide to Engine Test Kit in Junit 5

A Guide to the Engine Test Kit in JUnit 5
The Engine Test Kit executes Test Plans and collects statistics and events so you can verify discovery, high-level outcomes, and specific reasons for aborted or failed tests.

重點摘要

Execute Test Plans and gather pass/fail/skip/abort statistics
Verify Test Engine discovery and that tests are detected
Inspect test Events to assert specific abort or failure reasons
This tutorial introduces JUnit 5's Engine Test Kit, which runs Test Plans and collects statistics and detailed events. It uses a simple Display/Platform example with tests that succeed, fail, are disabled (skipped), and abort via failed assumptions. The guide shows how to verify that a chosen Test Engine (e.g., junit-jupiter) is discoverable and detects the test class, then how to execute the suite and assert high-level statistics (started, finished, succeeded, failed, skipped, aborted). It also demonstrates drilling down into Events to assert why a test aborted (abortedWithReason and message checks) or failed (finishedWithFailure and exception type), and mentions other assertion helpers like skippedWithReason and finishedSuccessfully. The piece concludes by noting the benefit of these checks for preventing regressions and verifying expected failure reasons.
JUnit 5 中 Engine Test Kit 的指南
Engine Test Kit 可执行 Test Plan 并收集统计与事件,帮助验证测试引擎发现、总体结果以及测试中止或失败的具体原因。

重點摘要

执行 Test Plan,收集通过、失败、跳过和中止统计
验证所选测试引擎可被发现并能检测测试类
通过 Events 断言中止或失败的具体原因与异常类型
本教程介绍了 JUnit 5 的 Engine Test Kit,说明如何运行测试计划并收集不同层次的统计和事件信息。以 Display/Platform 为例,包含成功、失败、被禁用(跳过)以及因假设不满足而中止的测试。演示先确认 junit-jupiter 或其他引擎可以被发现并识别测试类,随后执行测试并用 assertStatistics 验证启动、完成、成功、失败、跳过和中止的数量。进一步展示如何获取 Events,使用 abortedWithReason、finishedWithFailure 等断言来验证测试中止或失败的具体原因与异常类型,从而有助于防止回归并确认预期的失败原因。
JUnit 5 的 Engine Test Kit 使用指南
Engine Test Kit 可執行 Test Plan 並蒐集統計與事件,讓你驗證測試引擎的發現、整體結果,以及測試被中止或失敗的具體原因。

重點摘要

執行 Test Plan,蒐集通過、失敗、跳過與中止數據
確認並驗證所選 Test Engine 能正確發現測試
檢查 Events 以斷言中止或失敗的具體原因
本文說明 JUnit 5 的 Engine Test Kit 如何用於執行測試並取得不同層級的統計與事件資訊。範例以 Display 與 Platform 類別建立四種測試情境:成功、失敗、被標註跳過(@Disabled)與因假設失敗而中止。示範先驗證 junit-jupiter 測試引擎能被發現並偵測到測試類,接著執行 Test Plan 並使用 assertStatistics 驗證啟動、完成、成功、失敗、跳過與中止的數量。進一步展示如何透過 Events 與方法如 abortedWithReason、finishedWithFailure 斷言中止或失敗的原因與例外類型,強化對回歸或新失敗原因的偵測與確認。

How to Make IntelliJ IDEA Insert a New Line at Every End of File

How to Make IntelliJ IDEA Insert a New Line at Every End of File
Use IntelliJ’s On Save setting or a project .editorconfig to ensure every file ends with exactly one newline and remove extra trailing blank lines.

重點摘要

Enable Ensure every saved file ends with a line break in Editor > General > On Save
Use Editor > Code Style rules to enforce file-ending formatting on reformat/save
Prefer .editorconfig for team-wide consistency and to enforce insert_final_newline
IntelliJ IDEA can automatically add a newline at the end of files to improve consistency and avoid small problems in version control. You can enable a built-in On Save option (Editor > General > On Save) to ensure every saved file ends with a line break, or configure Code Style settings for language-specific formatting during reformat/save. For team projects, add insert_final_newline = true (and trim_trailing_whitespace = true) to a .editorconfig in the project root so all editors respect the rule. To avoid multiple blank lines at EOF, enable the Remove trailing blank lines at the end of the file option; combined with the line-break setting this guarantees exactly one final newline. These steps reduce unnecessary Git diffs, linter warnings, and merge issues while keeping files clean.
让 IntelliJ IDEA 在每个文件末尾插入换行符
通过 IDE 的 On Save 选项或在项目中使用 .editorconfig,可确保每个文件以单一换行结尾并自动删除多余空白行。

重點摘要

在 Editor > General > On Save 启用 Ensure every saved file ends with a line break
通过 Editor > Code Style 为特定语言设置结尾格式化规则
在项目根目录添加 .editorconfig(insert_final_newline = true)以确保团队一致性
本文介绍了在 IntelliJ IDEA 中保证文件结尾换行的一些方法:可以启用 IDE 的 On Save 选项来在保存时自动添加换行,或通过 Code Style 的设置在重格式化或保存时应用结尾规则。对于团队协作,推荐在项目根目录添加 .editorconfig,并设置 insert_final_newline = true 与 trim_trailing_whitespace = true,让不同编辑器遵循相同标准。若出现文件末尾多余空行,可启用移除尾部空白行的选项,与插入单一换行配合,确保每个文件仅以一个换行符结尾,从而减少 Git 差异、警告和合并问题。
讓 IntelliJ IDEA 在每個檔案結尾自動插入換行符
透過 IDE 的 On Save 選項或在專案加入 .editorconfig,可確保每個檔案以單一換行結尾並自動移除多餘空白行。

重點摘要

在 Editor > General > On Save 啟用 Ensure every saved file ends with a line break
透過 Editor > Code Style 為語言設定檔案結尾格式化規則
在專案根目錄放置 .editorconfig(insert_final_newline = true)以強制團隊一致性
本文說明在 IntelliJ IDEA 中管理檔案結尾換行的方法:可在 IDE 設定中啟用「確保每個已儲存檔案以換行結尾」,或利用 Code Style 的格式化規則在重格式化或儲存時調整結尾行為。對於團隊專案,建議在專案根目錄建立 .editorconfig 並設定 insert_final_newline = true 及 trim_trailing_whitespace = true,讓不同編輯器都遵守相同規則。此外可啟用「移除檔案結尾多餘空白行」選項,與自動插入換行搭配使用,確保每個檔案僅以一個換行符結尾,減少 Git 差異、合併衝突與程式碼風格警告。

Using TermQueries in Elastic Search

Using TermQuery in Elasticsearch
TermQuery performs exact matches against fields without analysis or tokenization, making it ideal for structured data such as keywords, booleans, numeric values, and identifiers.

重點摘要

TermQuery matches fields exactly without analysis, suitable for structured data.
Combine multiple term queries in a bool filter for fast, cache-friendly AND filtering.
Applicable via Query DSL, the Elasticsearch Java Client, Spring Data repositories, and inside aggregations.
TermQuery is a core Elasticsearch primitive that performs exact, non-analyzed matches on fields, making it appropriate for structured data like keywords, booleans, numeric values, and identifiers. The article walks through practical examples: defining a users index and mappings, bulk-inserting documents, and composing multiple term filters inside a bool.filter to retrieve exact AND-style matches. It shows how to execute these queries directly with Query DSL, with the Elasticsearch Java Client (including unit-test examples), and via Spring Data Elasticsearch repositories, noting that repository methods produce equivalent term queries but with less control. The piece also demonstrates combining term filters with terms aggregations to count roles among active users, and includes configuration snippets for Java/Spring clients and beans, highlighting trade-offs between speed, cacheability, and scoring.
在 Elasticsearch 中使用 TermQuery
TermQuery 对字段进行不经分析的精确匹配,适用于关键字、布尔、数值和标识符等结构化数据。

重點摘要

TermQuery 提供精确、不分析的字段匹配,适合结构化数据场景。
在 bool.filter 中组合多个 term 查询可实现快速、易缓存的 AND 过滤。
文章演示了 Query DSL、Elasticsearch Java Client、Spring Data repository 及聚合中的用法。
本文介绍了 Elasticsearch 的 TermQuery,用于对字段执行不经分析的精确匹配,适合标签、布尔、数值与 ID 等结构化数据。文章通过实例讲解:建立 users 索引与映射、批量插入文档,并在 bool.filter 中结合多个 term 查询以实现 AND 条件的过滤,从而获得快速且缓存友好的结果(但缺乏评分)。示例涵盖直接使用 Query DSL、使用 Elasticsearch Java Client(含单元测试)、以及通过 Spring Data Elasticsearch repository 的等价查询,并展示如何在聚合中先用 term 过滤再按 role.keyword 做 terms 聚合以统计活跃用户的角色分布。文中还给出 Java/Spring 客户端与 bean 的配置片段,并说明了适用场景与权衡。
在 Elasticsearch 中使用 TermQuery
TermQuery 對欄位做不經分析的精確比對,適合用於標籤、布林、數值與識別碼等結構化資料。

重點摘要

TermQuery 對欄位做精確、不分析的匹配,適合結構化資料。
多個 term filter 可在 bool.filter 中以 AND 條件組合,取得快速且易快取的結果。
示範了 Query DSL、Elasticsearch Java Client、Spring Data repository 與聚合中的應用。
本文介紹 Elasticsearch 的 TermQuery,說明它如何在不經分析、斷詞或文本轉換的情況下對欄位做精確匹配,適用於標籤、布林值、數值與識別碼等結構化資料;並示範實作流程:建立 users 索引與 mappings、以 Bulk 新增範例文件,然後在 bool.filter 中組合多個 term 查詢以取得 AND 條件的匹配(快速且易快取,但不具評分)。文章同時展示如何使用 Query DSL、Elasticsearch Java Client(含單元測試)以及 Spring Data Elasticsearch repository 進行等價查詢,並示範如何在聚合中先過濾再以 terms 聚合統計活躍使用者的角色分佈,最後附上 Java/Spring 的客戶端與 bean 配置範例與利弊說明。

Flexible Layouts in Jetpack Compose: Mastering FlowRow and FlowColumn

Flexible Layouts in Jetpack Compose: Mastering FlowRow and FlowColumn
Go beyond Row and Column to create flexible, wrap-around layouts for truly responsive Android apps.

重點摘要

FlowRow and FlowColumn provide wrap-around layout behavior
Enable responsive, adaptable UIs for dynamic content
Simplify layout logic beyond fixed Row and Column arrangements
This Medium article introduces FlowRow and FlowColumn in Jetpack Compose as flexible alternatives to the standard Row and Column. It explains how these components let children wrap onto new lines or columns, making layouts more adaptive to varying content sizes and screen widths. By using FlowRow/FlowColumn developers can build responsive interfaces that handle dynamic items—such as tags, chips, or variable-length content—without custom measurement or manual flow logic. The piece highlights practical benefits for Android UI design, including improved wrapping, spacing, and alignment control, and offers guidance to apply the APIs for more resilient, adaptive layouts in Compose-based apps.
Jetpack Compose 弹性布局:掌握 FlowRow 与 FlowColumn
超越 Row 和 Column,使用可换行的布局创建真正响应式的 Android 应用界面。

重點摘要

FlowRow 与 FlowColumn 支持换行与包裹行为
增强界面对动态内容与不同屏幕宽度的适应性
比固定的 Row/Column 减少自定义测量与布局逻辑
本文在 Medium 上介绍了 Jetpack Compose 中的 FlowRow 与 FlowColumn,作为传统 Row 与 Column 的灵活替代。它们允许子元素在空间不足时自动换行或换列,使布局能根据内容大小与屏幕宽度动态调整,适用于标签、chips 或长度不一的列表项。文章强调这些组件能简化自定义测量与流式布局逻辑,改善间距与对齐控制,并提供实用建议,帮助开发者在 Compose 中构建更健壮、响应式的 UI。
Jetpack Compose 彈性版面:掌握 FlowRow 與 FlowColumn
跳脫 Row 與 Column,利用可換行的版面建立真正具響應力的 Android 應用介面。

重點摘要

FlowRow 與 FlowColumn 支援換行與包裝行為
提升介面對動態內容與不同螢幕寬度的適應力
比固定的 Row/Column 減少自訂測量與版面流程邏輯
本文介紹 Jetpack Compose 中的 FlowRow 與 FlowColumn,作為傳統 Row 與 Column 的彈性替代方案。這兩種容器可讓子元件在空間不足時自動換行或換列,使版面能依內容長度與螢幕寬度動態調整,適合用於標籤、chips 或長短不一的項目。文章說明其能簡化自訂測量與排版邏輯、改善間距與對齊控制,並提供實務應用方向,協助開發者在 Compose 中建立更具韌性與響應能力的 UI。

Understanding SharedFlow: Why It Doesn’t Store Values (and Why That’s a Good Thing)

Understanding SharedFlow: Why It Doesn’t Store Values (and Why That’s a Good Thing)
Kotlin’s SharedFlow is one of the most powerful tools in modern Android development—especially for one-time events like navigation.

重點摘要

SharedFlow does not retain values by default.
Its behavior makes it well suited for one-time events such as navigation.
Not storing values prevents new collectors from receiving stale events.
This article examines Kotlin’s SharedFlow and the rationale behind its design choice not to store emitted values by default. It highlights SharedFlow’s strength for one-time events (for example, navigation actions) where delivering past events to newly started collectors would be undesirable. By not persisting values, SharedFlow avoids replaying stale events and helps ensure event handling remains timely and intentional. The piece frames this characteristic as a feature rather than a limitation, explaining that avoiding implicit state retention simplifies event-driven patterns in Android apps and reduces surprising behavior for subscribers. Overall, the article argues that SharedFlow’s non-storing semantics improve correctness and predictability when dealing with ephemeral UI events.
理解 SharedFlow:为什么它不存储值(以及这为何是好事)
Kotlin 的 SharedFlow 是现代 Android 开发中非常强大的工具,尤其适用于像导航这类一次性事件。

重點摘要

SharedFlow 默认不会保留已发出的值。
这让它非常适合一次性事件(例如导航)。
不存储值可防止新收集者接收到过时事件。
本文探讨了 Kotlin 的 SharedFlow 及其默认不存储发出值的设计理念。文章强调,SharedFlow 在处理一次性事件(如导航操作)时尤为合适,因为将过去事件回放给新启动的收集者通常是不期望的。通过不持久化值,SharedFlow 避免了回放过时事件,确保事件处理更为及时且有意图。作者将这种行为视为优点而非限制,认为避免隐含状态有助于简化事件驱动的开发模式,并减少订阅者遇到意外行为的可能性。总体而言,文章认为 SharedFlow 的不存储语义提高了处理临时 UI 事件时的正确性与可预测性。
理解 SharedFlow:為何它不儲存值(以及這為何是好事)
Kotlin 的 SharedFlow 是現代 Android 開發中極為強大的工具,特別適合像導覽這類一次性事件。

重點摘要

SharedFlow 預設不會保留已發出的值。
這使它非常適合處理一次性事件(例如導覽)。
不儲存值可避免新收集者收到過時事件。
本文說明 Kotlin 的 SharedFlow 以及其預設不儲存發出值的設計原因。文章指出,SharedFlow 在處理一次性事件(如導覽行為)時特別有用,因為將過去事件回放給新加入的收集者通常是不希望的。透過不持久化值,SharedFlow 能避免回放過時事件,確保事件的處理保持即時且具意圖性。作者將此行為視為特性而非缺點,認為不隱含狀態有助於簡化以事件為驅動的開發模式,並降低訂閱方遇到意外行為的機率。總體上,本文主張 SharedFlow 的不儲存語義可提升處理臨時 UI 事件時的正確性與可預測性。

Generated by Kotlin News Summarizer with AI Summaries