Skip to content

Commit b378f54

Browse files
committedJan 12, 2021
Merge
2 parents b6d51e1 + 2cb271e commit b378f54

File tree

12 files changed

+137
-23
lines changed

12 files changed

+137
-23
lines changed
 

‎make/autoconf/libraries.m4

+12-6
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,18 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
124124
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lpthread"
125125
fi
126126
127-
# Libatomic library
128-
# 32-bit MIPS needs fallback library for 8-byte atomic ops
129-
if test "x$OPENJDK_TARGET_OS" = xlinux &&
130-
(test "x$OPENJDK_TARGET_CPU" = xmips ||
131-
test "x$OPENJDK_TARGET_CPU" = xmipsel); then
132-
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -latomic"
127+
# Atomic library
128+
# 32-bit platforms needs fallback library for 8-byte atomic ops on Zero
129+
if HOTSPOT_CHECK_JVM_VARIANT(zero); then
130+
if test "x$OPENJDK_TARGET_OS" = xlinux &&
131+
(test "x$OPENJDK_TARGET_CPU" = xarm ||
132+
test "x$OPENJDK_TARGET_CPU" = xm68k ||
133+
test "x$OPENJDK_TARGET_CPU" = xmips ||
134+
test "x$OPENJDK_TARGET_CPU" = xmipsel ||
135+
test "x$OPENJDK_TARGET_CPU" = xppc ||
136+
test "x$OPENJDK_TARGET_CPU" = xsh); then
137+
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -latomic"
138+
fi
133139
fi
134140
135141
# perfstat lib

‎make/conf/jib-profiles.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1001,9 +1001,9 @@ var getJibProfilesProfiles = function (input, common, data) {
10011001
// test tasks. Care must however be taken not to polute that work dir by
10021002
// setting the appropriate make variables to control output directories.
10031003
//
1004-
// Use the existance of the top level README as indication of if this is
1004+
// Use the existance of the top level README.md as indication of if this is
10051005
// the full source or just src.conf.
1006-
if (!new java.io.File(__DIR__, "../../README").exists()) {
1006+
if (!new java.io.File(__DIR__, "../../README.md").exists()) {
10071007
var runTestPrebuiltSrcFullExtra = {
10081008
dependencies: "src.full",
10091009
work_dir: input.get("src.full", "install_path"),

‎src/java.base/windows/native/libnio/ch/UnixDomainSockets.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,16 @@ Java_sun_nio_ch_UnixDomainSockets_socketSupported(JNIEnv *env, jclass cl)
9292
return JNI_FALSE;
9393
}
9494
closesocket(s);
95-
return JNI_TRUE;
95+
96+
/* Check for build 18362 or newer, due to Windows bug described in 8259014 */
97+
98+
OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
99+
DWORDLONG cond_mask = 0;
100+
101+
VER_SET_CONDITION(cond_mask, VER_BUILDNUMBER, VER_GREATER_EQUAL);
102+
osvi.dwBuildNumber = 18362; // Windows 10 (1903) or newer
103+
104+
return VerifyVersionInfoW(&osvi, VER_BUILDNUMBER, cond_mask) != 0;
96105
}
97106

98107
JNIEXPORT jint JNICALL

‎src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,15 @@ public String getName() {
7575

7676
@Override
7777
public void init(JavacTask task, String... args) {
78-
// ignore
78+
throw new IllegalStateException("doclint not available");
7979
}
8080

8181
@Override
8282
public boolean isValidOption(String s) {
83-
return false;
83+
// passively accept all "plausible" options
84+
return s.equals(XMSGS_OPTION)
85+
|| s.startsWith(XMSGS_CUSTOM_PREFIX)
86+
|| s.startsWith(XCHECK_PACKAGE);
8487
}
8588
}
8689
}

‎src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import com.sun.tools.javac.platform.PlatformDescription.PluginInfo;
5656
import com.sun.tools.javac.processing.JavacProcessingEnvironment;
5757
import com.sun.tools.javac.resources.CompilerProperties.Errors;
58+
import com.sun.tools.javac.resources.CompilerProperties.Warnings;
5859
import com.sun.tools.javac.tree.JCTree;
5960
import com.sun.tools.javac.util.Context;
6061
import com.sun.tools.javac.util.DefinedBy;
@@ -257,8 +258,11 @@ private void initPlugin(Plugin p, String... args) {
257258
public void initDocLint(List<String> docLintOpts) {
258259
if (docLintOpts.isEmpty())
259260
return;
260-
261-
DocLint.newDocLint().init(this, docLintOpts.toArray(new String[docLintOpts.size()]));
262-
JavaCompiler.instance(context).keepComments = true;
261+
try {
262+
DocLint.newDocLint().init(this, docLintOpts.toArray(new String[docLintOpts.size()]));
263+
JavaCompiler.instance(context).keepComments = true;
264+
} catch (IllegalStateException e) {
265+
Log.instance(context).warning(Warnings.DoclintNotAvailable);
266+
}
263267
}
264268
}

‎src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties

+3
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,9 @@ compiler.warn.deprecated.annotation.has.no.effect=\
20562056
compiler.warn.invalid.path=\
20572057
Invalid filename: {0}
20582058

2059+
compiler.warn.doclint.not.available=\
2060+
No service provider for doclint is available
2061+
20592062
# 0: string
20602063
compiler.err.invalid.path=\
20612064
Invalid filename: {0}

‎src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -876,10 +876,9 @@ static MemorySegment allocateNative(long bytesSize) {
876876
* @param mapMode a file mapping mode, see {@link FileChannel#map(FileChannel.MapMode, long, long)}; the chosen mapping mode
877877
* might affect the behavior of the returned memory mapped segment (see {@link MappedMemorySegments#force(MemorySegment)}).
878878
* @return a new confined mapped memory segment.
879-
* @throws IllegalArgumentException if {@code bytesOffset < 0}.
880-
* @throws IllegalArgumentException if {@code bytesSize < 0}.
881-
* @throws UnsupportedOperationException if an unsupported map mode is specified, or if the {@code path} is associated
882-
* with a provider that does not support creating file channels.
879+
* @throws IllegalArgumentException if {@code bytesOffset < 0}, {@code bytesSize < 0}, or if {@code path} is not associated
880+
* with the default file system.
881+
* @throws UnsupportedOperationException if an unsupported map mode is specified.
883882
* @throws IOException if the specified path does not point to an existing file, or if some other I/O error occurs.
884883
* @throws SecurityException If a security manager is installed and it denies an unspecified permission required by the implementation.
885884
* In the case of the default provider, the {@link SecurityManager#checkRead(String)} method is invoked to check

‎src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/MappedMemorySegmentImpl.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import java.io.IOException;
3535
import java.nio.ByteBuffer;
3636
import java.nio.channels.FileChannel;
37+
import java.nio.file.FileSystem;
38+
import java.nio.file.FileSystems;
3739
import java.nio.file.OpenOption;
3840
import java.nio.file.Path;
3941
import java.nio.file.StandardOpenOption;
@@ -114,8 +116,13 @@ public static MemorySegment makeMappedSegment(Path path, long bytesOffset, long
114116
Objects.requireNonNull(mapMode);
115117
if (bytesSize < 0) throw new IllegalArgumentException("Requested bytes size must be >= 0.");
116118
if (bytesOffset < 0) throw new IllegalArgumentException("Requested bytes offset must be >= 0.");
117-
try (FileChannelImpl channelImpl = (FileChannelImpl)FileChannel.open(path, openOptions(mapMode))) {
118-
UnmapperProxy unmapperProxy = channelImpl.mapInternal(mapMode, bytesOffset, bytesSize);
119+
FileSystem fs = path.getFileSystem();
120+
if (fs != FileSystems.getDefault() ||
121+
fs.getClass().getModule() != Object.class.getModule()) {
122+
throw new IllegalArgumentException("Unsupported file system");
123+
}
124+
try (FileChannel channelImpl = FileChannel.open(path, openOptions(mapMode))) {
125+
UnmapperProxy unmapperProxy = ((FileChannelImpl)channelImpl).mapInternal(mapMode, bytesOffset, bytesSize);
119126
int modes = defaultAccessModes(bytesSize);
120127
if (mapMode == FileChannel.MapMode.READ_ONLY) {
121128
modes &= ~WRITE;

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlOptions.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
import java.util.Set;
3333
import java.util.TreeSet;
3434

35-
import com.sun.tools.doclint.DocLint;
3635
import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
3736
import jdk.javadoc.internal.doclets.toolkit.Messages;
3837
import jdk.javadoc.internal.doclets.toolkit.Resources;
3938
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
4039
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
40+
import jdk.javadoc.internal.doclint.DocLint;
4141

4242
/**
4343
* Storage for all options supported by the
@@ -405,7 +405,7 @@ public boolean process(String opt, List<String> args) {
405405
messages.error("doclet.Option_doclint_no_qualifiers");
406406
return false;
407407
}
408-
if (!DocLint.newDocLint().isValidOption(dopt)) {
408+
if (!(new DocLint()).isValidOption(dopt)) {
409409
messages.error("doclet.Option_doclint_invalid_arg");
410410
return false;
411411
}
@@ -418,7 +418,7 @@ public boolean process(String opt, List<String> args) {
418418
@Override
419419
public boolean process(String opt, List<String> args) {
420420
String dopt = opt.replace("-Xdoclint/package:", DocLint.XCHECK_PACKAGE);
421-
if (!DocLint.newDocLint().isValidOption(dopt)) {
421+
if (!(new DocLint()).isValidOption(dopt)) {
422422
messages.error("doclet.Option_doclint_package_invalid_arg");
423423
return false;
424424
}

‎test/jdk/java/foreign/TestByteBuffer.java

+7
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import java.lang.reflect.InvocationTargetException;
4848
import java.lang.reflect.Method;
4949
import java.lang.reflect.Modifier;
50+
import java.net.URI;
5051
import java.nio.Buffer;
5152
import java.nio.ByteBuffer;
5253
import java.nio.ByteOrder;
@@ -513,6 +514,12 @@ public void testMapZeroSize() throws IOException {
513514
}
514515
}
515516

517+
@Test(expectedExceptions = IllegalArgumentException.class)
518+
public void testMapCustomPath() throws IOException {
519+
Path path = Path.of(URI.create("jrt:/"));
520+
MemorySegment.mapFile(path, 0L, 0L, FileChannel.MapMode.READ_WRITE);
521+
}
522+
516523
@Test(dataProvider="resizeOps")
517524
public void testCopyHeapToNative(Consumer<MemorySegment> checker, Consumer<MemorySegment> initializer, SequenceLayout seq) {
518525
checkByteArrayAlignment(seq.elementLayout());

‎test/langtools/tools/javac/diags/examples.not-yet.txt

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ compiler.misc.wrong.version # ClassReader
110110
compiler.warn.annotation.method.not.found # ClassReader
111111
compiler.warn.annotation.method.not.found.reason # ClassReader
112112
compiler.warn.big.major.version # ClassReader
113+
compiler.warn.doclint.not.available # requires restricted image
113114
compiler.warn.future.attr # ClassReader
114115
compiler.warn.illegal.char.for.encoding
115116
compiler.warn.incubating.modules # requires adjusted classfile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/**
25+
* @test
26+
* @bug 8253996
27+
* @summary Verify doclint behavior when doclint not available
28+
* @library /tools/lib
29+
* @modules jdk.compiler/com.sun.tools.javac.api
30+
* jdk.compiler/com.sun.tools.javac.main
31+
* @run main/othervm --limit-modules jdk.compiler,jdk.zipfs LimitedImage
32+
*/
33+
34+
import java.io.IOException;
35+
import java.nio.file.Path;
36+
import java.util.List;
37+
38+
import toolbox.JavacTask;
39+
import toolbox.Task.Expect;
40+
import toolbox.Task.Mode;
41+
import toolbox.Task.OutputKind;
42+
import toolbox.ToolBox;
43+
44+
public class LimitedImage {
45+
public static void main(String... args) throws IOException {
46+
ToolBox tb = new ToolBox();
47+
48+
//showing help should be OK
49+
new JavacTask(tb, Mode.CMDLINE)
50+
.options("--help")
51+
.run().writeAll();
52+
53+
Path testSource = Path.of("Test.java");
54+
tb.writeFile(testSource, "class Test {}");
55+
56+
List<String> actualOutput;
57+
List<String> expectedOutput = List.of(
58+
"- compiler.warn.doclint.not.available",
59+
"1 warning"
60+
);
61+
62+
//check proper diagnostics when doclint provider not present:
63+
System.err.println("Test -Xdoclint when doclint not available");
64+
actualOutput = new JavacTask(tb, Mode.CMDLINE)
65+
.options("-XDrawDiagnostics", "-Xdoclint")
66+
.files(testSource)
67+
.outdir(".")
68+
.run(Expect.SUCCESS)
69+
.writeAll()
70+
.getOutputLines(OutputKind.DIRECT);
71+
72+
tb.checkEqual(expectedOutput, actualOutput);
73+
}
74+
75+
}

0 commit comments

Comments
 (0)
Please sign in to comment.