Java printer: drops the qualifier a call needs (explicit type arguments, a method named yield)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
Direzione di ricerca
The bug is in the Java printer, reached via JavaInspector.print2 with Formatter2Impl; start by finding where method-call expressions are printed and how the qualifier is chosen. Reproduce with a round trip on the two snippets in the issue (explicit type arguments such as X.<T>empty(), and a method named yield called as this.yield(...)). Done means both snippets print with a qualifier and the output re-parses.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
The Java printer drops the qualifier of a method call in two places where Java requires one. The printed source no longer compiles.
1. Explicit type arguments. Explicit type arguments need a qualifier (Type.<T>m(), this.<T>m(), super.<T>m()). The printer writes them bare, and <T> m() is a syntax error.
static <T> List<T> one(T t) { List<T> l = X.<T>empty(); ... }
<T> List<T> inst() { return this.<T>two(null); }
prints as
static <T> List<T> one(T t) { List<T> l = <T> empty(); ... }
<T> List<T> inst() { return <T> two(null); }
2. A method named yield. Since Java 14, an unqualified call to a method named yield is illegal ("invalid use of a restricted identifier 'yield'"). The printer drops the this.:
String callYield() { return this.yield("a"); }
prints as
String callYield() { return yield("a"); }
Expected
Keep (or write) a qualifier whenever the call has explicit type arguments, or the method is named yield. For a static method that's the type, and for an instance method it's this (or super, or the outer X.this as appropriate).
Seen on
A round trip (parse, then JavaInspector.print2 with Formatter2Impl) on maddi 0.9.5-alpha.5. On real code this is the most common reason a printed file fails to re-parse. In vavr it affects about 30 types, e.g. HashSet.<T>ofAll(elements), Promise.<T>make(executor), TreeMap.<K, V>empty(), and API's this.yield(Function.identity()).
- Lingua principale
- Java
- Stelle
- 1
- Fork
- 1
- Merge medio
- 2h 51m
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CodeLaser/maddi
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
build/ci good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
Tutte le issue di CodeLaser/maddi
Issue simili
-
Fix Math.ceilDiv wrong result for exact positive divisionsForse già presa @pamod-madubashana l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
scala-native/scala-native#5094 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] AI unread message badge counts a batch of new bubbles as one messageForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
apache/rocketmq-dashboard#5784 ·
I maintainer di solito rispondono entro 3 giorni
-
[i18n] 安装实例完成后的成功提示未正确本地化Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
PCL-Community/PCL-CE#3658 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
apache/skywalking#14127 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno