mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8194746: (fs) Add equivalents of Paths.get to Path interface
Copy Paths.get() methods to Path.get() methods and have former call latter Reviewed-by: alanb, forax, chegar, psandoz
This commit is contained in:
parent
37f1b2b1e3
commit
9e3d8fd230
18 changed files with 174 additions and 119 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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
|
||||
|
@ -30,7 +30,6 @@ import java.io.FilePermission;
|
|||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Objects;
|
||||
|
@ -63,7 +62,7 @@ final class ProxyClassesDumper {
|
|||
}
|
||||
try {
|
||||
path = path.trim();
|
||||
final Path dir = Paths.get(path.length() == 0 ? "." : path);
|
||||
final Path dir = Path.of(path.length() == 0 ? "." : path);
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Void run() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2018, 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
|
||||
|
@ -34,7 +34,6 @@ import java.lang.reflect.Array;
|
|||
import java.lang.reflect.Method;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
|
@ -346,11 +345,11 @@ class ProxyGenerator {
|
|||
int i = name.lastIndexOf('.');
|
||||
Path path;
|
||||
if (i > 0) {
|
||||
Path dir = Paths.get(name.substring(0, i).replace('.', File.separatorChar));
|
||||
Path dir = Path.of(name.substring(0, i).replace('.', File.separatorChar));
|
||||
Files.createDirectories(dir);
|
||||
path = dir.resolve(name.substring(i+1, name.length()) + ".class");
|
||||
} else {
|
||||
path = Paths.get(name + ".class");
|
||||
path = Path.of(name + ".class");
|
||||
}
|
||||
Files.write(path, classFile);
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue