Skip to content

Commit

Permalink
8236705: Use single character variant of String.replace when applicable
Browse files Browse the repository at this point in the history
Reviewed-by: igerasim, alanb
  • Loading branch information
dreis2211 authored and Ivan Gerasimov committed Jan 7, 2020
1 parent 769f853 commit 1cf603e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
@@ -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
Expand Down Expand Up @@ -566,7 +566,7 @@ private ModuleDescriptor deriveModuleDescriptor(JarFile jf)
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)) {
Expand Down
@@ -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
Expand Down Expand Up @@ -64,7 +64,7 @@ public static String toPackageName(String name) {
if (index == -1 || index == name.length()-1) {
return "";
} else {
return name.substring(0, index).replace("/", ".");
return name.substring(0, index).replace('/', '.');
}
}

Expand Down

0 comments on commit 1cf603e

Please sign in to comment.