Clean up Java 27 compatibility hack

オープン
#1 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
静か
技術スタック
java
領域
compilers

調査の方向性

src/main/java/software/coley/sourcesolver/util/compat から始め、互換性コミット 05b54eb0fabf4b57702d875d808d9ea219c4283d を調査します。JavacParser のファクトリ呼び出しとその Java 27 の契約に焦点を当ててください。パーサーの構築をどのように扱うべきかを決める前に、参照されている 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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。