Col-E / Col-E/SourceSolver

Clean up Java 27 compatibility hack

Aperta
#1 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Java
Stelle
12
Fork
2
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

```java
// 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.
```java
// 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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia in src/main/java/software/coley/sourcesolver/util/compat e ispeziona il commit di compatibilità 05b54eb0fabf4b57702d875d808d9ea219c4283d, concentrandoti sulla chiamata factory di JavacParser e sul relativo contratto Java 27. Esamina le modifiche di OpenJDK a cui si fa riferimento prima di decidere come debba essere gestita la costruzione del parser; il lavoro è completato quando la logica di compatibilità è ripulita senza interrompere la risoluzione degli intervalli dell’AST.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
compilers
Tipo di issue
Refactoring
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
52/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.