changeset 57593:1b28af1e2804

8236705: Use single character variant of String.replace when applicable Reviewed-by: igerasim, alanb Contributed-by: Christoph Dreis <christoph.dreis@freenet.de>
author igerasim
date Tue, 07 Jan 2020 15:33:09 -0800
parents f2dad2a448d0
children d630c0a63222
files src/java.base/share/classes/jdk/internal/module/ModulePath.java src/java.base/share/classes/jdk/internal/module/Resources.java
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/jdk/internal/module/ModulePath.java	Tue Jan 07 21:53:52 2020 +0100
+++ b/src/java.base/share/classes/jdk/internal/module/ModulePath.java	Tue Jan 07 15:33:09 2020 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -566,7 +566,7 @@
         if (attrs != null) {
             String mainClass = attrs.getValue(Attributes.Name.MAIN_CLASS);
             if (mainClass != null) {
-                mainClass = mainClass.replace("/", ".");
+                mainClass = mainClass.replace('/', '.');
                 if (Checks.isClassName(mainClass)) {
                     String pn = packageName(mainClass);
                     if (packages.contains(pn)) {
--- a/src/java.base/share/classes/jdk/internal/module/Resources.java	Tue Jan 07 21:53:52 2020 +0100
+++ b/src/java.base/share/classes/jdk/internal/module/Resources.java	Tue Jan 07 15:33:09 2020 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,7 +64,7 @@
         if (index == -1 || index == name.length()-1) {
             return "";
         } else {
-            return name.substring(0, index).replace("/", ".");
+            return name.substring(0, index).replace('/', '.');
         }
     }