mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8236075: Minor bootstrap improvements
Reviewed-by: mchung, alanb
This commit is contained in:
parent
3cf8b34d54
commit
c639682887
10 changed files with 208 additions and 145 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
|
@ -26,16 +26,12 @@
|
|||
package java.lang;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class ClassLoaderHelper {
|
||||
|
||||
private ClassLoaderHelper() {}
|
||||
|
||||
/**
|
||||
* Indicates, whether PATH env variable is allowed to contain quoted entries.
|
||||
*/
|
||||
static final boolean allowsQuotedPathElements = false;
|
||||
|
||||
/**
|
||||
* Returns an alternate path name for the given file
|
||||
* such that if the original pathname did not exist, then the
|
||||
|
@ -45,4 +41,25 @@ class ClassLoaderHelper {
|
|||
static File mapAlternativeName(File lib) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a PATH env variable.
|
||||
*
|
||||
* Empty elements will be replaced by dot.
|
||||
*/
|
||||
static String[] parsePath(String ldPath) {
|
||||
char ps = File.pathSeparatorChar;
|
||||
ArrayList<String> paths = new ArrayList<>();
|
||||
int pathStart = 0;
|
||||
int pathEnd;
|
||||
while ((pathEnd = ldPath.indexOf(ps, pathStart)) >= 0) {
|
||||
paths.add((pathStart < pathEnd) ?
|
||||
ldPath.substring(pathStart, pathEnd) : ".");
|
||||
pathStart = pathEnd + 1;
|
||||
}
|
||||
int ldLen = ldPath.length();
|
||||
paths.add((pathStart < ldLen) ?
|
||||
ldPath.substring(pathStart, ldLen) : ".");
|
||||
return paths.toArray(new String[paths.size()]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue