Skip to content

Comments unreadable in Java 8 #659

@zjcz

Description

@zjcz

Description
RSyntaxTextArea formats the comments incorrectly in a Java 8 application. They appear fine in a Java 21 application. I have tested with the SyntaxEditingStyle SYNTAX_STYLE_JAVA, SYNTAX_STYLE_CSHARP and SYNTAX_STYLE_XML

Steps to Reproduce
Specific steps to reproduce the behavior:

  1. Create a new project
  2. Add the RSyntaxTextArea dependency
  3. Add a new file TextEditorDemo.java file, add the code from the Example Usage in the GitHub project readme.md
  4. Run the project
  5. In the text area, type a comment. For example "// This is a Comment" or "/* This is a Comment */"

Expected behavior
I would expect to see the comments as typed, highlighted in green

Actual behavior
The comment text is replaced with illegible characters. The text is correct in the background, and can be copied and pasted into another app fine

Screenshots
Add a screenshot if it helps explain the problem.
This is screenshot from Java 8. The text entered is "//hello, this is a comment in Java 8"
Image

This is screenshot from Java 21.
Image

Java version
What version of Java are you running?
Error exists in Java 8. Error does not exist in Java 21 and comments are shown fine

Additional context
Discovered when using version 3.6.1 but still occurs in 3.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions