Bug 571040 - [cleanup] Improve "Use String.replace() ..." cleanup

Improve the "Use String.replace() instead of String.replaceAll() when
possible" cleanup
- to apply it also when there are escaped meta chars in the regex and/or
the replacement,
- to use chars when both arguments are Strings of length 1 and
- to handle Pattern.quote() and Matcher.quoteReplacement()

Examples:
s.replaceAll("\\.", "<\e\\\ \\&>") => s.replace(".", "<\\ &>")
s.replaceAll("\\.", "/") => s.replace('.', '/')
s.replaceAll(Pattern.quote(a), Matcher.quoteReplacement(b))
=> s.replace(a, b)

The preview has been adapted to cover these improvements.

More tests have been added and also the preview has been added to the
tests.

Property-based jqwik tests creating 20,100,000 random samples to back up
the verification of the correctness of the toPlainString() method has
been attached to the bug report (these tests are too slow to be run as
regular tests):
https://bugs.eclipse.org/bugs/attachment.cgi?id=285626

Change-Id: Ia9320494b77a972d19757bdfd6914b42b9911491
Signed-off-by: Holger Voormann <eclipse@voormann.de>
4 files changed
tree: e818de5c7021a9cbf1a62a95b996a54435a0b7f5
  1. org.eclipse.jdt.astview/
  2. org.eclipse.jdt.astview.feature/
  3. org.eclipse.jdt.core.manipulation/
  4. org.eclipse.jdt.jeview/
  5. org.eclipse.jdt.jeview.feature/
  6. org.eclipse.jdt.junit/
  7. org.eclipse.jdt.junit.core/
  8. org.eclipse.jdt.junit.runtime/
  9. org.eclipse.jdt.junit4.runtime/
  10. org.eclipse.jdt.junit5.runtime/
  11. org.eclipse.jdt.text.tests/
  12. org.eclipse.jdt.ui/
  13. org.eclipse.jdt.ui.examples.javafamily/
  14. org.eclipse.jdt.ui.examples.projects/
  15. org.eclipse.jdt.ui.junit.sampleproject/
  16. org.eclipse.jdt.ui.tests/
  17. org.eclipse.jdt.ui.tests.refactoring/
  18. org.eclipse.jdt.ui.unittest.junit/
  19. org.eclipse.jdt.ui.unittest.junit.feature/
  20. org.eclipse.ltk.core.refactoring/
  21. org.eclipse.ltk.core.refactoring.tests/
  22. org.eclipse.ltk.ui.refactoring/
  23. org.eclipse.ltk.ui.refactoring.tests/
  24. tests-pom/
  25. .gitignore
  26. CONTRIBUTING
  27. LICENSE
  28. NOTICE
  29. pom.xml
  30. README.md
README.md

Contributing to JDT UI - Java development tools UI

Thanks for your interest in this project.

Project description:

The JDT UI implements the user interface for the Java IDE. This includes views like Package Explorer and JUnit, the Java and properties files editors, Java search, and refactorings. Website: http://www.eclipse.org/jdt/ui/

How to contribute:

Contributions to JDT UI are most welcome. There are many ways to contribute, from entering high quality bug reports, to contributing code or documentation changes. For a complete guide, see the [How to Contribute] 1 page on the team wiki.

Developer resources:

Information regarding source code management, builds, coding standards, and more.

Contributor License Agreement:

Before your contribution can be accepted by the project, you need to create and electronically sign the Eclipse Foundation Contributor License Agreement (CLA).

Forum:

Public forum for Eclipse JDT users.

Search for bugs:

This project uses Bugzilla to track ongoing development and issues.

Create a new bug:

Be sure to search for existing bugs before you create another one. Remember that contributions are always welcome!

Contact:

Contact the project developers via the project's “dev” list.

License

Eclipse Public License (EPL) v2.0