Clean up Java 27 compatibility hack

未關閉
#1 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
52/100
Issue 類型
重構
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
java
領域
compilers

研究方向

從 src/main/java/software/coley/sourcesolver/util/compat 開始,檢查相容性提交 05b54eb0fabf4b57702d875d808d9ea219c4283d,重點關注 JavacParser 工廠呼叫及其 Java 27 契約。在決定應如何處理 parser 建構之前,先審查所引用的 OpenJDK 變更;完成的標準是清理相容性邏輯,同時不破壞 AST 範圍解析。

由索引模型根據 Issue 內容生成。

描述

enhancement

Compatibility commit: 05b54eb0fabf4b57702d875d808d9ea219c4283d

Compatibility logic: https://github.com/Col-E/SourceSolver/tree/master/src/main/java/software/coley/sourcesolver/util/compat

Somehow the parser factory call didn't totally break.

// Build parser for source and extract the end-pos table so that we can resolve AST ranges
JavacParser parser = factory.newParser(source,
		false /* keepJavadoc */,
		true  /* keepEndPos */,
		false /* keepLineMap */
);

The contract is different now, but doesn't immediately cause problems.

// Build parser for source and extract the end-pos table so that we can resolve AST ranges
JavacParser parser = factory.newParser(source,
		false /* keepJavadoc */,
		true  /* keepLineMap */,
		false /* parseModuleInfo */
);

We may want to also have some compat logic for building the parser instances...


Rant

This dogshit compatibility hack exists because we don't have maven/gradle support for Java 27 yet, but people already noticed because they try and run consuming projects on bleeding edge releases... yay.

I would have liked to use multi-release jars, but oh my god this is impossible. Because we use --add-exports we cannot use --release. And guess what mutli-release support in Maven/Gradle loves to use? Yeah.

I'm sure there's a way around it but I wasted 2.5 hours on this already...


Most javac internal changes can be found here:

  • https://github.com/openjdk/jdk/pulls?q=is%3Apr+author%3Acushon
    • 31058: Clean up calls to deprecated getStartPosition and getEndPosition methods
    • 29994: Don't require a CompilationUnit for end position APIs
    • 29463: Store end positions on more trees
    • 28610: Store end positions directly in JCTree
主要語言
Java
星號
12
分支
2
PR 合併指標
30 天內沒有已合併 PR

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。