eclipse-platform / eclipse-platform/eclipse.platform

Expressions containing strings with backslash escape character

Open
#514 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
165
Forks
174
Avg merge
2d 8h
Merged PRs (30d)
22

Description

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)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.