eclipse-platform / eclipse-platform/eclipse.platform
Expressions containing strings with backslash escape character
- Lingua principale
- Java
- Stelle
- 165
- Fork
- 174
- Merge medio
- 2g 8h
- PR unite (30g)
- 22
Descrizione
Not sure it I'm filing this bug in the right place. I was not able to find a duplicate bug for this, but maybe I used the wrong search criteria.
When debugging and using the expressions evaluation window, expressions that contain a string with a backslash (escape) character do no work properly you must add extra escape characters to get the expression to evaluate properly.
Here's a simple expression that illustrates the problem:
"filename.ext".split("//.")
This gives you an error complaining that dot is not a valid escape sequence.
if you use:
"filename.ext".split("////.")
this expression evaluates does split the string into an array of two strings split by the dot. From the Java language spec, this technically shouldn't have given the result of an array of one string matching the entire literal string. It quite obvious that the string input to new expressions is itself requiring escaped input and is not handling the case that an expression itself might be containing strings that contain escaped sequences.
The same issue occurs with an expressions like:
new File("//ext//file.x")
Please note that Java executes the code correctly, you just can't copy and paste those statements from the source code into the expressions window. This is certainly not how anyone would expect it to behave.
I've attached a csv file that lets you know what versions of the various components I have installed. I had also done an update on all the components, so I think I'm pretty much up-to-date and the problem still persists. I've also noticed a StackExchange issue that reported the same observation.
[eclipseInstalledSoftware.csv](https://github.com/eclipse-platform/eclipse.platform/files/11839577/eclipseInstalledSoftware.csv)
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con la finestra di valutazione delle espressioni di Eclipse e riproduci gli esempi usando "filename.ext".split("//.") e new File("//ext//file.x"). Confronta il loro comportamento con quello delle stesse istruzioni Java eseguite dal codice sorgente, usando come contesto le versioni dei componenti allegati. Il lavoro è completato quando l’escaping delle stringhe nello stile del codice sorgente funziona direttamente nella finestra di valutazione senza aggiungere caratteri di escape aggiuntivi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100