提交 dc8873f1 编写于 作者: A asaha

Merge

......@@ -667,11 +667,44 @@ f56f9368471aa5bc949a730e2724ceb68e90d717 jdk8u112-b12
b353281f73db9617d993353e468342d3420c29f1 jdk8u112-b14
6116c6644be0c85556931aaeb9b4f2dbc9c79157 jdk8u112-b15
ee37eafc48cb6fb20cb6c1e31cfecfe1ccc800da jdk8u112-b16
de1c3df992adb0c704005583210d1ed6dac758cd jdk8u112-b31
5710d574a99aeff3600c49a4aed34fa1b373f7b8 jdk8u121-b00
ab5d32d8cf5f6d81482692f801385a869b2d83c1 jdk8u121-b01
e260d46661d2da3ede78aae434d5420acce99950 jdk8u121-b02
0acfd50d67d98259a25fbd51129b763bab56d068 jdk8u121-b03
29a08aff06088cad98dafddef7628b51e324fcae jdk8u121-b04
a933635275c33e37c9403767d600a12b9ee71df7 jdk8u121-b05
dc1dd2e6cf8e094c4a8437d54ebc7bac1f7ab964 jdk8u121-b06
6cd0cd4078e9ec8ad9fa167cabf9c671ed21fc66 jdk8u121-b07
8efc10efbfe137ed5de6bf55875fdafd25bb6a1b jdk8u121-b08
57a26fe61f2b435332c0697e92965a22246cd143 jdk8u121-b09
53c94a674d6076ff390c62a7682ea0e87a893cdc jdk8u121-b10
b634abfcd98fb8b201da9208e398ea17cabd2b32 jdk8u121-b11
7fc347da372c8c4e5530a7fa32084b5dbc4ee8b6 jdk8u121-b12
f634736433d9fc1cffbdc55611f97ecb2cd44059 jdk8u121-b13
8b331e7199f74a2dea8a8a866f0d7f1977f146ee jdk8u131-b00
0d04068f82fe680c65619e08ef012ead7483873b jdk8u131-b01
452448c6347af8f7bd827dd4632ac06c991a15b8 jdk8u131-b02
38ea0481f6438a6379941d5c6cfc3078ab384027 jdk8u131-b03
f85da82b8218301a785ef925f8f3d8a59d6d3345 jdk8u131-b04
5a4e3151102973a2e0420272b044d1db94337e74 jdk8u131-b05
dd55d0995340fa86eb7e8bb41a7205dd724a4883 jdk8u131-b06
bc4f253725f93d9b832ec60d521cd5426a9489ea jdk8u131-b07
3a62189765a88f393a51923f98020ad7b2d4fc7d jdk8u131-b08
2f2c4931d13c44bb6a0f808809e723de0677e302 jdk8u131-b09
676a07884de49a7c60379da8ac892fe1403de6b6 jdk8u131-b10
5162417b51bdf68b95696198181f2e662a14ff8a jdk8u131-b11
1175fac90fdbbd864f7b1f306397644d26eb9781 jdk8u141-b00
bb163efa3276e129c69bad28299a6283b869caa3 jdk8u141-b01
5864e3781953daa69efd54b329a358a568229268 jdk8u141-b02
4378c8e874a5c13409b651a47b4b388f17904da1 jdk8u141-b03
d89ea3127a93d7ea6f2b89ee3adc673136833933 jdk8u141-b04
b8e0348df792b1c5f95cd7d77d5c05da1d435d32 jdk8u141-b05
13b638c8e005d48be437db11835a63721ca10086 jdk8u141-b06
4d04a70e3207dcb46b71e6f9ad04bf0e130cf389 jdk8u141-b07
e2abef6f10b9b2946ce8f5f851af67a764bbe57d jdk8u141-b08
1df48afb34a0778df6c97a2c96c483a177135431 jdk8u141-b09
479c13a68ca457526d49d8e2c7034a365bf0233d jdk8u141-b10
2cc58a0fdfd6e7e2d21a254f6830ba51c2b3612f jdk8u141-b11
b5259d2465fa61256f485860f986bd575f13fe92 jdk8u141-b12
4d69601f88c30e9f05e3b56c6d38a2f3eb47d477 jdk8u151-b00
......@@ -3318,12 +3318,12 @@ info@urwpp.de or design@bigelowandholmes.com
-------------------------------------------------------------------------------
%% This notice is provided with respect to zlib v1.2.8, which may be included
%% This notice is provided with respect to zlib v1.2.11, which may be included
with JRE 8, JDK 8, and OpenJDK 8.
--- begin of LICENSE ---
version 1.2.8, April 28th, 2013
version 1.2.11, January 15th, 2017
Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
......
......@@ -27,6 +27,7 @@ doclet.Encoding_not_supported=\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0{0
doclet.Building_Tree=\u5168\u30D1\u30C3\u30B1\u30FC\u30B8\u3068\u30AF\u30E9\u30B9\u306E\u968E\u5C64\u30C4\u30EA\u30FC\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
doclet.Building_Index=\u5168\u30D1\u30C3\u30B1\u30FC\u30B8\u3068\u30AF\u30E9\u30B9\u306E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
doclet.Building_Index_For_All_Classes=\u5168\u30AF\u30E9\u30B9\u306E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
doclet.JavaScript_in_option={0}\u306E\u5F15\u6570\u306BJavaScript\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002\n--allow-script-in-comments\u3092\u4F7F\u7528\u3057\u3066\u3001JavaScript\u306E\u4F7F\u7528\u3092\u8A31\u53EF\u3057\u3066\u304F\u3060\u3055\u3044\u3002
doclet.sourcetab_warning=-sourcetab\u306E\u5F15\u6570\u306F0\u3088\u308A\u5927\u304D\u3044\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
doclet.Packages=\u30D1\u30C3\u30B1\u30FC\u30B8
doclet.Profiles=\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB
......
......@@ -27,6 +27,7 @@ doclet.Encoding_not_supported=\u4E0D\u652F\u6301\u7F16\u7801: {0}
doclet.Building_Tree=\u6B63\u5728\u6784\u5EFA\u6240\u6709\u7A0B\u5E8F\u5305\u548C\u7C7B\u7684\u6811...
doclet.Building_Index=\u6B63\u5728\u6784\u5EFA\u6240\u6709\u7A0B\u5E8F\u5305\u548C\u7C7B\u7684\u7D22\u5F15...
doclet.Building_Index_For_All_Classes=\u6B63\u5728\u6784\u5EFA\u6240\u6709\u7C7B\u7684\u7D22\u5F15...
doclet.JavaScript_in_option={0} \u7684\u53C2\u6570\u5305\u542B JavaScript\u3002\n\u4F7F\u7528 --allow-script-in-comments \u53EF\u5141\u8BB8\u4F7F\u7528 JavaScript\u3002
doclet.sourcetab_warning=-sourcetab \u7684\u53C2\u6570\u5FC5\u987B\u662F\u5927\u4E8E 0 \u7684\u6574\u6570\u3002
doclet.Packages=\u7A0B\u5E8F\u5305
doclet.Profiles=\u914D\u7F6E\u6587\u4EF6
......
......@@ -1067,7 +1067,7 @@ public class Types {
List<Type> argtypes = msym.type.getParameterTypes();
return (msym.flags_field & NATIVE) != 0 &&
msym.owner == syms.methodHandleType.tsym &&
argtypes.tail.tail == null &&
argtypes.length() == 1 &&
argtypes.head.hasTag(TypeTag.ARRAY) &&
msym.type.getReturnType().tsym == syms.objectType.tsym &&
((ArrayType)argtypes.head).elemtype.tsym == syms.objectType.tsym;
......
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2016, 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
......@@ -81,6 +81,7 @@ javadoc.File_Read_Error=\u30D5\u30A1\u30A4\u30EB{0}\u306E\u8AAD\u8FBC\u307F\u4E2
javadoc.Body_missing_from_html_file=HTML\u306Bbody\u30BF\u30B0\u304C\u3042\u308A\u307E\u305B\u3093
javadoc.End_body_missing_from_html_file=HTML\u30D5\u30A1\u30A4\u30EB\u306Bbody\u306E\u9589\u3058\u30BF\u30B0\u304C\u3042\u308A\u307E\u305B\u3093
javadoc.Multiple_package_comments=\u30D1\u30C3\u30B1\u30FC\u30B8"{0}"\u306B\u8907\u6570\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30B3\u30E1\u30F3\u30C8\u306E\u30BD\u30FC\u30B9\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F
javadoc.JavaScript_in_comment=\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30B3\u30E1\u30F3\u30C8\u306BJavaScript\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002\n--allow-script-in-comments\u3092\u4F7F\u7528\u3057\u3066\u3001JavaScript\u306E\u4F7F\u7528\u3092\u8A31\u53EF\u3057\u3066\u304F\u3060\u3055\u3044\u3002
javadoc.class_not_found=\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
javadoc.error=\u30A8\u30E9\u30FC
javadoc.warning=\u8B66\u544A
......
#
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2016, 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
......@@ -81,6 +81,7 @@ javadoc.File_Read_Error=\u8BFB\u53D6\u6587\u4EF6{0}\u65F6\u51FA\u9519
javadoc.Body_missing_from_html_file=HTML \u6587\u4EF6\u4E2D\u7F3A\u5C11\u4E3B\u4F53\u6807\u8BB0
javadoc.End_body_missing_from_html_file=HTML \u6587\u4EF6\u4E2D\u7F3A\u5C11\u4E3B\u4F53\u7ED3\u675F\u6807\u8BB0
javadoc.Multiple_package_comments=\u627E\u5230\u7A0B\u5E8F\u5305 "{0}" \u7684\u591A\u4E2A\u7A0B\u5E8F\u5305\u6CE8\u91CA\u6E90
javadoc.JavaScript_in_comment=\u6587\u6863\u6CE8\u91CA\u4E2D\u53D1\u73B0 JavaScript\u3002\n\u4F7F\u7528 --allow-script-in-comments \u53EF\u5141\u8BB8\u4F7F\u7528 JavaScript\u3002
javadoc.class_not_found=\u627E\u4E0D\u5230\u7C7B{0}\u3002
javadoc.error=\u9519\u8BEF
javadoc.warning=\u8B66\u544A
......
/*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, 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,8 +34,10 @@ import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
/**
* ClassFileReader reads ClassFile(s) of a given path that can be
......@@ -154,6 +156,8 @@ public class ClassFileReader {
}
}
public boolean isMultiReleaseJar() throws IOException { return false; }
public String toString() {
return path.toString();
}
......@@ -290,6 +294,16 @@ public class ClassFileReader {
}
};
}
@Override
public boolean isMultiReleaseJar() throws IOException {
Manifest mf = this.jarfile.getManifest();
if (mf != null) {
Attributes atts = mf.getMainAttributes();
return "true".equalsIgnoreCase(atts.getValue("Multi-Release"));
}
return false;
}
}
class JarFileIterator implements Iterator<ClassFile> {
......
/*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, 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
......@@ -515,6 +515,13 @@ class JdepsTask {
// add all classpath archives to the source locations for reporting
sourceLocations.addAll(classpaths);
// warn about Multi-Release jars
for (Archive a : sourceLocations) {
if (a.reader().isMultiReleaseJar()) {
warning("warn.mrjar.usejdk9", a.getPathName());
}
}
// Work queue of names of classfiles to be searched.
// Entries will be unique, and for classes that do not yet have
// dependencies in the results map.
......
......@@ -99,6 +99,10 @@ subject to be removed or changed incompatibly and could break your application.\
Please modify your code to eliminate dependency on any JDK internal APIs.\n\
For the most recent update on JDK internal API replacements, please check:\n\
{0}
warn.mrjar.usejdk9=\
{0} is a multi-release jar file.\n\
All versioned entries are analyzed. To analyze the entries for a specific\n\
version, use a newer version of jdeps (JDK 9 or later) \"--multi-release\" option.
artifact.not.found=not found
jdeps.wiki.url=https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool
......@@ -46,6 +46,7 @@ err.invalid.path=\u7121\u52B9\u306A\u30D1\u30B9: {0}
warn.invalid.arg=\u7121\u52B9\u306A\u30AF\u30E9\u30B9\u540D\u307E\u305F\u306F\u30D1\u30B9\u540D\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}
warn.split.package=\u30D1\u30C3\u30B1\u30FC\u30B8{0}\u306F{1} {2}\u3067\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059
warn.replace.useJDKInternals=JDK\u5185\u90E8API\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u304A\u3089\u305A\u3001JDK\u5B9F\u88C5\u5C02\u7528\u3067\u3059\u304C\u3001\u4E92\u63DB\u6027\u306A\u3057\u3067\n\u524A\u9664\u307E\u305F\u306F\u5909\u66F4\u3055\u308C\u308B\u5834\u5408\u304C\u3042\u308A\u3001\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u3092\u4E2D\u65AD\u3055\u305B\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\nJDK\u5185\u90E8API\u306E\u4F9D\u5B58\u6027\u3092\u524A\u9664\u3059\u308B\u3088\u3046\u30B3\u30FC\u30C9\u3092\u5909\u66F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002\nJDK\u5185\u90E8API\u306E\u7F6E\u63DB\u306B\u95A2\u3059\u308B\u6700\u65B0\u306E\u66F4\u65B0\u306B\u3064\u3044\u3066\u306F\u3001\u6B21\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044:\n{0}
warn.mrjar.usejdk9={0}\u306F\u30DE\u30EB\u30C1\u30EA\u30EA\u30FC\u30B9jar\u30D5\u30A1\u30A4\u30EB\u3067\u3059\u3002\n\u3059\u3079\u3066\u306E\u30D0\u30FC\u30B8\u30E7\u30CB\u30F3\u30B0\u6E08\u30A8\u30F3\u30C8\u30EA\u3092\u5206\u6790\u3057\u307E\u3059\u3002\u7279\u5B9A\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306E\u30A8\u30F3\u30C8\u30EA\u3092\u5206\u6790\u3059\u308B\u306B\u306F\u3001\n\u65B0\u3057\u3044\u30D0\u30FC\u30B8\u30E7\u30F3\u306Ejdeps (JDK 9\u4EE5\u964D)\u306E"--multi-release"\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
artifact.not.found=\u898B\u3064\u304B\u308A\u307E\u305B\u3093
jdeps.wiki.url=https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool
......@@ -46,6 +46,7 @@ err.invalid.path=\u65E0\u6548\u8DEF\u5F84: {0}
warn.invalid.arg=\u7C7B\u540D\u65E0\u6548\u6216\u8DEF\u5F84\u540D\u4E0D\u5B58\u5728: {0}
warn.split.package=\u5DF2\u5728{1} {2}\u4E2D\u5B9A\u4E49\u7A0B\u5E8F\u5305{0}
warn.replace.useJDKInternals=\u4E0D\u652F\u6301 JDK \u5185\u90E8 API, \u5B83\u4EEC\u4E13\u7528\u4E8E\u901A\u8FC7\u4E0D\u517C\u5BB9\u65B9\u5F0F\u6765\u5220\u9664\n\u6216\u66F4\u6539\u7684 JDK \u5B9E\u73B0, \u53EF\u80FD\u4F1A\u635F\u574F\u60A8\u7684\u5E94\u7528\u7A0B\u5E8F\u3002\n\u8BF7\u4FEE\u6539\u60A8\u7684\u4EE3\u7801, \u6D88\u9664\u4E0E\u4EFB\u4F55 JDK \u5185\u90E8 API \u7684\u76F8\u5173\u6027\u3002\n\u6709\u5173 JDK \u5185\u90E8 API \u66FF\u6362\u7684\u6700\u65B0\u66F4\u65B0, \u8BF7\u67E5\u770B:\n{0}
warn.mrjar.usejdk9={0} \u662F\u591A\u53D1\u884C\u7248 jar \u6587\u4EF6\u3002\n\u5DF2\u5206\u6790\u6240\u6709\u7248\u672C\u5316\u6761\u76EE\u3002\u8981\u5206\u6790\u67D0\u4E2A\u7279\u5B9A\u7248\u672C\u7684\u6761\u76EE,\n\u8BF7\u4F7F\u7528\u66F4\u65B0\u7248\u672C\u7684 jdeps (JDK 9 \u6216\u66F4\u9AD8\u7248\u672C) "--multi-release" \u9009\u9879\u3002
artifact.not.found=\u627E\u4E0D\u5230
jdeps.wiki.url=https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool
// No translation needed
com.sun.crypto.provider.SunJCE=Use java.security.Security.getProvider(provider-name) @since 1.3
com.sun.image.codec=Use javax.imageio @since 1.4
com.sun.org.apache.xml.internal.security=Use java.xml.crypto @since 1.6
com.sun.org.apache.xml.internal.security.utils.Base64=Use java.util.Base64 @since 1.8
com.sun.org.apache.xml.internal.resolver=Use javax.xml.catalog @since 9
com.sun.net.ssl=Use javax.net.ssl @since 1.4
com.sun.net.ssl.internal.ssl.Provider=Use java.security.Security.getProvider(provider-name) @since 1.3
com.sun.rowset=Use javax.sql.rowset.RowSetProvider @since 1.7
com.sun.tools.doclets.standard=Use jdk.javadoc.doclets.StandardDoclet @since 9.
com.sun.tools.javac.tree=Use com.sun.source @since 1.6
com.sun.tools.javac=Use javax.tools and javax.lang.model @since 1.6
sun.awt.image.codec=Use javax.imageio @since 1.4
sun.misc.BASE64Encoder=Use java.util.Base64 @since 1.8
sun.misc.BASE64Decoder=Use java.util.Base64 @since 1.8
sun.misc.Cleaner=Use java.lang.ref.PhantomReference @since 1.2
sun.misc.Service=Use java.util.ServiceLoader @since 1.6
java.awt.peer=Should not use. See https://bugs.openjdk.java.net/browse/JDK-8037739
java.awt.dnd.peer=Should not use. See https://bugs.openjdk.java.net/browse/JDK-8037739
jdk.internal.ref.Cleaner=Use java.lang.ref.PhantomReference @since 1.2 or java.lang.ref.Cleaner @since 9
sun.awt.CausedFocusEvent=Use java.awt.event.FocusEvent::getCause @since 9
sun.font.FontUtilities=See java.awt.Font.textRequiresLayout @since 9
sun.reflect.Reflection=See http://openjdk.java.net/jeps/260
sun.reflect.ReflectionFactory=See http://openjdk.java.net/jeps/260
sun.misc.Unsafe=See http://openjdk.java.net/jeps/260
sun.misc.Signal=See http://openjdk.java.net/jeps/260
sun.misc.SignalHandler=See http://openjdk.java.net/jeps/260
sun.security.action=Use java.security.PrivilegedAction @since 1.1
sun.security.krb5=Use com.sun.security.jgss
sun.security.provider.PolicyFile=Use java.security.Policy.getInstance("JavaPolicy", new URIParameter(uri)) @since 1.6
sun.security.provider.Sun=Use java.security.Security.getProvider(provider-name) @since 1.3
sun.security.util.HostnameChecker=Use javax.net.ssl.SSLParameters.setEndpointIdentificationAlgorithm("HTTPS") @since 1.7\n\
or javax.net.ssl.HttpsURLConnection.setHostnameVerifier() @since 1.4
sun.security.util.SecurityConstants=Use appropriate java.security.Permission subclass @since 1.1
sun.security.x509.X500Name=Use javax.security.auth.x500.X500Principal @since 1.4
sun.tools.jar=Use java.util.jar or jar tool @since 1.2
sun.tools.jar=Use java.util.jar @since 1.2
sun.tools.jar.Main=Use java.util.spi.ToolProvider @since 9
# Internal APIs removed in JDK 9
com.apple.eawt=Use java.awt.Desktop @since 9. See http://openjdk.java.net/jeps/272
com.apple.concurrent=Removed in JDK 9. See https://bugs.openjdk.java.net/browse/JDK-8148187
com.sun.image.codec.jpeg=Use javax.imageio @since 1.4
sun.awt.image.codec=Use javax.imageio @since 1.4
sun.misc.BASE64Encoder=Use java.util.Base64 @since 1.8
sun.misc.BASE64Decoder=Use java.util.Base64 @since 1.8
sun.misc.ClassLoaderUtil=Use java.net.URLClassLoader.close() @since 1.7
sun.misc.Cleaner=Use java.lang.ref.PhantomReference @since 1.2 or java.lang.ref.Cleaner @since 9.\n\
See http://openjdk.java.net/jeps/260.
sun.misc.Service=Use java.util.ServiceLoader @since 1.6
sun.misc=Removed in JDK 9. See http://openjdk.java.net/jeps/260
sun.reflect=Removed in JDK 9. See http://openjdk.java.net/jeps/260
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8168774
* @summary Polymorhic signature method check crashes javac
* @compile BadPolySig.java
*/
package java.lang.invoke;
class MethodHandle {
native Object m();
}
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8176329
* @summary Test for jdeps warning when it encounters a multi-release jar
* @run testng MRJarWarning
*/
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import org.testng.Assert;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class MRJarWarning {
private static final String WARNING = " is a multi-release jar file";
private static final String MRJAR_ATTR = "Multi-Release";
Path mrjar1;
Path mrjar2;
Path nonMRjar;
Path mrjarAllCaps;
private Attributes defaultAttributes;
@BeforeSuite
public void setup() throws IOException {
defaultAttributes = new Attributes();
defaultAttributes.putValue("Manifest-Version", "1.0");
defaultAttributes.putValue("Created-By", "1.8.0-internal");
mrjar1 = Paths.get("mrjar1.jar");
mrjar2 = Paths.get("mrjar2.jar");
nonMRjar = Paths.get("nonMRjar.jar");
mrjarAllCaps = Paths.get("mrjarAllCaps.jar");
Attributes mrJarAttrs = new Attributes(defaultAttributes);
mrJarAttrs.putValue(MRJAR_ATTR, "true");
build(mrjar1, mrJarAttrs);
build(mrjar2, mrJarAttrs);
build(nonMRjar, defaultAttributes);
// JEP 238 - "Multi-Release JAR Files" states that the attribute name
// and value are case insensitive. Try with all caps to ensure that
// jdeps still recognizes a multi-release jar.
Attributes allCapsAttrs = new Attributes(defaultAttributes);
allCapsAttrs.putValue(MRJAR_ATTR.toUpperCase(), "TRUE");
build(mrjarAllCaps, allCapsAttrs);
}
@DataProvider(name="provider")
private Object[][] args() {
// jdeps warning messages may be localized.
// This test only checks for the English version. Return an empty
// array (skip testing) if the default language is not English.
String language = Locale.getDefault().getLanguage();
System.out.println("Language: " + language);
if ("en".equals(language)) {
return new Object[][] {
// one mrjar arg
{ Arrays.asList(mrjar1.toString()),
Arrays.asList(mrjar1)},
// two mrjar args
{ Arrays.asList(mrjar1.toString(), mrjar2.toString()),
Arrays.asList(mrjar1, mrjar2)},
// one mrjar arg, with mrjar on classpath
{ Arrays.asList("-cp", mrjar2.toString(), mrjar1.toString()),
Arrays.asList(mrjar1, mrjar2)},
// non-mrjar arg, with mrjar on classpath
{ Arrays.asList("-cp", mrjar1.toString(), nonMRjar.toString()),
Arrays.asList(mrjar1)},
// mrjar arg with jar attribute name/value in ALL CAPS
{ Arrays.asList(mrjarAllCaps.toString()),
Arrays.asList(mrjarAllCaps)},
// non-mrjar arg
{ Arrays.asList(nonMRjar.toString()),
Collections.emptyList()}
};
} else {
System.out.println("Non-English language \""+ language +
"\"; test passes superficially");
return new Object[][]{};
}
}
/* Run jdeps with the arguments given in 'args', and confirm that a warning
* is issued for each Multi-Release jar in 'expectedMRpaths'.
*/
@Test(dataProvider="provider")
public void checkWarning(List<String> args, List<Path> expectedMRpaths) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
int rc = com.sun.tools.jdeps.Main.run(args.toArray(new String[args.size()]), pw);
pw.close();
expectedMRJars(sw.toString(), expectedMRpaths);
Assert.assertEquals(rc, 0, "non-zero exit code from jdeps");
}
/* Confirm that warnings for the specified paths are in the output (or that
* warnings are absent if 'paths' is empty).
* Doesn't check for extra, unexpected warnings.
*/
private static void expectedMRJars(String output, List<Path> paths) {
if (paths.isEmpty()) {
Assert.assertFalse(output.contains(WARNING),
"Expected no mrjars, but found:\n" + output);
} else {
for (Path path : paths) {
String expect = "Warning: " + path.toString() + WARNING;
Assert.assertTrue(output.contains(expect),
"Did not find:\n" + expect + "\nin:\n" + output + "\n");
}
}
}
/* Build a jar at the expected path, containing the given attributes */
private static void build(Path path, Attributes attributes) throws IOException {
try (OutputStream os = Files.newOutputStream(path);
JarOutputStream jos = new JarOutputStream(os)) {
JarEntry me = new JarEntry("META-INF/MANIFEST.MF");
jos.putNextEntry(me);
Manifest manifest = new Manifest();
manifest.getMainAttributes().putAll(attributes);
manifest.write(jos);
jos.closeEntry();
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册