--- a/.hgtags Thu May 28 11:37:13 2015 -0700
+++ b/.hgtags Mon Jun 01 10:15:20 2015 -0700
@@ -308,3 +308,4 @@
989253a902c34dcb7564695161c9200a5fbb7412 jdk9-b63
8ffdeabc7c2b9a8280bf46cae026ac46b4d31c26 jdk9-b64
4915246064b2f89d5f00c96e758686b7fdad36a6 jdk9-b65
+ff3fc75f3214ad7e03595be1b0d0f38d887b6f0e jdk9-b66
--- a/.hgtags-top-repo Thu May 28 11:37:13 2015 -0700
+++ b/.hgtags-top-repo Mon Jun 01 10:15:20 2015 -0700
@@ -308,3 +308,4 @@
0b32ed628fa60e4ab99fb0b5866d648e16231f17 jdk9-b63
82cf9aab9a83e41c8194ba01af9666afdb856cbe jdk9-b64
7c31f9d7b932f7924f1258d52885b1c7c3e078c2 jdk9-b65
+dc6e8336f51bb6b67b7245766179eab5ca7720b4 jdk9-b66
--- a/common/autoconf/flags.m4 Thu May 28 11:37:13 2015 -0700
+++ b/common/autoconf/flags.m4 Mon Jun 01 10:15:20 2015 -0700
@@ -559,6 +559,7 @@
-Zi -MD -Zc:wchar_t- -W3 -wd4800 \
-DWIN32_LEAN_AND_MEAN \
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
+ -D_WINSOCK_DEPRECATED_NO_WARNINGS \
-DWIN32 -DIAL"
if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
--- a/common/autoconf/generated-configure.sh Thu May 28 11:37:13 2015 -0700
+++ b/common/autoconf/generated-configure.sh Mon Jun 01 10:15:20 2015 -0700
@@ -4366,7 +4366,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1431429776
+DATE_WHEN_GENERATED=1432629750
###############################################################################
#
@@ -42071,6 +42071,7 @@
-Zi -MD -Zc:wchar_t- -W3 -wd4800 \
-DWIN32_LEAN_AND_MEAN \
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
+ -D_WINSOCK_DEPRECATED_NO_WARNINGS \
-DWIN32 -DIAL"
if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_AMD64_ -Damd64"
--- a/common/bin/compare_exceptions.sh.incl Thu May 28 11:37:13 2015 -0700
+++ b/common/bin/compare_exceptions.sh.incl Mon Jun 01 10:15:20 2015 -0700
@@ -94,7 +94,6 @@
./bin/jstat
./bin/jstatd
./bin/keytool
-./bin/native2ascii
./bin/orbd
./bin/pack200
./bin/policytool
@@ -173,7 +172,6 @@
./bin/jstat
./bin/jstatd
./bin/keytool
-./bin/native2ascii
./bin/orbd
./bin/pack200
./bin/policytool
@@ -293,7 +291,6 @@
./bin/jstat
./bin/jstatd
./bin/keytool
-./bin/native2ascii
./bin/orbd
./bin/pack200
./bin/policytool
@@ -428,7 +425,6 @@
./bin/jstat
./bin/jstatd
./bin/keytool
-./bin/native2ascii
./bin/orbd
./bin/pack200
./bin/policytool
@@ -509,7 +505,6 @@
./bin/kinit.exe
./bin/klist.exe
./bin/ktab.exe
-./bin/native2ascii.exe
./bin/orbd.exe
./bin/pack200.exe
./bin/policytool.exe
@@ -585,7 +580,6 @@
./bin/jstat
./bin/jstatd
./bin/keytool
-./bin/native2ascii
./bin/orbd
./bin/pack200
./bin/policytool
--- a/common/bin/unshuffle_list.txt Thu May 28 11:37:13 2015 -0700
+++ b/common/bin/unshuffle_list.txt Mon Jun 01 10:15:20 2015 -0700
@@ -1301,8 +1301,6 @@
jdk/src/jdk.deploy.osx/macosx/native/libosx/Dispatch.m : jdk/src/macosx/native/com/apple/concurrent/Dispatch.m
jdk/src/jdk.deploy.osx/macosx/native/libosx/JavaAppLauncher.m : jdk/src/macosx/native/apple/launcher/JavaAppLauncher.m
jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m : jdk/src/macosx/native/apple/security/KeystoreImpl.m
-jdk/src/jdk.dev/share/classes/com/sun/tools/hat : jdk/src/share/classes/com/sun/tools/hat
-jdk/src/jdk.dev/share/classes/sun/tools/native2ascii : jdk/src/share/classes/sun/tools/native2ascii
jdk/src/jdk.hprof.agent/share/classes/com/sun/demo/jvmti/hprof : jdk/src/share/classes/com/sun/demo/jvmti/hprof
jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver : jdk/src/share/classes/com/sun/net/httpserver
jdk/src/jdk.httpserver/share/classes/sun/net/httpserver : jdk/src/share/classes/sun/net/httpserver
@@ -1487,16 +1485,16 @@
langtools/src/java.compiler/share/classes/javax/lang/model : langtools/src/share/classes/javax/lang/model
langtools/src/java.compiler/share/classes/javax/tools : langtools/src/share/classes/javax/tools
langtools/src/jdk.compiler/share/classes/com/sun/source : langtools/src/share/classes/com/sun/source
-langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile : langtools/src/share/classes/com/sun/tools/classfile
langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint : langtools/src/share/classes/com/sun/tools/doclint
langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources : langtools/src/share/classes/com/sun/tools/doclint/resources
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac : langtools/src/share/classes/com/sun/tools/javac
langtools/src/jdk.compiler/share/classes/com/sun/tools/javah : langtools/src/share/classes/com/sun/tools/javah
-langtools/src/jdk.compiler/share/classes/com/sun/tools/javap : langtools/src/share/classes/com/sun/tools/javap
langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac : langtools/src/share/classes/com/sun/tools/sjavac
-langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps : langtools/src/share/classes/com/sun/tools/jdeps
-langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/resources : langtools/src/share/classes/com/sun/tools/jdeps/resources
langtools/src/jdk.javadoc/share/classes/com/sun/javadoc : langtools/src/share/classes/com/sun/javadoc
langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets : langtools/src/share/classes/com/sun/tools/doclets
langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc : langtools/src/share/classes/com/sun/tools/javadoc
+langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile : langtools/src/share/classes/com/sun/tools/classfile
+langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap : langtools/src/share/classes/com/sun/tools/javap
+langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps : langtools/src/share/classes/com/sun/tools/jdeps
+langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources : langtools/src/share/classes/com/sun/tools/jdeps/resources
nashorn/src/jdk.scripting.nashorn/share/classes : nashorn/src
--- a/corba/.hgtags Thu May 28 11:37:13 2015 -0700
+++ b/corba/.hgtags Mon Jun 01 10:15:20 2015 -0700
@@ -308,3 +308,4 @@
0acac6937de7a0868f8c6f88b7d036d780abeee6 jdk9-b63
0a5e5a7c3539e8bde73d9fe55750e49a49cb8dac jdk9-b64
afc1e295c4bf83f9a5dd539c29914edd4a754a3f jdk9-b65
+44ee68f7dbacab24a45115fd6a8ccdc7eb6e8f0b jdk9-b66
--- a/corba/src/java.corba/share/classes/org/omg/DynamicAny/package.html Thu May 28 11:37:13 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/DynamicAny/package.html Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
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.
-
+
-->
</head>
@@ -40,97 +40,97 @@
been compiled with the object implementation). As a result, the object receiving the
<code>any</code> does not have a portable method of using it.
-<P><code>DynAny</code>s enable traversal of the data value associated with an
-<code>any</code> at runtime, and extraction of the primitive constituents of the data value.
-This is especially helpful for writing powerful generic servers (bridges, event channels
-supporting filtering). Similarly, this facility enables the construction of an
-<code>any</code> at runtime, without having static knowledge of its type. This is especially
+<P><code>DynAny</code>s enable traversal of the data value associated with an
+<code>any</code> at runtime, and extraction of the primitive constituents of the data value.
+This is especially helpful for writing powerful generic servers (bridges, event channels
+supporting filtering). Similarly, this facility enables the construction of an
+<code>any</code> at runtime, without having static knowledge of its type. This is especially
helpful for writing generic clients (bridges, browsers, debuggers, user interface tools).
-<P><code>Any</code> values can be dynamically interpreted (traversed) and constructed through
-<tt>DynAny</tt> objects. A <tt>DynAny</tt> object is associated with a data
-value which corresponds to a copy of the value inserted into an <tt>Any</tt>. A
+<P><code>Any</code> values can be dynamically interpreted (traversed) and constructed through
+<tt>DynAny</tt> objects. A <tt>DynAny</tt> object is associated with a data
+value which corresponds to a copy of the value inserted into an <tt>Any</tt>. A
<tt>DynAny</tt> object may be viewed as an ordered collection of component
-<tt>DynAny</tt>s. For <tt>DynAny</tt>s representing a basic type, such as <code>long</code>,
-or a type without components, such as an empty exception, the ordered collection of
-components is empty.
+<tt>DynAny</tt>s. For <tt>DynAny</tt>s representing a basic type, such as <code>long</code>,
+or a type without components, such as an empty exception, the ordered collection of
+components is empty.
-<P>Each <tt>DynAny</tt> object maintains the notion of a current position into its collection
-of component <tt>DynAny</tt>s. The current position is identified by an index value that runs
-from 0 to n-1, where <em>n</em> is the number of components. The special index value -1
+<P>Each <tt>DynAny</tt> object maintains the notion of a current position into its collection
+of component <tt>DynAny</tt>s. The current position is identified by an index value that runs
+from 0 to n-1, where <em>n</em> is the number of components. The special index value -1
indicates a current position that points nowhere.
For values that cannot have a current position (such as an empty exception),
the index value is fixed at -1.
- If a <code>DynAny</code> is initialized with a value that has components, the index is
+ If a <code>DynAny</code> is initialized with a value that has components, the index is
initialized to 0.
- After creation of an uninitialized <code>DynAny</code> (that is, a <code>DynAny</code> that
+ After creation of an uninitialized <code>DynAny</code> (that is, a <code>DynAny</code> that
has no value but a <code>TypeCode</code>
that permits components), the current position depends on the type of value represented by
- the <code>DynAny</code>. (The current position is set to 0 or -1, depending on whether the
+ the <code>DynAny</code>. (The current position is set to 0 or -1, depending on whether the
new <code>DynAny</code>
gets default values for its components.)
-
-
- <P>The iteration operations <code>rewind</code>, <code>seek</code>, and <code>next</code>
+
+
+<P>The iteration operations <code>rewind</code>, <code>seek</code>, and <code>next</code>
can be used to change the current position
- and the <code>current_component</code> operation returns the component at the current
+ and the <code>current_component</code> operation returns the component at the current
position.
- The <code>component_count</code> operation returns the number of components of a
+ The <code>component_count</code> operation returns the number of components of a
<code>DynAny</code>.
- Collectively, these operations enable iteration over the components of a
+ Collectively, these operations enable iteration over the components of a
<code>DynAny</code>, for example,
to (recursively) examine its contents.
- <P>A constructed <code>DynAny</code> object is a <code>DynAny</code> object associated with
+ <P>A constructed <code>DynAny</code> object is a <code>DynAny</code> object associated with
a constructed type.
- There is a different interface, inheriting from the <code>DynAny</code> interface,
+ There is a different interface, inheriting from the <code>DynAny</code> interface,
associated with
each kind of constructed type in IDL (fixed, enum, struct, sequence, union, array,
- exception, and value type). A constructed <code>DynAny</code> object exports operations
+ exception, and value type). A constructed <code>DynAny</code> object exports operations
that enable the creation of new <code>DynAny</code> objects,
each of them associated with a component of the constructed data value.
- As an example, a <code>DynStruct</code> is associated with a <code>struct</code> value. This
+ As an example, a <code>DynStruct</code> is associated with a <code>struct</code> value. This
means that the <code>DynStruct</code>
may be seen as owning an ordered collection of components, one for each structure member.
- The <code>DynStruct</code> object exports operations that enable the creation of new
+ The <code>DynStruct</code> object exports operations that enable the creation of new
<code>DynAny</code> objects,
each of them associated with a member of the <code>struct</code>.
-
-
- <P>If a <code>DynAny</code> object has been obtained from another (constructed)
+
+
+<P>If a <code>DynAny</code> object has been obtained from another (constructed)
<code>DynAny</code> object,
- such as a <code>DynAny</code> representing a structure member that was created from a
+ such as a <code>DynAny</code> representing a structure member that was created from a
<code>DynStruct</code>,
the member <code>DynAny</code> is logically contained in the <code>DynStruct</code>.
- Calling an <code>insert</code> or <code>get</code> operation leaves the current position
+ Calling an <code>insert</code> or <code>get</code> operation leaves the current position
unchanged.
- Destroying a top-level <code>DynAny</code> object (one that was not obtained as a component
+ Destroying a top-level <code>DynAny</code> object (one that was not obtained as a component
of another <code>DynAny</code>)
also destroys any component <code>DynAny</code> objects obtained from it.
Destroying a non-top level <code>DynAny</code> object does nothing.
- Invoking operations on a destroyed top-level <code>DynAny</code> or any of its descendants
+ Invoking operations on a destroyed top-level <code>DynAny</code> or any of its descendants
raises OBJECT_NOT_EXIST.
- If the programmer wants to destroy a <code>DynAny</code> object but still wants to
+ If the programmer wants to destroy a <code>DynAny</code> object but still wants to
manipulate some component
- of the data value associated with it, then he or she should first create a
+ of the data value associated with it, then he or she should first create a
<code>DynAny</code> for the component
and, after that, make a copy of the created <code>DynAny</code> object.
-
-
- <P>The behavior of <code>DynAny</code> objects has been defined in order to enable efficient
+
+
+<P>The behavior of <code>DynAny</code> objects has been defined in order to enable efficient
implementations
- in terms of allocated memory space and speed of access. <code>DynAny</code> objects are
+in terms of allocated memory space and speed of access. <code>DynAny</code> objects are
intended to be used
- for traversing values extracted from <code>any</code>s or constructing values of
+for traversing values extracted from <code>any</code>s or constructing values of
<code>any</code>s at runtime.
- Their use for other purposes is not recommended.
-
-
-
+Their use for other purposes is not recommended.
+
+
+
<H2>Handling DynAny objects</H2>
-
- <P><code>Insert</code> and <code>get</code> operations are necessary to handle basic
+
+<P><code>Insert</code> and <code>get</code> operations are necessary to handle basic
<code>DynAny</code> objects
but are also helpful to handle constructed <code>DynAny</code> objects.
Inserting a basic data type value into a constructed <code>DynAny</code> object
@@ -145,9 +145,8 @@
the <code>TypeCode</code> contained in the <code>DynAny</code> or, if the
<code>DynAny</code> has components, is equivalent to the <code>TypeCode</code>
of the <code>DynAny</code> at the current position.
-
+
<P>Basic operations include:
- <P>
<UL>
<LI>insert_boolean, get_boolean
<LI>insert_char, get_char
@@ -181,28 +180,28 @@
<LI>get_boxed_value
<LI>get_boxed_value_as_dyn_any
</UL>
-
-
- <P><code>DynAny</code> and <code>DynAnyFactory</code> objects are intended to be local to
+
+
+ <P><code>DynAny</code> and <code>DynAnyFactory</code> objects are intended to be local to
the process in which they are
- created and used. This means that references to <code>DynAny</code> and
+ created and used. This means that references to <code>DynAny</code> and
<code>DynAnyFactory</code> objects cannot be exported
to other processes, or externalized with <code>ORB.object_to_string()</code>.
- If any attempt is made to do so, the offending operation will raise a MARSHAL system
+ If any attempt is made to do so, the offending operation will raise a MARSHAL system
exception.
- Since their interfaces are specified in IDL, <code>DynAny</code> objects export operations
+ Since their interfaces are specified in IDL, <code>DynAny</code> objects export operations
defined in the standard
- <code>org.omg.CORBA.Object</code> interface. However, any attempt to invoke operations
+ <code>org.omg.CORBA.Object</code> interface. However, any attempt to invoke operations
exported through the <code>Object</code>
interface may raise the standard NO_IMPLEMENT exception.
- An attempt to use a <code>DynAny</code> object with the DII may raise the NO_IMPLEMENT
+ An attempt to use a <code>DynAny</code> object with the DII may raise the NO_IMPLEMENT
exception.
<H3>Package Specification</H3>
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
-HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java[tm] SE 6</A>.
@since 1.4
--- a/hotspot/.hgtags Thu May 28 11:37:13 2015 -0700
+++ b/hotspot/.hgtags Mon Jun 01 10:15:20 2015 -0700
@@ -468,3 +468,4 @@
2ac9b6b36689b50d1562627067c92d51781b5684 jdk9-b63
bf92b8db249cdfa5651ef954b6c0743a7e0ea4cd jdk9-b64
e7ae94c4f35e940ea423fc1dd260435df34a77c0 jdk9-b65
+197e94e0dacddd16816f101d24fc0442ab518326 jdk9-b66
--- a/jaxp/.hgtags Thu May 28 11:37:13 2015 -0700
+++ b/jaxp/.hgtags Mon Jun 01 10:15:20 2015 -0700
@@ -308,3 +308,4 @@
4a8f895f0317dcc90479cb7cc97014312e69edf7 jdk9-b63
6f91749b5aaef1a171ec2254163233438d1071d1 jdk9-b64
ae7406e82828fe1c245ac7507a9da5fd5b1c9529 jdk9-b65
+d5963ccce28d7a3e96ee3e2dc8a8676e61699b70 jdk9-b66
--- a/jaxws/.hgtags Thu May 28 11:37:13 2015 -0700
+++ b/jaxws/.hgtags Mon Jun 01 10:15:20 2015 -0700
@@ -311,3 +311,4 @@
b5c22d09b1c91dd49b006f38d8ba9c4397517ccc jdk9-b63
df100399ed27d0eaa57c137ca99819a0fee66178 jdk9-b64
45ef73bb85c12ec1b291835c1d40e342a454e3f0 jdk9-b65
+1232f4013417e4a9cd291096798d10f2e601d69d jdk9-b66
--- a/jdk/.hgtags Thu May 28 11:37:13 2015 -0700
+++ b/jdk/.hgtags Mon Jun 01 10:15:20 2015 -0700
@@ -308,3 +308,4 @@
fd3281c400347088b36aeb16273aa679d53a81a4 jdk9-b63
7de8d036ad0980d988d1b9b4b4e6be555d9fbf98 jdk9-b64
ed94f3e7ba6bbfec0772de6d24e39543e13f6d88 jdk9-b65
+4fbcca8ab812198c7fb747ea7b213b6e404f36e9 jdk9-b66
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/charsetmapping/JIS_X_0208_MS932.c2b Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,7 @@
+0x2124 0x00b8
+0x2126 0x00b7
+0x2131 0x00af
+0x2263 0x00ab
+0x2264 0x00bb
+0x2574 0x3094
+0x264c 0x00b5
--- a/jdk/make/data/charsetmapping/JIS_X_0208_MS932.map Thu May 28 11:37:13 2015 -0700
+++ b/jdk/make/data/charsetmapping/JIS_X_0208_MS932.map Mon Jun 01 10:15:20 2015 -0700
@@ -1,7 +1,7 @@
#
# mapping is based on JIS_X_0208_MS932_De/Encoder
#
-# moved following entries to .nr
+# copied following entries to .nr
#
# 0x224c 0xffe2
# 0x225d 0x22a5
@@ -14,7 +14,7 @@
# 0x2d7b 0x2229
# 0x2d7c 0x222a
#
-# and following to c2b
+# and moved following to c2b
#
# 0x2124 0x00b8
# 0x2126 0x00b7
@@ -144,13 +144,13 @@
0x2241 0x2229
0x224a 0x2227
0x224b 0x2228
-#0x224c 0xffe2
+0x224c 0xffe2
0x224d 0x21d2
0x224e 0x21d4
0x224f 0x2200
0x2250 0x2203
0x225c 0x2220
-#0x225d 0x22a5
+0x225d 0x22a5
0x225e 0x2312
0x225f 0x2202
0x2260 0x2207
@@ -158,11 +158,11 @@
0x2262 0x2252
0x2263 0x226a
0x2264 0x226b
-#0x2265 0x221a
+0x2265 0x221a
0x2266 0x223d
0x2267 0x221d
0x2268 0x2235
-#0x2269 0x222b
+0x2269 0x222b
0x226a 0x222c
0x2272 0x212b
0x2273 0x2030
@@ -620,19 +620,19 @@
0x2d6d 0x337e
0x2d6e 0x337d
0x2d6f 0x337c
-#0x2d70 0x2252
-#0x2d71 0x2261
+0x2d70 0x2252
+0x2d71 0x2261
0x2d72 0x222b
0x2d73 0x222e
0x2d74 0x2211
0x2d75 0x221a
0x2d76 0x22a5
-#0x2d77 0x2220
+0x2d77 0x2220
0x2d78 0x221f
0x2d79 0x22bf
-#0x2d7a 0x2235
-#0x2d7b 0x2229
-#0x2d7c 0x222a
+0x2d7a 0x2235
+0x2d7b 0x2229
+0x2d7c 0x222a
0x3021 0x4e9c
0x3022 0x5516
0x3023 0x5a03
--- a/jdk/make/data/charsetmapping/JIS_X_0212_Solaris.map Thu May 28 11:37:13 2015 -0700
+++ b/jdk/make/data/charsetmapping/JIS_X_0212_Solaris.map Mon Jun 01 10:15:20 2015 -0700
@@ -23,7 +23,7 @@
# as the round-trip entries.
#
# b2c and c2b all have entry "0x2271 <-> 0x2116", so the
-# "0x742c -> 0x2116" entry is moved to the .nr table.
+# "0x742c -> 0x2116" entry is copied to the .nr table.
#
# mapping (c2b) generated from JIS_X_0212_Solaris_Encoder has
# two "dup" entries
@@ -6126,7 +6126,7 @@
0x7429 0xff07
0x742a 0xff02
0x742b 0x3231
-#0x742c 0x2116
+0x742c 0x2116
0x742d 0x2121
0x742e 0x70bb
0x742f 0x4efc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/charsetmapping/stdcs-aix Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,6 @@
+#
+# generate these charsets into sun.nio.cs
+#
+EUC_CN
+EUC_KR
+GBK
--- a/jdk/make/gendata/Gendata-jdk.dev.gmk Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#
-# Copyright (c) 2014, 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.
-#
-
-include GendataCommon.gmk
-
-$(eval $(call IncludeCustomExtension, jdk, gendata/Gendata-jdk.dev.gmk))
-
-JDEPS_MODULES_XML := $(JDK_OUTPUTDIR)/modules/jdk.dev/com/sun/tools/jdeps/resources/jdeps-modules.xml
-MODULES_XML += $(TOPDIR)/modules.xml
-
-#
-# Generate modules.xml for jdeps to use
-# It augments $(TOPDIR)/modules.xml to include module membership
-#
-$(JDEPS_MODULES_XML): $(BUILD_TOOLS_JDK) $(MODULES_XML)
- $(MKDIR) -p $(@D)
- $(RM) $@
- $(TOOL_GENMODULESXML) -o $@ -mp $(JDK_OUTPUTDIR)/modules $(MODULES_XML)
-
-TARGETS += $(JDEPS_MODULES_XML)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/gendata/Gendata-jdk.jdeps.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,42 @@
+#
+# Copyright (c) 2014, 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.
+#
+
+include GendataCommon.gmk
+
+$(eval $(call IncludeCustomExtension, jdk, gendata/Gendata-jdk.jdeps.gmk))
+
+JDEPS_MODULES_XML := $(JDK_OUTPUTDIR)/modules/jdk.jdeps/com/sun/tools/jdeps/resources/jdeps-modules.xml
+MODULES_XML += $(TOPDIR)/modules.xml
+
+#
+# Generate modules.xml for jdeps to use
+# It augments $(TOPDIR)/modules.xml to include module membership
+#
+$(JDEPS_MODULES_XML): $(BUILD_TOOLS_JDK) $(MODULES_XML)
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(TOOL_GENMODULESXML) -o $@ -mp $(JDK_OUTPUTDIR)/modules $(MODULES_XML)
+
+TARGETS += $(JDEPS_MODULES_XML)
--- a/jdk/make/launcher/Launcher-jdk.compiler.gmk Thu May 28 11:37:13 2015 -0700
+++ b/jdk/make/launcher/Launcher-jdk.compiler.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -35,11 +35,6 @@
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }'))
-$(eval $(call SetupLauncher,javap, \
- -DEXPAND_CLASSPATH_WILDCARDS \
- -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
- -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))
-
$(eval $(call SetupLauncher,serialver, \
-DEXPAND_CLASSPATH_WILDCARDS \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
--- a/jdk/make/launcher/Launcher-jdk.dev.gmk Thu May 28 11:37:13 2015 -0700
+++ b/jdk/make/launcher/Launcher-jdk.dev.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -25,14 +25,5 @@
include LauncherCommon.gmk
-$(eval $(call SetupLauncher,jdeps, \
- -DEXPAND_CLASSPATH_WILDCARDS \
- -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
- -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.jdeps.Main"$(COMMA) }'))
-
$(eval $(call SetupLauncher,jimage,\
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.tools.jimage.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,native2ascii, \
- -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/launcher/Launcher-jdk.jdeps.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,36 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+include LauncherCommon.gmk
+
+$(eval $(call SetupLauncher,javap, \
+ -DEXPAND_CLASSPATH_WILDCARDS \
+ -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jdeps, \
+ -DEXPAND_CLASSPATH_WILDCARDS \
+ -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.jdeps.Main"$(COMMA) }'))
--- a/jdk/make/lib/CoreLibraries.gmk Thu May 28 11:37:13 2015 -0700
+++ b/jdk/make/lib/CoreLibraries.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -146,11 +146,6 @@
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
- DISABLED_WARNINGS_gcc := type-limits format-nonliteral, \
- DISABLED_WARNINGS_clang := int-conversion, \
- DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
- DISABLED_WARNINGS_microsoft := 4022 4267 4996, \
- WARNINGS_AS_ERRORS_solstudio := false, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/make/lib/Lib-jdk.hprof.agent.gmk Thu May 28 11:37:13 2015 -0700
+++ b/jdk/make/lib/Lib-jdk.hprof.agent.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -49,7 +49,6 @@
CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
$(BUILD_LIBHPROF_CFLAGS), \
CFLAGS_debug := -DHPROF_LOGGING, \
- CFLAGS_windows := -D_WINSOCK_DEPRECATED_NO_WARNINGS, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libhprof/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/src/bsd/doc/man/ja/native2ascii.1 Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-." Copyright (c) 1997, 2012, 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.
-."
-.TH native2ascii 1 "07 May 2011"
-
-.LP
--- a/jdk/src/bsd/doc/man/native2ascii.1 Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-'\" t
-.\" Copyright (c) 1997, 2013, 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.
-.\"
-.\" Arch: generic
-.\" Software: JDK 8
-.\" Date: 21 November 2013
-.\" SectDesc: Internationalization Tools
-.\" Title: native2ascii.1
-.\"
-.if n .pl 99999
-.TH native2ascii 1 "21 November 2013" "JDK 8" "Internationalization Tools"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-
-.SH NAME
-native2ascii \- Creates localizable applications by converting a file with characters in any supported character encoding to one with ASCII and/or Unicode escapes or vice versa\&.
-.SH SYNOPSIS
-.sp
-.nf
-
-\fBnative2ascii\fR [ \fIinputfile\fR ] [ \fIoutputfile\fR ]
-.fi
-.sp
-.TP
-\fIinputfile\fR
-The encoded file to be converted to ASCII\&.
-.TP
-\fIoutputfile\fR
-The converted ASCII file\&.
-.SH DESCRIPTION
-The \f3native2ascii\fR command converts encoded files supported by the Java Runtime Environment (JRE) to files encoded in ASCII, using Unicode escapes (\f3\eu\fR\fIxxxx\fR) notation for all characters that are not part of the ASCII character set\&. This process is required for properties files that contain characters not in ISO-8859-1 character sets\&. The tool can also perform the reverse conversion\&.
-.PP
-If the \f3outputfile\fR value is omitted, then standard output is used for output\&. If, in addition, the \f3inputfile\fR value is omitted, then standard input is used for input\&.
-.SH OPTIONS
-.TP
--reverse
-.br
-Perform the reverse operation: Converts a file encoded in ISO-8859-1 with Unicode escapes to a file in any character encoding supported by the JRE\&.
-.TP
--encoding \fIencoding_name\fR
-.br
-Specifies the name of the character encoding to be used by the conversion procedure\&. If this option is not present, then the default character encoding (as determined by the \f3java\&.nio\&.charset\&.Charset\&.defaultCharset\fR method) is used\&. The \f3encoding_name\fR string must be the name of a character encoding that is supported by the JRE\&. See Supported Encodings at http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/intl/encoding\&.doc\&.html
-.TP
--J\fIoption\fR
-.br
-Passes \f3option\fR to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java application launcher\&. For example, \f3-J-Xms48m\fR sets the startup memory to 48 MB\&. See java(1)\&.
-.RE
-.br
-'pl 8.5i
-'bp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2003, 2011, 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.
+ */
+
+/**
+ * This package provides methods to read files from a JAR file and to
+ * transform them to a more compact transfer format called Pack200.
+ * It also provides methods to receive the transmitted data and expand
+ * it into a JAR file equivalent to the original JAR file.
+ *
+ * <p>
+ * The {@code pack} methods may be used by application developers who
+ * wish to deploy large JARs on the web. The {@code unpack} methods
+ * may be used by deployment applications such as Java Web Start and
+ * Java Plugin.
+ *
+ * <p>
+ * In typical use, the packed output should be further compressed
+ * using a suitable tool such as gzip or
+ * {@code java.util.zip.GZIPOutputStream}. The resulting file (with
+ * a suffix ".pack.gz") should be hosted on a HTTP/1.1 compliant
+ * server, which will be capable of handling "Accept-Encoding", as
+ * specified by the HTTP 1.1 RFC2616 specification.
+ *
+ * <p>
+ * <b>NOTE:</b> It is recommended that the original ".jar" file be
+ * hosted in addition to the ".pack.gz" file, so that older client
+ * implementations will continue to work reliably. (On-demand
+ * compression by the server is not recommended.)
+ *
+ * <p>
+ * When a client application requests a ".jar" file (call it
+ * "Large.jar"), the client will transmit the headers
+ * "Content-Type=application/x-java-archive" as well as
+ * "Accept-Encoding=pack200-gzip". This indicates to the server that
+ * the client application desires an version of the file encoded with
+ * Pack200 and further compressed with gzip.
+ *
+ * <p>
+ * The server implementation will typically check for the existence of
+ * "Large.pack.gz". If that file is available, the server will
+ * transmit it with the headers "Content-Encoding=pack200-gzip" and
+ * "Content-Type=application/x-java-archive".
+ *
+ * <p>
+ * If the ".pack.gz" file, is not available, then the server will
+ * transmit the original ".jar" with "Content-Encoding=null" and
+ * "Content-Type=application/x-java-archive".
+ *
+ * <p>
+ * A MIME type of "application/x-java-pack200" may be specified by the
+ * client application to indicate a ".pack" file is required.
+ * However, this has limited capability, and is not recommended.
+ *
+ * <h2> Package Specification</h2>
+ * Network Transfer Format Specification :<a href="http://jcp.org/en/jsr/detail?id=200">
+ * http://jcp.org/en/jsr/detail?id=200</a>
+ *
+ * <h2> Related Documentation</h2>
+ * For overviews, tutorials, examples, guides, and tool documentation, please
+ * see:
+ * <ul>
+ *
+ * <li>
+ * Jar File Specification :<a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html">
+ * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html</a></li>
+ *
+ * <li>
+ * Class File Specification: Chapter 4 of
+ * <em>The Java™ Virtual Machine Specification</em>
+ *
+ * <li>
+ * Hypertext Transfer Protocol -- HTTP/1.1 : <a href="http://www.ietf.org/rfc/rfc2616.txt">
+ * http://www.ietf.org/rfc/rfc2616.txt
+ * </ul>
+ *
+ * <li>
+ * @since 1.5</li>
+ */
+package com.sun.java.util.jar.pack;
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
-<!--
-
-Copyright (c) 2003, 2011, 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.
--->
-</head>
-<body bgcolor="white">
-<p>
-This package provides methods to read files from a JAR file and
-to transform them to a more compact transfer format called Pack200.
-It also provides methods to receive the transmitted data and expand
-it into a JAR file equivalent to the original JAR file.
-
-<p>
-The <tt>pack</tt> methods may be used by application developers
-who wish to deploy large JARs on the web. The <tt>unpack</tt> methods may be used
-by deployment applications such as Java Web Start and Java Plugin.
-
-<p>
-In typical use, the packed output should be further compressed using
-a suitable tool such as gzip or <tt>java.util.zip.GZIPOutputStream</tt>.
-The resulting file (with a suffix ".pack.gz") should be hosted on a HTTP/1.1
-compliant server, which will be capable of handling "Accept-Encoding",
-as specified by the HTTP 1.1 RFC2616 specification.
-
-<p>
-<b>NOTE:</b> It is recommended that the original ".jar" file be hosted
-in addition to the ".pack.gz" file, so that older client implementations
-will continue to work reliably.
-(On-demand compression by the server is not recommended.)
-
-<p>
-When a client application requests a ".jar" file (call it "Large.jar"),
-the client will transmit the headers
-"Content-Type=application/x-java-archive" as well as "Accept-Encoding=pack200-gzip".
-This indicates to the server that the client application desires an version
-of the file encoded with Pack200 and further compressed with gzip.
-
-<p>
-The server implementation will typically check for the existence of "Large.pack.gz".
-If that file is available, the server will transmit it with the headers
-"Content-Encoding=pack200-gzip" and "Content-Type=application/x-java-archive".
-
-<p>
-If the ".pack.gz" file, is not available, then the server will transmit
-the original ".jar"
-with "Content-Encoding=null" and "Content-Type=application/x-java-archive".
-
-<p>
-A MIME type of "application/x-java-pack200" may be specified by the
-client application to indicate a ".pack" file is required.
-However, this has limited capability, and is not recommended.
-
-<h2> Package Specification</h2>
-Network Transfer Format Specification :<a href="http://jcp.org/en/jsr/detail?id=200">
-http://jcp.org/en/jsr/detail?id=200</a>
-
-<h2> Related Documentation</h2>
-For overviews, tutorials, examples, guides, and tool documentation, please
-see:
-<ul>
-
-<li>
-Jar File Specification :<a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html">
-http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html</a></li>
-
-<li>
-Class File Specification: Chapter 4 of
-<em>The Java™ Virtual Machine Specification</em>
-
-<li>
-Hypertext Transfer Protocol -- HTTP/1.1 : <a href="http://www.ietf.org/rfc/rfc2616.txt">
-http://www.ietf.org/rfc/rfc2616.txt
-</ul>
-
-<li>
-@since 1.5</li>
-
-<br><!-- Put @see and @since tags down here. -->
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1999, 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.
+ */
+
+/**
+ * Provides classes related to creating and configuring secure socket
+ * factories. These classes are used with the Sun reference
+ * implementation of the Java Secure Socket Extension (JSSE).
+ */
+package com.sun.net.ssl;
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
-
-Copyright (c) 1999, 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.
-
--->
-
-</head>
-<body bgcolor="white">
-
-Provides classes related to creating and configuring secure socket factories.
-These classes are used with the Sun reference implementation of the Java
-Secure Socket Extension (JSSE).
-<!--
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
- <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
-
--->
-
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/io/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1998, 2010, 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.
+ */
+
+/**
+ * Provides for system input and output through data streams,
+ * serialization and the file system.
+ *
+ * Unless otherwise noted, passing a null argument to a constructor or
+ * method in any class or interface in this package will cause a
+ * {@code NullPointerException} to be thrown.
+ *
+ * <h2>Package Specification</h2>
+ * <ul>
+ * <li><a href="../../../platform/serialization/spec/serialTOC.html"> Java Object Serialization Specification </a>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For overviews, tutorials, examples, guides, and tool documentation,
+ * please see:
+ * <ul>
+ * <li><a href="../../../technotes/guides/serialization">Serialization Enhancements</a>
+ * </ul>
+ *
+ * @since 1.0
+ */
+package java.io;
--- a/jdk/src/java.base/share/classes/java/io/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-<!--
- Copyright (c) 1998, 2010, 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.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<body bgcolor="white">
-
-Provides for system input and output through data streams,
-serialization and the file system.
-
-Unless otherwise noted, passing a null argument to a constructor
-or method in any class or interface in this package will cause a
-<tt>NullPointerException</tt> to be thrown.
-
-<h2>Package Specification</h2>
-<ul>
- <li><a href="../../../platform/serialization/spec/serialTOC.html"> Java Object Serialization Specification </a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation,
-please see:
-<ul>
- <li><a href="../../../technotes/guides/serialization">Serialization Enhancements</a>
-</ul>
-
-@since 1.0
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/ref/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 1998, 2003, 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.
+ */
+
+/**
+ * Provides reference-object classes, which support a limited degree
+ * of interaction with the garbage collector. A program may use a
+ * reference object to maintain a reference to some other object in
+ * such a way that the latter object may still be reclaimed by the
+ * collector. A program may also arrange to be notified some time
+ * after the collector has determined that the reachability of a given
+ * object has changed.
+ *
+ *<h2>Package Specification</h2>
+ *
+ * A <em>reference object</em> encapsulates a reference to some other
+ * object so that the reference itself may be examined and manipulated
+ * like any other object. Three types of reference objects are
+ * provided, each weaker than the last: <em>soft</em>, <em>weak</em>,
+ * and <em>phantom</em>. Each type corresponds to a different level
+ * of reachability, as defined below. Soft references are for
+ * implementing memory-sensitive caches, weak references are for
+ * implementing canonicalizing mappings that do not prevent their keys
+ * (or values) from being reclaimed, and phantom references are for
+ * scheduling pre-mortem cleanup actions in a more flexible way than
+ * is possible with the Java finalization mechanism.
+ *
+ * <p> Each reference-object type is implemented by a subclass of the
+ * abstract base {@link java.lang.ref.Reference} class.
+ * An instance of one of these subclasses encapsulates a single
+ * reference to a particular object, called the <em>referent</em>.
+ * Every reference object provides methods for getting and clearing
+ * the reference. Aside from the clearing operation reference objects
+ * are otherwise immutable, so no {@code set} operation is
+ * provided. A program may further subclass these subclasses, adding
+ * whatever fields and methods are required for its purposes, or it
+ * may use these subclasses without change.
+ *
+ * <h3>Notification</h3>
+ *
+ * A program may request to be notified of changes in an object's
+ * reachability by <em>registering</em> an appropriate reference
+ * object with a <em>reference queue</em> at the time the reference
+ * object is created. Some time after the garbage collector
+ * determines that the reachability of the referent has changed to the
+ * value corresponding to the type of the reference, it will add the
+ * reference to the associated queue. At this point, the reference is
+ * considered to be <em>enqueued</em>. The program may remove
+ * references from a queue either by polling or by blocking until a
+ * reference becomes available. Reference queues are implemented by
+ * the {@link java.lang.ref.ReferenceQueue} class.
+ *
+ * <p> The relationship between a registered reference object and its
+ * queue is one-sided. That is, a queue does not keep track of the
+ * references that are registered with it. If a registered reference
+ * becomes unreachable itself, then it will never be enqueued. It is
+ * the responsibility of the program using reference objects to ensure
+ * that the objects remain reachable for as long as the program is
+ * interested in their referents.
+ *
+ * <p> While some programs will choose to dedicate a thread to
+ * removing reference objects from one or more queues and processing
+ * them, this is by no means necessary. A tactic that often works
+ * well is to examine a reference queue in the course of performing
+ * some other fairly-frequent action. For example, a hashtable that
+ * uses weak references to implement weak keys could poll its
+ * reference queue each time the table is accessed. This is how the
+ * {@link java.util.WeakHashMap} class works. Because
+ * the {@link java.lang.ref.ReferenceQueue#poll
+ * ReferenceQueue.poll} method simply checks an internal data
+ * structure, this check will add little overhead to the hashtable
+ * access methods.
+ *
+ * <h3>Automatically-cleared references</h3>
+ *
+ * Soft and weak references are automatically cleared by the collector
+ * before being added to the queues with which they are registered, if
+ * any. Therefore soft and weak references need not be registered
+ * with a queue in order to be useful, while phantom references do.
+ * An object that is reachable via phantom references will remain so
+ * until all such references are cleared or themselves become
+ * unreachable.
+ *
+ * <a name="reachability"></a>
+ * <h3>Reachability</h3>
+ *
+ * Going from strongest to weakest, the different levels of
+ * reachability reflect the life cycle of an object. They are
+ * operationally defined as follows:
+ *
+ * <ul>
+ *
+ * <li> An object is <em>strongly reachable</em> if it can be reached
+ * by some thread without traversing any reference objects. A
+ * newly-created object is strongly reachable by the thread that
+ * created it.
+ *
+ * <li> An object is <em>softly reachable</em> if it is not strongly
+ * reachable but can be reached by traversing a soft reference.
+ *
+ * <li> An object is <em>weakly reachable</em> if it is neither
+ * strongly nor softly reachable but can be reached by traversing a
+ * weak reference. When the weak references to a weakly-reachable
+ * object are cleared, the object becomes eligible for finalization.
+ *
+ * <li> An object is <em>phantom reachable</em> if it is neither
+ * strongly, softly, nor weakly reachable, it has been finalized, and
+ * some phantom reference refers to it.
+ *
+ * <li> Finally, an object is <em>unreachable</em>, and therefore
+ * eligible for reclamation, when it is not reachable in any of the
+ * above ways.
+ *
+ * </ul>
+ *
+ * @author Mark Reinhold
+ * @since 1.2
+ */
+package java.lang.ref;
--- a/jdk/src/java.base/share/classes/java/lang/ref/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-<!--
- Copyright (c) 1998, 2003, 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.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<body bgcolor="white">
-
-
-Provides reference-object classes, which support a limited degree of
-interaction with the garbage collector. A program may use a reference object
-to maintain a reference to some other object in such a way that the latter
-object may still be reclaimed by the collector. A program may also arrange to
-be notified some time after the collector has determined that the reachability
-of a given object has changed.
-
-
-<h2>Package Specification</h2>
-
-A <em>reference object</em> encapsulates a reference to some other object so
-that the reference itself may be examined and manipulated like any other
-object. Three types of reference objects are provided, each weaker than the
-last: <em>soft</em>, <em>weak</em>, and <em>phantom</em>. Each type
-corresponds to a different level of reachability, as defined below. Soft
-references are for implementing memory-sensitive caches, weak references are
-for implementing canonicalizing mappings that do not prevent their keys (or
-values) from being reclaimed, and phantom references are for scheduling
-pre-mortem cleanup actions in a more flexible way than is possible with the
-Java finalization mechanism.
-
-<p> Each reference-object type is implemented by a subclass of the abstract
-base <code>{@link java.lang.ref.Reference}</code> class. An instance of one of
-these subclasses encapsulates a single reference to a particular object, called
-the <em>referent</em>. Every reference object provides methods for getting and
-clearing the reference. Aside from the clearing operation reference objects
-are otherwise immutable, so no <code>set</code> operation is provided. A
-program may further subclass these subclasses, adding whatever fields and
-methods are required for its purposes, or it may use these subclasses without
-change.
-
-
-<h3>Notification</h3>
-
-A program may request to be notified of changes in an object's reachability by
-<em>registering</em> an appropriate reference object with a <em>reference
-queue</em> at the time the reference object is created. Some time after the
-garbage collector determines that the reachability of the referent has changed
-to the value corresponding to the type of the reference, it will add the
-reference to the associated queue. At this point, the reference is considered
-to be <em>enqueued</em>. The program may remove references from a queue either
-by polling or by blocking until a reference becomes available. Reference
-queues are implemented by the <code>{@link java.lang.ref.ReferenceQueue}</code>
-class.
-
-<p> The relationship between a registered reference object and its queue is
-one-sided. That is, a queue does not keep track of the references that are
-registered with it. If a registered reference becomes unreachable itself, then
-it will never be enqueued. It is the responsibility of the program using
-reference objects to ensure that the objects remain reachable for as long as
-the program is interested in their referents.
-
-<p> While some programs will choose to dedicate a thread to removing reference
-objects from one or more queues and processing them, this is by no means
-necessary. A tactic that often works well is to examine a reference queue in
-the course of performing some other fairly-frequent action. For example, a
-hashtable that uses weak references to implement weak keys could poll its
-reference queue each time the table is accessed. This is how the <code>{@link
-java.util.WeakHashMap}</code> class works. Because the <code>{@link
-java.lang.ref.ReferenceQueue#poll ReferenceQueue.poll}</code> method simply
-checks an internal data structure, this check will add little overhead to the
-hashtable access methods.
-
-
-<h3>Automatically-cleared references</h3>
-
-Soft and weak references are automatically cleared by the collector before
-being added to the queues with which they are registered, if any. Therefore
-soft and weak references need not be registered with a queue in order to be
-useful, while phantom references do. An object that is reachable via phantom
-references will remain so until all such references are cleared or themselves
-become unreachable.
-
-
-<a name="reachability"></a>
-<h3>Reachability</h3>
-
-Going from strongest to weakest, the different levels of reachability reflect
-the life cycle of an object. They are operationally defined as follows:
-
-<ul>
-
-<li> An object is <em>strongly reachable</em> if it can be reached by some
-thread without traversing any reference objects. A newly-created object is
-strongly reachable by the thread that created it.
-
-<li> An object is <em>softly reachable</em> if it is not strongly reachable but
-can be reached by traversing a soft reference.
-
-<li> An object is <em>weakly reachable</em> if it is neither strongly nor
-softly reachable but can be reached by traversing a weak reference. When the
-weak references to a weakly-reachable object are cleared, the object becomes
-eligible for finalization.
-
-<li> An object is <em>phantom reachable</em> if it is neither strongly, softly,
-nor weakly reachable, it has been finalized, and some phantom reference refers
-to it.
-
-<li> Finally, an object is <em>unreachable</em>, and therefore eligible for
-reclamation, when it is not reachable in any of the above ways.
-
-</ul>
-
-
-@author Mark Reinhold
-@since 1.2
-
-<!--
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
--->
-</body>
-</html>
--- a/jdk/src/java.base/share/classes/java/math/BigDecimal.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/math/BigDecimal.java Mon Jun 01 10:15:20 2015 -0700
@@ -5176,7 +5176,7 @@
}
/*
- * returns true if 128 bit number <hi0,lo0> is less then <hi1,lo1>
+ * returns true if 128 bit number <hi0,lo0> is less than <hi1,lo1>
* hi0 & hi1 should be non-negative
*/
private static boolean longLongCompareMagnitude(long hi0, long lo0, long hi1, long lo1) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/nio/channels/spi/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2000, 2009, 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.
+ */
+
+/**
+ * Service-provider classes for the {@link java.nio.channels}
+ * package.
+ *
+ * <p> Only developers who are defining new selector providers or
+ * asynchronous channel providers should need to make direct use of
+ * this package. </p>
+ *
+ * <p> Unless otherwise noted, passing a {@code null} argument to a
+ * constructor or method in any class or interface in this package
+ * will cause a {@link java.lang.NullPointerException
+ * NullPointerException} to be thrown.
+ *
+ *
+ * @since 1.4
+ * @author Mark Reinhold
+ * @author JSR-51 Expert Group
+ */
+package java.nio.channels.spi;
--- a/jdk/src/java.base/share/classes/java/nio/channels/spi/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<!--
- Copyright (c) 2000, 2009, 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.
--->
-
-<!doctype html public "-//IETF//DTD HTML//EN">
-<html>
-<body bgcolor="white">
-
-Service-provider classes for the <tt>{@link java.nio.channels}</tt> package.
-
-<p> Only developers who are defining new selector providers or asynchronous
-channel providers should need to make direct use of this package. </p>
-
-<p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
-or method in any class or interface in this package will cause a {@link
-java.lang.NullPointerException NullPointerException} to be thrown.
-
-
-@since 1.4
-@author Mark Reinhold
-@author JSR-51 Expert Group
-
-</body>
-</html>
--- a/jdk/src/java.base/share/classes/java/nio/charset/Charset.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,7 @@
import java.nio.charset.spi.CharsetProvider;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
@@ -336,12 +337,10 @@
//
private static Iterator<CharsetProvider> providers() {
return new Iterator<>() {
-
ClassLoader cl = ClassLoader.getSystemClassLoader();
ServiceLoader<CharsetProvider> sl =
ServiceLoader.load(CharsetProvider.class, cl);
Iterator<CharsetProvider> i = sl.iterator();
-
CharsetProvider next = null;
private boolean getNext() {
@@ -424,32 +423,36 @@
/* The extended set of charsets */
private static class ExtendedProviderHolder {
- static final CharsetProvider extendedProvider = extendedProvider();
+ static final CharsetProvider[] extendedProviders = extendedProviders();
// returns ExtendedProvider, if installed
- private static CharsetProvider extendedProvider() {
- return AccessController.doPrivileged(
- new PrivilegedAction<>() {
- public CharsetProvider run() {
- try {
- Class<?> epc
- = Class.forName("sun.nio.cs.ext.ExtendedCharsets");
- return (CharsetProvider)epc.newInstance();
- } catch (ClassNotFoundException x) {
- // Extended charsets not available
- // (charsets.jar not present)
- } catch (InstantiationException |
- IllegalAccessException x) {
- throw new Error(x);
- }
- return null;
+ private static CharsetProvider[] extendedProviders() {
+ return AccessController.doPrivileged(new PrivilegedAction<>() {
+ public CharsetProvider[] run() {
+ CharsetProvider[] cps = new CharsetProvider[1];
+ int n = 0;
+ ServiceLoader<CharsetProvider> sl =
+ ServiceLoader.loadInstalled(CharsetProvider.class);
+ for (CharsetProvider cp : sl) {
+ if (n + 1 > cps.length) {
+ cps = Arrays.copyOf(cps, cps.length << 1);
}
- });
+ cps[n++] = cp;
+ }
+ return n == cps.length ? cps : Arrays.copyOf(cps, n);
+ }});
}
}
private static Charset lookupExtendedCharset(String charsetName) {
- CharsetProvider ecp = ExtendedProviderHolder.extendedProvider;
- return (ecp != null) ? ecp.charsetForName(charsetName) : null;
+ if (!sun.misc.VM.isBooted()) // see lookupViaProviders()
+ return null;
+ CharsetProvider[] ecps = ExtendedProviderHolder.extendedProviders;
+ for (CharsetProvider cp : ecps) {
+ Charset cs = cp.charsetForName(charsetName);
+ if (cs != null)
+ return cs;
+ }
+ return null;
}
private static Charset lookup(String charsetName) {
@@ -576,9 +579,10 @@
new TreeMap<>(
ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
put(standardProvider.charsets(), m);
- CharsetProvider ecp = ExtendedProviderHolder.extendedProvider;
- if (ecp != null)
+ CharsetProvider[] ecps = ExtendedProviderHolder.extendedProviders;
+ for (CharsetProvider ecp :ecps) {
put(ecp.charsets(), m);
+ }
for (Iterator<CharsetProvider> i = providers(); i.hasNext();) {
CharsetProvider cp = i.next();
put(cp.charsets(), m);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/nio/charset/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2001, 2010, 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.
+ */
+
+/**
+ * Defines charsets, decoders, and encoders, for translating between
+ * bytes and Unicode characters.
+ *
+ * <blockquote><table cellspacing=1 cellpadding=0 summary="Summary of charsets, decoders, and encoders in this package">
+ * <tr><th align="left">Class name</th><th align="left">Description</th></tr>
+ * <tr><td valign=top>{@link java.nio.charset.Charset}</td>
+ * <td>A named mapping between characters<br>and bytes</td></tr>
+ * <tr><td valign=top>{@link java.nio.charset.CharsetDecoder}</td>
+ * <td>Decodes bytes into characters</td></tr>
+ * <tr><td valign=top>{@link java.nio.charset.CharsetEncoder} </td>
+ * <td>Encodes characters into bytes</td></tr>
+ * <tr><td valign=top>{@link java.nio.charset.CoderResult} </td>
+ * <td>Describes coder results</td></tr>
+ * <tr><td valign=top>{@link java.nio.charset.CodingErrorAction} </td>
+ * <td>Describes actions to take when<br>coding errors are detected</td></tr>
+ *
+ * </table></blockquote>
+ *
+ * <p> A <i>charset</i> is named mapping between sequences of
+ * sixteen-bit Unicode characters and sequences of bytes, in the sense
+ * defined in <a
+ * href="http://www.ietf.org/rfc/rfc2278.txt"><i>RFC 2278</i></a>.
+ * A <i>decoder</i> is an engine which transforms bytes in a specific
+ * charset into characters, and an <i>encoder</i> is an engine which
+ * transforms characters into bytes. Encoders and decoders operate on
+ * byte and character buffers. They are collectively referred to as
+ * <i>coders</i>.
+ *
+ * <p> The {@link java.nio.charset.Charset} class defines methods for
+ * creating coders for a given charset and for retrieving the various
+ * names associated with a charset. It also defines static methods
+ * for testing whether a particular charset is supported, for locating
+ * charset instances by name, and for constructing a map that contains
+ * every charset for which support is available in the current Java
+ * virtual machine.
+ *
+ * <p> Most users will not use these classes directly; instead they
+ * will use the existing charset-related constructors and methods in
+ * the {@link java.lang.String} class, together with the existing
+ * {@link java.io.InputStreamReader} and {@link
+ * java.io.OutputStreamWriter} classes, all of whose implementations
+ * have been reworked to make use of the charset facilities defined in
+ * this package. A small number of changes have been made to the
+ * {@link java.io.InputStreamReader} and {@link
+ * java.io.OutputStreamWriter} classes in order to allow explicit
+ * charset objects to be specified in the construction of instances of
+ * those classes.
+ *
+ * <p> Support for new charsets can be made available via the
+ * interface defined in the {@link
+ * java.nio.charset.spi.CharsetProvider} class in the <tt>{@link
+ * java.nio.charset.spi}</tt> package.
+ *
+ * <p> Unless otherwise noted, passing a <tt>null</tt> argument to a
+ * constructor or method in any class or interface in this package
+ * will cause a {@link java.lang.NullPointerException
+ * NullPointerException} to be thrown.
+ *
+ *
+ * @since 1.4
+ * @author Mark Reinhold
+ * @author JSR-51 Expert Group
+ */
+package java.nio.charset;
--- a/jdk/src/java.base/share/classes/java/nio/charset/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-<!--
- Copyright (c) 2001, 2010, 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.
--->
-
-<!doctype html public "-//IETF//DTD HTML//EN">
-<html>
-<body bgcolor="white">
-
-
-Defines charsets, decoders, and encoders, for translating between bytes and
-Unicode characters.
-
-<blockquote><table cellspacing=1 cellpadding=0 summary="Summary of charsets, decoders, and encoders in this package">
- <tr><th><p align="left">Class name</p></th><th><p align="left">Description</p></th></tr>
- <tr><td valign=top><tt>{@link java.nio.charset.Charset}</tt></td>
- <td>A named mapping between characters<br>and bytes</td></tr>
- <tr><td valign=top><tt>{@link java.nio.charset.CharsetDecoder}</tt></td>
- <td>Decodes bytes into characters</td></tr>
- <tr><td valign=top><tt>{@link java.nio.charset.CharsetEncoder} </tt></td>
- <td>Encodes characters into bytes</td></tr>
- <tr><td valign=top><tt>{@link java.nio.charset.CoderResult} </tt></td>
- <td>Describes coder results</td></tr>
- <tr><td valign=top><tt>{@link java.nio.charset.CodingErrorAction} </tt></td>
- <td>Describes actions to take when<br>coding errors are detected</td></tr>
-
-</table></blockquote>
-
-<p> A <i>charset</i> is named mapping between sequences of sixteen-bit Unicode
-characters and sequences of bytes, in the sense defined in <a
-href="http://www.ietf.org/rfc/rfc2278.txt"><i>RFC 2278</i></a>. A
-<i>decoder</i> is an engine which transforms bytes in a specific charset into
-characters, and an <i>encoder</i> is an engine which transforms characters into
-bytes. Encoders and decoders operate on byte and character buffers. They are
-collectively referred to as <i>coders</i>.
-
-<p> The {@link java.nio.charset.Charset} class defines methods for creating
-coders for a given charset and for retrieving the various names associated with
-a charset. It also defines static methods for testing whether a particular
-charset is supported, for locating charset instances by name, and for
-constructing a map that contains every charset for which support is available
-in the current Java virtual machine.
-
-<p> Most users will not use these classes directly; instead they will use the
-existing charset-related constructors and methods in the {@link
-java.lang.String} class, together with the existing {@link
-java.io.InputStreamReader} and {@link java.io.OutputStreamWriter} classes, all
-of whose implementations have been reworked to make use of the charset
-facilities defined in this package. A small number of changes have been made
-to the {@link java.io.InputStreamReader} and {@link java.io.OutputStreamWriter}
-classes in order to allow explicit charset objects to be specified in the
-construction of instances of those classes.
-
-<p> Support for new charsets can be made available via the interface defined in
-the {@link java.nio.charset.spi.CharsetProvider} class in the <tt>{@link
-java.nio.charset.spi}</tt> package.
-
-<p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
-or method in any class or interface in this package will cause a {@link
-java.lang.NullPointerException NullPointerException} to be thrown.
-
-
-@since 1.4
-@author Mark Reinhold
-@author JSR-51 Expert Group
-
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/nio/charset/spi/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2001, 2005, 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.
+ */
+
+/**
+ * Service-provider classes for the {@link java.nio.charset} package.
+ *
+ * <p> Only developers who are defining new charsets should need to
+ * make direct use of this package. </p>
+ *
+ * <p> Unless otherwise noted, passing a {@code null} argument to a
+ * constructor or method in any class or interface in this package
+ * will cause a {@link java.lang.NullPointerException
+ * NullPointerException} to be thrown.
+ *
+ * @since 1.4
+ * @author Mark Reinhold
+ * @author JSR-51 Expert Group
+ */
+package java.nio.charset.spi;
--- a/jdk/src/java.base/share/classes/java/nio/charset/spi/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<!--
- Copyright (c) 2001, 2005, 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.
--->
-
-<!doctype html public "-//IETF//DTD HTML//EN">
-<html>
-<body bgcolor="white">
-
-Service-provider classes for the <tt>{@link java.nio.charset}</tt> package.
-
-<p> Only developers who are defining new charsets should need to make direct
-use of this package. </p>
-
-<p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
-or method in any class or interface in this package will cause a {@link
-java.lang.NullPointerException NullPointerException} to be thrown.
-
-
-@since 1.4
-@author Mark Reinhold
-@author JSR-51 Expert Group
-
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/nio/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2000, 2013, 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.
+ */
+
+/**
+ * Defines buffers, which are containers for data, and provides an
+ * overview of the other NIO packages.
+ *
+ *
+ * <p> The central abstractions of the NIO APIs are: </p>
+ *
+ * <ul>
+ *
+ * <li><p> <a href="#buffers"><i>Buffers</i></a>, which are containers for data;
+ * </p></li>
+ *
+ * <li><p> <a
+ * href="charset/package-summary.html"><i>Charsets</i></a> and their
+ * associated <i>decoders</i> and <i>encoders</i>, <br> which
+ * translate between bytes and Unicode characters; </p></li>
+ *
+ * <li><p> <a
+ * href="channels/package-summary.html"><i>Channels</i></a> of
+ * various types, which represent connections <br> to entities
+ * capable of performing I/O operations; and </p></li>
+ *
+ * <li><p> <i>Selectors</i> and <i>selection keys</i>, which
+ * together with <br> <i>selectable channels</i> define a <a
+ * href="channels/package-summary.html#multiplex">multiplexed,
+ * non-blocking <br> I/O</a> facility. </p></li>
+ *
+ * </ul>
+ *
+ * <p> The <tt>java.nio</tt> package defines the buffer classes, which
+ * are used throughout the NIO APIs. The charset API is defined in
+ * the {@link java.nio.charset} package, and the channel and selector
+ * APIs are defined in the {@link java.nio.channels} package. Each of
+ * these subpackages has its own service-provider (SPI) subpackage,
+ * the contents of which can be used to extend the platform's default
+ * implementations or to construct alternative implementations.
+ *
+ * <a name="buffers"> </a>
+ *
+ * <blockquote><table cellspacing=1 cellpadding=0 summary="Description of the various buffers">
+ * <tr><th align="left">Buffers</th><th align="left">Description</th></tr>
+ * <tr><td valign=top><tt>{@link java.nio.Buffer}</tt></td>
+ * <td>Position, limit, and capacity;
+ * <br>clear, flip, rewind, and mark/reset</td></tr>
+ * <tr><td valign=top><tt> {@link java.nio.ByteBuffer}</tt></td>
+ * <td>Get/put, compact, views; allocate, wrap</td></tr>
+ * <tr><td valign=top><tt> {@link java.nio.MappedByteBuffer} </tt></td>
+ * <td>A byte buffer mapped to a file</td></tr>
+ * <tr><td valign=top><tt> {@link java.nio.CharBuffer}</tt></td>
+ * <td>Get/put, compact; allocate, wrap</td></tr>
+ * <tr><td valign=top><tt> {@link java.nio.DoubleBuffer}</tt></td>
+ * <td> ' '</td></tr>
+ * <tr><td valign=top><tt> {@link java.nio.FloatBuffer}</tt></td>
+ * <td> ' '</td></tr>
+ * <tr><td valign=top><tt> {@link java.nio.IntBuffer}</tt></td>
+ * <td> ' '</td></tr>
+ * <tr><td valign=top><tt> {@link java.nio.LongBuffer}</tt></td>
+ * <td> ' '</td></tr>
+ * <tr><td valign=top><tt> {@link java.nio.ShortBuffer}</tt></td>
+ * <td> ' '</td></tr>
+ * <tr><td valign=top><tt>{@link java.nio.ByteOrder}</tt></td>
+ * <td>Typesafe enumeration for byte orders</td></tr>
+ * </table></blockquote>
+ *
+ * <p> A <i>buffer</i> is a container for a fixed amount of data of a
+ * specific primitive type. In addition to its content a buffer has a
+ * <i>position</i>, which is the index of the next element to be read
+ * or written, and a <i>limit</i>, which is the index of the first
+ * element that should not be read or written. The base {@link
+ * java.nio.Buffer} class defines these properties as well as methods
+ * for <i>clearing</i>, <i>flipping</i>, and <i>rewinding</i>, for
+ * <i>marking</i> the current position, and for <i>resetting</i> the
+ * position to the previous mark.
+ *
+ * <p> There is a buffer class for each non-boolean primitive type.
+ * Each class defines a family of <i>get</i> and <i>put</i> methods
+ * for moving data out of and in to a buffer, methods for
+ * <i>compacting</i>, <i>duplicating</i>, and <i>slicing</i> a buffer,
+ * and static methods for <i>allocating</i> a new buffer as well as
+ * for <i>wrapping</i> an existing array into a buffer.
+ *
+ * <p> Byte buffers are distinguished in that they can be used as the
+ * sources and targets of I/O operations. They also support several
+ * features not found in the other buffer classes:
+ *
+ * <ul>
+ *
+ * <li><p> A byte buffer can be allocated as a <a
+ * href="ByteBuffer.html#direct"> <i>direct</i></a> buffer, in which
+ * case the Java virtual machine will make a best effort to perform
+ * native I/O operations directly upon it. </p></li>
+ *
+ * <li><p> A byte buffer can be created by {@link
+ * java.nio.channels.FileChannel#map <i>mapping</i>} a region of a
+ * file directly into memory, in which case a few additional
+ * file-related operations defined in the {@link
+ * java.nio.MappedByteBuffer} class are available. </p></li>
+ *
+ * <li><p> A byte buffer provides access to its content as either a
+ * heterogeneous or homogeneous sequence of <a
+ * href="ByteBuffer.html#bin"><i>binary data</i></a> of any
+ * non-boolean primitive type, in either big-endian or little-endian
+ * <a href="ByteOrder.html">byte order</a>. </p></li>
+ *
+ * </ul>
+ *
+ * <p> Unless otherwise noted, passing a <tt>null</tt> argument to a
+ * constructor or method in any class or interface in this package
+ * will cause a {@link java.lang.NullPointerException
+ * NullPointerException} to be thrown.
+ *
+ * @since 1.4
+ * @author Mark Reinhold
+ * @author JSR-51 Expert Group
+ */
+package java.nio;
--- a/jdk/src/java.base/share/classes/java/nio/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-<!--
- Copyright (c) 2000, 2013, 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.
--->
-
-<!doctype html public "-//IETF//DTD HTML//EN">
-<html>
-<body bgcolor="white">
-
-Defines buffers, which are containers for data, and provides an overview of the
-other NIO packages.
-
-
-<p> The central abstractions of the NIO APIs are: </p>
-
-<ul>
-
- <li><p> <a href="#buffers"><i>Buffers</i></a>, which are containers for data;
- </p></li>
-
- <li><p> <a href="charset/package-summary.html"><i>Charsets</i></a> and their
- associated <i>decoders</i> and <i>encoders</i>, <br> which translate between
- bytes and Unicode characters; </p></li>
-
- <li><p> <a href="channels/package-summary.html"><i>Channels</i></a> of
- various types, which represent connections <br> to entities capable of
- performing I/O operations; and </p></li>
-
- <li><p> <i>Selectors</i> and <i>selection keys</i>, which together with <br>
- <i>selectable channels</i> define a <a
- href="channels/package-summary.html#multiplex">multiplexed, non-blocking <br>
- I/O</a> facility. </p></li>
-
-</ul>
-
-<p> The <tt>java.nio</tt> package defines the buffer classes, which are used
-throughout the NIO APIs. The charset API is defined in the {@link
-java.nio.charset} package, and the channel and selector APIs are defined in the
-{@link java.nio.channels} package. Each of these subpackages has its own
-service-provider (SPI) subpackage, the contents of which can be used to extend
-the platform's default implementations or to construct alternative
-implementations.
-
-
-<a name="buffers"> </a>
-
-<blockquote><table cellspacing=1 cellpadding=0 summary="Description of the various buffers">
- <tr><th><p align="left">Buffers</p></th><th><p align="left">Description</p></th></tr>
- <tr><td valign=top><tt>{@link java.nio.Buffer}</tt></td>
- <td>Position, limit, and capacity;
- <br>clear, flip, rewind, and mark/reset</td></tr>
- <tr><td valign=top><tt> {@link java.nio.ByteBuffer}</tt></td>
- <td>Get/put, compact, views; allocate, wrap</td></tr>
- <tr><td valign=top><tt> {@link java.nio.MappedByteBuffer} </tt></td>
- <td>A byte buffer mapped to a file</td></tr>
- <tr><td valign=top><tt> {@link java.nio.CharBuffer}</tt></td>
- <td>Get/put, compact; allocate, wrap</td></tr>
- <tr><td valign=top><tt> {@link java.nio.DoubleBuffer}</tt></td>
- <td> ' '</td></tr>
- <tr><td valign=top><tt> {@link java.nio.FloatBuffer}</tt></td>
- <td> ' '</td></tr>
- <tr><td valign=top><tt> {@link java.nio.IntBuffer}</tt></td>
- <td> ' '</td></tr>
- <tr><td valign=top><tt> {@link java.nio.LongBuffer}</tt></td>
- <td> ' '</td></tr>
- <tr><td valign=top><tt> {@link java.nio.ShortBuffer}</tt></td>
- <td> ' '</td></tr>
- <tr><td valign=top><tt>{@link java.nio.ByteOrder}</tt></td>
- <td>Typesafe enumeration for byte orders</td></tr>
-</table></blockquote>
-
-<p> A <i>buffer</i> is a container for a fixed amount of data of a specific
-primitive type. In addition to its content a buffer has a <i>position</i>,
-which is the index of the next element to be read or written, and a
-<i>limit</i>, which is the index of the first element that should not be read
-or written. The base {@link java.nio.Buffer} class defines these properties as
-well as methods for <i>clearing</i>, <i>flipping</i>, and <i>rewinding</i>, for
-<i>marking</i> the current position, and for <i>resetting</i> the position to
-the previous mark.
-
-<p> There is a buffer class for each non-boolean primitive type. Each class
-defines a family of <i>get</i> and <i>put</i> methods for moving data out of
-and in to a buffer, methods for <i>compacting</i>, <i>duplicating</i>, and
-<i>slicing</i> a buffer, and static methods for <i>allocating</i> a new buffer
-as well as for <i>wrapping</i> an existing array into a buffer.
-
-<p> Byte buffers are distinguished in that they can be used as the sources and
-targets of I/O operations. They also support several features not found in the
-other buffer classes:
-
-<ul>
-
- <li><p> A byte buffer can be allocated as a <a href="ByteBuffer.html#direct">
- <i>direct</i></a> buffer, in which case the Java virtual machine will make a
- best effort to perform native I/O operations directly upon it. </p></li>
-
- <li><p> A byte buffer can be created by {@link
- java.nio.channels.FileChannel#map <i>mapping</i>} a region of a
- file directly into memory, in which case a few additional file-related
- operations defined in the {@link java.nio.MappedByteBuffer} class are
- available. </p></li>
-
- <li><p> A byte buffer provides access to its content as either a heterogeneous
- or homogeneous sequence of <a href="ByteBuffer.html#bin"><i>binary data</i></a>
- of any non-boolean primitive type, in either big-endian or little-endian <a
- href="ByteOrder.html">byte order</a>. </p></li>
-
-</ul>
-
-<p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
-or method in any class or interface in this package will cause a {@link
-java.lang.NullPointerException NullPointerException} to be thrown.
-
-@since 1.4
-@author Mark Reinhold
-@author JSR-51 Expert Group
-
-</body>
-</html>
--- a/jdk/src/java.base/share/classes/java/text/AttributedString.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/text/AttributedString.java Mon Jun 01 10:15:20 2015 -0700
@@ -332,7 +332,7 @@
* @param beginIndex Index of the first character of the range.
* @param endIndex Index of the character following the last character of the range.
* @exception NullPointerException if <code>attribute</code> is null.
- * @exception IllegalArgumentException if beginIndex is less then 0, endIndex is
+ * @exception IllegalArgumentException if beginIndex is less than 0, endIndex is
* greater than the length of the string, or beginIndex and endIndex together don't
* define a non-empty subrange of the string.
*/
@@ -357,7 +357,7 @@
* @param endIndex Index of the character following the last
* character of the range.
* @exception NullPointerException if <code>attributes</code> is null.
- * @exception IllegalArgumentException if beginIndex is less then
+ * @exception IllegalArgumentException if beginIndex is less than
* 0, endIndex is greater than the length of the string, or
* beginIndex and endIndex together don't define a non-empty
* subrange of the string and the attributes parameter is not an
@@ -580,7 +580,7 @@
* @param beginIndex the index of the first character
* @param endIndex the index of the character following the last character
* @return an iterator providing access to the text and its attributes
- * @exception IllegalArgumentException if beginIndex is less then 0,
+ * @exception IllegalArgumentException if beginIndex is less than 0,
* endIndex is greater than the length of the string, or beginIndex is
* greater than endIndex.
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/text/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+
+/**
+ * Provides classes and interfaces for handling text, dates, numbers,
+ * and messages in a manner independent of natural languages. This
+ * means your main application or applet can be written to be
+ * language-independent, and it can rely upon separate,
+ * dynamically-linked localized resources. This allows the flexibility
+ * of adding localizations for new localizations at any time.
+ *
+ * <p>These classes are capable of formatting dates, numbers, and
+ * messages, parsing; searching and sorting strings; and iterating
+ * over characters, words, sentences, and line breaks. This package
+ * contains three main groups of classes and interfaces:
+ *
+ * <ul>
+ * <li>Classes for iteration over text
+ * <li>Classes for formatting and parsing
+ * <li>Classes for string collation
+ * </ul>
+ *
+ * @since 1.1
+ */
+package java.text;
--- a/jdk/src/java.base/share/classes/java/text/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1998, 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.
--->
-
-</head>
-<body bgcolor="white">
-
-Provides classes and interfaces for handling text, dates, numbers, and messages
-in a manner independent of natural languages. This means your main application
-or applet can be written to be language-independent, and it can rely upon
-separate, dynamically-linked localized resources. This allows the flexibility
-of adding localizations for new localizations at any time.
-<p>
-These classes are capable of formatting dates, numbers, and messages, parsing;
-searching and sorting strings; and iterating over characters, words, sentences,
-and line breaks. This package contains three main groups of classes and
-interfaces:
-<ul>
-<li>Classes for iteration over text
-<li>Classes for formatting and parsing
-<li>Classes for string collation
-</ul>
-<!--
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
- <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
--->
-
-@since 1.1
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/text/spi/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2005, 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.
+ */
+
+/**
+ * Service provider classes for the classes in the java.text package.
+ *
+ * @since 1.6
+ */
+package java.text.spi;
--- a/jdk/src/java.base/share/classes/java/text/spi/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body bgcolor="white">
-Service provider classes for the classes in the java.text package.
-<!--
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
- <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
--->
-
-@since 1.6
-</body>
-</html>
--- a/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java Mon Jun 01 10:15:20 2015 -0700
@@ -490,6 +490,16 @@
return yearOfEra;
}
+ /**
+ * Creates the HijrahEra object from the numeric value.
+ * The Hijrah calendar system has only one era covering the
+ * proleptic years greater than zero.
+ * This method returns the singleton HijrahEra for the value 1.
+ *
+ * @param eraValue the era value
+ * @return the calendar system era, not null
+ * @throws DateTimeException if unable to create the era
+ */
@Override
public HijrahEra eraOf(int eraValue) {
switch (eraValue) {
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatter.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -1333,8 +1333,8 @@
* If the time '23:59:60' is received, then a simple conversion is applied,
* replacing the second-of-minute of 60 with 59. This query can be used
* on the parse result to determine if the leap-second adjustment was made.
- * The query will return one second of excess if it did adjust to remove
- * the leap-second, and zero if not. Note that applying a leap-second
+ * The query will return {@code true} if it did adjust to remove the
+ * leap-second, and {@code false} if not. Note that applying a leap-second
* smoothing mechanism, such as UTC-SLS, is the responsibility of the
* application, as follows:
* <pre>
--- a/jdk/src/java.base/share/classes/java/time/package-info.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/time/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -120,9 +120,10 @@
*
* <h3>Duration and Period</h3>
* <p>
- * Beyond dates and times, the API also allows the storage of period and durations of time.
+ * Beyond dates and times, the API also allows the storage of periods and durations of time.
* A {@link java.time.Duration} is a simple measure of time along the time-line in nanoseconds.
- * A {@link java.time.Period} expresses an amount of time in units meaningful to humans, such as years or hours.
+ * A {@link java.time.Period} expresses an amount of time in units meaningful
+ * to humans, such as years or days.
* </p>
*
* <h3>Additional value types</h3>
--- a/jdk/src/java.base/share/classes/java/util/Properties.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Properties.java Mon Jun 01 10:15:20 2015 -0700
@@ -73,8 +73,7 @@
* Unicode escapes as defined in section 3.3 of
* <cite>The Java™ Language Specification</cite>;
* only a single 'u' character is allowed in an escape
- * sequence. The native2ascii tool can be used to convert property files to and
- * from other character encodings.
+ * sequence.
*
* <p> The {@link #loadFromXML(InputStream)} and {@link
* #storeToXML(OutputStream, String, String)} methods load and store properties
@@ -108,9 +107,6 @@
* <p>This class is thread-safe: multiple threads can share a single
* <tt>Properties</tt> object without the need for external synchronization.
*
- * @see <a href="../../../technotes/tools/solaris/native2ascii.html">native2ascii tool for Solaris</a>
- * @see <a href="../../../technotes/tools/windows/native2ascii.html">native2ascii tool for Windows</a>
- *
* @author Arthur van Hoff
* @author Michael McCloskey
* @author Xueming Shen
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Mon Jun 01 10:15:20 2015 -0700
@@ -268,13 +268,25 @@
}
/**
- * Returns an enumeration of the zip file entries.
+ * Returns an enumeration of the jar file entries.
+ *
+ * @return an enumeration of the jar file entries
+ * @throws IllegalStateException
+ * may be thrown if the jar file has been closed
*/
public Enumeration<JarEntry> entries() {
return new JarEntryIterator();
}
- @Override
+ /**
+ * Returns an ordered {@code Stream} over the jar file entries.
+ * Entries appear in the {@code Stream} in the order they appear in
+ * the central directory of the jar file.
+ *
+ * @return an ordered {@code Stream} of entries in this jar file
+ * @throws IllegalStateException if the jar file has been closed
+ * @since 1.8
+ */
public Stream<JarEntry> stream() {
return StreamSupport.stream(Spliterators.spliterator(
new JarEntryIterator(), size(),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/jar/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1998, 2006, 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.
+ */
+
+/**
+ * Provides classes for reading and writing the JAR (Java ARchive)
+ * file format, which is based on the standard ZIP file format with an
+ * optional manifest file. The manifest stores meta-information about
+ * the JAR file contents and is also used for signing JAR files.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * The <code>java.util.jar</code> package is based on the following
+ * specifications:
+ *
+ * <ul>
+ * <li><b>Info-ZIP file format</b> - The JAR format is based on the Info-ZIP
+ * file format. See
+ * <a href="../zip/package-summary.html#package_description">java.util.zip
+ * package description.</a> <p>
+ * In JAR files, all file names must be encoded in the UTF-8 encoding.
+ * <li><a href="../../../../technotes/guides/jar/jar.html">
+ * Manifest and Signature Specification</a> - The manifest format specification.
+ * </ul>
+ *
+ * @since 1.2
+ */
+package java.util.jar;
--- a/jdk/src/java.base/share/classes/java/util/jar/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1998, 2006, 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.
--->
-
-</head>
-<body bgcolor="white">
-
-Provides classes for reading and writing the JAR (Java ARchive) file
-format, which is based on the standard ZIP file format with an
-optional manifest file. The manifest stores meta-information about the
-JAR file contents and is also used for signing JAR files.
-
-
-<h2>Package Specification</h2>
-
-The <code>java.util.jar</code> package is based on the following specifications:
-<ul>
- <li><b>Info-ZIP file format</b> - The JAR format is based on the Info-ZIP
- file format. See
- <a href="../zip/package-summary.html#package_description">java.util.zip
- package description.</a> <p>
- In JAR files, all file names must be encoded in the UTF-8 encoding.
- <li><a href="../../../../technotes/guides/jar/jar.html">
- Manifest and Signature Specification</a> - The manifest format specification.
-</ul>
-
-<!--
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
--->
-
-@since 1.2
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1998, 2006, 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.
+ */
+
+/**
+ * Contains the collections framework, legacy collection classes,
+ * event model, date and time facilities, internationalization, and
+ * miscellaneous utility classes (a string tokenizer, a random-number
+ * generator, and a bit array).
+ *
+ * <h2>Package Specification</h2>
+ * <ul>
+ * <li><a href="../../../technotes/guides/collections/overview.html"><b>Collections Framework Overview</b></a>
+ * <li><a href="../../../technotes/guides/collections/reference.html"><b>
+ * Collections Framework Annotated Outline</b></a>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ * For overviews, tutorials, examples, guides, and tool documentation,
+ * please see:
+ * <ul>
+ * <li><a href="http://docs.oracle.com/javase/tutorial/collections/index.html">
+ * <b>Collections Framework Tutorial</b></a>
+ * <li><a
+ * href="../../../technotes/guides/collections/designfaq.html"><b>Collections
+ * Framework Design FAQ</b></a>
+ * </ul>
+ *
+ * @since 1.0
+ */
+package java.util;
--- a/jdk/src/java.base/share/classes/java/util/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1998, 2006, 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.
--->
-
-</head>
-<body bgcolor="white">
-
-Contains the collections framework, legacy collection classes, event model,
-date and time facilities, internationalization, and miscellaneous utility
-classes (a string tokenizer, a random-number generator, and a bit array).
-
-<h2>Package Specification</h2>
-<ul>
- <li><a href="../../../technotes/guides/collections/overview.html"><b>Collections Framework Overview</b></a>
- <li><a href="../../../technotes/guides/collections/reference.html"><b>
- Collections Framework Annotated Outline</b></a>
-</ul>
-
-<h2>Related Documentation</h2>
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="http://docs.oracle.com/javase/tutorial/collections/index.html">
- <b>Collections Framework Tutorial</b></a>
- <li><a
- href="../../../technotes/guides/collections/designfaq.html"><b>Collections
- Framework Design FAQ</b></a>
-</ul>
-
-@since 1.0
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/regex/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2000, 2006, 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.
+ */
+
+/**
+ * Classes for matching character sequences against patterns specified
+ * by regular expressions.
+ *
+ * <p> An instance of the {@link java.util.regex.Pattern} class
+ * represents a regular expression that is specified in string form in
+ * a syntax similar to that used by Perl.
+ *
+ * <p> Instances of the {@link java.util.regex.Matcher} class are used
+ * to match character sequences against a given pattern. Input is
+ * provided to matchers via the {@link java.lang.CharSequence}
+ * interface in order to support matching against characters from a
+ * wide variety of input sources. </p>
+ *
+ * <p> Unless otherwise noted, passing a <tt>null</tt> argument to a
+ * method in any class or interface in this package will cause a
+ * {@link java.lang.NullPointerException NullPointerException} to be
+ * thrown.
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * <p> An excellent tutorial and overview of regular expressions is <a
+ * href="http://www.oreilly.com/catalog/regex/"><i>Mastering Regular
+ * Expressions</i>, Jeffrey E. F. Friedl, O'Reilly and Associates,
+ * 1997.</a> </p>
+ *
+ * @since 1.4
+ * @author Mike McCloskey
+ * @author Mark Reinhold
+ */
+package java.util.regex;
--- a/jdk/src/java.base/share/classes/java/util/regex/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 2000, 2006, 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.
--->
-
-</head>
-<body bgcolor="white">
-
-Classes for matching character sequences against patterns specified by regular
-expressions.
-
-<p> An instance of the {@link java.util.regex.Pattern} class represents a
-regular expression that is specified in string form in a syntax similar to
-that used by Perl.
-
-<p> Instances of the {@link java.util.regex.Matcher} class are used to match
-character sequences against a given pattern. Input is provided to matchers via
-the {@link java.lang.CharSequence} interface in order to support matching
-against characters from a wide variety of input sources. </p>
-
-<p> Unless otherwise noted, passing a <tt>null</tt> argument to a method
-in any class or interface in this package will cause a
-{@link java.lang.NullPointerException NullPointerException} to be thrown.
-
-<h2>Related Documentation</h2>
-
-<p> An excellent tutorial and overview of regular expressions is <a
-href="http://www.oreilly.com/catalog/regex/"><i>Mastering Regular
-Expressions</i>, Jeffrey E. F. Friedl, O'Reilly and Associates, 1997.</a> </p>
-
-<!--
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
--->
-
-@since 1.4
-@author Mike McCloskey
-@author Mark Reinhold
-
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/util/spi/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2005, 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.
+ */
+
+/**
+ * Service provider classes for the classes in the java.util package.
+ *
+ * @since 1.6
+ */
+package java.util.spi;
--- a/jdk/src/java.base/share/classes/java/util/spi/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body bgcolor="white">
-Service provider classes for the classes in the java.util package.
-<!--
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
- <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
--->
-
-@since 1.6
-</body>
-</html>
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java Mon Jun 01 10:15:20 2015 -0700
@@ -538,7 +538,7 @@
}
/**
- * Return an ordered {@code Stream} over the ZIP file entries.
+ * Returns an ordered {@code Stream} over the ZIP file entries.
* Entries appear in the {@code Stream} in the order they appear in
* the central directory of the ZIP file.
*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/javax/crypto/interfaces/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1999, 2007, 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.
+ */
+
+/**
+ * Provides interfaces for Diffie-Hellman keys as defined in RSA
+ * Laboratories' PKCS #3.
+ *
+ * <P>Note that these interfaces are intended only for key
+ * implementations whose key material is accessible and
+ * available. These interfaces are not intended for key implementations
+ * whose key material resides in inaccessible, protected storage (such
+ * as in a hardware device).
+ *
+ * <P>For more developer information on how to use these interfaces,
+ * including information on how to design <code>Key</code> classes for
+ * hardware devices, please refer to the cryptographic provider
+ * developer guide:
+ *
+ * <ul>
+ * <li><a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
+ * <b>How to Implement a Provider for the Java™ Cryptography Architecture
+ * </b></a></li>
+ * </ul>
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>PKCS #3: Diffie-Hellman Key-Agreement Standard, Version 1.4,
+ * November 1993.</li>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For further documentation, please see:
+ * <ul>
+ * <li>
+ * <a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
+ * <b>Java™ Cryptography Architecture API Specification and Reference
+ * </b></a></li>
+ * </ul>
+ *
+ * @since 1.4
+ */
+package javax.crypto.interfaces;
--- a/jdk/src/java.base/share/classes/javax/crypto/interfaces/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-<!--
-Copyright (c) 1999, 2007, 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.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-
-<body bgcolor="white">
-
-Provides interfaces for Diffie-Hellman keys as defined in
-RSA Laboratories' PKCS #3.
-<P>
-Note that these interfaces are intended only
-for key implementations whose key material
-is accessible and available. These
-interfaces are not intended for key
-implementations whose key material resides
-in inaccessible, protected storage (such as
-in a hardware device).
-<P>
-For more developer information on how to use
-these interfaces, including information on
-how to design <code>Key</code> classes
-for hardware devices, please refer to the
-cryptographic provider developer guide:
-<ul>
- <li><a href=
- "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- <b>How to Implement a Provider for the Java™ Cryptography Architecture
- </b></a></li>
-</ul>
-
-<h2>Package Specification</h2>
-
-<ul>
- <li>PKCS #3: Diffie-Hellman Key-Agreement Standard, Version 1.4,
- November 1993.</li>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For further documentation, please see:
-<ul>
- <li>
- <a href=
- "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- <b>Java™ Cryptography Architecture API Specification and Reference
- </b></a></li>
-</ul>
-
-@since 1.4
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/javax/crypto/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1999, 2011, 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.
+ */
+
+/**
+ * Provides the classes and interfaces for cryptographic
+ * operations. The cryptographic operations defined in this package
+ * include encryption, key generation and key agreement, and Message
+ * Authentication Code (MAC) generation.
+ *
+ * <p>Support for encryption includes symmetric, asymmetric, block,
+ * and stream ciphers. This package also supports secure streams and
+ * sealed objects.
+ *
+ * <p>Many of the classes provided in this package are provider-based.
+ * The class itself defines a programming interface to which
+ * applications may write. The implementations themselves may then be
+ * written by independent third-party vendors and plugged in
+ * seamlessly as needed. Therefore application developers may take
+ * advantage of any number of provider-based implementations without
+ * having to add or rewrite code.
+ *
+ * <ul>
+ * <li><a href="{@docRoot}/../technotes/guides/security/StandardNames.html">
+ * <b>Java™ Cryptography Architecture Standard Algorithm Name
+ * Documentation</b></a></li>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For further documentation, please see:
+ * <ul>
+ * <li>
+ * <a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
+ * <b>Java™ Cryptography Architecture (JCA) Reference Guide
+ * </b></a></li>
+ * <li>
+ * <a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
+ * <b>How to Implement a Provider in the Java™ Cryptography
+ * Architecture </b></a></li>
+ * </ul>
+ *
+ * @since 1.4
+ */
+package javax.crypto;
--- a/jdk/src/java.base/share/classes/javax/crypto/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-<!--
-Copyright (c) 1999, 2015, 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.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-
-<body bgcolor="white">
-
-Provides the classes and interfaces for cryptographic operations. The
-cryptographic operations defined in this package include encryption,
-key generation and key agreement, and Message Authentication Code
-(MAC) generation.
-
-<p>Support for encryption includes symmetric, asymmetric, block, and
-stream ciphers. This package also supports secure streams and sealed
-objects.
-
-<p>Many of the classes provided in this package are provider-based. The
-class itself defines a programming interface to which applications may
-write. The implementations themselves may then be written by
-independent third-party vendors and plugged in seamlessly as needed.
-Therefore application developers may take advantage of any number of
-provider-based implementations without having to add or rewrite code.
-
-<h2>Package Specification</h2>
-
-<ul>
- <li><a href="{@docRoot}/../technotes/guides/security/StandardNames.html">
- <b>Java™
- Cryptography Architecture Standard Algorithm Name
- Documentation</b></a></li>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For further documentation, please see:
-<ul>
- <li>
- <a href=
- "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- <b>Java™
- Cryptography Architecture (JCA) Reference Guide
- </b></a></li>
- <li>
- <a href=
- "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- <b>How to Implement a Provider in the
- Java™ Cryptography Architecture
- </b></a></li>
-</ul>
-
-@since 1.4
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/javax/crypto/spec/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1999, 2007, 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.
+ */
+
+/**
+ * Provides classes and interfaces for key specifications and
+ * algorithm parameter specifications.
+ *
+ * <p>A key specification is a transparent representation of the key
+ * material that constitutes a key. A key may be specified in an
+ * algorithm-specific way, or in an algorithm-independent encoding
+ * format (such as ASN.1). This package contains key specifications
+ * for Diffie-Hellman public and private keys, as well as key
+ * specifications for DES, Triple DES, and PBE secret keys.
+ *
+ * <p>An algorithm parameter specification is a transparent
+ * representation of the sets of parameters used with an
+ * algorithm. This package contains algorithm parameter specifications
+ * for parameters used with the Diffie-Hellman, DES, Triple DES, PBE,
+ * RC2 and RC5 algorithms.
+ *
+ *
+ * <ul>
+ * <li>PKCS #3: Diffie-Hellman Key-Agreement Standard, Version 1.4,
+ * November 1993.</li>
+ * <li>PKCS #5: Password-Based Encryption Standard, Version 1.5,
+ * November 1993.</li>
+ * <li>Federal Information Processing Standards Publication (FIPS PUB) 46-2:
+ * Data Encryption Standard (DES) </li>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For documentation that includes information about algorithm
+ * parameter and key specifications, please see:
+ *
+ * <ul>
+ * <li>
+ * <a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
+ * <b>Java™ Cryptography Architecture API Specification and Reference
+ * </b></a></li>
+ * <li>
+ * <a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
+ * <b>How to Implement a Provider for the
+ * Java™ Cryptography Architecture
+ * </b></a></li>
+ * </ul>
+ *
+ * @since 1.4
+ */
+package javax.crypto.spec;
--- a/jdk/src/java.base/share/classes/javax/crypto/spec/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-<!--
-Copyright (c) 1999, 2007, 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.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-
-<body bgcolor="white">
-
-Provides classes and interfaces for key specifications and algorithm
-parameter specifications.
-
-<p>A key specification is a transparent representation of the key
-material that constitutes a key. A key may be specified in an
-algorithm-specific way, or in an algorithm-independent encoding format
-(such as ASN.1). This package contains key specifications for
-Diffie-Hellman public and private keys, as well as key specifications for DES,
-Triple DES, and PBE secret keys.
-
-<p>An algorithm parameter specification is a transparent representation
-of the sets of parameters used with an algorithm. This package contains
-algorithm parameter specifications for parameters used with the
-Diffie-Hellman, DES, Triple DES, PBE, RC2 and RC5 algorithms.
-
-<h2>Package Specification</h2>
-
-<ul>
- <li>PKCS #3: Diffie-Hellman Key-Agreement Standard, Version 1.4,
- November 1993.</li>
- <li>PKCS #5: Password-Based Encryption Standard, Version 1.5,
- November 1993.</li>
- <li>Federal Information Processing Standards Publication (FIPS PUB) 46-2:
- Data Encryption Standard (DES) </li>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For documentation that includes information about algorithm parameter
-and key specifications, please see:
-<ul>
- <li>
- <a href=
- "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html">
- <b>Java™ Cryptography Architecture API Specification and Reference
- </b></a></li>
- <li>
- <a href=
- "{@docRoot}/../technotes/guides/security/crypto/HowToImplAProvider.html">
- <b>How to Implement a Provider for the
- Java™ Cryptography Architecture
- </b></a></li>
-</ul>
-
-@since 1.4
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/javax/net/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 1999, 2001, 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.
+ */
+
+/**
+ * Provides classes for networking applications. These classes include
+ * factories for creating sockets. Using socket factories you can
+ * encapsulate socket creation and configuration behavior.
+ *
+ * @since 1.4
+ */
+package javax.net;
--- a/jdk/src/java.base/share/classes/javax/net/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1999, 2001, 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.
--->
-
-</head>
-<body bgcolor="white">
-
-Provides classes for networking applications. These classes include
-factories for creating sockets. Using socket factories you can encapsulate
-socket creation and configuration behavior.
-<!--
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
- <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
-
--->
-
-@since 1.4
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1999, 2011, 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.
+ */
+
+/**
+ * Provides classes for the secure socket package. Using the secure
+ * socket classes, you can communicate using SSL or a related security
+ * protocol to reliably detect any errors introduced into the network
+ * byte stream and to optionally encrypt the data and/or authenticate
+ * the communicating peers.
+ *
+ * <ul>
+ * <li><a href="{@docRoot}/../technotes/guides/security/StandardNames.html">
+ * <b>Java™ Cryptography Architecture Standard Algorithm Name
+ * Documentation</b></a></li>
+ * </ul>
+ *
+ * @since 1.4
+ */
+package javax.net.ssl;
--- a/jdk/src/java.base/share/classes/javax/net/ssl/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1999, 2011, 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.
--->
-
-</head>
-<body bgcolor="white">
-
-Provides classes for the secure socket package. Using the secure socket
-classes, you can communicate using SSL or a related security protocol
-to reliably detect any errors introduced into the network byte stream
-and to optionally encrypt the data and/or authenticate the communicating peers.
-
-<h2>Package Specification</h2>
-
-<ul>
- <li><a href="{@docRoot}/../technotes/guides/security/StandardNames.html">
- <b>Java™ Cryptography Architecture Standard Algorithm Name
- Documentation</b></a></li>
-</ul>
-
-<!--
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
-
--->
-
-@since 1.4
-</body>
-</html>
--- a/jdk/src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java Mon Jun 01 10:15:20 2015 -0700
@@ -162,8 +162,8 @@
* Possible character type values are:<br> - 0 for underscore ('_') or any
* lower and upper case alphabetical character value;<br> - 1 for colon
* (':') character;<br> - 2 for dash ('-') and dot ('.') or any decimal
- * digit character value;<br> - 3 for any kind of white space character<br
- * /> An ASCII (7 bit) character which does not fall in any category listed
+ * digit character value;<br> - 3 for any kind of white space character<br>
+ * An ASCII (7 bit) character which does not fall in any category listed
* above is mapped to 0xff.
*/
private static final byte nmttyp[];
--- a/jdk/src/java.base/share/classes/sun/reflect/package.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<HTML>
-<HEAD>
-<!--
-
- Copyright (c) 2001, 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.
-
--->
-</HEAD>
-<BODY BGCOLOR="white">
-<P>
-
-<B> Licensee impact of JDK 1.4 reflection changes </B>
-
-</P>
-<P>
-
-Sun's JDK 1.4 contains a new implementation of java.lang.reflect which
-offers substantially higher performance than previous JDKs' native
-code. Licensees can at their discretion port these changes. There are
-no public API or documentation changes associated with the new
-reflection implementation aside from a few minor clarifications in the
-specifications of Method.invoke(), Constructor.newInstance(), and a
-few methods in java.lang.reflect.Field.
-
-</P>
-<P>
-
-The bulk of the new implementation is Java programming language code
-which generates bytecodes, and is therefore portable. If licensees
-desire to port it, the following JVM changes are required:
-
-<OL>
-<LI> The following four new JVM entry points must be added:
-
- <UL>
- <LI> JVM_GetClassDeclaredConstructors
- <LI> JVM_GetClassDeclaredFields
- <LI> JVM_GetClassDeclaredMethods
- <LI> JVM_GetClassAccessFlags
- </UL>
-
-The first three return the declared constructors, fields, and methods
-for a given class, with an option to return only the public ones. They
-are similar in functionality to the earlier GetClassConstructors,
-GetClassFields, and GetClassMethods. JVM_GetClassDeclaredFields and
-JVM_GetClassDeclaredMethods must intern the Strings for the names of
-the Field and Method objects returned. The fouth returns the access
-flags for a given class as marked in the class file, as opposed to in
-the InnerClasses attribute if the class is an inner class, and
-therefore differs from JVM_GetClassModifiers for inner classes (most
-importantly, protected inner classes; see 4471811.)
-
-<LI> The JVM's link resolver must be modified to allow all field and
-method references from subclasses of sun.reflect.MagicAccessorImpl to
-any other class (even to private members of other classes) to
-succeed. This allows setAccessible() and its associated checks to be
-implemented in Java.
-
-<LI> The code which calls the verifier must skip verification for all
-subclasses of sun.reflect.MagicAccessorImpl. (It was originally
-intended that only a subset of the stub classes used for serialization
-would not pass the verifier, specifically, those subclassing
-SerializationConstructorAccessorImpl; see 4486457 for a case where
-this does not work.)
-
-<LI> The stack walker for security checks must be modified to skip not
-only all Method.invoke() frames, but also any frames for which the
-class is a subclass of sun.reflect.MethodAccessorImpl.
-
-<LI> The JVM entry points JVM_InvokeMethod and
-JVM_NewInstanceFromConstructor are currently still used because the
-first invocation of the bytecode-based reflection is currently slower
-than the original native code. The security checks they perform can,
-however, be disabled, as they are now performed by Java programming
-language code.
-
-</OL>
-
-</P>
-<P>
-
-The following changes were discovered to be necessary for backward
-compatibility with certain applications (see bug 4474172):
-
-<OL>
-
-<LI> The existing JVM entry point JVM_LatestUserDefinedLoader
-(typically used in applications which rely on the 1.1 security
-framework) must skip reflection-related frames in its stack walk:
-specifically all frames associated with subclasses of
-sun.reflect.MethodAccessorImpl and
-sun.reflect.ConstructorAccessorImpl.
-
-<LI> The new reflection implementation can cause class loading to
-occur in previously-unexpected places (namely during reflective
-calls). This can cause class loaders which contain subtle bugs to
-break. In general it is not possible to guarantee complete backward
-bug compatibility, but one kind of bug has been observed more than
-once: the inability of a user-defined loader to handle delegation to
-it for a class it has already loaded. The new reflection
-implementation is predicated on delegation working properly, as it
-loads stub classes into newly-fabricated class loaders of type
-sun.reflect.DelegatingClassLoader, one stub class per loader, to allow
-unloading of the stub classes to occur more quickly. To handle this
-kind of bug, the JVM's internal class lookup mechanism must be
-slightly modified to check for instances of
-sun.reflect.DelegatingClassLoader as the incoming class loader and
-silently traverse the "parent" field once for such loaders before
-entering the bulk of the resolution code. This avoids an upcall to
-Java programming language code which certain loaders can not handle.
-
-</OL>
-
-</P>
-<P>
-
-The following JVM entry points may be deleted:
-
-<UL>
-<LI> JVM_GetClassFields
-<LI> JVM_GetClassMethods
-<LI> JVM_GetClassConstructors
-<LI> JVM_GetClassField
-<LI> JVM_GetClassMethod
-<LI> JVM_GetClassConstructor
-<LI> JVM_NewInstance
-<LI> JVM_GetField
-<LI> JVM_GetPrimitiveField
-<LI> JVM_SetField
-<LI> JVM_SetPrimitiveField
-</UL>
-
-</P>
-<P>
-
-To keep using the previous reflection implementation, licensees should
-not take changes from Sun's JDK 1.4 relating specifically to the
-implementation of reflection in the following classes/methods and
-any associated native code:
-
-<UL>
-<LI> java.lang.Class.newInstance0
-<LI> java.lang.Class.getClassLoader0
-<LI> java.lang.Class.getFields
-<LI> java.lang.Class.getMethods
-<LI> java.lang.Class.getDeclaredFields
-<LI> java.lang.Class.getDeclaredMethods
-<LI> java.lang.Class.getFields0
-<LI> java.lang.Class.getMethods0
-<LI> java.lang.Class.getConstructors0
-<LI> java.lang.Class.getField0
-<LI> java.lang.Class.getMethod0
-<LI> java.lang.Class.getConstructor0
-<LI> java.lang.ClassLoader.getCallerClassLoader
-<LI> java.lang.System.getCallerClass
-<LI> java.lang.reflect.AccessibleObject
-<LI> java.lang.reflect.Constructor
-<LI> java.lang.reflect.Field
-<LI> java.lang.reflect.Method
-<LI> java.lang.reflect.Modifier
-<LI> sun.misc.ClassReflector
-</UL>
-
-</P>
-</HTML>
--- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -278,7 +278,6 @@
private boolean constructed = false;
private boolean expandProperties = true;
- private boolean ignoreIdentityScope = true;
private boolean allowSystemProperties = true;
private boolean notUtf8 = false;
private URL url;
@@ -415,8 +414,6 @@
public String run() {
expandProperties = "true".equalsIgnoreCase
(Security.getProperty("policy.expandProperties"));
- ignoreIdentityScope = "true".equalsIgnoreCase
- (Security.getProperty("policy.ignoreIdentityScope"));
allowSystemProperties = "true".equalsIgnoreCase
(Security.getProperty("policy.allowSystemProperty"));
notUtf8 = "false".equalsIgnoreCase
@@ -1206,31 +1203,6 @@
addPermissions(perms, cs, principals, entry);
}
- // Go through policyEntries gotten from identity db; sync required
- // because checkForTrustedIdentity (below) might update list
- synchronized (pi.identityPolicyEntries) {
- for (PolicyEntry entry : pi.identityPolicyEntries) {
- addPermissions(perms, cs, principals, entry);
- }
- }
-
- // now see if any of the keys are trusted ids.
- if (!ignoreIdentityScope) {
- Certificate certs[] = cs.getCertificates();
- if (certs != null) {
- for (int k=0; k < certs.length; k++) {
- Object idMap = pi.aliasMapping.get(certs[k]);
- if (idMap == null &&
- checkForTrustedIdentity(certs[k], pi)) {
- // checkForTrustedIdentity added it
- // to the policy for us. next time
- // around we'll find it. This time
- // around we need to add it.
- perms.add(SecurityConstants.ALL_PERMISSION);
- }
- }
- }
- }
return perms;
}
@@ -1620,7 +1592,7 @@
* associated with the given code source.
*
* The signer certificates are those certificates that were used
- * to verifysigned code originating from the codesource location.
+ * to verify signed code originating from the codesource location.
*
* This method assumes that in the given code source, each signer
* certificate is followed by its supporting certificate chain
@@ -1917,17 +1889,6 @@
}
/**
- * Checks public key. If it is marked as trusted in
- * the identity database, add it to the policy
- * with the AllPermission.
- */
- private boolean checkForTrustedIdentity(final Certificate cert,
- PolicyInfo myInfo)
- {
- return false;
- }
-
- /**
* Each entry in the policy configuration file is represented by a
* PolicyEntry object. <p>
*
@@ -2282,10 +2243,6 @@
// Stores grant entries in the policy
final List<PolicyEntry> policyEntries;
- // Stores grant entries gotten from identity database
- // Use separate lists to avoid sync on policyEntries
- final List<PolicyEntry> identityPolicyEntries;
-
// Maps aliases to certs
final Map<Object, Object> aliasMapping;
@@ -2295,8 +2252,6 @@
PolicyInfo(int numCaches) {
policyEntries = new ArrayList<>();
- identityPolicyEntries =
- Collections.synchronizedList(new ArrayList<PolicyEntry>(2));
aliasMapping = Collections.synchronizedMap(new HashMap<>(11));
pdMapping = new ProtectionDomainCache[numCaches];
--- a/jdk/src/java.base/share/conf/security/java.security Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/conf/security/java.security Mon Jun 01 10:15:20 2015 -0700
@@ -179,7 +179,8 @@
# whether or not we look into the IdentityScope for trusted Identities
# when encountering a 1.1 signed JAR file. If the identity is found
-# and is trusted, we grant it AllPermission.
+# and is trusted, we grant it AllPermission. Note: the default policy
+# provider (sun.security.provider.PolicyFile) does not support this property.
policy.ignoreIdentityScope=false
#
--- a/jdk/src/java.base/share/native/launcher/defines.h Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/native/launcher/defines.h Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, 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
@@ -46,6 +46,7 @@
#ifdef JAVA_ARGS
+#define HAS_JAVA_ARGS JNI_TRUE
static const char* const_progname = "java";
static const char* const_jargs[] = JAVA_ARGS;
/*
@@ -58,6 +59,7 @@
#endif /* APP_CLASSPATH */
static const char* const_appclasspath[] = APP_CLASSPATH;
#else /* !JAVA_ARGS */
+#define HAS_JAVA_ARGS JNI_FALSE
#ifdef PROGNAME
static const char* const_progname = PROGNAME;
#else
--- a/jdk/src/java.base/share/native/launcher/main.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/native/launcher/main.c Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, 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
@@ -129,6 +129,6 @@
DOT_VERSION,
(const_progname != NULL) ? const_progname : *margv,
(const_launcher != NULL) ? const_launcher : *margv,
- (const_jargs != NULL) ? JNI_TRUE : JNI_FALSE,
+ HAS_JAVA_ARGS,
const_cpwildcard, const_javaw, const_ergo_class);
}
--- a/jdk/src/java.base/share/native/libjava/FileInputStream.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/native/libjava/FileInputStream.c Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -23,6 +23,9 @@
* questions.
*/
+#include <fcntl.h>
+#include <limits.h>
+
#include "jni.h"
#include "jni_util.h"
#include "jlong.h"
@@ -32,9 +35,6 @@
#include "java_io_FileInputStream.h"
-#include <fcntl.h>
-#include <limits.h>
-
#include "io_util_md.h"
/*******************************************************************/
--- a/jdk/src/java.base/share/native/libjava/System.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/native/libjava/System.c Mon Jun 01 10:15:20 2015 -0700
@@ -111,7 +111,7 @@
#ifndef VENDOR /* Third party may overwrite this. */
#define VENDOR "Oracle Corporation"
#define VENDOR_URL "http://java.oracle.com/"
-#define VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/"
+#define VENDOR_URL_BUG "http://bugreport.java.com/bugreport/"
#endif
#define JAVA_MAX_SUPPORTED_VERSION 52
--- a/jdk/src/java.base/share/native/libjava/jdk_util.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/native/libjava/jdk_util.c Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, 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
@@ -58,9 +58,9 @@
/* If the JDK_BUILD_NUMBER is of format bXX and XX is an integer
* XX is the jdk_build_number.
*/
- int len = strlen(jdk_build_string);
+ size_t len = strlen(jdk_build_string);
if (jdk_build_string[0] == 'b' && len >= 2) {
- int i = 0;
+ size_t i = 0;
for (i = 1; i < len; i++) {
if (isdigit(jdk_build_string[i])) {
build_number[i-1] = jdk_build_string[i];
@@ -76,7 +76,7 @@
}
}
- assert(jdk_build_number >= 0 && jdk_build_number <= 255);
+ assert(jdk_build_number <= 255);
if (strlen(jdk_update_string) == 2 || strlen(jdk_update_string) == 3) {
if (isdigit(jdk_update_string[0]) && isdigit(jdk_update_string[1])) {
--- a/jdk/src/java.base/share/native/libjava/jni_util.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/share/native/libjava/jni_util.c Mon Jun 01 10:15:20 2015 -0700
@@ -157,7 +157,7 @@
const char *defaultDetail)
{
char buf[256];
- int n = getLastErrorString(buf, sizeof(buf));
+ size_t n = getLastErrorString(buf, sizeof(buf));
if (n > 0) {
jstring s = JNU_NewStringPlatform(env, buf);
@@ -448,7 +448,7 @@
static jstring
newString646_US(JNIEnv *env, const char *str)
{
- int len = strlen(str);
+ int len = (int)strlen(str);
jchar buf[512];
jchar *str1;
jstring result;
--- a/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c Mon Jun 01 10:15:20 2015 -0700
@@ -286,12 +286,14 @@
(*env)->ReleaseByteArrayElements(env, arr, (jbyte*) parr, JNI_ABORT);
}
+#define IOE_FORMAT "error=%d, %s"
+
static void
throwIOException(JNIEnv *env, int errnum, const char *defaultDetail)
{
- static const char * const format = "error=%d, %s";
const char *detail = defaultDetail;
char *errmsg;
+ size_t fmtsize;
jstring s;
if (errnum != 0) {
@@ -300,11 +302,12 @@
detail = s;
}
/* ASCII Decimal representation uses 2.4 times as many bits as binary. */
- errmsg = NEW(char, strlen(format) + strlen(detail) + 3 * sizeof(errnum));
+ fmtsize = sizeof(IOE_FORMAT) + strlen(detail) + 3 * sizeof(errnum);
+ errmsg = NEW(char, fmtsize);
if (errmsg == NULL)
return;
- sprintf(errmsg, format, errnum, detail);
+ snprintf(errmsg, fmtsize, IOE_FORMAT, errnum, detail);
s = JNU_NewStringPlatform(env, errmsg);
if (s != NULL) {
jobject x = JNU_NewObjectByName(env, "java/io/IOException",
--- a/jdk/src/java.base/unix/native/libjava/TimeZone_md.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjava/TimeZone_md.c Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -735,10 +735,10 @@
local_tm = localtime(&clock);
if (local_tm->tm_gmtoff >= 0) {
offset = (time_t) local_tm->tm_gmtoff;
- sign = "+";
+ sign = '+';
} else {
offset = (time_t) -local_tm->tm_gmtoff;
- sign = "-";
+ sign = '-';
}
sprintf(buf, (const char *)"GMT%c%02d:%02d",
sign, (int)(offset/3600), (int)((offset%3600)/60));
--- a/jdk/src/java.base/windows/native/libjava/ConcurrentPReader_md.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/windows/native/libjava/ConcurrentPReader_md.c Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -47,7 +47,7 @@
DWORD nread;
BOOL result;
- jlong handle = (*env)->GetLongField(env, fdo, handle_fdID);
+ HANDLE handle = (HANDLE)(*env)->GetLongField(env, fdo, handle_fdID);
void *buf = (void *)jlong_to_ptr(address);
ZeroMemory(&ov, sizeof(ov));
--- a/jdk/src/java.base/windows/native/libjava/ProcessImpl_md.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/windows/native/libjava/ProcessImpl_md.c Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -90,7 +90,7 @@
CP_UTF8,
0,
utf16_javaMessage,
- n, /*by creation n <= MESSAGE_LENGTH*/
+ (int)n, /*by creation n <= MESSAGE_LENGTH*/
utf8_javaMessage,
MESSAGE_LENGTH*2,
NULL,
--- a/jdk/src/java.base/windows/native/libjava/java_props_md.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/windows/native/libjava/java_props_md.c Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -345,6 +345,8 @@
return TRUE;
}
+// GetVersionEx is deprecated; disable the warning until a replacement is found
+#pragma warning(disable : 4996)
java_props_t *
GetJavaProperties(JNIEnv* env)
{
@@ -680,5 +682,5 @@
jstring
GetStringPlatform(JNIEnv *env, nchar* wcstr)
{
- return (*env)->NewString(env, wcstr, wcslen(wcstr));
+ return (*env)->NewString(env, wcstr, (jsize)wcslen(wcstr));
}
--- a/jdk/src/java.base/windows/native/libjava/jni_util_md.c Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.base/windows/native/libjava/jni_util_md.c Mon Jun 01 10:15:20 2015 -0700
@@ -124,9 +124,9 @@
CP_UTF8,
0,
utf16_osErrorMsg,
- n,
+ (int)n,
utf8_jvmErrorMsg,
- cbErrorMsg,
+ (int)cbErrorMsg,
NULL,
NULL);
--- a/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java Mon Jun 01 10:15:20 2015 -0700
@@ -1040,7 +1040,7 @@
/**
* Allow access to the name parser object.
- * @param String JNDI name, is ignored since there is only one Name
+ * @param name JNDI name, is ignored since there is only one Name
* Parser object.
* @exception NamingException --
* @return NameParser object
@@ -1051,7 +1051,7 @@
/**
* Allow access to the name parser object.
- * @param Name JNDI name, is ignored since there is only one Name
+ * @param name JNDI name, is ignored since there is only one Name
* Parser object.
* @exception NamingException --
* @return NameParser object
@@ -1088,7 +1088,7 @@
* Record change but do not reinitialize ORB.
*
* @param propName The property name.
- * @param propVal The ORB.
+ * @param propValue The ORB.
* @return the previous value of this property if any.
*/
@SuppressWarnings("unchecked")
--- a/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CorbanameUrl.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CorbanameUrl.java Mon Jun 01 10:15:20 2015 -0700
@@ -35,32 +35,36 @@
* Extract components of a "corbaname" URL.
*
* The format of an corbaname URL is defined in INS 99-12-03 as follows.
- *<p>
+ * <pre>{@code
* corbaname url = "corbaname:" <corbaloc_obj> ["#" <string_name>]
* corbaloc_obj = <obj_addr_list> ["/" <key_string>]
* obj_addr_list = as defined in a corbaloc URL
* key_string = as defined in a corbaloc URL
* string_name = stringified COS name | empty_string
- *<p>
- * Characters in <string_name> are escaped as follows.
+ * }</pre>
+ * Characters in {@code <string_name>} are escaped as follows.
* US-ASCII alphanumeric characters are not escaped. Any characters outside
* of this range are escaped except for the following:
+ * <pre>{@code
* ; / : ? @ & = + $ , - _ . ! ~ * ; ( )
+ * }</pre>
* Escaped characters is escaped by using a % followed by its 2 hexadecimal
* numbers representing the octet.
- *<p>
+ * <p>
* The corbaname URL is parsed into two parts: a corbaloc URL and a COS name.
- * The corbaloc URL is constructed by concatenation "corbaloc:" with
- * <corbaloc_obj>.
- * The COS name is <string_name> with the escaped characters resolved.
- *<p>
+ * The corbaloc URL is constructed by concatenation {@code "corbaloc:"} with
+ * {@code <corbaloc_obj>}.
+ * The COS name is {@code <string_name>} with the escaped characters resolved.
+ * <p>
* A corbaname URL is resolved by:
- *<ol>
- *<li>Construct a corbaloc URL by concatenating "corbaloc:" and <corbaloc_obj>.
- *<li>Resolve the corbaloc URL to a NamingContext by using
+ * <ol>
+ * <li>Construct a corbaloc URL by concatenating {@code "corbaloc:"} and {@code <corbaloc_obj>}.
+ * <li>Resolve the corbaloc URL to a NamingContext by using
+ * <pre>{@code
* nctx = ORB.string_to_object(corbalocUrl);
- *<li>Resolve <string_name> in the NamingContext.
- *</ol>
+ * }</pre>
+ * <li>Resolve {@code <string_name>} in the NamingContext.
+ * </ol>
*
* @author Rosanna Lee
*/
--- a/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/IiopUrl.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/IiopUrl.java Mon Jun 01 10:15:20 2015 -0700
@@ -38,6 +38,7 @@
*
* The format of an iiopname URL is defined in INS 98-10-11 as follows:
*
+ * <pre>
* iiopname url = "iiopname://" [addr_list]["/" string_name]
* addr_list = [address ","]* address
* address = [version host [":" port]]
@@ -46,19 +47,23 @@
* port = number
* major = number
* minor = number
- * string_name = stringified name | empty_string
+ * string_name = stringified name | empty_string
+ * </pre>
*
* The default port is 9999. The default version is "1.0"
* US-ASCII alphanumeric characters are not escaped. Any characters outside
* of this range are escaped except for the following:
+ * <pre>{@code
* ; / : ? : @ & = + $ , - _ . ! ~ * ' ( )
+ * }</pre>
* Escaped characters is escaped by using a % followed by its 2 hexadecimal
* numbers representing the octet.
*
* For backward compatibility, the "iiop" URL as defined in INS 97-6-6
* is also supported:
- *
+ * <pre>{@code
* iiop url = "iiop://" [host [":" port]] ["/" string_name]
+ * }</pre>
* The default port is 900.
*
* @author Rosanna Lee
--- a/jdk/src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java Mon Jun 01 10:15:20 2015 -0700
@@ -56,7 +56,7 @@
* object by using the javax.rmi.CORBA package.
*<p>
* This method effective does the following:
- *<blockquote><pre>
+ * <blockquote><pre>
* java.lang.Object stub;
* try {
* stub = PortableRemoteObject.toStub(remoteObj);
@@ -72,6 +72,7 @@
* // ignore 'already connected' error
* }
* return (javax.rmi.CORBA.Stub)stub;
+ * </pre></blockquote>
*
* @param remoteObj The non-null remote object for
* @param orb The non-null ORB to connect the remote object to
--- a/jdk/src/java.management/share/classes/sun/management/Agent.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.management/share/classes/sun/management/Agent.java Mon Jun 01 10:15:20 2015 -0700
@@ -345,6 +345,7 @@
if (jmxServer != null) {
ConnectorBootstrap.unexportRegistry();
+ ConnectorAddressLink.unexportRemote();
// Attempt to stop already stopped agent
// Don't cause any errors.
--- a/jdk/src/java.management/share/classes/sun/management/ConnectorAddressLink.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.management/share/classes/sun/management/ConnectorAddressLink.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, 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
@@ -27,6 +27,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -45,9 +46,26 @@
* @since 1.5
*/
public class ConnectorAddressLink {
+ /**
+ * A simple wrapper for the perf-counter backing {@linkplain ByteBuffer}
+ */
+ private static final class PerfHandle {
+ private ByteBuffer bb;
+
+ private PerfHandle(ByteBuffer bb) {
+ this.bb = bb.order(ByteOrder.nativeOrder());
+ }
+
+ private void putLong(long l) {
+ this.bb = bb.clear();
+ this.bb.asLongBuffer().put(l);
+ }
+ }
private static final String CONNECTOR_ADDRESS_COUNTER =
"sun.management.JMXConnectorServer.address";
+ private static final String REMOTE_CONNECTOR_STATE_COUNTER =
+ "sun.management.JMXConnectorServer.remote.enabled";
/*
* The format of the jvmstat counters representing the properties of
@@ -78,7 +96,9 @@
* JMX remote connector counter (it will be incremented every
* time a new out-of-the-box JMX remote connector is created).
*/
- private static AtomicInteger counter = new AtomicInteger();
+ private static final AtomicInteger counter = new AtomicInteger();
+
+ private static PerfHandle remotePerfHandle = null;
/**
* Exports the specified connector address to the instrumentation buffer
@@ -93,7 +113,17 @@
}
Perf perf = Perf.getPerf();
perf.createString(
- CONNECTOR_ADDRESS_COUNTER, 1, Units.STRING.intValue(), address);
+ CONNECTOR_ADDRESS_COUNTER, 1, Units.STRING.intValue(), address);
+ }
+
+ public static void unexportRemote() {
+ unexport(remotePerfHandle);
+ }
+
+ private static void unexport(PerfHandle ph) {
+ if (ph != null) {
+ ph.putLong(-1L);
+ }
}
/**
@@ -143,6 +173,13 @@
perf.createString(REMOTE_CONNECTOR_COUNTER_PREFIX + index + "." +
entry.getKey(), 1, Units.STRING.intValue(), entry.getValue());
}
+ if (remotePerfHandle != null) {
+ remotePerfHandle.putLong(index);
+ } else {
+ remotePerfHandle = new PerfHandle(
+ perf.createLong(REMOTE_CONNECTOR_STATE_COUNTER, 1, Units.NONE.intValue(), (long)index)
+ );
+ }
}
/**
--- a/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferences.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferences.java Mon Jun 01 10:15:20 2015 -0700
@@ -1013,7 +1013,6 @@
* description of the encoding algorithm.
*/
private static String toJavaValueString(byte[] windowsNameArray) {
- // Use modified native2ascii algorithm
String windowsName = byteArrayToString(windowsNameArray);
StringBuilder javaName = new StringBuilder();
char ch;
@@ -1055,8 +1054,7 @@
* Encoding algorithm adds "/" character to capital letters, i.e.
* "A" is encoded as "/A". Character '\' is encoded as '//',
* '/' is encoded as '\'.
- * Then encoding scheme similar to jdk's native2ascii converter is used
- * to convert java string to a byte array of ASCII characters.
+ * Then convert java string to a byte array of ASCII characters.
*/
private static byte[] toWindowsValueString(String javaName) {
StringBuilder windowsName = new StringBuilder();
--- a/jdk/src/java.scripting/share/classes/javax/script/ScriptEngine.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.scripting/share/classes/javax/script/ScriptEngine.java Mon Jun 01 10:15:20 2015 -0700
@@ -132,7 +132,9 @@
*
* @return The value returned from the execution of the script.
*
- * @throws ScriptException if an error occurs in script.
+ * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw
+ * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting
+ * implementations.
* @throws NullPointerException if either argument is null.
*/
public Object eval(Reader reader , ScriptContext context) throws ScriptException;
@@ -145,7 +147,9 @@
*
* @return The value returned from the execution of the script.
*
- * @throws ScriptException if error occurs in script.
+ * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw
+ * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting
+ * implementations.
* @throws NullPointerException if the argument is null.
*/
public Object eval(String script) throws ScriptException;
@@ -158,7 +162,9 @@
*
* @return The value returned by the script.
*
- * @throws ScriptException if an error occurs in script.
+ * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw
+ * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting
+ * implementations.
* @throws NullPointerException if the argument is null.
*/
public Object eval(Reader reader) throws ScriptException;
@@ -177,7 +183,9 @@
*
* @return The value returned by the script.
*
- * @throws ScriptException if an error occurs in script.
+ * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw
+ * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting
+ * implementations.
* @throws NullPointerException if either argument is null.
*/
public Object eval(String script, Bindings n) throws ScriptException;
@@ -191,7 +199,9 @@
*
* @return The value returned by the script.
*
- * @throws ScriptException if an error occurs.
+ * @throws ScriptException if an error occurs in script. ScriptEngines should create and throw
+ * <code>ScriptException</code> wrappers for checked Exceptions thrown by underlying scripting
+ * implementations.
* @throws NullPointerException if either argument is null.
*/
public Object eval(Reader reader , Bindings n) throws ScriptException;
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5AcceptCredential.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5AcceptCredential.java Mon Jun 01 10:15:20 2015 -0700
@@ -85,7 +85,7 @@
if (creds == null)
throw new GSSException(GSSException.NO_CRED, -1,
- "Failed to find any Kerberos credentails");
+ "Failed to find any Kerberos credentials");
if (name == null) {
String fullName = creds.getName();
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java Mon Jun 01 10:15:20 2015 -0700
@@ -110,8 +110,10 @@
* java.security.krb5.kdc not specified, error reading configuration file.
*/
- public static synchronized void refresh() throws KrbException {
- singleton = new Config();
+ public static void refresh() throws KrbException {
+ synchronized (Config.class) {
+ singleton = new Config();
+ }
KdcComm.initStatic();
EType.initStatic();
Checksum.initStatic();
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java Mon Jun 01 10:15:20 2015 -0700
@@ -1059,7 +1059,7 @@
* (<code>acceptChanges</code>) or population. This method may also be called
* while performing updates to the insert row.
* <P>
- * <code>undoUpdate</code may be called at any time during the life-time of a
+ * {@code undoUpdate} may be called at any time during the life-time of a
* rowset, however after a synchronization has occurs this method has no
* affect until further modification to the RowSet data occurs.
*
@@ -2467,10 +2467,11 @@
* @throws SQLException if (1) the given column name is not the name of
* a column in this rowset, (2) the cursor is not on one of
* this rowset's rows or its insert row, or (3) the designated
- * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
- * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, <b>CHAR</b>,
- * <b>VARCHAR</b></code> or <code>LONGVARCHAR<</code> value. The bold SQL type
- * designates the recommended return type.
+ * column does not store an SQL {@code TINYINT, SMALLINT, INTEGER
+ * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, }
+ * <b>{@code CHAR, VARCHAR}</b> or
+ * <b>{@code LONGVARCHAR}</b> value.
+ * The bold SQL type designates the recommended return type.
*/
public String getString(String columnName) throws SQLException {
return getString(getColIdxByName(columnName));
@@ -7748,7 +7749,7 @@
* Updates the designated column with a <code>RowId</code> value. The updater
* methods are used to update column values in the current row or the insert
* row. The updater methods do not update the underlying database; instead
- * the <code>updateRow<code> or <code>insertRow</code> methods are called
+ * the {@code updateRow} or {@code insertRow} methods are called
* to update the database.
*
* @param columnIndex the first column is 1, the second 2, ...
@@ -7764,7 +7765,7 @@
* Updates the designated column with a <code>RowId</code> value. The updater
* methods are used to update column values in the current row or the insert
* row. The updater methods do not update the underlying database; instead
- * the <code>updateRow<code> or <code>insertRow</code> methods are called
+ * the {@code updateRow} or {@code insertRow} methods are called
* to update the database.
*
* @param columnName the name of the column
--- a/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.sql.rowset/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -182,7 +182,7 @@
private CachedRowSetImpl crsResolve;
/**
- * This <code>ArrayList<code> will hold the values of SyncResolver.*
+ * This {@code ArrayList} will hold the values of SyncResolver.*
*/
private ArrayList<Integer> status;
--- a/jdk/src/java.sql/share/classes/java/sql/Blob.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.sql/share/classes/java/sql/Blob.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,29 +29,28 @@
/**
* The representation (mapping) in
- * the Java™ programming
- * language of an SQL
- * <code>BLOB</code> value. An SQL <code>BLOB</code> is a built-in type
+ * the Java™ programming language of an SQL
+ * {@code BLOB} value. An SQL {@code BLOB} is a built-in type
* that stores a Binary Large Object as a column value in a row of
- * a database table. By default drivers implement <code>Blob</code> using
- * an SQL <code>locator(BLOB)</code>, which means that a
- * <code>Blob</code> object contains a logical pointer to the
- * SQL <code>BLOB</code> data rather than the data itself.
- * A <code>Blob</code> object is valid for the duration of the
+ * a database table. By default drivers implement {@code Blob} using
+ * an SQL {@code locator(BLOB)}, which means that a
+ * {@code Blob} object contains a logical pointer to the
+ * SQL {@code BLOB} data rather than the data itself.
+ * A {@code Blob} object is valid for the duration of the
* transaction in which is was created.
*
* <P>Methods in the interfaces {@link ResultSet},
* {@link CallableStatement}, and {@link PreparedStatement}, such as
- * <code>getBlob</code> and <code>setBlob</code> allow a programmer to
- * access an SQL <code>BLOB</code> value.
- * The <code>Blob</code> interface provides methods for getting the
- * length of an SQL <code>BLOB</code> (Binary Large Object) value,
- * for materializing a <code>BLOB</code> value on the client, and for
+ * {@code getBlob} and {@code setBlob} allow a programmer to
+ * access an SQL {@code BLOB} value.
+ * The {@code Blob} interface provides methods for getting the
+ * length of an SQL {@code BLOB} (Binary Large Object) value,
+ * for materializing a {@code BLOB} value on the client, and for
* determining the position of a pattern of bytes within a
- * <code>BLOB</code> value. In addition, this interface has methods for updating
- * a <code>BLOB</code> value.
+ * {@code BLOB} value. In addition, this interface has methods for updating
+ * a {@code BLOB} value.
* <p>
- * All methods on the <code>Blob</code> interface must be fully implemented if the
+ * All methods on the {@code Blob} interface must be fully implemented if the
* JDBC driver supports the data type.
*
* @since 1.2
@@ -60,51 +59,52 @@
public interface Blob {
/**
- * Returns the number of bytes in the <code>BLOB</code> value
- * designated by this <code>Blob</code> object.
- * @return length of the <code>BLOB</code> in bytes
+ * Returns the number of bytes in the {@code BLOB} value
+ * designated by this {@code Blob} object.
+ *
+ * @return length of the {@code BLOB} in bytes
* @exception SQLException if there is an error accessing the
- * length of the <code>BLOB</code>
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * length of the {@code BLOB}
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.2
*/
long length() throws SQLException;
/**
- * Retrieves all or part of the <code>BLOB</code>
- * value that this <code>Blob</code> object represents, as an array of
- * bytes. This <code>byte</code> array contains up to <code>length</code>
- * consecutive bytes starting at position <code>pos</code>.
+ * Retrieves all or part of the {@code BLOB}
+ * value that this {@code Blob} object represents, as an array of
+ * bytes. This {@code byte} array contains up to {@code length}
+ * consecutive bytes starting at position {@code pos}.
*
* @param pos the ordinal position of the first byte in the
- * <code>BLOB</code> value to be extracted; the first byte is at
+ * {@code BLOB} value to be extracted; the first byte is at
* position 1
* @param length the number of consecutive bytes to be copied; the value
- * for length must be 0 or greater
- * @return a byte array containing up to <code>length</code>
- * consecutive bytes from the <code>BLOB</code> value designated
- * by this <code>Blob</code> object, starting with the
- * byte at position <code>pos</code>
+ * for length must be 0 or greater
+ * @return a byte array containing up to {@code length}
+ * consecutive bytes from the {@code BLOB} value designated
+ * by this {@code Blob} object, starting with the
+ * byte at position {@code pos}
* @exception SQLException if there is an error accessing the
- * <code>BLOB</code> value; if pos is less than 1 or length is
- * less than 0
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code BLOB} value; if pos is less than 1 or length is
+ * less than 0
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @see #setBytes
* @since 1.2
*/
byte[] getBytes(long pos, int length) throws SQLException;
/**
- * Retrieves the <code>BLOB</code> value designated by this
- * <code>Blob</code> instance as a stream.
+ * Retrieves the {@code BLOB} value designated by this
+ * {@code Blob} instance as a stream.
*
- * @return a stream containing the <code>BLOB</code> data
+ * @return a stream containing the {@code BLOB} data
* @exception SQLException if there is an error accessing the
- * <code>BLOB</code> value
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code BLOB} value
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @see #setBinaryStream
* @since 1.2
*/
@@ -112,38 +112,38 @@
/**
* Retrieves the byte position at which the specified byte array
- * <code>pattern</code> begins within the <code>BLOB</code>
- * value that this <code>Blob</code> object represents. The
- * search for <code>pattern</code> begins at position
- * <code>start</code>.
+ * {@code pattern} begins within the {@code BLOB}
+ * value that this {@code Blob} object represents.
+ * The search for {@code pattern} begins at position
+ * {@code start}.
*
* @param pattern the byte array for which to search
* @param start the position at which to begin searching; the
* first position is 1
* @return the position at which the pattern appears, else -1
* @exception SQLException if there is an error accessing the
- * <code>BLOB</code> or if start is less than 1
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code BLOB} or if start is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.2
*/
long position(byte pattern[], long start) throws SQLException;
/**
- * Retrieves the byte position in the <code>BLOB</code> value
- * designated by this <code>Blob</code> object at which
- * <code>pattern</code> begins. The search begins at position
- * <code>start</code>.
+ * Retrieves the byte position in the {@code BLOB} value
+ * designated by this {@code Blob} object at which
+ * {@code pattern} begins. The search begins at position
+ * {@code start}.
*
- * @param pattern the <code>Blob</code> object designating
- * the <code>BLOB</code> value for which to search
- * @param start the position in the <code>BLOB</code> value
+ * @param pattern the {@code Blob} object designating
+ * the {@code BLOB} value for which to search
+ * @param start the position in the {@code BLOB} value
* at which to begin searching; the first position is 1
* @return the position at which the pattern begins, else -1
* @exception SQLException if there is an error accessing the
- * <code>BLOB</code> value or if start is less than 1
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code BLOB} value or if start is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.2
*/
long position(Blob pattern, long start) throws SQLException;
@@ -151,152 +151,155 @@
// -------------------------- JDBC 3.0 -----------------------------------
/**
- * Writes the given array of bytes to the <code>BLOB</code> value that
- * this <code>Blob</code> object represents, starting at position
- * <code>pos</code>, and returns the number of bytes written.
+ * Writes the given array of bytes to the {@code BLOB} value that
+ * this {@code Blob} object represents, starting at position
+ * {@code pos}, and returns the number of bytes written.
* The array of bytes will overwrite the existing bytes
- * in the <code>Blob</code> object starting at the position
- * <code>pos</code>. If the end of the <code>Blob</code> value is reached
- * while writing the array of bytes, then the length of the <code>Blob</code>
+ * in the {@code Blob} object starting at the position
+ * {@code pos}. If the end of the {@code Blob} value is reached
+ * while writing the array of bytes, then the length of the {@code Blob}
* value will be increased to accommodate the extra bytes.
* <p>
- * <b>Note:</b> If the value specified for <code>pos</code>
- * is greater then the length+1 of the <code>BLOB</code> value then the
- * behavior is undefined. Some JDBC drivers may throw a
- * <code>SQLException</code> while other drivers may support this
+ * <b>Note:</b> If the value specified for {@code pos}
+ * is greater than the length+1 of the {@code BLOB} value then the
+ * behavior is undefined. Some JDBC drivers may throw an
+ * {@code SQLException} while other drivers may support this
* operation.
*
- * @param pos the position in the <code>BLOB</code> object at which
+ * @param pos the position in the {@code BLOB} object at which
* to start writing; the first position is 1
- * @param bytes the array of bytes to be written to the <code>BLOB</code>
- * value that this <code>Blob</code> object represents
+ * @param bytes the array of bytes to be written to the {@code BLOB}
+ * value that this {@code Blob} object represents
* @return the number of bytes written
* @exception SQLException if there is an error accessing the
- * <code>BLOB</code> value or if pos is less than 1
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code BLOB} value or if pos is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @see #getBytes
* @since 1.4
*/
int setBytes(long pos, byte[] bytes) throws SQLException;
/**
- * Writes all or part of the given <code>byte</code> array to the
- * <code>BLOB</code> value that this <code>Blob</code> object represents
+ * Writes all or part of the given {@code byte} array to the
+ * {@code BLOB} value that this {@code Blob} object represents
* and returns the number of bytes written.
- * Writing starts at position <code>pos</code> in the <code>BLOB</code>
- * value; <code>len</code> bytes from the given byte array are written.
+ * Writing starts at position {@code pos} in the {@code BLOB}
+ * value; {@code len} bytes from the given byte array are written.
* The array of bytes will overwrite the existing bytes
- * in the <code>Blob</code> object starting at the position
- * <code>pos</code>. If the end of the <code>Blob</code> value is reached
- * while writing the array of bytes, then the length of the <code>Blob</code>
+ * in the {@code Blob} object starting at the position
+ * {@code pos}. If the end of the {@code Blob} value is reached
+ * while writing the array of bytes, then the length of the {@code Blob}
* value will be increased to accommodate the extra bytes.
* <p>
- * <b>Note:</b> If the value specified for <code>pos</code>
- * is greater then the length+1 of the <code>BLOB</code> value then the
- * behavior is undefined. Some JDBC drivers may throw a
- * <code>SQLException</code> while other drivers may support this
+ * <b>Note:</b> If the value specified for {@code pos}
+ * is greater than the length+1 of the {@code BLOB} value then the
+ * behavior is undefined. Some JDBC drivers may throw an
+ * {@code SQLException} while other drivers may support this
* operation.
*
- * @param pos the position in the <code>BLOB</code> object at which
+ * @param pos the position in the {@code BLOB} object at which
* to start writing; the first position is 1
- * @param bytes the array of bytes to be written to this <code>BLOB</code>
+ * @param bytes the array of bytes to be written to this {@code BLOB}
* object
- * @param offset the offset into the array <code>bytes</code> at which
+ * @param offset the offset into the array {@code bytes} at which
* to start reading the bytes to be set
- * @param len the number of bytes to be written to the <code>BLOB</code>
- * value from the array of bytes <code>bytes</code>
+ * @param len the number of bytes to be written to the {@code BLOB}
+ * value from the array of bytes {@code bytes}
* @return the number of bytes written
* @exception SQLException if there is an error accessing the
- * <code>BLOB</code> value or if pos is less than 1
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code BLOB} value or if pos is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @see #getBytes
* @since 1.4
*/
int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException;
/**
- * Retrieves a stream that can be used to write to the <code>BLOB</code>
- * value that this <code>Blob</code> object represents. The stream begins
- * at position <code>pos</code>.
+ * Retrieves a stream that can be used to write to the {@code BLOB}
+ * value that this {@code Blob} object represents. The stream begins
+ * at position {@code pos}.
* The bytes written to the stream will overwrite the existing bytes
- * in the <code>Blob</code> object starting at the position
- * <code>pos</code>. If the end of the <code>Blob</code> value is reached
- * while writing to the stream, then the length of the <code>Blob</code>
+ * in the {@code Blob} object starting at the position
+ * {@code pos}. If the end of the {@code Blob} value is reached
+ * while writing to the stream, then the length of the {@code Blob}
* value will be increased to accommodate the extra bytes.
* <p>
- * <b>Note:</b> If the value specified for <code>pos</code>
- * is greater then the length+1 of the <code>BLOB</code> value then the
- * behavior is undefined. Some JDBC drivers may throw a
- * <code>SQLException</code> while other drivers may support this
+ * <b>Note:</b> If the value specified for {@code pos}
+ * is greater than the length+1 of the {@code BLOB} value then the
+ * behavior is undefined. Some JDBC drivers may throw an
+ * {@code SQLException} while other drivers may support this
* operation.
*
- * @param pos the position in the <code>BLOB</code> value at which
+ * @param pos the position in the {@code BLOB} value at which
* to start writing; the first position is 1
- * @return a <code>java.io.OutputStream</code> object to which data can
+ * @return a {@code java.io.OutputStream} object to which data can
* be written
* @exception SQLException if there is an error accessing the
- * <code>BLOB</code> value or if pos is less than 1
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code BLOB} value or if pos is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @see #getBinaryStream
* @since 1.4
*/
java.io.OutputStream setBinaryStream(long pos) throws SQLException;
/**
- * Truncates the <code>BLOB</code> value that this <code>Blob</code>
- * object represents to be <code>len</code> bytes in length.
+ * Truncates the {@code BLOB} value that this {@code Blob}
+ * object represents to be {@code len} bytes in length.
* <p>
- * <b>Note:</b> If the value specified for <code>pos</code>
- * is greater then the length+1 of the <code>BLOB</code> value then the
- * behavior is undefined. Some JDBC drivers may throw a
- * <code>SQLException</code> while other drivers may support this
+ * <b>Note:</b> If the value specified for {@code pos}
+ * is greater than the length+1 of the {@code BLOB} value then the
+ * behavior is undefined. Some JDBC drivers may throw an
+ * {@code SQLException} while other drivers may support this
* operation.
*
- * @param len the length, in bytes, to which the <code>BLOB</code> value
- * that this <code>Blob</code> object represents should be truncated
+ * @param len the length, in bytes, to which the {@code BLOB} value
+ * that this {@code Blob} object represents should be truncated
* @exception SQLException if there is an error accessing the
- * <code>BLOB</code> value or if len is less than 0
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code BLOB} value or if len is less than 0
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.4
*/
void truncate(long len) throws SQLException;
/**
- * This method frees the <code>Blob</code> object and releases the resources that
- * it holds. The object is invalid once the <code>free</code>
+ * This method frees the {@code Blob} object and releases the resources that
+ * it holds. The object is invalid once the {@code free}
* method is called.
* <p>
- * After <code>free</code> has been called, any attempt to invoke a
- * method other than <code>free</code> will result in a <code>SQLException</code>
- * being thrown. If <code>free</code> is called multiple times, the subsequent
- * calls to <code>free</code> are treated as a no-op.
+ * After {@code free} has been called, any attempt to invoke a
+ * method other than {@code free} will result in an {@code SQLException}
+ * being thrown. If {@code free} is called multiple times, the subsequent
+ * calls to {@code free} are treated as a no-op.
*
* @throws SQLException if an error occurs releasing
- * the Blob's resources
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * the Blob's resources
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.6
*/
void free() throws SQLException;
/**
- * Returns an <code>InputStream</code> object that contains a partial <code>Blob</code> value,
- * starting with the byte specified by pos, which is length bytes in length.
+ * Returns an {@code InputStream} object that contains
+ * a partial {@code Blob} value, starting with the byte
+ * specified by pos, which is length bytes in length.
*
- * @param pos the offset to the first byte of the partial value to be retrieved.
- * The first byte in the <code>Blob</code> is at position 1
+ * @param pos the offset to the first byte of the partial value to be
+ * retrieved. The first byte in the {@code Blob} is at position 1.
* @param length the length in bytes of the partial value to be retrieved
- * @return <code>InputStream</code> through which the partial <code>Blob</code> value can be read.
- * @throws SQLException if pos is less than 1 or if pos is greater than the number of bytes
- * in the <code>Blob</code> or if pos + length is greater than the number of bytes
- * in the <code>Blob</code>
+ * @return {@code InputStream} through which
+ * the partial {@code Blob} value can be read.
+ * @throws SQLException if pos is less than 1 or if pos is greater
+ * than the number of bytes in the {@code Blob} or if
+ * pos + length is greater than the number of bytes
+ * in the {@code Blob}
*
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.6
*/
InputStream getBinaryStream(long pos, long length) throws SQLException;
--- a/jdk/src/java.sql/share/classes/java/sql/Clob.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.sql/share/classes/java/sql/Clob.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,28 +29,28 @@
/**
* The mapping in the Java™ programming language
- * for the SQL <code>CLOB</code> type.
- * An SQL <code>CLOB</code> is a built-in type
+ * for the SQL {@code CLOB} type.
+ * An SQL {@code CLOB} is a built-in type
* that stores a Character Large Object as a column value in a row of
* a database table.
- * By default drivers implement a <code>Clob</code> object using an SQL
- * <code>locator(CLOB)</code>, which means that a <code>Clob</code> object
- * contains a logical pointer to the SQL <code>CLOB</code> data rather than
- * the data itself. A <code>Clob</code> object is valid for the duration
+ * By default drivers implement a {@code Clob} object using an SQL
+ * {@code locator(CLOB)}, which means that a {@code Clob} object
+ * contains a logical pointer to the SQL {@code CLOB} data rather than
+ * the data itself. A {@code Clob} object is valid for the duration
* of the transaction in which it was created.
- * <P>The <code>Clob</code> interface provides methods for getting the
- * length of an SQL <code>CLOB</code> (Character Large Object) value,
- * for materializing a <code>CLOB</code> value on the client, and for
- * searching for a substring or <code>CLOB</code> object within a
- * <code>CLOB</code> value.
+ * <P>The {@code Clob} interface provides methods for getting the
+ * length of an SQL {@code CLOB} (Character Large Object) value,
+ * for materializing a {@code CLOB} value on the client, and for
+ * searching for a substring or {@code CLOB} object within a
+ * {@code CLOB} value.
* Methods in the interfaces {@link ResultSet},
* {@link CallableStatement}, and {@link PreparedStatement}, such as
- * <code>getClob</code> and <code>setClob</code> allow a programmer to
- * access an SQL <code>CLOB</code> value. In addition, this interface
- * has methods for updating a <code>CLOB</code> value.
+ * {@code getClob} and {@code setClob} allow a programmer to
+ * access an SQL {@code CLOB} value. In addition, this interface
+ * has methods for updating a {@code CLOB} value.
* <p>
- * All methods on the <code>Clob</code> interface must be fully implemented if the
- * JDBC driver supports the data type.
+ * All methods on the {@code Clob} interface must be
+ * fully implemented if the JDBC driver supports the data type.
*
* @since 1.2
*/
@@ -59,67 +59,67 @@
/**
* Retrieves the number of characters
- * in the <code>CLOB</code> value
- * designated by this <code>Clob</code> object.
+ * in the {@code CLOB} value
+ * designated by this {@code Clob} object.
*
- * @return length of the <code>CLOB</code> in characters
+ * @return length of the {@code CLOB} in characters
* @exception SQLException if there is an error accessing the
- * length of the <code>CLOB</code> value
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * length of the {@code CLOB} value
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.2
*/
long length() throws SQLException;
/**
* Retrieves a copy of the specified substring
- * in the <code>CLOB</code> value
- * designated by this <code>Clob</code> object.
+ * in the {@code CLOB} value
+ * designated by this {@code Clob} object.
* The substring begins at position
- * <code>pos</code> and has up to <code>length</code> consecutive
+ * {@code pos} and has up to {@code length} consecutive
* characters.
*
* @param pos the first character of the substring to be extracted.
- * The first character is at position 1.
+ * The first character is at position 1.
* @param length the number of consecutive characters to be copied;
- * the value for length must be 0 or greater
- * @return a <code>String</code> that is the specified substring in
- * the <code>CLOB</code> value designated by this <code>Clob</code> object
+ * the value for length must be 0 or greater
+ * @return a {@code String} that is the specified substring in
+ * the {@code CLOB} value designated by this {@code Clob} object
* @exception SQLException if there is an error accessing the
- * <code>CLOB</code> value; if pos is less than 1 or length is
- * less than 0
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code CLOB} value; if pos is less than 1 or length is
+ * less than 0
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.2
*/
String getSubString(long pos, int length) throws SQLException;
/**
- * Retrieves the <code>CLOB</code> value designated by this <code>Clob</code>
- * object as a <code>java.io.Reader</code> object (or as a stream of
+ * Retrieves the {@code CLOB} value designated by this {@code Clob}
+ * object as a {@code java.io.Reader} object (or as a stream of
* characters).
*
- * @return a <code>java.io.Reader</code> object containing the
- * <code>CLOB</code> data
+ * @return a {@code java.io.Reader} object containing the
+ * {@code CLOB} data
* @exception SQLException if there is an error accessing the
- * <code>CLOB</code> value
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code CLOB} value
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @see #setCharacterStream
* @since 1.2
*/
java.io.Reader getCharacterStream() throws SQLException;
/**
- * Retrieves the <code>CLOB</code> value designated by this <code>Clob</code>
+ * Retrieves the {@code CLOB} value designated by this {@code Clob}
* object as an ascii stream.
*
- * @return a <code>java.io.InputStream</code> object containing the
- * <code>CLOB</code> data
+ * @return a {@code java.io.InputStream} object containing the
+ * {@code CLOB} data
* @exception SQLException if there is an error accessing the
- * <code>CLOB</code> value
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code CLOB} value
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @see #setAsciiStream
* @since 1.2
*/
@@ -127,38 +127,38 @@
/**
* Retrieves the character position at which the specified substring
- * <code>searchstr</code> appears in the SQL <code>CLOB</code> value
- * represented by this <code>Clob</code> object. The search
- * begins at position <code>start</code>.
+ * {@code searchstr} appears in the SQL {@code CLOB} value
+ * represented by this {@code Clob} object. The search
+ * begins at position {@code start}.
*
* @param searchstr the substring for which to search
- * @param start the position at which to begin searching; the first position
- * is 1
+ * @param start the position at which to begin searching;
+ * the first position is 1
* @return the position at which the substring appears or -1 if it is not
* present; the first position is 1
* @exception SQLException if there is an error accessing the
- * <code>CLOB</code> value or if pos is less than 1
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code CLOB} value or if pos is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.2
*/
long position(String searchstr, long start) throws SQLException;
/**
* Retrieves the character position at which the specified
- * <code>Clob</code> object <code>searchstr</code> appears in this
- * <code>Clob</code> object. The search begins at position
- * <code>start</code>.
+ * {@code Clob} object {@code searchstr} appears in this
+ * {@code Clob} object. The search begins at position
+ * {@code start}.
*
- * @param searchstr the <code>Clob</code> object for which to search
+ * @param searchstr the {@code Clob} object for which to search
* @param start the position at which to begin searching; the first
* position is 1
- * @return the position at which the <code>Clob</code> object appears
- * or -1 if it is not present; the first position is 1
+ * @return the position at which the {@code Clob} object appears
+ * or -1 if it is not present; the first position is 1
* @exception SQLException if there is an error accessing the
- * <code>CLOB</code> value or if start is less than 1
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code CLOB} value or if start is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.2
*/
long position(Clob searchstr, long start) throws SQLException;
@@ -166,90 +166,91 @@
//---------------------------- jdbc 3.0 -----------------------------------
/**
- * Writes the given Java <code>String</code> to the <code>CLOB</code>
- * value that this <code>Clob</code> object designates at the position
- * <code>pos</code>. The string will overwrite the existing characters
- * in the <code>Clob</code> object starting at the position
- * <code>pos</code>. If the end of the <code>Clob</code> value is reached
- * while writing the given string, then the length of the <code>Clob</code>
+ * Writes the given Java {@code String} to the {@code CLOB}
+ * value that this {@code Clob} object designates at the position
+ * {@code pos}. The string will overwrite the existing characters
+ * in the {@code Clob} object starting at the position
+ * {@code pos}. If the end of the {@code Clob} value is reached
+ * while writing the given string, then the length of the {@code Clob}
* value will be increased to accommodate the extra characters.
* <p>
- * <b>Note:</b> If the value specified for <code>pos</code>
- * is greater then the length+1 of the <code>CLOB</code> value then the
- * behavior is undefined. Some JDBC drivers may throw a
- * <code>SQLException</code> while other drivers may support this
+ * <b>Note:</b> If the value specified for {@code pos}
+ * is greater than the length+1 of the {@code CLOB} value then the
+ * behavior is undefined. Some JDBC drivers may throw an
+ * {@code SQLException} while other drivers may support this
* operation.
*
- * @param pos the position at which to start writing to the <code>CLOB</code>
- * value that this <code>Clob</code> object represents;
- * The first position is 1
- * @param str the string to be written to the <code>CLOB</code>
- * value that this <code>Clob</code> designates
+ * @param pos the position at which to start writing to the {@code CLOB}
+ * value that this {@code Clob} object represents;
+ * the first position is 1.
+ * @param str the string to be written to the {@code CLOB}
+ * value that this {@code Clob} designates
* @return the number of characters written
* @exception SQLException if there is an error accessing the
- * <code>CLOB</code> value or if pos is less than 1
+ * {@code CLOB} value or if pos is less than 1
*
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.4
*/
int setString(long pos, String str) throws SQLException;
/**
- * Writes <code>len</code> characters of <code>str</code>, starting
- * at character <code>offset</code>, to the <code>CLOB</code> value
- * that this <code>Clob</code> represents. The string will overwrite the existing characters
- * in the <code>Clob</code> object starting at the position
- * <code>pos</code>. If the end of the <code>Clob</code> value is reached
- * while writing the given string, then the length of the <code>Clob</code>
+ * Writes {@code len} characters of {@code str}, starting
+ * at character {@code offset}, to the {@code CLOB} value
+ * that this {@code Clob} represents.
+ * The string will overwrite the existing characters
+ * in the {@code Clob} object starting at the position
+ * {@code pos}. If the end of the {@code Clob} value is reached
+ * while writing the given string, then the length of the {@code Clob}
* value will be increased to accommodate the extra characters.
* <p>
- * <b>Note:</b> If the value specified for <code>pos</code>
- * is greater then the length+1 of the <code>CLOB</code> value then the
- * behavior is undefined. Some JDBC drivers may throw a
- * <code>SQLException</code> while other drivers may support this
+ * <b>Note:</b> If the value specified for {@code pos}
+ * is greater than the length+1 of the {@code CLOB} value then the
+ * behavior is undefined. Some JDBC drivers may throw an
+ * {@code SQLException} while other drivers may support this
* operation.
*
* @param pos the position at which to start writing to this
- * <code>CLOB</code> object; The first position is 1
- * @param str the string to be written to the <code>CLOB</code>
- * value that this <code>Clob</code> object represents
- * @param offset the offset into <code>str</code> to start reading
+ * {@code CLOB} object; The first position is 1
+ * @param str the string to be written to the {@code CLOB}
+ * value that this {@code Clob} object represents
+ * @param offset the offset into {@code str} to start reading
* the characters to be written
* @param len the number of characters to be written
* @return the number of characters written
* @exception SQLException if there is an error accessing the
- * <code>CLOB</code> value or if pos is less than 1
+ * {@code CLOB} value or if pos is less than 1
*
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.4
*/
int setString(long pos, String str, int offset, int len) throws SQLException;
/**
* Retrieves a stream to be used to write Ascii characters to the
- * <code>CLOB</code> value that this <code>Clob</code> object represents,
- * starting at position <code>pos</code>. Characters written to the stream
+ * {@code CLOB} value that this {@code Clob} object represents,
+ * starting at position {@code pos}. Characters written to the stream
* will overwrite the existing characters
- * in the <code>Clob</code> object starting at the position
- * <code>pos</code>. If the end of the <code>Clob</code> value is reached
- * while writing characters to the stream, then the length of the <code>Clob</code>
+ * in the {@code Clob} object starting at the position
+ * {@code pos}. If the end of the {@code Clob} value is reached
+ * while writing characters to the stream, then the length of the {@code Clob}
* value will be increased to accommodate the extra characters.
* <p>
- * <b>Note:</b> If the value specified for <code>pos</code>
- * is greater then the length+1 of the <code>CLOB</code> value then the
- * behavior is undefined. Some JDBC drivers may throw a
- * <code>SQLException</code> while other drivers may support this
+ * <b>Note:</b> If the value specified for {@code pos}
+ * is greater than the length+1 of the {@code CLOB} value then the
+ * behavior is undefined. Some JDBC drivers may throw an
+ * {@code SQLException} while other drivers may support this
* operation.
*
* @param pos the position at which to start writing to this
- * <code>CLOB</code> object; The first position is 1
+ * {@code CLOB} object; The first position is 1
* @return the stream to which ASCII encoded characters can be written
* @exception SQLException if there is an error accessing the
- * <code>CLOB</code> value or if pos is less than 1
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code CLOB} value or if pos is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @see #getAsciiStream
*
* @since 1.4
@@ -258,28 +259,28 @@
/**
* Retrieves a stream to be used to write a stream of Unicode characters
- * to the <code>CLOB</code> value that this <code>Clob</code> object
- * represents, at position <code>pos</code>. Characters written to the stream
+ * to the {@code CLOB} value that this {@code Clob} object
+ * represents, at position {@code pos}. Characters written to the stream
* will overwrite the existing characters
- * in the <code>Clob</code> object starting at the position
- * <code>pos</code>. If the end of the <code>Clob</code> value is reached
- * while writing characters to the stream, then the length of the <code>Clob</code>
+ * in the {@code Clob} object starting at the position
+ * {@code pos}. If the end of the {@code Clob} value is reached
+ * while writing characters to the stream, then the length of the {@code Clob}
* value will be increased to accommodate the extra characters.
* <p>
- * <b>Note:</b> If the value specified for <code>pos</code>
- * is greater then the length+1 of the <code>CLOB</code> value then the
- * behavior is undefined. Some JDBC drivers may throw a
- * <code>SQLException</code> while other drivers may support this
+ * <b>Note:</b> If the value specified for {@code pos}
+ * is greater than the length+1 of the {@code CLOB} value then the
+ * behavior is undefined. Some JDBC drivers may throw an
+ * {@code SQLException} while other drivers may support this
* operation.
*
* @param pos the position at which to start writing to the
- * <code>CLOB</code> value; The first position is 1
+ * {@code CLOB} value; The first position is 1
*
* @return a stream to which Unicode encoded characters can be written
* @exception SQLException if there is an error accessing the
- * <code>CLOB</code> value or if pos is less than 1
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * {@code CLOB} value or if pos is less than 1
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @see #getCharacterStream
*
* @since 1.4
@@ -287,60 +288,64 @@
java.io.Writer setCharacterStream(long pos) throws SQLException;
/**
- * Truncates the <code>CLOB</code> value that this <code>Clob</code>
- * designates to have a length of <code>len</code>
+ * Truncates the {@code CLOB} value that this {@code Clob}
+ * designates to have a length of {@code len}
* characters.
* <p>
- * <b>Note:</b> If the value specified for <code>pos</code>
- * is greater then the length+1 of the <code>CLOB</code> value then the
- * behavior is undefined. Some JDBC drivers may throw a
- * <code>SQLException</code> while other drivers may support this
+ * <b>Note:</b> If the value specified for {@code pos}
+ * is greater than the length+1 of the {@code CLOB} value then the
+ * behavior is undefined. Some JDBC drivers may throw an
+ * {@code SQLException} while other drivers may support this
* operation.
*
- * @param len the length, in characters, to which the <code>CLOB</code> value
+ * @param len the length, in characters, to which the {@code CLOB} value
* should be truncated
* @exception SQLException if there is an error accessing the
- * <code>CLOB</code> value or if len is less than 0
+ * {@code CLOB} value or if len is less than 0
*
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.4
*/
void truncate(long len) throws SQLException;
/**
- * This method releases the resources that the <code>Clob</code> object
- * holds. The object is invalid once the <code>free</code> method
+ * This method releases the resources that the {@code Clob} object
+ * holds. The object is invalid once the {@code free} method
* is called.
* <p>
- * After <code>free</code> has been called, any attempt to invoke a
- * method other than <code>free</code> will result in a <code>SQLException</code>
- * being thrown. If <code>free</code> is called multiple times, the subsequent
- * calls to <code>free</code> are treated as a no-op.
+ * After {@code free} has been called, any attempt to invoke a
+ * method other than {@code free} will result in a {@code SQLException}
+ * being thrown. If {@code free} is called multiple times, the subsequent
+ * calls to {@code free} are treated as a no-op.
*
* @throws SQLException if an error occurs releasing
- * the Clob's resources
+ * the Clob's resources
*
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.6
*/
void free() throws SQLException;
/**
- * Returns a <code>Reader</code> object that contains a partial <code>Clob</code> value, starting
- * with the character specified by pos, which is length characters in length.
+ * Returns a {@code Reader} object that contains
+ * a partial {@code Clob} value, starting with the character
+ * specified by pos, which is length characters in length.
*
* @param pos the offset to the first character of the partial value to
* be retrieved. The first character in the Clob is at position 1.
* @param length the length in characters of the partial value to be retrieved.
- * @return <code>Reader</code> through which the partial <code>Clob</code> value can be read.
- * @throws SQLException if pos is less than 1 or if pos is greater than the number of
- * characters in the <code>Clob</code> or if pos + length is greater than the number of
- * characters in the <code>Clob</code>
+ * @return {@code Reader} through which
+ * the partial {@code Clob} value can be read.
+ * @throws SQLException if pos is less than 1;
+ * or if pos is greater than the number of characters
+ * in the {@code Clob};
+ * or if pos + length is greater than the number of
+ * characters in the {@code Clob}
*
- * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
- * this method
+ * @exception SQLFeatureNotSupportedException if the JDBC driver
+ * does not support this method
* @since 1.6
*/
Reader getCharacterStream(long pos, long length) throws SQLException;
--- a/jdk/src/java.sql/share/classes/javax/transaction/xa/package.html Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.sql/share/classes/javax/transaction/xa/package.html Mon Jun 01 10:15:20 2015 -0700
@@ -35,7 +35,7 @@
resource manager driver) in JTA transactions. The driver vendor
for a specific resource manager provides the implementation of
this API.
-<p>
+
@since 1.4
</body>
</html>
--- a/jdk/src/java.transaction/share/classes/javax/transaction/package.html Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/java.transaction/share/classes/javax/transaction/package.html Mon Jun 01 10:15:20 2015 -0700
@@ -30,7 +30,7 @@
<body bgcolor="white">
Contains three exceptions thrown by the ORB machinery during unmarshalling.
-<p>
+
@since 1.3
</body>
</html>
--- a/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/AttachPermission.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/jdk.attach/share/classes/com/sun/tools/attach/AttachPermission.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,7 +31,7 @@
* VirtualMachine#attach VirtalMachine.attach} to attach to a target virtual
* machine.
* This permission is also checked when an {@link
- * com.sun.tools.attach.spi.AttachProvider AttachProvider} is created. </p>
+ * com.sun.tools.attach.spi.AttachProvider AttachProvider} is created.
*
* <p> An <code>AttachPermission</code> object contains a name (also referred
* to as a "target name") but no actions list; you either have the
@@ -39,7 +39,7 @@
* The following table provides a summary description of what the
* permission allows, and discusses the risks of granting code the
* permission.
- * <P>
+ *
* <table border=1 cellpadding=5 summary="Table shows permission
* target name, what the permission allows, and associated risks">
* <tr>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.charsets/share/classes/META-INF/services/java.nio.charset.spi.CharsetProvider Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,2 @@
+# NIO charset SPI extended charset provider
+sun.nio.cs.ext.ExtendedCharsets
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022.java Mon Jun 01 10:15:20 2015 -0700
@@ -395,7 +395,7 @@
protected final byte maximumDesignatorLength = 4;
- protected String SODesig,
+ protected byte[] SODesig,
SS2Desig = null,
SS3Desig = null;
@@ -426,21 +426,18 @@
SS3DesDefined = false;
}
- private int unicodeToNative(char unicode, byte ebyte[])
- {
+ private int unicodeToNative(char unicode, byte ebyte[]) {
int index = 0;
- byte tmpByte[];
char convChar[] = {unicode};
byte convByte[] = new byte[4];
int converted;
try{
CharBuffer cc = CharBuffer.wrap(convChar);
- ByteBuffer bb = ByteBuffer.allocate(4);
+ ByteBuffer bb = ByteBuffer.wrap(convByte);
ISOEncoder.encode(cc, bb, true);
bb.flip();
converted = bb.remaining();
- bb.get(convByte,0,converted);
} catch(Exception e) {
return -1;
}
@@ -449,9 +446,8 @@
if (!SODesDefined) {
newSODesDefined = true;
ebyte[0] = ISO_ESC;
- tmpByte = SODesig.getBytes();
- System.arraycopy(tmpByte,0,ebyte,1,tmpByte.length);
- index = tmpByte.length+1;
+ System.arraycopy(SODesig, 0, ebyte, 1, SODesig.length);
+ index = SODesig.length + 1;
}
if (!shiftout) {
newshiftout = true;
@@ -465,9 +461,8 @@
if (!SS2DesDefined) {
newSS2DesDefined = true;
ebyte[0] = ISO_ESC;
- tmpByte = SS2Desig.getBytes();
- System.arraycopy(tmpByte, 0, ebyte, 1, tmpByte.length);
- index = tmpByte.length+1;
+ System.arraycopy(SS2Desig, 0, ebyte, 1, SS2Desig.length);
+ index = SS2Desig.length + 1;
}
ebyte[index++] = ISO_ESC;
ebyte[index++] = ISO_SS2_7;
@@ -477,9 +472,8 @@
if(!SS3DesDefined){
newSS3DesDefined = true;
ebyte[0] = ISO_ESC;
- tmpByte = SS3Desig.getBytes();
- System.arraycopy(tmpByte, 0, ebyte, 1, tmpByte.length);
- index = tmpByte.length+1;
+ System.arraycopy(SS3Desig, 0, ebyte, 1, SS3Desig.length);
+ index = SS3Desig.length + 1;
}
ebyte[index++] = ISO_ESC;
ebyte[index++] = ISO_SS3_7;
@@ -560,7 +554,6 @@
}
}
-
private CoderResult encodeBufferLoop(CharBuffer src,
ByteBuffer dst)
{
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN_CNS.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN_CNS.java Mon Jun 01 10:15:20 2015 -0700
@@ -67,9 +67,9 @@
public Encoder(Charset cs)
{
super(cs);
- SODesig = "$)G";
- SS2Desig = "$*H";
- SS3Desig = "$+I";
+ SODesig = new byte[] {'$', ')', 'G' };
+ SS2Desig = new byte[] {'$', '*', 'H' };
+ SS3Desig = new byte[] {'$', '+', 'I' };
try {
Charset cset = Charset.forName("EUC_TW"); // CNS11643
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN_GB.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN_GB.java Mon Jun 01 10:15:20 2015 -0700
@@ -68,7 +68,7 @@
public Encoder(Charset cs)
{
super(cs);
- SODesig = "$)A";
+ SODesig = new byte[] { '$', ')', 'A'};
try {
Charset cset = Charset.forName("EUC_CN"); // GB2312
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_KR.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_KR.java Mon Jun 01 10:15:20 2015 -0700
@@ -81,11 +81,9 @@
private static class Encoder extends ISO2022.Encoder {
- public Encoder(Charset cs)
- {
+ public Encoder(Charset cs) {
super(cs);
- SODesig = "$)C";
-
+ SODesig = new byte[] {'$', ')', 'C' };
try {
ISOEncoder = ksc5601_cs.newEncoder();
} catch (Exception e) { }
--- a/jdk/src/jdk.dev/share/classes/sun/tools/native2ascii/A2NFilter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2001, 2005, 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.
- */
-
-/**
- * This FilterReader class processes a sequence of characters from
- * a source stream containing a mixture of 7-bit ASCII data and
- * 'back-tick U' escaped sequences representing characters which have
- * the possibility of being encoded in a user specified encoding
- * The filter relies on knowing the target encoding and makes a
- * determination as to whether a given supplied character in its
- * source character stream is encodeable in the target encoding.
- * If not, it is remains in its back-tick U escaped form.
- */
-
-package sun.tools.native2ascii;
-import java.io.*;
-
-
-class A2NFilter extends FilterReader {
-
- // maintain a trailing buffer to hold any incompleted
- // unicode escaped sequences
- private char[] trailChars = null;
-
- public A2NFilter(Reader in) {
- super(in);
- }
-
- public int read(char[] buf, int off, int len) throws IOException {
- int numChars = 0; // how many characters have been read
- int retChars = 0; // how many characters we'll return
-
- char[] cBuf = new char[len];
- int cOffset = 0; // offset at which we'll start reading
- boolean eof = false;
-
- // copy trailing chars from previous invocation to input buffer
- if (trailChars != null) {
- for (int i = 0; i < trailChars.length; i++)
- cBuf[i] = trailChars[i];
- numChars = trailChars.length;
- trailChars = null;
- }
-
- int n = in.read(cBuf, numChars, len - numChars);
- if (n < 0) {
- eof = true;
- if (numChars == 0)
- return -1; // EOF;
- } else {
- numChars += n;
- }
-
- for (int i = 0; i < numChars;) {
- char c = cBuf[i++];
-
- if (c != '\\' || (eof && numChars <= 5)) {
- // Not a backslash, so copy and continue
- // Always pass non backslash chars straight thru
- // for regular encoding. If backslash occurs in
- // input stream at the final 5 chars then don't
- // attempt to read-ahead and de-escape since these
- // are literal occurrences of U+005C which need to
- // be encoded verbatim in the target encoding.
- buf[retChars++] = c;
- continue;
- }
-
- int remaining = numChars - i;
- if (remaining < 5) {
- // Might be the first character of a unicode escape, but we
- // don't have enough characters to tell, so save it and finish
- trailChars = new char[1 + remaining];
- trailChars[0] = c;
- for (int j = 0; j < remaining; j++)
- trailChars[1 + j] = cBuf[i + j];
- break;
- }
- // At this point we have at least five characters remaining
-
- c = cBuf[i++];
- if (c != 'u') {
- // Not a unicode escape, so copy and continue
- buf[retChars++] = '\\';
- buf[retChars++] = c;
- continue;
- }
-
- // The next four characters are the hex part of a unicode escape
- char rc = 0;
- boolean isUE = true;
- try {
- rc = (char)Integer.parseInt(new String(cBuf, i, 4), 16);
- } catch (NumberFormatException x) {
- isUE = false;
- }
- if (isUE && Main.canConvert(rc)) {
- // We'll be able to convert this
- buf[retChars++] = rc;
- i += 4; // Align beyond the current uXXXX sequence
- } else {
- // We won't, so just retain the original sequence
- buf[retChars++] = '\\';
- buf[retChars++] = 'u';
- continue;
- }
-
- }
-
- return retChars;
- }
-
- public int read() throws IOException {
- char[] buf = new char[1];
-
- if (read(buf, 0, 1) == -1)
- return -1;
- else
- return (int)buf[0];
- }
-
-}
--- a/jdk/src/jdk.dev/share/classes/sun/tools/native2ascii/Main.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,375 +0,0 @@
-/*
- * Copyright (c) 1996, 2012, 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.
- */
-
-/*
- */
-
-/*
- Currently javac and load() method in java.util.Properties
- supports only Latin1 encoding input.
- But in Asian platforms programmer or message translator
- uses the editor which support othere than latin1 encoding
- to specify their native language string.
- So if programmer or message translator wants to use other than
- Latin1 character in his/her program source or properties file
- they must convert the file to ASCII plus \udddd notation.
- (javac/load() modification is not appropriate due to
- time constraints for JDK1.1)
- This utility is for the purpose of that conversion.
-
- NAME
- native2ascii - convert native encoding file to ascii file
- include \udddd Unicode notation
-
- SYNOPSIS
- native2ascii [options] [inputfile [outputfile]]
-
- DESCRIPTION
- If outputfile is not described standard output is used as
- output file, and if inputfile is not also described
- stardard input is used as input file.
-
- Options
-
- -reverse
- convert ascii with \udddd notation to native encoding
-
- -encoding encoding_name
- Specify the encoding name which is used by conversion.
- 8859_[1 - 9], JIS, EUCJIS, SJIS is currently supported.
- Default encoding is taken from System property "file.encoding".
-
-*/
-
-package sun.tools.native2ascii;
-
-import java.io.*;
-import java.util.*;
-import java.text.MessageFormat;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.Charset;
-import java.nio.charset.IllegalCharsetNameException;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-/**
- * Main program of the native2ascii
- */
-
-public class Main {
-
- String inputFileName = null;
- String outputFileName = null;
- File tempFile = null;
- boolean reverse = false;
- static String encodingString = null;
- static String defaultEncoding = null;
- static CharsetEncoder encoder = null;
-
- /**
- * Run the converter
- */
- public synchronized boolean convert(String argv[]) {
- List<String> v = new ArrayList<>(2);
- File outputFile = null;
- boolean createOutputFile = false;
-
- // Parse arguments
- for (int i = 0; i < argv.length; i++) {
- if (argv[i].equals("-encoding")) {
- if ((i + 1) < argv.length) {
- encodingString = argv[++i];
- } else {
- error(getMsg("err.bad.arg"));
- usage();
- return false;
- }
- } else if (argv[i].equals("-reverse")) {
- reverse = true;
- } else {
- if (v.size() > 1) {
- usage();
- return false;
- }
- v.add(argv[i]);
- }
- }
-
- if (encodingString == null) {
- defaultEncoding = Charset.defaultCharset().name();
- }
- char[] lineBreak = System.getProperty("line.separator").toCharArray();
-
- try {
- initializeConverter();
-
- if (v.size() == 1) {
- inputFileName = v.get(0);
- }
-
- if (v.size() == 2) {
- inputFileName = v.get(0);
- outputFileName = v.get(1);
- createOutputFile = true;
- }
-
- if (createOutputFile) {
- outputFile = new File(outputFileName);
- if (outputFile.exists() && !outputFile.canWrite()) {
- throw new Exception(formatMsg("err.cannot.write", outputFileName));
- }
- }
-
- if (reverse) {
- try (BufferedReader reader = getA2NInput(inputFileName);
- Writer osw = getA2NOutput(outputFileName);) {
- String line;
- while ((line = reader.readLine()) != null) {
- osw.write(line.toCharArray());
- osw.write(lineBreak);
- if (outputFileName == null) { // flush stdout
- osw.flush();
- }
- }
- }
- } else {
- // N2A
- try (BufferedReader in = getN2AInput(inputFileName);
- BufferedWriter out = getN2AOutput(outputFileName);) {
- String inLine;
- while ((inLine = in.readLine()) != null) {
- out.write(inLine.toCharArray());
- out.write(lineBreak);
- if (outputFileName == null) { // flush stdout
- out.flush();
- }
- }
- }
- }
-
- // Since we are done rename temporary file to desired output file
- if (createOutputFile) {
- if (outputFile.exists()) {
- // Some win32 platforms can't handle atomic
- // rename if source and target file paths are
- // identical. To make things simple we just unconditionally
- // delete the target file before calling renameTo()
- outputFile.delete();
- }
- tempFile.renameTo(outputFile);
- }
- } catch (Exception e) {
- error(e.toString());
- return false;
- }
-
- return true;
- }
-
- private void error(String msg){
- System.out.println(msg);
- }
-
- private void usage(){
- System.out.println(getMsg("usage"));
- }
-
-
- private BufferedReader getN2AInput(String inFile) throws Exception {
-
- InputStream forwardIn;
- if (inFile == null)
- forwardIn = System.in;
- else {
- File f = new File(inFile);
- if (!f.canRead()){
- throw new Exception(formatMsg("err.cannot.read", f.getName()));
- }
-
- try {
- forwardIn = new FileInputStream(inFile);
- } catch (IOException e) {
- throw new Exception(formatMsg("err.cannot.read", f.getName()));
- }
- }
-
- BufferedReader r = (encodingString != null) ?
- new BufferedReader(new InputStreamReader(forwardIn,
- encodingString)) :
- new BufferedReader(new InputStreamReader(forwardIn));
- return r;
- }
-
-
- private BufferedWriter getN2AOutput(String outFile) throws Exception {
- Writer output;
- BufferedWriter n2aOut;
-
- if (outFile == null)
- output = new OutputStreamWriter(System.out,"US-ASCII");
-
- else {
- File f = new File(outFile);
-
- File tempDir = f.getParentFile();
-
- if (tempDir == null)
- tempDir = new File(System.getProperty("user.dir"));
-
- tempFile = File.createTempFile("_N2A",
- ".TMP",
- tempDir);
- tempFile.deleteOnExit();
-
- try {
- output = new FileWriter(tempFile);
- } catch (IOException e){
- throw new Exception(formatMsg("err.cannot.write", tempFile.getName()));
- }
- }
-
- n2aOut = new BufferedWriter(new N2AFilter(output));
- return n2aOut;
- }
-
- private BufferedReader getA2NInput(String inFile) throws Exception {
- Reader in;
- BufferedReader reader;
-
- if (inFile == null)
- in = new InputStreamReader(System.in, "US-ASCII");
- else {
- File f = new File(inFile);
- if (!f.canRead()){
- throw new Exception(formatMsg("err.cannot.read", f.getName()));
- }
-
- try {
- in = new FileReader(inFile);
- } catch (Exception e) {
- throw new Exception(formatMsg("err.cannot.read", f.getName()));
- }
- }
-
- reader = new BufferedReader(new A2NFilter(in));
- return reader;
- }
-
- private Writer getA2NOutput(String outFile) throws Exception {
-
- OutputStreamWriter w = null;
- OutputStream output = null;
-
- if (outFile == null)
- output = System.out;
- else {
- File f = new File(outFile);
-
- File tempDir = f.getParentFile();
- if (tempDir == null)
- tempDir = new File(System.getProperty("user.dir"));
- tempFile = File.createTempFile("_N2A",
- ".TMP",
- tempDir);
- tempFile.deleteOnExit();
-
- try {
- output = new FileOutputStream(tempFile);
- } catch (IOException e){
- throw new Exception(formatMsg("err.cannot.write", tempFile.getName()));
- }
- }
-
- w = (encodingString != null) ?
- new OutputStreamWriter(output, encodingString) :
- new OutputStreamWriter(output);
-
- return (w);
- }
-
- private static Charset lookupCharset(String csName) {
- if (Charset.isSupported(csName)) {
- try {
- return Charset.forName(csName);
- } catch (UnsupportedCharsetException x) {
- throw new Error(x);
- }
- }
- return null;
- }
-
- public static boolean canConvert(char ch) {
- return (encoder != null && encoder.canEncode(ch));
- }
-
- private static void initializeConverter() throws UnsupportedEncodingException {
- Charset cs = null;
-
- try {
- cs = (encodingString == null) ?
- lookupCharset(defaultEncoding):
- lookupCharset(encodingString);
-
- encoder = (cs != null) ?
- cs.newEncoder() :
- null;
- } catch (IllegalCharsetNameException e) {
- throw new Error(e);
- }
- }
-
- private static ResourceBundle rsrc;
-
- static {
- try {
- rsrc = ResourceBundle.getBundle(
- "sun.tools.native2ascii.resources.MsgNative2ascii");
- } catch (MissingResourceException e) {
- throw new Error("Missing message file.");
- }
- }
-
- private String getMsg(String key) {
- try {
- return (rsrc.getString(key));
- } catch (MissingResourceException e) {
- throw new Error("Error in message file format.");
- }
- }
-
- private String formatMsg(String key, String arg) {
- String msg = getMsg(key);
- return MessageFormat.format(msg, arg);
- }
-
-
- /**
- * Main program
- */
- public static void main(String argv[]){
- Main converter = new Main();
- System.exit(converter.convert(argv) ? 0 : 1);
- }
-}
--- a/jdk/src/jdk.dev/share/classes/sun/tools/native2ascii/N2AFilter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2001, 2008, 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.
- */
-
-
-/**
- * This FilterWriter class takes an existing Writer and uses
- * the 'back-tick U' escape notation to escape characters which are
- * encountered within the input character based stream which
- * are outside the 7-bit ASCII range. The native platforms linefeed
- * character is emitted for each line of processed input
- */
-
-package sun.tools.native2ascii;
-import java.io.*;
-import java.nio.BufferOverflowException;
-
-class N2AFilter extends FilterWriter {
-
- public N2AFilter(Writer out) { super(out); }
-
- public void write(char b) throws IOException {
- char[] buf = new char[1];
- buf[0] = b;
- write(buf, 0, 1);
- }
-
- public void write(char[] buf, int off, int len) throws IOException {
-
- String lineBreak = System.getProperty("line.separator");
-
- //System.err.println ("xx Out buffer length is " + buf.length );
- for (int i = 0; i < len; i++) {
- if ((buf[i] > '\u007f')) {
- // write \udddd
- out.write('\\');
- out.write('u');
- String hex =
- Integer.toHexString(buf[i]);
- StringBuilder hex4 = new StringBuilder(hex);
- hex4.reverse();
- int length = 4 - hex4.length();
- for (int j = 0; j < length; j++) {
- hex4.append('0');
- }
- for (int j = 0; j < 4; j++) {
- out.write(hex4.charAt(3 - j));
- }
- } else
- out.write(buf[i]);
- }
- }
-}
--- a/jdk/src/jdk.dev/share/classes/sun/tools/native2ascii/resources/MsgNative2ascii.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1998, 2010, 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.
- */
-
-package sun.tools.native2ascii.resources;
-
-import java.util.ListResourceBundle;
-
-public class MsgNative2ascii extends ListResourceBundle {
-
- public Object[][] getContents() {
- Object[][] temp = new Object[][] {
- {"err.bad.arg", "-encoding requires argument"},
- {"err.cannot.read", "{0} could not be read."},
- {"err.cannot.write", "{0} could not be written."},
- {"usage", "Usage: native2ascii" +
- " [-reverse] [-encoding encoding] [inputfile [outputfile]]"},
- };
-
- return temp;
- }
-}
--- a/jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java Mon Jun 01 10:15:20 2015 -0700
@@ -173,12 +173,12 @@
* <p>
* This method must be called prior to calling {@link #getResponseBody()}.
* @param rCode the response code to send
- * @param responseLength if > 0, specifies a fixed response body length
- * and that exact number of bytes must be written
+ * @param responseLength if {@literal > 0}, specifies a fixed response
+ * body length and that exact number of bytes must be written
* to the stream acquired from getResponseBody(), or else
* if equal to 0, then chunked encoding is used,
* and an arbitrary number of bytes may be written.
- * if <= -1, then no response body length is specified and
+ * if {@literal <= -1}, then no response body length is specified and
* no response body may be written.
* @see HttpExchange#getResponseBody()
*/
--- a/jdk/src/jdk.jconsole/share/classes/com/sun/tools/jconsole/JConsoleContext.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/jdk.jconsole/share/classes/com/sun/tools/jconsole/JConsoleContext.java Mon Jun 01 10:15:20 2015 -0700
@@ -39,7 +39,6 @@
* {@link ConnectionState#DISCONNECTED DISCONNECTED}.
* The {@code JConsoleContext} instance will be the source for
* any generated events.
- * <p>
*
* @since 1.6
*/
--- a/jdk/src/jdk.rmic/share/classes/sun/tools/javac/resources/javac.properties Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/javac/resources/javac.properties Mon Jun 01 10:15:20 2015 -0700
@@ -498,9 +498,9 @@
javac.err.cant.write=\
Can''t write: {0}
javac.err.fatal.error=\
- An error has occurred in the compiler; please file a bug report (http://bugreport.sun.com/bugreport/).
+ An error has occurred in the compiler; please file a bug report (http://bugreport.java.com/bugreport/).
javac.err.fatal.exception=\
- An exception has occurred in the compiler; please file a bug report (http://bugreport.sun.com/bugreport/).
+ An exception has occurred in the compiler; please file a bug report (http://bugreport.java.com/bugreport/).
javac.err.no.inner.classes=\
Support for inner classes has been disabled.
javac.err.uncaught.exception=\
@@ -634,4 +634,4 @@
[The source classpath is "{0}"]\n\
[The library classpath is "{1}"]
javac.err.invalid.encoding.char=\
- The source file encoding may be different with this platform encoding. Please use -encoding option to adjust file encoding, or apply native2ascii utility to make source file ASCII encoding.
+ The source file encoding may be different with this platform encoding. Please use -encoding option to adjust file encoding, or make sure source file converted to ASCII encoding.
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java Mon Jun 01 10:15:20 2015 -0700
@@ -503,6 +503,7 @@
boolean hasCreateNew = false;
boolean hasCreate = false;
boolean hasAppend = false;
+ boolean hasTruncate = false;
for (OpenOption opt: options) {
if (opt == READ)
throw new IllegalArgumentException("READ not allowed");
@@ -512,7 +513,11 @@
hasCreate = true;
if (opt == APPEND)
hasAppend = true;
+ if (opt == TRUNCATE_EXISTING)
+ hasTruncate = true;
}
+ if (hasAppend && hasTruncate)
+ throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
beginRead(); // only need a readlock, the "update()" will
try { // try to obtain a writelock when the os is
ensureOpen(); // being closed.
@@ -564,6 +569,8 @@
if (!(option instanceof StandardOpenOption))
throw new IllegalArgumentException();
}
+ if (options.contains(APPEND) && options.contains(TRUNCATE_EXISTING))
+ throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
}
// Returns a Writable/ReadByteChannel for now. Might consdier to use
@@ -711,15 +718,19 @@
if (forWrite) {
checkWritable();
if (e == null) {
- if (!options.contains(StandardOpenOption.CREATE_NEW))
- throw new NoSuchFileException(getString(path));
+ if (!options.contains(StandardOpenOption.CREATE) &&
+ !options.contains(StandardOpenOption.CREATE_NEW)) {
+ throw new NoSuchFileException(getString(path));
+ }
} else {
- if (options.contains(StandardOpenOption.CREATE_NEW))
+ if (options.contains(StandardOpenOption.CREATE_NEW)) {
throw new FileAlreadyExistsException(getString(path));
+ }
if (e.isDir())
throw new FileAlreadyExistsException("directory <"
+ getString(path) + "> exists");
}
+ options = new HashSet<>(options);
options.remove(StandardOpenOption.CREATE_NEW); // for tmpfile
} else if (e == null || e.isDir()) {
throw new NoSuchFileException(getString(path));
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java Mon Jun 01 10:15:20 2015 -0700
@@ -773,7 +773,7 @@
{
if (options.length == 0)
return zfs.newOutputStream(getResolvedPath(),
- CREATE_NEW, WRITE);
+ CREATE, TRUNCATE_EXISTING, WRITE);
return zfs.newOutputStream(getResolvedPath(), options);
}
--- a/jdk/test/ProblemList.txt Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/ProblemList.txt Mon Jun 01 10:15:20 2015 -0700
@@ -123,6 +123,9 @@
# 8029891
java/lang/ClassLoader/deadlock/GetResource.java generic-all
+# 8080428
+java/lang/invoke/8022701/MHIllegalAccess.java generic-all
+
############################################################################
# jdk_instrument
--- a/jdk/test/TEST.groups Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/TEST.groups Mon Jun 01 10:15:20 2015 -0700
@@ -214,14 +214,12 @@
jdk/internal/jimage \
jdk/internal/jrtfs \
sun/tools/java \
- sun/tools/native2ascii \
sun/tools/jrunscript
svc_tools = \
com/sun/tools/attach \
sun/tools \
-sun/tools/java \
- -sun/tools/native2ascii \
-sun/tools/jrunscript \
sun/jvmstat \
demo/jvmti
@@ -598,6 +596,10 @@
sun/security/jgss \
sun/security/krb5 \
java/lang/annotation/AnnotationType/AnnotationTypeDeadlockTest.java \
+ java/lang/invoke/lambda/LambdaStackTrace.java \
+ java/lang/invoke/LFCaching/LFGarbageCollectedTest.java \
+ java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java \
+ java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java \
java/lang/System/MacEncoding/TestFileEncoding.java \
java/nio/channels/AsynchronousSocketChannel/Leaky.java \
java/security/PermissionCollection/Concurrent.java \
--- a/jdk/test/com/sun/corba/transport/KeepAliveSockets.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/corba/transport/KeepAliveSockets.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 8017195
* @summary Introduce option to setKeepAlive parameter on CORBA sockets
*
+ * @modules java.corba/com.sun.corba.se.impl.orb java.corba/com.sun.corba.se.impl.transport
* @run main/othervm KeepAliveSockets
* @run main/othervm -Dcom.sun.CORBA.transport.enableTcpKeepAlive KeepAliveSockets
* @run main/othervm -Dcom.sun.CORBA.transport.enableTcpKeepAlive=true KeepAliveSockets
--- a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @bug 8044193
* @summary Test AES ciphers with different modes and padding schemes after
* remove then add provider.
+ * @modules java.base/com.sun.crypto.provider
* @run main/othervm/policy=testAES.policy TestAESWithProviderChange
*/
--- a/jdk/test/com/sun/crypto/provider/Cipher/KeyWrap/XMLEncKAT.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/crypto/provider/Cipher/KeyWrap/XMLEncKAT.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,9 +24,10 @@
/*
* @test
* @bug 5008159 5008156
- * @run main XMLEncKAT
* @summary Verify that the two key wrap ciphers, i.e. "DESedeWrap"
* and "AESWrap", work as expected.
+ * @modules java.base/sun.misc
+ * @run main XMLEncKAT
* @author Valerie Peng
*/
import java.security.Key;
--- a/jdk/test/com/sun/crypto/provider/TLS/TestKeyMaterial.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/crypto/provider/TLS/TestKeyMaterial.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6313661
* @summary Known-answer-test for TlsKeyMaterial generator
* @author Andreas Sterbenz
+ * @modules java.base/sun.security.internal.spec
*/
import java.io.*;
--- a/jdk/test/com/sun/crypto/provider/TLS/TestMasterSecret.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/crypto/provider/TLS/TestMasterSecret.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @bug 6313661
* @summary Known-answer-test for TlsMasterSecret generator
* @author Andreas Sterbenz
+ * @modules java.base/sun.security.internal.interfaces
+ * java.base/sun.security.internal.spec
*/
import java.io.*;
--- a/jdk/test/com/sun/crypto/provider/TLS/TestPRF.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/crypto/provider/TLS/TestPRF.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6313661
* @summary Basic known-answer-test for TlsPrf
* @author Andreas Sterbenz
+ * @modules java.base/sun.security.internal.spec
*/
import java.io.*;
--- a/jdk/test/com/sun/crypto/provider/TLS/TestPRF12.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/crypto/provider/TLS/TestPRF12.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 6313661
+ * @modules java.base/sun.security.internal.spec
* @summary Basic known-answer-test for TlsPrf 12
*
* Vector obtained from the IETF TLS working group mailing list:
--- a/jdk/test/com/sun/crypto/provider/TLS/TestPremaster.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/crypto/provider/TLS/TestPremaster.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6313661
* @summary Basic tests for TlsRsaPremasterSecret generator
* @author Andreas Sterbenz
+ * @modules java.base/sun.security.internal.spec
*/
import java.security.Security;
--- a/jdk/test/com/sun/jndi/cosnaming/CNNameParser.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/jndi/cosnaming/CNNameParser.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @bug 4238914
* @summary Tests that JNDI/COS naming parser supports the syntax
* defined in the new INS standard.
+ * @modules java.corba/com.sun.jndi.cosnaming
*/
import javax.naming.*;
--- a/jdk/test/com/sun/jndi/cosnaming/IiopUrlIPv6.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/jndi/cosnaming/IiopUrlIPv6.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 5042453
* @summary Ipv6 address throws Non-numeric port number error
+ * @modules java.corba/com.sun.jndi.cosnaming
*/
import com.sun.jndi.cosnaming.*;
--- a/jdk/test/com/sun/jndi/dns/Parser.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/jndi/dns/Parser.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8035105
* @summary DNS resource record parsing
+ * @modules jdk.naming.dns/com.sun.jndi.dns
*/
import com.sun.jndi.dns.ResourceRecord;
--- a/jdk/test/com/sun/jndi/ldap/Base64Test.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/jndi/ldap/Base64Test.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8035807
* @summary Confirm that old and new Base64 encodings are compatible.
+ * @modules java.base/sun.misc
*/
import java.io.*;
--- a/jdk/test/com/sun/jndi/ldap/LdapName/Case.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/jndi/ldap/LdapName/Case.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4278094
* @summary Ensure that setValuesCaseSensitive() does not leave name
* in an invalid state.
+ * @modules java.naming/com.sun.jndi.ldap
*/
import com.sun.jndi.ldap.LdapName;
--- a/jdk/test/com/sun/jndi/ldap/LdapName/UnescapeTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/jndi/ldap/LdapName/UnescapeTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4892070
* @summary java gets hung in
* com.sun.jndi.ldap.LdapName$TypeAndValue.unescapeValue()
+ * @modules java.naming/com.sun.jndi.ldap
*/
import com.sun.jndi.ldap.LdapName;
--- a/jdk/test/com/sun/jndi/ldap/LdapURLOptionalFields.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/jndi/ldap/LdapURLOptionalFields.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8074761
* @summary RFC-2255 allows attribute, scope and filter to be empty.
+ * @modules java.naming/com.sun.jndi.ldap
*/
import com.sun.jndi.ldap.LdapURL;
--- a/jdk/test/com/sun/jndi/ldap/LdapUnicodeURL.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/jndi/ldap/LdapUnicodeURL.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6961765
* @summary Double byte characters corrupted in DN for LDAP referrals
+ * @modules java.naming/com.sun.jndi.ldap
*/
import com.sun.jndi.ldap.LdapURL;
--- a/jdk/test/com/sun/jndi/rmi/registry/RegistryContext/ContextWithNullProperties.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/jndi/rmi/registry/RegistryContext/ContextWithNullProperties.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 6676075
* @summary RegistryContext (com.sun.jndi.url.rmi.rmiURLContext) coding problem
+ * @modules jdk.naming.rmi/com.sun.jndi.rmi.registry java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server java.rmi/sun.rmi.transport java.rmi/sun.rmi.transport.tcp
* @library ../../../../../../java/rmi/testlibrary
* @build TestLibrary
* @run main ContextWithNullProperties
--- a/jdk/test/com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,9 @@
* @test
* @bug 4278121
* @summary Ensure that calling unbind() on an unbound name returns
- * successfully.
+ * successfully.
+ * @modules java.rmi/sun.rmi.registry java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport java.rmi/sun.rmi.transport.tcp
* @library ../../../../../../java/rmi/testlibrary
* @build TestLibrary
* @run main UnbindIdempotent
--- a/jdk/test/com/sun/management/VMOptionOpenDataTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/management/VMOptionOpenDataTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,8 @@
* @test
* @bug 8042901
* @summary Check that MappedMXBeanType.toOpenTypeData supports VMOption
+ * @modules java.management/sun.management
+ * jdk.management/com.sun.management
* @author Shanliang Jiang
*/
public class VMOptionOpenDataTest {
--- a/jdk/test/com/sun/net/ssl/SSLSecurity/ProviderTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/net/ssl/SSLSecurity/ProviderTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4667976
+ * @modules java.base/com.sun.net.ssl
* @compile JavaxSSLContextImpl.java ComSSLContextImpl.java
* JavaxTrustManagerFactoryImpl.java ComTrustManagerFactoryImpl.java
* JavaxKeyManagerFactoryImpl.java ComKeyManagerFactoryImpl.java
--- a/jdk/test/com/sun/net/ssl/SSLSecurity/TruncateArray.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/net/ssl/SSLSecurity/TruncateArray.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4665824
* @summary JSSE - ClassCastException with 1.4
+ * @modules java.base/com.sun.net.ssl
*/
import com.sun.net.ssl.*;
--- a/jdk/test/com/sun/org/apache/xml/internal/security/TruncateHMAC.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/org/apache/xml/internal/security/TruncateHMAC.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,10 @@
* @bug 6824440 6858484
* @summary Check that Apache XMLSec APIs will not accept HMAC truncation
* lengths less than minimum bound
+ * @modules java.xml.crypto/com.sun.org.apache.xml.internal.security
+ * java.xml.crypto/com.sun.org.apache.xml.internal.security.c14n
+ * java.xml.crypto/com.sun.org.apache.xml.internal.security.signature
+ * java.xml.crypto/com.sun.org.apache.xml.internal.security.utils
* @compile -XDignore.symbol.file TruncateHMAC.java
* @run main TruncateHMAC
*/
--- a/jdk/test/com/sun/org/apache/xml/internal/security/exceptions/LocaleTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/org/apache/xml/internal/security/exceptions/LocaleTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6454215
* @summary Make sure there are no runtime errors when throwing Apache XML
* Security exceptions in a non-US default locale.
+ * @modules java.xml.crypto/com.sun.org.apache.xml.internal.security.exceptions
* @compile -XDignore.symbol.file LocaleTest.java
* @run main LocaleTest
*/
--- a/jdk/test/com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @author Sean Mullan
* @bug 6461674 8009217 7147060
+ * @modules java.xml.crypto/com.sun.org.apache.xml.internal.security.exceptions
+ * java.xml.crypto/com.sun.org.apache.xml.internal.security.transforms
* @compile -XDignore.symbol.file ClassLoaderTest.java MyTransform.java
* @run main/othervm ClassLoaderTest
* @summary Ensure Transform.register works with transform implementations
--- a/jdk/test/com/sun/org/apache/xml/internal/security/utils/UnsyncByteArrayOutputStream/BufferOverflowTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/org/apache/xml/internal/security/utils/UnsyncByteArrayOutputStream/BufferOverflowTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6954275
* @summary Check that UnsyncByteArrayOutputStream does not
* throw ArrayIndexOutOfBoundsException
+ * @modules java.xml.crypto/com.sun.org.apache.xml.internal.security.utils
* @compile -XDignore.symbol.file BufferOverflowTest.java
* @run main BufferOverflowTest
*/
--- a/jdk/test/com/sun/security/sasl/ntlm/NTLMTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/security/sasl/ntlm/NTLMTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 6911951 7150092
* @summary NTLM should be a supported Java SASL mechanism
+ * @modules java.base/sun.misc
+ * java.security.sasl
*/
import java.io.IOException;
import javax.security.sasl.*;
--- a/jdk/test/com/sun/tools/attach/BasicTests.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java Mon Jun 01 10:15:20 2015 -0700
@@ -37,6 +37,7 @@
* @test
* @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
* @summary Basic unit tests for the VM attach mechanism.
+ * @modules jdk.jartool/sun.tools.jar
* @library /lib/testlibrary
* @modules java.instrument
* java.management
--- a/jdk/test/com/sun/tools/attach/PermissionTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/tools/attach/PermissionTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,7 @@
* @test
* @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
* @summary Basic unit tests for the VM attach mechanism.
+ * @modules jdk.jartool/sun.tools.jar
* @library /lib/testlibrary
* @modules java.management
* jdk.attach
--- a/jdk/test/com/sun/tools/attach/ProviderTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/tools/attach/ProviderTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,7 @@
* @test
* @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
* @summary Basic unit tests for the VM attach mechanism.
+ * @modules jdk.jartool/sun.tools.jar
* @library /lib/testlibrary
* @modules java.management
* jdk.attach
--- a/jdk/test/com/sun/tools/attach/StartManagementAgent.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/tools/attach/StartManagementAgent.java Mon Jun 01 10:15:20 2015 -0700
@@ -39,6 +39,7 @@
/*
* @test
* @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent
+ * @modules jdk.jartool/sun.tools.jar
* @library /lib/testlibrary
* @modules java.management
* jdk.attach
--- a/jdk/test/com/sun/tools/attach/TempDirTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -37,6 +37,7 @@
* @test
* @bug 8033104
* @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
+ * @modules jdk.jartool/sun.tools.jar
* @library /lib/testlibrary
* @modules java.management
* jdk.jartool/sun.tools.jar
--- a/jdk/test/java/awt/TrayIcon/8072769/bug8072769.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/awt/TrayIcon/8072769/bug8072769.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
@author Semyon Sadetsky
@library ../../../../lib/testlibrary
@build jdk.testlibrary.OSInfo
+ @run main bug8072769
*/
import jdk.testlibrary.OSInfo;
--- a/jdk/test/java/lang/Class/getSimpleName/GetSimpleNameTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/Class/getSimpleName/GetSimpleNameTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 8057919
* @summary Class.getSimpleName() should work for non-JLS compliant class names
+ * @modules java.base/jdk.internal.org.objectweb.asm
*/
import jdk.internal.org.objectweb.asm.*;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,7 @@
* 4947220 7018606 7034570 4244896 5049299 8003488 8054494 8058464
* 8067796
* @summary Basic tests for Process and Environment Variable code
+ * @modules java.base/sun.misc
* @run main/othervm/timeout=300 Basic
* @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic
* @author Martin Buchholz
--- a/jdk/test/java/lang/ProcessBuilder/RedirectWithLongFilename.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/ProcessBuilder/RedirectWithLongFilename.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8072611
* @summary ProcessBuilder Redirect to file appending on Windows should work with long file names
+ * @modules java.base/sun.misc
* @author Thomas Stuefe
*/
--- a/jdk/test/java/lang/annotation/AnnotationsInheritanceOrderRedefinitionTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/annotation/AnnotationsInheritanceOrderRedefinitionTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary Test inheritance, order and class redefinition behaviour of RUNTIME
* class annotations
* @author plevart
+ * @modules java.base/sun.reflect.annotation
*/
import sun.reflect.annotation.AnnotationParser;
--- a/jdk/test/java/lang/instrument/PremainClass/NoPremainAgentTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/instrument/PremainClass/NoPremainAgentTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -33,7 +33,7 @@
* @modules java.management
* @run build jdk.testlibrary.* DummyMain
* @run shell ../MakeJAR3.sh NoPremainAgent
- * @run main NoPremainAgentTest
+ * @run main/othervm -XX:-CreateCoredumpOnCrash NoPremainAgentTest
*/
public class NoPremainAgentTest {
// Use a javaagent without the premain() function.
--- a/jdk/test/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -33,7 +33,7 @@
* @modules java.management
* @run build jdk.testlibrary.* DummyMain
* @run shell ../MakeJAR3.sh ZeroArgPremainAgent
- * @run main ZeroArgPremainAgentTest
+ * @run main/othervm -XX:-CreateCoredumpOnCrash ZeroArgPremainAgentTest
*/
public class ZeroArgPremainAgentTest {
// Use a javaagent with a zero argument premain() function.
--- a/jdk/test/java/lang/invoke/8022701/MHIllegalAccess.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/invoke/8022701/MHIllegalAccess.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @test
* @bug 8022701
* @summary Illegal access exceptions via methodhandle invocations threw wrong error.
- *
+ * @modules java.base/jdk.internal.org.objectweb.asm
* @compile -XDignore.symbol.file BogoLoader.java InvokeSeveralWays.java MHIllegalAccess.java MethodSupplier.java
* @run main/othervm MHIllegalAccess
*/
--- a/jdk/test/java/lang/invoke/RevealDirectTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/invoke/RevealDirectTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @summary verify Lookup.revealDirect on a variety of input handles
+ * @modules java.base/sun.reflect
* @compile -XDignore.symbol.file RevealDirectTest.java
* @run junit/othervm -ea -esa test.java.lang.invoke.RevealDirectTest
*
--- a/jdk/test/java/lang/invoke/VMAnonymousClass.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/invoke/VMAnonymousClass.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 8046903
* @summary VM anonymous class members can't be statically invocable
+ * @modules java.base/sun.misc java.base/jdk.internal.org.objectweb.asm
* @run junit test.java.lang.invoke.VMAnonymousClass
*/
package test.java.lang.invoke;
--- a/jdk/test/java/lang/invoke/accessProtectedSuper/Test.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/invoke/accessProtectedSuper/Test.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @test
* @bug 8022718
* @summary Runtime accessibility checking: protected class, if extended, should be accessible from another package
- *
+ * @modules java.base/jdk.internal.org.objectweb.asm
* @compile -XDignore.symbol.file BogoLoader.java MethodInvoker.java Test.java anotherpkg/MethodSupplierOuter.java
* @run main/othervm Test
*/
--- a/jdk/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -76,7 +76,7 @@
doprivJava.delete();
doprivClass.delete();
tr = doExec(JAVA_CMD.getAbsolutePath(),
- "-Xbootclasspath/p:foo.jar",
+ "-Xbootclasspath/a:foo.jar",
"-cp", ".", "Bar");
tr.assertZero("testDoPrivileged fails");
barJava.delete();
--- a/jdk/test/java/lang/invoke/lambda/LambdaAsm.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/invoke/lambda/LambdaAsm.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @bug 8027232
* @summary ensures that j.l.i.InvokerByteCodeGenerator and ASM visitMethodInsn
* generate bytecodes with correct constant pool references
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ * jdk.compiler/com.sun.tools.classfile
* @compile -XDignore.symbol.file LambdaAsm.java LUtils.java
* @run main/othervm LambdaAsm
*/
@@ -133,7 +135,7 @@
int mcount = 0;
try (DirectoryStream<Path> ds = newDirectoryStream(new File(".").toPath(),
// filter in lambda proxy classes
- "A$I$$Lambda$?.class")) {
+ "A$I$$Lambda$*.class")) {
for (Path p : ds) {
System.out.println(p.toFile());
ClassFile cf = ClassFile.read(p.toFile());
--- a/jdk/test/java/lang/invoke/lambda/LambdaStackTrace.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/invoke/lambda/LambdaStackTrace.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8025636
* @summary Synthetic frames should be hidden in exceptions
+ * @modules java.base/jdk.internal.org.objectweb.asm
* @compile -XDignore.symbol.file LUtils.java LambdaStackTrace.java
* @run main LambdaStackTrace
*/
--- a/jdk/test/java/lang/invoke/lookup/SpecialStatic.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/invoke/lookup/SpecialStatic.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 8032400
* @summary JSR292: invokeSpecial: InternalError attempting to lookup a method
+ * @modules java.base/jdk.internal.org.objectweb.asm
* @compile -XDignore.symbol.file SpecialStatic.java
* @run junit test.java.lang.invoke.lookup.SpecialStatic
*/
--- a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,9 +32,30 @@
*/
import java.lang.management.*;
+import java.time.Instant;
import java.util.concurrent.Phaser;
+import java.util.function.Supplier;
public class AllThreadIds {
+ /**
+ * A supplier wrapper for the delayed format printing.
+ * The supplied value will have to be formatted as <em>$s</em>
+ * @param <T> The wrapped type
+ */
+ private static final class ArgWrapper<T> {
+ private final Supplier<T> val;
+
+ public ArgWrapper(Supplier<T> val) {
+ this.val = val;
+ }
+
+ @Override
+ public String toString() {
+ T resolved = val.get();
+ return resolved != null ? resolved.toString() : null;
+ }
+ }
+
final static int DAEMON_THREADS = 20;
final static int USER_THREADS = 5;
final static int ALL_THREADS = DAEMON_THREADS + USER_THREADS;
@@ -47,15 +68,10 @@
private static long prevTotalThreadCount = 0;
private static int prevLiveThreadCount = 0;
private static int prevPeakThreadCount = 0;
- private static long curTotalThreadCount = 0;
- private static int curLiveThreadCount = 0;
- private static int curPeakThreadCount = 0;
private static final Phaser startupCheck = new Phaser(ALL_THREADS + 1);
private static void printThreadList() {
- if (!trace) return;
-
long[] list = mbean.getAllThreadIds();
for (int i = 1; i <= list.length; i++) {
System.out.println(i + ": Thread id = " + list[i-1]);
@@ -68,59 +84,13 @@
}
}
- private static void fail(String msg) {
- trace = true;
- printThreadList();
- throw new RuntimeException(msg);
+ private static void checkInitialState() throws Exception {
+ updateCounters();
+ checkThreadCount(0, 0);
}
- private static void checkThreadCount(int numNewThreads,
- int numTerminatedThreads)
- throws Exception {
- prevTotalThreadCount = curTotalThreadCount;
- prevLiveThreadCount = curLiveThreadCount;
- prevPeakThreadCount = curPeakThreadCount;
- curTotalThreadCount = mbean.getTotalStartedThreadCount();
- curLiveThreadCount = mbean.getThreadCount();
- curPeakThreadCount = mbean.getPeakThreadCount();
-
- if ((curLiveThreadCount - prevLiveThreadCount) !=
- (numNewThreads - numTerminatedThreads)) {
- fail("Unexpected number of live threads: " +
- " Prev live = " + prevLiveThreadCount +
- " Current live = " + curLiveThreadCount +
- " Threads added = " + numNewThreads +
- " Threads terminated = " + numTerminatedThreads);
- }
- if (curPeakThreadCount - prevPeakThreadCount != numNewThreads) {
- fail("Unexpected number of peak threads: " +
- " Prev peak = " + prevPeakThreadCount +
- " Current peak = " + curPeakThreadCount +
- " Threads added = " + numNewThreads);
- }
- if (curTotalThreadCount - prevTotalThreadCount != numNewThreads) {
- fail("Unexpected number of total threads: " +
- " Prev Total = " + prevTotalThreadCount +
- " Current Total = " + curTotalThreadCount +
- " Threads added = " + numNewThreads);
- }
- long[] list = mbean.getAllThreadIds();
- if (list.length != curLiveThreadCount) {
- fail("Array length returned by " +
- "getAllThreadIds() = " + list.length +
- " not matched count = " + curLiveThreadCount);
- }
- }
-
- public static void main(String args[]) throws Exception {
- if (args.length > 0 && args[0].equals("trace")) {
- trace = true;
- }
-
- curTotalThreadCount = mbean.getTotalStartedThreadCount();
- curLiveThreadCount = mbean.getThreadCount();
- curPeakThreadCount = mbean.getPeakThreadCount();
- checkThreadCount(0, 0);
+ private static void checkAllThreadsAlive() throws Exception {
+ updateCounters();
// Start all threads and wait to be sure they all are alive
for (int i = 0; i < ALL_THREADS; i++) {
@@ -133,8 +103,9 @@
startupCheck.arriveAndAwaitAdvance();
checkThreadCount(ALL_THREADS, 0);
- printThreadList();
-
+ if (trace) {
+ printThreadList();
+ }
// Check mbean now. All threads must appear in getAllThreadIds() list
long[] list = mbean.getAllThreadIds();
@@ -165,6 +136,10 @@
if (trace) {
System.out.println();
}
+ }
+
+ private static void checkDaemonThreadsDead() throws Exception {
+ updateCounters();
// Stop daemon threads, wait to be sure they all are dead, and check
// that they disappeared from getAllThreadIds() list
@@ -179,7 +154,7 @@
checkThreadCount(0, DAEMON_THREADS);
// Check mbean now
- list = mbean.getAllThreadIds();
+ long[] list = mbean.getAllThreadIds();
for (int i = 0; i < ALL_THREADS; i++) {
long expectedId = allThreads[i].getId();
@@ -208,6 +183,10 @@
}
}
}
+ }
+
+ private static void checkAllThreadsDead() throws Exception {
+ updateCounters();
// Stop all threads and wait to be sure they all are dead
for (int i = DAEMON_THREADS; i < ALL_THREADS; i++) {
@@ -219,6 +198,127 @@
// and check the thread count
checkThreadCount(0, ALL_THREADS - DAEMON_THREADS);
+ }
+
+ private static void checkThreadCount(int numNewThreads,
+ int numTerminatedThreads)
+ throws Exception {
+
+ checkLiveThreads(numNewThreads, numTerminatedThreads);
+ checkPeakThreads(numNewThreads);
+ checkTotalThreads(numNewThreads);
+ checkThreadIds();
+ }
+
+ private static void checkLiveThreads(int numNewThreads,
+ int numTerminatedThreads)
+ throws InterruptedException {
+ int diff = numNewThreads - numTerminatedThreads;
+
+ waitTillEquals(
+ diff + prevLiveThreadCount,
+ ()->(long)mbean.getThreadCount(),
+ "Unexpected number of live threads: " +
+ " Prev live = %1$d Current live = ${provided} Threads added = %2$d" +
+ " Threads terminated = %3$d",
+ ()->prevLiveThreadCount,
+ ()->numNewThreads,
+ ()->numTerminatedThreads
+ );
+ }
+
+ private static void checkPeakThreads(int numNewThreads)
+ throws InterruptedException {
+
+ waitTillEquals(numNewThreads + prevPeakThreadCount,
+ ()->(long)mbean.getPeakThreadCount(),
+ "Unexpected number of peak threads: " +
+ " Prev peak = %1$d Current peak = ${provided} Threads added = %2$d",
+ ()->prevPeakThreadCount,
+ ()->numNewThreads
+ );
+ }
+
+ private static void checkTotalThreads(int numNewThreads)
+ throws InterruptedException {
+
+ waitTillEquals(numNewThreads + prevTotalThreadCount,
+ ()->mbean.getTotalStartedThreadCount(),
+ "Unexpected number of total threads: " +
+ " Prev Total = %1$d Current Total = ${provided} Threads added = %2$d",
+ ()->prevTotalThreadCount,
+ ()->numNewThreads
+ );
+ }
+
+ private static void checkThreadIds() throws InterruptedException {
+ long[] list = mbean.getAllThreadIds();
+
+ waitTillEquals(
+ list.length,
+ ()->(long)mbean.getThreadCount(),
+ "Array length returned by " +
+ "getAllThreadIds() = %1$d not matched count = ${provided}",
+ ()->list.length
+ );
+ }
+
+ /**
+ * Waits till the <em>expectedVal</em> equals to the <em>retrievedVal</em>.
+ * It will report a status message on the first occasion of the value mismatch
+ * and then, subsequently, when the <em>retrievedVal</em> value changes.
+ * @param expectedVal The value to wait for
+ * @param retrievedVal The supplier of the value to check against the <em>expectedVal</em>
+ * @param msgFormat The formatted message to be printed in case of mismatch
+ * @param msgArgs The parameters to the formatted message
+ * @throws InterruptedException
+ */
+ private static void waitTillEquals(long expectedVal, Supplier<Long> retrievedVal,
+ String msgFormat, Supplier<Object> ... msgArgs)
+ throws InterruptedException {
+ Object[] args = null;
+
+ long countPrev = -1;
+ while (true) {
+ Long count = retrievedVal.get();
+ if (count == expectedVal) break;
+ if (countPrev == -1 || countPrev != count) {
+ if (args == null) {
+ args = new Object[msgArgs.length];
+ for(int i=0; i < msgArgs.length; i++) {
+ args[i] = new ArgWrapper<>((Supplier<Object>)msgArgs[i]);
+ }
+ }
+ System.err.format("TS: %s\n", Instant.now());
+ System.err.format(
+ msgFormat
+ .replace("${provided}", String.valueOf(count))
+ .replace("$d", "$s"),
+ args
+ ).flush();
+ printThreadList();
+ System.err.println("\nRetrying ...\n");
+ }
+ countPrev = count;
+ Thread.sleep(1);
+ }
+ }
+
+ private static void updateCounters() {
+ prevTotalThreadCount = mbean.getTotalStartedThreadCount();
+ prevLiveThreadCount = mbean.getThreadCount();
+ prevPeakThreadCount = mbean.getPeakThreadCount();
+ }
+
+ public static void main(String args[]) throws Exception {
+ if (args.length > 0 && args[0].equals("trace")) {
+ trace = true;
+ }
+
+ checkInitialState();
+ checkAllThreadsAlive();
+ checkDaemonThreadsDead();
+ checkAllThreadsDead();
if (testFailed)
throw new RuntimeException("TEST FAILED.");
--- a/jdk/test/java/lang/reflect/Generics/TestBadSignatures.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/reflect/Generics/TestBadSignatures.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6832374 7052898
* @summary Test bad signatures get a GenericSignatureFormatError thrown.
* @author Joseph D. Darcy
+ * @modules java.base/sun.reflect.generics.parser
*/
import java.lang.reflect.*;
--- a/jdk/test/java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 8026213
* @summary Reflection support for private methods in interfaces
* @author Robert Field
+ * @modules java.base/jdk.internal.org.objectweb.asm
* @run main TestPrivateInterfaceMethodReflect
*/
--- a/jdk/test/java/net/Authenticator/B4678055.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/Authenticator/B4678055.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4678055
+ * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @run main B4678055
--- a/jdk/test/java/net/Authenticator/B4722333.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/Authenticator/B4722333.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4722333
+ * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @run main B4722333
--- a/jdk/test/java/net/Authenticator/B4759514.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/Authenticator/B4759514.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4759514
+ * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @run main B4759514
--- a/jdk/test/java/net/Authenticator/B4921848.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/Authenticator/B4921848.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4921848
+ * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @run main/othervm -Dhttp.auth.preference=basic B4921848
--- a/jdk/test/java/net/Authenticator/B4962064.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/Authenticator/B4962064.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4962064
+ * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @run main/othervm B4962064
--- a/jdk/test/java/net/Authenticator/B6870935.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/Authenticator/B6870935.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 6870935
+ * @modules java.base/sun.net.www
* @run main/othervm -Dhttp.nonProxyHosts="" -Dhttp.auth.digest.validateProxy=true B6870935
*/
--- a/jdk/test/java/net/Inet4Address/textToNumericFormat.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/Inet4Address/textToNumericFormat.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4749938
* @summary Bug in the parsing IPv4 literal addresses
+ * @modules java.base/sun.net.spi.nameservice
* @compile -XDignore.symbol.file=true DummyNameService.java DummyNameServiceDescriptor.java
* @run main/othervm -Dsun.net.spi.nameservice.provider.1=dummy,oracle textToNumericFormat
*/
--- a/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java Mon Jun 01 10:15:20 2015 -0700
@@ -156,12 +156,13 @@
// now check which network interface this packet comes from
NetworkInterface from = NetworkInterface.getByInetAddress(packet.getAddress());
NetworkInterface shouldbe = nic;
- if (!from.equals(shouldbe)) {
- System.out.println("Packets on group "
+ if (from != null) {
+ if (!from.equals(shouldbe)) {
+ System.out.println("Packets on group "
+ group + " should come from "
+ shouldbe.getName() + ", but came from "
+ from.getName());
- //throw new RuntimeException("Test failed.");
+ }
}
mcastsock.leaveGroup(new InetSocketAddress(group, PORT), nic);
--- a/jdk/test/java/net/MulticastSocket/TestInterfaces.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/MulticastSocket/TestInterfaces.java Mon Jun 01 10:15:20 2015 -0700
@@ -46,6 +46,11 @@
while (nifs.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface)nifs.nextElement();
+ // JDK-8022963, Skip (Windows) Teredo Tunneling Pseudo-Interface
+ String dName = ni.getDisplayName();
+ if (isWindows && dName != null && dName.contains("Teredo"))
+ continue;
+
/*
* Test MulticastSocket.getInterface
*/
@@ -92,10 +97,6 @@
continue;
}
- // JDK-8022963, Skip (Windows) Teredo Tunneling Pseudo-Interface
- String dName = ni.getDisplayName();
- if (isWindows && dName != null && dName.contains("Teredo"))
- continue;
NetworkInterface curr = soc.getNetworkInterface();
if (!curr.equals(ni)) {
--- a/jdk/test/java/net/ProxySelector/LoopbackAddresses.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/ProxySelector/LoopbackAddresses.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 4924226
* @summary PIT: Can no launch jnlp application via 127.0.0.1 address on the web server
+ * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/
* @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback
* @compile LoopbackAddresses.java
--- a/jdk/test/java/net/ProxySelector/ProxyTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/ProxySelector/ProxyTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4696512
* @summary HTTP client: Improve proxy server configuration and selection
+ * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/
* @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback
* @compile ProxyTest.java
--- a/jdk/test/java/net/Socket/HttpProxy.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/Socket/HttpProxy.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6370908
* @summary Add support for HTTP_CONNECT proxy in Socket class
+ * @modules java.base/sun.net.www
*/
import java.io.IOException;
--- a/jdk/test/java/net/URL/PerConnectionProxy.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/URL/PerConnectionProxy.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 4920526
* @summary Needs per connection proxy support for URLs
+ * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/
* @build ClosedChannelList TestHttpServer HttpTransaction HttpCallback
* @compile PerConnectionProxy.java
--- a/jdk/test/java/net/URL/SpecifyHandler.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/URL/SpecifyHandler.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4135031
* @summary Test new URL contructors that allow specification of a
* URLStreamHandler protocol handler.
+ * @modules java.base/sun.net.www.protocol.file
*/
import java.net.*;
--- a/jdk/test/java/net/URLConnection/B5052093.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/URLConnection/B5052093.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 5052093
+ * @modules java.base/sun.net.www java.base/sun.net.www.protocol.file
* @library ../../../sun/net/www/httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @run main B5052093
--- a/jdk/test/java/net/URLConnection/HandleContentTypeWithAttrs.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/net/URLConnection/HandleContentTypeWithAttrs.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4160200
* @summary Make sure URLConnection.getContnentHandler
* can handle MIME types with attributes
+ * @modules java.base/sun.net.www java.base/sun.net.www.content.text
*/
import java.net.*;
import java.io.*;
--- a/jdk/test/java/nio/file/Files/InterruptCopy.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/nio/file/Files/InterruptCopy.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 4313887 6993267
* @summary Unit test for Sun-specific ExtendedCopyOption.INTERRUPTIBLE option
+ * @modules java.base/com.sun.nio.file
* @library ..
*/
--- a/jdk/test/java/nio/file/Files/SBC.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/nio/file/Files/SBC.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @bug 4313887
* @summary Unit test for java.nio.file.Files.newByteChannel
* @library ..
+ * @modules java.base/com.sun.nio.file
*/
import java.nio.ByteBuffer;
--- a/jdk/test/java/nio/file/WatchService/FileTreeModifier.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/nio/file/WatchService/FileTreeModifier.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @bug 4313887 6838333
* @summary Sanity test for Sun-specific FILE_TREE watch event modifier
* @library ..
+ * @modules java.base/com.sun.nio.file
*/
import java.nio.file.*;
--- a/jdk/test/java/nio/file/WatchService/SensitivityModifier.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/nio/file/WatchService/SensitivityModifier.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 4313887
* @summary Sanity test for Sun-specific sensitivity level watch event modifier
+ * @modules java.base/com.sun.nio.file
* @library ..
* @run main/timeout=240 SensitivityModifier
* @key randomness
--- a/jdk/test/java/nio/file/WatchService/WithSecurityManager.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/nio/file/WatchService/WithSecurityManager.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 4313887
* @summary Unit test for Watchable#register's permission checks
+ * @modules java.base/com.sun.nio.file
* @build WithSecurityManager
* @run main/othervm WithSecurityManager denyAll.policy - fail
* @run main/othervm WithSecurityManager denyAll.policy tree fail
--- a/jdk/test/java/rmi/Naming/DefaultRegistryPort.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/Naming/DefaultRegistryPort.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @summary change in default URL port causes regression in java.rmi.Naming
* @author Dana Burns
* @library ../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm DefaultRegistryPort
*/
--- a/jdk/test/java/rmi/Naming/LookupIPv6.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/Naming/LookupIPv6.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,10 @@
* IPv6 addresses.
* @bug 4402708
* @library ../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm -Djava.net.preferIPv6Addresses=true LookupIPv6
*/
--- a/jdk/test/java/rmi/Naming/LookupNameWithColon.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/Naming/LookupNameWithColon.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* containing embedded ':' characters.
*
* @library ../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm LookupNameWithColon
*/
--- a/jdk/test/java/rmi/Naming/RmiIsNoScheme.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/Naming/RmiIsNoScheme.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Ann Wollrath
*
* @library ../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm RmiIsNoScheme
*/
--- a/jdk/test/java/rmi/Naming/UnderscoreHost.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/Naming/UnderscoreHost.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Vinod Johnson
*
* @library ../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary UnderscoreHost_Stub
* @run main/othervm UnderscoreHost
*/
--- a/jdk/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @summary Naming assumes '/' is present in relative URL; change in URL causes regression
* @author Dana Burns
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Legal LegalRegistryNames_Stub
* @run main/othervm LegalRegistryNames
*/
--- a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java Mon Jun 01 10:15:20 2015 -0700
@@ -36,6 +36,10 @@
* functionality is in place
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivateMe CheckActivateRef_Stub
* @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=true CheckActivateRef
* @run main/othervm/policy=security.policy/timeout=240 -Djava.rmi.server.ignoreStubClasses=false CheckActivateRef
--- a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Laird Dornin; code borrowed from Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID MyRMI CheckAnnotations_Stub
* @run main/othervm/policy=security.policy/timeout=480 CheckAnnotations
*/
--- a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @author Laird Dornin; code borrowed from Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID
* MyRMI ActivatableImpl ActivatableImpl ActivatableImpl_Stub
* @run main/othervm/policy=security.policy/timeout=150 CheckImplClassLoader
--- a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* ActivateMe CheckRegisterInLog_Stub
* @run main/othervm/policy=security.policy/timeout=240 CheckRegisterInLog
--- a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @author Laird Dornin
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivateMe
* @run main/othervm/policy=security.policy/timeout=240 CreatePrivateActivatable
*/
--- a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* @author Peter Jones (much code taken from Ann Wollrath's activation tests)
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* Foo FooReceiverImpl FooReceiverImpl_Stub Bar
* @run main/othervm/policy=security.policy/timeout=240 DownloadParameterClass
--- a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @author Laird Dornin
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivateMe ElucidateNoSuchMethod_Stub
* @run main/othervm/policy=security.policy/timeout=240 ElucidateNoSuchMethod
*/
--- a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @author Laird Dornin
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* ActivateMe ForceLogSnapshot_Stub
* @run main/othervm/policy=security.policy/timeout=640 ForceLogSnapshot
--- a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary ActivateMe InactiveGroup_Stub
* @run main/othervm/policy=security.policy/timeout=240 InactiveGroup
*/
--- a/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* @run main/othervm/timeout=240 LookupActivationSystem
*/
--- a/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary ActivateMe NestedActivate_Stub
* @run main/othervm/policy=security.policy/timeout=240 NestedActivate
*/
--- a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* ActivateMe NonExistentActivatable_Stub
* @run main/othervm/policy=security.policy/timeout=240 NonExistentActivatable
--- a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivateMe RestartCrashedService_Stub
* @run main/othervm/policy=security.policy/timeout=240 RestartCrashedService
*/
--- a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* RestartLatecomer RestartLatecomer_Stub
* @run main/othervm/policy=security.policy/timeout=240 RestartLatecomer
--- a/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary ActivateMe RestartService_Stub
* @run main/othervm/policy=security.policy/timeout=240 RestartService
*/
--- a/jdk/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Laird Dornin; code borrowed from Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID
* TestSecurityManager RegisteringActivatable ShutdownGracefully_Stub
* @run main/othervm/policy=security.policy/timeout=700 ShutdownGracefully
--- a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary ActivateMe UnregisterInactive_Stub
* @run main/othervm/policy=security.policy/timeout=240 UnregisterInactive
*/
--- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* ActivateMe ActivateFails_Stub ShutdownThread
* @run main/othervm/java.security.policy=security.policy/timeout=240 ActivateFails
--- a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* DownloadActivationGroup MyActivationGroupImpl DownloadActivationGroup_Stub
* @run main/othervm/policy=security.policy/timeout=240 DownloadActivationGroup
--- a/jdk/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/ActivationGroupDesc/checkDefaultGroupName/CheckDefaultGroupName.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,10 @@
* @author Laird Dornin
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main CheckDefaultGroupName
*/
--- a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* @run main/othervm/policy=security.policy/timeout=480 IdempotentActiveGroup
*/
--- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* ActivateMe ModifyDescriptor_Stub
* @run main/othervm/policy=security.policy/timeout=240 ModifyDescriptor
--- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,11 @@
* @author Laird Dornin
*
* @library ../../../testlibrary
+ * @modules java.base/sun.security.provider
+ * java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* CanCreateStubs StubClassesPermitted_Stub
* @run main/othervm/java.security.policy=security.policy/secure=java.lang.SecurityManager/timeout=240 StubClassesPermitted
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary ActivateMe
* @run main/othervm/policy=security.policy UnregisterGroup
*/
--- a/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java Mon Jun 01 10:15:20 2015 -0700
@@ -35,6 +35,10 @@
* @author Adrian Colley
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* Eliza Retireable Doctor Doctor_Stub
* @run main/othervm/timeout=240/policy=security.policy
--- a/jdk/test/java/rmi/activation/log/LogTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/log/LogTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,7 @@
* boundaries
* @author Ann Wollrath
*
+ * @modules java.rmi/sun.rmi.log
* @run main/othervm/timeout=240 LogTest
*/
--- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,11 @@
* @author Peter Jones
*
* @library ../../testlibrary
+ * @modules java.base/sun.nio.ch
+ * java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* @run main/othervm/timeout=240 InheritedChannelNotServerSocket
*/
--- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,11 @@
* @author Ann Wollrath
*
* @library ../../testlibrary
+ * @modules java.base/sun.nio.ch
+ * java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID ActivationLibrary
* @run main/othervm/timeout=240 RmidViaInheritedChannel
*/
--- a/jdk/test/java/rmi/dgc/VMID/CheckVMID.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/dgc/VMID/CheckVMID.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,10 @@
* @author Ann Wollrath
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm/policy=security.policy CheckVMID
*/
--- a/jdk/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/dgc/dgcImplInsulation/DGCImplInsulation.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* @author Peter Jones
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary DGCImplInsulation_Stub
* @run main/othervm/policy=security.policy DGCImplInsulation
*/
--- a/jdk/test/java/rmi/invalidName/InvalidName.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/invalidName/InvalidName.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,10 @@
* @author Laird Dornin
*
* @library ../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm InvalidName
*/
--- a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @author Laird Dornin
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary JavaVM RMID TestSecurityManager
* @run main/othervm AltSecurityManager
*/
--- a/jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/registry/classPathCodebase/ClassPathCodebase.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,10 @@
* @author Peter Jones
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Dummy
* @run main/othervm/policy=security.policy
* -Djava.rmi.server.useCodebaseOnly=false ClassPathCodebase
--- a/jdk/test/java/rmi/registry/emptyName/EmptyName.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/registry/emptyName/EmptyName.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,10 @@
* @bug 4399304
* @summary check that registry allows empty names
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm EmptyName
*/
--- a/jdk/test/java/rmi/registry/interfaceHash/InterfaceHash.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/registry/interfaceHash/InterfaceHash.java Mon Jun 01 10:15:20 2015 -0700
@@ -36,6 +36,10 @@
*
* @author Peter Jones
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary ReferenceRegistryStub
* @run main/othervm InterfaceHash
* @key intermittent
--- a/jdk/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/registry/multipleRegistries/MultipleRegistries.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* @author Ann Wollrath
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm/timeout=240 MultipleRegistries
*/
--- a/jdk/test/java/rmi/registry/reexport/Reexport.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/registry/reexport/Reexport.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,10 @@
* @bug 4120329
* @summary RMI registry creation is impossible if first attempt fails.
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary JavaVM RegistryRunner RegistryRunner_Stub
* @run main/othervm Reexport
*/
--- a/jdk/test/java/rmi/reliability/benchmark/bench/rmi/Main.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/rmi/Main.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,11 @@
* @summary The RMI benchmark test. This java class is used to run the test
* under JTREG.
* @library ../../../../testlibrary ../../
+ * @modules java.desktop
+ * java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary bench.BenchInfo bench.HtmlReporter bench.Util
* bench.Benchmark bench.Reporter bench.XmlReporter bench.ConfigFormatException
* bench.Harness bench.TextReporter bench.rmi.BenchServer
--- a/jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/reliability/juicer/AppleUserImpl.java Mon Jun 01 10:15:20 2015 -0700
@@ -55,6 +55,10 @@
* has been reached.
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* Apple AppleEvent AppleImpl
* Orange OrangeEcho OrangeEchoImpl OrangeImpl
--- a/jdk/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/delegateBeforePermissionCheck/DelegateBeforePermissionCheck.java Mon Jun 01 10:15:20 2015 -0700
@@ -33,6 +33,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Foo
* @run main/othervm DelegateBeforePermissionCheck
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/DelegateToContextLoader.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Dummy
* @run main/othervm/policy=security.policy/timeout=120 DelegateToContextLoader
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/DownloadArrayClass.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Receiver DownloadArrayClass_Stub Foo
* @run main/othervm/policy=security.policy DownloadArrayClass
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/getClassAnnotation/NullClass.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm NullClass
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/getClassLoader/GetClassLoader.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Foo
* @run main/othervm/policy=security.policy GetClassLoader
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/LoadProxyClasses.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,10 @@
* @author Laird Dornin
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary FnnClass FnnUnmarshal NonpublicInterface
* NonpublicInterface1 PublicInterface PublicInterface1
* @run main/othervm/policy=security.policy
--- a/jdk/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/ContextInsulation.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary ServiceConfiguration TestProvider TestProvider2
* @run main/othervm/policy=security.policy ContextInsulation
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/DefaultProperty.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary ServiceConfiguration Foo
* @run main/othervm/policy=security.policy DefaultProperty
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/spi/Installed.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/Installed.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary ServiceConfiguration TestProvider TestProvider2
* @run main/othervm/policy=security.policy Installed
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/InvalidProperty.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary ServiceConfiguration
* @run main/othervm/policy=security.policy InvalidProperty
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/spi/Property.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/Property.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary ServiceConfiguration TestProvider
* @run main/othervm/policy=security.policy Property
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/UseCodebaseOnly.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Receiver UseCodebaseOnly_Stub Foo Bar
* @run main/othervm/policy=security.policy UseCodebaseOnly
*/
--- a/jdk/test/java/rmi/server/RMIClassLoader/useCodebaseOnlyDefault/UseCodebaseOnlyDefault.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/useCodebaseOnlyDefault/UseCodebaseOnlyDefault.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary Tests proper parsing and defaulting of the
* "java.rmi.server.useCodebaseOnly" property.
*
+ * @modules java.rmi/sun.rmi.server
* @run main/othervm UseCodebaseOnlyDefault true
* @run main/othervm -Djava.rmi.server.useCodebaseOnly=xyzzy UseCodebaseOnlyDefault true
* @run main/othervm -Djava.rmi.server.useCodebaseOnly UseCodebaseOnlyDefault true
--- a/jdk/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMIClassLoader/useGetURLs/UseGetURLs.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Dummy
* @run main/othervm/policy=security.policy/timeout=120 UseGetURLs
*/
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Ann Wollrath
*
* @library ../../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Echo EchoImpl EchoImpl_Stub
* @run main/othervm/policy=security.policy/timeout=360 UseCustomSocketFactory
*/
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Laird Dornin; code borrowed from Ann Wollrath
*
* @library ../../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Compress Hello HelloImpl HelloImpl_Stub
* @run main/othervm/policy=security.policy/timeout=240 UseCustomSocketFactory
*/
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Ann Wollrath
*
* @library ../../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary RMID JavaVM Echo EchoImpl EchoImpl_Stub
* @run main/othervm/policy=security.policy/timeout=120 UseCustomSocketFactory
*/
--- a/jdk/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/RemoteObject/verifyRemoteEquals/VerifyRemoteEquals.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Laird Dornin
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm/timeout=40 VerifyRemoteEquals
*/
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary JavaVM KeepAliveDuringCall_Stub
* ShutdownMonitor Shutdown ShutdownImpl ShutdownImpl_Stub
* @run main/othervm KeepAliveDuringCall
--- a/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,10 @@
* @author Ann Wollrath
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary UnexportLeak_Stub Ping
* @run main/othervm UnexportLeak
*/
--- a/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/Unmarshal/checkUnmarshalOnStopThread/CheckUnmarshalOnStopThread.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* @author Laird Dornin
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary CheckUnmarshal CheckUnmarshalOnStopThread_Stub
* PoisonPill RuntimeExceptionParameter
* @run main/othervm/timeout=480 CheckUnmarshalOnStopThread
--- a/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java Mon Jun 01 10:15:20 2015 -0700
@@ -35,6 +35,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary FiniteGCLatency_Stub
* @run main/othervm/timeout=120 FiniteGCLatency
*/
--- a/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java Mon Jun 01 10:15:20 2015 -0700
@@ -37,6 +37,10 @@
* @author Peter Jones
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary JavaVM LeaseCheckInterval_Stub SelfTerminator
* @run main/othervm LeaseCheckInterval
*/
--- a/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java Mon Jun 01 10:15:20 2015 -0700
@@ -39,6 +39,10 @@
* @author Laird Dornin
*
* @library ../../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary UnreferencedContext_Stub
* @run main/othervm/timeout=120 UnreferencedContext
*/
--- a/jdk/test/java/rmi/server/clientStackTrace/ClientStackTrace.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/clientStackTrace/ClientStackTrace.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Laird Dornin
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary ClientStackTrace MyRemoteObject_Stub
* @run main/othervm/policy=security.policy/timeout=120 ClientStackTrace
*/
--- a/jdk/test/java/rmi/server/getRemoteClass/GetRemoteClass.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/getRemoteClass/GetRemoteClass.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Laird Dornin
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm GetRemoteClass
*/
--- a/jdk/test/java/rmi/server/useCustomRef/UseCustomRef.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/server/useCustomRef/UseCustomRef.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* 4180392
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Ping UseCustomRef_Stub UseCustomRef_Skel
* @run main/othervm/policy=security.policy/secure=java.rmi.RMISecurityManager/timeout=120 UseCustomRef
*
--- a/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/transport/checkFQDN/CheckFQDN.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, 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
@@ -33,6 +33,10 @@
* @author Laird Dornin
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary CheckFQDNClient CheckFQDN_Stub TellServerName
* @run main/othervm/timeout=120 CheckFQDN
*/
--- a/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Laird Dornin
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary CheckLeaseLeak_Stub LeaseLeakClient LeaseLeak
* @run main/othervm/timeout=240 CheckLeaseLeak
*
--- a/jdk/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/transport/closeServerSocket/CloseServerSocket.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* @author Peter Jones
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm CloseServerSocket
*/
--- a/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Laird Dornin
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Test TestImpl TestImpl_Stub
* @run main/othervm/policy=security.policy/timeout=360 DGCDeadLock
*/
--- a/jdk/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/transport/handshakeFailure/HandshakeFailure.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* @author Peter Jones
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm HandshakeFailure
*/
--- a/jdk/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/transport/handshakeTimeout/HandshakeTimeout.java Mon Jun 01 10:15:20 2015 -0700
@@ -34,6 +34,10 @@
* @author Peter Jones
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm HandshakeTimeout
*/
--- a/jdk/test/java/rmi/transport/httpSocket/HttpSocketTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/transport/httpSocket/HttpSocketTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,11 @@
* @author Dana Burns
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.proxy
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary HttpSocketTest HttpSocketTest_Stub
* @run main/othervm/policy=security.policy HttpSocketTest
*/
--- a/jdk/test/java/rmi/transport/pinClientSocketFactory/PinClientSocketFactory.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/transport/pinClientSocketFactory/PinClientSocketFactory.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,10 @@
* @author Peter Jones
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm -Dsun.rmi.transport.connectionTimeout=2000
* PinClientSocketFactory
--- a/jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,10 @@
* @author Peter Jones
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm RapidExportUnexport
*/
--- a/jdk/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/rmi/transport/reuseDefaultPort/ReuseDefaultPort.java Mon Jun 01 10:15:20 2015 -0700
@@ -34,6 +34,10 @@
* @author Peter Jones
*
* @library ../../testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm ReuseDefaultPort
*/
--- a/jdk/test/java/security/BasicPermission/Wildcard.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/BasicPermission/Wildcard.java Mon Jun 01 10:15:20 2015 -0700
@@ -33,6 +33,8 @@
* @summary Check that BasicPermission subclasses don't throw exception if name
* contains wildcard character ("*") but does not signify a
* wildcard match
+ * @modules java.base/com.sun.net.ssl
+ * java.sql
*/
public class Wildcard {
--- a/jdk/test/java/security/KeyPairGenerator/SolarisShortDSA.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/KeyPairGenerator/SolarisShortDSA.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 7081411
* @summary DSA keypair generation affected by Solaris bug
+ * @modules java.base/sun.security.provider
*/
import java.security.KeyPair;
--- a/jdk/test/java/security/PermissionCollection/Concurrent.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/PermissionCollection/Concurrent.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4671598
* @summary PermissionCollection is not properly synchronized
+ * @modules java.rmi/com.sun.rmi.rmid
*/
import java.security.*; // AllPermission, BasicPermission, Permissions
--- a/jdk/test/java/security/Policy/GetInstance/GetInstance.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/Policy/GetInstance/GetInstance.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 5100561
* @bug 6273812
* @summary Can not explicitly create a java.security.Policy object from a file
+ * @modules java.base/sun.security.provider
* @build GetInstancePolicySpi GetInstanceProvider
* @run main/othervm/policy=GetInstance.policy GetInstance
*/
@@ -34,7 +35,6 @@
import java.io.File;
import java.net.URI;
-import sun.net.www.ParseUtil;
public class GetInstance {
--- a/jdk/test/java/security/Policy/PolicyProvider/UseSystemClassLoader.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/Policy/PolicyProvider/UseSystemClassLoader.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,7 @@
* @test
* @bug 8075706
* @summary Check that a custom policy provider can be loaded from the classpath
+ * @modules java.base/sun.security.provider
* @run main/othervm UseSystemClassLoader CUSTOM
* @run main/othervm UseSystemClassLoader DEFAULT
* @run main/othervm UseSystemClassLoader NOT_AVAIL
--- a/jdk/test/java/security/ProtectionDomain/PreserveCombinerTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/ProtectionDomain/PreserveCombinerTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -34,6 +34,7 @@
* @summary Make sure that JavaSecurityAccess.doIntersectionPrivilege()
* is not dropping the information about the domain combiner of
* the stack ACC
+ * @modules java.base/sun.misc
*/
public class PreserveCombinerTest {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/Signature/Offsets.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.security.InvalidKeyException;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.Signature;
+import java.security.SignatureException;
+import jdk.testlibrary.RandomFactory;
+
+/*
+ * @test
+ * @bug 8050374
+ * @key randomness
+ * @summary This test validates signature verification
+ * Signature.verify(byte[], int, int). The test uses RandomFactory to
+ * get random set of clear text data to sign. After the signature
+ * generation, the test tries to verify signature with the above API
+ * and passing in different signature offset (0, 33, 66, 99).
+ * @library /lib/testlibrary
+ * @run main Offsets SUN NONEwithDSA
+ * @run main Offsets SUN SHA1withDSA
+ * @run main Offsets SUN SHA224withDSA
+ * @run main Offsets SUN SHA256withDSA
+ */
+public class Offsets {
+
+ private final int size;
+ private final byte[] cleartext;
+ private final PublicKey pubkey;
+ private final Signature signature;
+ private final byte[] signed;
+
+ private Offsets(Signature signature, PublicKey pubkey, PrivateKey privkey,
+ int size, byte[] cleartext) throws InvalidKeyException,
+ SignatureException {
+ this.pubkey = pubkey;
+ this.signature = signature;
+ this.size = size;
+ this.cleartext = cleartext;
+
+ signature.initSign(privkey);
+ signature.update(cleartext, 0, size);
+ signed = signature.sign();
+ }
+
+ int getDataSize() {
+ return size;
+ }
+
+ int getSignatureLength() {
+ return signed.length;
+ }
+
+ byte[] shiftSignData(int offset) {
+ byte[] testSignData = new byte[offset + signed.length];
+ System.arraycopy(signed, 0, testSignData, offset,
+ signed.length);
+ return testSignData;
+ }
+
+ boolean verifySignature(byte[] sigData, int sigOffset, int sigLength,
+ int updateOffset, int updateLength)
+ throws InvalidKeyException, SignatureException {
+ signature.initVerify(pubkey);
+ signature.update(cleartext, updateOffset, updateLength);
+ return signature.verify(sigData, sigOffset, sigLength);
+ }
+
+ static Offsets init(String provider, String algorithm)
+ throws NoSuchAlgorithmException, NoSuchProviderException,
+ InvalidKeyException, SignatureException {
+ // fill the cleartext data with random bytes
+ byte[] cleartext = new byte[100];
+ RandomFactory.getRandom().nextBytes(cleartext);
+
+ // NONEwith requires input to be of 20 bytes
+ int size = algorithm.contains("NONEwith") ? 20 : 100;
+
+ // create signature instance
+ Signature signature = Signature.getInstance(algorithm, provider);
+
+ String keyAlgo;
+ if (algorithm.contains("RSA")) {
+ keyAlgo = "RSA";
+ } else if (algorithm.contains("ECDSA")) {
+ keyAlgo = "EC";
+ } else if (algorithm.contains("DSA")) {
+ keyAlgo = "DSA";
+ } else {
+ throw new RuntimeException("Test doesn't support this signature "
+ + "algorithm: " + algorithm);
+ }
+
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance(keyAlgo, provider);
+ KeyPair kp = kpg.generateKeyPair();
+ PublicKey pubkey = kp.getPublic();
+ PrivateKey privkey = kp.getPrivate();
+
+ return new Offsets(signature, pubkey, privkey, size, cleartext);
+ }
+
+ public static void main(String[] args) throws NoSuchAlgorithmException,
+ InvalidKeyException, SignatureException {
+ if (args.length < 2) {
+ throw new RuntimeException("Wrong parameters");
+ }
+
+ boolean result = true;
+ try {
+ Offsets test = init(args[0], args[1]);
+
+ // We are trying 3 different offsets, data size has nothing to do
+ // with signature length
+ for (int chunk = 3; chunk > 0; chunk--) {
+ int signOffset = test.getDataSize() / chunk;
+
+ System.out.println("Running test with offset " + signOffset);
+ byte[] signData = test.shiftSignData(signOffset);
+
+ boolean success = test.verifySignature(signData, signOffset,
+ test.getSignatureLength(), 0, test.getDataSize());
+
+ if (success) {
+ System.out.println("Successfully verified with offset "
+ + signOffset);
+ } else {
+ System.out.println("Verification failed with offset "
+ + signOffset);
+ result = false;
+ }
+ }
+
+ // save signature to offset 0
+ byte[] signData = test.shiftSignData(0);
+
+ // Negative tests
+
+ // Test signature offset 0.
+ // Wrong test data will be passed to update,
+ // so signature verification should fail.
+ for (int chunk = 3; chunk > 0; chunk--) {
+ int dataOffset = (test.getDataSize() - 1) / chunk;
+ boolean success;
+ try {
+ success = test.verifySignature(signData, 0,
+ test.getSignatureLength(), dataOffset,
+ (test.getDataSize() - dataOffset));
+ } catch (SignatureException e) {
+ // Since we are trying different data size, it can throw
+ // SignatureException
+ success = false;
+ }
+
+ if (!success) {
+ System.out.println("Signature verification failed "
+ + "as expected, with data offset " + dataOffset
+ + " and length "
+ + (test.getDataSize() - dataOffset));
+ } else {
+ System.out.println("Signature verification "
+ + "should not succeed, with data offset "
+ + dataOffset + " and length "
+ + (test.getDataSize() - dataOffset));
+ result = false;
+ }
+ }
+
+ // Tests with manipulating offset and length
+ result &= Offsets.checkFailure(test, signData, -1,
+ test.getSignatureLength());
+
+ result &= Offsets.checkFailure(test, signData, 0,
+ test.getSignatureLength() - 1);
+
+ result &= Offsets.checkFailure(test, signData,
+ test.getSignatureLength() + 1, test.getSignatureLength());
+
+ result &= Offsets.checkFailure(test, signData, 0,
+ test.getSignatureLength() + 1);
+
+ result &= Offsets.checkFailure(test, signData, 0, 0);
+
+ result &= Offsets.checkFailure(test, signData, 0, -1);
+
+ result &= Offsets.checkFailure(test, signData,
+ 2147483646, test.getSignatureLength());
+
+ result &= Offsets.checkFailure(test, null, 0,
+ test.getSignatureLength());
+ } catch (NoSuchProviderException nspe) {
+ System.out.println("No such provider: " + nspe);
+ }
+
+ if (!result) {
+ throw new RuntimeException("Some test cases failed");
+ }
+ }
+
+ static boolean checkFailure(Offsets test, byte[] signData, int offset,
+ int length) {
+ boolean success;
+ try {
+ success = test.verifySignature(signData, offset, length, 0,
+ test.getDataSize());
+ } catch (IllegalArgumentException | SignatureException e) {
+ System.out.println("Expected exception: " + e);
+ success = false;
+ } catch (InvalidKeyException e) {
+ System.out.println("Unexpected exception: " + e);
+ return false;
+ }
+
+ if (!success) {
+ System.out.println("Signature verification failed as expected, "
+ + "with signature offset " + offset + " and length "
+ + length);
+ return true;
+ } else {
+ System.out.println("Signature verification should not succeed, "
+ + "with signature offset " + offset + " and length "
+ + length);
+ return false;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/SignedObject/Chain.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.security.Signature;
+import java.security.SignedObject;
+import java.security.KeyPairGenerator;
+import java.security.KeyPair;
+import java.security.NoSuchProviderException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.util.Arrays;
+
+/*
+ * @test
+ * @bug 8050374
+ * @summary Verify a chain of signed objects
+ */
+public class Chain {
+
+ static enum KeyAlg {
+ RSA("RSA"),
+ DSA("DSA"),
+ EC("EC");
+
+ final String name;
+
+ KeyAlg(String alg) {
+ this.name = alg;
+ }
+ }
+
+ static enum Provider {
+ Default("default"),
+ SunRsaSign("SunRsaSign"),
+ Sun("SUN"),
+ SunEC("SunEC"),
+ SunJSSE("SunJSSE"),
+ SunMSCAPI("SunMSCAPI");
+
+ final String name;
+
+ Provider(String name) {
+ this.name = name;
+ }
+ }
+
+ static enum SigAlg {
+ MD2withRSA("MD2withRSA"),
+ MD5withRSA("md5withRSA"),
+
+ SHA1withDSA("SHA1withDSA"),
+ SHA224withDSA("SHA224withDSA"),
+ SHA256withDSA("SHA256withDSA"),
+
+ SHA1withRSA("Sha1withrSA"),
+ SHA224withRSA("SHA224withRSA"),
+ SHA256withRSA("SHA256withRSA"),
+ SHA384withRSA("SHA384withRSA"),
+ SHA512withRSA("SHA512withRSA"),
+
+ SHA1withECDSA("SHA1withECDSA"),
+ SHA256withECDSA("SHA256withECDSA"),
+ SHA224withECDSA("SHA224withECDSA"),
+ SHA384withECDSA("SHA384withECDSA"),
+ SHA512withECDSA("SHA512withECDSA"),
+
+ MD5andSHA1withRSA("MD5andSHA1withRSA");
+
+ final String name;
+
+ SigAlg(String name) {
+ this.name = name;
+ }
+ }
+
+ static class Test {
+ final Provider provider;
+ final KeyAlg keyAlg;
+ final SigAlg sigAlg;
+
+ Test(SigAlg sigAlg, KeyAlg keyAlg, Provider privider) {
+ this.provider = privider;
+ this.keyAlg = keyAlg;
+ this.sigAlg = sigAlg;
+ }
+ }
+
+ private static final Test[] tests = {
+ new Test(SigAlg.SHA1withDSA, KeyAlg.DSA, Provider.Default),
+ new Test(SigAlg.MD2withRSA, KeyAlg.RSA, Provider.Default),
+ new Test(SigAlg.MD5withRSA, KeyAlg.RSA, Provider.Default),
+ new Test(SigAlg.SHA1withRSA, KeyAlg.RSA, Provider.Default),
+ new Test(SigAlg.SHA1withDSA, KeyAlg.DSA, Provider.Sun),
+ new Test(SigAlg.SHA224withDSA, KeyAlg.DSA, Provider.Sun),
+ new Test(SigAlg.SHA256withDSA, KeyAlg.DSA, Provider.Sun),
+ };
+
+ private static final String str = "to-be-signed";
+ private static final int N = 3;
+
+ public static void main(String argv[]) {
+ boolean result = Arrays.stream(tests).allMatch((test) -> runTest(test));
+ if(result) {
+ System.out.println("All tests passed");
+ } else {
+ throw new RuntimeException("Some tests failed");
+ }
+ }
+
+ static boolean runTest(Test test) {
+ System.out.format("Test: provider = %s, signature algorithm = %s, "
+ + "key algorithm = %s\n",
+ test.provider, test.sigAlg, test.keyAlg);
+ try {
+ // Generate all private/public key pairs
+ PrivateKey[] privKeys = new PrivateKey[N];
+ PublicKey[] pubKeys = new PublicKey[N];
+ PublicKey[] anotherPubKeys = new PublicKey[N];
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance(
+ test.keyAlg.name);
+ for (int j=0; j < N; j++) {
+ KeyPair kp = kpg.genKeyPair();
+ KeyPair anotherKp = kpg.genKeyPair();
+ privKeys[j] = kp.getPrivate();
+ pubKeys[j] = kp.getPublic();
+ anotherPubKeys[j] = anotherKp.getPublic();
+
+ if (Arrays.equals(pubKeys[j].getEncoded(),
+ anotherPubKeys[j].getEncoded())) {
+ System.out.println("Failed: it should not get "
+ + "the same pair of public key");
+ return false;
+ }
+ }
+
+ Signature signature;
+ if (test.provider != Provider.Default) {
+ signature = Signature.getInstance(test.sigAlg.name,
+ test.provider.name);
+ } else {
+ signature = Signature.getInstance(test.sigAlg.name);
+ }
+
+ // Create a chain of signed objects
+ SignedObject[] objects = new SignedObject[N];
+ objects[0] = new SignedObject(str, privKeys[0], signature);
+ for (int j = 1; j < N; j++) {
+ objects[j] = new SignedObject(objects[j - 1], privKeys[j],
+ signature);
+ }
+
+ // Verify the chain
+ int n = objects.length - 1;
+ SignedObject object = objects[n];
+ do {
+ if (!object.verify(pubKeys[n], signature)) {
+ System.out.println("Failed: verification failed, n = " + n);
+ return false;
+ }
+
+ if (object.verify(anotherPubKeys[n], signature)) {
+ System.out.println("Failed: verification should not "
+ + "succeed with wrong public key, n = " + n);
+ return false;
+ }
+
+ object = (SignedObject) object.getObject();
+ n--;
+ } while (n > 0);
+
+ System.out.println("signed data: " + object.getObject());
+ if (!str.equals(object.getObject())) {
+ System.out.println("Failed: signed data is not equal to "
+ + "original one");
+ return false;
+ }
+
+ System.out.println("Test passed");
+ return true;
+ } catch (NoSuchProviderException nspe) {
+ if (test.provider == Provider.SunMSCAPI
+ && !System.getProperty("os.name").startsWith("Windows")) {
+ System.out.println("SunMSCAPI is available only on Windows: "
+ + nspe);
+ return true;
+ }
+ System.out.println("Unexpected exception: " + nspe);
+ return false;
+ } catch (Exception e) {
+ System.out.println("Unexpected exception: " + e);
+ e.printStackTrace(System.out);
+ return false;
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/SignedObject/Copy.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.io.Serializable;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.Signature;
+import java.security.SignedObject;
+
+/*
+ * @test
+ * @bug 8050374
+ * @summary Checks if a signed object is a copy of an original object
+ */
+public class Copy {
+
+ private static final String DSA = "DSA";
+ private static final int KEY_SIZE = 512;
+ private static final int MAGIC = 123;
+
+ public static void main(String args[]) throws Exception {
+ KeyPairGenerator kg = KeyPairGenerator.getInstance(DSA);
+ kg.initialize(KEY_SIZE);
+ KeyPair kp = kg.genKeyPair();
+
+ Signature signature = Signature.getInstance(DSA);
+ Test original = new Test();
+ SignedObject so = new SignedObject(original, kp.getPrivate(),
+ signature);
+ System.out.println("Signature algorithm: " + so.getAlgorithm());
+
+ signature = Signature.getInstance(DSA, "SUN");
+ if (!so.verify(kp.getPublic(), signature)) {
+ throw new RuntimeException("Verification failed");
+ }
+
+ kg = KeyPairGenerator.getInstance(DSA);
+ kg.initialize(KEY_SIZE);
+ kp = kg.genKeyPair();
+
+ if (so.verify(kp.getPublic(), signature)) {
+ throw new RuntimeException("Unexpected success");
+ }
+
+ Object copy = so.getObject();
+ if (!original.equals(copy)) {
+ throw new RuntimeException("Signed object is not equal "
+ + "to original one: " + copy);
+ }
+
+ /*
+ * The signed object is a copy of an original one.
+ * Once the copy is made, further manipulation
+ * of the original object shouldn't has any effect on the copy.
+ */
+ original.set(MAGIC - 1);
+ copy = so.getObject();
+ if (original.equals(copy)) {
+ throw new RuntimeException("Signed object is not a copy "
+ + "of original one: " + copy);
+ }
+
+ System.out.println("Test passed");
+ }
+
+ private static class Test implements Serializable {
+ private int number = MAGIC;
+
+ public int get() {
+ return number;
+ }
+
+ public void set(int magic) {
+ this.number = magic;
+ }
+
+ @Override
+ public int hashCode() {
+ return number;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+
+ if (!(obj instanceof Test)) {
+ return false;
+ }
+
+ Test other = (Test) obj;
+ return number == other.number;
+ }
+
+ @Override
+ public String toString() {
+ return "" + number;
+ }
+ }
+}
+
+
--- a/jdk/test/java/security/cert/CertPathBuilder/selfIssued/DisableRevocation.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/cert/CertPathBuilder/selfIssued/DisableRevocation.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,7 @@
* @bug 6852744
* @summary PIT b61: PKI test suite fails because self signed certificates
* are being rejected
+ * @modules java.base/sun.security.util
* @run main/othervm DisableRevocation subca
* @run main/othervm DisableRevocation subci
* @run main/othervm DisableRevocation alice
--- a/jdk/test/java/security/cert/CertPathBuilder/selfIssued/KeyUsageMatters.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/cert/CertPathBuilder/selfIssued/KeyUsageMatters.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,7 @@
* @bug 6852744
* @summary PIT b61: PKI test suite fails because self signed certificates
* are being rejected
+ * @modules java.base/sun.security.util
* @run main/othervm KeyUsageMatters subca
* @run main/othervm KeyUsageMatters subci
* @run main/othervm KeyUsageMatters alice
--- a/jdk/test/java/security/cert/CertPathBuilder/selfIssued/StatusLoopDependency.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/cert/CertPathBuilder/selfIssued/StatusLoopDependency.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,7 @@
* @bug 6852744
* @summary PIT b61: PKI test suite fails because self signed certificates
* are being rejected
+ * @modules java.base/sun.security.util
* @run main/othervm StatusLoopDependency subca
* @run main/othervm StatusLoopDependency subci
* @run main/othervm StatusLoopDependency alice
--- a/jdk/test/java/security/cert/CertPathValidator/trustAnchor/ValidateNC.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/cert/CertPathValidator/trustAnchor/ValidateNC.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,7 @@
* CertPathValidator.validate() and CertPathBuilder.build() throw an
* InvalidAlgorithmParameterException if any of the TrustAnchors specified
* contain nameConstraints
+ * @modules java.base/sun.security.util
*/
import java.io.File;
import java.io.FileInputStream;
--- a/jdk/test/java/security/cert/CertificateRevokedException/Basic.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/security/cert/CertificateRevokedException/Basic.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4946388
* @summary Unit test for CertificateRevokedException
+ * @modules java.base/sun.security.x509
*/
import java.io.ByteArrayInputStream;
--- a/jdk/test/java/text/Bidi/Bug6850113.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/text/Bidi/Bug6850113.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
* @test
* @bug 6850113
* @summary Verify the return value of digit() for some digits.
+ * @modules java.base/sun.text.normalizer
* @compile -XDignore.symbol.file=true Bug6850113.java
* @run main Bug6850113
*/
--- a/jdk/test/java/time/TEST.properties Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/time/TEST.properties Mon Jun 01 10:15:20 2015 -0700
@@ -1,3 +1,4 @@
# Threeten test uses TestNG
TestNG.dirs = .
othervm.dirs = tck/java/time/chrono test/java/time/chrono test/java/time/format
+lib.dirs = ../../lib/testlibrary
--- a/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -42,10 +42,17 @@
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
+import jdk.testlibrary.RandomFactory;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+/*
+ * @test
+ * @bug 8081022
+ * @key randomness
+ */
+
/**
* Test ZoneTextPrinterParser
*/
@@ -59,8 +66,8 @@
}
public void test_printText() {
- Random r = new Random();
- int N = 50;
+ Random r = RandomFactory.getRandom();
+ int N = 8;
Locale[] locales = Locale.getAvailableLocales();
Set<String> zids = ZoneRulesProvider.getAvailableZoneIds();
ZonedDateTime zdt = ZonedDateTime.now();
--- a/jdk/test/java/util/Calendar/Bug8007038.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/Calendar/Bug8007038.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 8007038
* @summary Verify ArrayIndexOutOfBoundsException is not thrown on
* on calling localizedDateTime().print() with JapaneseChrono
+ * @modules java.base/sun.util.locale.provider
* @compile -XDignore.symbol.file Bug8007038.java
* @run main Bug8007038
*/
--- a/jdk/test/java/util/Calendar/CldrFormatNamesTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/Calendar/CldrFormatNamesTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,9 +24,10 @@
/*
* @test
* @bug 8004489 8006509
+ * @summary Unit test for CLDR FormatData resources
+ * @modules java.base/sun.util.locale.provider
* @compile -XDignore.symbol.file CldrFormatNamesTest.java
* @run main/othervm -Djava.locale.providers=CLDR CldrFormatNamesTest
- * @summary Unit test for CLDR FormatData resources
*/
import java.util.*;
--- a/jdk/test/java/util/Formatter/Basic.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/Formatter/Basic.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,7 @@
* 6344623 6369500 6534606 6282094 6286592 6476425 5063507 6469160 6476168
* 8059175
*
+ * @modules java.base/sun.misc
* @run shell/timeout=240 Basic.sh
*/
--- a/jdk/test/java/util/Locale/Bug6989440.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/Locale/Bug6989440.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6989440
* @summary Verify ConcurrentModificationException is not thrown with multiple
* thread accesses.
+ * @modules java.base/sun.util.locale.provider
* @compile -XDignore.symbol.file=true Bug6989440.java
* @run main Bug6989440
*/
--- a/jdk/test/java/util/Locale/Bug8004240.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/Locale/Bug8004240.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8004240
* @summary Verify that getAdapterPreference returns an unmodifiable list.
+ * @modules java.base/sun.util.locale.provider
* @compile -XDignore.symbol.file Bug8004240.java
* @run main Bug8004240
*/
--- a/jdk/test/java/util/jar/JarInputStream/ExtraFileInMetaInf.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/jar/JarInputStream/ExtraFileInMetaInf.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,8 +23,10 @@
/*
* @test
- * @bug 8021788
- * @summary JarInputStream doesn't provide certificates for some file under META-INF
+ * @bug 8021788
+ * @summary JarInputStream doesn't provide certificates for some file under META-INF
+ * @modules java.base/sun.security.tools.keytool
+ * jdk.jartool/sun.security.tools.jarsigner
*/
import java.util.jar.*;
--- a/jdk/test/java/util/jar/Manifest/CreateManifest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/jar/Manifest/CreateManifest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 7148584
* @summary Jar tools fails to generate manifest correctly when boundary condition hit
+ * @modules jdk.jartool/sun.tools.jar
* @compile -XDignore.symbol.file=true CreateManifest.java
* @run main CreateManifest
*/
--- a/jdk/test/java/util/logging/CustomLogManagerTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/logging/CustomLogManagerTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,7 @@
* @bug 8005615 8006104
* @summary Add loggers to custom log manager
*
+ * @modules java.base/sun.util.logging
* @compile -XDignore.symbol.file CustomLogManagerTest.java CustomLogManager.java
* @run main/othervm -Djava.util.logging.manager=CustomLogManager CustomLogManagerTest
*/
--- a/jdk/test/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java Mon Jun 01 10:15:20 2015 -0700
@@ -35,6 +35,7 @@
* @test
* @bug 8026499
* @summary checks that Logger.getLogger("").setLevel() is working correctly.
+ * @modules java.base/sun.util.logging
* @build TestRootLoggerLevel
* @run main/othervm -Dtest.security=on TestRootLoggerLevel
* @run main/othervm -Dtest.security=off TestRootLoggerLevel
--- a/jdk/test/java/util/logging/LogManagerAppContextDeadlock.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/logging/LogManagerAppContextDeadlock.java Mon Jun 01 10:15:20 2015 -0700
@@ -41,6 +41,7 @@
* @bug 8065991
* @summary check that when LogManager is initialized, a deadlock similar
* to that described in 8065709 will not occur.
+ * @modules java.base/sun.misc
* @run main/othervm LogManagerAppContextDeadlock UNSECURE
* @run main/othervm LogManagerAppContextDeadlock SECURE
*
--- a/jdk/test/java/util/logging/LoggingDeadlock4.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/logging/LoggingDeadlock4.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6977677 8004928
* @summary Deadlock between LogManager.<clinit> and Logger.getLogger()
* @author Daniel D. Daugherty
+ * @modules java.base/sun.util.logging
* @compile -XDignore.symbol.file LoggingDeadlock4.java
* @run main/othervm/timeout=15 LoggingDeadlock4
*/
--- a/jdk/test/java/util/logging/RootLogger/RootLevelInConfigFile.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/logging/RootLogger/RootLevelInConfigFile.java Mon Jun 01 10:15:20 2015 -0700
@@ -42,6 +42,7 @@
* @bug 8030850
* @summary Tests that setting .level=FINEST for the root logger in logging
* configuration file does work.
+ * @modules java.base/sun.misc
* @run main/othervm RootLevelInConfigFile
*
* @author danielfuchs
--- a/jdk/test/java/util/logging/SimpleLogManager.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/logging/SimpleLogManager.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @summary A LogManager subclass overrides its own implementation of named
* logger (see the subclassing information in the Logger class specification)
*
+ * @modules java.base/sun.util.logging
* @compile -XDignore.symbol.file CustomLogManager.java SimpleLogManager.java
* @run main/othervm -Djava.util.logging.manager=SimpleLogManager SimpleLogManager
*/
--- a/jdk/test/java/util/logging/TestAppletLoggerContext.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/logging/TestAppletLoggerContext.java Mon Jun 01 10:15:20 2015 -0700
@@ -42,6 +42,7 @@
* @summary NPE when using Logger.getAnonymousLogger or
* LogManager.getLogManager().getLogger
*
+ * @modules java.base/sun.misc
* @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingApplet
* @run main/othervm -Dtest.security=on TestAppletLoggerContext LoadingApplet
* @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingMain
--- a/jdk/test/java/util/logging/TestGetLoggerNPE.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/logging/TestGetLoggerNPE.java Mon Jun 01 10:15:20 2015 -0700
@@ -35,6 +35,7 @@
*
* @summary NPE with logging while launching webstart
*
+ * @modules java.base/sun.misc
* @build TestGetLoggerNPE
* @run main/othervm TestGetLoggerNPE getLogger
* @run main/othervm TestGetLoggerNPE getLogManager
--- a/jdk/test/java/util/logging/TestLoggerWeakRefLeak.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/logging/TestLoggerWeakRefLeak.java Mon Jun 01 10:15:20 2015 -0700
@@ -38,7 +38,8 @@
* @bug 6942989
* @summary Check for WeakReference leak in Logger and anonymous Logger objects
* @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @modules jdk.attach/sun.tools.attach
+ * @build jdk.testlibrary.ProcessTools
* @run main/othervm TestLoggerWeakRefLeak Logger
* @run main/othervm TestLoggerWeakRefLeak AnonymousLogger
*/
--- a/jdk/test/java/util/logging/TestMainAppContext.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/java/util/logging/TestMainAppContext.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,7 @@
* @bug 8026404
* @summary checks that calling getLogger() from a Thread whose ThreadGroup is
* a child of the main root group doesn't throw an exception.
+ * @modules java.desktop/sun.awt
* @build TestMainAppContext
* @run main/othervm TestMainAppContext
* @author danielfuchs
--- a/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/management/remote/mandatory/notif/ListenerScaleTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -21,12 +21,16 @@
* questions.
*/
-/*
+/**
* @test
* @bug 6338874
* @summary Check that notification dispatch is not linear in number of MBeans.
* @author Eamonn McManus
* @modules java.management
+ *
+ * @library /lib/testlibrary
+ * @run build jdk.testlibrary.* ListenerScaleTest
+ * @run main ListenerScaleTest
*/
/*
@@ -67,6 +71,8 @@
import javax.management.remote.JMXConnectorServerFactory;
import javax.management.remote.JMXServiceURL;
+import jdk.testlibrary.Platform;
+
public class ListenerScaleTest {
private static final int WARMUP_WITH_ONE_MBEAN = 1000;
private static final int NOTIFS_TO_TIME = 100;
@@ -126,6 +132,10 @@
};
public static void main(String[] args) throws Exception {
+ if (Platform.isDebugBuild()) {
+ System.out.println("Running on a debug build. Performance test not applicable. Skipping.");
+ return;
+ }
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
Sender sender = new Sender();
mbs.registerMBean(sender, testObjectName);
--- a/jdk/test/javax/net/ssl/FixingJavadocs/ComURLNulls.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/FixingJavadocs/ComURLNulls.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,8 @@
* @summary Need to revisit the javadocs for JSSE, especially the
* promoted classes, and HttpsURLConnection.getCipherSuite throws
* NullPointerException
+ * @modules java.base/com.sun.net.ssl
+ * java.base/com.sun.net.ssl.internal.www.protocol.https
* @run main/othervm ComURLNulls
*
* SunJSSE does not support dynamic system properties, no way to re-use
--- a/jdk/test/javax/net/ssl/GetInstance.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/GetInstance.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary verify getInstance() works using Provider.getService()
* Export "PKIX" as the standard algorithm name of KeyManagerFactory
* @author Andreas Sterbenz
+ * @modules java.base/com.sun.net.ssl
*/
import java.security.*;
--- a/jdk/test/javax/net/ssl/SSLSession/CheckMyTrustedKeystore.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/SSLSession/CheckMyTrustedKeystore.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,7 @@
* @bug 4329114
* @summary Need better way of reflecting the reason when a chain is
* rejected as untrusted.
+ * @modules java.base/com.sun.net.ssl
* @ignore JSSE supports algorithm constraints with CR 6916074,
* need to update this test case in JDK 7 soon
* @run main/othervm CheckMyTrustedKeystore
--- a/jdk/test/javax/net/ssl/ServerName/SSLEngineExplorer.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLEngineExplorer.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../SSLEngine ../templates
+ * @modules java.base/sun.misc
* @build SSLEngineService SSLCapabilities SSLExplorer
* @run main/othervm SSLEngineExplorer SSLv2Hello,SSLv3
* @run main/othervm SSLEngineExplorer SSLv3
--- a/jdk/test/javax/net/ssl/ServerName/SSLEngineExplorerMatchedSNI.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLEngineExplorerMatchedSNI.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../SSLEngine ../templates
+ * @modules java.base/sun.misc
* @build SSLEngineService SSLCapabilities SSLExplorer
* @run main/othervm SSLEngineExplorerMatchedSNI www.example.com
* www\.example\.com
--- a/jdk/test/javax/net/ssl/ServerName/SSLEngineExplorerUnmatchedSNI.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLEngineExplorerUnmatchedSNI.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../SSLEngine ../templates
+ * @modules java.base/sun.misc
* @build SSLEngineService SSLCapabilities SSLExplorer
* @run main/othervm SSLEngineExplorerUnmatchedSNI www.example.com
* www\.example\.org
--- a/jdk/test/javax/net/ssl/ServerName/SSLEngineExplorerWithCli.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLEngineExplorerWithCli.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../SSLEngine ../templates
+ * @modules java.base/sun.misc
* @build SSLEngineService SSLCapabilities SSLExplorer
* @run main/othervm SSLEngineExplorerWithCli
*/
--- a/jdk/test/javax/net/ssl/ServerName/SSLEngineExplorerWithSrv.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLEngineExplorerWithSrv.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../SSLEngine ../templates
+ * @modules java.base/sun.misc
* @build SSLEngineService SSLCapabilities SSLExplorer
* @run main/othervm SSLEngineExplorerWithSrv
*/
--- a/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorer.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorer.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../templates
+ * @modules java.base/sun.misc
* @build SSLCapabilities SSLExplorer
* @run main/othervm SSLSocketExplorer SSLv2Hello,SSLv3
* @run main/othervm SSLSocketExplorer SSLv3
--- a/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorerFailure.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorerFailure.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../templates
+ * @modules java.base/sun.misc
* @build SSLCapabilities SSLExplorer
* @run main/othervm SSLSocketExplorerFailure SSLv2Hello,SSLv3
* @run main/othervm SSLSocketExplorerFailure SSLv3
--- a/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorerMatchedSNI.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorerMatchedSNI.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../templates
+ * @modules java.base/sun.misc
* @build SSLCapabilities SSLExplorer
* @run main/othervm SSLSocketExplorerMatchedSNI www.example.com
* www\.example\.com
--- a/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorerUnmatchedSNI.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorerUnmatchedSNI.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../templates
+ * @modules java.base/sun.misc
* @build SSLCapabilities SSLExplorer
* @run main/othervm SSLSocketExplorerUnmatchedSNI www.example.com
* www\.example\.org
--- a/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorerWithCliSNI.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorerWithCliSNI.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../templates
+ * @modules java.base/sun.misc
* @build SSLCapabilities SSLExplorer
* @run main/othervm SSLSocketExplorerWithCliSNI
*/
--- a/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorerWithSrvSNI.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ServerName/SSLSocketExplorerWithSrvSNI.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @bug 7068321
* @summary Support TLS Server Name Indication (SNI) Extension in JSSE Server
* @library ../templates
+ * @modules java.base/sun.misc
* @build SSLCapabilities SSLExplorer
* @run main/othervm SSLSocketExplorerWithSrvSNI
*/
--- a/jdk/test/javax/net/ssl/TLS/TestJSSE.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSE.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,8 @@
* @test
* @bug 8049429
* @library ../../../../lib/testlibrary/
+ * @modules java.management
+ * jdk.crypto.ec/sun.security.ec
* @build jdk.testlibrary.Utils
* @compile CipherTestUtils.java JSSEClient.java JSSEServer.java
* @summary Test that all cipher suites work in all versions and all client
--- a/jdk/test/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,6 +32,7 @@
* @test
* @bug 7030966
* @summary Support AEAD CipherSuites
+ * @modules java.base/sun.misc
* @run main/othervm ShortRSAKeyGCM PKIX TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* @run main/othervm ShortRSAKeyGCM PKIX TLS_RSA_WITH_AES_128_GCM_SHA256
* @run main/othervm ShortRSAKeyGCM PKIX TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
--- a/jdk/test/javax/net/ssl/ciphersuites/DisabledAlgorithms.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/net/ssl/ciphersuites/DisabledAlgorithms.java Mon Jun 01 10:15:20 2015 -0700
@@ -103,6 +103,8 @@
default:
throw new RuntimeException("Wrong parameter: " + args[0]);
}
+
+ System.out.println("Test passed");
}
/*
@@ -127,7 +129,6 @@
}
}
- server.stop();
while (server.isRunning()) {
sleep();
}
@@ -223,11 +224,19 @@
} catch (SSLHandshakeException e) {
System.out.println("Server: run: " + e);
sslError = true;
+ stopped = true;
} catch (IOException e) {
if (!stopped) {
- System.out.println("Server: run: " + e);
+ System.out.println("Server: run: unexpected exception: "
+ + e);
e.printStackTrace();
otherError = true;
+ stopped = true;
+ } else {
+ System.out.println("Server: run: " + e);
+ System.out.println("The exception above occurred "
+ + "because socket was closed, "
+ + "please ignore it");
}
}
}
@@ -260,6 +269,7 @@
stopped = true;
if (!ssocket.isClosed()) {
try {
+ System.out.println("Server: close socket");
ssocket.close();
} catch (IOException e) {
System.out.println("Server: close: " + e);
--- a/jdk/test/javax/script/VersionTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/script/VersionTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 6346729 6705893
* @summary Create JavaScript engine and check language and engine version
+ * @modules java.scripting
+ * jdk.scripting.nashorn/jdk.nashorn.internal.runtime
*/
import javax.script.*;
--- a/jdk/test/javax/security/auth/Subject/SubjectNullTests.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/security/auth/Subject/SubjectNullTests.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,9 @@
/*
* @test
* @bug 8015081
+ * @modules java.base/sun.misc
+ * java.management
+ * java.security.jgss
* @compile Subject.java
* @compile SubjectNullTests.java
* @build SubjectNullTests
--- a/jdk/test/javax/security/auth/kerberos/StandardNames.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/security/auth/kerberos/StandardNames.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8035986
* @summary KerberosKey algorithm names are not specified
+ * @modules java.security.jgss/sun.security.krb5
*/
import sun.security.krb5.EncryptedData;
--- a/jdk/test/javax/security/auth/login/Configuration/GetInstanceSecurity.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/security/auth/login/Configuration/GetInstanceSecurity.java Mon Jun 01 10:15:20 2015 -0700
@@ -34,8 +34,6 @@
import java.security.*;
import javax.security.auth.login.*;
-import sun.net.www.ParseUtil;
-
public class GetInstanceSecurity {
private static final String JAVA_CONFIG = "JavaLoginConfig";
--- a/jdk/test/javax/security/auth/x500/X500Principal/NameFormat.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/security/auth/x500/X500Principal/NameFormat.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4505980 5109882 7049963 7090565
* @summary X500Principal input name parsing issues and wrong exception thrown
+ * @modules java.base/sun.security.x509
* @run main/othervm -Djava.security.debug=x509,ava NameFormat
*
* The debug=ava above must be set in order to check for escaped hex chars.
--- a/jdk/test/javax/sql/testng/TEST.properties Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/sql/testng/TEST.properties Mon Jun 01 10:15:20 2015 -0700
@@ -2,3 +2,6 @@
TestNG.dirs= .
othervm.dirs= .
lib.dirs = /java/sql/testng
+modules = java.sql.rowset/com.sun.rowset \
+ java.sql.rowset/com.sun.rowset.internal \
+ java.sql.rowset/com.sun.rowset.providers
--- a/jdk/test/javax/swing/JComboBox/8032878/bug8032878.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/swing/JComboBox/8032878/bug8032878.java Mon Jun 01 10:15:20 2015 -0700
@@ -22,7 +22,7 @@
*/
/* @test
- * @bug 8032878
+ * @bug 8032878 8078855
* @summary Checks that JComboBox as JTable cell editor processes key events
* even where setSurrendersFocusOnKeystroke flag in JTable is false and
* that it does not lose the first key press where the flag is true.
@@ -36,6 +36,7 @@
import java.awt.event.KeyEvent;
import javax.swing.*;
import javax.swing.text.JTextComponent;
+import javax.swing.plaf.metal.MetalLookAndFeel;
public class bug8032878 implements Runnable {
private static final String ONE = "one";
@@ -53,6 +54,8 @@
private volatile String text;
public static void main(String[] args) throws Exception {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+
final bug8032878 test = new bug8032878();
test.test(false);
--- a/jdk/test/javax/xml/bind/xjc/8029837/PreParseGrammarTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/xml/bind/xjc/8029837/PreParseGrammarTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,10 @@
* @bug 8029837
* @summary Test simulates the partial call to xjc ant task that fails with
* NullPointer exception
+ * @modules java.xml/com.sun.org.apache.xerces.internal.parsers
+ * @modules java.xml/com.sun.org.apache.xerces.internal.xni
+ * @modules java.xml/com.sun.org.apache.xerces.internal.xni.grammars
+ * @modules java.xml/com.sun.org.apache.xerces.internal.xni.parser
* @run main/othervm PreParseGrammarTest
*/
--- a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,9 @@
* @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8046949
* 8046724 8079693
* @summary Basic unit tests for generating XML Signatures with JSR 105
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
+ * java.xml.crypto/org.jcp.xml.dsig.internal.dom
* @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
* X509KeySelector.java GenerationTests.java
* @run main/othervm GenerationTests
--- a/jdk/test/javax/xml/crypto/dsig/ValidationTests.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/xml/crypto/dsig/ValidationTests.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,9 @@
* @test
* @bug 4635230 6365103 6366054 6824440 7131084 8046724 8079693
* @summary Basic unit tests for validating XML Signatures with JSR 105
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
+ * java.xml.crypto/org.jcp.xml.dsig.internal.dom
* @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
* X509KeySelector.java ValidationTests.java
* @run main/othervm ValidationTests
--- a/jdk/test/javax/xml/crypto/dsig/keyinfo/KeyInfo/Marshal.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/xml/crypto/dsig/keyinfo/KeyInfo/Marshal.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6372500
* @summary Test that KeyInfo.marshal works correctly
+ * @modules java.xml.crypto/org.jcp.xml.dsig.internal.dom
* @compile -XDignore.symbol.file Marshal.java
* @run main Marshal
* @author Sean Mullan
--- a/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,7 @@
* correctly maps them to their preferred mime names.
* Also checks that the Encodings.properties resource file
* is consistent.
+ * @modules java.xml/com.sun.org.apache.xml.internal.serializer
* @compile -XDignore.symbol.file CheckEncodingPropertiesFile.java
* @run main CheckEncodingPropertiesFile
* @author Daniel Fuchs
--- a/jdk/test/javax/xml/jaxp/XPath/8035577/Regex.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/xml/jaxp/XPath/8035577/Regex.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8035577
* @summary Tests for xpath regular expression methods.
+ * @modules java.xml/com.sun.org.apache.xerces.internal.impl.xpath.regex
* @run main Regex
* @author david.x.li@oracle.com
*/
--- a/jdk/test/javax/xml/jaxp/parsers/8022548/XOMParserTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/xml/jaxp/parsers/8022548/XOMParserTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,10 @@
* @test
* @bug 8022548
* @summary test that a parser can use DTDConfiguration
+ * @modules java.xml/com.sun.org.apache.xerces.internal.impl
+ * java.xml/com.sun.org.apache.xerces.internal.parsers
+ * java.xml/com.sun.org.apache.xerces.internal.util
+ * java.xml/com.sun.org.apache.xerces.internal.xni.parser
* @run main XOMParserTest
*/
import com.sun.org.apache.xerces.internal.impl.Constants;
--- a/jdk/test/javax/xml/jaxp/testng/TEST.properties Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/javax/xml/jaxp/testng/TEST.properties Mon Jun 01 10:15:20 2015 -0700
@@ -1,3 +1,11 @@
# This file identifies root(s) of the test-ng hierarchy.
TestNG.dirs = .
+
+modules = java.xml/com.sun.org.apache.xerces.internal.dom \
+ java.xml/com.sun.org.apache.xerces.internal.impl \
+ java.xml/com.sun.org.apache.xerces.internal.impl.xs \
+ java.xml/com.sun.org.apache.xerces.internal.parsers \
+ java.xml/com.sun.org.apache.xerces.internal.util \
+ java.xml/com.sun.org.apache.xerces.internal.xni.parser \
+ java.xml/com.sun.org.apache.xerces.internal.xs
--- a/jdk/test/jdk/internal/jimage/VerifyJimage.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/jdk/internal/jimage/VerifyJimage.java Mon Jun 01 10:15:20 2015 -0700
@@ -48,6 +48,7 @@
/*
* @test
* @summary Verify jimage
+ * @modules java.base/jdk.internal.jimage
* @run main/othervm VerifyJimage
*/
--- a/jdk/test/jdk/nio/zipfs/ZFSTests.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/jdk/nio/zipfs/ZFSTests.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -22,7 +22,7 @@
*/
/* @test
- * @bug 7156873 8040059
+ * @bug 7156873 8040059 8028480 8034773
* @summary ZipFileSystem regression tests
*
* @run main ZFSTests
@@ -30,15 +30,19 @@
*/
+import java.io.OutputStream;
import java.net.URI;
+import java.nio.ByteBuffer;
+import java.nio.channels.*;
import java.nio.file.*;
-import java.util.Map;
-import java.util.HashMap;
+import java.nio.file.spi.*;
+import java.util.*;
public class ZFSTests {
public static void main(String[] args) throws Throwable {
test7156873();
+ testOpenOptions();
}
static void test7156873() throws Throwable {
@@ -56,4 +60,44 @@
Files.deleteIfExists(dir);
}
}
+
+ static void testOpenOptions() throws Throwable {
+ Path path = Paths.get("file.zip");
+ try {
+ URI uri = URI.create("jar:" + path.toUri());
+ Map<String, Object> env = new HashMap<String, Object>();
+ env.put("create", "true");
+ try (FileSystem fs = FileSystems.newFileSystem(uri, env)) {
+ FileSystemProvider fsp = fs.provider();
+ Set<? extends OpenOption> options;
+ Path p = fs.getPath("test.txt");
+ // 8028480
+ options = EnumSet.of(StandardOpenOption.CREATE,
+ StandardOpenOption.WRITE,
+ StandardOpenOption.APPEND);
+ try (FileChannel ch = fsp.newFileChannel(p, options)) {
+ ch.write(ByteBuffer.wrap("Hello!".getBytes("ASCII")));
+ }
+ // 8034773
+ try (OutputStream os = fsp.newOutputStream(p, new OpenOption[0])) {
+ os.write("Hello2!".getBytes("ASCII"));
+ }
+ if (!"Hello2!".equals(new String(
+ Files.readAllBytes(fs.getPath("test.txt"))))) {
+ throw new RuntimeException("failed to open as truncate_existing");
+ }
+
+ options = EnumSet.of(StandardOpenOption.CREATE,
+ StandardOpenOption.APPEND,
+ StandardOpenOption.TRUNCATE_EXISTING);
+ try (FileChannel ch = fsp.newFileChannel(p, options)) {
+ throw new RuntimeException("expected IAE not thrown!");
+ } catch (IllegalArgumentException x) {
+ // expected x.printStackTrace();
+ }
+ }
+ } finally {
+ Files.deleteIfExists(path);
+ }
+ }
}
--- a/jdk/test/lib/security/CheckBlacklistedCerts.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/lib/security/CheckBlacklistedCerts.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8011402
* @summary Move blacklisting certificate logic from hard code to data
+ * @modules java.base/sun.security.util
*/
import sun.security.util.UntrustedCertificates;
--- a/jdk/test/lib/testlibrary/OutputAnalyzerReportingTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/lib/testlibrary/OutputAnalyzerReportingTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, 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
@@ -29,6 +29,7 @@
* such as printing additional diagnostic info
* (exit code, stdout, stderr, command line, etc.)
* @library /testlibrary
+ * @modules java.management
* @build jdk.testlibrary.*
* @run main jdk.testlibrary.OutputAnalyzerReportingTest
*/
--- a/jdk/test/lib/testlibrary/OutputAnalyzerTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/lib/testlibrary/OutputAnalyzerTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, 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,6 +26,7 @@
* @test
* @summary Test the OutputAnalyzer utility class
* @library /testlibrary
+ * @modules java.management
* @build jdk.testlibrary.*
* @run main jdk.testlibrary.OutputAnalyzerTest
*/
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Mon Jun 01 10:15:20 2015 -0700
@@ -44,8 +44,6 @@
import java.util.function.Consumer;
import java.util.stream.Collectors;
-import sun.management.VMManagement;
-
public final class ProcessTools {
private static final class LineForwarder extends StreamPumper.LinePump {
private final PrintStream ps;
--- a/jdk/test/sun/invoke/util/ValueConversionsTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/invoke/util/ValueConversionsTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -35,6 +35,7 @@
/* @test
* @summary unit tests for value-type conversion utilities
+ * @modules java.base/sun.invoke.util
* @compile -XDignore.symbol.file ValueConversionsTest.java
* @run junit/othervm test.sun.invoke.util.ValueConversionsTest
*/
--- a/jdk/test/sun/management/PlatformMBeanProviderConstructorCheck.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/management/PlatformMBeanProviderConstructorCheck.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,7 @@
* @test
* @bug 8042901
* @summary Check permission for PlatformMBeanProvider Constructor
+ * @modules java.management/sun.management.spi
* @author Shanliang Jiang
*/
public class PlatformMBeanProviderConstructorCheck {
--- a/jdk/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/JvmstatCountersTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -116,10 +116,10 @@
throw new IllegalArgumentException("Test case 3 failed");
}
for (String key : remoteData.keySet()) {
- if (!key.startsWith("sun.management.JMXConnectorServer.0.")) {
+ if (!isKeyAcceptable(key)) {
System.out.println("Test FAILED! The OOTB management " +
"agent shouldn't publish anything which isn't " +
- "related to the remote connector.");
+ "related to the remote connector (" + key + ").");
throw new IllegalArgumentException("Test case 3 failed");
}
}
@@ -165,10 +165,10 @@
throw new IllegalArgumentException("Test case 4 failed");
}
for (String key : remoteData2.keySet()) {
- if (!key.startsWith("sun.management.JMXConnectorServer.0.")) {
+ if (!isKeyAcceptable(key)) {
System.out.println("Test FAILED! The OOTB management " +
"agent shouldn't publish anything which isn't " +
- "related to the remote connector.");
+ "related to the remote connector (" + key + ").");
throw new IllegalArgumentException("Test case 4 failed");
}
}
@@ -184,4 +184,9 @@
}
System.out.println("Bye! Bye!");
}
+
+ private static boolean isKeyAcceptable(String key) {
+ return key.startsWith("sun.management.JMXConnectorServer.0.") ||
+ key.startsWith("sun.management.JMXConnectorServer.remote.enabled");
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.io.IOException;
+import java.net.BindException;
+import java.util.Properties;
+import java.util.function.Predicate;
+import static org.testng.Assert.*;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import jdk.testlibrary.ProcessTools;
+
+
+/**
+ * @test
+ * @bug 8075926
+ * @summary Makes sure that the current management agent status is reflected
+ * in the related performance counters.
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
+ * @run testng/othervm -XX:+UsePerfData JMXStatusPerfCountersTest
+ */
+public class JMXStatusPerfCountersTest {
+ private final static String TEST_APP_NAME = "TestApp";
+
+ private final static String REMOTE_STATUS_KEY = "sun.management.JMXConnectorServer.remote.enabled";
+
+ private static ProcessBuilder testAppPb;
+ private Process testApp;
+
+ private ManagementAgentJcmd jcmd;
+
+ @BeforeClass
+ public static void setupClass() throws Exception {
+ testAppPb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+UsePerfData",
+ "-cp", System.getProperty("test.class.path"),
+ TEST_APP_NAME
+ );
+ }
+
+ @BeforeTest
+ public void setup() {
+ jcmd = new ManagementAgentJcmd(TEST_APP_NAME, false);
+ }
+
+ @BeforeMethod
+ public void startTestApp() throws Exception {
+ testApp = ProcessTools.startProcess(
+ TEST_APP_NAME, testAppPb,
+ (Predicate<String>)l->l.trim().equals("main enter")
+ );
+ }
+
+ @AfterMethod
+ public void stopTestApp() throws Exception {
+ testApp.getOutputStream().write(1);
+ testApp.getOutputStream().flush();
+ testApp.waitFor();
+ testApp = null;
+ }
+
+ /**
+ * The 'sun.management.JMXConnectorServer.remote.enabled' counter must not be
+ * exported if the remote agent is not enabled.
+ * @throws Exception
+ */
+ @Test
+ public void testNotInitializedRemote() throws Exception {
+ assertFalse(
+ getCounters().containsKey(REMOTE_STATUS_KEY),
+ "Unexpected occurrence of " + REMOTE_STATUS_KEY + " in perf counters"
+ );
+ }
+
+ /**
+ * After enabling the remote agent the 'sun.management.JMXConnectorServer.remote.enabled'
+ * counter will be exported with value of '0' - corresponding to the actual
+ * version of the associated remote connector perf counters.
+ * @throws Exception
+ */
+ @Test
+ public void testRemoteEnabled() throws Exception {
+ while (true) {
+ try {
+ int[] ports = PortAllocator.allocatePorts(1);
+ jcmd.start(
+ "jmxremote.port=" + ports[0],
+ "jmxremote.authenticate=false",
+ "jmxremote.ssl=false"
+ );
+ String v = getCounters().getProperty(REMOTE_STATUS_KEY);
+ assertNotNull(v);
+ assertEquals("0", v);
+ return;
+ } catch (BindException e) {
+ System.out.println("Failed to allocate ports. Retrying ...");
+ }
+ }
+ }
+
+ /**
+ * After disabling the remote agent the value of 'sun.management.JMXConnectorServer.remote.enabled'
+ * counter will become '-1'.
+ * @throws Exception
+ */
+ @Test
+ public void testRemoteDisabled() throws Exception {
+ while (true) {
+ try {
+ int[] ports = PortAllocator.allocatePorts(1);
+ jcmd.start(
+ "jmxremote.port=" + ports[0],
+ "jmxremote.authenticate=false",
+ "jmxremote.ssl=false"
+ );
+ jcmd.stop();
+ String v = getCounters().getProperty(REMOTE_STATUS_KEY);
+ assertNotNull(v);
+ assertEquals("-1", v);
+ return;
+ } catch (BindException e) {
+ System.out.println("Failed to allocate ports. Retrying ...");
+ }
+ }
+ }
+
+ /**
+ * Each subsequent re-enablement of the remote agent must keep the value of
+ * 'sun.management.JMXConnectorServer.remote.enabled' counter in sync with
+ * the actual version of the associated remote connector perf counters.
+ * @throws Exception
+ */
+ @Test
+ public void testRemoteReEnabled() throws Exception {
+ while (true) {
+ try {
+ int[] ports = PortAllocator.allocatePorts(1);
+ jcmd.start(
+ "jmxremote.port=" + ports[0],
+ "jmxremote.authenticate=false",
+ "jmxremote.ssl=false"
+ );
+ jcmd.stop();
+ jcmd.start(
+ "jmxremote.port=" + ports[0],
+ "jmxremote.authenticate=false",
+ "jmxremote.ssl=false"
+ );
+
+ String v = getCounters().getProperty(REMOTE_STATUS_KEY);
+ assertNotNull(v);
+ assertEquals("1", v);
+ return;
+ } catch (BindException e) {
+ System.out.println("Failed to allocate ports. Retrying ...");
+ }
+ }
+ }
+
+ private Properties getCounters() throws IOException, InterruptedException {
+ return jcmd.perfCounters("sun\\.management\\.JMXConnectorServer\\..*");
+ }
+}
\ No newline at end of file
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStatusTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -36,6 +36,7 @@
* Management agent may be disable, started (only local connections) and started.
* The test asserts that the expected text is being printed.
* @library /lib/testlibrary
+ * @modules java.management/sun.management
* @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
* @run testng/othervm -XX:+UsePerfData JMXStatusTest
*/
--- a/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/ManagementAgentJcmd.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,8 +25,10 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
import sun.management.Agent;
import sun.management.AgentConfigurationError;
@@ -43,6 +45,7 @@
private static final String CMD_START = "ManagementAgent.start";
private static final String CMD_START_LOCAL = "ManagementAgent.start_local";
private static final String CMD_STATUS = "ManagementAgent.status";
+ private static final String CMD_PRINTPERF = "PerfCounter.print";
private final String id;
private final boolean verbose;
@@ -63,6 +66,39 @@
}
/**
+ * `jcmd PerfCounter.print`
+ * @return Returns the available performance counters with their values as
+ * {@linkplain Properties} instance
+ * @throws IOException
+ * @throws InterruptedException
+ */
+ public Properties perfCounters() throws IOException, InterruptedException {
+ return perfCounters(".*");
+ }
+
+ /**
+ * `jcmd PerfCounter.print | grep {exp}>`
+ * @param regex Regular expression for including perf counters in the result
+ * @return Returns the matching performance counters with their values
+ * as {@linkplain Properties} instance
+ * @throws IOException
+ * @throws InterruptedException
+ */
+ public Properties perfCounters(String regex) throws IOException, InterruptedException {
+ Pattern pat = Pattern.compile(regex);
+ Properties p = new Properties();
+ for(String l : jcmd(CMD_PRINTPERF).split("\\n")) {
+ String[] kv = l.split("=");
+ if (kv.length > 1) {
+ if (pat.matcher(kv[0]).matches()) {
+ p.setProperty(kv[0], kv[1].replace("\"", ""));
+ }
+ }
+ }
+ return p;
+ }
+
+ /**
* `jcmd <app> ManagementAgent.stop`
* @return The JCMD output
* @throws IOException
--- a/jdk/test/sun/misc/CopyMemory.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/CopyMemory.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 6565543
* @summary Minimal test for unsafe.copyMemory() and unsafe.setMemory()
+ * @modules java.base/sun.nio.ch java.base/sun.misc
* @key randomness
*/
--- a/jdk/test/sun/misc/Encode/DecodeBuffer.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/Encode/DecodeBuffer.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4159554
* @summary Problem with UUDecoder
- *
+ * @modules java.base/sun.misc
*/
import sun.misc.*;
--- a/jdk/test/sun/misc/Encode/Encode.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/Encode/Encode.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4041231
* @summary Test UUEncoder.java for proper masking in encodeAtom
- *
+ * @modules java.base/sun.misc
*/
import sun.misc.*;
--- a/jdk/test/sun/misc/Encode/GetBytes.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/Encode/GetBytes.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 5031097
* @summary sun.misc.CharacterEncoder(ByteBuffer) is dumping too
* much information
+ * @modules java.base/sun.misc
* @author Brad Wetmore
*/
--- a/jdk/test/sun/misc/FloatingDecimal/TestFDBigInteger.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/FloatingDecimal/TestFDBigInteger.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,7 @@
* @test
* @bug 7032154
* @summary unit testys of sun.misc.FDBigInteger
+ * @modules java.base/sun.misc
* @author Dmitry Nadezhin
*/
public class TestFDBigInteger {
--- a/jdk/test/sun/misc/FloatingDecimal/TestFloatingDecimal.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/FloatingDecimal/TestFloatingDecimal.java Mon Jun 01 10:15:20 2015 -0700
@@ -58,6 +58,7 @@
* @test
* @bug 7032154
* @summary unit tests of sun.misc.FloatingDecimal
+ * @modules java.base/sun.misc
* @library ../../../java/lang/Math
* @build DoubleConsts FloatConsts
* @run main TestFloatingDecimal
--- a/jdk/test/sun/misc/JarIndex/JarIndexMergeTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/JarIndex/JarIndexMergeTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,9 +24,10 @@
/*
* @test
* @bug 6901992
+ * @summary InvalidJarIndexException due to bug in sun.misc.JarIndex.merge()
+ * @modules java.base/sun.misc
* @compile -XDignore.symbol.file JarIndexMergeTest.java
* @run main JarIndexMergeTest
- * @summary InvalidJarIndexException due to bug in sun.misc.JarIndex.merge()
* @author Diego Belfer
*/
--- a/jdk/test/sun/misc/JarIndex/metaInfFilenames/Basic.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/JarIndex/metaInfFilenames/Basic.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6887710
* @summary Verify the impact of sun.misc.JarIndex.metaInfFilenames on ServiceLoader
+ * @modules jdk.jartool/sun.tools.jar
* @run main/othervm Basic
*/
--- a/jdk/test/sun/misc/JavaLangAccess/FormatUnsigned.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/JavaLangAccess/FormatUnsigned.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,8 +26,9 @@
/*
* @test
+ * @bug 8050114
* @summary Test JavaLangAccess.formatUnsignedInt/-Long
- * @bug 8050114
+ * @modules java.base/sun.misc
*/
public class FormatUnsigned {
--- a/jdk/test/sun/misc/JavaLangAccess/NewUnsafeString.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/JavaLangAccess/NewUnsafeString.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,8 +28,9 @@
/*
* @test
+ * @bug 8013528
* @summary Test JavaLangAccess.newUnsafeString
- * @bug 8013528
+ * @modules java.base/sun.misc
* @compile -XDignore.symbol.file NewUnsafeString.java
*/
public class NewUnsafeString {
--- a/jdk/test/sun/misc/Safe.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/Safe.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @bug 4495577
* @summary Ensure that sun.misc.Unsafe cannot (easily)
* be accessed from user code
+ * @modules java.base/sun.misc
*/
--- a/jdk/test/sun/misc/URLClassPath/ClassnameCharTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/URLClassPath/ClassnameCharTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,10 +23,11 @@
/* @test
* @bug 4957669 5017871
+ * @summary cannot load class names containing some JSR 202 characters;
+ * plugin does not escape unicode character in http request
+ * @modules java.desktop/sun.applet
* @compile -XDignore.symbol.file=true ClassnameCharTest.java
* @run main ClassnameCharTest
- * @summary cannot load class names containing some JSR 202 characters;
- * plugin does not escape unicode character in http request
*/
import java.io.*;
--- a/jdk/test/sun/misc/VM/GetNanoTimeAdjustment.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/VM/GetNanoTimeAdjustment.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @test
* @bug 8068730
* @summary tests that VM.getgetNanoTimeAdjustment() works as expected.
+ * @modules java.base/sun.misc
* @run main GetNanoTimeAdjustment
* @author danielfuchs
*/
--- a/jdk/test/sun/misc/Version/Version.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/misc/Version/Version.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @bug 6994413
* @summary Check the JDK and JVM version returned by sun.misc.Version
* matches the versions defined in the system properties
+ * @modules java.base/sun.misc
* @compile -XDignore.symbol.file Version.java
* @run main Version
*/
--- a/jdk/test/sun/net/InetAddress/nameservice/chaining/Providers.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/InetAddress/nameservice/chaining/Providers.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4762344
* @summary 2nd nameservice provider is non functional
+ * @modules java.base/sun.net.spi.nameservice
* @compile -XDignore.symbol.file=true SimpleNameService.java
* Simple1NameServiceDescriptor.java
* Simple2NameServiceDescriptor.java
--- a/jdk/test/sun/net/InetAddress/nameservice/deadlock/Hang.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/InetAddress/nameservice/deadlock/Hang.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 7012768
+ * @modules java.base/sun.net.spi.nameservice
* @compile -XDignore.symbol.file=true ThrowingNameService.java
* ThrowingNameServiceDescriptor.java
* @run main/othervm/timeout=30 -Dsun.net.spi.nameservice.provider.1=throwing,sun Hang
--- a/jdk/test/sun/net/InetAddress/nameservice/simple/CacheTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/InetAddress/nameservice/simple/CacheTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @summary Check that InetAddress doesn't continue to throw UHE
* after the name service has recovered and the negative ttl
* on the initial lookup has expired.
+ * @modules java.base/sun.net.spi.nameservice
* @compile -XDignore.symbol.file=true SimpleNameService.java
* SimpleNameServiceDescriptor.java
* @run main/othervm/timeout=200 -Dsun.net.spi.nameservice.provider.1=simple,sun CacheTest
--- a/jdk/test/sun/net/InetAddress/nameservice/simple/DefaultCaching.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/InetAddress/nameservice/simple/DefaultCaching.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @bug 6442088
* @summary Change default DNS caching behavior for code not running under
* security manager.
+ * @modules java.base/sun.net.spi.nameservice
* @compile -XDignore.symbol.file=true SimpleNameService.java
* SimpleNameServiceDescriptor.java
* @run main/othervm/timeout=200 -Dsun.net.inetaddr.ttl=20 -Dsun.net.spi.nameservice.provider.1=simple,sun DefaultCaching
--- a/jdk/test/sun/net/TelnetTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/TelnetTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,7 @@
* @test
* @bug 4145748
* @summary test stickyCRLF in TelnetOutputStream
+ * @modules java.base/sun.net
*/
public class TelnetTest {
--- a/jdk/test/sun/net/ftp/B6427768.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/ftp/B6427768.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6427768
* @summary FtpURLConnection doesn't close FTP connection when login fails
+ * @modules java.base/sun.net.ftp
* @library ../www/ftptest/
* @build FtpServer FtpCommandHandler FtpAuthHandler FtpFileSystemHandler
* @run main/othervm/timeout=500 B6427768
--- a/jdk/test/sun/net/idn/PunycodeTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/idn/PunycodeTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @summary Unit test for sun.net.idn.Punycode
* @bug 4737170
+ * @modules java.base/sun.net.idn
* @compile -XDignore.symbol.file PunycodeTest.java
* @run main/othervm -ea PunycodeTest
* @author Edward Wang
--- a/jdk/test/sun/net/idn/TestStringPrep.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/idn/TestStringPrep.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @summary Unit test for sun.net.idn.Punycode
* @bug 4737170
+ * @modules java.base/sun.net.idn java.base/sun.text.normalizer
* @library .
* @compile -XDignore.symbol.file TestStringPrep.java NFS4StringPrep.java
* TestData.java
--- a/jdk/test/sun/net/www/AuthHeaderTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/AuthHeaderTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4804309
+ * @modules java.base/sun.net.www
* @library ../../../sun/net/www/httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @run main AuthHeaderTest
--- a/jdk/test/sun/net/www/EmbeddedEquals.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/EmbeddedEquals.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4456995
+ * @modules java.base/sun.net.www
* @summary HeaderParser misinterprets a '=' character embedded in value
*/
--- a/jdk/test/sun/net/www/HeaderTests.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/HeaderTests.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,7 @@
/**
* @test
+ * @modules java.base/sun.net.www
* @summary Tests for HeaderParser and MessageHeader
*
* Test of HeaderParser, MessageHeader changes
@@ -31,7 +32,6 @@
import sun.net.www.HeaderParser;
import sun.net.www.MessageHeader;
-import sun.net.www.protocol.http.AuthenticationHeader;
import java.io.*;
import java.util.Iterator;
--- a/jdk/test/sun/net/www/MessageHeaderTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/MessageHeaderTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 8003948
+ * @modules java.base/sun.net.www
* @run main MessageHeaderTest
*/
import java.io.*;
--- a/jdk/test/sun/net/www/ParseUtil_4922813.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/ParseUtil_4922813.java Mon Jun 01 10:15:20 2015 -0700
@@ -22,8 +22,9 @@
*/
/* @test
- @bug 4922813
- @summary Check the new impl of encodePath will not cause regression
+ * @bug 4922813
+ * @summary Check the new impl of encodePath will not cause regression
+ * @modules java.base/sun.net.www
@key randomness
*/
--- a/jdk/test/sun/net/www/ParseUtil_6274990.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/ParseUtil_6274990.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @summary REGRESSION: URLConnection.connect() throws Exception with non UTF-8 char
* @bug 6274990
+ * @modules java.base/sun.net.www
*/
import sun.net.www.*;
--- a/jdk/test/sun/net/www/ParseUtil_6306697.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/ParseUtil_6306697.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @summary PIT: CookieManager/TestCookieManager/TestCookieManager3 failed in Mustang PIT b47
* @bug 6306697
+ * @modules java.base/sun.net.www
*/
import sun.net.www.ParseUtil;
--- a/jdk/test/sun/net/www/ParseUtil_6380332.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/ParseUtil_6380332.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @summary SunTea applet fails to load under Mustang
* @bug 6380332
+ * @modules java.base/sun.net.www
*/
import sun.net.www.ParseUtil;
--- a/jdk/test/sun/net/www/ParseUtil_6478588.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/ParseUtil_6478588.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @summary StringIndexOutOfBoundsException in HttpURLConnection.getResponseCode
* @bug 6478588
+ * @modules java.base/sun.net.www
*/
import sun.net.www.ParseUtil;
--- a/jdk/test/sun/net/www/http/ChunkedInputStream/ChunkedEncodingWithProgressMonitorTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/http/ChunkedInputStream/ChunkedEncodingWithProgressMonitorTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,8 +24,9 @@
/**
* @test
* @bug 4333920 4994372
+ * @summary ChunkedEncoding unit test; MeteredStream/ProgressData problem
+ * @modules java.base/sun.net
* @run main ChunkedEncodingWithProgressMonitorTest
- * @summary ChunkedEncoding unit test; MeteredStream/ProgressData problem
*/
import java.net.*;
--- a/jdk/test/sun/net/www/http/HttpClient/GetProxyPort.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/http/HttpClient/GetProxyPort.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,8 @@
* @test
* @bug 5025019
* @summary REGRESSION: Sun implementation for HttpURLConnection could throw NPE
- *
+ * @modules java.base/sun.net
+ * java.base/sun.net.www.http
*/
import java.net.ServerSocket;
import java.net.URL;
--- a/jdk/test/sun/net/www/http/HttpClient/ImplicitFileName.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/http/HttpClient/ImplicitFileName.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,9 +24,10 @@
/*
* @test
* @bug 4251209
- * @summary Make sure that implicit filenames will be returned as
- * "/"
-*/
+ * @summary Make sure that implicit filenames will be returned as "/"
+ * @modules java.base/sun.net
+ * java.base/sun.net.www.http
+ */
import java.net.URL;
import java.net.ServerSocket;
--- a/jdk/test/sun/net/www/http/HttpClient/IsAvailable.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/http/HttpClient/IsAvailable.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @bug 8009650
* @summary HttpClient available() check throws SocketException when connection
* has been closed
+ * @modules java.base/sun.net
+ * java.base/sun.net.www.http
*/
import java.net.URL;
--- a/jdk/test/sun/net/www/http/HttpClient/IsKeepingAlive.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/http/HttpClient/IsKeepingAlive.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @bug 4277155
* @summary Make sure HttpClient.getHttpKeepAliveSet() has
* doPrivileged() call at appropriate places.
+ * @modules java.base/sun.net
+ * java.base/sun.net.www.http
* @run main/othervm/policy=IsKeepingAlive.policy IsKeepingAlive
*/
--- a/jdk/test/sun/net/www/http/HttpClient/OpenServer.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/http/HttpClient/OpenServer.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4154481
* @summary Make sure HttpClient has
* doPrivileged() calls at appropriate places.
+ * @modules java.base/sun.net.www.http
* @run main/othervm/policy=OpenServer.policy OpenServer
*/
--- a/jdk/test/sun/net/www/http/HttpClient/ProxyFromCache.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/http/HttpClient/ProxyFromCache.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,8 +24,9 @@
/*
* @test
* @bug 6498566
+ * @summary URL.openConnection(Proxy.NO_PROXY) may connect through a proxy.
+ * @modules java.base/sun.net.www
* @run main/othervm ProxyFromCache
- * @summary URL.openConnection(Proxy.NO_PROXY) may connect through a proxy.
*/
import java.net.*;
--- a/jdk/test/sun/net/www/http/HttpClient/RequestURI.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/http/HttpClient/RequestURI.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,8 +24,9 @@
/*
* @test
* @bug 6469663
+ * @summary HTTP Request-URI contains fragment when connecting through proxy
+ * @modules java.base/sun.net.www
* @run main/othervm RequestURI
- * @summary HTTP Request-URI contains fragment when connecting through proxy
*/
import java.net.*;
--- a/jdk/test/sun/net/www/http/KeepAliveCache/B5045306.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/http/KeepAliveCache/B5045306.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 5045306 6356004 6993490
+ * @modules java.base/sun.net.www
* @library ../../httptest/
* @build HttpCallback TestHttpServer HttpTransaction
* @run main/othervm B5045306
--- a/jdk/test/sun/net/www/protocol/ftp/UserAndPasswordTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/ftp/UserAndPasswordTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -39,7 +39,6 @@
import java.util.*;
import java.util.jar.*;
import java.util.zip.*;
-import sun.net.ftp.FtpLoginException;
public class UserAndPasswordTest {
--- a/jdk/test/sun/net/www/protocol/http/B6296310.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/B6296310.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 6296310
+ * @modules java.base/sun.net.www
* @library ../../httptest/
* @build HttpCallback TestHttpServer HttpTransaction
* @run main/othervm B6296310
--- a/jdk/test/sun/net/www/protocol/http/CloseOptionHeader.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/CloseOptionHeader.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 6189206
+ * @modules java.base/sun.net.www
* @run main/othervm -Dhttp.keepAlive=false CloseOptionHeader
* @summary HTTP client should set "Connection: close" header in request when keepalive is disabled
*/
--- a/jdk/test/sun/net/www/protocol/http/DigestTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/DigestTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4432213
+ * @modules java.base/sun.net.www
* @run main/othervm -Dhttp.auth.digest.validateServer=true DigestTest
* @summary Need to support Digest Authentication for Proxies
*/
--- a/jdk/test/sun/net/www/protocol/http/NTLMTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/NTLMTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 6520665 6357133
+ * @modules java.base/sun.net.www
* @run main/othervm NTLMTest
* @summary 6520665 & 6357133: NTLM authentication issues.
*/
--- a/jdk/test/sun/net/www/protocol/http/NoNTLM.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/NoNTLM.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @bug 8004502
* @summary Sanity check that NTLM will not be selected by the http protocol
* handler when running on a profile that does not support NTLM
+ * @modules java.base/sun.net.www
* @run main/othervm NoNTLM
*/
--- a/jdk/test/sun/net/www/protocol/http/RelativeRedirect.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/RelativeRedirect.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4726087
+ * @modules java.base/sun.net.www
* @library ../../httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @run main RelativeRedirect
--- a/jdk/test/sun/net/www/protocol/http/ResponseCacheStream.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/ResponseCacheStream.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 6262486
+ * @modules java.base/sun.net.www
* @library ../../httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @run main/othervm -Dhttp.keepAlive=false ResponseCacheStream
--- a/jdk/test/sun/net/www/protocol/http/RetryUponTimeout.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/RetryUponTimeout.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4772077
* @summary using defaultReadTimeout appear to retry request upon timeout
+ * @modules java.base/sun.net.www
*/
import java.net.*;
--- a/jdk/test/sun/net/www/protocol/http/SetChunkedStreamingMode.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/SetChunkedStreamingMode.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,8 +24,9 @@
/**
* @test
* @bug 5049976
+ * @modules java.base/sun.net.www
* @library ../../httptest/
- @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
+ * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @run main SetChunkedStreamingMode
* @summary Unspecified NPE is thrown when streaming output mode is enabled
*/
--- a/jdk/test/sun/net/www/protocol/http/TunnelThroughProxy.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/TunnelThroughProxy.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4620362
+ * @modules java.base/sun.net.www
* @run main/othervm TunnelThroughProxy
* @summary JSSE not returning proper exception on unknown host
*/
--- a/jdk/test/sun/net/www/protocol/http/UserAgent.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/UserAgent.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4512200
+ * @modules java.base/sun.net.www
* @run main/othervm -Dhttp.agent=foo UserAgent
* @summary HTTP header "User-Agent" format incorrect
*/
--- a/jdk/test/sun/net/www/protocol/http/ZoneId.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/http/ZoneId.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 8027308
+ * @modules java.base/sun.net.www.protocol.http
* @summary verifies that HttpURLConnection does not send the zone id in the
* 'Host' field of the header:
* Host: [fe80::a00:27ff:aaaa:aaaa] instead of
--- a/jdk/test/sun/net/www/protocol/https/ChunkedOutputStream.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/ChunkedOutputStream.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 5026745
+ * @modules java.base/sun.net.www
* @library ../../httpstest/
* @build TestHttpsServer HttpCallback
* @run main/othervm ChunkedOutputStream
--- a/jdk/test/sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/HttpsClient/ProxyAuthTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4323990 4413069
* @summary HttpsURLConnection doesn't send Proxy-Authorization on CONNECT
* Incorrect checking of proxy server response
+ * @modules java.base/sun.net.www
* @run main/othervm ProxyAuthTest
*
* No way to reserve and restore java.lang.Authenticator, need to run this
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6216082.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,11 +24,12 @@
/*
* @test
* @bug 6216082
- * @library ..
- * @build HttpCallback TestHttpsServer ClosedChannelList HttpTransaction TunnelProxy
* @summary Redirect problem with HttpsURLConnection using a proxy
* SunJSSE does not support dynamic system properties, no way to re-use
* system properties in samevm/agentvm mode.
+ * @modules java.base/sun.net.www
+ * @library ..
+ * @build HttpCallback TestHttpsServer ClosedChannelList HttpTransaction TunnelProxy
* @run main/othervm B6216082
*/
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6226610.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/B6226610.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,8 +24,9 @@
/*
* @test
* @bug 6226610 6973030
+ * @summary HTTP tunnel connections send user headers to proxy
+ * @modules java.base/sun.net.www
* @run main/othervm B6226610
- * @summary HTTP tunnel connections send user headers to proxy
*/
/* This class includes a proxy server that processes the HTTP CONNECT request,
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/CheckMethods.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/CheckMethods.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4423074
* @summary Need to rebase all the duplicated classes from Merlin.
* This test will check out http POST
+ * @modules java.base/sun.net.www.protocol.https java.base/com.sun.net.ssl.internal.www.protocol.https
*/
import java.net.*;
import java.util.*;
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/DNSIdentities.java Mon Jun 01 10:15:20 2015 -0700
@@ -46,8 +46,6 @@
import java.security.interfaces.*;
import java.math.BigInteger;
-import sun.security.ssl.SSLSocketImpl;
-
/*
* Certificates and key used in the test.
*
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPAddressDNSIdentities.java Mon Jun 01 10:15:20 2015 -0700
@@ -43,8 +43,6 @@
import java.security.interfaces.*;
import java.math.BigInteger;
-import sun.security.ssl.SSLSocketImpl;
-
/*
* Certificates and key used in the test.
*
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPAddressIPIdentities.java Mon Jun 01 10:15:20 2015 -0700
@@ -46,8 +46,6 @@
import java.security.interfaces.*;
import java.math.BigInteger;
-import sun.security.ssl.SSLSocketImpl;
-
/*
* Certificates and key used in the test.
*
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/IPIdentities.java Mon Jun 01 10:15:20 2015 -0700
@@ -46,8 +46,6 @@
import java.security.interfaces.*;
import java.math.BigInteger;
-import sun.security.ssl.SSLSocketImpl;
-
/*
* Certificates and key used in the test.
*
--- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/Identities.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/Identities.java Mon Jun 01 10:15:20 2015 -0700
@@ -46,8 +46,6 @@
import java.security.interfaces.*;
import java.math.BigInteger;
-import sun.security.ssl.SSLSocketImpl;
-
/*
* Certificates and key used in the test.
*
--- a/jdk/test/sun/net/www/protocol/https/NewImpl/ComHTTPSConnection.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/NewImpl/ComHTTPSConnection.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 4474255
* @summary Can no longer obtain a com.sun.net.ssl.HttpsURLConnection
+ * @modules java.base/com.sun.net.ssl
+ * java.base/com.sun.net.ssl.internal.www.protocol.https
* @run main/othervm ComHTTPSConnection
*
* SunJSSE does not support dynamic system properties, no way to re-use
--- a/jdk/test/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/net/www/protocol/https/NewImpl/ComHostnameVerifier.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,8 @@
* @bug 4484246
* @summary When an application enables anonymous SSL cipher suite,
* Hostname verification is not required
+ * @modules java.base/com.sun.net.ssl
+ * java.base/com.sun.net.ssl.internal.www.protocol.https
* @run main/othervm ComHostnameVerifier
*
* SunJSSE does not support dynamic system properties, no way to re-use
--- a/jdk/test/sun/nio/cs/OLD/TestIBMDB.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/nio/cs/OLD/TestIBMDB.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6843578
* @summary Test old and new implementation of db charsets
* @build IBM930_OLD IBM933_OLD IBM935_OLD IBM937_OLD IBM939_OLD IBM942_OLD IBM943_OLD IBM948_OLD IBM949_OLD IBM950_OLD IBM970_OLD IBM942C_OLD IBM943C_OLD IBM949C_OLD IBM1381_OLD IBM1383_OLD EUC_CN_OLD EUC_KR_OLD GBK_OLD Johab_OLD MS932_OLD MS936_OLD MS949_OLD MS950_OLD SJIS_OLD PCK_OLD EUC_JP_OLD EUC_JP_LINUX_OLD EUC_JP_Open_OLD
+ * @modules java.base/sun.nio.cs jdk.charsets/sun.nio.cs.ext
* @run main TestIBMDB
*/
--- a/jdk/test/sun/nio/cs/Test4200310.sh Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-#
-# Copyright (c) 2008, 2010, 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 4200310
-# @summary make sure class files are not duplicated between rt.jar,
-# charsets.jar, and localedata.jar
-# @author Norbert Lindenberg
-# @run shell Test4200310.sh
-
-2>&1 $TESTJAVA/bin/jar -tf "$TESTJAVA/jre/lib/rt.jar" > class-list
-2>&1 $TESTJAVA/bin/jar -tf "$TESTJAVA/jre/lib/charsets.jar" >> class-list
-2>&1 $TESTJAVA/bin/jar -tf "$TESTJAVA/jre/lib/ext/localedata.jar" >> class-list
-duplicates=`grep '\.class$' class-list | sort | uniq -d`
-
-rm -f class-list
-if [ "$duplicates" != "" ]; then
- echo FAILED: $duplicates are duplicated between rt.jar, charsets.jar, and localedata.jar
- exit 1
-fi
-
-exit 0
--- a/jdk/test/sun/nio/cs/TestEUC_TW.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/nio/cs/TestEUC_TW.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6831794 6229811
* @summary Test EUC_TW charset
+ * @modules java.base/sun.nio.cs
*/
import java.nio.charset.*;
--- a/jdk/test/sun/nio/cs/TestISO2022JP.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/nio/cs/TestISO2022JP.java Mon Jun 01 10:15:20 2015 -0700
@@ -22,7 +22,7 @@
*/
/* @test
- @bug 4626545 4879522 4913711 4119445
+ @bug 4626545 4879522 4913711 4119445 8042125
@summary Check full coverage encode/decode for ISO-2022-JP
*/
@@ -33,6 +33,8 @@
*/
import java.io.*;
+import java.util.Arrays;
+
public class TestISO2022JP {
private final static String US_ASCII =
@@ -608,5 +610,41 @@
if (encoded[i] != expected[i])
throw new Exception("ISO-2022-JP Decoder error");
}
+
+ // Test for 7 c2b codepoints in ms932 iso2022jp
+ String testStr4 = "\u00b8\u00b7\u00af\u00ab\u00bb\u3094\u00b5";
+ expected = new byte[] {
+ (byte)0x1b, (byte)0x24, (byte)0x42,
+ (byte)0x21, (byte)0x24,
+ (byte)0x21, (byte)0x26,
+ (byte)0x21, (byte)0x31,
+ (byte)0x22, (byte)0x63,
+ (byte)0x22, (byte)0x64,
+ (byte)0x25, (byte)0x74,
+ (byte)0x26, (byte)0x4c,
+ (byte)0x1b, (byte)0x28, (byte)0x42 };
+ encoded = testStr4.getBytes("x-windows-iso2022jp");
+ if (!Arrays.equals(encoded, expected)) {
+ throw new Exception("MSISO2022JP Encoder error");
+ }
+ // Test for 10 non-roundtrip characters in ms932 iso2022jp
+ encoded = new byte[] {
+ (byte)0x1B, (byte)0x24, (byte)0x42,
+ (byte)0x22, (byte)0x4C,
+ (byte)0x22, (byte)0x5D,
+ (byte)0x22, (byte)0x65,
+ (byte)0x22, (byte)0x69,
+ (byte)0x2D, (byte)0x70,
+ (byte)0x2D, (byte)0x71,
+ (byte)0x2D, (byte)0x77,
+ (byte)0x2D, (byte)0x7A,
+ (byte)0x2D, (byte)0x7B,
+ (byte)0x2D, (byte)0x7C,
+ (byte)0x1B, (byte)0x28, (byte)0x42,
+ };
+ String expectedStr = "\uffe2\u22a5\u221a\u222b\u2252\u2261\u2220\u2235\u2229\u222a";
+ if (!new String(encoded, "x-windows-iso2022jp").equals(expectedStr)) {
+ throw new Exception("MSISO2022JP Decoder error");
+ }
}
}
--- a/jdk/test/sun/nio/cs/TestJIS0212Decoder.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/nio/cs/TestJIS0212Decoder.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,7 +23,7 @@
/*
* @test
- @bug 4179800
+ @bug 4179800 8042125
@summary Make sure JIS0212.Decoder really works
*/
@@ -38,25 +38,26 @@
(byte)0x30, (byte)0x25, (byte)0x30, (byte)0x26,
(byte)0x30, (byte)0x27};
- public static void main(String args[])
- throws Exception
- {
+ public static void main(String args[]) throws Exception {
test();
}
- private static void test()
- throws Exception
- {
+ private static void test() throws Exception {
CharsetDecoder dec = Charset.forName("JIS0212").newDecoder();
try {
String ret = dec.decode(ByteBuffer.wrap(inputBytes)).toString();
if (ret.length() != outputString.length()
|| ! outputString.equals(ret)){
- throw new Exception("ByteToCharJIS0212 does not work correctly");
+ throw new Exception("JIS0212 decoder does not work correctly");
}
+ } catch (Exception e){
+ throw new Exception("JIS0212 encoder does not work correctly");
}
- catch (Exception e){
- throw new Exception("ByteToCharJIS0212 does not work correctly");
+
+ // test 0x742c -> u2116 mapping
+ if (!"\u2116".equals(new String(new byte[] { (byte)0x8f, (byte)0xf4, (byte)0xac },
+ "x-eucJP-Open"))) {
+ throw new RuntimeException("JIS0212_Solaris nr mapping failed");
}
}
}
--- a/jdk/test/sun/nio/cs/TestStringCoding.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/nio/cs/TestStringCoding.java Mon Jun 01 10:15:20 2015 -0700
@@ -22,8 +22,9 @@
*/
/* @test
- @bug 6636323 6636319 7040220 7096080 7183053 8080248
- @summary Test if StringCoding and NIO result have the same de/encoding result
+ * @bug 6636323 6636319 7040220 7096080 7183053 8080248
+ * @summary Test if StringCoding and NIO result have the same de/encoding result
+ * @modules java.base/sun.nio.cs
* @run main/othervm/timeout=2000 TestStringCoding
* @key randomness
*/
--- a/jdk/test/sun/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,8 +25,10 @@
* @test
* @bug 7194897
* @summary JSR 292: Cannot create more than 16 instances of an anonymous class
+ * @modules java.base/sun.misc
+ * @modules java.management
+ * @library /lib/testlibrary
* @author Robert Field
- * @library /lib/testlibrary
* @compile -XDignore.symbol.file ManyNewInstanceAnonTest.java
* @build jdk.testlibrary.*
* @run main ClassFileInstaller ManyNewInstanceAnonTest
--- a/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java Mon Jun 01 10:15:20 2015 -0700
@@ -48,6 +48,7 @@
* @bug 8010117
* @summary Verify if CallerSensitive methods are annotated with
* sun.reflect.CallerSensitive annotation
+ * @modules jdk.compiler/com.sun.tools.classfile jdk.jdeps/com.sun.tools.jdeps
* @build CallerSensitiveFinder
* @run main/othervm/timeout=900 CallerSensitiveFinder
*/
--- a/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,10 @@
* @test
* @bug 8010117
* @summary Test CallerSensitiveFinder to find missing annotation
+ * @modules java.base/sun.reflect
+ * jdk.jdeps/com.sun.tools.classfile
+ * jdk.jdeps/com.sun.tools.jdeps
+ * @modules java.base/sun.reflect
* @compile -XDignore.symbol.file MissingCallerSensitive.java
* @build CallerSensitiveFinder
* @run main MissingCallerSensitive
--- a/jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8025799
* @summary sun.reflect.Reflection.getCallerClass(int)
+ * @modules java.base/sun.reflect
* @run main GetCallerClassWithDepth
*/
--- a/jdk/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/log/ReliableLog/LogAlignmentTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @bug 4094889
* @summary rmid can have a corrupted log
*
+ * @modules java.rmi/sun.rmi.log
* @run main/othervm LogAlignmentTest
*/
--- a/jdk/test/sun/rmi/log/ReliableLog/SnapshotSize.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/log/ReliableLog/SnapshotSize.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @summary Verify that ReliableLog.snapshotSize() returns correct snapshot
* file size even if LogHandler doesn't flush.
*
+ * @modules java.rmi/sun.rmi.log
* @run main/othervm SnapshotSize
*/
--- a/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,8 @@
* @summary New constructor in sun.tools.java.ClassPath builds a path using
* File.separator instead of File.pathSeparator. This test does
* not affect VM global state, so othervm is not required.
+ * @modules jdk.rmic/sun.rmi.rmic
+ * jdk.rmic/sun.tools.java
* @run main RMICClassPathTest
*/
--- a/jdk/test/sun/rmi/rmic/iiopCompilation/IIOPCompilation.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/rmic/iiopCompilation/IIOPCompilation.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,11 @@
/* @test
* @bug 8065957
* @library ../../../../java/rmi/testlibrary
+ * @modules java.corba
+ * java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @summary Compiles a PortableRemoteObject with rmic -iiop and ensures that stub and tie classes are generated.
* @run main IIOPCompilation
--- a/jdk/test/sun/rmi/runtime/Log/4504153/Test4504153.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/runtime/Log/4504153/Test4504153.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Peter Jones
*
* @library ../../../../../java/rmi/testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build JavaVM
* @run main/othervm Test4504153
*/
--- a/jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/runtime/Log/6409194/NoConsoleOutput.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* @author Peter Jones
*
* @library ../../../../../java/rmi/testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary JavaVM
* @run main/othervm NoConsoleOutput
*/
--- a/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogStreams.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Laird Dornin
*
* @library ../../../../../java/rmi/testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary CheckLogging
* @run main/othervm -Dsun.rmi.log.useOld=true CheckLogStreams
*/
--- a/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/runtime/Log/checkLogging/CheckLogging.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,10 @@
* @author Laird Dornin
*
* @library ../../../../../java/rmi/testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm CheckLogging
*/
--- a/jdk/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/MarshalForeignStub.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,6 +31,10 @@
* @author Ann Wollrath
*
* @library ../../../../../java/rmi/testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary Receiver MarshalForeignStub_Stub
* @run main/othervm/policy=security.policy MarshalForeignStub
*/
--- a/jdk/test/sun/rmi/transport/proxy/DisableHttpDefaultValue.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/transport/proxy/DisableHttpDefaultValue.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @bug 8023862
* @summary Verify that the default value of the java.rmi.server.disableHttp
* has been changed from false to true.
+ * @modules java.rmi/sun.rmi.transport.proxy
* @compile -XDignore.symbol.file DisableHttpDefaultValue.java
*
* @run main/othervm DisableHttpDefaultValue true
--- a/jdk/test/sun/rmi/transport/proxy/EagerHttpFallback.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/transport/proxy/EagerHttpFallback.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,10 @@
* sun.rmi.transport.proxy.eagerHttpFallback system property is set.
*
* @library ../../../../java/rmi/testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary
* @run main/othervm EagerHttpFallback
*/
--- a/jdk/test/sun/rmi/transport/tcp/DeadCachedConnection.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/transport/tcp/DeadCachedConnection.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,10 @@
* @bug 4094891
* @summary unable to retry call if cached connection to server is used
* @library ../../../../java/rmi/testlibrary
+ * @modules java.rmi/sun.rmi.registry
+ * java.rmi/sun.rmi.server
+ * java.rmi/sun.rmi.transport
+ * java.rmi/sun.rmi.transport.tcp
* @build TestLibrary JavaVM
* @run main/othervm DeadCachedConnection
*/
--- a/jdk/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/rmi/transport/tcp/blockAccept/BlockAcceptTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,7 @@
* @author Adrian Colley
*
* @library ../../../../../java/rmi/testlibrary
+ * @modules java.rmi/sun.rmi.transport.proxy
* @build TestIface TestImpl TestImpl_Stub
* @run main/othervm/policy=security.policy/timeout=60 BlockAcceptTest
*/
--- a/jdk/test/sun/security/action/Generify.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/action/Generify.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 5057136
* @summary Generify sun.security.action.GetPropertyAction and friends
+ * @modules java.base/sun.security.action
*/
import java.io.*;
--- a/jdk/test/sun/security/action/GetLongAction/ReturnNullIfNoDefault.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/action/GetLongAction/ReturnNullIfNoDefault.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4173993
* @summary Make sure "null" is returned if property does not exist (or has
* wrong numeric format) and no default has been specified.
+ * @modules java.base/sun.security.action
*/
import sun.security.action.*;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ec/SignatureOffsets.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SignatureException;
+
+/*
+ * @test
+ * @bug 8050374
+ * @key randomness
+ * @summary This test validates signature verification
+ * Signature.verify(byte[], int, int). The test uses RandomFactory to
+ * get random set of clear text data to sign. After the signature
+ * generation, the test tries to verify signature with the above API
+ * and passing in different signature offset (0, 33, 66, 99).
+ * @library /lib/testlibrary
+ * @compile ../../../java/security/Signature/Offsets.java
+ * @run main SignatureOffsets SunEC NONEwithECDSA
+ * @run main SignatureOffsets SunEC SHA1withECDSA
+ * @run main SignatureOffsets SunEC SHA256withECDSA
+ * @run main SignatureOffsets SunEC SHA224withECDSA
+ * @run main SignatureOffsets SunEC SHA384withECDSA
+ * @run main SignatureOffsets SunEC SHA512withECDSA
+ */
+public class SignatureOffsets {
+
+ public static void main(String[] args) throws NoSuchAlgorithmException,
+ InvalidKeyException, SignatureException {
+ Offsets.main(args);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ec/SignedObjectChain.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015, 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 8050374
+ * @compile ../../../java/security/SignedObject/Chain.java
+ * @summary Verify a chain of signed objects
+ */
+public class SignedObjectChain {
+
+ private static class Test extends Chain.Test {
+
+ public Test(Chain.SigAlg sigAlg) {
+ super(sigAlg, Chain.KeyAlg.EC, Chain.Provider.SunEC);
+ }
+ }
+
+ private static final Test[] tests = {
+ new Test(Chain.SigAlg.SHA1withECDSA),
+ new Test(Chain.SigAlg.SHA256withECDSA),
+ new Test(Chain.SigAlg.SHA224withECDSA),
+ new Test(Chain.SigAlg.SHA384withECDSA),
+ new Test(Chain.SigAlg.SHA512withECDSA),
+ };
+
+ public static void main(String argv[]) {
+ boolean resutl = java.util.Arrays.stream(tests).allMatch(
+ (test) -> Chain.runTest(test));
+
+ if(resutl) {
+ System.out.println("All tests passed");
+ } else {
+ throw new RuntimeException("Some tests failed");
+ }
+ }
+}
--- a/jdk/test/sun/security/ec/TestEC.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/ec/TestEC.java Mon Jun 01 10:15:20 2015 -0700
@@ -34,6 +34,7 @@
* @library ../pkcs11/ec
* @library ../pkcs11/sslecc
* @library ../../../java/security/testlibrary
+ * @modules jdk.crypto.pkcs11/sun.security.pkcs11.wrapper
* @compile -XDignore.symbol.file TestEC.java
* @run main/othervm TestEC
*/
--- a/jdk/test/sun/security/jgss/DefaultGssConfig.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/jgss/DefaultGssConfig.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6483218
* @summary Provide a default login configuration
+ * @modules java.security.jgss/sun.security.jgss
*/
import java.io.FileNotFoundException;
--- a/jdk/test/sun/security/jgss/GssNPE.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/jgss/GssNPE.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 6345338
+ * @modules java.security.jgss/sun.security.jgss
* @run main/othervm GssNPE
* @summary GSS throws NPE when the JAAS config file does not exist
*/
--- a/jdk/test/sun/security/jgss/spnego/NegTokenTargFields.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/jgss/spnego/NegTokenTargFields.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 7040151
* @summary SPNEGO GSS code does not parse tokens in accordance to RFC 2478
+ * @modules java.security.jgss/sun.security.jgss.spnego
* @compile -XDignore.symbol.file NegTokenTargFields.java
* @run main NegTokenTargFields nomech
* @run main/fail NegTokenTargFields badorder
--- a/jdk/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 6770883
+ * @modules java.security.jgss/sun.security.jgss
* @run main/othervm NoSpnegoAsDefMech
* @summary Infinite loop if SPNEGO specified as sun.security.jgss.mechanism
*/
--- a/jdk/test/sun/security/jgss/spnego/NotPreferredMech.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/jgss/spnego/NotPreferredMech.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,9 @@
/*
* @test
* @bug 8048194
+ * @modules java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.jgss.spnego
* @run main/othervm NotPreferredMech
* @summary GSSContext.acceptSecContext fails when a supported mech is not initiator preferred
*/
--- a/jdk/test/sun/security/krb5/KrbCredSubKey.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/KrbCredSubKey.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
/**
* @test
* @bug 7030180
+ * @modules java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
* @run main/othervm KrbCredSubKey
* @summary AES 128/256 decrypt exception
*/
--- a/jdk/test/sun/security/krb5/MicroTime.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/MicroTime.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
* @test
* @bug 6882687 8011124
* @summary KerberosTime too imprecise
+ * @modules java.security.jgss/sun.security.krb5.internal
*/
import sun.security.krb5.internal.KerberosTime;
--- a/jdk/test/sun/security/krb5/NegativeNonce.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/NegativeNonce.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
* @test
* @bug 6517944
* @summary Nonce should be UInt32
+ * @modules java.security.jgss/sun.security.krb5.internal.crypto
*/
import sun.security.krb5.internal.crypto.Nonce;
--- a/jdk/test/sun/security/krb5/OptionPADataInKDCReq.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/OptionPADataInKDCReq.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
* @test
* @bug 6648972
* @summary KDCReq.init always read padata
+ * @modules java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5.internal
*/
import sun.security.krb5.internal.ETypeInfo2;
import sun.security.krb5.internal.KDCReq;
--- a/jdk/test/sun/security/krb5/RFC396xTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/RFC396xTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,9 @@
/*
* @test
* @bug 6862679
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.crypto.dk
* @run main/othervm RFC396xTest
* @summary ESC: AD Authentication with user with umlauts fails
*/
--- a/jdk/test/sun/security/krb5/ServiceCredsCombination.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/ServiceCredsCombination.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,7 @@
/*
* @test
* @bug 8005447
+ * @modules java.security.jgss/sun.security.jgss
* @compile -XDignore.symbol.file ServiceCredsCombination.java
* @run main ServiceCredsCombination
* @summary default principal can act as anyone
--- a/jdk/test/sun/security/krb5/TestPAData.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/TestPAData.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
* @test
* @bug 6570062
* @summary Kerberos authentication regression
+ * @modules java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5.internal
*/
import sun.security.krb5.internal.KRBError;
--- a/jdk/test/sun/security/krb5/UnknownCCEntry.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/UnknownCCEntry.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
* @test
* @bug 6979329
* @summary CCacheInputStream fails to read ticket cache files from Kerberos 1.8.1
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.ccache
*/
import java.io.ByteArrayInputStream;
--- a/jdk/test/sun/security/krb5/auto/AcceptPermissions.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/AcceptPermissions.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 9999999
* @summary default principal can act as anyone
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file AcceptPermissions.java
* @run main/othervm AcceptPermissions two
* @run main/othervm AcceptPermissions unbound
--- a/jdk/test/sun/security/krb5/auto/AcceptorSubKey.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/AcceptorSubKey.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 7077646
* @summary gssapi wrap for CFX per-message tokens always set FLAG_ACCEPTOR_SUBKEY
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file AcceptorSubKey.java
* @run main/othervm AcceptorSubKey 0
* @run main/othervm AcceptorSubKey 4
--- a/jdk/test/sun/security/krb5/auto/AddressesAndNameType.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/AddressesAndNameType.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 4501327 4868379 8039132
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm AddressesAndNameType 1
* @run main/othervm AddressesAndNameType 2
* @run main/othervm AddressesAndNameType 3
--- a/jdk/test/sun/security/krb5/auto/BadKdc1.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/BadKdc1.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 6843127
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm/timeout=300 BadKdc1
* @summary krb5 should not try to access unavailable kdc too often
*/
--- a/jdk/test/sun/security/krb5/auto/BadKdc2.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/BadKdc2.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 6843127
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm/timeout=300 BadKdc2
* @summary krb5 should not try to access unavailable kdc too often
*/
--- a/jdk/test/sun/security/krb5/auto/BadKdc3.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/BadKdc3.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 6843127
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm/timeout=300 BadKdc3
* @summary krb5 should not try to access unavailable kdc too often
*/
--- a/jdk/test/sun/security/krb5/auto/BadKdc4.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/BadKdc4.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 6843127
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm/timeout=300 BadKdc4
* @summary krb5 should not try to access unavailable kdc too often
*/
--- a/jdk/test/sun/security/krb5/auto/Basic.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/Basic.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 7152176
* @summary More krb5 tests
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file Basic.java
* @run main/othervm Basic
*/
--- a/jdk/test/sun/security/krb5/auto/BasicKrb5Test.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/BasicKrb5Test.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 6706974
* @summary Add krb5 test infrastructure
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file BasicKrb5Test.java
* @run main/othervm BasicKrb5Test
* @run main/othervm BasicKrb5Test des-cbc-crc
--- a/jdk/test/sun/security/krb5/auto/BasicProc.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/BasicProc.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,13 @@
* @bug 8009977
* @summary A test library to launch multiple Java processes
* @library ../../../../java/security/testlibrary/
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file BasicProc.java
* @run main/othervm BasicProc
*/
--- a/jdk/test/sun/security/krb5/auto/CleanState.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/CleanState.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 6716534
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file CleanState.java
* @run main/othervm CleanState
* @summary Krb5LoginModule has not cleaned temp info between authentication attempts
--- a/jdk/test/sun/security/krb5/auto/CrossRealm.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/CrossRealm.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 6706974
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file CrossRealm.java
* @run main/othervm CrossRealm
* @summary Add krb5 test infrastructure
--- a/jdk/test/sun/security/krb5/auto/DiffNameSameKey.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/DiffNameSameKey.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8005447
* @summary default principal can act as anyone
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file DiffNameSameKey.java
* @run main/othervm/fail DiffNameSameKey a
* @run main/othervm DiffNameSameKey b
--- a/jdk/test/sun/security/krb5/auto/DupEtypes.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/DupEtypes.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 7067974
* @summary multiple ETYPE-INFO-ENTRY with same etype and different salt
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file DupEtypes.java
* @run main/othervm DupEtypes 1
* @run main/othervm DupEtypes 2
--- a/jdk/test/sun/security/krb5/auto/DynamicKeytab.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/DynamicKeytab.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 6894072
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file DynamicKeytab.java
* @run main/othervm DynamicKeytab
* @summary always refresh keytab
--- a/jdk/test/sun/security/krb5/auto/EmptyPassword.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/EmptyPassword.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,13 @@
* @test
* @bug 6879540
* @summary enable empty password for kerberos 5
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file EmptyPassword.java
* @run main/othervm EmptyPassword
*/
--- a/jdk/test/sun/security/krb5/auto/FileKeyTab.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/FileKeyTab.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,13 +25,19 @@
* @test
* @bug 7152121
* @summary Krb5LoginModule no longer handles keyTabNames with "file:" prefix
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file FileKeyTab.java
* @run main/othervm FileKeyTab
*/
import java.io.File;
import java.io.FileOutputStream;
-import sun.security.jgss.GSSUtil;
// The basic krb5 test skeleton you can copy from
public class FileKeyTab {
--- a/jdk/test/sun/security/krb5/auto/ForwardableCheck.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/ForwardableCheck.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8022582
* @summary Relax response flags checking in sun.security.krb5.KrbKdcRep.check.
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file ForwardableCheck.java
* @run main/othervm ForwardableCheck
*/
--- a/jdk/test/sun/security/krb5/auto/GSS.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/GSS.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 7152176
* @summary More krb5 tests
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file GSS.java
* @run main/othervm GSS
*/
--- a/jdk/test/sun/security/krb5/auto/GSSUnbound.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/GSSUnbound.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8001104
* @summary Unbound SASL service: the GSSAPI/krb5 mech
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file GSSUnbound.java
* @run main/othervm GSSUnbound
*/
--- a/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/HttpNegotiateServer.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,15 @@
/*
* @test
* @bug 6578647 6829283
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.base/sun.util.logging
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm HttpNegotiateServer
* @summary Undefined requesting URL in java.net.Authenticator.getPasswordAuthentication()
* @summary HTTP/Negotiate: Authenticator triggered again when user cancels the first one
--- a/jdk/test/sun/security/krb5/auto/IgnoreChannelBinding.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/IgnoreChannelBinding.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 6851973
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm IgnoreChannelBinding
* @summary ignore incoming channel binding if acceptor does not set one
*/
--- a/jdk/test/sun/security/krb5/auto/KPEquals.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/KPEquals.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8015669
* @summary KerberosPrincipal::equals should ignore name-type
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file KPEquals.java
* @run main/othervm KPEquals
*/
--- a/jdk/test/sun/security/krb5/auto/KeyPermissions.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/KeyPermissions.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8004488
* @summary wrong permissions checked in krb5
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file KeyPermissions.java
* @run main/othervm KeyPermissions
*/
--- a/jdk/test/sun/security/krb5/auto/KeyTabCompat.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/KeyTabCompat.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 6894072
* @bug 8004488
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file KeyTabCompat.java
* @run main/othervm KeyTabCompat
* @summary always refresh keytab
--- a/jdk/test/sun/security/krb5/auto/KvnoNA.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/KvnoNA.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 7197159
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file KvnoNA.java
* @run main/othervm KvnoNA
* @summary accept different kvno if there no match
--- a/jdk/test/sun/security/krb5/auto/LifeTimeInSeconds.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/LifeTimeInSeconds.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 6857802
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm LifeTimeInSeconds
* @summary GSS getRemainingInitLifetime method returns milliseconds not seconds
*/
--- a/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 6765491
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm LoginModuleOptions
* @summary Krb5LoginModule a little too restrictive, and the doc is not clear.
*/
--- a/jdk/test/sun/security/krb5/auto/LoginNoPass.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/LoginNoPass.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8028351
* @summary JWS doesn't get authenticated when using kerberos auth proxy
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file LoginNoPass.java
* @run main/othervm LoginNoPass
*/
--- a/jdk/test/sun/security/krb5/auto/MSOID2.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/MSOID2.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,15 @@
* @test
* @bug 8078439
* @summary SPNEGO auth fails if client proposes MS krb5 OID
+ * @modules java.base/sun.misc
+ * java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file MSOID2.java
* @run main/othervm MSOID2
*/
--- a/jdk/test/sun/security/krb5/auto/MaxRetries.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/MaxRetries.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 6844193
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file MaxRetries.java
* @run main/othervm/timeout=300 MaxRetries
* @summary support max_retries in krb5.conf
--- a/jdk/test/sun/security/krb5/auto/MoreKvno.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/MoreKvno.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 6893158 6907425 7197159
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm MoreKvno
* @summary AP_REQ check should use key version number
*/
--- a/jdk/test/sun/security/krb5/auto/NewInquireTypes.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/NewInquireTypes.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8043071
* @summary Expose session key and KRB_CRED through extended GSS-API
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file NewInquireTypes.java
* @run main/othervm NewInquireTypes
*/
--- a/jdk/test/sun/security/krb5/auto/NewSalt.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/NewSalt.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 6960894
* @summary Better AS-REQ creation and processing
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm NewSalt
* @run main/othervm -Dnopreauth NewSalt
* @run main/othervm -Donlyonepreauth NewSalt
--- a/jdk/test/sun/security/krb5/auto/NoAddresses.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/NoAddresses.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 7032354
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm NoAddresses 1
* @run main/othervm NoAddresses 2
* @run main/othervm/fail NoAddresses 3
--- a/jdk/test/sun/security/krb5/auto/NoInitNoKeytab.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/NoInitNoKeytab.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 7089889
* @summary Krb5LoginModule.login() throws an exception if used without a keytab
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file NoInitNoKeytab.java
* @run main/othervm NoInitNoKeytab
*/
--- a/jdk/test/sun/security/krb5/auto/NonMutualSpnego.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/NonMutualSpnego.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 6733095
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm NonMutualSpnego
* @summary Failure when SPNEGO request non-Mutual
*/
--- a/jdk/test/sun/security/krb5/auto/NoneReplayCacheTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/NoneReplayCacheTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 8001326
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm NoneReplayCacheTest
* @summary the replaycache type none cannot stop an authenticator replay,
* but it can stop a message replay when s.s.k.acceptor.subkey is true.
--- a/jdk/test/sun/security/krb5/auto/OkAsDelegate.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/OkAsDelegate.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 6853328 7172701
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm OkAsDelegate false true true false false false
* FORWARDABLE ticket not allowed, always fail
* @run main/othervm OkAsDelegate true false false false false false
--- a/jdk/test/sun/security/krb5/auto/OkAsDelegateXRealm.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/OkAsDelegateXRealm.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 6853328 7172701
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm OkAsDelegateXRealm false
* KDC no OK-AS-DELEGATE, fail
* @run main/othervm -Dtest.kdc.policy.ok-as-delegate OkAsDelegateXRealm true
--- a/jdk/test/sun/security/krb5/auto/OnlyDesLogin.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/OnlyDesLogin.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,13 @@
* @test
* @bug 8014310
* @summary JAAS/Krb5LoginModule using des encytypes failure with NPE after JDK-8012679
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file OnlyDesLogin.java
* @run main/othervm OnlyDesLogin
*/
--- a/jdk/test/sun/security/krb5/auto/PrincipalNameEquals.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/PrincipalNameEquals.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 7061379
* @summary [Kerberos] Cross-realm authentication fails, due to nameType problem
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file PrincipalNameEquals.java
* @run main/othervm PrincipalNameEquals
*/
--- a/jdk/test/sun/security/krb5/auto/RRC.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/RRC.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 7077640
* @summary gss wrap for cfx doesn't handle rrc != 0
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file RRC.java
* @run main/othervm RRC
*/
--- a/jdk/test/sun/security/krb5/auto/Renewal.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/Renewal.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,11 +27,17 @@
* @summary Add kinit options and krb5.conf flags that allow users to
* obtain renewable tickets and specify ticket lifetimes
* @library ../../../../java/security/testlibrary/
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file Renewal.java
* @run main/othervm Renewal
*/
-import sun.security.jgss.GSSUtil;
import sun.security.krb5.Config;
import sun.security.krb5.internal.ccache.Credentials;
import sun.security.krb5.internal.ccache.FileCredentialsCache;
--- a/jdk/test/sun/security/krb5/auto/ReplayCacheExpunge.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheExpunge.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
/*
* @test
* @bug 8001326
+ * @modules java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.rcache
* @run main/othervm ReplayCacheExpunge 16
* @run main/othervm/fail ReplayCacheExpunge 15
* @summary when number of expired entries minus number of good entries
--- a/jdk/test/sun/security/krb5/auto/ReplayCachePrecise.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/ReplayCachePrecise.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,9 @@
/*
* @test
* @bug 8001326
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.rcache
* @run main/othervm ReplayCachePrecise
* @summary when there are 2 two AuthTime with the same time but different hash,
* it's not a replay.
--- a/jdk/test/sun/security/krb5/auto/ReplayCacheTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 7118809 8001326
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm ReplayCacheTest jvm
* @run main/othervm ReplayCacheTest dfl
* @summary rcache deadlock
--- a/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,16 @@
* @bug 7152176
* @summary More krb5 tests
* @library ../../../../java/security/testlibrary/
+ * @modules java.base/sun.misc
+ * java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
+ * java.security.jgss/sun.security.krb5.internal.rcache
* @compile -XDignore.symbol.file ReplayCacheTestProc.java
* @run main/othervm/timeout=100 ReplayCacheTestProc
*/
--- a/jdk/test/sun/security/krb5/auto/S4U2proxy.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/S4U2proxy.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 6355584 8044215
* @summary Introduce constrained Kerberos delegation
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file S4U2proxy.java
* @run main/othervm S4U2proxy krb5
* @run main/othervm S4U2proxy spnego
--- a/jdk/test/sun/security/krb5/auto/S4U2proxyGSS.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/S4U2proxyGSS.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 6355584
* @summary Introduce constrained Kerberos delegation
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file S4U2proxyGSS.java
* @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2proxyGSS krb5
* @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2proxyGSS spnego
--- a/jdk/test/sun/security/krb5/auto/S4U2self.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/S4U2self.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 6355584
* @summary Introduce constrained Kerberos delegation
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file S4U2self.java
* @run main/othervm -Dsun.security.krb5.debug=false S4U2self krb5 0
* @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 1
--- a/jdk/test/sun/security/krb5/auto/S4U2selfAsServer.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/S4U2selfAsServer.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 6355584
* @summary Introduce constrained Kerberos delegation
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file S4U2selfAsServer.java
* @run main/othervm S4U2selfAsServer krb5
* @run main/othervm S4U2selfAsServer spnego
--- a/jdk/test/sun/security/krb5/auto/S4U2selfAsServerGSS.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/S4U2selfAsServerGSS.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 6355584
* @summary Introduce constrained Kerberos delegation
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file S4U2selfAsServerGSS.java
* @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2selfAsServerGSS krb5
* @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2selfAsServerGSS spnego
--- a/jdk/test/sun/security/krb5/auto/S4U2selfGSS.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/S4U2selfGSS.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 6355584
* @summary Introduce constrained Kerberos delegation
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file S4U2selfGSS.java
* @run main/othervm -Dsun.security.krb5.debug=false S4U2selfGSS krb5
* @run main/othervm -Dsun.security.krb5.debug=false S4U2selfGSS spnego
--- a/jdk/test/sun/security/krb5/auto/SPNEGO.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/SPNEGO.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 7040151
* @summary SPNEGO GSS code does not parse tokens in accordance to RFC 2478
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file SPNEGO.java
* @run main/othervm SPNEGO
*/
--- a/jdk/test/sun/security/krb5/auto/SSL.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/SSL.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,14 @@
* @bug 6894643 6913636 8005523 8025123
* @summary Test JSSE Kerberos ciphersuite
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA
* @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA unbound
* @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA unbound sni
--- a/jdk/test/sun/security/krb5/auto/SaslBasic.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/SaslBasic.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 7110803
* @summary SASL service for multiple hostnames
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
+ * java.security.sasl
* @compile -XDignore.symbol.file SaslBasic.java
* @run main/othervm SaslBasic bound
* @run main/othervm SaslBasic unbound
--- a/jdk/test/sun/security/krb5/auto/SaslGSS.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/SaslGSS.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,15 @@
* @bug 8012082 8019267
* @summary SASL: auth-conf negotiated, but unencrypted data is accepted,
* reset to unencrypt
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
+ * java.security.sasl
* @compile -XDignore.symbol.file SaslGSS.java
* @run main/othervm SaslGSS
*/
--- a/jdk/test/sun/security/krb5/auto/SaslUnbound.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/SaslUnbound.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8001104
* @summary Unbound SASL service: the GSSAPI/krb5 mech
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
+ * java.security.sasl
* @compile -XDignore.symbol.file SaslUnbound.java
* @run main/othervm SaslUnbound 0
* @run main/othervm/fail SaslUnbound 1
--- a/jdk/test/sun/security/krb5/auto/SpnegoLifeTime.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/SpnegoLifeTime.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8000653
* @summary SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid)
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file SpnegoLifeTime.java
* @run main/othervm SpnegoLifeTime
*/
--- a/jdk/test/sun/security/krb5/auto/SpnegoReqFlags.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/SpnegoReqFlags.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 6815182
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm SpnegoReqFlags
* @summary GSSAPI/SPNEGO does not work with server using MIT Kerberos library
*/
--- a/jdk/test/sun/security/krb5/auto/TcpTimeout.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/TcpTimeout.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 6952519
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file TcpTimeout.java
* @run main/othervm TcpTimeout
* @summary kdc_timeout is not being honoured when using TCP
--- a/jdk/test/sun/security/krb5/auto/Test5653.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/Test5653.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 6895424
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm Test5653
* @summary RFC 5653
*/
--- a/jdk/test/sun/security/krb5/auto/TwoOrThree.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/TwoOrThree.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8005447
* @summary default principal can act as anyone
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file TwoOrThree.java
* @run main/othervm TwoOrThree first first
* @run main/othervm/fail TwoOrThree first second
--- a/jdk/test/sun/security/krb5/auto/TwoPrinces.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/TwoPrinces.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,14 @@
/*
* @test
* @bug 6894072
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file TwoPrinces.java
* @run main/othervm TwoPrinces
* @summary always refresh keytab
--- a/jdk/test/sun/security/krb5/auto/TwoTab.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/TwoTab.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 7152176
* @summary More krb5 tests
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file TwoTab.java
* @run main/othervm TwoTab
*/
--- a/jdk/test/sun/security/krb5/auto/UdpTcp.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/UdpTcp.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,13 @@
/*
* @test
* @bug 4966382 8039132
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm UdpTcp UDP
* @run main/othervm UdpTcp TCP
* @summary udp or tcp
--- a/jdk/test/sun/security/krb5/auto/UnboundService.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/UnboundService.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,14 @@
* @test
* @bug 8001104
* @summary Unbound SASL service: the GSSAPI/krb5 mech
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.jgss
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file UnboundService.java
* @run main/othervm UnboundService null null
* @run main/othervm UnboundService server/host.rabbit.hole null
--- a/jdk/test/sun/security/krb5/auto/Unreachable.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/Unreachable.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 7162687
* @summary enhance KDC server availability detection
+ * @modules java.security.jgss/sun.security.krb5
* @compile -XDignore.symbol.file Unreachable.java
* @run main/othervm/timeout=10 Unreachable
*/
--- a/jdk/test/sun/security/krb5/auto/UseCacheAndStoreKey.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/UseCacheAndStoreKey.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,13 @@
* @bug 7201053
* @summary Krb5LoginModule shows NPE when both useTicketCache and storeKey
* are set to true
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @compile -XDignore.symbol.file UseCacheAndStoreKey.java
* @run main/othervm UseCacheAndStoreKey
*/
--- a/jdk/test/sun/security/krb5/auto/W83.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/W83.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,13 @@
* @bug 6932525 6951366 6959292
* @summary kerberos login failure on win2008 with AD set to win2000 compat mode
* and cannot login if session key and preauth does not use the same etype
+ * @modules java.base/sun.net.spi.nameservice
+ * java.base/sun.security.util
+ * java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ccache
+ * java.security.jgss/sun.security.krb5.internal.crypto
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm -D6932525 W83
* @run main/othervm -D6959292 W83
*/
--- a/jdk/test/sun/security/krb5/canonicalize/Test.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/canonicalize/Test.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
* @test
* @bug 6682516
* @summary SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms
+ * @modules java.base/sun.net.spi.nameservice
+ * java.security.jgss/sun.security.krb5
* @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock -Djava.security.krb5.conf=krb5.conf Test
*/
--- a/jdk/test/sun/security/krb5/ccache/CorruptedCC.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/ccache/CorruptedCC.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 8028780
* @summary JDK KRB5 module throws OutOfMemoryError when CCache is corrupt
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.ccache
* @run main/othervm -Xmx8m CorruptedCC
*/
import java.nio.file.Files;
--- a/jdk/test/sun/security/krb5/ccache/DefaultFile.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/ccache/DefaultFile.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8054817
* @summary File ccache only recognizes Linux and Solaris defaults
+ * @modules java.security.jgss/sun.security.krb5.internal.ccache
*/
import sun.security.krb5.internal.ccache.FileCredentialsCache;
--- a/jdk/test/sun/security/krb5/ccache/EmptyCC.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/ccache/EmptyCC.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,8 @@
* @bug 8001208
* @summary NPE in sun.security.krb5.Credentials.acquireDefaultCreds()
* @library ../../../../java/security/testlibrary/
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.ccache
* @compile -XDignore.symbol.file EmptyCC.java
* @run main EmptyCC tmpcc
* @run main EmptyCC FILE:tmpcc
--- a/jdk/test/sun/security/krb5/ccache/EmptyRealmCC.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/ccache/EmptyRealmCC.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 8048073
* @summary Cannot read ccache entry with a realm-less service name
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.ccache
* @compile -XDignore.symbol.file EmptyRealmCC.java
* @run main EmptyRealmCC
*/
--- a/jdk/test/sun/security/krb5/ccache/TimeInCCache.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/ccache/TimeInCCache.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,8 @@
/*
* @test
* @bug 6590930
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.ccache
* @run main/othervm TimeInCCache
* @summary read/write does not match for ccache
*/
--- a/jdk/test/sun/security/krb5/config/ConfigWithQuotations.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/ConfigWithQuotations.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,7 @@
/*
* @test
* @bug 6714845
+ * @modules java.security.jgss/sun.security.krb5
* @run main/othervm ConfigWithQuotations
* @summary Quotes in Kerberos configuration file are included in the values
*/
--- a/jdk/test/sun/security/krb5/config/DefUdpLimit.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/DefUdpLimit.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8009875
* @summary Provide a default udp_preference_limit for krb5.conf
+ * @modules java.security.jgss/sun.security.krb5
* @compile -XDignore.symbol.file DefUdpLimit.java
* @run main/othervm DefUdpLimit -1 1465
* @run main/othervm DefUdpLimit 0 0
--- a/jdk/test/sun/security/krb5/config/DnsFallback.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/DnsFallback.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,7 @@
/*
* @test
* @bug 6673164 6552334 8077102
+ * @modules java.security.jgss/sun.security.krb5
* @run main/othervm DnsFallback
* @summary fix dns_fallback parse error, and use dns by default
*/
--- a/jdk/test/sun/security/krb5/config/Duplicates.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/Duplicates.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,7 @@
/*
* @test
* @bug 7184246
+ * @modules java.security.jgss/sun.security.krb5
* @compile -XDignore.symbol.file Duplicates.java
* @run main/othervm Duplicates
* @summary Simplify Config.get() of krb5
--- a/jdk/test/sun/security/krb5/config/Duration.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/Duration.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 8044500
* @summary Add kinit options and krb5.conf flags that allow users to
* obtain renewable tickets and specify ticket lifetimes
+ * @modules java.security.jgss/sun.security.krb5
* @compile -XDignore.symbol.file Duration.java
* @run main Duration
*/
--- a/jdk/test/sun/security/krb5/config/ExtraLines.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/ExtraLines.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,7 @@
/*
* @test
* @bug 8036971
+ * @modules java.security.jgss/sun.security.krb5
* @compile -XDignore.symbol.file ExtraLines.java
* @run main/othervm ExtraLines
* @summary krb5.conf does not accept directive lines before the first section
--- a/jdk/test/sun/security/krb5/config/Include.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/Include.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8029994
* @summary Support "include" and "includedir" in krb5.conf
+ * @modules java.security.jgss/sun.security.krb5
* @compile -XDignore.symbol.file Include.java
* @run main/othervm Include
*/
--- a/jdk/test/sun/security/krb5/config/KdcDefaultOptions.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/KdcDefaultOptions.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
* @test
* @bug 7195426
* @summary kdc_default_options not supported correctly
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
* @compile -XDignore.symbol.file KdcDefaultOptions.java
* @run main/othervm KdcDefaultOptions
*/
--- a/jdk/test/sun/security/krb5/config/ParseCAPaths.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/ParseCAPaths.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,7 @@
/*
* @test
* @bug 6789935 8012615
+ * @modules java.security.jgss/sun.security.krb5
* @run main/othervm ParseCAPaths
* @summary cross-realm capath search error
*/
--- a/jdk/test/sun/security/krb5/config/ParseConfig.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/ParseConfig.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,7 @@
/*
* @test
* @bug 6319046 8055045
+ * @modules java.security.jgss/sun.security.krb5
* @compile -XDignore.symbol.file ParseConfig.java
* @run main/othervm ParseConfig
* @summary Problem with parsing krb5.conf
--- a/jdk/test/sun/security/krb5/config/SCDynamicConfigTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/SCDynamicConfigTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 7184246
* @summary Simplify Config.get() of krb5
+ * @modules java.security.jgss/sun.security.krb5
*/
import java.lang.reflect.Field;
import java.lang.reflect.Method;
--- a/jdk/test/sun/security/krb5/config/YesNo.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/config/YesNo.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 8029995
* @summary accept yes/no for boolean krb5.conf settings
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.crypto
* @compile -XDignore.symbol.file YesNo.java
* @run main/othervm YesNo
*/
--- a/jdk/test/sun/security/krb5/etype/ETypeOrder.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/etype/ETypeOrder.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,7 @@
/*
* @test
* @bug 6844907
+ * @modules java.security.jgss/sun.security.krb5.internal.crypto
* @run main/othervm ETypeOrder
* @summary krb5 etype order should be from strong to weak
*/
--- a/jdk/test/sun/security/krb5/etype/WeakCrypto.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/etype/WeakCrypto.java Mon Jun 01 10:15:20 2015 -0700
@@ -23,6 +23,8 @@
/*
* @test
* @bug 6844909 8012679
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.crypto
* @run main/othervm WeakCrypto
* @run main/othervm WeakCrypto true
* @run main/othervm WeakCrypto false
--- a/jdk/test/sun/security/krb5/ktab/FileKeyTab.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/ktab/FileKeyTab.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
* @test
* @bug 7144530
* @summary KeyTab.getInstance(String) no longer handles keyTabNames with "file:" prefix
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.ktab
*/
import java.io.File;
import sun.security.krb5.PrincipalName;
--- a/jdk/test/sun/security/krb5/ktab/HighestKvno.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/ktab/HighestKvno.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
* @test
* @bug 6867665
* @bug 6875033
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.ktab
* @run main/othervm HighestKvno
* @summary Problem with keytabs with multiple kvno's (key versions)
*/
--- a/jdk/test/sun/security/krb5/ktab/KeyString.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/ktab/KeyString.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,9 @@
* @test
* @bug 6917791
* @summary KeyTabEntry, when the byte value smaller then 16, the string drop '0'
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal
+ * java.security.jgss/sun.security.krb5.internal.ktab
*/
import sun.security.krb5.internal.ktab.KeyTabEntry;
--- a/jdk/test/sun/security/krb5/ktab/KeyTabIndex.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/ktab/KeyTabIndex.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
* @test
* @bug 6919610
* @summary KeyTabInputStream uses static field for per-instance value
+ * @modules java.security.jgss/sun.security.krb5
+ * java.security.jgss/sun.security.krb5.internal.ktab
*/
import sun.security.krb5.PrincipalName;
import sun.security.krb5.internal.ktab.KeyTab;
--- a/jdk/test/sun/security/krb5/name/Constructors.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/name/Constructors.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
* @test
* @bug 6966259
* @summary Make PrincipalName and Realm immutable
+ * @modules java.security.jgss/sun.security.krb5
* @run main/othervm Constructors
*/
--- a/jdk/test/sun/security/krb5/name/Immutable.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/name/Immutable.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8005460
* @summary [findbugs] Probably returned array should be cloned
+ * @modules java.security.jgss/sun.security.krb5
*/
import sun.security.krb5.PrincipalName;
--- a/jdk/test/sun/security/krb5/tools/KtabZero.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/krb5/tools/KtabZero.java Mon Jun 01 10:15:20 2015 -0700
@@ -33,6 +33,7 @@
* @test
* @bug 8014196
* @summary ktab creates a file with zero kt_vno
+ * @modules java.security.jgss/sun.security.krb5.internal.ktab
*/
public class KtabZero {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/mscapi/SignatureOffsets.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SignatureException;
+
+/*
+ * @test
+ * @bug 8050374
+ * @key randomness
+ * @summary This test validates signature verification
+ * Signature.verify(byte[], int, int). The test uses RandomFactory to
+ * get random set of clear text data to sign. After the signature
+ * generation, the test tries to verify signature with the above API
+ * and passing in different signature offset (0, 33, 66, 99).
+ * @library /lib/testlibrary
+ * @compile ../../../java/security/Signature/Offsets.java
+ * @run main SignatureOffsets SunMSCAPI NONEwithRSA
+ * @run main SignatureOffsets SunMSCAPI MD2withRSA
+ * @run main SignatureOffsets SunMSCAPI MD5withRSA
+ * @run main SignatureOffsets SunMSCAPI SHA1withRSA
+ * @run main SignatureOffsets SunMSCAPI SHA256withRSA
+ * @run main SignatureOffsets SunMSCAPI SHA384withRSA
+ * @run main SignatureOffsets SunMSCAPI SHA512withRSA
+ */
+public class SignatureOffsets {
+
+ public static void main(String[] args) throws NoSuchAlgorithmException,
+ InvalidKeyException, SignatureException {
+ Offsets.main(args);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/mscapi/SignedObjectChain.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015, 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 8050374
+ * @compile ../../../java/security/SignedObject/Chain.java
+ * @summary Verify a chain of signed objects
+ */
+public class SignedObjectChain {
+
+ private static class Test extends Chain.Test {
+
+ public Test(Chain.SigAlg sigAlg) {
+ super(sigAlg, Chain.KeyAlg.RSA, Chain.Provider.SunMSCAPI);
+ }
+ }
+
+ private static final Test[] tests = {
+ new Test(Chain.SigAlg.MD2withRSA),
+ new Test(Chain.SigAlg.MD5withRSA),
+ new Test(Chain.SigAlg.SHA1withRSA),
+ new Test(Chain.SigAlg.SHA256withRSA),
+ new Test(Chain.SigAlg.SHA384withRSA),
+ new Test(Chain.SigAlg.SHA512withRSA),
+ };
+
+ public static void main(String argv[]) {
+ boolean resutl = java.util.Arrays.stream(tests).allMatch(
+ (test) -> Chain.runTest(test));
+
+ if(resutl) {
+ System.out.println("All tests passed");
+ } else {
+ throw new RuntimeException("Some tests failed");
+ }
+ }
+}
--- a/jdk/test/sun/security/pkcs/EncryptedPrivateKeyInfo/EncryptedPKInfoEqualsHashCode.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs/EncryptedPrivateKeyInfo/EncryptedPKInfoEqualsHashCode.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @author Gary Ellison
* @bug 4170635
* @summary Verify equals()/hashCode() contract honored
+ * @modules java.base/sun.security.pkcs
+ * java.base/sun.security.x509
*/
import java.io.*;
--- a/jdk/test/sun/security/pkcs/pkcs9/UnknownAttribute.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs/pkcs9/UnknownAttribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,9 @@
* @test
* @bug 8011867
* @summary Accept unknown PKCS #9 attributes
+ * @modules java.base/sun.misc
+ * java.base/sun.security.pkcs
+ * java.base/sun.security.util
*/
import java.io.*;
--- a/jdk/test/sun/security/pkcs/pkcs9/UnstructuredName.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs/pkcs9/UnstructuredName.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8016916
* @summary UnstructuredName should support DirectoryString
+ * @modules java.base/sun.security.pkcs10
*/
import java.util.Base64;
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -23,7 +23,6 @@
import java.io.*;
import java.util.*;
-import java.lang.reflect.*;
import java.security.KeyStore;
import java.security.KeyStoreException;
--- a/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, 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
@@ -23,7 +23,6 @@
import java.io.*;
import java.util.*;
-import java.lang.reflect.*;
import java.security.*;
import javax.security.auth.callback.*;
--- a/jdk/test/sun/security/pkcs11/Provider/Login.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.java Mon Jun 01 10:15:20 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -23,7 +23,6 @@
import java.io.*;
import java.util.*;
-import java.lang.reflect.*;
import java.security.*;
import javax.security.auth.callback.*;
--- a/jdk/test/sun/security/pkcs11/ec/TestCurves.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/ec/TestCurves.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary Basic consistency test for all curves using ECDSA and ECDH
* @author Andreas Sterbenz
* @library ..
+ * @modules jdk.crypto.pkcs11/sun.security.pkcs11.wrapper
* @compile -XDignore.symbol.file TestCurves.java
* @run main TestCurves
* @key randomness
--- a/jdk/test/sun/security/pkcs11/ec/TestECDH2.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/ec/TestECDH2.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,7 @@
* example data in "Suite B Implementer's Guide to FIPS 186-3".
* @library ..
* @library ../../../../java/security/testlibrary
+ * @modules java.base/sun.security.util
* @compile -XDignore.symbol.file TestECDH2.java
* @run main TestECDH2
*/
--- a/jdk/test/sun/security/pkcs11/ec/TestECDSA2.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/ec/TestECDSA2.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,7 @@
* example data in "Suite B Implementer's Guide to FIPS 186-3".
* @library ..
* @library ../../../../java/security/testlibrary
+ * @modules java.base/sun.security.util
* @compile -XDignore.symbol.file TestECDSA2.java
* @run main TestECDSA2
*/
--- a/jdk/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary Verify that all ciphersuites work in FIPS mode
* @library ..
* @author Andreas Sterbenz
+ * @modules java.base/com.sun.net.ssl.internal.ssl
* @run main/manual ClientJSSEServerJSSE
*/
--- a/jdk/test/sun/security/pkcs11/fips/TrustManagerTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/fips/TrustManagerTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary Verify that the SunJSSE trustmanager works correctly in FIPS mode
* @author Andreas Sterbenz
* @library ..
+ * @modules java.base/com.sun.net.ssl.internal.ssl
* @run main/othervm TrustManagerTest
*/
--- a/jdk/test/sun/security/pkcs11/tls/TestKeyMaterial.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/tls/TestKeyMaterial.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary Known-answer-test for TlsKeyMaterial generator
* @author Andreas Sterbenz
* @library ..
+ * @modules java.base/sun.security.internal.spec
*/
import java.io.*;
--- a/jdk/test/sun/security/pkcs11/tls/TestMasterSecret.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/tls/TestMasterSecret.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,8 @@
* @summary Known-answer-test for TlsMasterSecret generator
* @author Andreas Sterbenz
* @library ..
+ * @modules java.base/sun.security.internal.interfaces
+ * java.base/sun.security.internal.spec
*/
import java.io.*;
--- a/jdk/test/sun/security/pkcs11/tls/TestPRF.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/tls/TestPRF.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary Basic known-answer-test for TlsPrf
* @author Andreas Sterbenz
* @library ..
+ * @modules java.base/sun.security.internal.spec
*/
import java.io.*;
--- a/jdk/test/sun/security/pkcs11/tls/TestPremaster.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/tls/TestPremaster.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary Basic tests for TlsRsaPremasterSecret generator
* @author Andreas Sterbenz
* @library ..
+ * @modules java.base/sun.security.internal.spec
*/
import java.security.Security;
--- a/jdk/test/sun/security/pkcs12/PKCS12SameKeyId.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/pkcs12/PKCS12SameKeyId.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,10 @@
* @test
* @bug 6958026
* @summary Problem with PKCS12 keystore
+ * @modules java.base/sun.security.pkcs
+ * java.base/sun.security.tools.keytool
+ * java.base/sun.security.util
+ * java.base/sun.security.x509
* @compile -XDignore.symbol.file PKCS12SameKeyId.java
* @run main PKCS12SameKeyId
*/
--- a/jdk/test/sun/security/provider/MessageDigest/DigestKAT.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/MessageDigest/DigestKAT.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4819771 4834179 5008306 4963723
* @summary Basic known-answer-test for all our MessageDigest algorithms
+ * @modules java.base/sun.security.provider
* @author Andreas Sterbenz
*/
--- a/jdk/test/sun/security/provider/PolicyFile/Comparator.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/PolicyFile/Comparator.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,8 +24,9 @@
/*
* @test
* @bug 5037004
+ * @summary Frivolous ClassCastExceptions thrown by SubjectCodeSource.implies
+ * @modules java.base/sun.security.provider
* @run main/othervm Comparator
- * @summary Frivolous ClassCastExceptions thrown by SubjectCodeSource.implies
*
* Note: if you want to see the java.security.debug output,
* you can not simply set the system property.
--- a/jdk/test/sun/security/provider/PolicyFile/TokenStore.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/PolicyFile/TokenStore.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,8 +25,7 @@
* @test
* @bug 4919147
* @summary Support for token-based KeyStores
- *
- * TokenStore.keystore password is "TokenStore"
+ * @modules java.base/sun.security.provider
*/
import java.io.*;
--- a/jdk/test/sun/security/provider/PolicyParser/BogusGrants.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/PolicyParser/BogusGrants.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @author Gary Ellison
* @bug 4233900
* @summary Catch anomalies in Policy parsing
+ * @modules java.base/sun.security.provider
* @run main BogusGrants p001.policy p002.policy p003.policy p004.policy
*/
--- a/jdk/test/sun/security/provider/PolicyParser/EncodeURL.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/PolicyParser/EncodeURL.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4797850
+ * @modules java.base/sun.security.provider
* @summary Security policy file does not grok hash mark in pathnames
*/
--- a/jdk/test/sun/security/provider/PolicyParser/TokenStore.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/PolicyParser/TokenStore.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4919147
* @summary Support for token-based KeyStores
+ * @modules java.base/sun.security.provider
*/
import java.io.*;
--- a/jdk/test/sun/security/provider/X509Factory/BadPem.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/X509Factory/BadPem.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8074935
* @summary jdk8 keytool doesn't validate pem files for RFC 1421 correctness, as jdk7 did
+ * @modules java.base/sun.security.provider
*/
import java.io.ByteArrayOutputStream;
--- a/jdk/test/sun/security/provider/X509Factory/BigCRL.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/X509Factory/BigCRL.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 7099399
* @summary cannot deal with CRL file larger than 16MB
+ * @modules java.base/sun.security.x509
* @run main/othervm -Xshare:off -Xmx1024m BigCRL
*/
--- a/jdk/test/sun/security/provider/certpath/CertId/CheckCertId.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/certpath/CertId/CheckCertId.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 6355295
* @summary Certificate validation using OCSP fails for a particular class of certificates
+ * @modules java.base/sun.security.provider.certpath
+ * java.base/sun.security.x509
*/
import java.io.*;
--- a/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPBuilder.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPBuilder.java Mon Jun 01 10:15:20 2015 -0700
@@ -53,7 +53,6 @@
import java.util.*;
import java.security.Security;
import java.security.cert.*;
-import sun.security.util.DerInputStream;
public class CPBuilder {
--- a/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPBuilderWithMD5.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/certpath/DisabledAlgorithms/CPBuilderWithMD5.java Mon Jun 01 10:15:20 2015 -0700
@@ -58,7 +58,6 @@
import java.util.*;
import java.security.Security;
import java.security.cert.*;
-import sun.security.util.DerInputStream;
public class CPBuilderWithMD5 {
--- a/jdk/test/sun/security/provider/certpath/OCSP/OCSPSingleExtensions.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/certpath/OCSP/OCSPSingleExtensions.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8074064
* @summary OCSPResponse.SingleResponse objects do not parse singleExtensions
+ * @modules java.base/sun.security.x509
* @run main/othervm sun.security.provider.certpath.OCSPSingleExtensions
*/
--- a/jdk/test/sun/security/provider/certpath/SunCertPathBuilderExceptionTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/certpath/SunCertPathBuilderExceptionTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 5032952
* @summary non-transient non-serializable instance field in
serializable class
+ * @modules java.base/sun.security.provider.certpath
*/
import sun.security.provider.certpath.SunCertPathBuilderException;
--- a/jdk/test/sun/security/provider/certpath/X509CertPath/IllegalCertiticates.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/provider/certpath/X509CertPath/IllegalCertiticates.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6492692
* @summary Some JCK test failed because of the compiler warnings changes
+ * @modules java.base/sun.security.provider.certpath
*/
import java.security.cert.CertificateException;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/rsa/SignatureOffsets.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SignatureException;
+
+/*
+ * @test
+ * @bug 8050374
+ * @key randomness
+ * @summary This test validates signature verification
+ * Signature.verify(byte[], int, int). The test uses RandomFactory to
+ * get random set of clear text data to sign. After the signature
+ * generation, the test tries to verify signature with the above API
+ * and passing in different signature offset (0, 33, 66, 99).
+ * @library /lib/testlibrary
+ * @compile ../../../java/security/Signature/Offsets.java
+ * @run main SignatureOffsets SunRsaSign MD2withRSA
+ * @run main SignatureOffsets SunRsaSign MD5withRSA
+ * @run main SignatureOffsets SunRsaSign SHA1withRSA
+ * @run main SignatureOffsets SunRsaSign SHA224withRSA
+ * @run main SignatureOffsets SunRsaSign SHA256withRSA
+ * @run main SignatureOffsets SunRsaSign SHA384withRSA
+ * @run main SignatureOffsets SunRsaSign SHA512withRSA
+ */
+public class SignatureOffsets {
+
+ public static void main(String[] args) throws NoSuchAlgorithmException,
+ InvalidKeyException, SignatureException {
+ Offsets.main(args);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/rsa/SignedObjectChain.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, 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 8050374
+ * @compile ../../../java/security/SignedObject/Chain.java
+ * @summary Verify a chain of signed objects
+ */
+public class SignedObjectChain {
+
+ private static class Test extends Chain.Test {
+
+ public Test(Chain.SigAlg sigAlg) {
+ super(sigAlg, Chain.KeyAlg.RSA, Chain.Provider.SunRsaSign);
+ }
+ }
+
+ private static final Test[] tests = {
+ new Test(Chain.SigAlg.MD2withRSA),
+ new Test(Chain.SigAlg.MD5withRSA),
+ new Test(Chain.SigAlg.SHA1withRSA),
+ new Test(Chain.SigAlg.SHA224withRSA),
+ new Test(Chain.SigAlg.SHA256withRSA),
+ new Test(Chain.SigAlg.SHA384withRSA),
+ new Test(Chain.SigAlg.SHA512withRSA),
+ };
+
+ public static void main(String argv[]) {
+ boolean resutl = java.util.Arrays.stream(tests).allMatch(
+ (test) -> Chain.runTest(test));
+
+ if(resutl) {
+ System.out.println("All tests passed");
+ } else {
+ throw new RuntimeException("Some tests failed");
+ }
+ }
+}
--- a/jdk/test/sun/security/ssl/ClientHandshaker/LengthCheckTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/ssl/ClientHandshaker/LengthCheckTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 8044860
* @summary Vectors and fixed length fields should be verified
* for allowed sizes.
+ * @modules java.base/sun.security.ssl
* @run main/othervm LengthCheckTest
* @key randomness
*/
--- a/jdk/test/sun/security/ssl/InputRecord/ClientHelloRead.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/ssl/InputRecord/ClientHelloRead.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4432868
* @summary A client-hello message may not always be read correctly
+ * @modules java.base/sun.net.www
* @run main/othervm ClientHelloRead
*
* SunJSSE does not support dynamic system properties, no way to re-use
--- a/jdk/test/sun/security/ssl/ServerHandshaker/GetPeerHostClient.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/ssl/ServerHandshaker/GetPeerHostClient.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,7 +31,6 @@
import java.net.*;
import java.io.*;
import javax.net.ssl.*;
-import com.sun.net.ssl.*;
class GetPeerHostClient extends Thread
{
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/CheckNullEntity.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/CheckNullEntity.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary unspecified exceptions in X509TrustManager.checkClient[Server]Truste
d
* @author Xuelei Fan
+ * @modules java.base/com.sun.net.ssl.internal.ssl
*/
import java.io.*;
--- a/jdk/test/sun/security/ssl/X509TrustManagerImpl/ClientServer.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/ssl/X509TrustManagerImpl/ClientServer.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4717766
* @author Brad Wetmore
* @summary 1.0.3 JsseX509TrustManager erroneously calls isClientTrusted()
+ * @modules java.base/com.sun.net.ssl
* @run main/manual ClientServer
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/rsa/SignatureOffsets.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SignatureException;
+
+/*
+ * @test
+ * @bug 8050374
+ * @key randomness
+ * @summary This test validates signature verification
+ * Signature.verify(byte[], int, int). The test uses RandomFactory to
+ * get random set of clear text data to sign. After the signature
+ * generation, the test tries to verify signature with the above API
+ * and passing in different signature offset (0, 33, 66, 99).
+ * @library /lib/testlibrary
+ * @compile ../../../../java/security/Signature/Offsets.java
+ * @run main SignatureOffsets SunJSSE MD2withRSA
+ * @run main SignatureOffsets SunJSSE MD5withRSA
+ * @run main SignatureOffsets SunJSSE SHA1withRSA
+ * @run main SignatureOffsets SunJSSE MD5andSHA1withRSA
+ */
+public class SignatureOffsets {
+
+ public static void main(String[] args) throws NoSuchAlgorithmException,
+ InvalidKeyException, SignatureException {
+ Offsets.main(args);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/rsa/SignedObjectChain.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015, 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 8050374
+ * @compile ../../../../java/security/SignedObject/Chain.java
+ * @summary Verify a chain of signed objects
+ */
+public class SignedObjectChain {
+
+ private static class Test extends Chain.Test {
+
+ public Test(Chain.SigAlg sigAlg) {
+ super(sigAlg, Chain.KeyAlg.RSA, Chain.Provider.SunJSSE);
+ }
+ }
+
+ private static final Test[] tests = {
+ new Test(Chain.SigAlg.MD2withRSA),
+ new Test(Chain.SigAlg.MD5withRSA),
+ new Test(Chain.SigAlg.SHA1withRSA),
+ new Test(Chain.SigAlg.MD5andSHA1withRSA),
+ };
+
+ public static void main(String argv[]) {
+ boolean resutl = java.util.Arrays.stream(tests).allMatch(
+ (test) -> Chain.runTest(test));
+
+ if(resutl) {
+ System.out.println("All tests passed");
+ } else {
+ throw new RuntimeException("Some tests failed");
+ }
+ }
+}
--- a/jdk/test/sun/security/tools/jarsigner/CertChainUnclosed.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/CertChainUnclosed.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 8027991
* @summary InputStream should be closed in sun.security.tools.jarsigner.Main
+ * @modules java.base/sun.security.tools.keytool
+ * jdk.jartool/sun.security.tools.jarsigner
* @run main/othervm CertChainUnclosed
*/
--- a/jdk/test/sun/security/tools/jarsigner/DefaultSigalg.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/DefaultSigalg.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,12 @@
* @test
* @bug 8057810
* @summary New defaults for DSA keys in jarsigner and keytool
+ * @modules java.base/sun.security.pkcs
+ * java.base/sun.security.tools.keytool
+ * java.base/sun.security.util
+ * java.base/sun.security.x509
+ * jdk.jartool/sun.security.tools.jarsigner
+ * jdk.jartool/sun.tools.jar
*/
import sun.security.pkcs.PKCS7;
--- a/jdk/test/sun/security/tools/jarsigner/EntriesOrder.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/EntriesOrder.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,9 @@
* @bug 8031572
* @summary jarsigner -verify exits with 0 when a jar file is not properly signed
* @library /lib/testlibrary
+ * @modules java.base/sun.security.tools.keytool
+ * jdk.jartool/sun.security.tools.jarsigner
+ * jdk.jartool/sun.tools.jar
* @build jdk.testlibrary.IOUtils
* @run main EntriesOrder
*/
--- a/jdk/test/sun/security/tools/jarsigner/JarSigningNonAscii.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/JarSigningNonAscii.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4924188
* @summary sign a JAR file that has entry names with non-ASCII characters.
+ * @modules jdk.jartool/sun.security.tools.jarsigner
*/
import sun.security.tools.*;
--- a/jdk/test/sun/security/tools/jarsigner/LargeJarEntry.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/LargeJarEntry.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6405538 6474350
* @summary Make sure jar files with large entries (more than max heap size)
* can be signed
+ * @modules jdk.jartool/sun.security.tools.jarsigner
* @run main/othervm -Xmx8M LargeJarEntry
* @author Sean Mullan
*/
--- a/jdk/test/sun/security/tools/jarsigner/TsacertOptionTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/TsacertOptionTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,12 @@
* @bug 8024302 8026037
* @summary The test signs and verifies a jar file with -tsacert option
* @library /lib/testlibrary
+ * @modules java.base/sun.misc
+ * java.base/sun.security.pkcs
+ * java.base/sun.security.timestamp
+ * java.base/sun.security.util
+ * java.base/sun.security.x509
+ * java.management
* @run main TsacertOptionTest
*/
public class TsacertOptionTest {
--- a/jdk/test/sun/security/tools/keytool/CloseFile.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/tools/keytool/CloseFile.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6489721
* @summary keytool has not closed several file streams
* @author weijun.wang
+ * @modules java.base/sun.security.tools.keytool
* @compile -XDignore.symbol.file CloseFile.java
* @run main CloseFile
*
--- a/jdk/test/sun/security/tools/keytool/NewSize7.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/tools/keytool/NewSize7.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6561126
* @summary keytool should use larger default keysize for keypairs
+ * @modules java.base/sun.security.tools.keytool
* @compile -XDignore.symbol.file NewSize7.java
* @run main NewSize7
*/
--- a/jdk/test/sun/security/tools/keytool/StartDateTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/tools/keytool/StartDateTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6468285
* @summary keytool ability to backdate self-signed certificates to compensate for clock skew
+ * @modules java.base/sun.security.tools.keytool
* @compile -XDignore.symbol.file StartDateTest.java
* @run main StartDateTest
*/
--- a/jdk/test/sun/security/tools/keytool/UnknownAndUnparseable.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/tools/keytool/UnknownAndUnparseable.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,9 @@
* @test
* @bug 7192202
* @summary Make sure keytool prints both unknown and unparseable extensions
+ * @modules java.base/sun.security.tools.keytool
+ * java.base/sun.security.util
+ * java.base/sun.security.x509
* @compile -XDignore.symbol.file UnknownAndUnparseable.java
* @run main UnknownAndUnparseable
*/
--- a/jdk/test/sun/security/util/BitArray/NamedBitList.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/BitArray/NamedBitList.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @author Weijun Wang
* @bug 4654195
* @summary BIT STRING types with named bits must remove trailing 0 bits
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
*/
import sun.security.util.BitArray;
--- a/jdk/test/sun/security/util/Debug/MultiOptions.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/Debug/MultiOptions.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @bug 6466247
* @summary java.security.debug permission=<classname> and codebase=<URL>
* options do not work
+ * @modules java.base/sun.security.util
* @run main/othervm -Djava.security.debug="stacknothing--=-30logincontextacCess:stack-domain,combiner;access:fAilure-jarpermission=sun.dummy.DummyPermission;peRmiSsion=sun.Dummy.DummyPermission2=permission=sun.dummy.DummyPermission3:codEbAse=/dir1/DIR2/Dir3/File.java,codebase=http://www.sun.com/search?q=SunMicro,codEbAse=/dir1/DIR2/Dir3/File.java;coDebase=www.sun.com;codebase=file:///C:/temp/foo%20more/a.txt" MultiOptions
*/
import sun.security.util.Debug;
--- a/jdk/test/sun/security/util/DerInputBuffer/BigInteger0.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/DerInputBuffer/BigInteger0.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4492053
* @summary Verify invalid zero length Integer value is rejected
+ * @modules java.base/sun.security.util
*/
import java.io.*;
--- a/jdk/test/sun/security/util/DerInputBuffer/DerInputBufferEqualsHashCode.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/DerInputBuffer/DerInputBufferEqualsHashCode.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @author Gary Ellison
* @bug 4170635
* @summary Verify equals()/hashCode() contract honored
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
* @run main/othervm/policy=Allow.policy DerInputBufferEqualsHashCode
*/
--- a/jdk/test/sun/security/util/DerInputBuffer/PaddedBitString.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/DerInputBuffer/PaddedBitString.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4511556
* @summary Verify BitString value containing padding bits is accepted.
+ * @modules java.base/sun.security.util
*/
import java.io.*;
--- a/jdk/test/sun/security/util/DerInputBuffer/TimeParsing.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/DerInputBuffer/TimeParsing.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4558835 4915146
* @summary Verify timezone offset and fractional seconds are correctly parsed
+ * @modules java.base/sun.security.util
*/
import java.io.*;
--- a/jdk/test/sun/security/util/DerOutputStream/LocaleInTime.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/DerOutputStream/LocaleInTime.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6670889
* @summary Keystore created under Hindi Locale causing ArrayIndexOutOfBoundsException
+ * @modules java.base/sun.security.util
* @run main/othervm -Duser.language=hi -Duser.region=IN LocaleInTime
*/
--- a/jdk/test/sun/security/util/DerValue/BadValue.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/DerValue/BadValue.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 6864911
* @summary ASN.1/DER input stream parser needs more work
+ * @modules java.base/sun.misc
+ * java.base/sun.security.util
*/
import java.io.*;
--- a/jdk/test/sun/security/util/DerValue/DerValueEqualsHashCode.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/DerValue/DerValueEqualsHashCode.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @author Gary Ellison
* @bug 4170635
* @summary Verify equals()/hashCode() contract honored
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
*/
import java.io.*;
--- a/jdk/test/sun/security/util/DerValue/EmptyValue.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/DerValue/EmptyValue.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6804045
* @summary DerValue does not accept empty OCTET STRING
+ * @modules java.base/sun.security.util
*/
import sun.security.util.DerValue;
--- a/jdk/test/sun/security/util/DerValue/Indefinite.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/DerValue/Indefinite.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6731685
* @summary CertificateFactory.generateCertificates throws IOException on PKCS7 cert chain
+ * @modules java.base/sun.security.util
*/
import java.io.*;
--- a/jdk/test/sun/security/util/DerValue/NegInt.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/DerValue/NegInt.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6855671
* @summary DerOutputStream encodes negative integer incorrectly
+ * @modules java.base/sun.security.util
*/
import sun.security.util.DerOutputStream;
--- a/jdk/test/sun/security/util/HostnameMatcher/TestHostnameChecker.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/HostnameMatcher/TestHostnameChecker.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 4514108
* @summary Verify host name matching behaves as defined in RFC2818.
+ * @modules java.base/sun.security.util
*/
import java.io.*;
--- a/jdk/test/sun/security/util/Oid/OidFormat.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/Oid/OidFormat.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,8 @@
* @bug 6418425
* @bug 6418433
* @summary ObjectIdentifier should reject 1.2.3.-4 and throw IOException on all format errors
+ * @modules java.base/sun.security.util
+ * java.security.jgss
*/
import java.io.IOException;
--- a/jdk/test/sun/security/util/Oid/S11N.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/Oid/S11N.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
/*
* @test
* @bug 4811968 6908628 8006564
+ * @modules java.base/sun.misc
+ * java.base/sun.security.util
* @run main S11N check
* @summary Serialization compatibility with old versions (and fixes)
*/
--- a/jdk/test/sun/security/util/PropertyExpander/ExpandAndEncode.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/PropertyExpander/ExpandAndEncode.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @author Valerie Peng
* @bug 4716213
* @bug 4797850
+ * @modules java.base/sun.security.util
* @summary Verify that expand(String, boolean) does not encode if
* the value is a valid URI with a scheme (it is already encoded),
* i.e. avoid double encoding.
--- a/jdk/test/sun/security/util/Resources/NewNamesFormat.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/Resources/NewNamesFormat.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,10 @@
/*
* @test
* @bug 6987827
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.tools.keytool
+ * jdk.jartool/sun.security.tools.jarsigner
+ * jdk.policytool/sun.security.tools.policytool
* @summary security/util/Resources.java needs improvement
*/
--- a/jdk/test/sun/security/util/asn1StringTypes/StringTypes.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/util/asn1StringTypes/StringTypes.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4178326
* @summary Make sure reading/writing of different DER encoded string
* types works correctly.
+ * @modules java.base/sun.security.util
*/
import java.io.*;
--- a/jdk/test/sun/security/validator/ConstructorTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/validator/ConstructorTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6996377
* @summary shrink duplicate code in the constructor of PKIXValidator
+ * @modules java.base/sun.security.validator
*/
import java.io.ByteArrayInputStream;
--- a/jdk/test/sun/security/validator/EndEntityExtensionCheck.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/validator/EndEntityExtensionCheck.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 8076117
* @summary EndEntityChecker should not process custom extensions
* after PKIX validation
+ * @modules java.base/sun.security.validator
*/
import java.io.ByteArrayInputStream;
--- a/jdk/test/sun/security/x509/AVA/AVAEqualsHashCode.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/AVA/AVAEqualsHashCode.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @author Gary Ellison
* @bug 4170635
* @summary Verify equals()/hashCode() contract honored
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
* @run main/othervm/policy=Allow.policy AVAEqualsHashCode
*/
--- a/jdk/test/sun/security/x509/AVA/BadName.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/AVA/BadName.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 4184274
* @summary Make sure bad distinguished names (without keywords) don't
* cause out-of-memory condition
+ * @modules java.base/sun.security.x509
*/
import java.io.IOException;
import sun.security.x509.X500Name;
--- a/jdk/test/sun/security/x509/AVA/DomainComponentEncoding.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/AVA/DomainComponentEncoding.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 6391482
* @summary incorrect ASN1 DER encoding of DomainComponent AttributeValue
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
*/
import javax.security.auth.x500.X500Principal;
--- a/jdk/test/sun/security/x509/AVA/EmailAddressEncoding.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/AVA/EmailAddressEncoding.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 4702543
* @summary incorrect ASN1 DER encoding of EmailAddress Attribute
+ * @modules java.base/sun.security.pkcs
+ * java.base/sun.security.util
*/
import java.io.*;
--- a/jdk/test/sun/security/x509/AlgorithmId/AlgorithmIdEqualsHashCode.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/AlgorithmId/AlgorithmIdEqualsHashCode.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @author Gary Ellison
* @bug 4170635
* @summary Verify equals()/hashCode() contract honored
+ * @modules java.base/sun.security.x509
*/
import java.io.*;
--- a/jdk/test/sun/security/x509/AlgorithmId/ExtensibleAlgorithmId.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/AlgorithmId/ExtensibleAlgorithmId.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4162868
+ * @modules java.base/sun.security.x509
* @run main/othervm ExtensibleAlgorithmId
* @summary Algorithm Name-to-OID mapping needs to be made extensible.
*/
--- a/jdk/test/sun/security/x509/AlgorithmId/NonStandardNames.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/AlgorithmId/NonStandardNames.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,10 @@
* @test
* @bug 7180907
* @summary Jarsigner -verify fails if rsa file used sha-256 with authenticated attributes
+ * @modules java.base/sun.security.pkcs
+ * java.base/sun.security.tools.keytool
+ * java.base/sun.security.util
+ * java.base/sun.security.x509
* @compile -XDignore.symbol.file NonStandardNames.java
* @run main NonStandardNames
*/
--- a/jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 6871847
* @summary AlgorithmId.get("SHA256withECDSA") not available
+ * @modules java.base/sun.security.x509
*/
import sun.security.x509.*;
--- a/jdk/test/sun/security/x509/AlgorithmId/TurkishRegion.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/AlgorithmId/TurkishRegion.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @bug 6867345
* @summary Turkish regional options cause NPE in
* sun.security.x509.AlgorithmId.algOID
+ * @modules java.base/sun.security.x509
* @run main/othervm -Duser.language=tr -Duser.region=TR TurkishRegion
* @author Xuelei Fan
*/
--- a/jdk/test/sun/security/x509/Extensions/BCNull.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/Extensions/BCNull.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @test
* @summary BasicConstraintsExtension does not encode when (ca==false && pathLen<0)
* @bug 6803376
+ * @modules java.base/sun.security.x509
*/
import sun.security.x509.BasicConstraintsExtension;
--- a/jdk/test/sun/security/x509/Extensions/DefaultCriticality.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/Extensions/DefaultCriticality.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
* @summary Change default criticality of policy mappings and policy constraints
certificate extensions
* @bug 8059916
+ * @modules java.base/sun.security.x509
*/
import sun.security.x509.PolicyConstraintsExtension;
--- a/jdk/test/sun/security/x509/GeneralName/Encode.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/GeneralName/Encode.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,6 +30,8 @@
* @bug 4716972
* @summary Check that GeneralName.encode() encodes an X500Name with
* an explicit tag
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
*/
public class Encode {
--- a/jdk/test/sun/security/x509/URIName/Parse.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/URIName/Parse.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @bug 8005389
* @summary CRL Distribution Point URIs with spaces or backslashes should
* not be parseable
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
*/
import java.io.ByteArrayInputStream;
import java.io.IOException;
--- a/jdk/test/sun/security/x509/X500Name/AllAttribs.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/X500Name/AllAttribs.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 4244051
* @summary Make sure all PKIX-required X.520 name attribs are supported
+ * @modules java.base/sun.security.x509
*/
import sun.security.x509.*;
--- a/jdk/test/sun/security/x509/X500Name/DerValueConstructor.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/X500Name/DerValueConstructor.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,8 @@
/* @test
* @bug 4228833
* @summary Make sure constructor that takes DerValue argument works
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
*/
import sun.security.util.*;
--- a/jdk/test/sun/security/x509/X500Name/EmailKeyword.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/X500Name/EmailKeyword.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,7 @@
* @bug 4531319
* @summary Make sure AVA with EMAIL or EMAILADDRESS keyword is recognized
* in DEFAULT format
+ * @modules java.base/sun.security.x509
*/
import sun.security.x509.X500Name;
--- a/jdk/test/sun/security/x509/X500Name/NullX500Name.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/X500Name/NullX500Name.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,9 @@
/* @test
* @bug 4118818
* @summary allow null X.500 Names
+ * @modules java.base/sun.misc
+ * java.base/sun.security.util
+ * java.base/sun.security.x509
*/
import java.util.Arrays;
--- a/jdk/test/sun/security/x509/X500Name/RDNwithMultipleAVAs.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/X500Name/RDNwithMultipleAVAs.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/* @test
* @bug 4197911
* @summary Make sure RDN with multiple AVAs can be parsed.
+ * @modules java.base/sun.security.x509
*/
import java.io.*;
--- a/jdk/test/sun/security/x509/X509CRLImpl/OrderAndDup.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/X509CRLImpl/OrderAndDup.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 7143872
* @summary Improve certificate extension processing
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
*/
import java.io.ByteArrayInputStream;
import java.math.BigInteger;
--- a/jdk/test/sun/security/x509/equalNames/AltNamesEqualsTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/security/x509/equalNames/AltNamesEqualsTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,8 @@
* @summary Make sure names that are equal are treated as such.
* @bug 4273559
* @author Yassir Elley
+ * @modules java.base/sun.security.util
+ * java.base/sun.security.x509
*/
import sun.security.x509.*;
--- a/jdk/test/sun/tools/java/CFCTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/tools/java/CFCTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,7 +24,9 @@
/*
* @test
* @bug 8011805
- * @summary Update sun.tools.java class file reading/writing support to include the new constant pool entries (including invokedynamic)
+ * @modules jdk.rmic/sun.tools.java jdk.rmic/sun.rmi.rmic
+ * @summary Update sun.tools.java class file reading/writing support to include
+ * the new constant pool entries (including invokedynamic)
*/
import java.io.DataInputStream;
Binary file jdk/test/sun/tools/jhat/hprof.bin has changed
Binary file jdk/test/sun/tools/jhat/jmap.bin has changed
Binary file jdk/test/sun/tools/jhat/minimal.bin has changed
--- a/jdk/test/sun/tools/jmap/BasicJMapTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/tools/jmap/BasicJMapTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -44,7 +44,7 @@
* @build jdk.test.lib.hprof.module.*
* @build jdk.test.lib.hprof.parser.*
* @build jdk.test.lib.hprof.utils.*
- * @run main BasicJMapTest
+ * @run main/timeout=240 BasicJMapTest
*/
public class BasicJMapTest {
--- a/jdk/test/sun/tools/native2ascii/A2N_4630463 Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF
--- a/jdk/test/sun/tools/native2ascii/A2N_4630463.expected Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
--- a/jdk/test/sun/tools/native2ascii/A2N_4630971 Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-#input test file 4630971 for bug native2ascii -reverse
-#occurence of a backslash character in last 5 chars
-#of input file should not hang native2ascii -reverse
-Hello world\\\\\
--- a/jdk/test/sun/tools/native2ascii/A2N_4701617 Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-\uFF61\uFF62\uFF63\uFF64\uFF65\uFF66
-\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C
-\uFF6D\uFF6E\uFF6F\uFF70\uFF71\uFF72
-\uFF73\uFF74\uFF75\uFF76\uFF77\uFF78
-\uFF79\uFF7A\uFF7B\uFF7C\uFF7D\uFF7E
-\uFF7F\uFF80\uFF81\uFF82\uFF83\uFF84
-\uFF85\uFF86\uFF87\uFF88\uFF89\uFF8A
-\uFF8B\uFF8C\uFF8D\uFF8E\uFF8F\uFF90
-\uFF91\uFF92\uFF93\uFF94\uFF95\uFF96
-\uFF97\uFF98\uFF99\uFF9A\uFF9B\uFF9C
-\uFF9D\uFF9E\uFF9F
--- a/jdk/test/sun/tools/native2ascii/A2N_4701617.expected Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-¡¢£¤¥¦
-§¨©ª«¬
-®¯°±²
-³´µ¶·¸
-¹º»¼½¾
-¿ÀÁÂÃÄ
-ÅÆÇÈÉÊ
-ËÌÍÎÏÐ
-ÑÒÓÔÕÖ
-×ØÙÚÛÜ
-ÝÞß
--- a/jdk/test/sun/tools/native2ascii/A2N_6247817 Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-\user
--- a/jdk/test/sun/tools/native2ascii/N2A_4636448 Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
--- a/jdk/test/sun/tools/native2ascii/N2A_4636448.expected Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u00de\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff
--- a/jdk/test/sun/tools/native2ascii/Native2AsciiTests.sh Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-#! /bin/sh -e
-
-#
-# Copyright (c) 2002, 2011, 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 4630463 4630971 4636448 4701617 4721296 4710890 6247817 7021987 8067964
-# @summary Tests miscellaneous native2ascii bugfixes and regressions
-
-
-if [ "${TESTSRC}" = "" ]; then TESTSRC=.; fi
-if [ "${TESTJAVA}" = "" ]; then TESTJAVA=$1; shift; fi
-
-case `uname -s` in
- Windows* | CYGWIN*) OS=Windows;;
- SunOS|Linux) OS=Unix;;
-esac
-
-N2A=$TESTJAVA/bin/native2ascii
-
-check() {
- bug=$1; shift
- expected=$1; shift
- out=$1; shift
-
- # Strip carriage returns from output when comparing with n2a test output
- # on win32 systems
- if [ ${OS} = Windows ]; then
- sed -e 's@\\r@@g' $out >$out.1
- sed -e 's@\\r@@g' $expected >$out.expected
- else
- cp $out $out.1
- cp $expected $out.expected
- fi
- if (set -x; diff -c $out.expected $out.1); then
- echo "$bug passed"
- else
- echo "$bug failed"
- exit 1
- fi
-}
-
-# Check that native2ascii -reverse with an ISO-8859-1 encoded file works
-# as documented. 4630463 fixes a bug in the ISO-8859-1 encoder which
-# prevented encoding of valid ISO-8859-1 chars > 0x7f
-
-rm -f x.*
-$N2A -reverse -encoding ISO-8859-1 $TESTSRC/A2N_4630463 x.out
-check 4630463 $TESTSRC/A2N_4630463.expected x.out
-
-# Take file encoded in ISO-8859-1 with range of chars , 0x7f < c < 0xff
-# invoke native2ascii with input filename and output filename identical
-# Ensure that output file is as expected by comparing to expected output.
-# 4636448 Fixed bug whereby output file was clobbered if infile and outfile
-# referred to same filename. This bug only applies to Solaris/Linux, since on
-# Windows you can't write to a file that's open for reading.
-
-if [ $OS = Unix ]; then
- rm -f x.*
- cp $TESTSRC/N2A_4636448 x.in
- chmod +w x.in
- ls -l x.in
- if $N2A -encoding ISO-8859-1 x.in x.in; then
- check 4636448 $TESTSRC/N2A_4636448.expected x.in
- fi
-fi
-
-# Ensure that files containing backslashes adjacent to EOF don't
-# hang native2ascii -reverse
-
-rm -f x.*
-$N2A -reverse -encoding ISO-8859-1 $TESTSRC/A2N_4630971 x.out
-check 4630971 $TESTSRC/A2N_4630971 x.out
-
-# Check reverse (char -> native) encoding of Japanese Halfwidth
-# Katakana characters for MS932 (default WinNT Japanese encoding)
-# Regression test for bugID 4701617
-
-rm -f x.*
-$N2A -reverse -encoding MS932 $TESTSRC/A2N_4701617 x.out
-check 4701617 $TESTSRC/A2N_4701617.expected x.out
-
-# Check that the inputfile appears in the error message when not found
-
-badin="DoesNotExist"
-$N2A $badin x.out | grep "$badin" > /dev/null
-if [ $? != 0 ]; then
- echo "\"$badin\" expected to appear in error message"
- exit 1
-fi
-
-# for win32 only ensure when output file pre-exists that
-# native2ascii tool will simply overwrite with the expected
-# output file (fixed bugID 4710890)
-
-if [ OS = Windows ]; then
- rm -f x.*
- cp $TESTSRC/test3 x.in
- chmod a+x x.in
- ls -l x.in
- touch x.out
- $N2A -encoding ISO-8859-1 x.in x.out
- check 4710890 $TESTSRC/test3 x.out
-fi
-
-rm -rf x.*
-$N2A -reverse $TESTSRC/A2N_6247817 x.out
-check 4701617 $TESTSRC/A2N_6247817 x.out
-
--- a/jdk/test/sun/tools/native2ascii/NativeErrors.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 1998, 1999, 2014 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 4136352
- * @library /lib/testlibrary
- * @summary Test Native2ASCII error messages
- *
- */
-
-import java.io.File;
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.ProcessTools;
-
-public class NativeErrors {
-
- private static ResourceBundle rsrc;
-
- static {
- try {
- rsrc = ResourceBundle.getBundle(
- "sun.tools.native2ascii.resources.MsgNative2ascii");
- } catch (MissingResourceException e) {
- throw new Error("Missing message file.");
- }
- }
-
- public static void main(String args[]) throws Throwable {
- // Execute command in another vm. Verify stdout for expected err msg.
-
- // Test with no input file given.
- checkResult(executeCmd("-encoding"), "err.bad.arg");
-
- File f0 = new File(System.getProperty("test.src", "."), "test123");
- String path0 = f0.getPath();
- if ( f0.exists() ) {
- throw new Error("Input file should not exist: " + path0);
- }
- checkResult(executeCmd(path0), "err.cannot.read");
-
- File f1 = new File(System.getProperty("test.src", "."), "test1");
- File f2 = File.createTempFile("test2", ".tmp");
- String path1 = f1.getPath();
- String path2 = f2.getPath();
- if ( !f1.exists() ) {
- throw new Error("Missing input file: " + path1);
- }
- if ( !f2.setWritable(false) ) {
- throw new Error("Output file cannot be made read only: " + path2);
- }
- f2.deleteOnExit();
- if ( f2.canWrite() ) {
- String msg = "Output file is still writable. " +
- "Probably because test is run as root. Read-only test skipped.";
- System.out.println(msg);
- } else {
- // Test write to a read-only file.
- checkResult(executeCmd(path1, path2), "err.cannot.write");
- }
- }
-
- private static String executeCmd(String... toolArgs) throws Throwable {
- JDKToolLauncher cmd = JDKToolLauncher.createUsingTestJDK("native2ascii");
- for (String s : toolArgs) {
- cmd.addToolArg(s);
- }
- OutputAnalyzer output = ProcessTools.executeProcess(cmd.getCommand());
- if (output == null || output.getStdout() == null) {
- throw new Exception("Output was null. Process did not finish correctly.");
- }
- if (output.getExitValue() == 0) {
- throw new Exception("Process exit code was 0, but error was expected.");
- }
- return output.getStdout();
- }
-
- private static void checkResult(
- String errorReceived, String errorKey) throws Exception {
- String errorExpected = rsrc.getString(errorKey);
- if (errorExpected == null) {
- throw new Exception("No error message for key: " + errorKey);
- }
- // Remove template tag from error message.
- errorExpected = errorExpected.replaceAll("\\{0\\}", "");
-
- System.out.println("received: " + errorReceived);
- System.out.println("expected: " + errorExpected);
- if (errorReceived.indexOf(errorExpected) < 0) {
- throw new RuntimeException("Native2ascii bad arg error broken.");
- }
- }
-
-}
--- a/jdk/test/sun/tools/native2ascii/Permission.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2012, 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 7177216
- * @summary resulting file of native2ascii should have normal permission
- */
-
-import java.io.*;
-import java.nio.file.*;
-import java.nio.file.attribute.*;
-import sun.tools.native2ascii.Main;
-
-public class Permission {
-
- private static void cleanup(String... fnames) throws Throwable {
- for (String fname : fnames) {
- Files.deleteIfExists(Paths.get(fname));
- }
- }
-
- public static void realMain(String[] args) throws Throwable {
- if (!System.getProperty("os.name").startsWith("Windows")) {
- String src = "native2ascii_permtest_src";
- String dst = "native2ascii_permtest_dst";
-
- cleanup(src, dst);
- try {
- try (FileOutputStream fos = new FileOutputStream(src)) {
- fos.write('a'); fos.write('b'); fos.write('c');
- }
- String[] n2aArgs = new String[] {"-encoding", "utf8", src, dst};
- if (!new Main().convert(n2aArgs)) {
- fail("n2a failed.");
- }
- equal(Files.getPosixFilePermissions(Paths.get(src)),
- Files.getPosixFilePermissions(Paths.get(dst)));
- String[] a2nArgs = new String[] {"-reverse", "-encoding", "utf8", dst, src};
- if (!new Main().convert(a2nArgs)) {
- fail("a2n failed.");
- }
- equal(Files.getPosixFilePermissions(Paths.get(src)),
- Files.getPosixFilePermissions(Paths.get(dst)));
- } finally {
- cleanup(src, dst);
- }
- }
- }
-
- //--------------------- Infrastructure ---------------------------
- static volatile int passed = 0, failed = 0;
- static void pass() {passed++;}
- static void fail() {failed++; Thread.dumpStack();}
- static void fail(String msg) {System.out.println(msg); fail();}
- static void unexpected(Throwable t) {failed++; t.printStackTrace();}
- static void check(boolean cond) {if (cond) pass(); else fail();}
- static void equal(Object x, Object y) {
- if (x == null ? y == null : x.equals(y)) pass();
- else fail(x + " not equal to " + y);}
- public static void main(String[] args) throws Throwable {
- try {realMain(args);} catch (Throwable t) {unexpected(t);}
- System.out.println("\nPassed = " + passed + " failed = " + failed);
- if (failed > 0) throw new AssertionError("Some tests failed");}
-}
--- a/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2005, 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 6287579
- * @summary SubClasses of ListResourceBundle should fix getContents()
- * @run main ImmutableResourceTest
- *
- * @author Tim Bell
- *
- */
-import java.util.ResourceBundle;
-
-public class ImmutableResourceTest {
-
- public static void main(String[] args) throws Exception {
- /* Reach under the covers and get the message strings */
- sun.tools.native2ascii.resources.MsgNative2ascii msgs =
- new sun.tools.native2ascii.resources.MsgNative2ascii ();
- Object [][] testData = msgs.getContents();
-
- /* Shred our copy of the message strings */
- for (int ii = 0; ii < testData.length; ii++) {
- testData[ii][0] = "T6287579";
- testData[ii][1] = "yyy";
- }
-
- /*
- * Try to lookup the shredded key.
- * If this is successful we have a problem.
- */
- String ss = null;
- try {
- ss = msgs.getString("T6287579");
- } catch (java.util.MissingResourceException mre) {
- /*
- * Ignore the expected MissingResourceException since key
- * "T6287579" is not in the canonical MsgNative2ascii.
- */
- }
- if ("yyy".equals(ss)) {
- throw new Exception ("SubClasses of ListResourceBundle should fix getContents()");
- }
- System.out.println("...Finished.");
- }
-}
--- a/jdk/test/sun/tools/native2ascii/test1 Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-This file exists as a readable placeholder for NativeErrors.java.
--- a/jdk/test/sun/tools/native2ascii/test3 Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-This file exists as a non-writable placeholder for Native2AsciiTests
--- a/jdk/test/sun/util/calendar/zi/TestZoneInfo310.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/util/calendar/zi/TestZoneInfo310.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,6 +26,7 @@
*@bug 8007572 8008161
*@summary Test whether the TimeZone generated from JSR310 tzdb is the same
*as the one from the tz data from javazic
+ * @modules java.base/sun.util.calendar
*/
import java.io.File;
--- a/jdk/test/sun/util/locale/provider/Bug8038436.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/util/locale/provider/Bug8038436.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,6 +25,8 @@
* @test
* @bug 8038436
* @summary Test for changes in 8038436
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.spi
* @compile -XDignore.symbol.file Bug8038436.java
* @run main/othervm Bug8038436 -Djava.ext.dirs=foo security
* @run main/othervm Bug8038436 -Djava.locale.providers=JRE availlocs
--- a/jdk/test/sun/util/logging/PlatformLoggerTest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/util/logging/PlatformLoggerTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,6 +29,7 @@
* operations. othervm mode to make sure java.util.logging
* is not initialized.
*
+ * @modules java.base/sun.util.logging
* @compile -XDignore.symbol.file PlatformLoggerTest.java
* @run main/othervm PlatformLoggerTest
*/
--- a/jdk/test/sun/util/logging/SourceClassName.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/sun/util/logging/SourceClassName.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,6 +27,7 @@
* @summary Test the source class name and method output by the platform
* logger.
*
+ * @modules java.base/sun.util.logging
* @compile -XDignore.symbol.file SourceClassName.java
* @run main/othervm SourceClassName
*/
--- a/jdk/test/tools/jar/ChangeDir.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/tools/jar/ChangeDir.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4806786 8023113
+ * @modules jdk.jartool/sun.tools.jar
* @summary jar -C doesn't ignore multiple // in path
*/
--- a/jdk/test/tools/jar/JarBackSlash.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/tools/jar/JarBackSlash.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,6 +28,7 @@
/*
* @test
* @bug 7201156
+ * @modules jdk.jartool/sun.tools.jar
* @summary jar tool fails to convert file separation characters for list and extract
* @author Sean Chou
*/
--- a/jdk/test/tools/jar/JarEntryTime.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/tools/jar/JarEntryTime.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4225317 6969651
+ * @modules jdk.jartool/sun.tools.jar
* @summary Check extracted files have date as per those in the .jar file
*/
--- a/jdk/test/tools/jar/UpdateJar.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/tools/jar/UpdateJar.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 7175845
+ * @modules jdk.jartool/sun.tools.jar
* @summary jar -uf should not change file permission
*/
--- a/jdk/test/tools/jar/UpdateManifest.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/tools/jar/UpdateManifest.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @bug 6434207 6442687 6984046
+ * @modules jdk.jartool/sun.tools.jar
* @summary Ensure that jar ufm actually updates the
* existing jar file's manifest with contents of the
* manifest file.
--- a/jdk/test/tools/jar/index/MetaInf.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/tools/jar/index/MetaInf.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4408526 6854795
+ * @modules jdk.jartool/sun.tools.jar
* @summary Index the non-meta files in META-INF, such as META-INF/services.
*/
--- a/jdk/test/tools/launcher/VersionCheck.java Thu May 28 11:37:13 2015 -0700
+++ b/jdk/test/tools/launcher/VersionCheck.java Mon Jun 01 10:15:20 2015 -0700
@@ -93,7 +93,6 @@
"kinit",
"klist",
"ktab",
- "native2ascii",
"orbd",
"pack200",
"packager",
--- a/langtools/.hgtags Thu May 28 11:37:13 2015 -0700
+++ b/langtools/.hgtags Mon Jun 01 10:15:20 2015 -0700
@@ -308,3 +308,4 @@
a28b7f42dae9bd59513beaa5a2d6eb563dc09e08 jdk9-b63
809d66512998789b620d08c335d7c31211a0cf29 jdk9-b64
4fcf722b811406a7db8f206d88446c82cda1b5f4 jdk9-b65
+fd6bda430d96fc5ab421161de016412f2ddd9082 jdk9-b66
--- a/langtools/make/CompileInterim.gmk Thu May 28 11:37:13 2015 -0700
+++ b/langtools/make/CompileInterim.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -41,11 +41,11 @@
DISABLE_SJAVAC := true, \
SRC := $(LANGTOOLS_TOPDIR)/src/java.compiler/share/classes \
$(LANGTOOLS_TOPDIR)/src/jdk.compiler/share/classes \
- $(LANGTOOLS_TOPDIR)/src/jdk.dev/share/classes \
$(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/classes \
+ $(LANGTOOLS_TOPDIR)/src/jdk.jdeps/share/classes \
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.compiler \
- $(SUPPORT_OUTPUTDIR)/gensrc/jdk.dev \
- $(SUPPORT_OUTPUTDIR)/gensrc/jdk.javadoc, \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.javadoc \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdeps, \
EXCLUDES := sun jdk, \
COPY := .gif .xml .css .js javax.tools.JavaCompilerTool, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_interim_classes, \
--- a/langtools/make/build.properties Thu May 28 11:37:13 2015 -0700
+++ b/langtools/make/build.properties Mon Jun 01 10:15:20 2015 -0700
@@ -47,11 +47,11 @@
boot.javac.target = 8
#configuration of submodules (share by both the bootstrap and normal compilation):
-langtools.modules=java.compiler:jdk.compiler:jdk.dev:jdk.javadoc
+langtools.modules=java.compiler:jdk.compiler:jdk.jdeps:jdk.javadoc
java.compiler.dependencies=
jdk.compiler.dependencies=java.compiler
jdk.javadoc.dependencies=java.compiler:jdk.compiler
-jdk.dev.dependencies=java.compiler:jdk.compiler
+jdk.jdeps.dependencies=java.compiler:jdk.compiler
javac.resource.includes = \
com/sun/tools/javac/resources/compiler.properties
--- a/langtools/make/build.xml Thu May 28 11:37:13 2015 -0700
+++ b/langtools/make/build.xml Mon Jun 01 10:15:20 2015 -0700
@@ -257,7 +257,7 @@
<class location="${build.dir}/java.compiler/classes"/>
<class location="${build.dir}/jdk.compiler/classes"/>
<class location="${build.dir}/jdk.javadoc/classes"/>
- <class location="${build.dir}/jdk.dev/classes"/>
+ <class location="${build.dir}/jdk.jdeps/classes"/>
<sourcePath>
<pathelement path="${langtools.sources}"/>
</sourcePath>
@@ -463,7 +463,7 @@
<build-module-jar module.name="java.compiler" compilation.kind="@{compilation.kind}" />
<build-module-jar module.name="jdk.compiler" compilation.kind="@{compilation.kind}" />
<build-module-jar module.name="jdk.javadoc" compilation.kind="@{compilation.kind}" />
- <build-module-jar module.name="jdk.dev" compilation.kind="@{compilation.kind}" />
+ <build-module-jar module.name="jdk.jdeps" compilation.kind="@{compilation.kind}" />
</sequential>
</macrodef>
</target>
@@ -527,7 +527,7 @@
resource.includes="${javac.resource.includes}" />
<build-module-classes module.name="jdk.javadoc"
compilation.kind="@{compilation.kind}" />
- <build-module-classes module.name="jdk.dev"
+ <build-module-classes module.name="jdk.jdeps"
compilation.kind="@{compilation.kind}" />
</sequential>
</macrodef>
--- a/langtools/make/gensrc/Gensrc-jdk.compiler.gmk Thu May 28 11:37:13 2015 -0700
+++ b/langtools/make/gensrc/Gensrc-jdk.compiler.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -31,11 +31,8 @@
$(eval $(call SetupVersionProperties,JAVAH_VERSION, \
com/sun/tools/javah/resources/version.properties))
-$(eval $(call SetupVersionProperties,JAVAP_VERSION, \
- com/sun/tools/javap/resources/version.properties))
-
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
- $(JAVAC_VERSION) $(JAVAH_VERSION) $(JAVAP_VERSION)))
+ $(JAVAC_VERSION) $(JAVAH_VERSION)))
$(eval $(call SetupParseProperties,PARSE_PROPERTIES, \
com/sun/tools/javac/resources/compiler.properties))
--- a/langtools/make/gensrc/Gensrc-jdk.dev.gmk Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2014, 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.
-#
-
-include GensrcCommon.gmk
-
-$(eval $(call SetupVersionProperties,JDEPS_VERSION,\
- com/sun/tools/jdeps/resources/version.properties))
-
-$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, $(JDEPS_VERSION)))
-
-all: $(COMPILE_PROPERTIES)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/make/gensrc/Gensrc-jdk.jdeps.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2014, 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.
+#
+
+include GensrcCommon.gmk
+
+$(eval $(call SetupVersionProperties,JAVAP_VERSION, \
+ com/sun/tools/javap/resources/version.properties))
+
+$(eval $(call SetupVersionProperties,JDEPS_VERSION,\
+ com/sun/tools/jdeps/resources/version.properties))
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES,\
+ $(JDEPS_VERSION) $(JAVAP_VERSION)))
+
+all: $(COMPILE_PROPERTIES)
--- a/langtools/make/intellij/langtools.iml Thu May 28 11:37:13 2015 -0700
+++ b/langtools/make/intellij/langtools.iml Mon Jun 01 10:15:20 2015 -0700
@@ -6,13 +6,13 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/java.compiler/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.compiler/share/classes" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/jdk.dev/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.javadoc/share/classes" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/jdk.jdeps/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/bootstrap/java.compiler/gensrc" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/bootstrap/jdk.compiler/gensrc" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/build/bootstrap/jdk.dev/gensrc" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/bootstrap/jdk.javadoc/gensrc" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/build/bootstrap/jdk.jdeps/gensrc" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
--- a/langtools/make/intellij/workspace.xml Thu May 28 11:37:13 2015 -0700
+++ b/langtools/make/intellij/workspace.xml Mon Jun 01 10:15:20 2015 -0700
@@ -10,7 +10,7 @@
<!-- standard tools -->
<configuration default="false" name="javac" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="com.sun.tools.javac.Main" />
- <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.dev@FILE_SEP@classes" />
+ <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.jdeps@FILE_SEP@classes" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -29,7 +29,7 @@
</configuration>
<configuration default="false" name="javadoc" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="com.sun.tools.javadoc.Main" />
- <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.dev@FILE_SEP@classes" />
+ <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.jdeps@FILE_SEP@classes" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -48,7 +48,7 @@
</configuration>
<configuration default="false" name="javap" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="com.sun.tools.javap.Main" />
- <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.dev@FILE_SEP@classes" />
+ <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.jdeps@FILE_SEP@classes" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -67,7 +67,7 @@
</configuration>
<configuration default="false" name="javah" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="com.sun.tools.javah.Main" />
- <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.dev@FILE_SEP@classes" />
+ <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.jdeps@FILE_SEP@classes" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -86,7 +86,7 @@
</configuration>
<configuration default="false" name="sjavac" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="com.sun.tools.sjavac.Main" />
- <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.dev@FILE_SEP@classes" />
+ <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.jdeps@FILE_SEP@classes" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -106,7 +106,7 @@
<!-- bootstrap javac -->
<configuration default="false" name="javac (bootstrap)" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="com.sun.tools.javac.Main" />
- <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@bootstrap@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@bootstrap@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@bootstrap@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@bootstrap@FILE_SEP@jdk.dev@FILE_SEP@classes" />
+ <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@bootstrap@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@bootstrap@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@bootstrap@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@bootstrap@FILE_SEP@jdk.jdeps@FILE_SEP@classes" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
--- a/langtools/make/netbeans/langtools/nbproject/project.xml Thu May 28 11:37:13 2015 -0700
+++ b/langtools/make/netbeans/langtools/nbproject/project.xml Mon Jun 01 10:15:20 2015 -0700
@@ -67,9 +67,9 @@
<location>${root}/src/jdk.compiler/share/classes</location>
</source-folder>
<source-folder>
- <label>Source files - jdk.dev</label>
+ <label>Source files - jdk.jdeps</label>
<type>java</type>
- <location>${root}/src/jdk.dev/share/classes</location>
+ <location>${root}/src/jdk.jdeps/share/classes</location>
</source-folder>
<source-folder>
<label>Source files - jdk.javadoc</label>
@@ -128,10 +128,10 @@
</action>
<action name="compile.single">
<target>compile-single</target>
- <property name="module.name">jdk.dev</property>
+ <property name="module.name">jdk.jdeps</property>
<context>
<property>includes</property>
- <folder>${root}/src/jdk.dev/share/classes</folder>
+ <folder>${root}/src/jdk.jdeps/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path</format>
<arity>
@@ -195,7 +195,7 @@
<target>run-single</target>
<context>
<property>run.classname</property>
- <folder>${root}/src/jdk.dev/share/classes</folder>
+ <folder>${root}/src/jdk.jdeps/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
@@ -265,7 +265,7 @@
<target>debug-single</target>
<context>
<property>debug.classname</property>
- <folder>${root}/src/jdk.dev/share/classes</folder>
+ <folder>${root}/src/jdk.jdeps/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
@@ -329,10 +329,10 @@
</action>
<action name="debug.fix">
<target>debug-fix</target>
- <property name="module.name">jdk.dev</property>
+ <property name="module.name">jdk.jdeps</property>
<context>
<property>class</property>
- <folder>${root}/src/jdk.dev/share/classes</folder>
+ <folder>${root}/src/jdk.jdeps/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path-noext</format>
<arity>
@@ -382,8 +382,8 @@
<location>${root}/src/jdk.compiler/share/classes</location>
</source-folder>
<source-folder style="tree">
- <label>Source files - jdk.dev</label>
- <location>${root}/src/jdk.dev/share/classes</location>
+ <label>Source files - jdk.jdeps</label>
+ <location>${root}/src/jdk.jdeps/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Source files - jdk.javadoc</label>
@@ -443,10 +443,10 @@
<source-level>1.8</source-level>
</compilation-unit>
<compilation-unit>
- <package-root>${root}/src/jdk.dev/share/classes</package-root>
- <package-root>${root}/build/bootstrap/jdk.dev/gensrc</package-root>
+ <package-root>${root}/src/jdk.jdeps/share/classes</package-root>
+ <package-root>${root}/build/bootstrap/jdk.jdeps/gensrc</package-root>
<classpath mode="compile">${root}/build/java.compiler/classes:${root}/build/jdk.compiler/classes</classpath>
- <built-to>${root}/build/jdk.dev/classes</built-to>
+ <built-to>${root}/build/jdk.jdeps/classes</built-to>
<source-level>1.8</source-level>
</compilation-unit>
<compilation-unit>
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/AccessFlags.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * See JVMS, sections 4.2, 4.6, 4.7.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class AccessFlags {
- public static final int ACC_PUBLIC = 0x0001; // class, inner, field, method
- public static final int ACC_PRIVATE = 0x0002; // inner, field, method
- public static final int ACC_PROTECTED = 0x0004; // inner, field, method
- public static final int ACC_STATIC = 0x0008; // inner, field, method
- public static final int ACC_FINAL = 0x0010; // class, inner, field, method
- public static final int ACC_SUPER = 0x0020; // class
- public static final int ACC_SYNCHRONIZED = 0x0020; // method
- public static final int ACC_VOLATILE = 0x0040; // field
- public static final int ACC_BRIDGE = 0x0040; // method
- public static final int ACC_TRANSIENT = 0x0080; // field
- public static final int ACC_VARARGS = 0x0080; // method
- public static final int ACC_NATIVE = 0x0100; // method
- public static final int ACC_INTERFACE = 0x0200; // class, inner
- public static final int ACC_ABSTRACT = 0x0400; // class, inner, method
- public static final int ACC_STRICT = 0x0800; // method
- public static final int ACC_SYNTHETIC = 0x1000; // class, inner, field, method
- public static final int ACC_ANNOTATION = 0x2000; // class, inner
- public static final int ACC_ENUM = 0x4000; // class, inner, field
- public static final int ACC_MANDATED = 0x8000; // class, inner, field, method
-
- public static enum Kind { Class, InnerClass, Field, Method}
-
- AccessFlags(ClassReader cr) throws IOException {
- this(cr.readUnsignedShort());
- }
-
- public AccessFlags(int flags) {
- this.flags = flags;
- }
-
- public AccessFlags ignore(int mask) {
- return new AccessFlags(flags & ~mask);
- }
-
- public boolean is(int mask) {
- return (flags & mask) != 0;
- }
-
- public int byteLength() {
- return 2;
- }
-
- private static final int[] classModifiers = {
- ACC_PUBLIC, ACC_FINAL, ACC_ABSTRACT
- };
-
- private static final int[] classFlags = {
- ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_INTERFACE, ACC_ABSTRACT,
- ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM
- };
-
- public Set<String> getClassModifiers() {
- int f = ((flags & ACC_INTERFACE) != 0 ? flags & ~ACC_ABSTRACT : flags);
- return getModifiers(f, classModifiers, Kind.Class);
- }
-
- public Set<String> getClassFlags() {
- return getFlags(classFlags, Kind.Class);
- }
-
- private static final int[] innerClassModifiers = {
- ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
- ACC_ABSTRACT
- };
-
- private static final int[] innerClassFlags = {
- ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_SUPER,
- ACC_INTERFACE, ACC_ABSTRACT, ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM
- };
-
- public Set<String> getInnerClassModifiers() {
- int f = ((flags & ACC_INTERFACE) != 0 ? flags & ~ACC_ABSTRACT : flags);
- return getModifiers(f, innerClassModifiers, Kind.InnerClass);
- }
-
- public Set<String> getInnerClassFlags() {
- return getFlags(innerClassFlags, Kind.InnerClass);
- }
-
- private static final int[] fieldModifiers = {
- ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
- ACC_VOLATILE, ACC_TRANSIENT
- };
-
- private static final int[] fieldFlags = {
- ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
- ACC_VOLATILE, ACC_TRANSIENT, ACC_SYNTHETIC, ACC_ENUM
- };
-
- public Set<String> getFieldModifiers() {
- return getModifiers(fieldModifiers, Kind.Field);
- }
-
- public Set<String> getFieldFlags() {
- return getFlags(fieldFlags, Kind.Field);
- }
-
- private static final int[] methodModifiers = {
- ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
- ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT, ACC_STRICT
- };
-
- private static final int[] methodFlags = {
- ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
- ACC_SYNCHRONIZED, ACC_BRIDGE, ACC_VARARGS, ACC_NATIVE, ACC_ABSTRACT,
- ACC_STRICT, ACC_SYNTHETIC
- };
-
- public Set<String> getMethodModifiers() {
- return getModifiers(methodModifiers, Kind.Method);
- }
-
- public Set<String> getMethodFlags() {
- return getFlags(methodFlags, Kind.Method);
- }
-
- private Set<String> getModifiers(int[] modifierFlags, Kind t) {
- return getModifiers(flags, modifierFlags, t);
- }
-
- private static Set<String> getModifiers(int flags, int[] modifierFlags, Kind t) {
- Set<String> s = new LinkedHashSet<>();
- for (int m: modifierFlags) {
- if ((flags & m) != 0)
- s.add(flagToModifier(m, t));
- }
- return s;
- }
-
- private Set<String> getFlags(int[] expectedFlags, Kind t) {
- Set<String> s = new LinkedHashSet<>();
- int f = flags;
- for (int e: expectedFlags) {
- if ((f & e) != 0) {
- s.add(flagToName(e, t));
- f = f & ~e;
- }
- }
- while (f != 0) {
- int bit = Integer.highestOneBit(f);
- s.add("0x" + Integer.toHexString(bit));
- f = f & ~bit;
- }
- return s;
- }
-
- private static String flagToModifier(int flag, Kind t) {
- switch (flag) {
- case ACC_PUBLIC:
- return "public";
- case ACC_PRIVATE:
- return "private";
- case ACC_PROTECTED:
- return "protected";
- case ACC_STATIC:
- return "static";
- case ACC_FINAL:
- return "final";
- case ACC_SYNCHRONIZED:
- return "synchronized";
- case 0x80:
- return (t == Kind.Field ? "transient" : null);
- case ACC_VOLATILE:
- return "volatile";
- case ACC_NATIVE:
- return "native";
- case ACC_ABSTRACT:
- return "abstract";
- case ACC_STRICT:
- return "strictfp";
- case ACC_MANDATED:
- return "mandated";
- default:
- return null;
- }
- }
-
- private static String flagToName(int flag, Kind t) {
- switch (flag) {
- case ACC_PUBLIC:
- return "ACC_PUBLIC";
- case ACC_PRIVATE:
- return "ACC_PRIVATE";
- case ACC_PROTECTED:
- return "ACC_PROTECTED";
- case ACC_STATIC:
- return "ACC_STATIC";
- case ACC_FINAL:
- return "ACC_FINAL";
- case 0x20:
- return (t == Kind.Class ? "ACC_SUPER" : "ACC_SYNCHRONIZED");
- case 0x40:
- return (t == Kind.Field ? "ACC_VOLATILE" : "ACC_BRIDGE");
- case 0x80:
- return (t == Kind.Field ? "ACC_TRANSIENT" : "ACC_VARARGS");
- case ACC_NATIVE:
- return "ACC_NATIVE";
- case ACC_INTERFACE:
- return "ACC_INTERFACE";
- case ACC_ABSTRACT:
- return "ACC_ABSTRACT";
- case ACC_STRICT:
- return "ACC_STRICT";
- case ACC_SYNTHETIC:
- return "ACC_SYNTHETIC";
- case ACC_ANNOTATION:
- return "ACC_ANNOTATION";
- case ACC_ENUM:
- return "ACC_ENUM";
- case ACC_MANDATED:
- return "ACC_MANDATED";
- default:
- return null;
- }
- }
-
- public final int flags;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Annotation.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2007, 2009, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.16.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Annotation {
- static class InvalidAnnotation extends AttributeException {
- private static final long serialVersionUID = -4620480740735772708L;
- InvalidAnnotation(String msg) {
- super(msg);
- }
- }
-
- Annotation(ClassReader cr) throws IOException, InvalidAnnotation {
- type_index = cr.readUnsignedShort();
- num_element_value_pairs = cr.readUnsignedShort();
- element_value_pairs = new element_value_pair[num_element_value_pairs];
- for (int i = 0; i < element_value_pairs.length; i++)
- element_value_pairs[i] = new element_value_pair(cr);
- }
-
- public Annotation(ConstantPool constant_pool,
- int type_index,
- element_value_pair[] element_value_pairs) {
- this.type_index = type_index;
- num_element_value_pairs = element_value_pairs.length;
- this.element_value_pairs = element_value_pairs;
- }
-
- public int length() {
- int n = 2 /*type_index*/ + 2 /*num_element_value_pairs*/;
- for (element_value_pair pair: element_value_pairs)
- n += pair.length();
- return n;
- }
-
- public final int type_index;
- public final int num_element_value_pairs;
- public final element_value_pair element_value_pairs[];
-
- /**
- * See JVMS, section 4.8.16.1.
- */
- public static abstract class element_value {
- public static element_value read(ClassReader cr)
- throws IOException, InvalidAnnotation {
- int tag = cr.readUnsignedByte();
- switch (tag) {
- case 'B':
- case 'C':
- case 'D':
- case 'F':
- case 'I':
- case 'J':
- case 'S':
- case 'Z':
- case 's':
- return new Primitive_element_value(cr, tag);
-
- case 'e':
- return new Enum_element_value(cr, tag);
-
- case 'c':
- return new Class_element_value(cr, tag);
-
- case '@':
- return new Annotation_element_value(cr, tag);
-
- case '[':
- return new Array_element_value(cr, tag);
-
- default:
- throw new InvalidAnnotation("unrecognized tag: " + tag);
- }
- }
-
- protected element_value(int tag) {
- this.tag = tag;
- }
-
- public abstract int length();
-
- public abstract <R,P> R accept(Visitor<R,P> visitor, P p);
-
- public interface Visitor<R,P> {
- R visitPrimitive(Primitive_element_value ev, P p);
- R visitEnum(Enum_element_value ev, P p);
- R visitClass(Class_element_value ev, P p);
- R visitAnnotation(Annotation_element_value ev, P p);
- R visitArray(Array_element_value ev, P p);
- }
-
- public final int tag;
- }
-
- public static class Primitive_element_value extends element_value {
- Primitive_element_value(ClassReader cr, int tag) throws IOException {
- super(tag);
- const_value_index = cr.readUnsignedShort();
- }
-
- @Override
- public int length() {
- return 2;
- }
-
- public <R,P> R accept(Visitor<R,P> visitor, P p) {
- return visitor.visitPrimitive(this, p);
- }
-
- public final int const_value_index;
-
- }
-
- public static class Enum_element_value extends element_value {
- Enum_element_value(ClassReader cr, int tag) throws IOException {
- super(tag);
- type_name_index = cr.readUnsignedShort();
- const_name_index = cr.readUnsignedShort();
- }
-
- @Override
- public int length() {
- return 4;
- }
-
- public <R,P> R accept(Visitor<R,P> visitor, P p) {
- return visitor.visitEnum(this, p);
- }
-
- public final int type_name_index;
- public final int const_name_index;
- }
-
- public static class Class_element_value extends element_value {
- Class_element_value(ClassReader cr, int tag) throws IOException {
- super(tag);
- class_info_index = cr.readUnsignedShort();
- }
-
- @Override
- public int length() {
- return 2;
- }
-
- public <R,P> R accept(Visitor<R,P> visitor, P p) {
- return visitor.visitClass(this, p);
- }
-
- public final int class_info_index;
- }
-
- public static class Annotation_element_value extends element_value {
- Annotation_element_value(ClassReader cr, int tag)
- throws IOException, InvalidAnnotation {
- super(tag);
- annotation_value = new Annotation(cr);
- }
-
- @Override
- public int length() {
- return annotation_value.length();
- }
-
- public <R,P> R accept(Visitor<R,P> visitor, P p) {
- return visitor.visitAnnotation(this, p);
- }
-
- public final Annotation annotation_value;
- }
-
- public static class Array_element_value extends element_value {
- Array_element_value(ClassReader cr, int tag)
- throws IOException, InvalidAnnotation {
- super(tag);
- num_values = cr.readUnsignedShort();
- values = new element_value[num_values];
- for (int i = 0; i < values.length; i++)
- values[i] = element_value.read(cr);
- }
-
- @Override
- public int length() {
- int n = 2;
- for (int i = 0; i < values.length; i++)
- n += values[i].length();
- return n;
- }
-
- public <R,P> R accept(Visitor<R,P> visitor, P p) {
- return visitor.visitArray(this, p);
- }
-
- public final int num_values;
- public final element_value[] values;
- }
-
- public static class element_value_pair {
- element_value_pair(ClassReader cr)
- throws IOException, InvalidAnnotation {
- element_name_index = cr.readUnsignedShort();
- value = element_value.read(cr);
- }
-
- public int length() {
- return 2 + value.length();
- }
-
- public final int element_name_index;
- public final element_value value;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/AnnotationDefault_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.15.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class AnnotationDefault_attribute extends Attribute {
- AnnotationDefault_attribute(ClassReader cr, int name_index, int length)
- throws IOException, Annotation.InvalidAnnotation {
- super(name_index, length);
- default_value = Annotation.element_value.read(cr);
- }
-
- public AnnotationDefault_attribute(ConstantPool constant_pool, Annotation.element_value default_value)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.AnnotationDefault), default_value);
- }
-
- public AnnotationDefault_attribute(int name_index, Annotation.element_value default_value) {
- super(name_index, default_value.length());
- this.default_value = default_value;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitAnnotationDefault(this, data);
- }
-
- public final Annotation.element_value default_value;
-}
-
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2007, 2014, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-
-public abstract class Attribute {
- public static final String AnnotationDefault = "AnnotationDefault";
- public static final String BootstrapMethods = "BootstrapMethods";
- public static final String CharacterRangeTable = "CharacterRangeTable";
- public static final String Code = "Code";
- public static final String ConstantValue = "ConstantValue";
- public static final String CompilationID = "CompilationID";
- public static final String Deprecated = "Deprecated";
- public static final String EnclosingMethod = "EnclosingMethod";
- public static final String Exceptions = "Exceptions";
- public static final String InnerClasses = "InnerClasses";
- public static final String LineNumberTable = "LineNumberTable";
- public static final String LocalVariableTable = "LocalVariableTable";
- public static final String LocalVariableTypeTable = "LocalVariableTypeTable";
- public static final String MethodParameters = "MethodParameters";
- public static final String RuntimeVisibleAnnotations = "RuntimeVisibleAnnotations";
- public static final String RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
- public static final String RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
- public static final String RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
- public static final String RuntimeVisibleTypeAnnotations = "RuntimeVisibleTypeAnnotations";
- public static final String RuntimeInvisibleTypeAnnotations = "RuntimeInvisibleTypeAnnotations";
- public static final String Signature = "Signature";
- public static final String SourceDebugExtension = "SourceDebugExtension";
- public static final String SourceFile = "SourceFile";
- public static final String SourceID = "SourceID";
- public static final String StackMap = "StackMap";
- public static final String StackMapTable = "StackMapTable";
- public static final String Synthetic = "Synthetic";
-
- public static class Factory {
- public Factory() {
- // defer init of standardAttributeClasses until after options set up
- }
-
- public Attribute createAttribute(ClassReader cr, int name_index, byte[] data)
- throws IOException {
- if (standardAttributes == null) {
- init();
- }
-
- ConstantPool cp = cr.getConstantPool();
- String reasonForDefaultAttr;
- try {
- String name = cp.getUTF8Value(name_index);
- Class<? extends Attribute> attrClass = standardAttributes.get(name);
- if (attrClass != null) {
- try {
- Class<?>[] constrArgTypes = {ClassReader.class, int.class, int.class};
- Constructor<? extends Attribute> constr = attrClass.getDeclaredConstructor(constrArgTypes);
- return constr.newInstance(cr, name_index, data.length);
- } catch (Throwable t) {
- reasonForDefaultAttr = t.toString();
- // fall through and use DefaultAttribute
- // t.printStackTrace();
- }
- } else {
- reasonForDefaultAttr = "unknown attribute";
- }
- } catch (ConstantPoolException e) {
- reasonForDefaultAttr = e.toString();
- // fall through and use DefaultAttribute
- }
- return new DefaultAttribute(cr, name_index, data, reasonForDefaultAttr);
- }
-
- protected void init() {
- standardAttributes = new HashMap<>();
- standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
- standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
- standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
- standardAttributes.put(Code, Code_attribute.class);
- standardAttributes.put(CompilationID, CompilationID_attribute.class);
- standardAttributes.put(ConstantValue, ConstantValue_attribute.class);
- standardAttributes.put(Deprecated, Deprecated_attribute.class);
- standardAttributes.put(EnclosingMethod, EnclosingMethod_attribute.class);
- standardAttributes.put(Exceptions, Exceptions_attribute.class);
- standardAttributes.put(InnerClasses, InnerClasses_attribute.class);
- standardAttributes.put(LineNumberTable, LineNumberTable_attribute.class);
- standardAttributes.put(LocalVariableTable, LocalVariableTable_attribute.class);
- standardAttributes.put(LocalVariableTypeTable, LocalVariableTypeTable_attribute.class);
- standardAttributes.put(MethodParameters, MethodParameters_attribute.class);
- standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class);
- standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
- standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
- standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
- standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
- standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
- standardAttributes.put(Signature, Signature_attribute.class);
- standardAttributes.put(SourceDebugExtension, SourceDebugExtension_attribute.class);
- standardAttributes.put(SourceFile, SourceFile_attribute.class);
- standardAttributes.put(SourceID, SourceID_attribute.class);
- standardAttributes.put(StackMap, StackMap_attribute.class);
- standardAttributes.put(StackMapTable, StackMapTable_attribute.class);
- standardAttributes.put(Synthetic, Synthetic_attribute.class);
- }
-
- private Map<String,Class<? extends Attribute>> standardAttributes;
- }
-
- public static Attribute read(ClassReader cr) throws IOException {
- return cr.readAttribute();
- }
-
- protected Attribute(int name_index, int length) {
- attribute_name_index = name_index;
- attribute_length = length;
- }
-
- public String getName(ConstantPool constant_pool) throws ConstantPoolException {
- return constant_pool.getUTF8Value(attribute_name_index);
- }
-
- public abstract <R,D> R accept(Attribute.Visitor<R,D> visitor, D data);
-
- public int byteLength() {
- return 6 + attribute_length;
- }
-
- public final int attribute_name_index;
- public final int attribute_length;
-
-
- public interface Visitor<R,P> {
- R visitBootstrapMethods(BootstrapMethods_attribute attr, P p);
- R visitDefault(DefaultAttribute attr, P p);
- R visitAnnotationDefault(AnnotationDefault_attribute attr, P p);
- R visitCharacterRangeTable(CharacterRangeTable_attribute attr, P p);
- R visitCode(Code_attribute attr, P p);
- R visitCompilationID(CompilationID_attribute attr, P p);
- R visitConstantValue(ConstantValue_attribute attr, P p);
- R visitDeprecated(Deprecated_attribute attr, P p);
- R visitEnclosingMethod(EnclosingMethod_attribute attr, P p);
- R visitExceptions(Exceptions_attribute attr, P p);
- R visitInnerClasses(InnerClasses_attribute attr, P p);
- R visitLineNumberTable(LineNumberTable_attribute attr, P p);
- R visitLocalVariableTable(LocalVariableTable_attribute attr, P p);
- R visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, P p);
- R visitMethodParameters(MethodParameters_attribute attr, P p);
- R visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, P p);
- R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p);
- R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p);
- R visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, P p);
- R visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, P p);
- R visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, P p);
- R visitSignature(Signature_attribute attr, P p);
- R visitSourceDebugExtension(SourceDebugExtension_attribute attr, P p);
- R visitSourceFile(SourceFile_attribute attr, P p);
- R visitSourceID(SourceID_attribute attr, P p);
- R visitStackMap(StackMap_attribute attr, P p);
- R visitStackMapTable(StackMapTable_attribute attr, P p);
- R visitSynthetic(Synthetic_attribute attr, P p);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/AttributeException.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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.
- */
-
-package com.sun.tools.classfile;
-
-/*
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class AttributeException extends Exception {
- private static final long serialVersionUID = -4231486387714867770L;
- AttributeException() { }
-
- AttributeException(String msg) {
- super(msg);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Attributes.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/*
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Attributes implements Iterable<Attribute> {
-
- public final Attribute[] attrs;
- public final Map<String, Attribute> map;
-
- Attributes(ClassReader cr) throws IOException {
- map = new HashMap<>();
- int attrs_count = cr.readUnsignedShort();
- attrs = new Attribute[attrs_count];
- for (int i = 0; i < attrs_count; i++) {
- Attribute attr = Attribute.read(cr);
- attrs[i] = attr;
- try {
- map.put(attr.getName(cr.getConstantPool()), attr);
- } catch (ConstantPoolException e) {
- // don't enter invalid names in map
- }
- }
- }
-
- public Attributes(ConstantPool constant_pool, Attribute[] attrs) {
- this.attrs = attrs;
- map = new HashMap<>();
- for (Attribute attr : attrs) {
- try {
- map.put(attr.getName(constant_pool), attr);
- } catch (ConstantPoolException e) {
- // don't enter invalid names in map
- }
- }
- }
-
- public Iterator<Attribute> iterator() {
- return Arrays.asList(attrs).iterator();
- }
-
- public Attribute get(int index) {
- return attrs[index];
- }
-
- public Attribute get(String name) {
- return map.get(name);
- }
-
- public int getIndex(ConstantPool constant_pool, String name) {
- for (int i = 0; i < attrs.length; i++) {
- Attribute attr = attrs[i];
- try {
- if (attr != null && attr.getName(constant_pool).equals(name))
- return i;
- } catch (ConstantPoolException e) {
- // ignore invalid entries
- }
- }
- return -1;
- }
-
- public int size() {
- return attrs.length;
- }
-
- public int byteLength() {
- int length = 2;
- for (Attribute a: attrs)
- length += a.byteLength();
- return length;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/BootstrapMethods_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS 4.7.21
- * http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.21
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class BootstrapMethods_attribute extends Attribute {
- public final BootstrapMethodSpecifier[] bootstrap_method_specifiers;
-
- BootstrapMethods_attribute(ClassReader cr, int name_index, int length)
- throws IOException, AttributeException {
- super(name_index, length);
- int bootstrap_method_count = cr.readUnsignedShort();
- bootstrap_method_specifiers = new BootstrapMethodSpecifier[bootstrap_method_count];
- for (int i = 0; i < bootstrap_method_specifiers.length; i++)
- bootstrap_method_specifiers[i] = new BootstrapMethodSpecifier(cr);
- }
-
- public BootstrapMethods_attribute(int name_index, BootstrapMethodSpecifier[] bootstrap_method_specifiers) {
- super(name_index, length(bootstrap_method_specifiers));
- this.bootstrap_method_specifiers = bootstrap_method_specifiers;
- }
-
- public static int length(BootstrapMethodSpecifier[] bootstrap_method_specifiers) {
- int n = 2;
- for (BootstrapMethodSpecifier b : bootstrap_method_specifiers)
- n += b.length();
- return n;
- }
-
- @Override
- public <R, P> R accept(Visitor<R, P> visitor, P p) {
- return visitor.visitBootstrapMethods(this, p);
- }
-
- public static class BootstrapMethodSpecifier {
- public int bootstrap_method_ref;
- public int[] bootstrap_arguments;
-
- public BootstrapMethodSpecifier(int bootstrap_method_ref, int[] bootstrap_arguments) {
- this.bootstrap_method_ref = bootstrap_method_ref;
- this.bootstrap_arguments = bootstrap_arguments;
- }
- BootstrapMethodSpecifier(ClassReader cr) throws IOException {
- bootstrap_method_ref = cr.readUnsignedShort();
- int method_count = cr.readUnsignedShort();
- bootstrap_arguments = new int[method_count];
- for (int i = 0; i < bootstrap_arguments.length; i++) {
- bootstrap_arguments[i] = cr.readUnsignedShort();
- }
- }
-
- int length() {
- // u2 (method_ref) + u2 (argc) + u2 * argc
- return 2 + 2 + (bootstrap_arguments.length * 2);
- }
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/CharacterRangeTable_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class CharacterRangeTable_attribute extends Attribute {
- public static final int CRT_STATEMENT = 0x0001;
- public static final int CRT_BLOCK = 0x0002;
- public static final int CRT_ASSIGNMENT = 0x0004;
- public static final int CRT_FLOW_CONTROLLER = 0x0008;
- public static final int CRT_FLOW_TARGET = 0x0010;
- public static final int CRT_INVOKE = 0x0020;
- public static final int CRT_CREATE = 0x0040;
- public static final int CRT_BRANCH_TRUE = 0x0080;
- public static final int CRT_BRANCH_FALSE = 0x0100;
-
- CharacterRangeTable_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- int character_range_table_length = cr.readUnsignedShort();
- character_range_table = new Entry[character_range_table_length];
- for (int i = 0; i < character_range_table_length; i++)
- character_range_table[i] = new Entry(cr);
- }
-
- public CharacterRangeTable_attribute(ConstantPool constant_pool, Entry[] character_range_table)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.CharacterRangeTable), character_range_table);
- }
-
- public CharacterRangeTable_attribute(int name_index, Entry[] character_range_table) {
- super(name_index, 2 + character_range_table.length * Entry.length());
- this.character_range_table = character_range_table;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitCharacterRangeTable(this, data);
- }
-
- public final Entry[] character_range_table;
-
- public static class Entry {
- Entry(ClassReader cr) throws IOException {
- start_pc = cr.readUnsignedShort();
- end_pc = cr.readUnsignedShort();
- character_range_start = cr.readInt();
- character_range_end = cr.readInt();
- flags = cr.readUnsignedShort();
- }
-
- public static int length() {
- return 14;
- }
-
- public final int start_pc;
- public final int end_pc;
- public final int character_range_start;
- public final int character_range_end;
- public final int flags;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/ClassFile.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-
-import static com.sun.tools.classfile.AccessFlags.*;
-
-/**
- * See JVMS, section 4.2.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ClassFile {
- public static ClassFile read(File file)
- throws IOException, ConstantPoolException {
- return read(file.toPath(), new Attribute.Factory());
- }
-
- public static ClassFile read(Path input)
- throws IOException, ConstantPoolException {
- return read(input, new Attribute.Factory());
- }
-
- public static ClassFile read(Path input, Attribute.Factory attributeFactory)
- throws IOException, ConstantPoolException {
- try (InputStream in = Files.newInputStream(input)) {
- return new ClassFile(in, attributeFactory);
- }
- }
-
- public static ClassFile read(File file, Attribute.Factory attributeFactory)
- throws IOException, ConstantPoolException {
- return read(file.toPath(), attributeFactory);
- }
-
- public static ClassFile read(InputStream in)
- throws IOException, ConstantPoolException {
- return new ClassFile(in, new Attribute.Factory());
- }
-
- public static ClassFile read(InputStream in, Attribute.Factory attributeFactory)
- throws IOException, ConstantPoolException {
- return new ClassFile(in, attributeFactory);
- }
-
- ClassFile(InputStream in, Attribute.Factory attributeFactory) throws IOException, ConstantPoolException {
- ClassReader cr = new ClassReader(this, in, attributeFactory);
- magic = cr.readInt();
- minor_version = cr.readUnsignedShort();
- major_version = cr.readUnsignedShort();
- constant_pool = new ConstantPool(cr);
- access_flags = new AccessFlags(cr);
- this_class = cr.readUnsignedShort();
- super_class = cr.readUnsignedShort();
-
- int interfaces_count = cr.readUnsignedShort();
- interfaces = new int[interfaces_count];
- for (int i = 0; i < interfaces_count; i++)
- interfaces[i] = cr.readUnsignedShort();
-
- int fields_count = cr.readUnsignedShort();
- fields = new Field[fields_count];
- for (int i = 0; i < fields_count; i++)
- fields[i] = new Field(cr);
-
- int methods_count = cr.readUnsignedShort();
- methods = new Method[methods_count];
- for (int i = 0; i < methods_count; i++)
- methods[i] = new Method(cr);
-
- attributes = new Attributes(cr);
- }
-
- public ClassFile(int magic, int minor_version, int major_version,
- ConstantPool constant_pool, AccessFlags access_flags,
- int this_class, int super_class, int[] interfaces,
- Field[] fields, Method[] methods, Attributes attributes) {
- this.magic = magic;
- this.minor_version = minor_version;
- this.major_version = major_version;
- this.constant_pool = constant_pool;
- this.access_flags = access_flags;
- this.this_class = this_class;
- this.super_class = super_class;
- this.interfaces = interfaces;
- this.fields = fields;
- this.methods = methods;
- this.attributes = attributes;
- }
-
- public String getName() throws ConstantPoolException {
- return constant_pool.getClassInfo(this_class).getName();
- }
-
- public String getSuperclassName() throws ConstantPoolException {
- return constant_pool.getClassInfo(super_class).getName();
- }
-
- public String getInterfaceName(int i) throws ConstantPoolException {
- return constant_pool.getClassInfo(interfaces[i]).getName();
- }
-
- public Attribute getAttribute(String name) {
- return attributes.get(name);
- }
-
- public boolean isClass() {
- return !isInterface();
- }
-
- public boolean isInterface() {
- return access_flags.is(ACC_INTERFACE);
- }
-
- public int byteLength() {
- return 4 + // magic
- 2 + // minor
- 2 + // major
- constant_pool.byteLength() +
- 2 + // access flags
- 2 + // this_class
- 2 + // super_class
- byteLength(interfaces) +
- byteLength(fields) +
- byteLength(methods) +
- attributes.byteLength();
- }
-
- private int byteLength(int[] indices) {
- return 2 + 2 * indices.length;
- }
-
- private int byteLength(Field[] fields) {
- int length = 2;
- for (Field f: fields)
- length += f.byteLength();
- return length;
- }
-
- private int byteLength(Method[] methods) {
- int length = 2;
- for (Method m: methods)
- length += m.byteLength();
- return length;
- }
-
- public final int magic;
- public final int minor_version;
- public final int major_version;
- public final ConstantPool constant_pool;
- public final AccessFlags access_flags;
- public final int this_class;
- public final int super_class;
- public final int[] interfaces;
- public final Field[] fields;
- public final Method[] methods;
- public final Attributes attributes;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/ClassReader.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Objects;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ClassReader {
- ClassReader(ClassFile classFile, InputStream in, Attribute.Factory attributeFactory) throws IOException {
- this.classFile = Objects.requireNonNull(classFile);
- this.attributeFactory = Objects.requireNonNull(attributeFactory);
- this.in = new DataInputStream(new BufferedInputStream(in));
- }
-
- ClassFile getClassFile() {
- return classFile;
- }
-
- ConstantPool getConstantPool() {
- return classFile.constant_pool;
- }
-
- public Attribute readAttribute() throws IOException {
- int name_index = readUnsignedShort();
- int length = readInt();
- byte[] data = new byte[length];
- readFully(data);
-
- DataInputStream prev = in;
- in = new DataInputStream(new ByteArrayInputStream(data));
- try {
- return attributeFactory.createAttribute(this, name_index, data);
- } finally {
- in = prev;
- }
- }
-
- public void readFully(byte[] b) throws IOException {
- in.readFully(b);
- }
-
- public int readUnsignedByte() throws IOException {
- return in.readUnsignedByte();
- }
-
- public int readUnsignedShort() throws IOException {
- return in.readUnsignedShort();
- }
-
- public int readInt() throws IOException {
- return in.readInt();
- }
-
- public long readLong() throws IOException {
- return in.readLong();
- }
-
- public float readFloat() throws IOException {
- return in.readFloat();
- }
-
- public double readDouble() throws IOException {
- return in.readDouble();
- }
-
- public String readUTF() throws IOException {
- return in.readUTF();
- }
-
- private DataInputStream in;
- private ClassFile classFile;
- private Attribute.Factory attributeFactory;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/ClassTranslator.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,410 +0,0 @@
-/*
- * Copyright (c) 2008, 2012, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.util.Map;
-
-import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_Double_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_Fieldref_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_Float_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_Integer_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_InterfaceMethodref_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_InvokeDynamic_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_Long_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodHandle_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodType_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_Methodref_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_NameAndType_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_String_info;
-import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info;
-import com.sun.tools.classfile.ConstantPool.CPInfo;
-
-/**
- * Rewrites a class file using a map of translations.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ClassTranslator
- implements ConstantPool.Visitor<ConstantPool.CPInfo,Map<Object,Object>> {
- /**
- * Create a new ClassFile from {@code cf}, such that for all entries
- * {@code k -\> v} in {@code translations},
- * each occurrence of {@code k} in {@code cf} will be replaced by {@code v}.
- * in
- * @param cf the class file to be processed
- * @param translations the set of translations to be applied
- * @return a copy of {@code} with the values in {@code translations} substituted
- */
- public ClassFile translate(ClassFile cf, Map<Object,Object> translations) {
- ClassFile cf2 = (ClassFile) translations.get(cf);
- if (cf2 == null) {
- ConstantPool constant_pool2 = translate(cf.constant_pool, translations);
- Field[] fields2 = translate(cf.fields, cf.constant_pool, translations);
- Method[] methods2 = translateMethods(cf.methods, cf.constant_pool, translations);
- Attributes attributes2 = translateAttributes(cf.attributes, cf.constant_pool,
- translations);
-
- if (constant_pool2 == cf.constant_pool &&
- fields2 == cf.fields &&
- methods2 == cf.methods &&
- attributes2 == cf.attributes)
- cf2 = cf;
- else
- cf2 = new ClassFile(
- cf.magic,
- cf.minor_version,
- cf.major_version,
- constant_pool2,
- cf.access_flags,
- cf.this_class,
- cf.super_class,
- cf.interfaces,
- fields2,
- methods2,
- attributes2);
- translations.put(cf, cf2);
- }
- return cf2;
- }
-
- ConstantPool translate(ConstantPool cp, Map<Object,Object> translations) {
- ConstantPool cp2 = (ConstantPool) translations.get(cp);
- if (cp2 == null) {
- ConstantPool.CPInfo[] pool2 = new ConstantPool.CPInfo[cp.size()];
- boolean eq = true;
- for (int i = 0; i < cp.size(); ) {
- ConstantPool.CPInfo cpInfo;
- try {
- cpInfo = cp.get(i);
- } catch (ConstantPool.InvalidIndex e) {
- throw new IllegalStateException(e);
- }
- ConstantPool.CPInfo cpInfo2 = translate(cpInfo, translations);
- eq &= (cpInfo == cpInfo2);
- pool2[i] = cpInfo2;
- if (cpInfo.getTag() != cpInfo2.getTag())
- throw new IllegalStateException();
- i += cpInfo.size();
- }
-
- if (eq)
- cp2 = cp;
- else
- cp2 = new ConstantPool(pool2);
-
- translations.put(cp, cp2);
- }
- return cp2;
- }
-
- ConstantPool.CPInfo translate(ConstantPool.CPInfo cpInfo, Map<Object,Object> translations) {
- ConstantPool.CPInfo cpInfo2 = (ConstantPool.CPInfo) translations.get(cpInfo);
- if (cpInfo2 == null) {
- cpInfo2 = cpInfo.accept(this, translations);
- translations.put(cpInfo, cpInfo2);
- }
- return cpInfo2;
- }
-
- Field[] translate(Field[] fields, ConstantPool constant_pool, Map<Object,Object> translations) {
- Field[] fields2 = (Field[]) translations.get(fields);
- if (fields2 == null) {
- fields2 = new Field[fields.length];
- for (int i = 0; i < fields.length; i++)
- fields2[i] = translate(fields[i], constant_pool, translations);
- if (equal(fields, fields2))
- fields2 = fields;
- translations.put(fields, fields2);
- }
- return fields2;
- }
-
- Field translate(Field field, ConstantPool constant_pool, Map<Object,Object> translations) {
- Field field2 = (Field) translations.get(field);
- if (field2 == null) {
- Attributes attributes2 = translateAttributes(field.attributes, constant_pool,
- translations);
-
- if (attributes2 == field.attributes)
- field2 = field;
- else
- field2 = new Field(
- field.access_flags,
- field.name_index,
- field.descriptor,
- attributes2);
- translations.put(field, field2);
- }
- return field2;
- }
-
- Method[] translateMethods(Method[] methods, ConstantPool constant_pool, Map<Object,Object> translations) {
- Method[] methods2 = (Method[]) translations.get(methods);
- if (methods2 == null) {
- methods2 = new Method[methods.length];
- for (int i = 0; i < methods.length; i++)
- methods2[i] = translate(methods[i], constant_pool, translations);
- if (equal(methods, methods2))
- methods2 = methods;
- translations.put(methods, methods2);
- }
- return methods2;
- }
-
- Method translate(Method method, ConstantPool constant_pool, Map<Object,Object> translations) {
- Method method2 = (Method) translations.get(method);
- if (method2 == null) {
- Attributes attributes2 = translateAttributes(method.attributes, constant_pool,
- translations);
-
- if (attributes2 == method.attributes)
- method2 = method;
- else
- method2 = new Method(
- method.access_flags,
- method.name_index,
- method.descriptor,
- attributes2);
- translations.put(method, method2);
- }
- return method2;
- }
-
- Attributes translateAttributes(Attributes attributes,
- ConstantPool constant_pool, Map<Object,Object> translations) {
- Attributes attributes2 = (Attributes) translations.get(attributes);
- if (attributes2 == null) {
- Attribute[] attrArray2 = new Attribute[attributes.size()];
- ConstantPool constant_pool2 = translate(constant_pool, translations);
- boolean attrsEqual = true;
- for (int i = 0; i < attributes.size(); i++) {
- Attribute attr = attributes.get(i);
- Attribute attr2 = translate(attr, translations);
- if (attr2 != attr)
- attrsEqual = false;
- attrArray2[i] = attr2;
- }
- if ((constant_pool2 == constant_pool) && attrsEqual)
- attributes2 = attributes;
- else
- attributes2 = new Attributes(constant_pool2, attrArray2);
- translations.put(attributes, attributes2);
- }
- return attributes2;
- }
-
- Attribute translate(Attribute attribute, Map<Object,Object> translations) {
- Attribute attribute2 = (Attribute) translations.get(attribute);
- if (attribute2 == null) {
- attribute2 = attribute; // don't support translation within attributes yet
- // (what about Code attribute)
- translations.put(attribute, attribute2);
- }
- return attribute2;
- }
-
- private static <T> boolean equal(T[] a1, T[] a2) {
- if (a1 == null || a2 == null)
- return (a1 == a2);
- if (a1.length != a2.length)
- return false;
- for (int i = 0; i < a1.length; i++) {
- if (a1[i] != a2[i])
- return false;
- }
- return true;
- }
-
- public CPInfo visitClass(CONSTANT_Class_info info, Map<Object, Object> translations) {
- CONSTANT_Class_info info2 = (CONSTANT_Class_info) translations.get(info);
- if (info2 == null) {
- ConstantPool cp2 = translate(info.cp, translations);
- if (cp2 == info.cp)
- info2 = info;
- else
- info2 = new CONSTANT_Class_info(cp2, info.name_index);
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitDouble(CONSTANT_Double_info info, Map<Object, Object> translations) {
- CONSTANT_Double_info info2 = (CONSTANT_Double_info) translations.get(info);
- if (info2 == null) {
- info2 = info;
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitFieldref(CONSTANT_Fieldref_info info, Map<Object, Object> translations) {
- CONSTANT_Fieldref_info info2 = (CONSTANT_Fieldref_info) translations.get(info);
- if (info2 == null) {
- ConstantPool cp2 = translate(info.cp, translations);
- if (cp2 == info.cp)
- info2 = info;
- else
- info2 = new CONSTANT_Fieldref_info(cp2, info.class_index, info.name_and_type_index);
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitFloat(CONSTANT_Float_info info, Map<Object, Object> translations) {
- CONSTANT_Float_info info2 = (CONSTANT_Float_info) translations.get(info);
- if (info2 == null) {
- info2 = info;
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitInteger(CONSTANT_Integer_info info, Map<Object, Object> translations) {
- CONSTANT_Integer_info info2 = (CONSTANT_Integer_info) translations.get(info);
- if (info2 == null) {
- info2 = info;
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Map<Object, Object> translations) {
- CONSTANT_InterfaceMethodref_info info2 = (CONSTANT_InterfaceMethodref_info) translations.get(info);
- if (info2 == null) {
- ConstantPool cp2 = translate(info.cp, translations);
- if (cp2 == info.cp)
- info2 = info;
- else
- info2 = new CONSTANT_InterfaceMethodref_info(cp2, info.class_index, info.name_and_type_index);
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Map<Object, Object> translations) {
- CONSTANT_InvokeDynamic_info info2 = (CONSTANT_InvokeDynamic_info) translations.get(info);
- if (info2 == null) {
- ConstantPool cp2 = translate(info.cp, translations);
- if (cp2 == info.cp) {
- info2 = info;
- } else {
- info2 = new CONSTANT_InvokeDynamic_info(cp2, info.bootstrap_method_attr_index, info.name_and_type_index);
- }
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitLong(CONSTANT_Long_info info, Map<Object, Object> translations) {
- CONSTANT_Long_info info2 = (CONSTANT_Long_info) translations.get(info);
- if (info2 == null) {
- info2 = info;
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitNameAndType(CONSTANT_NameAndType_info info, Map<Object, Object> translations) {
- CONSTANT_NameAndType_info info2 = (CONSTANT_NameAndType_info) translations.get(info);
- if (info2 == null) {
- ConstantPool cp2 = translate(info.cp, translations);
- if (cp2 == info.cp)
- info2 = info;
- else
- info2 = new CONSTANT_NameAndType_info(cp2, info.name_index, info.type_index);
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitMethodref(CONSTANT_Methodref_info info, Map<Object, Object> translations) {
- CONSTANT_Methodref_info info2 = (CONSTANT_Methodref_info) translations.get(info);
- if (info2 == null) {
- ConstantPool cp2 = translate(info.cp, translations);
- if (cp2 == info.cp)
- info2 = info;
- else
- info2 = new CONSTANT_Methodref_info(cp2, info.class_index, info.name_and_type_index);
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitMethodHandle(CONSTANT_MethodHandle_info info, Map<Object, Object> translations) {
- CONSTANT_MethodHandle_info info2 = (CONSTANT_MethodHandle_info) translations.get(info);
- if (info2 == null) {
- ConstantPool cp2 = translate(info.cp, translations);
- if (cp2 == info.cp) {
- info2 = info;
- } else {
- info2 = new CONSTANT_MethodHandle_info(cp2, info.reference_kind, info.reference_index);
- }
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitMethodType(CONSTANT_MethodType_info info, Map<Object, Object> translations) {
- CONSTANT_MethodType_info info2 = (CONSTANT_MethodType_info) translations.get(info);
- if (info2 == null) {
- ConstantPool cp2 = translate(info.cp, translations);
- if (cp2 == info.cp) {
- info2 = info;
- } else {
- info2 = new CONSTANT_MethodType_info(cp2, info.descriptor_index);
- }
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitString(CONSTANT_String_info info, Map<Object, Object> translations) {
- CONSTANT_String_info info2 = (CONSTANT_String_info) translations.get(info);
- if (info2 == null) {
- ConstantPool cp2 = translate(info.cp, translations);
- if (cp2 == info.cp)
- info2 = info;
- else
- info2 = new CONSTANT_String_info(cp2, info.string_index);
- translations.put(info, info2);
- }
- return info;
- }
-
- public CPInfo visitUtf8(CONSTANT_Utf8_info info, Map<Object, Object> translations) {
- CONSTANT_Utf8_info info2 = (CONSTANT_Utf8_info) translations.get(info);
- if (info2 == null) {
- info2 = info;
- translations.put(info, info2);
- }
- return info;
- }
-
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/ClassWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,808 +0,0 @@
-
-/*
- * Copyright (c) 2008, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import static com.sun.tools.classfile.Annotation.*;
-import static com.sun.tools.classfile.ConstantPool.*;
-import static com.sun.tools.classfile.StackMapTable_attribute.*;
-import static com.sun.tools.classfile.StackMapTable_attribute.verification_type_info.*;
-
-/**
- * Write a ClassFile data structure to a file or stream.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ClassWriter {
- public ClassWriter() {
- attributeWriter = new AttributeWriter();
- constantPoolWriter = new ConstantPoolWriter();
- out = new ClassOutputStream();
- }
-
- /**
- * Write a ClassFile data structure to a file.
- */
- public void write(ClassFile classFile, File f) throws IOException {
- try (FileOutputStream f_out = new FileOutputStream(f)) {
- write(classFile, f_out);
- }
- }
-
- /**
- * Write a ClassFile data structure to a stream.
- */
- public void write(ClassFile classFile, OutputStream s) throws IOException {
- this.classFile = classFile;
- out.reset();
- write();
- out.writeTo(s);
- }
-
- protected void write() throws IOException {
- writeHeader();
- writeConstantPool();
- writeAccessFlags(classFile.access_flags);
- writeClassInfo();
- writeFields();
- writeMethods();
- writeAttributes(classFile.attributes);
- }
-
- protected void writeHeader() {
- out.writeInt(classFile.magic);
- out.writeShort(classFile.minor_version);
- out.writeShort(classFile.major_version);
- }
-
- protected void writeAccessFlags(AccessFlags flags) {
- out.writeShort(flags.flags);
- }
-
- protected void writeAttributes(Attributes attributes) {
- int size = attributes.size();
- out.writeShort(size);
- for (Attribute attr: attributes)
- attributeWriter.write(attr, out);
- }
-
- protected void writeClassInfo() {
- out.writeShort(classFile.this_class);
- out.writeShort(classFile.super_class);
- int[] interfaces = classFile.interfaces;
- out.writeShort(interfaces.length);
- for (int i: interfaces)
- out.writeShort(i);
- }
-
- protected void writeDescriptor(Descriptor d) {
- out.writeShort(d.index);
- }
-
- protected void writeConstantPool() {
- ConstantPool pool = classFile.constant_pool;
- int size = pool.size();
- out.writeShort(size);
- for (CPInfo cpInfo: pool.entries())
- constantPoolWriter.write(cpInfo, out);
- }
-
- protected void writeFields() throws IOException {
- Field[] fields = classFile.fields;
- out.writeShort(fields.length);
- for (Field f: fields)
- writeField(f);
- }
-
- protected void writeField(Field f) throws IOException {
- writeAccessFlags(f.access_flags);
- out.writeShort(f.name_index);
- writeDescriptor(f.descriptor);
- writeAttributes(f.attributes);
- }
-
- protected void writeMethods() throws IOException {
- Method[] methods = classFile.methods;
- out.writeShort(methods.length);
- for (Method m: methods) {
- writeMethod(m);
- }
- }
-
- protected void writeMethod(Method m) throws IOException {
- writeAccessFlags(m.access_flags);
- out.writeShort(m.name_index);
- writeDescriptor(m.descriptor);
- writeAttributes(m.attributes);
- }
-
- protected ClassFile classFile;
- protected ClassOutputStream out;
- protected AttributeWriter attributeWriter;
- protected ConstantPoolWriter constantPoolWriter;
-
- /**
- * Subtype of ByteArrayOutputStream with the convenience methods of
- * a DataOutputStream. Since ByteArrayOutputStream does not throw
- * IOException, there are no exceptions from the additional
- * convenience methods either,
- */
- protected static class ClassOutputStream extends ByteArrayOutputStream {
- public ClassOutputStream() {
- d = new DataOutputStream(this);
- }
-
- public void writeByte(int value) {
- try {
- d.writeByte(value);
- } catch (IOException ignore) {
- }
- }
-
- public void writeShort(int value) {
- try {
- d.writeShort(value);
- } catch (IOException ignore) {
- }
- }
-
- public void writeInt(int value) {
- try {
- d.writeInt(value);
- } catch (IOException ignore) {
- }
- }
-
- public void writeLong(long value) {
- try {
- d.writeLong(value);
- } catch (IOException ignore) {
- }
- }
-
- public void writeFloat(float value) {
- try {
- d.writeFloat(value);
- } catch (IOException ignore) {
- }
- }
-
- public void writeDouble(double value) {
- try {
- d.writeDouble(value);
- } catch (IOException ignore) {
- }
- }
-
- public void writeUTF(String value) {
- try {
- d.writeUTF(value);
- } catch (IOException ignore) {
- }
- }
-
- public void writeTo(ClassOutputStream s) {
- try {
- super.writeTo(s);
- } catch (IOException ignore) {
- }
- }
-
- private DataOutputStream d;
- }
-
- /**
- * Writer for the entries in the constant pool.
- */
- protected static class ConstantPoolWriter
- implements ConstantPool.Visitor<Integer,ClassOutputStream> {
- protected int write(CPInfo info, ClassOutputStream out) {
- out.writeByte(info.getTag());
- return info.accept(this, out);
- }
-
- public Integer visitClass(CONSTANT_Class_info info, ClassOutputStream out) {
- out.writeShort(info.name_index);
- return 1;
- }
-
- public Integer visitDouble(CONSTANT_Double_info info, ClassOutputStream out) {
- out.writeDouble(info.value);
- return 2;
- }
-
- public Integer visitFieldref(CONSTANT_Fieldref_info info, ClassOutputStream out) {
- writeRef(info, out);
- return 1;
- }
-
- public Integer visitFloat(CONSTANT_Float_info info, ClassOutputStream out) {
- out.writeFloat(info.value);
- return 1;
- }
-
- public Integer visitInteger(CONSTANT_Integer_info info, ClassOutputStream out) {
- out.writeInt(info.value);
- return 1;
- }
-
- public Integer visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, ClassOutputStream out) {
- writeRef(info, out);
- return 1;
- }
-
- public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, ClassOutputStream out) {
- out.writeShort(info.bootstrap_method_attr_index);
- out.writeShort(info.name_and_type_index);
- return 1;
- }
-
- public Integer visitLong(CONSTANT_Long_info info, ClassOutputStream out) {
- out.writeLong(info.value);
- return 2;
- }
-
- public Integer visitNameAndType(CONSTANT_NameAndType_info info, ClassOutputStream out) {
- out.writeShort(info.name_index);
- out.writeShort(info.type_index);
- return 1;
- }
-
- public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, ClassOutputStream out) {
- out.writeByte(info.reference_kind.tag);
- out.writeShort(info.reference_index);
- return 1;
- }
-
- public Integer visitMethodType(CONSTANT_MethodType_info info, ClassOutputStream out) {
- out.writeShort(info.descriptor_index);
- return 1;
- }
-
- public Integer visitMethodref(CONSTANT_Methodref_info info, ClassOutputStream out) {
- return writeRef(info, out);
- }
-
- public Integer visitString(CONSTANT_String_info info, ClassOutputStream out) {
- out.writeShort(info.string_index);
- return 1;
- }
-
- public Integer visitUtf8(CONSTANT_Utf8_info info, ClassOutputStream out) {
- out.writeUTF(info.value);
- return 1;
- }
-
- protected Integer writeRef(CPRefInfo info, ClassOutputStream out) {
- out.writeShort(info.class_index);
- out.writeShort(info.name_and_type_index);
- return 1;
- }
- }
-
- /**
- * Writer for the different types of attribute.
- */
- protected static class AttributeWriter implements Attribute.Visitor<Void,ClassOutputStream> {
- public void write(Attributes attributes, ClassOutputStream out) {
- int size = attributes.size();
- out.writeShort(size);
- for (Attribute a: attributes)
- write(a, out);
- }
-
- // Note: due to the use of shared resources, this method is not reentrant.
- public void write(Attribute attr, ClassOutputStream out) {
- out.writeShort(attr.attribute_name_index);
- sharedOut.reset();
- attr.accept(this, sharedOut);
- out.writeInt(sharedOut.size());
- sharedOut.writeTo(out);
- }
-
- protected ClassOutputStream sharedOut = new ClassOutputStream();
- protected AnnotationWriter annotationWriter = new AnnotationWriter();
-
- public Void visitDefault(DefaultAttribute attr, ClassOutputStream out) {
- out.write(attr.info, 0, attr.info.length);
- return null;
- }
-
- public Void visitAnnotationDefault(AnnotationDefault_attribute attr, ClassOutputStream out) {
- annotationWriter.write(attr.default_value, out);
- return null;
- }
-
- public Void visitBootstrapMethods(BootstrapMethods_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.bootstrap_method_specifiers.length);
- for (BootstrapMethods_attribute.BootstrapMethodSpecifier bsm : attr.bootstrap_method_specifiers) {
- out.writeShort(bsm.bootstrap_method_ref);
- int bsm_args_count = bsm.bootstrap_arguments.length;
- out.writeShort(bsm_args_count);
- for (int i : bsm.bootstrap_arguments) {
- out.writeShort(i);
- }
- }
- return null;
- }
-
- public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.character_range_table.length);
- for (CharacterRangeTable_attribute.Entry e: attr.character_range_table)
- writeCharacterRangeTableEntry(e, out);
- return null;
- }
-
- protected void writeCharacterRangeTableEntry(CharacterRangeTable_attribute.Entry entry, ClassOutputStream out) {
- out.writeShort(entry.start_pc);
- out.writeShort(entry.end_pc);
- out.writeInt(entry.character_range_start);
- out.writeInt(entry.character_range_end);
- out.writeShort(entry.flags);
- }
-
- public Void visitCode(Code_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.max_stack);
- out.writeShort(attr.max_locals);
- out.writeInt(attr.code.length);
- out.write(attr.code, 0, attr.code.length);
- out.writeShort(attr.exception_table.length);
- for (Code_attribute.Exception_data e: attr.exception_table)
- writeExceptionTableEntry(e, out);
- new AttributeWriter().write(attr.attributes, out);
- return null;
- }
-
- protected void writeExceptionTableEntry(Code_attribute.Exception_data exception_data, ClassOutputStream out) {
- out.writeShort(exception_data.start_pc);
- out.writeShort(exception_data.end_pc);
- out.writeShort(exception_data.handler_pc);
- out.writeShort(exception_data.catch_type);
- }
-
- public Void visitCompilationID(CompilationID_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.compilationID_index);
- return null;
- }
-
- public Void visitConstantValue(ConstantValue_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.constantvalue_index);
- return null;
- }
-
- public Void visitDeprecated(Deprecated_attribute attr, ClassOutputStream out) {
- return null;
- }
-
- public Void visitEnclosingMethod(EnclosingMethod_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.class_index);
- out.writeShort(attr.method_index);
- return null;
- }
-
- public Void visitExceptions(Exceptions_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.exception_index_table.length);
- for (int i: attr.exception_index_table)
- out.writeShort(i);
- return null;
- }
-
- public Void visitInnerClasses(InnerClasses_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.classes.length);
- for (InnerClasses_attribute.Info info: attr.classes)
- writeInnerClassesInfo(info, out);
- return null;
- }
-
- protected void writeInnerClassesInfo(InnerClasses_attribute.Info info, ClassOutputStream out) {
- out.writeShort(info.inner_class_info_index);
- out.writeShort(info.outer_class_info_index);
- out.writeShort(info.inner_name_index);
- writeAccessFlags(info.inner_class_access_flags, out);
- }
-
- public Void visitLineNumberTable(LineNumberTable_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.line_number_table.length);
- for (LineNumberTable_attribute.Entry e: attr.line_number_table)
- writeLineNumberTableEntry(e, out);
- return null;
- }
-
- protected void writeLineNumberTableEntry(LineNumberTable_attribute.Entry entry, ClassOutputStream out) {
- out.writeShort(entry.start_pc);
- out.writeShort(entry.line_number);
- }
-
- public Void visitLocalVariableTable(LocalVariableTable_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.local_variable_table.length);
- for (LocalVariableTable_attribute.Entry e: attr.local_variable_table)
- writeLocalVariableTableEntry(e, out);
- return null;
- }
-
- protected void writeLocalVariableTableEntry(LocalVariableTable_attribute.Entry entry, ClassOutputStream out) {
- out.writeShort(entry.start_pc);
- out.writeShort(entry.length);
- out.writeShort(entry.name_index);
- out.writeShort(entry.descriptor_index);
- out.writeShort(entry.index);
- }
-
- public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.local_variable_table.length);
- for (LocalVariableTypeTable_attribute.Entry e: attr.local_variable_table)
- writeLocalVariableTypeTableEntry(e, out);
- return null;
- }
-
- protected void writeLocalVariableTypeTableEntry(LocalVariableTypeTable_attribute.Entry entry, ClassOutputStream out) {
- out.writeShort(entry.start_pc);
- out.writeShort(entry.length);
- out.writeShort(entry.name_index);
- out.writeShort(entry.signature_index);
- out.writeShort(entry.index);
- }
-
- public Void visitMethodParameters(MethodParameters_attribute attr, ClassOutputStream out) {
- out.writeByte(attr.method_parameter_table.length);
- for (MethodParameters_attribute.Entry e : attr.method_parameter_table) {
- out.writeShort(e.name_index);
- out.writeShort(e.flags);
- }
- return null;
- }
-
- public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, ClassOutputStream out) {
- annotationWriter.write(attr.annotations, out);
- return null;
- }
-
- public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, ClassOutputStream out) {
- annotationWriter.write(attr.annotations, out);
- return null;
- }
-
- public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
- annotationWriter.write(attr.annotations, out);
- return null;
- }
-
- public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
- annotationWriter.write(attr.annotations, out);
- return null;
- }
-
- public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
- out.writeByte(attr.parameter_annotations.length);
- for (Annotation[] annos: attr.parameter_annotations)
- annotationWriter.write(annos, out);
- return null;
- }
-
- public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
- out.writeByte(attr.parameter_annotations.length);
- for (Annotation[] annos: attr.parameter_annotations)
- annotationWriter.write(annos, out);
- return null;
- }
-
- public Void visitSignature(Signature_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.signature_index);
- return null;
- }
-
- public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr, ClassOutputStream out) {
- out.write(attr.debug_extension, 0, attr.debug_extension.length);
- return null;
- }
-
- public Void visitSourceFile(SourceFile_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.sourcefile_index);
- return null;
- }
-
- public Void visitSourceID(SourceID_attribute attr, ClassOutputStream out) {
- out.writeShort(attr.sourceID_index);
- return null;
- }
-
- public Void visitStackMap(StackMap_attribute attr, ClassOutputStream out) {
- if (stackMapWriter == null)
- stackMapWriter = new StackMapTableWriter();
-
- out.writeShort(attr.entries.length);
- for (stack_map_frame f: attr.entries)
- stackMapWriter.write(f, out);
- return null;
- }
-
- public Void visitStackMapTable(StackMapTable_attribute attr, ClassOutputStream out) {
- if (stackMapWriter == null)
- stackMapWriter = new StackMapTableWriter();
-
- out.writeShort(attr.entries.length);
- for (stack_map_frame f: attr.entries)
- stackMapWriter.write(f, out);
- return null;
- }
-
- public Void visitSynthetic(Synthetic_attribute attr, ClassOutputStream out) {
- return null;
- }
-
- protected void writeAccessFlags(AccessFlags flags, ClassOutputStream p) {
- sharedOut.writeShort(flags.flags);
- }
-
- protected StackMapTableWriter stackMapWriter;
- }
-
- /**
- * Writer for the frames of StackMap and StackMapTable attributes.
- */
- protected static class StackMapTableWriter
- implements stack_map_frame.Visitor<Void,ClassOutputStream> {
-
- public void write(stack_map_frame frame, ClassOutputStream out) {
- out.write(frame.frame_type);
- frame.accept(this, out);
- }
-
- public Void visit_same_frame(same_frame frame, ClassOutputStream p) {
- return null;
- }
-
- public Void visit_same_locals_1_stack_item_frame(same_locals_1_stack_item_frame frame, ClassOutputStream out) {
- writeVerificationTypeInfo(frame.stack[0], out);
- return null;
- }
-
- public Void visit_same_locals_1_stack_item_frame_extended(same_locals_1_stack_item_frame_extended frame, ClassOutputStream out) {
- out.writeShort(frame.offset_delta);
- writeVerificationTypeInfo(frame.stack[0], out);
- return null;
- }
-
- public Void visit_chop_frame(chop_frame frame, ClassOutputStream out) {
- out.writeShort(frame.offset_delta);
- return null;
- }
-
- public Void visit_same_frame_extended(same_frame_extended frame, ClassOutputStream out) {
- out.writeShort(frame.offset_delta);
- return null;
- }
-
- public Void visit_append_frame(append_frame frame, ClassOutputStream out) {
- out.writeShort(frame.offset_delta);
- for (verification_type_info l: frame.locals)
- writeVerificationTypeInfo(l, out);
- return null;
- }
-
- public Void visit_full_frame(full_frame frame, ClassOutputStream out) {
- out.writeShort(frame.offset_delta);
- out.writeShort(frame.locals.length);
- for (verification_type_info l: frame.locals)
- writeVerificationTypeInfo(l, out);
- out.writeShort(frame.stack.length);
- for (verification_type_info s: frame.stack)
- writeVerificationTypeInfo(s, out);
- return null;
- }
-
- protected void writeVerificationTypeInfo(verification_type_info info,
- ClassOutputStream out) {
- out.write(info.tag);
- switch (info.tag) {
- case ITEM_Top:
- case ITEM_Integer:
- case ITEM_Float:
- case ITEM_Long:
- case ITEM_Double:
- case ITEM_Null:
- case ITEM_UninitializedThis:
- break;
-
- case ITEM_Object:
- Object_variable_info o = (Object_variable_info) info;
- out.writeShort(o.cpool_index);
- break;
-
- case ITEM_Uninitialized:
- Uninitialized_variable_info u = (Uninitialized_variable_info) info;
- out.writeShort(u.offset);
- break;
-
- default:
- throw new Error();
- }
- }
- }
-
- /**
- * Writer for annotations and the values they contain.
- */
- protected static class AnnotationWriter
- implements Annotation.element_value.Visitor<Void,ClassOutputStream> {
- public void write(Annotation[] annos, ClassOutputStream out) {
- out.writeShort(annos.length);
- for (Annotation anno: annos)
- write(anno, out);
- }
-
- public void write(TypeAnnotation[] annos, ClassOutputStream out) {
- out.writeShort(annos.length);
- for (TypeAnnotation anno: annos)
- write(anno, out);
- }
-
- public void write(Annotation anno, ClassOutputStream out) {
- out.writeShort(anno.type_index);
- out.writeShort(anno.element_value_pairs.length);
- for (element_value_pair p: anno.element_value_pairs)
- write(p, out);
- }
-
- public void write(TypeAnnotation anno, ClassOutputStream out) {
- write(anno.position, out);
- write(anno.annotation, out);
- }
-
- public void write(element_value_pair pair, ClassOutputStream out) {
- out.writeShort(pair.element_name_index);
- write(pair.value, out);
- }
-
- public void write(element_value ev, ClassOutputStream out) {
- out.writeByte(ev.tag);
- ev.accept(this, out);
- }
-
- public Void visitPrimitive(Primitive_element_value ev, ClassOutputStream out) {
- out.writeShort(ev.const_value_index);
- return null;
- }
-
- public Void visitEnum(Enum_element_value ev, ClassOutputStream out) {
- out.writeShort(ev.type_name_index);
- out.writeShort(ev.const_name_index);
- return null;
- }
-
- public Void visitClass(Class_element_value ev, ClassOutputStream out) {
- out.writeShort(ev.class_info_index);
- return null;
- }
-
- public Void visitAnnotation(Annotation_element_value ev, ClassOutputStream out) {
- write(ev.annotation_value, out);
- return null;
- }
-
- public Void visitArray(Array_element_value ev, ClassOutputStream out) {
- out.writeShort(ev.num_values);
- for (element_value v: ev.values)
- write(v, out);
- return null;
- }
-
- // TODO: Move this to TypeAnnotation to be closer with similar logic?
- private void write(TypeAnnotation.Position p, ClassOutputStream out) {
- out.writeByte(p.type.targetTypeValue());
- switch (p.type) {
- // instanceof
- case INSTANCEOF:
- // new expression
- case NEW:
- // constructor/method reference receiver
- case CONSTRUCTOR_REFERENCE:
- case METHOD_REFERENCE:
- out.writeShort(p.offset);
- break;
- // local variable
- case LOCAL_VARIABLE:
- // resource variable
- case RESOURCE_VARIABLE:
- int table_length = p.lvarOffset.length;
- out.writeShort(table_length);
- for (int i = 0; i < table_length; ++i) {
- out.writeShort(1); // for table length
- out.writeShort(p.lvarOffset[i]);
- out.writeShort(p.lvarLength[i]);
- out.writeShort(p.lvarIndex[i]);
- }
- break;
- // exception parameter
- case EXCEPTION_PARAMETER:
- out.writeShort(p.exception_index);
- break;
- // method receiver
- case METHOD_RECEIVER:
- // Do nothing
- break;
- // type parameters
- case CLASS_TYPE_PARAMETER:
- case METHOD_TYPE_PARAMETER:
- out.writeByte(p.parameter_index);
- break;
- // type parameters bounds
- case CLASS_TYPE_PARAMETER_BOUND:
- case METHOD_TYPE_PARAMETER_BOUND:
- out.writeByte(p.parameter_index);
- out.writeByte(p.bound_index);
- break;
- // class extends or implements clause
- case CLASS_EXTENDS:
- out.writeShort(p.type_index);
- break;
- // throws
- case THROWS:
- out.writeShort(p.type_index);
- break;
- // method parameter
- case METHOD_FORMAL_PARAMETER:
- out.writeByte(p.parameter_index);
- break;
- // type cast
- case CAST:
- // method/constructor/reference type argument
- case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
- case METHOD_INVOCATION_TYPE_ARGUMENT:
- case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
- case METHOD_REFERENCE_TYPE_ARGUMENT:
- out.writeShort(p.offset);
- out.writeByte(p.type_index);
- break;
- // We don't need to worry about these
- case METHOD_RETURN:
- case FIELD:
- break;
- case UNKNOWN:
- throw new AssertionError("ClassWriter: UNKNOWN target type should never occur!");
- default:
- throw new AssertionError("ClassWriter: Unknown target type for position: " + p);
- }
-
- { // Append location data for generics/arrays.
- // TODO: check for overrun?
- out.writeByte((byte)p.location.size());
- for (int i : TypeAnnotation.Position.getBinaryFromTypePath(p.location))
- out.writeByte((byte)i);
- }
- }
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Code_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * See JVMS, section 4.8.3.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Code_attribute extends Attribute {
- public static class InvalidIndex extends AttributeException {
- private static final long serialVersionUID = -8904527774589382802L;
- InvalidIndex(int index) {
- this.index = index;
- }
-
- @Override
- public String getMessage() {
- // i18n
- return "invalid index " + index + " in Code attribute";
- }
-
- public final int index;
- }
-
- Code_attribute(ClassReader cr, int name_index, int length)
- throws IOException, ConstantPoolException {
- super(name_index, length);
- max_stack = cr.readUnsignedShort();
- max_locals = cr.readUnsignedShort();
- code_length = cr.readInt();
- code = new byte[code_length];
- cr.readFully(code);
- exception_table_length = cr.readUnsignedShort();
- exception_table = new Exception_data[exception_table_length];
- for (int i = 0; i < exception_table_length; i++)
- exception_table[i] = new Exception_data(cr);
- attributes = new Attributes(cr);
- }
-
- public int getByte(int offset) throws InvalidIndex {
- if (offset < 0 || offset >= code.length)
- throw new InvalidIndex(offset);
- return code[offset];
- }
-
- public int getUnsignedByte(int offset) throws InvalidIndex {
- if (offset < 0 || offset >= code.length)
- throw new InvalidIndex(offset);
- return code[offset] & 0xff;
- }
-
- public int getShort(int offset) throws InvalidIndex {
- if (offset < 0 || offset + 1 >= code.length)
- throw new InvalidIndex(offset);
- return (code[offset] << 8) | (code[offset + 1] & 0xFF);
- }
-
- public int getUnsignedShort(int offset) throws InvalidIndex {
- if (offset < 0 || offset + 1 >= code.length)
- throw new InvalidIndex(offset);
- return ((code[offset] << 8) | (code[offset + 1] & 0xFF)) & 0xFFFF;
- }
-
- public int getInt(int offset) throws InvalidIndex {
- if (offset < 0 || offset + 3 >= code.length)
- throw new InvalidIndex(offset);
- return (getShort(offset) << 16) | (getShort(offset + 2) & 0xFFFF);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitCode(this, data);
- }
-
- public Iterable<Instruction> getInstructions() {
- return new Iterable<Instruction>() {
- public Iterator<Instruction> iterator() {
- return new Iterator<Instruction>() {
-
- public boolean hasNext() {
- return (next != null);
- }
-
- public Instruction next() {
- if (next == null)
- throw new NoSuchElementException();
-
- current = next;
- pc += current.length();
- next = (pc < code.length ? new Instruction(code, pc) : null);
- return current;
- }
-
- public void remove() {
- throw new UnsupportedOperationException("Not supported.");
- }
-
- Instruction current = null;
- int pc = 0;
- Instruction next = new Instruction(code, pc);
-
- };
- }
-
- };
- }
-
- public final int max_stack;
- public final int max_locals;
- public final int code_length;
- public final byte[] code;
- public final int exception_table_length;
- public final Exception_data[] exception_table;
- public final Attributes attributes;
-
- public static class Exception_data {
- Exception_data(ClassReader cr) throws IOException {
- start_pc = cr.readUnsignedShort();
- end_pc = cr.readUnsignedShort();
- handler_pc = cr.readUnsignedShort();
- catch_type = cr.readUnsignedShort();
- }
-
- public final int start_pc;
- public final int end_pc;
- public final int handler_pc;
- public final int catch_type;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/CompilationID_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class CompilationID_attribute extends Attribute {
-
- CompilationID_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- compilationID_index = cr.readUnsignedShort();
- }
-
- public CompilationID_attribute(ConstantPool constant_pool, int compilationID_index)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.CompilationID), compilationID_index);
- }
-
- public CompilationID_attribute(int name_index, int compilationID_index) {
- super(name_index, 2);
- this.compilationID_index = compilationID_index;
- }
-
- String getCompilationID(ConstantPool constant_pool)
- throws ConstantPoolException {
- return constant_pool.getUTF8Value(compilationID_index);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitCompilationID(this, data);
- }
-
- public final int compilationID_index;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/ConstantPool.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,914 +0,0 @@
-/*
- * Copyright (c) 2007, 2011, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Iterator;
-
-/**
- * See JVMS, section 4.5.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ConstantPool {
-
- public static class InvalidIndex extends ConstantPoolException {
- private static final long serialVersionUID = -4350294289300939730L;
- InvalidIndex(int index) {
- super(index);
- }
-
- @Override
- public String getMessage() {
- // i18n
- return "invalid index #" + index;
- }
- }
-
- public static class UnexpectedEntry extends ConstantPoolException {
- private static final long serialVersionUID = 6986335935377933211L;
- UnexpectedEntry(int index, int expected_tag, int found_tag) {
- super(index);
- this.expected_tag = expected_tag;
- this.found_tag = found_tag;
- }
-
- @Override
- public String getMessage() {
- // i18n?
- return "unexpected entry at #" + index + " -- expected tag " + expected_tag + ", found " + found_tag;
- }
-
- public final int expected_tag;
- public final int found_tag;
- }
-
- public static class InvalidEntry extends ConstantPoolException {
- private static final long serialVersionUID = 1000087545585204447L;
- InvalidEntry(int index, int tag) {
- super(index);
- this.tag = tag;
- }
-
- @Override
- public String getMessage() {
- // i18n?
- return "unexpected tag at #" + index + ": " + tag;
- }
-
- public final int tag;
- }
-
- public static class EntryNotFound extends ConstantPoolException {
- private static final long serialVersionUID = 2885537606468581850L;
- EntryNotFound(Object value) {
- super(-1);
- this.value = value;
- }
-
- @Override
- public String getMessage() {
- // i18n?
- return "value not found: " + value;
- }
-
- public final Object value;
- }
-
- public static final int CONSTANT_Utf8 = 1;
- public static final int CONSTANT_Integer = 3;
- public static final int CONSTANT_Float = 4;
- public static final int CONSTANT_Long = 5;
- public static final int CONSTANT_Double = 6;
- public static final int CONSTANT_Class = 7;
- public static final int CONSTANT_String = 8;
- public static final int CONSTANT_Fieldref = 9;
- public static final int CONSTANT_Methodref = 10;
- public static final int CONSTANT_InterfaceMethodref = 11;
- public static final int CONSTANT_NameAndType = 12;
- public static final int CONSTANT_MethodHandle = 15;
- public static final int CONSTANT_MethodType = 16;
- public static final int CONSTANT_InvokeDynamic = 18;
-
- public static enum RefKind {
- REF_getField(1, "getfield"),
- REF_getStatic(2, "getstatic"),
- REF_putField(3, "putfield"),
- REF_putStatic(4, "putstatic"),
- REF_invokeVirtual(5, "invokevirtual"),
- REF_invokeStatic(6, "invokestatic"),
- REF_invokeSpecial(7, "invokespecial"),
- REF_newInvokeSpecial(8, "newinvokespecial"),
- REF_invokeInterface(9, "invokeinterface");
-
- public final int tag;
- public final String name;
-
- RefKind(int tag, String name) {
- this.tag = tag;
- this.name = name;
- }
-
- static RefKind getRefkind(int tag) {
- switch(tag) {
- case 1:
- return REF_getField;
- case 2:
- return REF_getStatic;
- case 3:
- return REF_putField;
- case 4:
- return REF_putStatic;
- case 5:
- return REF_invokeVirtual;
- case 6:
- return REF_invokeStatic;
- case 7:
- return REF_invokeSpecial;
- case 8:
- return REF_newInvokeSpecial;
- case 9:
- return REF_invokeInterface;
- default:
- return null;
- }
- }
- }
-
- ConstantPool(ClassReader cr) throws IOException, InvalidEntry {
- int count = cr.readUnsignedShort();
- pool = new CPInfo[count];
- for (int i = 1; i < count; i++) {
- int tag = cr.readUnsignedByte();
- switch (tag) {
- case CONSTANT_Class:
- pool[i] = new CONSTANT_Class_info(this, cr);
- break;
-
- case CONSTANT_Double:
- pool[i] = new CONSTANT_Double_info(cr);
- i++;
- break;
-
- case CONSTANT_Fieldref:
- pool[i] = new CONSTANT_Fieldref_info(this, cr);
- break;
-
- case CONSTANT_Float:
- pool[i] = new CONSTANT_Float_info(cr);
- break;
-
- case CONSTANT_Integer:
- pool[i] = new CONSTANT_Integer_info(cr);
- break;
-
- case CONSTANT_InterfaceMethodref:
- pool[i] = new CONSTANT_InterfaceMethodref_info(this, cr);
- break;
-
- case CONSTANT_InvokeDynamic:
- pool[i] = new CONSTANT_InvokeDynamic_info(this, cr);
- break;
-
- case CONSTANT_Long:
- pool[i] = new CONSTANT_Long_info(cr);
- i++;
- break;
-
- case CONSTANT_MethodHandle:
- pool[i] = new CONSTANT_MethodHandle_info(this, cr);
- break;
-
- case CONSTANT_MethodType:
- pool[i] = new CONSTANT_MethodType_info(this, cr);
- break;
-
- case CONSTANT_Methodref:
- pool[i] = new CONSTANT_Methodref_info(this, cr);
- break;
-
- case CONSTANT_NameAndType:
- pool[i] = new CONSTANT_NameAndType_info(this, cr);
- break;
-
- case CONSTANT_String:
- pool[i] = new CONSTANT_String_info(this, cr);
- break;
-
- case CONSTANT_Utf8:
- pool[i] = new CONSTANT_Utf8_info(cr);
- break;
-
- default:
- throw new InvalidEntry(i, tag);
- }
- }
- }
-
- public ConstantPool(CPInfo[] pool) {
- this.pool = pool;
- }
-
- public int size() {
- return pool.length;
- }
-
- public int byteLength() {
- int length = 2;
- for (int i = 1; i < size(); ) {
- CPInfo cpInfo = pool[i];
- length += cpInfo.byteLength();
- i += cpInfo.size();
- }
- return length;
- }
-
- public CPInfo get(int index) throws InvalidIndex {
- if (index <= 0 || index >= pool.length)
- throw new InvalidIndex(index);
- CPInfo info = pool[index];
- if (info == null) {
- // this occurs for indices referencing the "second half" of an
- // 8 byte constant, such as CONSTANT_Double or CONSTANT_Long
- throw new InvalidIndex(index);
- }
- return pool[index];
- }
-
- private CPInfo get(int index, int expected_type) throws InvalidIndex, UnexpectedEntry {
- CPInfo info = get(index);
- if (info.getTag() != expected_type)
- throw new UnexpectedEntry(index, expected_type, info.getTag());
- return info;
- }
-
- public CONSTANT_Utf8_info getUTF8Info(int index) throws InvalidIndex, UnexpectedEntry {
- return ((CONSTANT_Utf8_info) get(index, CONSTANT_Utf8));
- }
-
- public CONSTANT_Class_info getClassInfo(int index) throws InvalidIndex, UnexpectedEntry {
- return ((CONSTANT_Class_info) get(index, CONSTANT_Class));
- }
-
- public CONSTANT_NameAndType_info getNameAndTypeInfo(int index) throws InvalidIndex, UnexpectedEntry {
- return ((CONSTANT_NameAndType_info) get(index, CONSTANT_NameAndType));
- }
-
- public String getUTF8Value(int index) throws InvalidIndex, UnexpectedEntry {
- return getUTF8Info(index).value;
- }
-
- public int getUTF8Index(String value) throws EntryNotFound {
- for (int i = 1; i < pool.length; i++) {
- CPInfo info = pool[i];
- if (info instanceof CONSTANT_Utf8_info &&
- ((CONSTANT_Utf8_info) info).value.equals(value))
- return i;
- }
- throw new EntryNotFound(value);
- }
-
- public Iterable<CPInfo> entries() {
- return new Iterable<CPInfo>() {
- public Iterator<CPInfo> iterator() {
- return new Iterator<CPInfo>() {
-
- public boolean hasNext() {
- return next < pool.length;
- }
-
- public CPInfo next() {
- current = pool[next];
- switch (current.getTag()) {
- case CONSTANT_Double:
- case CONSTANT_Long:
- next += 2;
- break;
- default:
- next += 1;
- }
- return current;
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- private CPInfo current;
- private int next = 1;
-
- };
- }
- };
- }
-
- private CPInfo[] pool;
-
- public interface Visitor<R,P> {
- R visitClass(CONSTANT_Class_info info, P p);
- R visitDouble(CONSTANT_Double_info info, P p);
- R visitFieldref(CONSTANT_Fieldref_info info, P p);
- R visitFloat(CONSTANT_Float_info info, P p);
- R visitInteger(CONSTANT_Integer_info info, P p);
- R visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, P p);
- R visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, P p);
- R visitLong(CONSTANT_Long_info info, P p);
- R visitNameAndType(CONSTANT_NameAndType_info info, P p);
- R visitMethodref(CONSTANT_Methodref_info info, P p);
- R visitMethodHandle(CONSTANT_MethodHandle_info info, P p);
- R visitMethodType(CONSTANT_MethodType_info info, P p);
- R visitString(CONSTANT_String_info info, P p);
- R visitUtf8(CONSTANT_Utf8_info info, P p);
- }
-
- public static abstract class CPInfo {
- CPInfo() {
- this.cp = null;
- }
-
- CPInfo(ConstantPool cp) {
- this.cp = cp;
- }
-
- public abstract int getTag();
-
- /** The number of slots in the constant pool used by this entry.
- * 2 for CONSTANT_Double and CONSTANT_Long; 1 for everything else. */
- public int size() {
- return 1;
- }
-
- public abstract int byteLength();
-
- public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
-
- protected final ConstantPool cp;
- }
-
- public static abstract class CPRefInfo extends CPInfo {
- protected CPRefInfo(ConstantPool cp, ClassReader cr, int tag) throws IOException {
- super(cp);
- this.tag = tag;
- class_index = cr.readUnsignedShort();
- name_and_type_index = cr.readUnsignedShort();
- }
-
- protected CPRefInfo(ConstantPool cp, int tag, int class_index, int name_and_type_index) {
- super(cp);
- this.tag = tag;
- this.class_index = class_index;
- this.name_and_type_index = name_and_type_index;
- }
-
- public int getTag() {
- return tag;
- }
-
- public int byteLength() {
- return 5;
- }
-
- public CONSTANT_Class_info getClassInfo() throws ConstantPoolException {
- return cp.getClassInfo(class_index);
- }
-
- public String getClassName() throws ConstantPoolException {
- return cp.getClassInfo(class_index).getName();
- }
-
- public CONSTANT_NameAndType_info getNameAndTypeInfo() throws ConstantPoolException {
- return cp.getNameAndTypeInfo(name_and_type_index);
- }
-
- public final int tag;
- public final int class_index;
- public final int name_and_type_index;
- }
-
- public static class CONSTANT_Class_info extends CPInfo {
- CONSTANT_Class_info(ConstantPool cp, ClassReader cr) throws IOException {
- super(cp);
- name_index = cr.readUnsignedShort();
- }
-
- public CONSTANT_Class_info(ConstantPool cp, int name_index) {
- super(cp);
- this.name_index = name_index;
- }
-
- public int getTag() {
- return CONSTANT_Class;
- }
-
- public int byteLength() {
- return 3;
- }
-
- /**
- * Get the raw value of the class referenced by this constant pool entry.
- * This will either be the name of the class, in internal form, or a
- * descriptor for an array class.
- * @return the raw value of the class
- */
- public String getName() throws ConstantPoolException {
- return cp.getUTF8Value(name_index);
- }
-
- /**
- * If this constant pool entry identifies either a class or interface type,
- * or a possibly multi-dimensional array of a class of interface type,
- * return the name of the class or interface in internal form. Otherwise,
- * (i.e. if this is a possibly multi-dimensional array of a primitive type),
- * return null.
- * @return the base class or interface name
- */
- public String getBaseName() throws ConstantPoolException {
- String name = getName();
- if (name.startsWith("[")) {
- int index = name.indexOf("[L");
- if (index == -1)
- return null;
- return name.substring(index + 2, name.length() - 1);
- } else
- return name;
- }
-
- public int getDimensionCount() throws ConstantPoolException {
- String name = getName();
- int count = 0;
- while (name.charAt(count) == '[')
- count++;
- return count;
- }
-
- @Override
- public String toString() {
- return "CONSTANT_Class_info[name_index: " + name_index + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitClass(this, data);
- }
-
- public final int name_index;
- }
-
- public static class CONSTANT_Double_info extends CPInfo {
- CONSTANT_Double_info(ClassReader cr) throws IOException {
- value = cr.readDouble();
- }
-
- public CONSTANT_Double_info(double value) {
- this.value = value;
- }
-
- public int getTag() {
- return CONSTANT_Double;
- }
-
- public int byteLength() {
- return 9;
- }
-
- @Override
- public int size() {
- return 2;
- }
-
- @Override
- public String toString() {
- return "CONSTANT_Double_info[value: " + value + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitDouble(this, data);
- }
-
- public final double value;
- }
-
- public static class CONSTANT_Fieldref_info extends CPRefInfo {
- CONSTANT_Fieldref_info(ConstantPool cp, ClassReader cr) throws IOException {
- super(cp, cr, CONSTANT_Fieldref);
- }
-
- public CONSTANT_Fieldref_info(ConstantPool cp, int class_index, int name_and_type_index) {
- super(cp, CONSTANT_Fieldref, class_index, name_and_type_index);
- }
-
- @Override
- public String toString() {
- return "CONSTANT_Fieldref_info[class_index: " + class_index + ", name_and_type_index: " + name_and_type_index + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitFieldref(this, data);
- }
- }
-
- public static class CONSTANT_Float_info extends CPInfo {
- CONSTANT_Float_info(ClassReader cr) throws IOException {
- value = cr.readFloat();
- }
-
- public CONSTANT_Float_info(float value) {
- this.value = value;
- }
-
- public int getTag() {
- return CONSTANT_Float;
- }
-
- public int byteLength() {
- return 5;
- }
-
- @Override
- public String toString() {
- return "CONSTANT_Float_info[value: " + value + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitFloat(this, data);
- }
-
- public final float value;
- }
-
- public static class CONSTANT_Integer_info extends CPInfo {
- CONSTANT_Integer_info(ClassReader cr) throws IOException {
- value = cr.readInt();
- }
-
- public CONSTANT_Integer_info(int value) {
- this.value = value;
- }
-
- public int getTag() {
- return CONSTANT_Integer;
- }
-
- public int byteLength() {
- return 5;
- }
-
- @Override
- public String toString() {
- return "CONSTANT_Integer_info[value: " + value + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitInteger(this, data);
- }
-
- public final int value;
- }
-
- public static class CONSTANT_InterfaceMethodref_info extends CPRefInfo {
- CONSTANT_InterfaceMethodref_info(ConstantPool cp, ClassReader cr) throws IOException {
- super(cp, cr, CONSTANT_InterfaceMethodref);
- }
-
- public CONSTANT_InterfaceMethodref_info(ConstantPool cp, int class_index, int name_and_type_index) {
- super(cp, CONSTANT_InterfaceMethodref, class_index, name_and_type_index);
- }
-
- @Override
- public String toString() {
- return "CONSTANT_InterfaceMethodref_info[class_index: " + class_index + ", name_and_type_index: " + name_and_type_index + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitInterfaceMethodref(this, data);
- }
- }
-
- public static class CONSTANT_InvokeDynamic_info extends CPInfo {
- CONSTANT_InvokeDynamic_info(ConstantPool cp, ClassReader cr) throws IOException {
- super(cp);
- bootstrap_method_attr_index = cr.readUnsignedShort();
- name_and_type_index = cr.readUnsignedShort();
- }
-
- public CONSTANT_InvokeDynamic_info(ConstantPool cp, int bootstrap_method_index, int name_and_type_index) {
- super(cp);
- this.bootstrap_method_attr_index = bootstrap_method_index;
- this.name_and_type_index = name_and_type_index;
- }
-
- public int getTag() {
- return CONSTANT_InvokeDynamic;
- }
-
- public int byteLength() {
- return 5;
- }
-
- @Override
- public String toString() {
- return "CONSTANT_InvokeDynamic_info[bootstrap_method_index: " + bootstrap_method_attr_index + ", name_and_type_index: " + name_and_type_index + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitInvokeDynamic(this, data);
- }
-
- public CONSTANT_NameAndType_info getNameAndTypeInfo() throws ConstantPoolException {
- return cp.getNameAndTypeInfo(name_and_type_index);
- }
-
- public final int bootstrap_method_attr_index;
- public final int name_and_type_index;
- }
-
- public static class CONSTANT_Long_info extends CPInfo {
- CONSTANT_Long_info(ClassReader cr) throws IOException {
- value = cr.readLong();
- }
-
- public CONSTANT_Long_info(long value) {
- this.value = value;
- }
-
- public int getTag() {
- return CONSTANT_Long;
- }
-
- @Override
- public int size() {
- return 2;
- }
-
- public int byteLength() {
- return 9;
- }
-
- @Override
- public String toString() {
- return "CONSTANT_Long_info[value: " + value + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitLong(this, data);
- }
-
- public final long value;
- }
-
- public static class CONSTANT_MethodHandle_info extends CPInfo {
- CONSTANT_MethodHandle_info(ConstantPool cp, ClassReader cr) throws IOException {
- super(cp);
- reference_kind = RefKind.getRefkind(cr.readUnsignedByte());
- reference_index = cr.readUnsignedShort();
- }
-
- public CONSTANT_MethodHandle_info(ConstantPool cp, RefKind ref_kind, int member_index) {
- super(cp);
- this.reference_kind = ref_kind;
- this.reference_index = member_index;
- }
-
- public int getTag() {
- return CONSTANT_MethodHandle;
- }
-
- public int byteLength() {
- return 4;
- }
-
- @Override
- public String toString() {
- return "CONSTANT_MethodHandle_info[ref_kind: " + reference_kind + ", member_index: " + reference_index + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitMethodHandle(this, data);
- }
-
- public CPRefInfo getCPRefInfo() throws ConstantPoolException {
- int expected = CONSTANT_Methodref;
- int actual = cp.get(reference_index).getTag();
- // allow these tag types also:
- switch (actual) {
- case CONSTANT_Fieldref:
- case CONSTANT_InterfaceMethodref:
- expected = actual;
- }
- return (CPRefInfo) cp.get(reference_index, expected);
- }
-
- public final RefKind reference_kind;
- public final int reference_index;
- }
-
- public static class CONSTANT_MethodType_info extends CPInfo {
- CONSTANT_MethodType_info(ConstantPool cp, ClassReader cr) throws IOException {
- super(cp);
- descriptor_index = cr.readUnsignedShort();
- }
-
- public CONSTANT_MethodType_info(ConstantPool cp, int signature_index) {
- super(cp);
- this.descriptor_index = signature_index;
- }
-
- public int getTag() {
- return CONSTANT_MethodType;
- }
-
- public int byteLength() {
- return 3;
- }
-
- @Override
- public String toString() {
- return "CONSTANT_MethodType_info[signature_index: " + descriptor_index + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitMethodType(this, data);
- }
-
- public String getType() throws ConstantPoolException {
- return cp.getUTF8Value(descriptor_index);
- }
-
- public final int descriptor_index;
- }
-
- public static class CONSTANT_Methodref_info extends CPRefInfo {
- CONSTANT_Methodref_info(ConstantPool cp, ClassReader cr) throws IOException {
- super(cp, cr, CONSTANT_Methodref);
- }
-
- public CONSTANT_Methodref_info(ConstantPool cp, int class_index, int name_and_type_index) {
- super(cp, CONSTANT_Methodref, class_index, name_and_type_index);
- }
-
- @Override
- public String toString() {
- return "CONSTANT_Methodref_info[class_index: " + class_index + ", name_and_type_index: " + name_and_type_index + "]";
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitMethodref(this, data);
- }
- }
-
- public static class CONSTANT_NameAndType_info extends CPInfo {
- CONSTANT_NameAndType_info(ConstantPool cp, ClassReader cr) throws IOException {
- super(cp);
- name_index = cr.readUnsignedShort();
- type_index = cr.readUnsignedShort();
- }
-
- public CONSTANT_NameAndType_info(ConstantPool cp, int name_index, int type_index) {
- super(cp);
- this.name_index = name_index;
- this.type_index = type_index;
- }
-
- public int getTag() {
- return CONSTANT_NameAndType;
- }
-
- public int byteLength() {
- return 5;
- }
-
- public String getName() throws ConstantPoolException {
- return cp.getUTF8Value(name_index);
- }
-
- public String getType() throws ConstantPoolException {
- return cp.getUTF8Value(type_index);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitNameAndType(this, data);
- }
-
- @Override
- public String toString() {
- return "CONSTANT_NameAndType_info[name_index: " + name_index + ", type_index: " + type_index + "]";
- }
-
- public final int name_index;
- public final int type_index;
- }
-
- public static class CONSTANT_String_info extends CPInfo {
- CONSTANT_String_info(ConstantPool cp, ClassReader cr) throws IOException {
- super(cp);
- string_index = cr.readUnsignedShort();
- }
-
- public CONSTANT_String_info(ConstantPool cp, int string_index) {
- super(cp);
- this.string_index = string_index;
- }
-
- public int getTag() {
- return CONSTANT_String;
- }
-
- public int byteLength() {
- return 3;
- }
-
- public String getString() throws ConstantPoolException {
- return cp.getUTF8Value(string_index);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitString(this, data);
- }
-
- @Override
- public String toString() {
- return "CONSTANT_String_info[class_index: " + string_index + "]";
- }
-
- public final int string_index;
- }
-
- public static class CONSTANT_Utf8_info extends CPInfo {
- CONSTANT_Utf8_info(ClassReader cr) throws IOException {
- value = cr.readUTF();
- }
-
- public CONSTANT_Utf8_info(String value) {
- this.value = value;
- }
-
- public int getTag() {
- return CONSTANT_Utf8;
- }
-
- public int byteLength() {
- class SizeOutputStream extends OutputStream {
- @Override
- public void write(int b) {
- size++;
- }
- int size;
- }
- SizeOutputStream sizeOut = new SizeOutputStream();
- DataOutputStream out = new DataOutputStream(sizeOut);
- try { out.writeUTF(value); } catch (IOException ignore) { }
- return 1 + sizeOut.size;
- }
-
- @Override
- public String toString() {
- if (value.length() < 32 && isPrintableAscii(value))
- return "CONSTANT_Utf8_info[value: \"" + value + "\"]";
- else
- return "CONSTANT_Utf8_info[value: (" + value.length() + " chars)]";
- }
-
- static boolean isPrintableAscii(String s) {
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
- if (c < 32 || c >= 127)
- return false;
- }
- return true;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitUtf8(this, data);
- }
-
- public final String value;
- }
-
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/ConstantPoolException.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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.
- */
-
-
-package com.sun.tools.classfile;
-
-/*
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ConstantPoolException extends Exception {
- private static final long serialVersionUID = -2324397349644754565L;
- ConstantPoolException(int index) {
- this.index = index;
- }
-
- public final int index;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/ConstantValue_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.2.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ConstantValue_attribute extends Attribute {
- ConstantValue_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- constantvalue_index = cr.readUnsignedShort();
- }
-
- public ConstantValue_attribute(ConstantPool constant_pool, int constantvalue_index)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.ConstantValue), constantvalue_index);
- }
-
- public ConstantValue_attribute(int name_index, int constantvalue_index) {
- super(name_index, 2);
- this.constantvalue_index = constantvalue_index;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitConstantValue(this, data);
- }
-
- public final int constantvalue_index;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/DefaultAttribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-/*
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class DefaultAttribute extends Attribute {
- DefaultAttribute(ClassReader cr, int name_index, byte[] data) {
- this(cr, name_index, data, null);
- }
-
- DefaultAttribute(ClassReader cr, int name_index, byte[] data, String reason) {
- super(name_index, data.length);
- info = data;
- this.reason = reason;
- }
-
- public DefaultAttribute(ConstantPool constant_pool, int name_index, byte[] info) {
- this(constant_pool, name_index, info, null);
- }
-
- public DefaultAttribute(ConstantPool constant_pool, int name_index,
- byte[] info, String reason) {
- super(name_index, info.length);
- this.info = info;
- this.reason = reason;
- }
-
- public <R, P> R accept(Visitor<R, P> visitor, P p) {
- return visitor.visitDefault(this, p);
- }
-
- public final byte[] info;
- /** Why did we need to generate a DefaultAttribute
- */
- public final String reason;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Dependencies.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,794 +0,0 @@
-/*
- * Copyright (c) 2009, 2013, 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.
- */
-package com.sun.tools.classfile;
-
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import com.sun.tools.classfile.Dependency.Filter;
-import com.sun.tools.classfile.Dependency.Finder;
-import com.sun.tools.classfile.Dependency.Location;
-import com.sun.tools.classfile.Type.ArrayType;
-import com.sun.tools.classfile.Type.ClassSigType;
-import com.sun.tools.classfile.Type.ClassType;
-import com.sun.tools.classfile.Type.MethodType;
-import com.sun.tools.classfile.Type.SimpleType;
-import com.sun.tools.classfile.Type.TypeParamType;
-import com.sun.tools.classfile.Type.WildcardType;
-
-import static com.sun.tools.classfile.ConstantPool.*;
-
-/**
- * A framework for determining {@link Dependency dependencies} between class files.
- *
- * A {@link Dependency.Finder finder} is used to identify the dependencies of
- * individual classes. Some finders may return subtypes of {@code Dependency} to
- * further characterize the type of dependency, such as a dependency on a
- * method within a class.
- *
- * A {@link Dependency.Filter filter} may be used to restrict the set of
- * dependencies found by a finder.
- *
- * Dependencies that are found may be passed to a {@link Dependencies.Recorder
- * recorder} so that the dependencies can be stored in a custom data structure.
- */
-public class Dependencies {
- /**
- * Thrown when a class file cannot be found.
- */
- public static class ClassFileNotFoundException extends Exception {
- private static final long serialVersionUID = 3632265927794475048L;
-
- public ClassFileNotFoundException(String className) {
- super(className);
- this.className = className;
- }
-
- public ClassFileNotFoundException(String className, Throwable cause) {
- this(className);
- initCause(cause);
- }
-
- public final String className;
- }
-
- /**
- * Thrown when an exception is found processing a class file.
- */
- public static class ClassFileError extends Error {
- private static final long serialVersionUID = 4111110813961313203L;
-
- public ClassFileError(Throwable cause) {
- initCause(cause);
- }
- }
-
- /**
- * Service provider interface to locate and read class files.
- */
- public interface ClassFileReader {
- /**
- * Get the ClassFile object for a specified class.
- * @param className the name of the class to be returned.
- * @return the ClassFile for the given class
- * @throws Dependencies.ClassFileNotFoundException if the classfile cannot be
- * found
- */
- public ClassFile getClassFile(String className)
- throws ClassFileNotFoundException;
- }
-
- /**
- * Service provide interface to handle results.
- */
- public interface Recorder {
- /**
- * Record a dependency that has been found.
- * @param d
- */
- public void addDependency(Dependency d);
- }
-
- /**
- * Get the default finder used to locate the dependencies for a class.
- * @return the default finder
- */
- public static Finder getDefaultFinder() {
- return new APIDependencyFinder(AccessFlags.ACC_PRIVATE);
- }
-
- /**
- * Get a finder used to locate the API dependencies for a class.
- * These include the superclass, superinterfaces, and classes referenced in
- * the declarations of fields and methods. The fields and methods that
- * are checked can be limited according to a specified access.
- * The access parameter must be one of {@link AccessFlags#ACC_PUBLIC ACC_PUBLIC},
- * {@link AccessFlags#ACC_PRIVATE ACC_PRIVATE},
- * {@link AccessFlags#ACC_PROTECTED ACC_PROTECTED}, or 0 for
- * package private access. Members with greater than or equal accessibility
- * to that specified will be searched for dependencies.
- * @param access the access of members to be checked
- * @return an API finder
- */
- public static Finder getAPIFinder(int access) {
- return new APIDependencyFinder(access);
- }
-
- /**
- * Get a finder to do class dependency analysis.
- *
- * @return a Class dependency finder
- */
- public static Finder getClassDependencyFinder() {
- return new ClassDependencyFinder();
- }
-
- /**
- * Get the finder used to locate the dependencies for a class.
- * @return the finder
- */
- public Finder getFinder() {
- if (finder == null)
- finder = getDefaultFinder();
- return finder;
- }
-
- /**
- * Set the finder used to locate the dependencies for a class.
- * @param f the finder
- */
- public void setFinder(Finder f) {
- finder = Objects.requireNonNull(f);
- }
-
- /**
- * Get the default filter used to determine included when searching
- * the transitive closure of all the dependencies.
- * Unless overridden, the default filter accepts all dependencies.
- * @return the default filter.
- */
- public static Filter getDefaultFilter() {
- return DefaultFilter.instance();
- }
-
- /**
- * Get a filter which uses a regular expression on the target's class name
- * to determine if a dependency is of interest.
- * @param pattern the pattern used to match the target's class name
- * @return a filter for matching the target class name with a regular expression
- */
- public static Filter getRegexFilter(Pattern pattern) {
- return new TargetRegexFilter(pattern);
- }
-
- /**
- * Get a filter which checks the package of a target's class name
- * to determine if a dependency is of interest. The filter checks if the
- * package of the target's class matches any of a set of given package
- * names. The match may optionally match subpackages of the given names as well.
- * @param packageNames the package names used to match the target's class name
- * @param matchSubpackages whether or not to match subpackages as well
- * @return a filter for checking the target package name against a list of package names
- */
- public static Filter getPackageFilter(Set<String> packageNames, boolean matchSubpackages) {
- return new TargetPackageFilter(packageNames, matchSubpackages);
- }
-
- /**
- * Get the filter used to determine the dependencies included when searching
- * the transitive closure of all the dependencies.
- * Unless overridden, the default filter accepts all dependencies.
- * @return the filter
- */
- public Filter getFilter() {
- if (filter == null)
- filter = getDefaultFilter();
- return filter;
- }
-
- /**
- * Set the filter used to determine the dependencies included when searching
- * the transitive closure of all the dependencies.
- * @param f the filter
- */
- public void setFilter(Filter f) {
- filter = Objects.requireNonNull(f);
- }
-
- /**
- * Find the dependencies of a class, using the current
- * {@link Dependencies#getFinder finder} and
- * {@link Dependencies#getFilter filter}.
- * The search may optionally include the transitive closure of all the
- * filtered dependencies, by also searching in the classes named in those
- * dependencies.
- * @param classFinder a finder to locate class files
- * @param rootClassNames the names of the root classes from which to begin
- * searching
- * @param transitiveClosure whether or not to also search those classes
- * named in any filtered dependencies that are found.
- * @return the set of dependencies that were found
- * @throws ClassFileNotFoundException if a required class file cannot be found
- * @throws ClassFileError if an error occurs while processing a class file,
- * such as an error in the internal class file structure.
- */
- public Set<Dependency> findAllDependencies(
- ClassFileReader classFinder, Set<String> rootClassNames,
- boolean transitiveClosure)
- throws ClassFileNotFoundException {
- final Set<Dependency> results = new HashSet<>();
- Recorder r = new Recorder() {
- public void addDependency(Dependency d) {
- results.add(d);
- }
- };
- findAllDependencies(classFinder, rootClassNames, transitiveClosure, r);
- return results;
- }
-
- /**
- * Find the dependencies of a class, using the current
- * {@link Dependencies#getFinder finder} and
- * {@link Dependencies#getFilter filter}.
- * The search may optionally include the transitive closure of all the
- * filtered dependencies, by also searching in the classes named in those
- * dependencies.
- * @param classFinder a finder to locate class files
- * @param rootClassNames the names of the root classes from which to begin
- * searching
- * @param transitiveClosure whether or not to also search those classes
- * named in any filtered dependencies that are found.
- * @param recorder a recorder for handling the results
- * @throws ClassFileNotFoundException if a required class file cannot be found
- * @throws ClassFileError if an error occurs while processing a class file,
- * such as an error in the internal class file structure.
- */
- public void findAllDependencies(
- ClassFileReader classFinder, Set<String> rootClassNames,
- boolean transitiveClosure, Recorder recorder)
- throws ClassFileNotFoundException {
- Set<String> doneClasses = new HashSet<>();
-
- getFinder(); // ensure initialized
- getFilter(); // ensure initialized
-
- // 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.
- Deque<String> deque = new LinkedList<>(rootClassNames);
-
- String className;
- while ((className = deque.poll()) != null) {
- assert (!doneClasses.contains(className));
- doneClasses.add(className);
-
- ClassFile cf = classFinder.getClassFile(className);
-
- // The following code just applies the filter to the dependencies
- // followed for the transitive closure.
- for (Dependency d: finder.findDependencies(cf)) {
- recorder.addDependency(d);
- if (transitiveClosure && filter.accepts(d)) {
- String cn = d.getTarget().getClassName();
- if (!doneClasses.contains(cn))
- deque.add(cn);
- }
- }
- }
- }
-
- private Filter filter;
- private Finder finder;
-
- /**
- * A location identifying a class.
- */
- static class SimpleLocation implements Location {
- public SimpleLocation(String name) {
- this.name = name;
- this.className = name.replace('/', '.');
- }
-
- public String getName() {
- return name;
- }
-
- public String getClassName() {
- return className;
- }
-
- public String getPackageName() {
- int i = name.lastIndexOf('/');
- return (i > 0) ? name.substring(0, i).replace('/', '.') : "";
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other)
- return true;
- if (!(other instanceof SimpleLocation))
- return false;
- return (name.equals(((SimpleLocation) other).name));
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public String toString() {
- return name;
- }
-
- private String name;
- private String className;
- }
-
- /**
- * A dependency of one class on another.
- */
- static class SimpleDependency implements Dependency {
- public SimpleDependency(Location origin, Location target) {
- this.origin = origin;
- this.target = target;
- }
-
- public Location getOrigin() {
- return origin;
- }
-
- public Location getTarget() {
- return target;
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other)
- return true;
- if (!(other instanceof SimpleDependency))
- return false;
- SimpleDependency o = (SimpleDependency) other;
- return (origin.equals(o.origin) && target.equals(o.target));
- }
-
- @Override
- public int hashCode() {
- return origin.hashCode() * 31 + target.hashCode();
- }
-
- @Override
- public String toString() {
- return origin + ":" + target;
- }
-
- private Location origin;
- private Location target;
- }
-
-
- /**
- * This class accepts all dependencies.
- */
- static class DefaultFilter implements Filter {
- private static DefaultFilter instance;
-
- static DefaultFilter instance() {
- if (instance == null)
- instance = new DefaultFilter();
- return instance;
- }
-
- public boolean accepts(Dependency dependency) {
- return true;
- }
- }
-
- /**
- * This class accepts those dependencies whose target's class name matches a
- * regular expression.
- */
- static class TargetRegexFilter implements Filter {
- TargetRegexFilter(Pattern pattern) {
- this.pattern = pattern;
- }
-
- public boolean accepts(Dependency dependency) {
- return pattern.matcher(dependency.getTarget().getClassName()).matches();
- }
-
- private final Pattern pattern;
- }
-
- /**
- * This class accepts those dependencies whose class name is in a given
- * package.
- */
- static class TargetPackageFilter implements Filter {
- TargetPackageFilter(Set<String> packageNames, boolean matchSubpackages) {
- for (String pn: packageNames) {
- if (pn.length() == 0) // implies null check as well
- throw new IllegalArgumentException();
- }
- this.packageNames = packageNames;
- this.matchSubpackages = matchSubpackages;
- }
-
- public boolean accepts(Dependency dependency) {
- String pn = dependency.getTarget().getPackageName();
- if (packageNames.contains(pn))
- return true;
-
- if (matchSubpackages) {
- for (String n: packageNames) {
- if (pn.startsWith(n + "."))
- return true;
- }
- }
-
- return false;
- }
-
- private final Set<String> packageNames;
- private final boolean matchSubpackages;
- }
-
- /**
- * This class identifies class names directly or indirectly in the constant pool.
- */
- static class ClassDependencyFinder extends BasicDependencyFinder {
- public Iterable<? extends Dependency> findDependencies(ClassFile classfile) {
- Visitor v = new Visitor(classfile);
- for (CPInfo cpInfo: classfile.constant_pool.entries()) {
- v.scan(cpInfo);
- }
- try {
- v.addClass(classfile.super_class);
- v.addClasses(classfile.interfaces);
- v.scan(classfile.attributes);
-
- for (Field f : classfile.fields) {
- v.scan(f.descriptor, f.attributes);
- }
- for (Method m : classfile.methods) {
- v.scan(m.descriptor, m.attributes);
- Exceptions_attribute e =
- (Exceptions_attribute)m.attributes.get(Attribute.Exceptions);
- if (e != null) {
- v.addClasses(e.exception_index_table);
- }
- }
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- }
-
- return v.deps;
- }
- }
-
- /**
- * This class identifies class names in the signatures of classes, fields,
- * and methods in a class.
- */
- static class APIDependencyFinder extends BasicDependencyFinder {
- APIDependencyFinder(int access) {
- switch (access) {
- case AccessFlags.ACC_PUBLIC:
- case AccessFlags.ACC_PROTECTED:
- case AccessFlags.ACC_PRIVATE:
- case 0:
- showAccess = access;
- break;
- default:
- throw new IllegalArgumentException("invalid access 0x"
- + Integer.toHexString(access));
- }
- }
-
- public Iterable<? extends Dependency> findDependencies(ClassFile classfile) {
- try {
- Visitor v = new Visitor(classfile);
- v.addClass(classfile.super_class);
- v.addClasses(classfile.interfaces);
- // inner classes?
- for (Field f : classfile.fields) {
- if (checkAccess(f.access_flags))
- v.scan(f.descriptor, f.attributes);
- }
- for (Method m : classfile.methods) {
- if (checkAccess(m.access_flags)) {
- v.scan(m.descriptor, m.attributes);
- Exceptions_attribute e =
- (Exceptions_attribute) m.attributes.get(Attribute.Exceptions);
- if (e != null)
- v.addClasses(e.exception_index_table);
- }
- }
- return v.deps;
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- }
- }
-
- boolean checkAccess(AccessFlags flags) {
- // code copied from javap.Options.checkAccess
- boolean isPublic = flags.is(AccessFlags.ACC_PUBLIC);
- boolean isProtected = flags.is(AccessFlags.ACC_PROTECTED);
- boolean isPrivate = flags.is(AccessFlags.ACC_PRIVATE);
- boolean isPackage = !(isPublic || isProtected || isPrivate);
-
- if ((showAccess == AccessFlags.ACC_PUBLIC) && (isProtected || isPrivate || isPackage))
- return false;
- else if ((showAccess == AccessFlags.ACC_PROTECTED) && (isPrivate || isPackage))
- return false;
- else if ((showAccess == 0) && (isPrivate))
- return false;
- else
- return true;
- }
-
- private int showAccess;
- }
-
- static abstract class BasicDependencyFinder implements Finder {
- private Map<String,Location> locations = new HashMap<>();
-
- Location getLocation(String className) {
- Location l = locations.get(className);
- if (l == null)
- locations.put(className, l = new SimpleLocation(className));
- return l;
- }
-
- class Visitor implements ConstantPool.Visitor<Void,Void>, Type.Visitor<Void, Void> {
- private ConstantPool constant_pool;
- private Location origin;
- Set<Dependency> deps;
-
- Visitor(ClassFile classFile) {
- try {
- constant_pool = classFile.constant_pool;
- origin = getLocation(classFile.getName());
- deps = new HashSet<>();
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- }
- }
-
- void scan(Descriptor d, Attributes attrs) {
- try {
- scan(new Signature(d.index).getType(constant_pool));
- scan(attrs);
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- }
- }
-
- void scan(CPInfo cpInfo) {
- cpInfo.accept(this, null);
- }
-
- void scan(Type t) {
- t.accept(this, null);
- }
-
- void scan(Attributes attrs) {
- try {
- Signature_attribute sa = (Signature_attribute)attrs.get(Attribute.Signature);
- if (sa != null)
- scan(sa.getParsedSignature().getType(constant_pool));
-
- scan((RuntimeVisibleAnnotations_attribute)
- attrs.get(Attribute.RuntimeVisibleAnnotations));
- scan((RuntimeVisibleParameterAnnotations_attribute)
- attrs.get(Attribute.RuntimeVisibleParameterAnnotations));
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- }
- }
-
- private void scan(RuntimeAnnotations_attribute attr) throws ConstantPoolException {
- if (attr == null) {
- return;
- }
- for (int i = 0; i < attr.annotations.length; i++) {
- int index = attr.annotations[i].type_index;
- scan(new Signature(index).getType(constant_pool));
- }
- }
-
- private void scan(RuntimeParameterAnnotations_attribute attr) throws ConstantPoolException {
- if (attr == null) {
- return;
- }
- for (int param = 0; param < attr.parameter_annotations.length; param++) {
- for (int i = 0; i < attr.parameter_annotations[param].length; i++) {
- int index = attr.parameter_annotations[param][i].type_index;
- scan(new Signature(index).getType(constant_pool));
- }
- }
- }
-
- void addClass(int index) throws ConstantPoolException {
- if (index != 0) {
- String name = constant_pool.getClassInfo(index).getBaseName();
- if (name != null)
- addDependency(name);
- }
- }
-
- void addClasses(int[] indices) throws ConstantPoolException {
- for (int i: indices)
- addClass(i);
- }
-
- private void addDependency(String name) {
- deps.add(new SimpleDependency(origin, getLocation(name)));
- }
-
- // ConstantPool.Visitor methods
-
- public Void visitClass(CONSTANT_Class_info info, Void p) {
- try {
- if (info.getName().startsWith("["))
- new Signature(info.name_index).getType(constant_pool).accept(this, null);
- else
- addDependency(info.getBaseName());
- return null;
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- }
- }
-
- public Void visitDouble(CONSTANT_Double_info info, Void p) {
- return null;
- }
-
- public Void visitFieldref(CONSTANT_Fieldref_info info, Void p) {
- return visitRef(info, p);
- }
-
- public Void visitFloat(CONSTANT_Float_info info, Void p) {
- return null;
- }
-
- public Void visitInteger(CONSTANT_Integer_info info, Void p) {
- return null;
- }
-
- public Void visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
- return visitRef(info, p);
- }
-
- public Void visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
- return null;
- }
-
- public Void visitLong(CONSTANT_Long_info info, Void p) {
- return null;
- }
-
- public Void visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
- return null;
- }
-
- public Void visitMethodType(CONSTANT_MethodType_info info, Void p) {
- return null;
- }
-
- public Void visitMethodref(CONSTANT_Methodref_info info, Void p) {
- return visitRef(info, p);
- }
-
- public Void visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
- try {
- new Signature(info.type_index).getType(constant_pool).accept(this, null);
- return null;
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- }
- }
-
- public Void visitString(CONSTANT_String_info info, Void p) {
- return null;
- }
-
- public Void visitUtf8(CONSTANT_Utf8_info info, Void p) {
- return null;
- }
-
- private Void visitRef(CPRefInfo info, Void p) {
- try {
- visitClass(info.getClassInfo(), p);
- return null;
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- }
- }
-
- // Type.Visitor methods
-
- private void findDependencies(Type t) {
- if (t != null)
- t.accept(this, null);
- }
-
- private void findDependencies(List<? extends Type> ts) {
- if (ts != null) {
- for (Type t: ts)
- t.accept(this, null);
- }
- }
-
- public Void visitSimpleType(SimpleType type, Void p) {
- return null;
- }
-
- public Void visitArrayType(ArrayType type, Void p) {
- findDependencies(type.elemType);
- return null;
- }
-
- public Void visitMethodType(MethodType type, Void p) {
- findDependencies(type.paramTypes);
- findDependencies(type.returnType);
- findDependencies(type.throwsTypes);
- findDependencies(type.typeParamTypes);
- return null;
- }
-
- public Void visitClassSigType(ClassSigType type, Void p) {
- findDependencies(type.superclassType);
- findDependencies(type.superinterfaceTypes);
- return null;
- }
-
- public Void visitClassType(ClassType type, Void p) {
- findDependencies(type.outerType);
- addDependency(type.getBinaryName());
- findDependencies(type.typeArgs);
- return null;
- }
-
- public Void visitTypeParamType(TypeParamType type, Void p) {
- findDependencies(type.classBound);
- findDependencies(type.interfaceBounds);
- return null;
- }
-
- public Void visitWildcardType(WildcardType type, Void p) {
- findDependencies(type.boundType);
- return null;
- }
- }
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Dependency.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- */
-
-package com.sun.tools.classfile;
-
-
-/**
- * A directed relationship between two {@link Dependency.Location Location}s.
- * Subtypes of {@code Dependency} may provide additional detail about the dependency.
- *
- * @see Dependency.Finder
- * @see Dependency.Filter
- * @see Dependencies
- */
-public interface Dependency {
- /**
- * A filter used to select dependencies of interest, and to discard others.
- */
- public interface Filter {
- /**
- * Return true if the dependency is of interest.
- * @param dependency the dependency to be considered
- * @return true if and only if the dependency is of interest.
- */
- boolean accepts(Dependency dependency);
- }
-
- /**
- * An interface for finding the immediate dependencies of a given class file.
- */
- public interface Finder {
- /**
- * Find the immediate dependencies of a given class file.
- * @param classfile the class file to be examined
- * @return the dependencies located in the given class file.
- */
- public Iterable<? extends Dependency> findDependencies(ClassFile classfile);
- }
-
-
- /**
- * A location somewhere within a class. Subtypes of {@code Location}
- * may be used to provide additional detail about the location.
- */
- public interface Location {
- /**
- * Get the name of the class containing the location.
- * This name will be used to locate the class file for transitive
- * dependency analysis.
- * @return the name of the class containing the location.
- */
- String getName();
-
- /**
- * Get the fully-qualified name of the class containing the location.
- * @return the fully-qualified name of the class containing the location.
- */
- String getClassName();
-
- /**
- * Get the package name of the class containing the location.
- * @return the package name of the class containing the location.
- */
- String getPackageName();
- }
-
-
- /**
- * Get the location that has the dependency.
- * @return the location that has the dependency.
- */
- Location getOrigin();
-
- /**
- * Get the location that is being depended upon.
- * @return the location that is being depended upon.
- */
- Location getTarget();
-}
-
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Deprecated_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.15.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Deprecated_attribute extends Attribute {
- Deprecated_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- }
-
- public Deprecated_attribute(ConstantPool constant_pool)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.Deprecated));
- }
-
- public Deprecated_attribute(int name_index) {
- super(name_index, 0);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitDeprecated(this, data);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Descriptor.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.4.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Descriptor {
- public static class InvalidDescriptor extends DescriptorException {
- private static final long serialVersionUID = 1L;
- InvalidDescriptor(String desc) {
- this.desc = desc;
- this.index = -1;
- }
-
- InvalidDescriptor(String desc, int index) {
- this.desc = desc;
- this.index = index;
- }
-
- @Override
- public String getMessage() {
- // i18n
- if (index == -1)
- return "invalid descriptor \"" + desc + "\"";
- else
- return "descriptor is invalid at offset " + index + " in \"" + desc + "\"";
- }
-
- public final String desc;
- public final int index;
-
- }
-
- public Descriptor(ClassReader cr) throws IOException {
- this(cr.readUnsignedShort());
- }
-
- public Descriptor(int index) {
- this.index = index;
-
- }
-
- public String getValue(ConstantPool constant_pool) throws ConstantPoolException {
- return constant_pool.getUTF8Value(index);
- }
-
- public int getParameterCount(ConstantPool constant_pool)
- throws ConstantPoolException, InvalidDescriptor {
- String desc = getValue(constant_pool);
- int end = desc.indexOf(")");
- if (end == -1)
- throw new InvalidDescriptor(desc);
- parse(desc, 0, end + 1);
- return count;
-
- }
-
- public String getParameterTypes(ConstantPool constant_pool)
- throws ConstantPoolException, InvalidDescriptor {
- String desc = getValue(constant_pool);
- int end = desc.indexOf(")");
- if (end == -1)
- throw new InvalidDescriptor(desc);
- return parse(desc, 0, end + 1);
- }
-
- public String getReturnType(ConstantPool constant_pool)
- throws ConstantPoolException, InvalidDescriptor {
- String desc = getValue(constant_pool);
- int end = desc.indexOf(")");
- if (end == -1)
- throw new InvalidDescriptor(desc);
- return parse(desc, end + 1, desc.length());
- }
-
- public String getFieldType(ConstantPool constant_pool)
- throws ConstantPoolException, InvalidDescriptor {
- String desc = getValue(constant_pool);
- return parse(desc, 0, desc.length());
- }
-
- private String parse(String desc, int start, int end)
- throws InvalidDescriptor {
- int p = start;
- StringBuilder sb = new StringBuilder();
- int dims = 0;
- count = 0;
-
- while (p < end) {
- String type;
- char ch;
- switch (ch = desc.charAt(p++)) {
- case '(':
- sb.append('(');
- continue;
-
- case ')':
- sb.append(')');
- continue;
-
- case '[':
- dims++;
- continue;
-
- case 'B':
- type = "byte";
- break;
-
- case 'C':
- type = "char";
- break;
-
- case 'D':
- type = "double";
- break;
-
- case 'F':
- type = "float";
- break;
-
- case 'I':
- type = "int";
- break;
-
- case 'J':
- type = "long";
- break;
-
- case 'L':
- int sep = desc.indexOf(';', p);
- if (sep == -1)
- throw new InvalidDescriptor(desc, p - 1);
- type = desc.substring(p, sep).replace('/', '.');
- p = sep + 1;
- break;
-
- case 'S':
- type = "short";
- break;
-
- case 'Z':
- type = "boolean";
- break;
-
- case 'V':
- type = "void";
- break;
-
- default:
- throw new InvalidDescriptor(desc, p - 1);
- }
-
- if (sb.length() > 1 && sb.charAt(0) == '(')
- sb.append(", ");
- sb.append(type);
- for ( ; dims > 0; dims-- )
- sb.append("[]");
-
- count++;
- }
-
- return sb.toString();
- }
-
- public final int index;
- private int count;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/DescriptorException.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 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.
- */
-
-
-package com.sun.tools.classfile;
-
-/*
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class DescriptorException extends Exception {
- private static final long serialVersionUID = 2411890273788901032L;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/EnclosingMethod_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.7.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class EnclosingMethod_attribute extends Attribute {
- EnclosingMethod_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- class_index = cr.readUnsignedShort();
- method_index = cr.readUnsignedShort();
- }
-
- public EnclosingMethod_attribute(ConstantPool constant_pool, int class_index, int method_index)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.EnclosingMethod), class_index, method_index);
- }
-
- public EnclosingMethod_attribute(int name_index, int class_index, int method_index) {
- super(name_index, 4);
- this.class_index = class_index;
- this.method_index = method_index;
- }
-
- public String getClassName(ConstantPool constant_pool) throws ConstantPoolException {
- return constant_pool.getClassInfo(class_index).getName();
- }
-
- public String getMethodName(ConstantPool constant_pool) throws ConstantPoolException {
- if (method_index == 0)
- return "";
- return constant_pool.getNameAndTypeInfo(method_index).getName();
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitEnclosingMethod(this, data);
- }
-
- public final int class_index;
- public final int method_index;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Exceptions_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.5.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Exceptions_attribute extends Attribute {
- Exceptions_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- number_of_exceptions = cr.readUnsignedShort();
- exception_index_table = new int[number_of_exceptions];
- for (int i = 0; i < number_of_exceptions; i++)
- exception_index_table[i] = cr.readUnsignedShort();
- }
-
- public Exceptions_attribute(ConstantPool constant_pool, int[] exception_index_table)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.Exceptions), exception_index_table);
- }
-
- public Exceptions_attribute(int name_index, int[] exception_index_table) {
- super(name_index, 2 + 2 * exception_index_table.length);
- this.number_of_exceptions = exception_index_table.length;
- this.exception_index_table = exception_index_table;
- }
-
- public String getException(int index, ConstantPool constant_pool) throws ConstantPoolException {
- int exception_index = exception_index_table[index];
- return constant_pool.getClassInfo(exception_index).getName();
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitExceptions(this, data);
- }
-
- public final int number_of_exceptions;
- public final int[] exception_index_table;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Field.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/*
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Field {
- Field(ClassReader cr) throws IOException {
- access_flags = new AccessFlags(cr);
- name_index = cr.readUnsignedShort();
- descriptor = new Descriptor(cr);
- attributes = new Attributes(cr);
- }
-
- public Field(AccessFlags access_flags,
- int name_index, Descriptor descriptor,
- Attributes attributes) {
- this.access_flags = access_flags;
- this.name_index = name_index;
- this.descriptor = descriptor;
- this.attributes = attributes;
- }
-
- public int byteLength() {
- return 6 + attributes.byteLength();
- }
-
- public String getName(ConstantPool constant_pool) throws ConstantPoolException {
- return constant_pool.getUTF8Value(name_index);
- }
-
- public final AccessFlags access_flags;
- public final int name_index;
- public final Descriptor descriptor;
- public final Attributes attributes;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/InnerClasses_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-import com.sun.tools.classfile.ConstantPool.*;
-
-/**
- * See JVMS, section 4.8.6.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class InnerClasses_attribute extends Attribute {
- InnerClasses_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- number_of_classes = cr.readUnsignedShort();
- classes = new Info[number_of_classes];
- for (int i = 0; i < number_of_classes; i++)
- classes[i] = new Info(cr);
- }
-
- public InnerClasses_attribute(ConstantPool constant_pool, Info[] classes)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.InnerClasses), classes);
- }
-
- public InnerClasses_attribute(int name_index, Info[] classes) {
- super(name_index, 2 + Info.length() * classes.length);
- this.number_of_classes = classes.length;
- this.classes = classes;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitInnerClasses(this, data);
- }
-
- public final int number_of_classes;
- public final Info[] classes;
-
- public static class Info {
- Info(ClassReader cr) throws IOException {
- inner_class_info_index = cr.readUnsignedShort();
- outer_class_info_index = cr.readUnsignedShort();
- inner_name_index = cr.readUnsignedShort();
- inner_class_access_flags = new AccessFlags(cr.readUnsignedShort());
- }
-
- public CONSTANT_Class_info getInnerClassInfo(ConstantPool constant_pool) throws ConstantPoolException {
- if (inner_class_info_index == 0)
- return null;
- return constant_pool.getClassInfo(inner_class_info_index);
- }
-
- public CONSTANT_Class_info getOuterClassInfo(ConstantPool constant_pool) throws ConstantPoolException {
- if (outer_class_info_index == 0)
- return null;
- return constant_pool.getClassInfo(outer_class_info_index);
- }
-
- public String getInnerName(ConstantPool constant_pool) throws ConstantPoolException {
- if (inner_name_index == 0)
- return null;
- return constant_pool.getUTF8Value(inner_name_index);
- }
-
- public static int length() {
- return 8;
- }
-
- public final int inner_class_info_index;
- public final int outer_class_info_index;
- public final int inner_name_index;
- public final AccessFlags inner_class_access_flags;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Instruction.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,353 +0,0 @@
-/*
- * Copyright (c) 2009, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.util.Locale;
-
-/**
- * See JVMS, chapter 6.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @see Code_attribute#getInstructions
- */
-public class Instruction {
- /** The kind of an instruction, as determined by the position, size and
- * types of its operands. */
- public static enum Kind {
- /** Opcode is not followed by any operands. */
- NO_OPERANDS(1),
- /** Opcode is followed by a byte indicating a type. */
- ATYPE(2),
- /** Opcode is followed by a 2-byte branch offset. */
- BRANCH(3),
- /** Opcode is followed by a 4-byte branch offset. */
- BRANCH_W(5),
- /** Opcode is followed by a signed byte value. */
- BYTE(2),
- /** Opcode is followed by a 1-byte index into the constant pool. */
- CPREF(2),
- /** Opcode is followed by a 2-byte index into the constant pool. */
- CPREF_W(3),
- /** Opcode is followed by a 2-byte index into the constant pool,
- * an unsigned byte value. */
- CPREF_W_UBYTE(4),
- /** Opcode is followed by a 2-byte index into the constant pool.,
- * an unsigned byte value, and a zero byte. */
- CPREF_W_UBYTE_ZERO(5),
- /** Opcode is followed by variable number of operands, depending
- * on the instruction.*/
- DYNAMIC(-1),
- /** Opcode is followed by a 1-byte reference to a local variable. */
- LOCAL(2),
- /** Opcode is followed by a 1-byte reference to a local variable,
- * and a signed byte value. */
- LOCAL_BYTE(3),
- /** Opcode is followed by a signed short value. */
- SHORT(3),
- /** Wide opcode is not followed by any operands. */
- WIDE_NO_OPERANDS(2),
- /** Wide opcode is followed by a 2-byte index into the local variables array. */
- WIDE_LOCAL(4),
- /** Wide opcode is followed by a 2-byte index into the constant pool. */
- WIDE_CPREF_W(4),
- /** Wide opcode is followed by a 2-byte index into the constant pool,
- * and a signed short value. */
- WIDE_CPREF_W_SHORT(6),
- /** Wide opcode is followed by a 2-byte reference to a local variable,
- * and a signed short value. */
- WIDE_LOCAL_SHORT(6),
- /** Opcode was not recognized. */
- UNKNOWN(1);
-
- Kind(int length) {
- this.length = length;
- }
-
- /** The length, in bytes, of this kind of instruction, or -1 is the
- * length depends on the specific instruction. */
- public final int length;
- }
-
- /** A utility visitor to help decode the operands of an instruction.
- * @see Instruction#accept */
- public interface KindVisitor<R,P> {
- /** See {@link Kind#NO_OPERANDS}, {@link Kind#WIDE_NO_OPERANDS}. */
- R visitNoOperands(Instruction instr, P p);
- /** See {@link Kind#ATYPE}. */
- R visitArrayType(Instruction instr, TypeKind kind, P p);
- /** See {@link Kind#BRANCH}, {@link Kind#BRANCH_W}. */
- R visitBranch(Instruction instr, int offset, P p);
- /** See {@link Kind#CPREF}, {@link Kind#CPREF_W}, {@link Kind#WIDE_CPREF_W}. */
- R visitConstantPoolRef(Instruction instr, int index, P p);
- /** See {@link Kind#CPREF_W_UBYTE}, {@link Kind#CPREF_W_UBYTE_ZERO}, {@link Kind#WIDE_CPREF_W_SHORT}. */
- R visitConstantPoolRefAndValue(Instruction instr, int index, int value, P p);
- /** See {@link Kind#LOCAL}, {@link Kind#WIDE_LOCAL}. */
- R visitLocal(Instruction instr, int index, P p);
- /** See {@link Kind#LOCAL_BYTE}. */
- R visitLocalAndValue(Instruction instr, int index, int value, P p);
- /** See {@link Kind#DYNAMIC}. */
- R visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, P p);
- /** See {@link Kind#DYNAMIC}. */
- R visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, P p);
- /** See {@link Kind#BYTE}, {@link Kind#SHORT}. */
- R visitValue(Instruction instr, int value, P p);
- /** Instruction is unrecognized. */
- R visitUnknown(Instruction instr, P p);
-
- }
-
- /** The kind of primitive array type to create.
- * See JVMS chapter 6, newarray. */
- public static enum TypeKind {
- T_BOOLEAN(4, "boolean"),
- T_CHAR(5, "char"),
- T_FLOAT(6, "float"),
- T_DOUBLE(7, "double"),
- T_BYTE(8, "byte"),
- T_SHORT(9, "short"),
- T_INT (10, "int"),
- T_LONG (11, "long");
- TypeKind(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- public static TypeKind get(int value) {
- switch (value) {
- case 4: return T_BOOLEAN;
- case 5: return T_CHAR;
- case 6: return T_FLOAT;
- case 7: return T_DOUBLE;
- case 8: return T_BYTE;
- case 9: return T_SHORT;
- case 10: return T_INT;
- case 11: return T_LONG;
- default: return null;
- }
- }
-
- public final int value;
- public final String name;
- }
-
- /** An instruction is defined by its position in a bytecode array. */
- public Instruction(byte[] bytes, int pc) {
- this.bytes = bytes;
- this.pc = pc;
- }
-
- /** Get the position of the instruction within the bytecode array. */
- public int getPC() {
- return pc;
- }
-
- /** Get a byte value, relative to the start of this instruction. */
- public int getByte(int offset) {
- return bytes[pc + offset];
- }
-
- /** Get an unsigned byte value, relative to the start of this instruction. */
- public int getUnsignedByte(int offset) {
- return getByte(offset) & 0xff;
- }
-
- /** Get a 2-byte value, relative to the start of this instruction. */
- public int getShort(int offset) {
- return (getByte(offset) << 8) | getUnsignedByte(offset + 1);
- }
-
- /** Get a unsigned 2-byte value, relative to the start of this instruction. */
- public int getUnsignedShort(int offset) {
- return getShort(offset) & 0xFFFF;
- }
-
- /** Get a 4-byte value, relative to the start of this instruction. */
- public int getInt(int offset) {
- return (getShort(offset) << 16) | (getUnsignedShort(offset + 2));
- }
-
- /** Get the Opcode for this instruction, or null if the instruction is
- * unrecognized. */
- public Opcode getOpcode() {
- int b = getUnsignedByte(0);
- switch (b) {
- case Opcode.NONPRIV:
- case Opcode.PRIV:
- case Opcode.WIDE:
- return Opcode.get(b, getUnsignedByte(1));
- }
- return Opcode.get(b);
- }
-
- /** Get the mnemonic for this instruction, or a default string if the
- * instruction is unrecognized. */
- public String getMnemonic() {
- Opcode opcode = getOpcode();
- if (opcode == null)
- return "bytecode " + getUnsignedByte(0);
- else
- return opcode.toString().toLowerCase(Locale.US);
- }
-
- /** Get the length, in bytes, of this instruction, including the opcode
- * and all its operands. */
- public int length() {
- Opcode opcode = getOpcode();
- if (opcode == null)
- return 1;
-
- switch (opcode) {
- case TABLESWITCH: {
- int pad = align(pc + 1) - pc;
- int low = getInt(pad + 4);
- int high = getInt(pad + 8);
- return pad + 12 + 4 * (high - low + 1);
- }
- case LOOKUPSWITCH: {
- int pad = align(pc + 1) - pc;
- int npairs = getInt(pad + 4);
- return pad + 8 + 8 * npairs;
-
- }
- default:
- return opcode.kind.length;
- }
- }
-
- /** Get the {@link Kind} of this instruction. */
- public Kind getKind() {
- Opcode opcode = getOpcode();
- return (opcode != null ? opcode.kind : Kind.UNKNOWN);
- }
-
- /** Invoke a method on the visitor according to the kind of this
- * instruction, passing in the decoded operands for the instruction. */
- public <R,P> R accept(KindVisitor<R,P> visitor, P p) {
- switch (getKind()) {
- case NO_OPERANDS:
- return visitor.visitNoOperands(this, p);
-
- case ATYPE:
- return visitor.visitArrayType(
- this, TypeKind.get(getUnsignedByte(1)), p);
-
- case BRANCH:
- return visitor.visitBranch(this, getShort(1), p);
-
- case BRANCH_W:
- return visitor.visitBranch(this, getInt(1), p);
-
- case BYTE:
- return visitor.visitValue(this, getByte(1), p);
-
- case CPREF:
- return visitor.visitConstantPoolRef(this, getUnsignedByte(1), p);
-
- case CPREF_W:
- return visitor.visitConstantPoolRef(this, getUnsignedShort(1), p);
-
- case CPREF_W_UBYTE:
- case CPREF_W_UBYTE_ZERO:
- return visitor.visitConstantPoolRefAndValue(
- this, getUnsignedShort(1), getUnsignedByte(3), p);
-
- case DYNAMIC: {
- switch (getOpcode()) {
- case TABLESWITCH: {
- int pad = align(pc + 1) - pc;
- int default_ = getInt(pad);
- int low = getInt(pad + 4);
- int high = getInt(pad + 8);
- int[] values = new int[high - low + 1];
- for (int i = 0; i < values.length; i++)
- values[i] = getInt(pad + 12 + 4 * i);
- return visitor.visitTableSwitch(
- this, default_, low, high, values, p);
- }
- case LOOKUPSWITCH: {
- int pad = align(pc + 1) - pc;
- int default_ = getInt(pad);
- int npairs = getInt(pad + 4);
- int[] matches = new int[npairs];
- int[] offsets = new int[npairs];
- for (int i = 0; i < npairs; i++) {
- matches[i] = getInt(pad + 8 + i * 8);
- offsets[i] = getInt(pad + 12 + i * 8);
- }
- return visitor.visitLookupSwitch(
- this, default_, npairs, matches, offsets, p);
- }
- default:
- throw new IllegalStateException();
- }
- }
-
- case LOCAL:
- return visitor.visitLocal(this, getUnsignedByte(1), p);
-
- case LOCAL_BYTE:
- return visitor.visitLocalAndValue(
- this, getUnsignedByte(1), getByte(2), p);
-
- case SHORT:
- return visitor.visitValue(this, getShort(1), p);
-
- case WIDE_NO_OPERANDS:
- return visitor.visitNoOperands(this, p);
-
- case WIDE_LOCAL:
- return visitor.visitLocal(this, getUnsignedShort(2), p);
-
- case WIDE_CPREF_W:
- return visitor.visitConstantPoolRef(this, getUnsignedShort(2), p);
-
- case WIDE_CPREF_W_SHORT:
- return visitor.visitConstantPoolRefAndValue(
- this, getUnsignedShort(2), getUnsignedByte(4), p);
-
- case WIDE_LOCAL_SHORT:
- return visitor.visitLocalAndValue(
- this, getUnsignedShort(2), getShort(4), p);
-
- case UNKNOWN:
- return visitor.visitUnknown(this, p);
-
- default:
- throw new IllegalStateException();
- }
- }
-
- private static int align(int n) {
- return (n + 3) & ~3;
- }
-
- private byte[] bytes;
- private int pc;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/LineNumberTable_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.12.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class LineNumberTable_attribute extends Attribute {
- LineNumberTable_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- line_number_table_length = cr.readUnsignedShort();
- line_number_table = new Entry[line_number_table_length];
- for (int i = 0; i < line_number_table_length; i++)
- line_number_table[i] = new Entry(cr);
- }
-
- public LineNumberTable_attribute(ConstantPool constant_pool, Entry[] line_number_table)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.LineNumberTable), line_number_table);
- }
-
- public LineNumberTable_attribute(int name_index, Entry[] line_number_table) {
- super(name_index, 2 + line_number_table.length * Entry.length());
- this.line_number_table_length = line_number_table.length;
- this.line_number_table = line_number_table;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitLineNumberTable(this, data);
- }
-
- public final int line_number_table_length;
- public final Entry[] line_number_table;
-
- public static class Entry {
- Entry(ClassReader cr) throws IOException {
- start_pc = cr.readUnsignedShort();
- line_number = cr.readUnsignedShort();
- }
-
- public static int length() {
- return 4;
- }
-
- public final int start_pc;
- public final int line_number;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/LocalVariableTable_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.13.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class LocalVariableTable_attribute extends Attribute {
- LocalVariableTable_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- local_variable_table_length = cr.readUnsignedShort();
- local_variable_table = new Entry[local_variable_table_length];
- for (int i = 0; i < local_variable_table_length; i++)
- local_variable_table[i] = new Entry(cr);
- }
-
- public LocalVariableTable_attribute(ConstantPool constant_pool, Entry[] local_variable_table)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.LocalVariableTable), local_variable_table);
- }
-
- public LocalVariableTable_attribute(int name_index, Entry[] local_variable_table) {
- super(name_index, 2 + local_variable_table.length * Entry.length());
- this.local_variable_table_length = local_variable_table.length;
- this.local_variable_table = local_variable_table;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitLocalVariableTable(this, data);
- }
-
- public final int local_variable_table_length;
- public final Entry[] local_variable_table;
-
- public static class Entry {
- Entry(ClassReader cr) throws IOException {
- start_pc = cr.readUnsignedShort();
- length = cr.readUnsignedShort();
- name_index = cr.readUnsignedShort();
- descriptor_index = cr.readUnsignedShort();
- index = cr.readUnsignedShort();
- }
-
- public static int length() {
- return 10;
- }
-
- public final int start_pc;
- public final int length;
- public final int name_index;
- public final int descriptor_index;
- public final int index;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/LocalVariableTypeTable_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.14.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class LocalVariableTypeTable_attribute extends Attribute {
- LocalVariableTypeTable_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- local_variable_table_length = cr.readUnsignedShort();
- local_variable_table = new Entry[local_variable_table_length];
- for (int i = 0; i < local_variable_table_length; i++)
- local_variable_table[i] = new Entry(cr);
- }
-
- public LocalVariableTypeTable_attribute(ConstantPool constant_pool, Entry[] local_variable_table)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.LocalVariableTypeTable), local_variable_table);
- }
-
- public LocalVariableTypeTable_attribute(int name_index, Entry[] local_variable_table) {
- super(name_index, 2 + local_variable_table.length * Entry.length());
- this.local_variable_table_length = local_variable_table.length;
- this.local_variable_table = local_variable_table;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitLocalVariableTypeTable(this, data);
- }
-
- public final int local_variable_table_length;
- public final Entry[] local_variable_table;
-
- public static class Entry {
- Entry(ClassReader cr) throws IOException {
- start_pc = cr.readUnsignedShort();
- length = cr.readUnsignedShort();
- name_index = cr.readUnsignedShort();
- signature_index = cr.readUnsignedShort();
- index = cr.readUnsignedShort();
- }
-
- public static int length() {
- return 10;
- }
-
- public final int start_pc;
- public final int length;
- public final int name_index;
- public final int signature_index;
- public final int index;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Method.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/*
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Method {
- Method(ClassReader cr) throws IOException {
- access_flags = new AccessFlags(cr);
- name_index = cr.readUnsignedShort();
- descriptor = new Descriptor(cr);
- attributes = new Attributes(cr);
- }
-
- public Method(AccessFlags access_flags,
- int name_index, Descriptor descriptor,
- Attributes attributes) {
- this.access_flags = access_flags;
- this.name_index = name_index;
- this.descriptor = descriptor;
- this.attributes = attributes;
- }
-
- public int byteLength() {
- return 6 + attributes.byteLength();
- }
-
- public String getName(ConstantPool constant_pool) throws ConstantPoolException {
- return constant_pool.getUTF8Value(name_index);
- }
-
- public final AccessFlags access_flags;
- public final int name_index;
- public final Descriptor descriptor;
- public final Attributes attributes;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/MethodParameters_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.13.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class MethodParameters_attribute extends Attribute {
-
- public final int method_parameter_table_length;
- public final Entry[] method_parameter_table;
-
- MethodParameters_attribute(ClassReader cr,
- int name_index,
- int length)
- throws IOException {
- super(name_index, length);
-
- method_parameter_table_length = cr.readUnsignedByte();
- method_parameter_table = new Entry[method_parameter_table_length];
- for (int i = 0; i < method_parameter_table_length; i++)
- method_parameter_table[i] = new Entry(cr);
- }
-
- public MethodParameters_attribute(ConstantPool constant_pool,
- Entry[] method_parameter_table)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.MethodParameters),
- method_parameter_table);
- }
-
- public MethodParameters_attribute(int name_index,
- Entry[] method_parameter_table) {
- super(name_index, 1 + method_parameter_table.length * Entry.length());
- this.method_parameter_table_length = method_parameter_table.length;
- this.method_parameter_table = method_parameter_table;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitMethodParameters(this, data);
- }
-
- public static class Entry {
- Entry(ClassReader cr) throws IOException {
- name_index = cr.readUnsignedShort();
- flags = cr.readUnsignedShort();
- }
-
- public static int length() {
- return 6;
- }
-
- public final int name_index;
- public final int flags;
- }
-
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Opcode.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,472 +0,0 @@
-/*
- * Copyright (c) 2009, 2012, 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.
- */
-
-package com.sun.tools.classfile;
-
-import static com.sun.tools.classfile.Instruction.Kind.*;
-import static com.sun.tools.classfile.Opcode.Set.*;
-
-/**
- * See JVMS, chapter 6.
- *
- * <p>In addition to providing all the standard opcodes defined in JVMS,
- * this class also provides legacy support for the PicoJava extensions.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public enum Opcode {
- NOP(0x0),
- ACONST_NULL(0x1),
- ICONST_M1(0x2),
- ICONST_0(0x3),
- ICONST_1(0x4),
- ICONST_2(0x5),
- ICONST_3(0x6),
- ICONST_4(0x7),
- ICONST_5(0x8),
- LCONST_0(0x9),
- LCONST_1(0xa),
- FCONST_0(0xb),
- FCONST_1(0xc),
- FCONST_2(0xd),
- DCONST_0(0xe),
- DCONST_1(0xf),
- BIPUSH(0x10, BYTE),
- SIPUSH(0x11, SHORT),
- LDC(0x12, CPREF),
- LDC_W(0x13, CPREF_W),
- LDC2_W(0x14, CPREF_W),
- ILOAD(0x15, LOCAL),
- LLOAD(0x16, LOCAL),
- FLOAD(0x17, LOCAL),
- DLOAD(0x18, LOCAL),
- ALOAD(0x19, LOCAL),
- ILOAD_0(0x1a),
- ILOAD_1(0x1b),
- ILOAD_2(0x1c),
- ILOAD_3(0x1d),
- LLOAD_0(0x1e),
- LLOAD_1(0x1f),
- LLOAD_2(0x20),
- LLOAD_3(0x21),
- FLOAD_0(0x22),
- FLOAD_1(0x23),
- FLOAD_2(0x24),
- FLOAD_3(0x25),
- DLOAD_0(0x26),
- DLOAD_1(0x27),
- DLOAD_2(0x28),
- DLOAD_3(0x29),
- ALOAD_0(0x2a),
- ALOAD_1(0x2b),
- ALOAD_2(0x2c),
- ALOAD_3(0x2d),
- IALOAD(0x2e),
- LALOAD(0x2f),
- FALOAD(0x30),
- DALOAD(0x31),
- AALOAD(0x32),
- BALOAD(0x33),
- CALOAD(0x34),
- SALOAD(0x35),
- ISTORE(0x36, LOCAL),
- LSTORE(0x37, LOCAL),
- FSTORE(0x38, LOCAL),
- DSTORE(0x39, LOCAL),
- ASTORE(0x3a, LOCAL),
- ISTORE_0(0x3b),
- ISTORE_1(0x3c),
- ISTORE_2(0x3d),
- ISTORE_3(0x3e),
- LSTORE_0(0x3f),
- LSTORE_1(0x40),
- LSTORE_2(0x41),
- LSTORE_3(0x42),
- FSTORE_0(0x43),
- FSTORE_1(0x44),
- FSTORE_2(0x45),
- FSTORE_3(0x46),
- DSTORE_0(0x47),
- DSTORE_1(0x48),
- DSTORE_2(0x49),
- DSTORE_3(0x4a),
- ASTORE_0(0x4b),
- ASTORE_1(0x4c),
- ASTORE_2(0x4d),
- ASTORE_3(0x4e),
- IASTORE(0x4f),
- LASTORE(0x50),
- FASTORE(0x51),
- DASTORE(0x52),
- AASTORE(0x53),
- BASTORE(0x54),
- CASTORE(0x55),
- SASTORE(0x56),
- POP(0x57),
- POP2(0x58),
- DUP(0x59),
- DUP_X1(0x5a),
- DUP_X2(0x5b),
- DUP2(0x5c),
- DUP2_X1(0x5d),
- DUP2_X2(0x5e),
- SWAP(0x5f),
- IADD(0x60),
- LADD(0x61),
- FADD(0x62),
- DADD(0x63),
- ISUB(0x64),
- LSUB(0x65),
- FSUB(0x66),
- DSUB(0x67),
- IMUL(0x68),
- LMUL(0x69),
- FMUL(0x6a),
- DMUL(0x6b),
- IDIV(0x6c),
- LDIV(0x6d),
- FDIV(0x6e),
- DDIV(0x6f),
- IREM(0x70),
- LREM(0x71),
- FREM(0x72),
- DREM(0x73),
- INEG(0x74),
- LNEG(0x75),
- FNEG(0x76),
- DNEG(0x77),
- ISHL(0x78),
- LSHL(0x79),
- ISHR(0x7a),
- LSHR(0x7b),
- IUSHR(0x7c),
- LUSHR(0x7d),
- IAND(0x7e),
- LAND(0x7f),
- IOR(0x80),
- LOR(0x81),
- IXOR(0x82),
- LXOR(0x83),
- IINC(0x84, LOCAL_BYTE),
- I2L(0x85),
- I2F(0x86),
- I2D(0x87),
- L2I(0x88),
- L2F(0x89),
- L2D(0x8a),
- F2I(0x8b),
- F2L(0x8c),
- F2D(0x8d),
- D2I(0x8e),
- D2L(0x8f),
- D2F(0x90),
- I2B(0x91),
- I2C(0x92),
- I2S(0x93),
- LCMP(0x94),
- FCMPL(0x95),
- FCMPG(0x96),
- DCMPL(0x97),
- DCMPG(0x98),
- IFEQ(0x99, BRANCH),
- IFNE(0x9a, BRANCH),
- IFLT(0x9b, BRANCH),
- IFGE(0x9c, BRANCH),
- IFGT(0x9d, BRANCH),
- IFLE(0x9e, BRANCH),
- IF_ICMPEQ(0x9f, BRANCH),
- IF_ICMPNE(0xa0, BRANCH),
- IF_ICMPLT(0xa1, BRANCH),
- IF_ICMPGE(0xa2, BRANCH),
- IF_ICMPGT(0xa3, BRANCH),
- IF_ICMPLE(0xa4, BRANCH),
- IF_ACMPEQ(0xa5, BRANCH),
- IF_ACMPNE(0xa6, BRANCH),
- GOTO(0xa7, BRANCH),
- JSR(0xa8, BRANCH),
- RET(0xa9, LOCAL),
- TABLESWITCH(0xaa, DYNAMIC),
- LOOKUPSWITCH(0xab, DYNAMIC),
- IRETURN(0xac),
- LRETURN(0xad),
- FRETURN(0xae),
- DRETURN(0xaf),
- ARETURN(0xb0),
- RETURN(0xb1),
- GETSTATIC(0xb2, CPREF_W),
- PUTSTATIC(0xb3, CPREF_W),
- GETFIELD(0xb4, CPREF_W),
- PUTFIELD(0xb5, CPREF_W),
- INVOKEVIRTUAL(0xb6, CPREF_W),
- INVOKESPECIAL(0xb7, CPREF_W),
- INVOKESTATIC(0xb8, CPREF_W),
- INVOKEINTERFACE(0xb9, CPREF_W_UBYTE_ZERO),
- INVOKEDYNAMIC(0xba, CPREF_W_UBYTE_ZERO),
- NEW(0xbb, CPREF_W),
- NEWARRAY(0xbc, ATYPE),
- ANEWARRAY(0xbd, CPREF_W),
- ARRAYLENGTH(0xbe),
- ATHROW(0xbf),
- CHECKCAST(0xc0, CPREF_W),
- INSTANCEOF(0xc1, CPREF_W),
- MONITORENTER(0xc2),
- MONITOREXIT(0xc3),
- // wide 0xc4
- MULTIANEWARRAY(0xc5, CPREF_W_UBYTE),
- IFNULL(0xc6, BRANCH),
- IFNONNULL(0xc7, BRANCH),
- GOTO_W(0xc8, BRANCH_W),
- JSR_W(0xc9, BRANCH_W),
- // impdep 0xfe: PicoJava nonpriv
- // impdep 0xff: Picojava priv
-
- // wide opcodes
- ILOAD_W(0xc415, WIDE_LOCAL),
- LLOAD_W(0xc416, WIDE_LOCAL),
- FLOAD_W(0xc417, WIDE_LOCAL),
- DLOAD_W(0xc418, WIDE_LOCAL),
- ALOAD_W(0xc419, WIDE_LOCAL),
- ISTORE_W(0xc436, WIDE_LOCAL),
- LSTORE_W(0xc437, WIDE_LOCAL),
- FSTORE_W(0xc438, WIDE_LOCAL),
- DSTORE_W(0xc439, WIDE_LOCAL),
- ASTORE_W(0xc43a, WIDE_LOCAL),
- IINC_W(0xc484, WIDE_LOCAL_SHORT),
- RET_W(0xc4a9, WIDE_LOCAL),
-
- // PicoJava nonpriv instructions
- LOAD_UBYTE(PICOJAVA, 0xfe00),
- LOAD_BYTE(PICOJAVA, 0xfe01),
- LOAD_CHAR(PICOJAVA, 0xfe02),
- LOAD_SHORT(PICOJAVA, 0xfe03),
- LOAD_WORD(PICOJAVA, 0xfe04),
- RET_FROM_SUB(PICOJAVA, 0xfe05),
- LOAD_CHAR_OE(PICOJAVA, 0xfe0a),
- LOAD_SHORT_OE(PICOJAVA, 0xfe0b),
- LOAD_WORD_OE(PICOJAVA, 0xfe0c),
- NCLOAD_UBYTE(PICOJAVA, 0xfe10),
- NCLOAD_BYTE(PICOJAVA, 0xfe11),
- NCLOAD_CHAR(PICOJAVA, 0xfe12),
- NCLOAD_SHORT(PICOJAVA, 0xfe13),
- NCLOAD_WORD(PICOJAVA, 0xfe14),
- NCLOAD_CHAR_OE(PICOJAVA, 0xfe1a),
- NCLOAD_SHORT_OE(PICOJAVA, 0xfe1b),
- NCLOAD_WORD_OE(PICOJAVA, 0xfe1c),
- CACHE_FLUSH(PICOJAVA, 0xfe1e),
- STORE_BYTE(PICOJAVA, 0xfe20),
- STORE_SHORT(PICOJAVA, 0xfe22),
- STORE_WORD(PICOJAVA, 0xfe24),
- STORE_SHORT_OE(PICOJAVA, 0xfe2a),
- STORE_WORD_OE(PICOJAVA, 0xfe2c),
- NCSTORE_BYTE(PICOJAVA, 0xfe30),
- NCSTORE_SHORT(PICOJAVA, 0xfe32),
- NCSTORE_WORD(PICOJAVA, 0xfe34),
- NCSTORE_SHORT_OE(PICOJAVA, 0xfe3a),
- NCSTORE_WORD_OE(PICOJAVA, 0xfe3c),
- ZERO_LINE(PICOJAVA, 0xfe3e),
- ENTER_SYNC_METHOD(PICOJAVA, 0xfe3f),
-
- // PicoJava priv instructions
- PRIV_LOAD_UBYTE(PICOJAVA, 0xff00),
- PRIV_LOAD_BYTE(PICOJAVA, 0xff01),
- PRIV_LOAD_CHAR(PICOJAVA, 0xff02),
- PRIV_LOAD_SHORT(PICOJAVA, 0xff03),
- PRIV_LOAD_WORD(PICOJAVA, 0xff04),
- PRIV_RET_FROM_TRAP(PICOJAVA, 0xff05),
- PRIV_READ_DCACHE_TAG(PICOJAVA, 0xff06),
- PRIV_READ_DCACHE_DATA(PICOJAVA, 0xff07),
- PRIV_LOAD_CHAR_OE(PICOJAVA, 0xff0a),
- PRIV_LOAD_SHORT_OE(PICOJAVA, 0xff0b),
- PRIV_LOAD_WORD_OE(PICOJAVA, 0xff0c),
- PRIV_READ_ICACHE_TAG(PICOJAVA, 0xff0e),
- PRIV_READ_ICACHE_DATA(PICOJAVA, 0xff0f),
- PRIV_NCLOAD_UBYTE(PICOJAVA, 0xff10),
- PRIV_NCLOAD_BYTE(PICOJAVA, 0xff11),
- PRIV_NCLOAD_CHAR(PICOJAVA, 0xff12),
- PRIV_NCLOAD_SHORT(PICOJAVA, 0xff13),
- PRIV_NCLOAD_WORD(PICOJAVA, 0xff14),
- PRIV_POWERDOWN(PICOJAVA, 0xff16),
- PRIV_READ_SCACHE_DATA(PICOJAVA, 0xff17),
- PRIV_NCLOAD_CHAR_OE(PICOJAVA, 0xff1a),
- PRIV_NCLOAD_SHORT_OE(PICOJAVA, 0xff1b),
- PRIV_NCLOAD_WORD_OE(PICOJAVA, 0xff1c),
- PRIV_CACHE_FLUSH(PICOJAVA, 0xff1e),
- PRIV_CACHE_INDEX_FLUSH(PICOJAVA, 0xff1f),
- PRIV_STORE_BYTE(PICOJAVA, 0xff20),
- PRIV_STORE_SHORT(PICOJAVA, 0xff22),
- PRIV_STORE_WORD(PICOJAVA, 0xff24),
- PRIV_WRITE_DCACHE_TAG(PICOJAVA, 0xff26),
- PRIV_WRITE_DCACHE_DATA(PICOJAVA, 0xff27),
- PRIV_STORE_SHORT_OE(PICOJAVA, 0xff2a),
- PRIV_STORE_WORD_OE(PICOJAVA, 0xff2c),
- PRIV_WRITE_ICACHE_TAG(PICOJAVA, 0xff2e),
- PRIV_WRITE_ICACHE_DATA(PICOJAVA, 0xff2f),
- PRIV_NCSTORE_BYTE(PICOJAVA, 0xff30),
- PRIV_NCSTORE_SHORT(PICOJAVA, 0xff32),
- PRIV_NCSTORE_WORD(PICOJAVA, 0xff34),
- PRIV_RESET(PICOJAVA, 0xff36),
- PRIV_WRITE_SCACHE_DATA(PICOJAVA, 0xff37),
- PRIV_NCSTORE_SHORT_OE(PICOJAVA, 0xff3a),
- PRIV_NCSTORE_WORD_OE(PICOJAVA, 0xff3c),
- PRIV_ZERO_LINE(PICOJAVA, 0xff3e),
- PRIV_READ_REG_0(PICOJAVA, 0xff40),
- PRIV_READ_REG_1(PICOJAVA, 0xff41),
- PRIV_READ_REG_2(PICOJAVA, 0xff42),
- PRIV_READ_REG_3(PICOJAVA, 0xff43),
- PRIV_READ_REG_4(PICOJAVA, 0xff44),
- PRIV_READ_REG_5(PICOJAVA, 0xff45),
- PRIV_READ_REG_6(PICOJAVA, 0xff46),
- PRIV_READ_REG_7(PICOJAVA, 0xff47),
- PRIV_READ_REG_8(PICOJAVA, 0xff48),
- PRIV_READ_REG_9(PICOJAVA, 0xff49),
- PRIV_READ_REG_10(PICOJAVA, 0xff4a),
- PRIV_READ_REG_11(PICOJAVA, 0xff4b),
- PRIV_READ_REG_12(PICOJAVA, 0xff4c),
- PRIV_READ_REG_13(PICOJAVA, 0xff4d),
- PRIV_READ_REG_14(PICOJAVA, 0xff4e),
- PRIV_READ_REG_15(PICOJAVA, 0xff4f),
- PRIV_READ_REG_16(PICOJAVA, 0xff50),
- PRIV_READ_REG_17(PICOJAVA, 0xff51),
- PRIV_READ_REG_18(PICOJAVA, 0xff52),
- PRIV_READ_REG_19(PICOJAVA, 0xff53),
- PRIV_READ_REG_20(PICOJAVA, 0xff54),
- PRIV_READ_REG_21(PICOJAVA, 0xff55),
- PRIV_READ_REG_22(PICOJAVA, 0xff56),
- PRIV_READ_REG_23(PICOJAVA, 0xff57),
- PRIV_READ_REG_24(PICOJAVA, 0xff58),
- PRIV_READ_REG_25(PICOJAVA, 0xff59),
- PRIV_READ_REG_26(PICOJAVA, 0xff5a),
- PRIV_READ_REG_27(PICOJAVA, 0xff5b),
- PRIV_READ_REG_28(PICOJAVA, 0xff5c),
- PRIV_READ_REG_29(PICOJAVA, 0xff5d),
- PRIV_READ_REG_30(PICOJAVA, 0xff5e),
- PRIV_READ_REG_31(PICOJAVA, 0xff5f),
- PRIV_WRITE_REG_0(PICOJAVA, 0xff60),
- PRIV_WRITE_REG_1(PICOJAVA, 0xff61),
- PRIV_WRITE_REG_2(PICOJAVA, 0xff62),
- PRIV_WRITE_REG_3(PICOJAVA, 0xff63),
- PRIV_WRITE_REG_4(PICOJAVA, 0xff64),
- PRIV_WRITE_REG_5(PICOJAVA, 0xff65),
- PRIV_WRITE_REG_6(PICOJAVA, 0xff66),
- PRIV_WRITE_REG_7(PICOJAVA, 0xff67),
- PRIV_WRITE_REG_8(PICOJAVA, 0xff68),
- PRIV_WRITE_REG_9(PICOJAVA, 0xff69),
- PRIV_WRITE_REG_10(PICOJAVA, 0xff6a),
- PRIV_WRITE_REG_11(PICOJAVA, 0xff6b),
- PRIV_WRITE_REG_12(PICOJAVA, 0xff6c),
- PRIV_WRITE_REG_13(PICOJAVA, 0xff6d),
- PRIV_WRITE_REG_14(PICOJAVA, 0xff6e),
- PRIV_WRITE_REG_15(PICOJAVA, 0xff6f),
- PRIV_WRITE_REG_16(PICOJAVA, 0xff70),
- PRIV_WRITE_REG_17(PICOJAVA, 0xff71),
- PRIV_WRITE_REG_18(PICOJAVA, 0xff72),
- PRIV_WRITE_REG_19(PICOJAVA, 0xff73),
- PRIV_WRITE_REG_20(PICOJAVA, 0xff74),
- PRIV_WRITE_REG_21(PICOJAVA, 0xff75),
- PRIV_WRITE_REG_22(PICOJAVA, 0xff76),
- PRIV_WRITE_REG_23(PICOJAVA, 0xff77),
- PRIV_WRITE_REG_24(PICOJAVA, 0xff78),
- PRIV_WRITE_REG_25(PICOJAVA, 0xff79),
- PRIV_WRITE_REG_26(PICOJAVA, 0xff7a),
- PRIV_WRITE_REG_27(PICOJAVA, 0xff7b),
- PRIV_WRITE_REG_28(PICOJAVA, 0xff7c),
- PRIV_WRITE_REG_29(PICOJAVA, 0xff7d),
- PRIV_WRITE_REG_30(PICOJAVA, 0xff7e),
- PRIV_WRITE_REG_31(PICOJAVA, 0xff7f);
-
- Opcode(int opcode) {
- this(STANDARD, opcode, NO_OPERANDS);
- }
-
- Opcode(int opcode, Instruction.Kind kind) {
- this(STANDARD, opcode, kind);
- }
-
- Opcode(Set set, int opcode) {
- this(set, opcode, (set == STANDARD ? NO_OPERANDS : WIDE_NO_OPERANDS));
- }
-
- Opcode(Set set, int opcode, Instruction.Kind kind) {
- this.set = set;
- this.opcode = opcode;
- this.kind = kind;
- }
-
- public final Set set;
- public final int opcode;
- public final Instruction.Kind kind;
-
- /** Get the Opcode for a simple standard 1-byte opcode. */
- public static Opcode get(int opcode) {
- return stdOpcodes[opcode];
- }
-
- /** Get the Opcode for 1- or 2-byte opcode. */
- public static Opcode get(int opcodePrefix, int opcode) {
- Opcode[] block = getOpcodeBlock(opcodePrefix);
- return (block == null ? null : block[opcode]);
- }
-
- private static Opcode[] getOpcodeBlock(int opcodePrefix) {
- switch (opcodePrefix) {
- case 0:
- return stdOpcodes;
- case WIDE:
- return wideOpcodes;
- case NONPRIV:
- return nonPrivOpcodes;
- case PRIV:
- return privOpcodes;
- default:
- return null;
- }
-
- }
-
- private static final Opcode[] stdOpcodes = new Opcode[256];
- private static final Opcode[] wideOpcodes = new Opcode[256];
- private static final Opcode[] nonPrivOpcodes = new Opcode[256];
- private static final Opcode[] privOpcodes = new Opcode[256];
- static {
- for (Opcode o: values())
- getOpcodeBlock(o.opcode >> 8)[o.opcode & 0xff] = o;
- }
-
- /** The byte prefix for the wide instructions. */
- public static final int WIDE = 0xc4;
- /** The byte prefix for the PicoJava nonpriv instructions. */
- public static final int NONPRIV = 0xfe;
- /** The byte prefix for the PicoJava priv instructions. */
- public static final int PRIV = 0xff;
-
- public enum Set {
- /** Standard opcodes. */
- STANDARD,
- /** Legacy support for PicoJava opcodes. */
- PICOJAVA }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/ReferenceFinder.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import com.sun.tools.classfile.Instruction.TypeKind;
-import static com.sun.tools.classfile.ConstantPool.*;
-
-/**
- * A utility class to find where in a ClassFile references
- * a {@link CONSTANT_Methodref_info method},
- * a {@link CONSTANT_InterfaceMethodref_info interface method,
- * or a {@link CONSTANT_Fieldref_info field}.
- */
-public final class ReferenceFinder {
- /**
- * Filter for ReferenceFinder of what constant pool entries for reference lookup.
- */
- public interface Filter {
- /**
- * Decides if the given CPRefInfo entry should be accepted or filtered.
- *
- * @param cpool ConstantPool of the ClassFile being parsed
- * @param cpref constant pool entry representing a reference to
- * a fields method, and interface method.
- * @return {@code true} if accepted; otherwise {@code false}
- */
- boolean accept(ConstantPool cpool, CPRefInfo cpref);
- }
-
- /**
- * Visitor of individual method of a ClassFile that references the
- * accepted field, method, or interface method references.
- */
- public interface Visitor {
- /**
- * Invoked for a method containing one or more accepted CPRefInfo entries
- *
- * @param cf ClassFile
- * @param method Method that does the references the accepted references
- * @param refs Accepted constant pool method/field reference
- */
- void visit(ClassFile cf, Method method, List<CPRefInfo> refConstantPool);
- }
-
- private final Filter filter;
- private final Visitor visitor;
-
- /**
- * Constructor.
- */
- public ReferenceFinder(Filter filter, Visitor visitor) {
- this.filter = Objects.requireNonNull(filter);
- this.visitor = Objects.requireNonNull(visitor);
- }
-
- /**
- * Parses a given ClassFile and invoke the visitor if there is any reference
- * to the constant pool entries referencing field, method, or
- * interface method that are accepted. This method will return
- * {@code true} if there is one or more accepted constant pool entries
- * to lookup; otherwise, it will return {@code false}.
- *
- * @param cf ClassFile
- * @return {@code true} if the given class file is processed to lookup
- * references
- * @throws ConstantPoolException if an error of the constant pool
- */
- public boolean parse(ClassFile cf) throws ConstantPoolException {
- List<Integer> cprefs = new ArrayList<>();
- int index = 1;
- for (ConstantPool.CPInfo cpInfo : cf.constant_pool.entries()) {
- if (cpInfo.accept(cpVisitor, cf.constant_pool)) {
- cprefs.add(index);
- }
- index += cpInfo.size();
- }
-
- if (cprefs.isEmpty()) {
- return false;
- }
-
- for (Method m : cf.methods) {
- Set<Integer> ids = new HashSet<>();
- Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code);
- if (c_attr != null) {
- for (Instruction instr : c_attr.getInstructions()) {
- int idx = instr.accept(codeVisitor, cprefs);
- if (idx > 0) {
- ids.add(idx);
- }
- }
- }
- if (ids.size() > 0) {
- List<CPRefInfo> refInfos = new ArrayList<>(ids.size());
- for (int id : ids) {
- refInfos.add(CPRefInfo.class.cast(cf.constant_pool.get(id)));
- }
- visitor.visit(cf, m, refInfos);
- }
- }
- return true;
- }
-
- private ConstantPool.Visitor<Boolean,ConstantPool> cpVisitor =
- new ConstantPool.Visitor<Boolean,ConstantPool>()
- {
- public Boolean visitClass(CONSTANT_Class_info info, ConstantPool cpool) {
- return false;
- }
-
- public Boolean visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, ConstantPool cpool) {
- return filter.accept(cpool, info);
- }
-
- public Boolean visitMethodref(CONSTANT_Methodref_info info, ConstantPool cpool) {
- return filter.accept(cpool, info);
- }
-
- public Boolean visitFieldref(CONSTANT_Fieldref_info info, ConstantPool cpool) {
- return filter.accept(cpool, info);
- }
-
- public Boolean visitDouble(CONSTANT_Double_info info, ConstantPool cpool) {
- return false;
- }
-
- public Boolean visitFloat(CONSTANT_Float_info info, ConstantPool cpool) {
- return false;
- }
-
- public Boolean visitInteger(CONSTANT_Integer_info info, ConstantPool cpool) {
- return false;
- }
-
- public Boolean visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, ConstantPool cpool) {
- return false;
- }
-
- public Boolean visitLong(CONSTANT_Long_info info, ConstantPool cpool) {
- return false;
- }
-
- public Boolean visitNameAndType(CONSTANT_NameAndType_info info, ConstantPool cpool) {
- return false;
- }
-
- public Boolean visitMethodHandle(CONSTANT_MethodHandle_info info, ConstantPool cpool) {
- return false;
- }
-
- public Boolean visitMethodType(CONSTANT_MethodType_info info, ConstantPool cpool) {
- return false;
- }
-
- public Boolean visitString(CONSTANT_String_info info, ConstantPool cpool) {
- return false;
- }
-
- public Boolean visitUtf8(CONSTANT_Utf8_info info, ConstantPool cpool) {
- return false;
- }
- };
-
- private Instruction.KindVisitor<Integer, List<Integer>> codeVisitor =
- new Instruction.KindVisitor<Integer, List<Integer>>()
- {
- public Integer visitNoOperands(Instruction instr, List<Integer> p) {
- return 0;
- }
-
- public Integer visitArrayType(Instruction instr, TypeKind kind, List<Integer> p) {
- return 0;
- }
-
- public Integer visitBranch(Instruction instr, int offset, List<Integer> p) {
- return 0;
- }
-
- public Integer visitConstantPoolRef(Instruction instr, int index, List<Integer> p) {
- return p.contains(index) ? index : 0;
- }
-
- public Integer visitConstantPoolRefAndValue(Instruction instr, int index, int value, List<Integer> p) {
- return p.contains(index) ? index : 0;
- }
-
- public Integer visitLocal(Instruction instr, int index, List<Integer> p) {
- return 0;
- }
-
- public Integer visitLocalAndValue(Instruction instr, int index, int value, List<Integer> p) {
- return 0;
- }
-
- public Integer visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, List<Integer> p) {
- return 0;
- }
-
- public Integer visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, List<Integer> p) {
- return 0;
- }
-
- public Integer visitValue(Instruction instr, int value, List<Integer> p) {
- return 0;
- }
-
- public Integer visitUnknown(Instruction instr, List<Integer> p) {
- return 0;
- }
- };
-}
-
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/RuntimeAnnotations_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.16 and 4.8.17.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public abstract class RuntimeAnnotations_attribute extends Attribute {
- protected RuntimeAnnotations_attribute(ClassReader cr, int name_index, int length)
- throws IOException, Annotation.InvalidAnnotation {
- super(name_index, length);
- int num_annotations = cr.readUnsignedShort();
- annotations = new Annotation[num_annotations];
- for (int i = 0; i < annotations.length; i++)
- annotations[i] = new Annotation(cr);
- }
-
- protected RuntimeAnnotations_attribute(int name_index, Annotation[] annotations) {
- super(name_index, length(annotations));
- this.annotations = annotations;
- }
-
- private static int length(Annotation[] annos) {
- int n = 2;
- for (Annotation anno: annos)
- n += anno.length();
- return n;
- }
-
- public final Annotation[] annotations;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/RuntimeInvisibleAnnotations_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.17.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class RuntimeInvisibleAnnotations_attribute extends RuntimeAnnotations_attribute {
- RuntimeInvisibleAnnotations_attribute(ClassReader cr, int name_index, int length)
- throws IOException, AttributeException {
- super(cr, name_index, length);
- }
-
- public RuntimeInvisibleAnnotations_attribute(ConstantPool cp, Annotation[] annotations)
- throws ConstantPoolException {
- this(cp.getUTF8Index(Attribute.RuntimeInvisibleAnnotations), annotations);
- }
-
- public RuntimeInvisibleAnnotations_attribute(int name_index, Annotation[] annotations) {
- super(name_index, annotations);
- }
-
- public <R, P> R accept(Visitor<R, P> visitor, P p) {
- return visitor.visitRuntimeInvisibleAnnotations(this, p);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/RuntimeInvisibleParameterAnnotations_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.18.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class RuntimeInvisibleParameterAnnotations_attribute extends RuntimeParameterAnnotations_attribute {
- RuntimeInvisibleParameterAnnotations_attribute(ClassReader cr, int name_index, int length)
- throws IOException, Annotation.InvalidAnnotation {
- super(cr, name_index, length);
- }
-
- public RuntimeInvisibleParameterAnnotations_attribute(ConstantPool cp, Annotation[][] parameter_annotations)
- throws ConstantPoolException {
- this(cp.getUTF8Index(Attribute.RuntimeInvisibleParameterAnnotations), parameter_annotations);
- }
-
- public RuntimeInvisibleParameterAnnotations_attribute(int name_index, Annotation[][] parameter_annotations) {
- super(name_index, parameter_annotations);
- }
-
- public <R, P> R accept(Visitor<R, P> visitor, P p) {
- return visitor.visitRuntimeInvisibleParameterAnnotations(this, p);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/RuntimeInvisibleTypeAnnotations_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, Section 3.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class RuntimeInvisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
- RuntimeInvisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
- throws IOException, Annotation.InvalidAnnotation {
- super(cr, name_index, length);
- }
-
- public RuntimeInvisibleTypeAnnotations_attribute(ConstantPool cp, TypeAnnotation[] annotations)
- throws ConstantPoolException {
- this(cp.getUTF8Index(Attribute.RuntimeInvisibleTypeAnnotations), annotations);
- }
-
- public RuntimeInvisibleTypeAnnotations_attribute(int name_index, TypeAnnotation[] annotations) {
- super(name_index, annotations);
- }
-
- public <R, P> R accept(Visitor<R, P> visitor, P p) {
- return visitor.visitRuntimeInvisibleTypeAnnotations(this, p);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/RuntimeParameterAnnotations_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.18 and 4.8.19.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public abstract class RuntimeParameterAnnotations_attribute extends Attribute {
- RuntimeParameterAnnotations_attribute(ClassReader cr, int name_index, int length)
- throws IOException, Annotation.InvalidAnnotation {
- super(name_index, length);
- int num_parameters = cr.readUnsignedByte();
- parameter_annotations = new Annotation[num_parameters][];
- for (int p = 0; p < parameter_annotations.length; p++) {
- int num_annotations = cr.readUnsignedShort();
- Annotation[] annotations = new Annotation[num_annotations];
- for (int i = 0; i < num_annotations; i++)
- annotations[i] = new Annotation(cr);
- parameter_annotations[p] = annotations;
- }
- }
-
- protected RuntimeParameterAnnotations_attribute(int name_index, Annotation[][] parameter_annotations) {
- super(name_index, length(parameter_annotations));
- this.parameter_annotations = parameter_annotations;
- }
-
- private static int length(Annotation[][] anno_arrays) {
- int n = 1;
- for (Annotation[] anno_array: anno_arrays) {
- n += 2;
- for (Annotation anno: anno_array)
- n += anno.length();
- }
- return n;
- }
-
- public final Annotation[][] parameter_annotations;
-}
-
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/RuntimeTypeAnnotations_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, Section 3.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public abstract class RuntimeTypeAnnotations_attribute extends Attribute {
- protected RuntimeTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
- throws IOException, Annotation.InvalidAnnotation {
- super(name_index, length);
- int num_annotations = cr.readUnsignedShort();
- annotations = new TypeAnnotation[num_annotations];
- for (int i = 0; i < annotations.length; i++)
- annotations[i] = new TypeAnnotation(cr);
- }
-
- protected RuntimeTypeAnnotations_attribute(int name_index, TypeAnnotation[] annotations) {
- super(name_index, length(annotations));
- this.annotations = annotations;
- }
-
- private static int length(TypeAnnotation[] annos) {
- int n = 2;
- for (TypeAnnotation anno: annos)
- n += anno.length();
- return n;
- }
-
- public final TypeAnnotation[] annotations;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/RuntimeVisibleAnnotations_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.16.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class RuntimeVisibleAnnotations_attribute extends RuntimeAnnotations_attribute {
- RuntimeVisibleAnnotations_attribute(ClassReader cr, int name_index, int length)
- throws IOException, Annotation.InvalidAnnotation {
- super(cr, name_index, length);
- }
-
- public RuntimeVisibleAnnotations_attribute(ConstantPool cp, Annotation[] annotations)
- throws ConstantPoolException {
- this(cp.getUTF8Index(Attribute.RuntimeVisibleAnnotations), annotations);
- }
-
- public RuntimeVisibleAnnotations_attribute(int name_index, Annotation[] annotations) {
- super(name_index, annotations);
- }
-
- public <R, P> R accept(Visitor<R, P> visitor, P p) {
- return visitor.visitRuntimeVisibleAnnotations(this, p);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/RuntimeVisibleParameterAnnotations_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.18.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class RuntimeVisibleParameterAnnotations_attribute extends RuntimeParameterAnnotations_attribute {
- RuntimeVisibleParameterAnnotations_attribute(ClassReader cr, int name_index, int length)
- throws IOException, Annotation.InvalidAnnotation {
- super(cr, name_index, length);
- }
-
- public RuntimeVisibleParameterAnnotations_attribute(ConstantPool cp, Annotation[][] parameter_annotations)
- throws ConstantPoolException {
- this(cp.getUTF8Index(Attribute.RuntimeVisibleParameterAnnotations), parameter_annotations);
- }
-
- public RuntimeVisibleParameterAnnotations_attribute(int name_index, Annotation[][] parameter_annotations) {
- super(name_index, parameter_annotations);
- }
-
- public <R, P> R accept(Visitor<R, P> visitor, P p) {
- return visitor.visitRuntimeVisibleParameterAnnotations(this, p);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/RuntimeVisibleTypeAnnotations_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JSR 308 specification, Section 3.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class RuntimeVisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
- RuntimeVisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
- throws IOException, Annotation.InvalidAnnotation {
- super(cr, name_index, length);
- }
-
- public RuntimeVisibleTypeAnnotations_attribute(ConstantPool cp, TypeAnnotation[] annotations)
- throws ConstantPoolException {
- this(cp.getUTF8Index(Attribute.RuntimeVisibleTypeAnnotations), annotations);
- }
-
- public RuntimeVisibleTypeAnnotations_attribute(int name_index, TypeAnnotation[] annotations) {
- super(name_index, annotations);
- }
-
- public <R, P> R accept(Visitor<R, P> visitor, P p) {
- return visitor.visitRuntimeVisibleTypeAnnotations(this, p);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Signature.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.util.ArrayList;
-import java.util.List;
-import com.sun.tools.classfile.Type.*;
-
-/**
- * See JVMS 4.4.4.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Signature extends Descriptor {
-
- public Signature(int index) {
- super(index);
- }
-
- public Type getType(ConstantPool constant_pool) throws ConstantPoolException {
- if (type == null)
- type = parse(getValue(constant_pool));
- return type;
- }
-
- @Override
- public int getParameterCount(ConstantPool constant_pool) throws ConstantPoolException {
- MethodType m = (MethodType) getType(constant_pool);
- return m.paramTypes.size();
- }
-
- @Override
- public String getParameterTypes(ConstantPool constant_pool) throws ConstantPoolException {
- MethodType m = (MethodType) getType(constant_pool);
- StringBuilder sb = new StringBuilder();
- sb.append("(");
- String sep = "";
- for (Type paramType: m.paramTypes) {
- sb.append(sep);
- sb.append(paramType);
- sep = ", ";
- }
- sb.append(")");
- return sb.toString();
- }
-
- @Override
- public String getReturnType(ConstantPool constant_pool) throws ConstantPoolException {
- MethodType m = (MethodType) getType(constant_pool);
- return m.returnType.toString();
- }
-
- @Override
- public String getFieldType(ConstantPool constant_pool) throws ConstantPoolException {
- return getType(constant_pool).toString();
- }
-
- private Type parse(String sig) {
- this.sig = sig;
- sigp = 0;
-
- List<TypeParamType> typeParamTypes = null;
- if (sig.charAt(sigp) == '<')
- typeParamTypes = parseTypeParamTypes();
-
- if (sig.charAt(sigp) == '(') {
- List<Type> paramTypes = parseTypeSignatures(')');
- Type returnType = parseTypeSignature();
- List<Type> throwsTypes = null;
- while (sigp < sig.length() && sig.charAt(sigp) == '^') {
- sigp++;
- if (throwsTypes == null)
- throwsTypes = new ArrayList<>();
- throwsTypes.add(parseTypeSignature());
- }
- return new MethodType(typeParamTypes, paramTypes, returnType, throwsTypes);
- } else {
- Type t = parseTypeSignature();
- if (typeParamTypes == null && sigp == sig.length())
- return t;
- Type superclass = t;
- List<Type> superinterfaces = null;
- while (sigp < sig.length()) {
- if (superinterfaces == null)
- superinterfaces = new ArrayList<>();
- superinterfaces.add(parseTypeSignature());
- }
- return new ClassSigType(typeParamTypes, superclass, superinterfaces);
-
- }
- }
-
- private Type parseTypeSignature() {
- switch (sig.charAt(sigp)) {
- case 'B':
- sigp++;
- return new SimpleType("byte");
-
- case 'C':
- sigp++;
- return new SimpleType("char");
-
- case 'D':
- sigp++;
- return new SimpleType("double");
-
- case 'F':
- sigp++;
- return new SimpleType("float");
-
- case 'I':
- sigp++;
- return new SimpleType("int");
-
- case 'J':
- sigp++;
- return new SimpleType("long");
-
- case 'L':
- return parseClassTypeSignature();
-
- case 'S':
- sigp++;
- return new SimpleType("short");
-
- case 'T':
- return parseTypeVariableSignature();
-
- case 'V':
- sigp++;
- return new SimpleType("void");
-
- case 'Z':
- sigp++;
- return new SimpleType("boolean");
-
- case '[':
- sigp++;
- return new ArrayType(parseTypeSignature());
-
- case '*':
- sigp++;
- return new WildcardType();
-
- case '+':
- sigp++;
- return new WildcardType(WildcardType.Kind.EXTENDS, parseTypeSignature());
-
- case '-':
- sigp++;
- return new WildcardType(WildcardType.Kind.SUPER, parseTypeSignature());
-
- default:
- throw new IllegalStateException(debugInfo());
- }
- }
-
- private List<Type> parseTypeSignatures(char term) {
- sigp++;
- List<Type> types = new ArrayList<>();
- while (sig.charAt(sigp) != term)
- types.add(parseTypeSignature());
- sigp++;
- return types;
- }
-
- private Type parseClassTypeSignature() {
- assert sig.charAt(sigp) == 'L';
- sigp++;
- return parseClassTypeSignatureRest();
- }
-
- private Type parseClassTypeSignatureRest() {
- StringBuilder sb = new StringBuilder();
- List<Type> argTypes = null;
- ClassType t = null;
- char sigch ;
-
- do {
- switch (sigch = sig.charAt(sigp)) {
- case '<':
- argTypes = parseTypeSignatures('>');
- break;
-
- case '.':
- case ';':
- sigp++;
- t = new ClassType(t, sb.toString(), argTypes);
- sb.setLength(0);
- argTypes = null;
- break;
-
- default:
- sigp++;
- sb.append(sigch);
- break;
- }
- } while (sigch != ';');
-
- return t;
- }
-
- private List<TypeParamType> parseTypeParamTypes() {
- assert sig.charAt(sigp) == '<';
- sigp++;
- List<TypeParamType> types = new ArrayList<>();
- while (sig.charAt(sigp) != '>')
- types.add(parseTypeParamType());
- sigp++;
- return types;
- }
-
- private TypeParamType parseTypeParamType() {
- int sep = sig.indexOf(":", sigp);
- String name = sig.substring(sigp, sep);
- Type classBound = null;
- List<Type> interfaceBounds = null;
- sigp = sep + 1;
- if (sig.charAt(sigp) != ':')
- classBound = parseTypeSignature();
- while (sig.charAt(sigp) == ':') {
- sigp++;
- if (interfaceBounds == null)
- interfaceBounds = new ArrayList<>();
- interfaceBounds.add(parseTypeSignature());
- }
- return new TypeParamType(name, classBound, interfaceBounds);
- }
-
- private Type parseTypeVariableSignature() {
- sigp++;
- int sep = sig.indexOf(';', sigp);
- Type t = new SimpleType(sig.substring(sigp, sep));
- sigp = sep + 1;
- return t;
- }
-
- private String debugInfo() {
- return sig.substring(0, sigp) + "!" + sig.charAt(sigp) + "!" + sig.substring(sigp+1);
- }
-
- private String sig;
- private int sigp;
-
- private Type type;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Signature_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.9.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Signature_attribute extends Attribute {
- Signature_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- signature_index = cr.readUnsignedShort();
- }
-
- public Signature_attribute(ConstantPool constant_pool, int signature_index)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.Signature), signature_index);
- }
-
- public Signature_attribute(int name_index, int signature_index) {
- super(name_index, 2);
- this.signature_index = signature_index;
- }
-
- public String getSignature(ConstantPool constant_pool) throws ConstantPoolException {
- return constant_pool.getUTF8Value(signature_index);
- }
-
- public Signature getParsedSignature() {
- return new Signature(signature_index);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitSignature(this, data);
- }
-
- public final int signature_index;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/SourceDebugExtension_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.charset.Charset;
-
-/**
- * See JVMS, section 4.8.15.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class SourceDebugExtension_attribute extends Attribute {
- private static final Charset UTF8 = Charset.forName("UTF-8");
-
- SourceDebugExtension_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- debug_extension = new byte[attribute_length];
- cr.readFully(debug_extension);
- }
-
- public SourceDebugExtension_attribute(ConstantPool constant_pool, byte[] debug_extension)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.SourceDebugExtension), debug_extension);
- }
-
- public SourceDebugExtension_attribute(int name_index, byte[] debug_extension) {
- super(name_index, debug_extension.length);
- this.debug_extension = debug_extension;
- }
-
- public String getValue() {
- return new String(debug_extension, UTF8);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitSourceDebugExtension(this, data);
- }
-
- public final byte[] debug_extension;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/SourceFile_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.10.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class SourceFile_attribute extends Attribute {
- SourceFile_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- sourcefile_index = cr.readUnsignedShort();
- }
-
- public SourceFile_attribute(ConstantPool constant_pool, int sourcefile_index)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.SourceFile), sourcefile_index);
- }
-
- public SourceFile_attribute(int name_index, int sourcefile_index) {
- super(name_index, 2);
- this.sourcefile_index = sourcefile_index;
- }
-
- public String getSourceFile(ConstantPool constant_pool) throws ConstantPoolException {
- return constant_pool.getUTF8Value(sourcefile_index);
- }
-
- public <R, P> R accept(Visitor<R, P> visitor, P p) {
- return visitor.visitSourceFile(this, p);
- }
-
- public final int sourcefile_index;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/SourceID_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2008, 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.
- */
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class SourceID_attribute extends Attribute {
-
- SourceID_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- sourceID_index = cr.readUnsignedShort();
- }
-
- public SourceID_attribute(ConstantPool constant_pool, int sourceID_index)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.SourceID), sourceID_index);
- }
-
- public SourceID_attribute(int name_index, int sourceID_index) {
- super(name_index, 2);
- this.sourceID_index = sourceID_index;
- }
-
- String getSourceID(ConstantPool constant_pool) throws ConstantPoolException {
- return constant_pool.getUTF8Value(sourceID_index);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitSourceID(this, data);
- }
-
- public final int sourceID_index;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/StackMapTable_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,380 +0,0 @@
-/*
- * Copyright (c) 2007, 2009, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.4.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class StackMapTable_attribute extends Attribute {
- static class InvalidStackMap extends AttributeException {
- private static final long serialVersionUID = -5659038410855089780L;
- InvalidStackMap(String msg) {
- super(msg);
- }
- }
-
- StackMapTable_attribute(ClassReader cr, int name_index, int length)
- throws IOException, InvalidStackMap {
- super(name_index, length);
- number_of_entries = cr.readUnsignedShort();
- entries = new stack_map_frame[number_of_entries];
- for (int i = 0; i < number_of_entries; i++)
- entries[i] = stack_map_frame.read(cr);
- }
-
- public StackMapTable_attribute(ConstantPool constant_pool, stack_map_frame[] entries)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.StackMapTable), entries);
- }
-
- public StackMapTable_attribute(int name_index, stack_map_frame[] entries) {
- super(name_index, length(entries));
- this.number_of_entries = entries.length;
- this.entries = entries;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitStackMapTable(this, data);
- }
-
- static int length(stack_map_frame[] entries) {
- int n = 2;
- for (stack_map_frame entry: entries)
- n += entry.length();
- return n;
- }
-
- public final int number_of_entries;
- public final stack_map_frame entries[];
-
- public static abstract class stack_map_frame {
- static stack_map_frame read(ClassReader cr)
- throws IOException, InvalidStackMap {
- int frame_type = cr.readUnsignedByte();
- if (frame_type <= 63)
- return new same_frame(frame_type);
- else if (frame_type <= 127)
- return new same_locals_1_stack_item_frame(frame_type, cr);
- else if (frame_type <= 246)
- throw new Error("unknown frame_type " + frame_type);
- else if (frame_type == 247)
- return new same_locals_1_stack_item_frame_extended(frame_type, cr);
- else if (frame_type <= 250)
- return new chop_frame(frame_type, cr);
- else if (frame_type == 251)
- return new same_frame_extended(frame_type, cr);
- else if (frame_type <= 254)
- return new append_frame(frame_type, cr);
- else
- return new full_frame(frame_type, cr);
- }
-
- protected stack_map_frame(int frame_type) {
- this.frame_type = frame_type;
- }
-
- public int length() {
- return 1;
- }
-
- public abstract int getOffsetDelta();
-
- public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
-
- public final int frame_type;
-
- public static interface Visitor<R,P> {
- R visit_same_frame(same_frame frame, P p);
- R visit_same_locals_1_stack_item_frame(same_locals_1_stack_item_frame frame, P p);
- R visit_same_locals_1_stack_item_frame_extended(same_locals_1_stack_item_frame_extended frame, P p);
- R visit_chop_frame(chop_frame frame, P p);
- R visit_same_frame_extended(same_frame_extended frame, P p);
- R visit_append_frame(append_frame frame, P p);
- R visit_full_frame(full_frame frame, P p);
- }
- }
-
- public static class same_frame extends stack_map_frame {
- same_frame(int frame_type) {
- super(frame_type);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visit_same_frame(this, data);
- }
-
- public int getOffsetDelta() {
- return frame_type;
- }
- }
-
- public static class same_locals_1_stack_item_frame extends stack_map_frame {
- same_locals_1_stack_item_frame(int frame_type, ClassReader cr)
- throws IOException, InvalidStackMap {
- super(frame_type);
- stack = new verification_type_info[1];
- stack[0] = verification_type_info.read(cr);
- }
-
- @Override
- public int length() {
- return super.length() + stack[0].length();
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visit_same_locals_1_stack_item_frame(this, data);
- }
-
- public int getOffsetDelta() {
- return frame_type - 64;
- }
-
- public final verification_type_info[] stack;
- }
-
- public static class same_locals_1_stack_item_frame_extended extends stack_map_frame {
- same_locals_1_stack_item_frame_extended(int frame_type, ClassReader cr)
- throws IOException, InvalidStackMap {
- super(frame_type);
- offset_delta = cr.readUnsignedShort();
- stack = new verification_type_info[1];
- stack[0] = verification_type_info.read(cr);
- }
-
- @Override
- public int length() {
- return super.length() + 2 + stack[0].length();
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visit_same_locals_1_stack_item_frame_extended(this, data);
- }
-
- public int getOffsetDelta() {
- return offset_delta;
- }
-
- public final int offset_delta;
- public final verification_type_info[] stack;
- }
-
- public static class chop_frame extends stack_map_frame {
- chop_frame(int frame_type, ClassReader cr) throws IOException {
- super(frame_type);
- offset_delta = cr.readUnsignedShort();
- }
-
- @Override
- public int length() {
- return super.length() + 2;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visit_chop_frame(this, data);
- }
-
- public int getOffsetDelta() {
- return offset_delta;
- }
-
- public final int offset_delta;
- }
-
- public static class same_frame_extended extends stack_map_frame {
- same_frame_extended(int frame_type, ClassReader cr) throws IOException {
- super(frame_type);
- offset_delta = cr.readUnsignedShort();
- }
-
- @Override
- public int length() {
- return super.length() + 2;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visit_same_frame_extended(this, data);
- }
-
- public int getOffsetDelta() {
- return offset_delta;
- }
-
- public final int offset_delta;
- }
-
- public static class append_frame extends stack_map_frame {
- append_frame(int frame_type, ClassReader cr)
- throws IOException, InvalidStackMap {
- super(frame_type);
- offset_delta = cr.readUnsignedShort();
- locals = new verification_type_info[frame_type - 251];
- for (int i = 0; i < locals.length; i++)
- locals[i] = verification_type_info.read(cr);
- }
-
- @Override
- public int length() {
- int n = super.length() + 2;
- for (verification_type_info local: locals)
- n += local.length();
- return n;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visit_append_frame(this, data);
- }
-
- public int getOffsetDelta() {
- return offset_delta;
- }
-
- public final int offset_delta;
- public final verification_type_info[] locals;
- }
-
- public static class full_frame extends stack_map_frame {
- full_frame(int frame_type, ClassReader cr)
- throws IOException, InvalidStackMap {
- super(frame_type);
- offset_delta = cr.readUnsignedShort();
- number_of_locals = cr.readUnsignedShort();
- locals = new verification_type_info[number_of_locals];
- for (int i = 0; i < locals.length; i++)
- locals[i] = verification_type_info.read(cr);
- number_of_stack_items = cr.readUnsignedShort();
- stack = new verification_type_info[number_of_stack_items];
- for (int i = 0; i < stack.length; i++)
- stack[i] = verification_type_info.read(cr);
- }
-
- @Override
- public int length() {
- int n = super.length() + 2;
- for (verification_type_info local: locals)
- n += local.length();
- n += 2;
- for (verification_type_info item: stack)
- n += item.length();
- return n;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visit_full_frame(this, data);
- }
-
- public int getOffsetDelta() {
- return offset_delta;
- }
-
- public final int offset_delta;
- public final int number_of_locals;
- public final verification_type_info[] locals;
- public final int number_of_stack_items;
- public final verification_type_info[] stack;
- }
-
- public static class verification_type_info {
- public static final int ITEM_Top = 0;
- public static final int ITEM_Integer = 1;
- public static final int ITEM_Float = 2;
- public static final int ITEM_Long = 4;
- public static final int ITEM_Double = 3;
- public static final int ITEM_Null = 5;
- public static final int ITEM_UninitializedThis = 6;
- public static final int ITEM_Object = 7;
- public static final int ITEM_Uninitialized = 8;
-
- static verification_type_info read(ClassReader cr)
- throws IOException, InvalidStackMap {
- int tag = cr.readUnsignedByte();
- switch (tag) {
- case ITEM_Top:
- case ITEM_Integer:
- case ITEM_Float:
- case ITEM_Long:
- case ITEM_Double:
- case ITEM_Null:
- case ITEM_UninitializedThis:
- return new verification_type_info(tag);
-
- case ITEM_Object:
- return new Object_variable_info(cr);
-
- case ITEM_Uninitialized:
- return new Uninitialized_variable_info(cr);
-
- default:
- throw new InvalidStackMap("unrecognized verification_type_info tag");
- }
- }
-
- protected verification_type_info(int tag) {
- this.tag = tag;
- }
-
- public int length() {
- return 1;
- }
-
- public final int tag;
- }
-
- public static class Object_variable_info extends verification_type_info {
- Object_variable_info(ClassReader cr) throws IOException {
- super(ITEM_Object);
- cpool_index = cr.readUnsignedShort();
- }
-
- @Override
- public int length() {
- return super.length() + 2;
- }
-
- public final int cpool_index;
- }
-
- public static class Uninitialized_variable_info extends verification_type_info {
- Uninitialized_variable_info(ClassReader cr) throws IOException {
- super(ITEM_Uninitialized);
- offset = cr.readUnsignedShort();
- }
-
- @Override
- public int length() {
- return super.length() + 2;
- }
-
- public final int offset;
-
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/StackMap_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class StackMap_attribute extends Attribute {
- StackMap_attribute(ClassReader cr, int name_index, int length)
- throws IOException, StackMapTable_attribute.InvalidStackMap {
- super(name_index, length);
- number_of_entries = cr.readUnsignedShort();
- entries = new stack_map_frame[number_of_entries];
- for (int i = 0; i < number_of_entries; i++)
- entries[i] = new stack_map_frame(cr);
- }
-
- public StackMap_attribute(ConstantPool constant_pool, stack_map_frame[] entries)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.StackMap), entries);
- }
-
- public StackMap_attribute(int name_index, stack_map_frame[] entries) {
- super(name_index, StackMapTable_attribute.length(entries));
- this.number_of_entries = entries.length;
- this.entries = entries;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitStackMap(this, data);
- }
-
- public final int number_of_entries;
- public final stack_map_frame entries[];
-
- public static class stack_map_frame extends StackMapTable_attribute.full_frame {
- stack_map_frame(ClassReader cr)
- throws IOException, StackMapTable_attribute.InvalidStackMap {
- super(255, cr);
- }
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Synthetic_attribute.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-
-/**
- * See JVMS, section 4.8.8.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Synthetic_attribute extends Attribute {
- Synthetic_attribute(ClassReader cr, int name_index, int length) throws IOException {
- super(name_index, length);
- }
-
- public Synthetic_attribute(ConstantPool constant_pool)
- throws ConstantPoolException {
- this(constant_pool.getUTF8Index(Attribute.Synthetic));
- }
-
- public Synthetic_attribute(int name_index) {
- super(name_index, 0);
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitSynthetic(this, data);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/Type.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,378 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/*
- * Family of classes used to represent the parsed form of a {@link Descriptor}
- * or {@link Signature}.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public abstract class Type {
- protected Type() { }
-
- public boolean isObject() {
- return false;
- }
-
- public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
-
- protected static void append(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) {
- sb.append(prefix);
- String sep = "";
- for (Type t: types) {
- sb.append(sep);
- sb.append(t);
- sep = ", ";
- }
- sb.append(suffix);
- }
-
- protected static void appendIfNotEmpty(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) {
- if (types != null && types.size() > 0)
- append(sb, prefix, types, suffix);
- }
-
- public interface Visitor<R,P> {
- R visitSimpleType(SimpleType type, P p);
- R visitArrayType(ArrayType type, P p);
- R visitMethodType(MethodType type, P p);
- R visitClassSigType(ClassSigType type, P p);
- R visitClassType(ClassType type, P p);
- R visitTypeParamType(TypeParamType type, P p);
- R visitWildcardType(WildcardType type, P p);
- }
-
- /**
- * Represents a type signature with a simple name. The name may be that of a
- * primitive type, such "{@code int}, {@code float}, etc
- * or that of a type argument, such as {@code T}, {@code K}, {@code V}, etc.
- *
- * See:
- * JVMS 4.3.2
- * BaseType:
- * {@code B}, {@code C}, {@code D}, {@code F}, {@code I},
- * {@code J}, {@code S}, {@code Z};
- * VoidDescriptor:
- * {@code V};
- * JVMS 4.3.4
- * TypeVariableSignature:
- * {@code T} Identifier {@code ;}
- */
- public static class SimpleType extends Type {
- public SimpleType(String name) {
- this.name = name;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitSimpleType(this, data);
- }
-
- public boolean isPrimitiveType() {
- return primitiveTypes.contains(name);
- }
- // where
- private static final Set<String> primitiveTypes = new HashSet<>(Arrays.asList(
- "boolean", "byte", "char", "double", "float", "int", "long", "short", "void"));
-
- @Override
- public String toString() {
- return name;
- }
-
- public final String name;
- }
-
- /**
- * Represents an array type signature.
- *
- * See:
- * JVMS 4.3.4
- * ArrayTypeSignature:
- * {@code [} TypeSignature {@code ]}
- */
- public static class ArrayType extends Type {
- public ArrayType(Type elemType) {
- this.elemType = elemType;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitArrayType(this, data);
- }
-
- @Override
- public String toString() {
- return elemType + "[]";
- }
-
- public final Type elemType;
- }
-
- /**
- * Represents a method type signature.
- *
- * See;
- * JVMS 4.3.4
- * MethodTypeSignature:
- * FormalTypeParameters_opt {@code (} TypeSignature* {@code)} ReturnType
- * ThrowsSignature*
- */
- public static class MethodType extends Type {
- public MethodType(List<? extends Type> paramTypes, Type resultType) {
- this(null, paramTypes, resultType, null);
- }
-
- public MethodType(List<? extends TypeParamType> typeParamTypes,
- List<? extends Type> paramTypes,
- Type returnType,
- List<? extends Type> throwsTypes) {
- this.typeParamTypes = typeParamTypes;
- this.paramTypes = paramTypes;
- this.returnType = returnType;
- this.throwsTypes = throwsTypes;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitMethodType(this, data);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- appendIfNotEmpty(sb, "<", typeParamTypes, "> ");
- sb.append(returnType);
- append(sb, " (", paramTypes, ")");
- appendIfNotEmpty(sb, " throws ", throwsTypes, "");
- return sb.toString();
- }
-
- public final List<? extends TypeParamType> typeParamTypes;
- public final List<? extends Type> paramTypes;
- public final Type returnType;
- public final List<? extends Type> throwsTypes;
- }
-
- /**
- * Represents a class signature. These describe the signature of
- * a class that has type arguments.
- *
- * See:
- * JVMS 4.3.4
- * ClassSignature:
- * FormalTypeParameters_opt SuperclassSignature SuperinterfaceSignature*
- */
- public static class ClassSigType extends Type {
- public ClassSigType(List<TypeParamType> typeParamTypes, Type superclassType,
- List<Type> superinterfaceTypes) {
- this.typeParamTypes = typeParamTypes;
- this.superclassType = superclassType;
- this.superinterfaceTypes = superinterfaceTypes;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitClassSigType(this, data);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- appendIfNotEmpty(sb, "<", typeParamTypes, ">");
- if (superclassType != null) {
- sb.append(" extends ");
- sb.append(superclassType);
- }
- appendIfNotEmpty(sb, " implements ", superinterfaceTypes, "");
- return sb.toString();
- }
-
- public final List<TypeParamType> typeParamTypes;
- public final Type superclassType;
- public final List<Type> superinterfaceTypes;
- }
-
- /**
- * Represents a class type signature. This is used to represent a
- * reference to a class, such as in a field, parameter, return type, etc.
- *
- * See:
- * JVMS 4.3.4
- * ClassTypeSignature:
- * {@code L} PackageSpecifier_opt SimpleClassTypeSignature
- * ClassTypeSignatureSuffix* {@code ;}
- * PackageSpecifier:
- * Identifier {@code /} PackageSpecifier*
- * SimpleClassTypeSignature:
- * Identifier TypeArguments_opt }
- * ClassTypeSignatureSuffix:
- * {@code .} SimpleClassTypeSignature
- */
- public static class ClassType extends Type {
- public ClassType(ClassType outerType, String name, List<Type> typeArgs) {
- this.outerType = outerType;
- this.name = name;
- this.typeArgs = typeArgs;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitClassType(this, data);
- }
-
- public String getBinaryName() {
- if (outerType == null)
- return name;
- else
- return (outerType.getBinaryName() + "$" + name);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- if (outerType != null) {
- sb.append(outerType);
- sb.append(".");
- }
- sb.append(name);
- appendIfNotEmpty(sb, "<", typeArgs, ">");
- return sb.toString();
- }
-
- @Override
- public boolean isObject() {
- return (outerType == null)
- && name.equals("java/lang/Object")
- && (typeArgs == null || typeArgs.isEmpty());
- }
-
- public final ClassType outerType;
- public final String name;
- public final List<Type> typeArgs;
- }
-
- /**
- * Represents a FormalTypeParameter. These are used to declare the type
- * parameters for generic classes and methods.
- *
- * See:
- * JVMS 4.3.4
- * FormalTypeParameters:
- * {@code <} FormalTypeParameter+ {@code >}
- * FormalTypeParameter:
- * Identifier ClassBound InterfaceBound*
- * ClassBound:
- * {@code :} FieldTypeSignature_opt
- * InterfaceBound:
- * {@code :} FieldTypeSignature
- */
- public static class TypeParamType extends Type {
- public TypeParamType(String name, Type classBound, List<Type> interfaceBounds) {
- this.name = name;
- this.classBound = classBound;
- this.interfaceBounds = interfaceBounds;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitTypeParamType(this, data);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(name);
- String sep = " extends ";
- if (classBound != null) {
- sb.append(sep);
- sb.append(classBound);
- sep = " & ";
- }
- if (interfaceBounds != null) {
- for (Type bound: interfaceBounds) {
- sb.append(sep);
- sb.append(bound);
- sep = " & ";
- }
- }
- return sb.toString();
- }
-
- public final String name;
- public final Type classBound;
- public final List<Type> interfaceBounds;
- }
-
- /**
- * Represents a wildcard type argument. A type argument that is not a
- * wildcard type argument will be represented by a ClassType, ArrayType, etc.
- *
- * See:
- * JVMS 4.3.4
- * TypeArgument:
- * WildcardIndicator_opt FieldTypeSignature
- * {@code *}
- * WildcardIndicator:
- * {@code +}
- * {@code -}
- */
- public static class WildcardType extends Type {
- public enum Kind { UNBOUNDED, EXTENDS, SUPER }
-
- public WildcardType() {
- this(Kind.UNBOUNDED, null);
- }
- public WildcardType(Kind kind, Type boundType) {
- this.kind = kind;
- this.boundType = boundType;
- }
-
- public <R, D> R accept(Visitor<R, D> visitor, D data) {
- return visitor.visitWildcardType(this, data);
- }
-
- @Override
- public String toString() {
- switch (kind) {
- case UNBOUNDED:
- return "?";
- case EXTENDS:
- return "? extends " + boundType;
- case SUPER:
- return "? super " + boundType;
- default:
- throw new AssertionError();
- }
- }
-
- public final Kind kind;
- public final Type boundType;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/TypeAnnotation.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,657 +0,0 @@
-/*
- * Copyright (c) 2009, 2013, 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.
- */
-
-package com.sun.tools.classfile;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.sun.tools.classfile.TypeAnnotation.Position.TypePathEntry;
-
-/**
- * See JSR 308 specification, Section 3.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class TypeAnnotation {
- TypeAnnotation(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
- constant_pool = cr.getConstantPool();
- position = read_position(cr);
- annotation = new Annotation(cr);
- }
-
- public TypeAnnotation(ConstantPool constant_pool,
- Annotation annotation, Position position) {
- this.constant_pool = constant_pool;
- this.position = position;
- this.annotation = annotation;
- }
-
- public int length() {
- int n = annotation.length();
- n += position_length(position);
- return n;
- }
-
- @Override
- public String toString() {
- try {
- return "@" + constant_pool.getUTF8Value(annotation.type_index).toString().substring(1) +
- " pos: " + position.toString();
- } catch (Exception e) {
- e.printStackTrace();
- return e.toString();
- }
- }
-
- public final ConstantPool constant_pool;
- public final Position position;
- public final Annotation annotation;
-
- private static Position read_position(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
- // Copied from ClassReader
- int tag = cr.readUnsignedByte(); // TargetType tag is a byte
- if (!TargetType.isValidTargetTypeValue(tag))
- throw new Annotation.InvalidAnnotation("TypeAnnotation: Invalid type annotation target type value: " + String.format("0x%02X", tag));
-
- TargetType type = TargetType.fromTargetTypeValue(tag);
-
- Position position = new Position();
- position.type = type;
-
- switch (type) {
- // instanceof
- case INSTANCEOF:
- // new expression
- case NEW:
- // constructor/method reference receiver
- case CONSTRUCTOR_REFERENCE:
- case METHOD_REFERENCE:
- position.offset = cr.readUnsignedShort();
- break;
- // local variable
- case LOCAL_VARIABLE:
- // resource variable
- case RESOURCE_VARIABLE:
- int table_length = cr.readUnsignedShort();
- position.lvarOffset = new int[table_length];
- position.lvarLength = new int[table_length];
- position.lvarIndex = new int[table_length];
- for (int i = 0; i < table_length; ++i) {
- position.lvarOffset[i] = cr.readUnsignedShort();
- position.lvarLength[i] = cr.readUnsignedShort();
- position.lvarIndex[i] = cr.readUnsignedShort();
- }
- break;
- // exception parameter
- case EXCEPTION_PARAMETER:
- position.exception_index = cr.readUnsignedShort();
- break;
- // method receiver
- case METHOD_RECEIVER:
- // Do nothing
- break;
- // type parameter
- case CLASS_TYPE_PARAMETER:
- case METHOD_TYPE_PARAMETER:
- position.parameter_index = cr.readUnsignedByte();
- break;
- // type parameter bound
- case CLASS_TYPE_PARAMETER_BOUND:
- case METHOD_TYPE_PARAMETER_BOUND:
- position.parameter_index = cr.readUnsignedByte();
- position.bound_index = cr.readUnsignedByte();
- break;
- // class extends or implements clause
- case CLASS_EXTENDS:
- int in = cr.readUnsignedShort();
- if (in == 0xFFFF)
- in = -1;
- position.type_index = in;
- break;
- // throws
- case THROWS:
- position.type_index = cr.readUnsignedShort();
- break;
- // method parameter
- case METHOD_FORMAL_PARAMETER:
- position.parameter_index = cr.readUnsignedByte();
- break;
- // type cast
- case CAST:
- // method/constructor/reference type argument
- case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
- case METHOD_INVOCATION_TYPE_ARGUMENT:
- case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
- case METHOD_REFERENCE_TYPE_ARGUMENT:
- position.offset = cr.readUnsignedShort();
- position.type_index = cr.readUnsignedByte();
- break;
- // We don't need to worry about these
- case METHOD_RETURN:
- case FIELD:
- break;
- case UNKNOWN:
- throw new AssertionError("TypeAnnotation: UNKNOWN target type should never occur!");
- default:
- throw new AssertionError("TypeAnnotation: Unknown target type: " + type);
- }
-
- { // Write type path
- int len = cr.readUnsignedByte();
- List<Integer> loc = new ArrayList<>(len);
- for (int i = 0; i < len * TypePathEntry.bytesPerEntry; ++i)
- loc.add(cr.readUnsignedByte());
- position.location = Position.getTypePathFromBinary(loc);
- }
- return position;
- }
-
- private static int position_length(Position pos) {
- int n = 0;
- n += 1; // TargetType tag is a byte
- switch (pos.type) {
- // instanceof
- case INSTANCEOF:
- // new expression
- case NEW:
- // constructor/method reference receiver
- case CONSTRUCTOR_REFERENCE:
- case METHOD_REFERENCE:
- n += 2; // offset
- break;
- // local variable
- case LOCAL_VARIABLE:
- // resource variable
- case RESOURCE_VARIABLE:
- n += 2; // table_length;
- int table_length = pos.lvarOffset.length;
- n += 2 * table_length; // offset
- n += 2 * table_length; // length
- n += 2 * table_length; // index
- break;
- // exception parameter
- case EXCEPTION_PARAMETER:
- n += 2; // exception_index
- break;
- // method receiver
- case METHOD_RECEIVER:
- // Do nothing
- break;
- // type parameter
- case CLASS_TYPE_PARAMETER:
- case METHOD_TYPE_PARAMETER:
- n += 1; // parameter_index
- break;
- // type parameter bound
- case CLASS_TYPE_PARAMETER_BOUND:
- case METHOD_TYPE_PARAMETER_BOUND:
- n += 1; // parameter_index
- n += 1; // bound_index
- break;
- // class extends or implements clause
- case CLASS_EXTENDS:
- n += 2; // type_index
- break;
- // throws
- case THROWS:
- n += 2; // type_index
- break;
- // method parameter
- case METHOD_FORMAL_PARAMETER:
- n += 1; // parameter_index
- break;
- // type cast
- case CAST:
- // method/constructor/reference type argument
- case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
- case METHOD_INVOCATION_TYPE_ARGUMENT:
- case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
- case METHOD_REFERENCE_TYPE_ARGUMENT:
- n += 2; // offset
- n += 1; // type index
- break;
- // We don't need to worry about these
- case METHOD_RETURN:
- case FIELD:
- break;
- case UNKNOWN:
- throw new AssertionError("TypeAnnotation: UNKNOWN target type should never occur!");
- default:
- throw new AssertionError("TypeAnnotation: Unknown target type: " + pos.type);
- }
-
- {
- n += 1; // length
- n += TypePathEntry.bytesPerEntry * pos.location.size(); // bytes for actual array
- }
-
- return n;
- }
-
- // Code duplicated from com.sun.tools.javac.code.TypeAnnotationPosition
- public static class Position {
- public enum TypePathEntryKind {
- ARRAY(0),
- INNER_TYPE(1),
- WILDCARD(2),
- TYPE_ARGUMENT(3);
-
- public final int tag;
-
- private TypePathEntryKind(int tag) {
- this.tag = tag;
- }
- }
-
- public static class TypePathEntry {
- /** The fixed number of bytes per TypePathEntry. */
- public static final int bytesPerEntry = 2;
-
- public final TypePathEntryKind tag;
- public final int arg;
-
- public static final TypePathEntry ARRAY = new TypePathEntry(TypePathEntryKind.ARRAY);
- public static final TypePathEntry INNER_TYPE = new TypePathEntry(TypePathEntryKind.INNER_TYPE);
- public static final TypePathEntry WILDCARD = new TypePathEntry(TypePathEntryKind.WILDCARD);
-
- private TypePathEntry(TypePathEntryKind tag) {
- if (!(tag == TypePathEntryKind.ARRAY ||
- tag == TypePathEntryKind.INNER_TYPE ||
- tag == TypePathEntryKind.WILDCARD)) {
- throw new AssertionError("Invalid TypePathEntryKind: " + tag);
- }
- this.tag = tag;
- this.arg = 0;
- }
-
- public TypePathEntry(TypePathEntryKind tag, int arg) {
- if (tag != TypePathEntryKind.TYPE_ARGUMENT) {
- throw new AssertionError("Invalid TypePathEntryKind: " + tag);
- }
- this.tag = tag;
- this.arg = arg;
- }
-
- public static TypePathEntry fromBinary(int tag, int arg) {
- if (arg != 0 && tag != TypePathEntryKind.TYPE_ARGUMENT.tag) {
- throw new AssertionError("Invalid TypePathEntry tag/arg: " + tag + "/" + arg);
- }
- switch (tag) {
- case 0:
- return ARRAY;
- case 1:
- return INNER_TYPE;
- case 2:
- return WILDCARD;
- case 3:
- return new TypePathEntry(TypePathEntryKind.TYPE_ARGUMENT, arg);
- default:
- throw new AssertionError("Invalid TypePathEntryKind tag: " + tag);
- }
- }
-
- @Override
- public String toString() {
- return tag.toString() +
- (tag == TypePathEntryKind.TYPE_ARGUMENT ? ("(" + arg + ")") : "");
- }
-
- @Override
- public boolean equals(Object other) {
- if (! (other instanceof TypePathEntry)) {
- return false;
- }
- TypePathEntry tpe = (TypePathEntry) other;
- return this.tag == tpe.tag && this.arg == tpe.arg;
- }
-
- @Override
- public int hashCode() {
- return this.tag.hashCode() * 17 + this.arg;
- }
- }
-
- public TargetType type = TargetType.UNKNOWN;
-
- // For generic/array types.
- // TODO: or should we use null? Noone will use this object.
- public List<TypePathEntry> location = new ArrayList<>(0);
-
- // Tree position.
- public int pos = -1;
-
- // For typecasts, type tests, new (and locals, as start_pc).
- public boolean isValidOffset = false;
- public int offset = -1;
-
- // For locals. arrays same length
- public int[] lvarOffset = null;
- public int[] lvarLength = null;
- public int[] lvarIndex = null;
-
- // For type parameter bound
- public int bound_index = Integer.MIN_VALUE;
-
- // For type parameter and method parameter
- public int parameter_index = Integer.MIN_VALUE;
-
- // For class extends, implements, and throws clauses
- public int type_index = Integer.MIN_VALUE;
-
- // For exception parameters, index into exception table
- public int exception_index = Integer.MIN_VALUE;
-
- public Position() {}
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append('[');
- sb.append(type);
-
- switch (type) {
- // instanceof
- case INSTANCEOF:
- // new expression
- case NEW:
- // constructor/method reference receiver
- case CONSTRUCTOR_REFERENCE:
- case METHOD_REFERENCE:
- sb.append(", offset = ");
- sb.append(offset);
- break;
- // local variable
- case LOCAL_VARIABLE:
- // resource variable
- case RESOURCE_VARIABLE:
- if (lvarOffset == null) {
- sb.append(", lvarOffset is null!");
- break;
- }
- sb.append(", {");
- for (int i = 0; i < lvarOffset.length; ++i) {
- if (i != 0) sb.append("; ");
- sb.append("start_pc = ");
- sb.append(lvarOffset[i]);
- sb.append(", length = ");
- sb.append(lvarLength[i]);
- sb.append(", index = ");
- sb.append(lvarIndex[i]);
- }
- sb.append("}");
- break;
- // method receiver
- case METHOD_RECEIVER:
- // Do nothing
- break;
- // type parameter
- case CLASS_TYPE_PARAMETER:
- case METHOD_TYPE_PARAMETER:
- sb.append(", param_index = ");
- sb.append(parameter_index);
- break;
- // type parameter bound
- case CLASS_TYPE_PARAMETER_BOUND:
- case METHOD_TYPE_PARAMETER_BOUND:
- sb.append(", param_index = ");
- sb.append(parameter_index);
- sb.append(", bound_index = ");
- sb.append(bound_index);
- break;
- // class extends or implements clause
- case CLASS_EXTENDS:
- sb.append(", type_index = ");
- sb.append(type_index);
- break;
- // throws
- case THROWS:
- sb.append(", type_index = ");
- sb.append(type_index);
- break;
- // exception parameter
- case EXCEPTION_PARAMETER:
- sb.append(", exception_index = ");
- sb.append(exception_index);
- break;
- // method parameter
- case METHOD_FORMAL_PARAMETER:
- sb.append(", param_index = ");
- sb.append(parameter_index);
- break;
- // type cast
- case CAST:
- // method/constructor/reference type argument
- case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
- case METHOD_INVOCATION_TYPE_ARGUMENT:
- case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
- case METHOD_REFERENCE_TYPE_ARGUMENT:
- sb.append(", offset = ");
- sb.append(offset);
- sb.append(", type_index = ");
- sb.append(type_index);
- break;
- // We don't need to worry about these
- case METHOD_RETURN:
- case FIELD:
- break;
- case UNKNOWN:
- sb.append(", position UNKNOWN!");
- break;
- default:
- throw new AssertionError("Unknown target type: " + type);
- }
-
- // Append location data for generics/arrays.
- if (!location.isEmpty()) {
- sb.append(", location = (");
- sb.append(location);
- sb.append(")");
- }
-
- sb.append(", pos = ");
- sb.append(pos);
-
- sb.append(']');
- return sb.toString();
- }
-
- /**
- * Indicates whether the target tree of the annotation has been optimized
- * away from classfile or not.
- * @return true if the target has not been optimized away
- */
- public boolean emitToClassfile() {
- return !type.isLocal() || isValidOffset;
- }
-
- /**
- * Decode the binary representation for a type path and set
- * the {@code location} field.
- *
- * @param list The bytecode representation of the type path.
- */
- public static List<TypePathEntry> getTypePathFromBinary(List<Integer> list) {
- List<TypePathEntry> loc = new ArrayList<>(list.size() / TypePathEntry.bytesPerEntry);
- int idx = 0;
- while (idx < list.size()) {
- if (idx + 1 == list.size()) {
- throw new AssertionError("Could not decode type path: " + list);
- }
- loc.add(TypePathEntry.fromBinary(list.get(idx), list.get(idx + 1)));
- idx += 2;
- }
- return loc;
- }
-
- public static List<Integer> getBinaryFromTypePath(List<TypePathEntry> locs) {
- List<Integer> loc = new ArrayList<>(locs.size() * TypePathEntry.bytesPerEntry);
- for (TypePathEntry tpe : locs) {
- loc.add(tpe.tag.tag);
- loc.add(tpe.arg);
- }
- return loc;
- }
- }
-
- // Code duplicated from com.sun.tools.javac.code.TargetType
- // The IsLocal flag could be removed here.
- public enum TargetType {
- /** For annotations on a class type parameter declaration. */
- CLASS_TYPE_PARAMETER(0x00),
-
- /** For annotations on a method type parameter declaration. */
- METHOD_TYPE_PARAMETER(0x01),
-
- /** For annotations on the type of an "extends" or "implements" clause. */
- CLASS_EXTENDS(0x10),
-
- /** For annotations on a bound of a type parameter of a class. */
- CLASS_TYPE_PARAMETER_BOUND(0x11),
-
- /** For annotations on a bound of a type parameter of a method. */
- METHOD_TYPE_PARAMETER_BOUND(0x12),
-
- /** For annotations on a field. */
- FIELD(0x13),
-
- /** For annotations on a method return type. */
- METHOD_RETURN(0x14),
-
- /** For annotations on the method receiver. */
- METHOD_RECEIVER(0x15),
-
- /** For annotations on a method parameter. */
- METHOD_FORMAL_PARAMETER(0x16),
-
- /** For annotations on a throws clause in a method declaration. */
- THROWS(0x17),
-
- /** For annotations on a local variable. */
- LOCAL_VARIABLE(0x40, true),
-
- /** For annotations on a resource variable. */
- RESOURCE_VARIABLE(0x41, true),
-
- /** For annotations on an exception parameter. */
- EXCEPTION_PARAMETER(0x42, true),
-
- /** For annotations on a type test. */
- INSTANCEOF(0x43, true),
-
- /** For annotations on an object creation expression. */
- NEW(0x44, true),
-
- /** For annotations on a constructor reference receiver. */
- CONSTRUCTOR_REFERENCE(0x45, true),
-
- /** For annotations on a method reference receiver. */
- METHOD_REFERENCE(0x46, true),
-
- /** For annotations on a typecast. */
- CAST(0x47, true),
-
- /** For annotations on a type argument of an object creation expression. */
- CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x48, true),
-
- /** For annotations on a type argument of a method call. */
- METHOD_INVOCATION_TYPE_ARGUMENT(0x49, true),
-
- /** For annotations on a type argument of a constructor reference. */
- CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT(0x4A, true),
-
- /** For annotations on a type argument of a method reference. */
- METHOD_REFERENCE_TYPE_ARGUMENT(0x4B, true),
-
- /** For annotations with an unknown target. */
- UNKNOWN(0xFF);
-
- private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x4B;
-
- private final int targetTypeValue;
- private final boolean isLocal;
-
- private TargetType(int targetTypeValue) {
- this(targetTypeValue, false);
- }
-
- private TargetType(int targetTypeValue, boolean isLocal) {
- if (targetTypeValue < 0
- || targetTypeValue > 255)
- throw new AssertionError("Attribute type value needs to be an unsigned byte: " + String.format("0x%02X", targetTypeValue));
- this.targetTypeValue = targetTypeValue;
- this.isLocal = isLocal;
- }
-
- /**
- * Returns whether or not this TargetType represents an annotation whose
- * target is exclusively a tree in a method body
- *
- * Note: wildcard bound targets could target a local tree and a class
- * member declaration signature tree
- */
- public boolean isLocal() {
- return isLocal;
- }
-
- public int targetTypeValue() {
- return this.targetTypeValue;
- }
-
- private static final TargetType[] targets;
-
- static {
- targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
- TargetType[] alltargets = values();
- for (TargetType target : alltargets) {
- if (target.targetTypeValue != UNKNOWN.targetTypeValue)
- targets[target.targetTypeValue] = target;
- }
- for (int i = 0; i <= MAXIMUM_TARGET_TYPE_VALUE; ++i) {
- if (targets[i] == null)
- targets[i] = UNKNOWN;
- }
- }
-
- public static boolean isValidTargetTypeValue(int tag) {
- if (tag == UNKNOWN.targetTypeValue)
- return true;
- return (tag >= 0 && tag < targets.length);
- }
-
- public static TargetType fromTargetTypeValue(int tag) {
- if (tag == UNKNOWN.targetTypeValue)
- return UNKNOWN;
-
- if (tag < 0 || tag >= targets.length)
- throw new AssertionError("Unknown TargetType: " + tag);
- return targets[tag];
- }
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/classfile/package-info.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-/**
- A minimalist library to read and write class files into objects closely
- based on the corresponding definitions in
- <cite>The Java™ Virtual Machine Specification</cite> (JVMS).
-
- <p><b>This is NOT part of any supported API.
- If you write code that depends on this, you do so at your own risk.
- This code and its internal interfaces are subject to change or
- deletion without notice.</b>
-*/
-@jdk.Exported(false)
-package com.sun.tools.classfile;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Mon Jun 01 10:15:20 2015 -0700
@@ -2749,7 +2749,7 @@
Scope s = c.members();
for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
if (sym.kind == MTH &&
- (sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
+ (sym.flags() & (ABSTRACT|IPROXY|DEFAULT|PRIVATE)) == ABSTRACT) {
MethodSymbol absmeth = (MethodSymbol)sym;
MethodSymbol implmeth = absmeth.implementation(impl, this, true);
if (implmeth == null || implmeth == absmeth) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Mon Jun 01 10:15:20 2015 -0700
@@ -985,7 +985,7 @@
if (isDefaultMethod || (tree.sym.flags() & (ABSTRACT | NATIVE)) == 0 &&
!relax)
log.error(tree.pos(), "missing.meth.body.or.decl.abstract");
- } else if ((tree.sym.flags() & ABSTRACT) != 0 && !isDefaultMethod) {
+ } else if ((tree.sym.flags() & (ABSTRACT|DEFAULT|PRIVATE)) == ABSTRACT) {
if ((owner.flags() & INTERFACE) != 0) {
log.error(tree.body.pos(), "intf.meth.cant.have.body");
} else {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/AnnotationWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-package com.sun.tools.javap;
-
-import com.sun.tools.classfile.Annotation;
-import com.sun.tools.classfile.TypeAnnotation;
-import com.sun.tools.classfile.Annotation.Annotation_element_value;
-import com.sun.tools.classfile.Annotation.Array_element_value;
-import com.sun.tools.classfile.Annotation.Class_element_value;
-import com.sun.tools.classfile.Annotation.Enum_element_value;
-import com.sun.tools.classfile.Annotation.Primitive_element_value;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.Descriptor;
-import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
-
-/**
- * A writer for writing annotations as text.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class AnnotationWriter extends BasicWriter {
- static AnnotationWriter instance(Context context) {
- AnnotationWriter instance = context.get(AnnotationWriter.class);
- if (instance == null)
- instance = new AnnotationWriter(context);
- return instance;
- }
-
- protected AnnotationWriter(Context context) {
- super(context);
- classWriter = ClassWriter.instance(context);
- constantWriter = ConstantWriter.instance(context);
- }
-
- public void write(Annotation annot) {
- write(annot, false);
- }
-
- public void write(Annotation annot, boolean resolveIndices) {
- writeDescriptor(annot.type_index, resolveIndices);
- boolean showParens = annot.num_element_value_pairs > 0 || !resolveIndices;
- if (showParens)
- print("(");
- for (int i = 0; i < annot.num_element_value_pairs; i++) {
- if (i > 0)
- print(",");
- write(annot.element_value_pairs[i], resolveIndices);
- }
- if (showParens)
- print(")");
- }
-
- public void write(TypeAnnotation annot) {
- write(annot, true, false);
- }
-
- public void write(TypeAnnotation annot, boolean showOffsets, boolean resolveIndices) {
- write(annot.annotation, resolveIndices);
- print(": ");
- write(annot.position, showOffsets);
- }
-
- public void write(TypeAnnotation.Position pos, boolean showOffsets) {
- print(pos.type);
-
- switch (pos.type) {
- // instanceof
- case INSTANCEOF:
- // new expression
- case NEW:
- // constructor/method reference receiver
- case CONSTRUCTOR_REFERENCE:
- case METHOD_REFERENCE:
- if (showOffsets) {
- print(", offset=");
- print(pos.offset);
- }
- break;
- // local variable
- case LOCAL_VARIABLE:
- // resource variable
- case RESOURCE_VARIABLE:
- if (pos.lvarOffset == null) {
- print(", lvarOffset is Null!");
- break;
- }
- print(", {");
- for (int i = 0; i < pos.lvarOffset.length; ++i) {
- if (i != 0) print("; ");
- if (showOffsets) {
- print("start_pc=");
- print(pos.lvarOffset[i]);
- }
- print(", length=");
- print(pos.lvarLength[i]);
- print(", index=");
- print(pos.lvarIndex[i]);
- }
- print("}");
- break;
- // exception parameter
- case EXCEPTION_PARAMETER:
- print(", exception_index=");
- print(pos.exception_index);
- break;
- // method receiver
- case METHOD_RECEIVER:
- // Do nothing
- break;
- // type parameter
- case CLASS_TYPE_PARAMETER:
- case METHOD_TYPE_PARAMETER:
- print(", param_index=");
- print(pos.parameter_index);
- break;
- // type parameter bound
- case CLASS_TYPE_PARAMETER_BOUND:
- case METHOD_TYPE_PARAMETER_BOUND:
- print(", param_index=");
- print(pos.parameter_index);
- print(", bound_index=");
- print(pos.bound_index);
- break;
- // class extends or implements clause
- case CLASS_EXTENDS:
- print(", type_index=");
- print(pos.type_index);
- break;
- // throws
- case THROWS:
- print(", type_index=");
- print(pos.type_index);
- break;
- // method parameter
- case METHOD_FORMAL_PARAMETER:
- print(", param_index=");
- print(pos.parameter_index);
- break;
- // type cast
- case CAST:
- // method/constructor/reference type argument
- case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
- case METHOD_INVOCATION_TYPE_ARGUMENT:
- case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
- case METHOD_REFERENCE_TYPE_ARGUMENT:
- if (showOffsets) {
- print(", offset=");
- print(pos.offset);
- }
- print(", type_index=");
- print(pos.type_index);
- break;
- // We don't need to worry about these
- case METHOD_RETURN:
- case FIELD:
- break;
- case UNKNOWN:
- throw new AssertionError("AnnotationWriter: UNKNOWN target type should never occur!");
- default:
- throw new AssertionError("AnnotationWriter: Unknown target type for position: " + pos);
- }
-
- // Append location data for generics/arrays.
- if (!pos.location.isEmpty()) {
- print(", location=");
- print(pos.location);
- }
- }
-
- public void write(Annotation.element_value_pair pair) {
- write(pair, false);
- }
-
- public void write(Annotation.element_value_pair pair, boolean resolveIndices) {
- writeIndex(pair.element_name_index, resolveIndices);
- print("=");
- write(pair.value, resolveIndices);
- }
-
- public void write(Annotation.element_value value) {
- write(value, false);
- }
-
- public void write(Annotation.element_value value, boolean resolveIndices) {
- ev_writer.write(value, resolveIndices);
- }
-
- private void writeDescriptor(int index, boolean resolveIndices) {
- if (resolveIndices) {
- try {
- ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
- Descriptor d = new Descriptor(index);
- print(d.getFieldType(constant_pool));
- return;
- } catch (ConstantPoolException | InvalidDescriptor ignore) {
- }
- }
-
- print("#" + index);
- }
-
- private void writeIndex(int index, boolean resolveIndices) {
- if (resolveIndices) {
- print(constantWriter.stringValue(index));
- } else
- print("#" + index);
- }
-
- element_value_Writer ev_writer = new element_value_Writer();
-
- class element_value_Writer implements Annotation.element_value.Visitor<Void,Boolean> {
- public void write(Annotation.element_value value, boolean resolveIndices) {
- value.accept(this, resolveIndices);
- }
-
- public Void visitPrimitive(Primitive_element_value ev, Boolean resolveIndices) {
- if (resolveIndices)
- writeIndex(ev.const_value_index, resolveIndices);
- else
- print(((char) ev.tag) + "#" + ev.const_value_index);
- return null;
- }
-
- public Void visitEnum(Enum_element_value ev, Boolean resolveIndices) {
- if (resolveIndices) {
- writeIndex(ev.type_name_index, resolveIndices);
- print(".");
- writeIndex(ev.const_name_index, resolveIndices);
- } else
- print(((char) ev.tag) + "#" + ev.type_name_index + ".#" + ev.const_name_index);
- return null;
- }
-
- public Void visitClass(Class_element_value ev, Boolean resolveIndices) {
- if (resolveIndices) {
- writeIndex(ev.class_info_index, resolveIndices);
- print(".class");
- } else
- print(((char) ev.tag) + "#" + ev.class_info_index);
- return null;
- }
-
- public Void visitAnnotation(Annotation_element_value ev, Boolean resolveIndices) {
- print((char) ev.tag);
- AnnotationWriter.this.write(ev.annotation_value, resolveIndices);
- return null;
- }
-
- public Void visitArray(Array_element_value ev, Boolean resolveIndices) {
- print("[");
- for (int i = 0; i < ev.num_values; i++) {
- if (i > 0)
- print(",");
- write(ev.values[i], resolveIndices);
- }
- print("]");
- return null;
- }
-
- }
-
- private ClassWriter classWriter;
- private ConstantWriter constantWriter;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/AttributeWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,712 +0,0 @@
-/*
- * Copyright (c) 2007, 2014, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.util.Formatter;
-
-import com.sun.tools.classfile.AccessFlags;
-import com.sun.tools.classfile.AnnotationDefault_attribute;
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.Attributes;
-import com.sun.tools.classfile.BootstrapMethods_attribute;
-import com.sun.tools.classfile.CharacterRangeTable_attribute;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.CompilationID_attribute;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.ConstantValue_attribute;
-import com.sun.tools.classfile.DefaultAttribute;
-import com.sun.tools.classfile.Deprecated_attribute;
-import com.sun.tools.classfile.EnclosingMethod_attribute;
-import com.sun.tools.classfile.Exceptions_attribute;
-import com.sun.tools.classfile.InnerClasses_attribute;
-import com.sun.tools.classfile.LineNumberTable_attribute;
-import com.sun.tools.classfile.LocalVariableTable_attribute;
-import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
-import com.sun.tools.classfile.MethodParameters_attribute;
-import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
-import com.sun.tools.classfile.Signature_attribute;
-import com.sun.tools.classfile.SourceDebugExtension_attribute;
-import com.sun.tools.classfile.SourceFile_attribute;
-import com.sun.tools.classfile.SourceID_attribute;
-import com.sun.tools.classfile.StackMapTable_attribute;
-import com.sun.tools.classfile.StackMap_attribute;
-import com.sun.tools.classfile.Synthetic_attribute;
-
-import static com.sun.tools.classfile.AccessFlags.*;
-
-import com.sun.tools.javac.util.Assert;
-import com.sun.tools.javac.util.StringUtils;
-
-/*
- * A writer for writing Attributes as text.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class AttributeWriter extends BasicWriter
- implements Attribute.Visitor<Void,Void>
-{
- public static AttributeWriter instance(Context context) {
- AttributeWriter instance = context.get(AttributeWriter.class);
- if (instance == null)
- instance = new AttributeWriter(context);
- return instance;
- }
-
- protected AttributeWriter(Context context) {
- super(context);
- context.put(AttributeWriter.class, this);
- annotationWriter = AnnotationWriter.instance(context);
- codeWriter = CodeWriter.instance(context);
- constantWriter = ConstantWriter.instance(context);
- options = Options.instance(context);
- }
-
- public void write(Object owner, Attribute attr, ConstantPool constant_pool) {
- if (attr != null) {
- Assert.checkNonNull(constant_pool);
- Assert.checkNonNull(owner);
- this.constant_pool = constant_pool;
- this.owner = owner;
- attr.accept(this, null);
- }
- }
-
- public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
- if (attrs != null) {
- Assert.checkNonNull(constant_pool);
- Assert.checkNonNull(owner);
- this.constant_pool = constant_pool;
- this.owner = owner;
- for (Attribute attr: attrs)
- attr.accept(this, null);
- }
- }
-
- public Void visitDefault(DefaultAttribute attr, Void ignore) {
- if (attr.reason != null) {
- report(attr.reason);
- }
- byte[] data = attr.info;
- int i = 0;
- int j = 0;
- print(" ");
- try {
- print(attr.getName(constant_pool));
- } catch (ConstantPoolException e) {
- report(e);
- print("attribute name = #" + attr.attribute_name_index);
- }
- print(": ");
- println("length = 0x" + toHex(attr.info.length));
-
- print(" ");
-
- while (i < data.length) {
- print(toHex(data[i], 2));
-
- j++;
- if (j == 16) {
- println();
- print(" ");
- j = 0;
- } else {
- print(" ");
- }
- i++;
- }
- println();
- return null;
- }
-
- public Void visitAnnotationDefault(AnnotationDefault_attribute attr, Void ignore) {
- println("AnnotationDefault:");
- indent(+1);
- print("default_value: ");
- annotationWriter.write(attr.default_value);
- indent(-1);
- return null;
- }
-
- public Void visitBootstrapMethods(BootstrapMethods_attribute attr, Void p) {
- println(Attribute.BootstrapMethods + ":");
- for (int i = 0; i < attr.bootstrap_method_specifiers.length ; i++) {
- BootstrapMethods_attribute.BootstrapMethodSpecifier bsm = attr.bootstrap_method_specifiers[i];
- indent(+1);
- print(i + ": #" + bsm.bootstrap_method_ref + " ");
- println(constantWriter.stringValue(bsm.bootstrap_method_ref));
- indent(+1);
- println("Method arguments:");
- indent(+1);
- for (int j = 0; j < bsm.bootstrap_arguments.length; j++) {
- print("#" + bsm.bootstrap_arguments[j] + " ");
- println(constantWriter.stringValue(bsm.bootstrap_arguments[j]));
- }
- indent(-3);
- }
- return null;
- }
-
- public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, Void ignore) {
- println("CharacterRangeTable:");
- indent(+1);
- for (int i = 0; i < attr.character_range_table.length; i++) {
- CharacterRangeTable_attribute.Entry e = attr.character_range_table[i];
- print(String.format(" %2d, %2d, %6x, %6x, %4x",
- e.start_pc, e.end_pc,
- e.character_range_start, e.character_range_end,
- e.flags));
- tab();
- print(String.format("// %2d, %2d, %4d:%02d, %4d:%02d",
- e.start_pc, e.end_pc,
- (e.character_range_start >> 10), (e.character_range_start & 0x3ff),
- (e.character_range_end >> 10), (e.character_range_end & 0x3ff)));
- if ((e.flags & CharacterRangeTable_attribute.CRT_STATEMENT) != 0)
- print(", statement");
- if ((e.flags & CharacterRangeTable_attribute.CRT_BLOCK) != 0)
- print(", block");
- if ((e.flags & CharacterRangeTable_attribute.CRT_ASSIGNMENT) != 0)
- print(", assignment");
- if ((e.flags & CharacterRangeTable_attribute.CRT_FLOW_CONTROLLER) != 0)
- print(", flow-controller");
- if ((e.flags & CharacterRangeTable_attribute.CRT_FLOW_TARGET) != 0)
- print(", flow-target");
- if ((e.flags & CharacterRangeTable_attribute.CRT_INVOKE) != 0)
- print(", invoke");
- if ((e.flags & CharacterRangeTable_attribute.CRT_CREATE) != 0)
- print(", create");
- if ((e.flags & CharacterRangeTable_attribute.CRT_BRANCH_TRUE) != 0)
- print(", branch-true");
- if ((e.flags & CharacterRangeTable_attribute.CRT_BRANCH_FALSE) != 0)
- print(", branch-false");
- println();
- }
- indent(-1);
- return null;
- }
-
- public Void visitCode(Code_attribute attr, Void ignore) {
- codeWriter.write(attr, constant_pool);
- return null;
- }
-
- public Void visitCompilationID(CompilationID_attribute attr, Void ignore) {
- constantWriter.write(attr.compilationID_index);
- return null;
- }
-
- public Void visitConstantValue(ConstantValue_attribute attr, Void ignore) {
- print("ConstantValue: ");
- constantWriter.write(attr.constantvalue_index);
- println();
- return null;
- }
-
- public Void visitDeprecated(Deprecated_attribute attr, Void ignore) {
- println("Deprecated: true");
- return null;
- }
-
- public Void visitEnclosingMethod(EnclosingMethod_attribute attr, Void ignore) {
- print("EnclosingMethod: #" + attr.class_index + ".#" + attr.method_index);
- tab();
- print("// " + getJavaClassName(attr));
- if (attr.method_index != 0)
- print("." + getMethodName(attr));
- println();
- return null;
- }
-
- private String getJavaClassName(EnclosingMethod_attribute a) {
- try {
- return getJavaName(a.getClassName(constant_pool));
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- private String getMethodName(EnclosingMethod_attribute a) {
- try {
- return a.getMethodName(constant_pool);
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- public Void visitExceptions(Exceptions_attribute attr, Void ignore) {
- println("Exceptions:");
- indent(+1);
- print("throws ");
- for (int i = 0; i < attr.number_of_exceptions; i++) {
- if (i > 0)
- print(", ");
- print(getJavaException(attr, i));
- }
- println();
- indent(-1);
- return null;
- }
-
- private String getJavaException(Exceptions_attribute attr, int index) {
- try {
- return getJavaName(attr.getException(index, constant_pool));
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- public Void visitInnerClasses(InnerClasses_attribute attr, Void ignore) {
- boolean first = true;
- for (int i = 0 ; i < attr.classes.length; i++) {
- InnerClasses_attribute.Info info = attr.classes[i];
- //access
- AccessFlags access_flags = info.inner_class_access_flags;
- if (options.checkAccess(access_flags)) {
- if (first) {
- writeInnerClassHeader();
- first = false;
- }
- for (String name: access_flags.getInnerClassModifiers())
- print(name + " ");
- if (info.inner_name_index != 0) {
- print("#" + info.inner_name_index + "= ");
- }
- print("#" + info.inner_class_info_index);
- if (info.outer_class_info_index != 0) {
- print(" of #" + info.outer_class_info_index);
- }
- print(";");
- tab();
- print("// ");
- if (info.inner_name_index != 0) {
- print(getInnerName(constant_pool, info) + "=");
- }
- constantWriter.write(info.inner_class_info_index);
- if (info.outer_class_info_index != 0) {
- print(" of ");
- constantWriter.write(info.outer_class_info_index);
- }
- println();
- }
- }
- if (!first)
- indent(-1);
- return null;
- }
-
- String getInnerName(ConstantPool constant_pool, InnerClasses_attribute.Info info) {
- try {
- return info.getInnerName(constant_pool);
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- private void writeInnerClassHeader() {
- println("InnerClasses:");
- indent(+1);
- }
-
- public Void visitLineNumberTable(LineNumberTable_attribute attr, Void ignore) {
- println("LineNumberTable:");
- indent(+1);
- for (LineNumberTable_attribute.Entry entry: attr.line_number_table) {
- println("line " + entry.line_number + ": " + entry.start_pc);
- }
- indent(-1);
- return null;
- }
-
- public Void visitLocalVariableTable(LocalVariableTable_attribute attr, Void ignore) {
- println("LocalVariableTable:");
- indent(+1);
- println("Start Length Slot Name Signature");
- for (LocalVariableTable_attribute.Entry entry : attr.local_variable_table) {
- println(String.format("%5d %7d %5d %5s %s",
- entry.start_pc, entry.length, entry.index,
- constantWriter.stringValue(entry.name_index),
- constantWriter.stringValue(entry.descriptor_index)));
- }
- indent(-1);
- return null;
- }
-
- public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, Void ignore) {
- println("LocalVariableTypeTable:");
- indent(+1);
- println("Start Length Slot Name Signature");
- for (LocalVariableTypeTable_attribute.Entry entry : attr.local_variable_table) {
- println(String.format("%5d %7d %5d %5s %s",
- entry.start_pc, entry.length, entry.index,
- constantWriter.stringValue(entry.name_index),
- constantWriter.stringValue(entry.signature_index)));
- }
- indent(-1);
- return null;
- }
-
- private static final String format = "%-31s%s";
-
- public Void visitMethodParameters(MethodParameters_attribute attr,
- Void ignore) {
-
- final String header = String.format(format, "Name", "Flags");
- println("MethodParameters:");
- indent(+1);
- println(header);
- for (MethodParameters_attribute.Entry entry :
- attr.method_parameter_table) {
- String namestr =
- entry.name_index != 0 ?
- constantWriter.stringValue(entry.name_index) : "<no name>";
- String flagstr =
- (0 != (entry.flags & ACC_FINAL) ? "final " : "") +
- (0 != (entry.flags & ACC_MANDATED) ? "mandated " : "") +
- (0 != (entry.flags & ACC_SYNTHETIC) ? "synthetic" : "");
- println(String.format(format, namestr, flagstr));
- }
- indent(-1);
- return null;
- }
-
- public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, Void ignore) {
- println("RuntimeVisibleAnnotations:");
- indent(+1);
- for (int i = 0; i < attr.annotations.length; i++) {
- print(i + ": ");
- annotationWriter.write(attr.annotations[i]);
- println();
- }
- indent(-1);
- return null;
- }
-
- public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, Void ignore) {
- println("RuntimeInvisibleAnnotations:");
- indent(+1);
- for (int i = 0; i < attr.annotations.length; i++) {
- print(i + ": ");
- annotationWriter.write(attr.annotations[i]);
- println();
- }
- indent(-1);
- return null;
- }
-
- public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, Void ignore) {
- println("RuntimeVisibleTypeAnnotations:");
- indent(+1);
- for (int i = 0; i < attr.annotations.length; i++) {
- print(i + ": ");
- annotationWriter.write(attr.annotations[i]);
- println();
- }
- indent(-1);
- return null;
- }
-
- public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, Void ignore) {
- println("RuntimeInvisibleTypeAnnotations:");
- indent(+1);
- for (int i = 0; i < attr.annotations.length; i++) {
- print(i + ": ");
- annotationWriter.write(attr.annotations[i]);
- println();
- }
- indent(-1);
- return null;
- }
-
- public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, Void ignore) {
- println("RuntimeVisibleParameterAnnotations:");
- indent(+1);
- for (int param = 0; param < attr.parameter_annotations.length; param++) {
- println("parameter " + param + ": ");
- indent(+1);
- for (int i = 0; i < attr.parameter_annotations[param].length; i++) {
- print(i + ": ");
- annotationWriter.write(attr.parameter_annotations[param][i]);
- println();
- }
- indent(-1);
- }
- indent(-1);
- return null;
- }
-
- public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, Void ignore) {
- println("RuntimeInvisibleParameterAnnotations:");
- indent(+1);
- for (int param = 0; param < attr.parameter_annotations.length; param++) {
- println(param + ": ");
- indent(+1);
- for (int i = 0; i < attr.parameter_annotations[param].length; i++) {
- print(i + ": ");
- annotationWriter.write(attr.parameter_annotations[param][i]);
- println();
- }
- indent(-1);
- }
- indent(-1);
- return null;
- }
-
- public Void visitSignature(Signature_attribute attr, Void ignore) {
- print("Signature: #" + attr.signature_index);
- tab();
- println("// " + getSignature(attr));
- return null;
- }
-
- String getSignature(Signature_attribute info) {
- try {
- return info.getSignature(constant_pool);
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr, Void ignore) {
- println("SourceDebugExtension:");
- indent(+1);
- for (String s: attr.getValue().split("[\r\n]+")) {
- println(s);
- }
- indent(-1);
- return null;
- }
-
- public Void visitSourceFile(SourceFile_attribute attr, Void ignore) {
- println("SourceFile: \"" + getSourceFile(attr) + "\"");
- return null;
- }
-
- private String getSourceFile(SourceFile_attribute attr) {
- try {
- return attr.getSourceFile(constant_pool);
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- public Void visitSourceID(SourceID_attribute attr, Void ignore) {
- constantWriter.write(attr.sourceID_index);
- return null;
- }
-
- public Void visitStackMap(StackMap_attribute attr, Void ignore) {
- println("StackMap: number_of_entries = " + attr.number_of_entries);
- indent(+1);
- StackMapTableWriter w = new StackMapTableWriter();
- for (StackMapTable_attribute.stack_map_frame entry : attr.entries) {
- w.write(entry);
- }
- indent(-1);
- return null;
- }
-
- public Void visitStackMapTable(StackMapTable_attribute attr, Void ignore) {
- println("StackMapTable: number_of_entries = " + attr.number_of_entries);
- indent(+1);
- StackMapTableWriter w = new StackMapTableWriter();
- for (StackMapTable_attribute.stack_map_frame entry : attr.entries) {
- w.write(entry);
- }
- indent(-1);
- return null;
- }
-
- class StackMapTableWriter // also handles CLDC StackMap attributes
- implements StackMapTable_attribute.stack_map_frame.Visitor<Void,Void> {
- public void write(StackMapTable_attribute.stack_map_frame frame) {
- frame.accept(this, null);
- }
-
- public Void visit_same_frame(StackMapTable_attribute.same_frame frame, Void p) {
- printHeader(frame, "/* same */");
- return null;
- }
-
- public Void visit_same_locals_1_stack_item_frame(StackMapTable_attribute.same_locals_1_stack_item_frame frame, Void p) {
- printHeader(frame, "/* same_locals_1_stack_item */");
- indent(+1);
- printMap("stack", frame.stack);
- indent(-1);
- return null;
- }
-
- public Void visit_same_locals_1_stack_item_frame_extended(StackMapTable_attribute.same_locals_1_stack_item_frame_extended frame, Void p) {
- printHeader(frame, "/* same_locals_1_stack_item_frame_extended */");
- indent(+1);
- println("offset_delta = " + frame.offset_delta);
- printMap("stack", frame.stack);
- indent(-1);
- return null;
- }
-
- public Void visit_chop_frame(StackMapTable_attribute.chop_frame frame, Void p) {
- printHeader(frame, "/* chop */");
- indent(+1);
- println("offset_delta = " + frame.offset_delta);
- indent(-1);
- return null;
- }
-
- public Void visit_same_frame_extended(StackMapTable_attribute.same_frame_extended frame, Void p) {
- printHeader(frame, "/* same_frame_extended */");
- indent(+1);
- println("offset_delta = " + frame.offset_delta);
- indent(-1);
- return null;
- }
-
- public Void visit_append_frame(StackMapTable_attribute.append_frame frame, Void p) {
- printHeader(frame, "/* append */");
- indent(+1);
- println("offset_delta = " + frame.offset_delta);
- printMap("locals", frame.locals);
- indent(-1);
- return null;
- }
-
- public Void visit_full_frame(StackMapTable_attribute.full_frame frame, Void p) {
- if (frame instanceof StackMap_attribute.stack_map_frame) {
- printHeader(frame, "offset = " + frame.offset_delta);
- indent(+1);
- } else {
- printHeader(frame, "/* full_frame */");
- indent(+1);
- println("offset_delta = " + frame.offset_delta);
- }
- printMap("locals", frame.locals);
- printMap("stack", frame.stack);
- indent(-1);
- return null;
- }
-
- void printHeader(StackMapTable_attribute.stack_map_frame frame, String extra) {
- print("frame_type = " + frame.frame_type + " ");
- println(extra);
- }
-
- void printMap(String name, StackMapTable_attribute.verification_type_info[] map) {
- print(name + " = [");
- for (int i = 0; i < map.length; i++) {
- StackMapTable_attribute.verification_type_info info = map[i];
- int tag = info.tag;
- switch (tag) {
- case StackMapTable_attribute.verification_type_info.ITEM_Object:
- print(" ");
- constantWriter.write(((StackMapTable_attribute.Object_variable_info) info).cpool_index);
- break;
- case StackMapTable_attribute.verification_type_info.ITEM_Uninitialized:
- print(" " + mapTypeName(tag));
- print(" " + ((StackMapTable_attribute.Uninitialized_variable_info) info).offset);
- break;
- default:
- print(" " + mapTypeName(tag));
- }
- print(i == (map.length - 1) ? " " : ",");
- }
- println("]");
- }
-
- String mapTypeName(int tag) {
- switch (tag) {
- case StackMapTable_attribute.verification_type_info.ITEM_Top:
- return "top";
-
- case StackMapTable_attribute.verification_type_info.ITEM_Integer:
- return "int";
-
- case StackMapTable_attribute.verification_type_info.ITEM_Float:
- return "float";
-
- case StackMapTable_attribute.verification_type_info.ITEM_Long:
- return "long";
-
- case StackMapTable_attribute.verification_type_info.ITEM_Double:
- return "double";
-
- case StackMapTable_attribute.verification_type_info.ITEM_Null:
- return "null";
-
- case StackMapTable_attribute.verification_type_info.ITEM_UninitializedThis:
- return "this";
-
- case StackMapTable_attribute.verification_type_info.ITEM_Object:
- return "CP";
-
- case StackMapTable_attribute.verification_type_info.ITEM_Uninitialized:
- return "uninitialized";
-
- default:
- report("unrecognized verification_type_info tag: " + tag);
- return "[tag:" + tag + "]";
- }
- }
- }
-
- public Void visitSynthetic(Synthetic_attribute attr, Void ignore) {
- println("Synthetic: true");
- return null;
- }
-
- static String getJavaName(String name) {
- return name.replace('/', '.');
- }
-
- String toHex(byte b, int w) {
- return toHex(b & 0xff, w);
- }
-
- static String toHex(int i) {
- return StringUtils.toUpperCase(Integer.toString(i, 16));
- }
-
- static String toHex(int i, int w) {
- String s = StringUtils.toUpperCase(Integer.toHexString(i));
- while (s.length() < w)
- s = "0" + s;
- return StringUtils.toUpperCase(s);
- }
-
- private AnnotationWriter annotationWriter;
- private CodeWriter codeWriter;
- private ConstantWriter constantWriter;
- private Options options;
-
- private ConstantPool constant_pool;
- private Object owner;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/BasicWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 2007, 2014, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.io.PrintWriter;
-
-import com.sun.tools.classfile.AttributeException;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.DescriptorException;
-
-/*
- * A writer similar to a PrintWriter but which does not hide exceptions.
- * The standard print calls are line-buffered; report calls write messages directly.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class BasicWriter {
- protected BasicWriter(Context context) {
- lineWriter = LineWriter.instance(context);
- out = context.get(PrintWriter.class);
- messages = context.get(Messages.class);
- if (messages == null)
- throw new AssertionError();
- }
-
- protected void print(String s) {
- lineWriter.print(s);
- }
-
- protected void print(Object o) {
- lineWriter.print(o == null ? null : o.toString());
- }
-
- protected void println() {
- lineWriter.println();
- }
-
- protected void println(String s) {
- lineWriter.print(s);
- lineWriter.println();
- }
-
- protected void println(Object o) {
- lineWriter.print(o == null ? null : o.toString());
- lineWriter.println();
- }
-
- protected void indent(int delta) {
- lineWriter.indent(delta);
- }
-
- protected void tab() {
- lineWriter.tab();
- }
-
- protected void setPendingNewline(boolean b) {
- lineWriter.pendingNewline = b;
- }
-
- protected String report(AttributeException e) {
- out.println("Error: " + e.getMessage()); // i18n?
- return "???";
- }
-
- protected String report(ConstantPoolException e) {
- out.println("Error: " + e.getMessage()); // i18n?
- return "???";
- }
-
- protected String report(DescriptorException e) {
- out.println("Error: " + e.getMessage()); // i18n?
- return "???";
- }
-
- protected String report(String msg) {
- out.println("Error: " + msg); // i18n?
- return "???";
- }
-
- protected String space(int w) {
- if (w < spaces.length && spaces[w] != null)
- return spaces[w];
-
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < w; i++)
- sb.append(" ");
-
- String s = sb.toString();
- if (w < spaces.length)
- spaces[w] = s;
-
- return s;
- }
-
- private String[] spaces = new String[80];
-
- private LineWriter lineWriter;
- private PrintWriter out;
- protected Messages messages;
-
- private static class LineWriter {
- static LineWriter instance(Context context) {
- LineWriter instance = context.get(LineWriter.class);
- if (instance == null)
- instance = new LineWriter(context);
- return instance;
- }
-
- protected LineWriter(Context context) {
- context.put(LineWriter.class, this);
- Options options = Options.instance(context);
- indentWidth = options.indentWidth;
- tabColumn = options.tabColumn;
- out = context.get(PrintWriter.class);
- buffer = new StringBuilder();
- }
-
- protected void print(String s) {
- if (pendingNewline) {
- println();
- pendingNewline = false;
- }
- if (s == null)
- s = "null";
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
- switch (c) {
- case ' ':
- pendingSpaces++;
- break;
-
- case '\n':
- println();
- break;
-
- default:
- if (buffer.length() == 0)
- indent();
- if (pendingSpaces > 0) {
- for (int sp = 0; sp < pendingSpaces; sp++)
- buffer.append(' ');
- pendingSpaces = 0;
- }
- buffer.append(c);
- }
- }
-
- }
-
- protected void println() {
- // ignore/discard pending spaces
- pendingSpaces = 0;
- out.println(buffer);
- buffer.setLength(0);
- }
-
- protected void indent(int delta) {
- indentCount += delta;
- }
-
- protected void tab() {
- int col = indentCount * indentWidth + tabColumn;
- pendingSpaces += (col <= buffer.length() ? 1 : col - buffer.length());
- }
-
- private void indent() {
- pendingSpaces += (indentCount * indentWidth);
- }
-
- private final PrintWriter out;
- private final StringBuilder buffer;
- private int indentCount;
- private final int indentWidth;
- private final int tabColumn;
- private boolean pendingNewline;
- private int pendingSpaces;
- }
-}
-
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/ClassWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,756 +0,0 @@
-/*
- * Copyright (c) 2007, 2014, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.net.URI;
-import java.text.DateFormat;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
-import com.sun.tools.classfile.AccessFlags;
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.Attributes;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.ConstantValue_attribute;
-import com.sun.tools.classfile.Descriptor;
-import com.sun.tools.classfile.DescriptorException;
-import com.sun.tools.classfile.Exceptions_attribute;
-import com.sun.tools.classfile.Field;
-import com.sun.tools.classfile.Method;
-import com.sun.tools.classfile.Signature;
-import com.sun.tools.classfile.Signature_attribute;
-import com.sun.tools.classfile.SourceFile_attribute;
-import com.sun.tools.classfile.Type;
-import com.sun.tools.classfile.Type.ArrayType;
-import com.sun.tools.classfile.Type.ClassSigType;
-import com.sun.tools.classfile.Type.ClassType;
-import com.sun.tools.classfile.Type.MethodType;
-import com.sun.tools.classfile.Type.SimpleType;
-import com.sun.tools.classfile.Type.TypeParamType;
-import com.sun.tools.classfile.Type.WildcardType;
-
-import static com.sun.tools.classfile.AccessFlags.*;
-
-/*
- * The main javap class to write the contents of a class file as text.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ClassWriter extends BasicWriter {
- static ClassWriter instance(Context context) {
- ClassWriter instance = context.get(ClassWriter.class);
- if (instance == null)
- instance = new ClassWriter(context);
- return instance;
- }
-
- protected ClassWriter(Context context) {
- super(context);
- context.put(ClassWriter.class, this);
- options = Options.instance(context);
- attrWriter = AttributeWriter.instance(context);
- codeWriter = CodeWriter.instance(context);
- constantWriter = ConstantWriter.instance(context);
- }
-
- void setDigest(String name, byte[] digest) {
- this.digestName = name;
- this.digest = digest;
- }
-
- void setFile(URI uri) {
- this.uri = uri;
- }
-
- void setFileSize(int size) {
- this.size = size;
- }
-
- void setLastModified(long lastModified) {
- this.lastModified = lastModified;
- }
-
- protected ClassFile getClassFile() {
- return classFile;
- }
-
- protected void setClassFile(ClassFile cf) {
- classFile = cf;
- constant_pool = classFile.constant_pool;
- }
-
- protected Method getMethod() {
- return method;
- }
-
- protected void setMethod(Method m) {
- method = m;
- }
-
- public void write(ClassFile cf) {
- setClassFile(cf);
-
- if (options.sysInfo || options.verbose) {
- if (uri != null) {
- if (uri.getScheme().equals("file"))
- println("Classfile " + uri.getPath());
- else
- println("Classfile " + uri);
- }
- indent(+1);
- if (lastModified != -1) {
- Date lm = new Date(lastModified);
- DateFormat df = DateFormat.getDateInstance();
- if (size > 0) {
- println("Last modified " + df.format(lm) + "; size " + size + " bytes");
- } else {
- println("Last modified " + df.format(lm));
- }
- } else if (size > 0) {
- println("Size " + size + " bytes");
- }
- if (digestName != null && digest != null) {
- StringBuilder sb = new StringBuilder();
- for (byte b: digest)
- sb.append(String.format("%02x", b));
- println(digestName + " checksum " + sb);
- }
- }
-
- Attribute sfa = cf.getAttribute(Attribute.SourceFile);
- if (sfa instanceof SourceFile_attribute) {
- println("Compiled from \"" + getSourceFile((SourceFile_attribute) sfa) + "\"");
- }
-
- if (options.sysInfo || options.verbose) {
- indent(-1);
- }
-
- String name = getJavaName(classFile);
- AccessFlags flags = cf.access_flags;
-
- writeModifiers(flags.getClassModifiers());
-
- if (classFile.isClass())
- print("class ");
- else if (classFile.isInterface())
- print("interface ");
-
- print(name);
-
- Signature_attribute sigAttr = getSignature(cf.attributes);
- if (sigAttr == null) {
- // use info from class file header
- if (classFile.isClass() && classFile.super_class != 0 ) {
- String sn = getJavaSuperclassName(cf);
- if (!sn.equals("java.lang.Object")) {
- print(" extends ");
- print(sn);
- }
- }
- for (int i = 0; i < classFile.interfaces.length; i++) {
- print(i == 0 ? (classFile.isClass() ? " implements " : " extends ") : ",");
- print(getJavaInterfaceName(classFile, i));
- }
- } else {
- try {
- Type t = sigAttr.getParsedSignature().getType(constant_pool);
- JavaTypePrinter p = new JavaTypePrinter(classFile.isInterface());
- // The signature parser cannot disambiguate between a
- // FieldType and a ClassSignatureType that only contains a superclass type.
- if (t instanceof Type.ClassSigType) {
- print(p.print(t));
- } else if (options.verbose || !t.isObject()) {
- print(" extends ");
- print(p.print(t));
- }
- } catch (ConstantPoolException e) {
- print(report(e));
- }
- }
-
- if (options.verbose) {
- println();
- indent(+1);
- println("minor version: " + cf.minor_version);
- println("major version: " + cf.major_version);
- writeList("flags: ", flags.getClassFlags(), "\n");
- indent(-1);
- constantWriter.writeConstantPool();
- } else {
- print(" ");
- }
-
- println("{");
- indent(+1);
- writeFields();
- writeMethods();
- indent(-1);
- println("}");
-
- if (options.verbose) {
- attrWriter.write(cf, cf.attributes, constant_pool);
- }
- }
- // where
- class JavaTypePrinter implements Type.Visitor<StringBuilder,StringBuilder> {
- boolean isInterface;
-
- JavaTypePrinter(boolean isInterface) {
- this.isInterface = isInterface;
- }
-
- String print(Type t) {
- return t.accept(this, new StringBuilder()).toString();
- }
-
- String printTypeArgs(List<? extends TypeParamType> typeParamTypes) {
- StringBuilder builder = new StringBuilder();
- appendIfNotEmpty(builder, "<", typeParamTypes, "> ");
- return builder.toString();
- }
-
- public StringBuilder visitSimpleType(SimpleType type, StringBuilder sb) {
- sb.append(getJavaName(type.name));
- return sb;
- }
-
- public StringBuilder visitArrayType(ArrayType type, StringBuilder sb) {
- append(sb, type.elemType);
- sb.append("[]");
- return sb;
- }
-
- public StringBuilder visitMethodType(MethodType type, StringBuilder sb) {
- appendIfNotEmpty(sb, "<", type.typeParamTypes, "> ");
- append(sb, type.returnType);
- append(sb, " (", type.paramTypes, ")");
- appendIfNotEmpty(sb, " throws ", type.throwsTypes, "");
- return sb;
- }
-
- public StringBuilder visitClassSigType(ClassSigType type, StringBuilder sb) {
- appendIfNotEmpty(sb, "<", type.typeParamTypes, ">");
- if (isInterface) {
- appendIfNotEmpty(sb, " extends ", type.superinterfaceTypes, "");
- } else {
- if (type.superclassType != null
- && (options.verbose || !type.superclassType.isObject())) {
- sb.append(" extends ");
- append(sb, type.superclassType);
- }
- appendIfNotEmpty(sb, " implements ", type.superinterfaceTypes, "");
- }
- return sb;
- }
-
- public StringBuilder visitClassType(ClassType type, StringBuilder sb) {
- if (type.outerType != null) {
- append(sb, type.outerType);
- sb.append(".");
- }
- sb.append(getJavaName(type.name));
- appendIfNotEmpty(sb, "<", type.typeArgs, ">");
- return sb;
- }
-
- public StringBuilder visitTypeParamType(TypeParamType type, StringBuilder sb) {
- sb.append(type.name);
- String sep = " extends ";
- if (type.classBound != null
- && (options.verbose || !type.classBound.isObject())) {
- sb.append(sep);
- append(sb, type.classBound);
- sep = " & ";
- }
- if (type.interfaceBounds != null) {
- for (Type bound: type.interfaceBounds) {
- sb.append(sep);
- append(sb, bound);
- sep = " & ";
- }
- }
- return sb;
- }
-
- public StringBuilder visitWildcardType(WildcardType type, StringBuilder sb) {
- switch (type.kind) {
- case UNBOUNDED:
- sb.append("?");
- break;
- case EXTENDS:
- sb.append("? extends ");
- append(sb, type.boundType);
- break;
- case SUPER:
- sb.append("? super ");
- append(sb, type.boundType);
- break;
- default:
- throw new AssertionError();
- }
- return sb;
- }
-
- private void append(StringBuilder sb, Type t) {
- t.accept(this, sb);
- }
-
- private void append(StringBuilder sb, String prefix, List<? extends Type> list, String suffix) {
- sb.append(prefix);
- String sep = "";
- for (Type t: list) {
- sb.append(sep);
- append(sb, t);
- sep = ", ";
- }
- sb.append(suffix);
- }
-
- private void appendIfNotEmpty(StringBuilder sb, String prefix, List<? extends Type> list, String suffix) {
- if (!isEmpty(list))
- append(sb, prefix, list, suffix);
- }
-
- private boolean isEmpty(List<? extends Type> list) {
- return (list == null || list.isEmpty());
- }
- }
-
- protected void writeFields() {
- for (Field f: classFile.fields) {
- writeField(f);
- }
- }
-
- protected void writeField(Field f) {
- if (!options.checkAccess(f.access_flags))
- return;
-
- AccessFlags flags = f.access_flags;
- writeModifiers(flags.getFieldModifiers());
- Signature_attribute sigAttr = getSignature(f.attributes);
- if (sigAttr == null)
- print(getJavaFieldType(f.descriptor));
- else {
- try {
- Type t = sigAttr.getParsedSignature().getType(constant_pool);
- print(getJavaName(t.toString()));
- } catch (ConstantPoolException e) {
- // report error?
- // fall back on non-generic descriptor
- print(getJavaFieldType(f.descriptor));
- }
- }
- print(" ");
- print(getFieldName(f));
- if (options.showConstants) {
- Attribute a = f.attributes.get(Attribute.ConstantValue);
- if (a instanceof ConstantValue_attribute) {
- print(" = ");
- ConstantValue_attribute cv = (ConstantValue_attribute) a;
- print(getConstantValue(f.descriptor, cv.constantvalue_index));
- }
- }
- print(";");
- println();
-
- indent(+1);
-
- boolean showBlank = false;
-
- if (options.showDescriptors)
- println("descriptor: " + getValue(f.descriptor));
-
- if (options.verbose)
- writeList("flags: ", flags.getFieldFlags(), "\n");
-
- if (options.showAllAttrs) {
- for (Attribute attr: f.attributes)
- attrWriter.write(f, attr, constant_pool);
- showBlank = true;
- }
-
- indent(-1);
-
- if (showBlank || options.showDisassembled || options.showLineAndLocalVariableTables)
- println();
- }
-
- protected void writeMethods() {
- for (Method m: classFile.methods)
- writeMethod(m);
- setPendingNewline(false);
- }
-
- protected void writeMethod(Method m) {
- if (!options.checkAccess(m.access_flags))
- return;
-
- method = m;
-
- AccessFlags flags = m.access_flags;
-
- Descriptor d;
- Type.MethodType methodType;
- List<? extends Type> methodExceptions;
-
- Signature_attribute sigAttr = getSignature(m.attributes);
- if (sigAttr == null) {
- d = m.descriptor;
- methodType = null;
- methodExceptions = null;
- } else {
- Signature methodSig = sigAttr.getParsedSignature();
- d = methodSig;
- try {
- methodType = (Type.MethodType) methodSig.getType(constant_pool);
- methodExceptions = methodType.throwsTypes;
- if (methodExceptions != null && methodExceptions.isEmpty())
- methodExceptions = null;
- } catch (ConstantPoolException e) {
- // report error?
- // fall back on standard descriptor
- methodType = null;
- methodExceptions = null;
- }
- }
-
- writeModifiers(flags.getMethodModifiers());
- if (methodType != null) {
- print(new JavaTypePrinter(false).printTypeArgs(methodType.typeParamTypes));
- }
- if (getName(m).equals("<init>")) {
- print(getJavaName(classFile));
- print(getJavaParameterTypes(d, flags));
- } else if (getName(m).equals("<clinit>")) {
- print("{}");
- } else {
- print(getJavaReturnType(d));
- print(" ");
- print(getName(m));
- print(getJavaParameterTypes(d, flags));
- }
-
- Attribute e_attr = m.attributes.get(Attribute.Exceptions);
- if (e_attr != null) { // if there are generic exceptions, there must be erased exceptions
- if (e_attr instanceof Exceptions_attribute) {
- Exceptions_attribute exceptions = (Exceptions_attribute) e_attr;
- print(" throws ");
- if (methodExceptions != null) { // use generic list if available
- writeList("", methodExceptions, "");
- } else {
- for (int i = 0; i < exceptions.number_of_exceptions; i++) {
- if (i > 0)
- print(", ");
- print(getJavaException(exceptions, i));
- }
- }
- } else {
- report("Unexpected or invalid value for Exceptions attribute");
- }
- }
-
- println(";");
-
- indent(+1);
-
- if (options.showDescriptors) {
- println("descriptor: " + getValue(m.descriptor));
- }
-
- if (options.verbose) {
- writeList("flags: ", flags.getMethodFlags(), "\n");
- }
-
- Code_attribute code = null;
- Attribute c_attr = m.attributes.get(Attribute.Code);
- if (c_attr != null) {
- if (c_attr instanceof Code_attribute)
- code = (Code_attribute) c_attr;
- else
- report("Unexpected or invalid value for Code attribute");
- }
-
- if (options.showAllAttrs) {
- Attribute[] attrs = m.attributes.attrs;
- for (Attribute attr: attrs)
- attrWriter.write(m, attr, constant_pool);
- } else if (code != null) {
- if (options.showDisassembled) {
- println("Code:");
- codeWriter.writeInstrs(code);
- codeWriter.writeExceptionTable(code);
- }
-
- if (options.showLineAndLocalVariableTables) {
- attrWriter.write(code, code.attributes.get(Attribute.LineNumberTable), constant_pool);
- attrWriter.write(code, code.attributes.get(Attribute.LocalVariableTable), constant_pool);
- }
- }
-
- indent(-1);
-
- // set pendingNewline to write a newline before the next method (if any)
- // if a separator is desired
- setPendingNewline(
- options.showDisassembled ||
- options.showAllAttrs ||
- options.showDescriptors ||
- options.showLineAndLocalVariableTables ||
- options.verbose);
- }
-
- void writeModifiers(Collection<String> items) {
- for (Object item: items) {
- print(item);
- print(" ");
- }
- }
-
- void writeList(String prefix, Collection<?> items, String suffix) {
- print(prefix);
- String sep = "";
- for (Object item: items) {
- print(sep);
- print(item);
- sep = ", ";
- }
- print(suffix);
- }
-
- void writeListIfNotEmpty(String prefix, List<?> items, String suffix) {
- if (items != null && items.size() > 0)
- writeList(prefix, items, suffix);
- }
-
- Signature_attribute getSignature(Attributes attributes) {
- return (Signature_attribute) attributes.get(Attribute.Signature);
- }
-
- String adjustVarargs(AccessFlags flags, String params) {
- if (flags.is(ACC_VARARGS)) {
- int i = params.lastIndexOf("[]");
- if (i > 0)
- return params.substring(0, i) + "..." + params.substring(i+2);
- }
-
- return params;
- }
-
- String getJavaName(ClassFile cf) {
- try {
- return getJavaName(cf.getName());
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- String getJavaSuperclassName(ClassFile cf) {
- try {
- return getJavaName(cf.getSuperclassName());
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- String getJavaInterfaceName(ClassFile cf, int index) {
- try {
- return getJavaName(cf.getInterfaceName(index));
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- String getJavaFieldType(Descriptor d) {
- try {
- return getJavaName(d.getFieldType(constant_pool));
- } catch (ConstantPoolException e) {
- return report(e);
- } catch (DescriptorException e) {
- return report(e);
- }
- }
-
- String getJavaReturnType(Descriptor d) {
- try {
- return getJavaName(d.getReturnType(constant_pool));
- } catch (ConstantPoolException e) {
- return report(e);
- } catch (DescriptorException e) {
- return report(e);
- }
- }
-
- String getJavaParameterTypes(Descriptor d, AccessFlags flags) {
- try {
- return getJavaName(adjustVarargs(flags, d.getParameterTypes(constant_pool)));
- } catch (ConstantPoolException e) {
- return report(e);
- } catch (DescriptorException e) {
- return report(e);
- }
- }
-
- String getJavaException(Exceptions_attribute attr, int index) {
- try {
- return getJavaName(attr.getException(index, constant_pool));
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- String getValue(Descriptor d) {
- try {
- return d.getValue(constant_pool);
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- String getFieldName(Field f) {
- try {
- return f.getName(constant_pool);
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- String getName(Method m) {
- try {
- return m.getName(constant_pool);
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- static String getJavaName(String name) {
- return name.replace('/', '.');
- }
-
- String getSourceFile(SourceFile_attribute attr) {
- try {
- return attr.getSourceFile(constant_pool);
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- /**
- * Get the value of an entry in the constant pool as a Java constant.
- * Characters and booleans are represented by CONSTANT_Intgere entries.
- * Character and string values are processed to escape characters outside
- * the basic printable ASCII set.
- * @param d the descriptor, giving the expected type of the constant
- * @param index the index of the value in the constant pool
- * @return a printable string containing the value of the constant.
- */
- String getConstantValue(Descriptor d, int index) {
- try {
- ConstantPool.CPInfo cpInfo = constant_pool.get(index);
-
- switch (cpInfo.getTag()) {
- case ConstantPool.CONSTANT_Integer: {
- ConstantPool.CONSTANT_Integer_info info =
- (ConstantPool.CONSTANT_Integer_info) cpInfo;
- String t = d.getValue(constant_pool);
- if (t.equals("C")) { // character
- return getConstantCharValue((char) info.value);
- } else if (t.equals("Z")) { // boolean
- return String.valueOf(info.value == 1);
- } else { // other: assume integer
- return String.valueOf(info.value);
- }
- }
-
- case ConstantPool.CONSTANT_String: {
- ConstantPool.CONSTANT_String_info info =
- (ConstantPool.CONSTANT_String_info) cpInfo;
- return getConstantStringValue(info.getString());
- }
-
- default:
- return constantWriter.stringValue(cpInfo);
- }
- } catch (ConstantPoolException e) {
- return "#" + index;
- }
- }
-
- private String getConstantCharValue(char c) {
- StringBuilder sb = new StringBuilder();
- sb.append('\'');
- sb.append(esc(c, '\''));
- sb.append('\'');
- return sb.toString();
- }
-
- private String getConstantStringValue(String s) {
- StringBuilder sb = new StringBuilder();
- sb.append("\"");
- for (int i = 0; i < s.length(); i++) {
- sb.append(esc(s.charAt(i), '"'));
- }
- sb.append("\"");
- return sb.toString();
- }
-
- private String esc(char c, char quote) {
- if (32 <= c && c <= 126 && c != quote)
- return String.valueOf(c);
- else switch (c) {
- case '\b': return "\\b";
- case '\n': return "\\n";
- case '\t': return "\\t";
- case '\f': return "\\f";
- case '\r': return "\\r";
- case '\\': return "\\\\";
- case '\'': return "\\'";
- case '\"': return "\\\"";
- default: return String.format("\\u%04x", (int) c);
- }
- }
-
- private Options options;
- private AttributeWriter attrWriter;
- private CodeWriter codeWriter;
- private ConstantWriter constantWriter;
- private ClassFile classFile;
- private URI uri;
- private long lastModified;
- private String digestName;
- private byte[] digest;
- private int size;
- private ConstantPool constant_pool;
- private Method method;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/CodeWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.sun.tools.classfile.AccessFlags;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.DescriptorException;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.Instruction.TypeKind;
-import com.sun.tools.classfile.Method;
-
-/*
- * Write the contents of a Code attribute.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class CodeWriter extends BasicWriter {
- public static CodeWriter instance(Context context) {
- CodeWriter instance = context.get(CodeWriter.class);
- if (instance == null)
- instance = new CodeWriter(context);
- return instance;
- }
-
- protected CodeWriter(Context context) {
- super(context);
- context.put(CodeWriter.class, this);
- attrWriter = AttributeWriter.instance(context);
- classWriter = ClassWriter.instance(context);
- constantWriter = ConstantWriter.instance(context);
- sourceWriter = SourceWriter.instance(context);
- tryBlockWriter = TryBlockWriter.instance(context);
- stackMapWriter = StackMapWriter.instance(context);
- localVariableTableWriter = LocalVariableTableWriter.instance(context);
- localVariableTypeTableWriter = LocalVariableTypeTableWriter.instance(context);
- typeAnnotationWriter = TypeAnnotationWriter.instance(context);
- options = Options.instance(context);
- }
-
- void write(Code_attribute attr, ConstantPool constant_pool) {
- println("Code:");
- indent(+1);
- writeVerboseHeader(attr, constant_pool);
- writeInstrs(attr);
- writeExceptionTable(attr);
- attrWriter.write(attr, attr.attributes, constant_pool);
- indent(-1);
- }
-
- public void writeVerboseHeader(Code_attribute attr, ConstantPool constant_pool) {
- Method method = classWriter.getMethod();
- String argCount;
- try {
- int n = method.descriptor.getParameterCount(constant_pool);
- if (!method.access_flags.is(AccessFlags.ACC_STATIC))
- ++n; // for 'this'
- argCount = Integer.toString(n);
- } catch (ConstantPoolException e) {
- argCount = report(e);
- } catch (DescriptorException e) {
- argCount = report(e);
- }
-
- println("stack=" + attr.max_stack +
- ", locals=" + attr.max_locals +
- ", args_size=" + argCount);
-
- }
-
- public void writeInstrs(Code_attribute attr) {
- List<InstructionDetailWriter> detailWriters = getDetailWriters(attr);
-
- for (Instruction instr: attr.getInstructions()) {
- try {
- for (InstructionDetailWriter w: detailWriters)
- w.writeDetails(instr);
- writeInstr(instr);
- } catch (ArrayIndexOutOfBoundsException e) {
- println(report("error at or after byte " + instr.getPC()));
- break;
- }
- }
-
- for (InstructionDetailWriter w: detailWriters)
- w.flush();
- }
-
- public void writeInstr(Instruction instr) {
- print(String.format("%4d: %-13s ", instr.getPC(), instr.getMnemonic()));
- // compute the number of indentations for the body of multi-line instructions
- // This is 6 (the width of "%4d: "), divided by the width of each indentation level,
- // and rounded up to the next integer.
- int indentWidth = options.indentWidth;
- int indent = (6 + indentWidth - 1) / indentWidth;
- instr.accept(instructionPrinter, indent);
- println();
- }
- // where
- Instruction.KindVisitor<Void,Integer> instructionPrinter =
- new Instruction.KindVisitor<Void,Integer>() {
-
- public Void visitNoOperands(Instruction instr, Integer indent) {
- return null;
- }
-
- public Void visitArrayType(Instruction instr, TypeKind kind, Integer indent) {
- print(" " + kind.name);
- return null;
- }
-
- public Void visitBranch(Instruction instr, int offset, Integer indent) {
- print((instr.getPC() + offset));
- return null;
- }
-
- public Void visitConstantPoolRef(Instruction instr, int index, Integer indent) {
- print("#" + index);
- tab();
- print("// ");
- printConstant(index);
- return null;
- }
-
- public Void visitConstantPoolRefAndValue(Instruction instr, int index, int value, Integer indent) {
- print("#" + index + ", " + value);
- tab();
- print("// ");
- printConstant(index);
- return null;
- }
-
- public Void visitLocal(Instruction instr, int index, Integer indent) {
- print(index);
- return null;
- }
-
- public Void visitLocalAndValue(Instruction instr, int index, int value, Integer indent) {
- print(index + ", " + value);
- return null;
- }
-
- public Void visitLookupSwitch(Instruction instr,
- int default_, int npairs, int[] matches, int[] offsets, Integer indent) {
- int pc = instr.getPC();
- print("{ // " + npairs);
- indent(indent);
- for (int i = 0; i < npairs; i++) {
- print(String.format("%n%12d: %d", matches[i], (pc + offsets[i])));
- }
- print("\n default: " + (pc + default_) + "\n}");
- indent(-indent);
- return null;
- }
-
- public Void visitTableSwitch(Instruction instr,
- int default_, int low, int high, int[] offsets, Integer indent) {
- int pc = instr.getPC();
- print("{ // " + low + " to " + high);
- indent(indent);
- for (int i = 0; i < offsets.length; i++) {
- print(String.format("%n%12d: %d", (low + i), (pc + offsets[i])));
- }
- print("\n default: " + (pc + default_) + "\n}");
- indent(-indent);
- return null;
- }
-
- public Void visitValue(Instruction instr, int value, Integer indent) {
- print(value);
- return null;
- }
-
- public Void visitUnknown(Instruction instr, Integer indent) {
- return null;
- }
- };
-
-
- public void writeExceptionTable(Code_attribute attr) {
- if (attr.exception_table_length > 0) {
- println("Exception table:");
- indent(+1);
- println(" from to target type");
- for (int i = 0; i < attr.exception_table.length; i++) {
- Code_attribute.Exception_data handler = attr.exception_table[i];
- print(String.format(" %5d %5d %5d",
- handler.start_pc, handler.end_pc, handler.handler_pc));
- print(" ");
- int catch_type = handler.catch_type;
- if (catch_type == 0) {
- println("any");
- } else {
- print("Class ");
- println(constantWriter.stringValue(catch_type));
- }
- }
- indent(-1);
- }
-
- }
-
- private void printConstant(int index) {
- constantWriter.write(index);
- }
-
- private List<InstructionDetailWriter> getDetailWriters(Code_attribute attr) {
- List<InstructionDetailWriter> detailWriters = new ArrayList<>();
- if (options.details.contains(InstructionDetailWriter.Kind.SOURCE)) {
- sourceWriter.reset(classWriter.getClassFile(), attr);
- if (sourceWriter.hasSource())
- detailWriters.add(sourceWriter);
- else
- println("(Source code not available)");
- }
-
- if (options.details.contains(InstructionDetailWriter.Kind.LOCAL_VARS)) {
- localVariableTableWriter.reset(attr);
- detailWriters.add(localVariableTableWriter);
- }
-
- if (options.details.contains(InstructionDetailWriter.Kind.LOCAL_VAR_TYPES)) {
- localVariableTypeTableWriter.reset(attr);
- detailWriters.add(localVariableTypeTableWriter);
- }
-
- if (options.details.contains(InstructionDetailWriter.Kind.STACKMAPS)) {
- stackMapWriter.reset(attr);
- stackMapWriter.writeInitialDetails();
- detailWriters.add(stackMapWriter);
- }
-
- if (options.details.contains(InstructionDetailWriter.Kind.TRY_BLOCKS)) {
- tryBlockWriter.reset(attr);
- detailWriters.add(tryBlockWriter);
- }
-
- if (options.details.contains(InstructionDetailWriter.Kind.TYPE_ANNOS)) {
- typeAnnotationWriter.reset(attr);
- detailWriters.add(typeAnnotationWriter);
- }
-
- return detailWriters;
- }
-
- private AttributeWriter attrWriter;
- private ClassWriter classWriter;
- private ConstantWriter constantWriter;
- private LocalVariableTableWriter localVariableTableWriter;
- private LocalVariableTypeTableWriter localVariableTypeTableWriter;
- private TypeAnnotationWriter typeAnnotationWriter;
- private SourceWriter sourceWriter;
- private StackMapWriter stackMapWriter;
- private TryBlockWriter tryBlockWriter;
- private Options options;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/ConstantWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,466 +0,0 @@
-/*
- * Copyright (c) 2007, 2014, 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.
- */
-
-package com.sun.tools.javap;
-
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPoolException;
-
-import static com.sun.tools.classfile.ConstantPool.*;
-
-/*
- * Write a constant pool entry.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class ConstantWriter extends BasicWriter {
- public static ConstantWriter instance(Context context) {
- ConstantWriter instance = context.get(ConstantWriter.class);
- if (instance == null)
- instance = new ConstantWriter(context);
- return instance;
- }
-
- protected ConstantWriter(Context context) {
- super(context);
- context.put(ConstantWriter.class, this);
- classWriter = ClassWriter.instance(context);
- options = Options.instance(context);
- }
-
- protected void writeConstantPool() {
- ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
- writeConstantPool(constant_pool);
- }
-
- protected void writeConstantPool(ConstantPool constant_pool) {
- ConstantPool.Visitor<Integer, Void> v = new ConstantPool.Visitor<Integer,Void>() {
- public Integer visitClass(CONSTANT_Class_info info, Void p) {
- print("#" + info.name_index);
- tab();
- println("// " + stringValue(info));
- return 1;
- }
-
- public Integer visitDouble(CONSTANT_Double_info info, Void p) {
- println(stringValue(info));
- return 2;
- }
-
- public Integer visitFieldref(CONSTANT_Fieldref_info info, Void p) {
- print("#" + info.class_index + ".#" + info.name_and_type_index);
- tab();
- println("// " + stringValue(info));
- return 1;
- }
-
- public Integer visitFloat(CONSTANT_Float_info info, Void p) {
- println(stringValue(info));
- return 1;
- }
-
- public Integer visitInteger(CONSTANT_Integer_info info, Void p) {
- println(stringValue(info));
- return 1;
- }
-
- public Integer visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
- print("#" + info.class_index + ".#" + info.name_and_type_index);
- tab();
- println("// " + stringValue(info));
- return 1;
- }
-
- public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
- print("#" + info.bootstrap_method_attr_index + ":#" + info.name_and_type_index);
- tab();
- println("// " + stringValue(info));
- return 1;
- }
-
- public Integer visitLong(CONSTANT_Long_info info, Void p) {
- println(stringValue(info));
- return 2;
- }
-
- public Integer visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
- print("#" + info.name_index + ":#" + info.type_index);
- tab();
- println("// " + stringValue(info));
- return 1;
- }
-
- public Integer visitMethodref(CONSTANT_Methodref_info info, Void p) {
- print("#" + info.class_index + ".#" + info.name_and_type_index);
- tab();
- println("// " + stringValue(info));
- return 1;
- }
-
- public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
- print("#" + info.reference_kind.tag + ":#" + info.reference_index);
- tab();
- println("// " + stringValue(info));
- return 1;
- }
-
- public Integer visitMethodType(CONSTANT_MethodType_info info, Void p) {
- print("#" + info.descriptor_index);
- tab();
- println("// " + stringValue(info));
- return 1;
- }
-
- public Integer visitString(CONSTANT_String_info info, Void p) {
- print("#" + info.string_index);
- tab();
- println("// " + stringValue(info));
- return 1;
- }
-
- public Integer visitUtf8(CONSTANT_Utf8_info info, Void p) {
- println(stringValue(info));
- return 1;
- }
-
- };
- println("Constant pool:");
- indent(+1);
- int width = String.valueOf(constant_pool.size()).length() + 1;
- int cpx = 1;
- while (cpx < constant_pool.size()) {
- print(String.format("%" + width + "s", ("#" + cpx)));
- try {
- CPInfo cpInfo = constant_pool.get(cpx);
- print(String.format(" = %-18s ", cpTagName(cpInfo)));
- cpx += cpInfo.accept(v, null);
- } catch (ConstantPool.InvalidIndex ex) {
- // should not happen
- }
- }
- indent(-1);
- }
-
- protected void write(int cpx) {
- ClassFile classFile = classWriter.getClassFile();
- if (cpx == 0) {
- print("#0");
- return;
- }
-
- CPInfo cpInfo;
- try {
- cpInfo = classFile.constant_pool.get(cpx);
- } catch (ConstantPoolException e) {
- print("#" + cpx);
- return;
- }
-
- int tag = cpInfo.getTag();
- switch (tag) {
- case CONSTANT_Methodref:
- case CONSTANT_InterfaceMethodref:
- case CONSTANT_Fieldref:
- // simplify references within this class
- CPRefInfo ref = (CPRefInfo) cpInfo;
- try {
- if (ref.class_index == classFile.this_class)
- cpInfo = classFile.constant_pool.get(ref.name_and_type_index);
- } catch (ConstantPool.InvalidIndex e) {
- // ignore, for now
- }
- }
- print(tagName(tag) + " " + stringValue(cpInfo));
- }
-
- String cpTagName(CPInfo cpInfo) {
- String n = cpInfo.getClass().getSimpleName();
- return n.replace("CONSTANT_", "").replace("_info", "");
- }
-
- String tagName(int tag) {
- switch (tag) {
- case CONSTANT_Utf8:
- return "Utf8";
- case CONSTANT_Integer:
- return "int";
- case CONSTANT_Float:
- return "float";
- case CONSTANT_Long:
- return "long";
- case CONSTANT_Double:
- return "double";
- case CONSTANT_Class:
- return "class";
- case CONSTANT_String:
- return "String";
- case CONSTANT_Fieldref:
- return "Field";
- case CONSTANT_MethodHandle:
- return "MethodHandle";
- case CONSTANT_MethodType:
- return "MethodType";
- case CONSTANT_Methodref:
- return "Method";
- case CONSTANT_InterfaceMethodref:
- return "InterfaceMethod";
- case CONSTANT_InvokeDynamic:
- return "InvokeDynamic";
- case CONSTANT_NameAndType:
- return "NameAndType";
- default:
- return "(unknown tag " + tag + ")";
- }
- }
-
- String stringValue(int constant_pool_index) {
- ClassFile classFile = classWriter.getClassFile();
- try {
- return stringValue(classFile.constant_pool.get(constant_pool_index));
- } catch (ConstantPool.InvalidIndex e) {
- return report(e);
- }
- }
-
- String stringValue(CPInfo cpInfo) {
- return stringValueVisitor.visit(cpInfo);
- }
-
- StringValueVisitor stringValueVisitor = new StringValueVisitor();
-
- private class StringValueVisitor implements ConstantPool.Visitor<String, Void> {
- public String visit(CPInfo info) {
- return info.accept(this, null);
- }
-
- public String visitClass(CONSTANT_Class_info info, Void p) {
- return getCheckedName(info);
- }
-
- String getCheckedName(CONSTANT_Class_info info) {
- try {
- return checkName(info.getName());
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- public String visitDouble(CONSTANT_Double_info info, Void p) {
- return info.value + "d";
- }
-
- public String visitFieldref(CONSTANT_Fieldref_info info, Void p) {
- return visitRef(info, p);
- }
-
- public String visitFloat(CONSTANT_Float_info info, Void p) {
- return info.value + "f";
- }
-
- public String visitInteger(CONSTANT_Integer_info info, Void p) {
- return String.valueOf(info.value);
- }
-
- public String visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
- return visitRef(info, p);
- }
-
- public String visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
- try {
- String callee = stringValue(info.getNameAndTypeInfo());
- return "#" + info.bootstrap_method_attr_index + ":" + callee;
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- public String visitLong(CONSTANT_Long_info info, Void p) {
- return info.value + "l";
- }
-
- public String visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
- return getCheckedName(info) + ":" + getType(info);
- }
-
- String getCheckedName(CONSTANT_NameAndType_info info) {
- try {
- return checkName(info.getName());
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- String getType(CONSTANT_NameAndType_info info) {
- try {
- return info.getType();
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- public String visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
- try {
- return info.reference_kind.name + " " + stringValue(info.getCPRefInfo());
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- public String visitMethodType(CONSTANT_MethodType_info info, Void p) {
- try {
- return info.getType();
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- public String visitMethodref(CONSTANT_Methodref_info info, Void p) {
- return visitRef(info, p);
- }
-
- public String visitString(CONSTANT_String_info info, Void p) {
- try {
- ClassFile classFile = classWriter.getClassFile();
- int string_index = info.string_index;
- return stringValue(classFile.constant_pool.getUTF8Info(string_index));
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
-
- public String visitUtf8(CONSTANT_Utf8_info info, Void p) {
- String s = info.value;
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
- switch (c) {
- case '\t':
- sb.append('\\').append('t');
- break;
- case '\n':
- sb.append('\\').append('n');
- break;
- case '\r':
- sb.append('\\').append('r');
- break;
- case '\b':
- sb.append('\\').append('b');
- break;
- case '\f':
- sb.append('\\').append('f');
- break;
- case '\"':
- sb.append('\\').append('\"');
- break;
- case '\'':
- sb.append('\\').append('\'');
- break;
- case '\\':
- sb.append('\\').append('\\');
- break;
- default:
- sb.append(c);
- }
- }
- return sb.toString();
- }
-
- String visitRef(CPRefInfo info, Void p) {
- String cn = getCheckedClassName(info);
- String nat;
- try {
- nat = stringValue(info.getNameAndTypeInfo());
- } catch (ConstantPoolException e) {
- nat = report(e);
- }
- return cn + "." + nat;
- }
-
- String getCheckedClassName(CPRefInfo info) {
- try {
- return checkName(info.getClassName());
- } catch (ConstantPoolException e) {
- return report(e);
- }
- }
- }
-
- /* If name is a valid binary name, return it; otherwise quote it. */
- private static String checkName(String name) {
- if (name == null)
- return "null";
-
- int len = name.length();
- if (len == 0)
- return "\"\"";
-
- int cc = '/';
- int cp;
- for (int k = 0; k < len; k += Character.charCount(cp)) {
- cp = name.codePointAt(k);
- if ((cc == '/' && !Character.isJavaIdentifierStart(cp))
- || (cp != '/' && !Character.isJavaIdentifierPart(cp))) {
- return "\"" + addEscapes(name) + "\"";
- }
- cc = cp;
- }
-
- return name;
- }
-
- /* If name requires escapes, put them in, so it can be a string body. */
- private static String addEscapes(String name) {
- String esc = "\\\"\n\t";
- String rep = "\\\"nt";
- StringBuilder buf = null;
- int nextk = 0;
- int len = name.length();
- for (int k = 0; k < len; k++) {
- char cp = name.charAt(k);
- int n = esc.indexOf(cp);
- if (n >= 0) {
- if (buf == null)
- buf = new StringBuilder(len * 2);
- if (nextk < k)
- buf.append(name, nextk, k);
- buf.append('\\');
- buf.append(rep.charAt(n));
- nextk = k+1;
- }
- }
- if (buf == null)
- return name;
- if (nextk < len)
- buf.append(name, nextk, len);
- return buf.toString();
- }
-
- private ClassWriter classWriter;
- private Options options;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/Context.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/*
- * Class from which to put/get shared resources.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Context {
-
- Map<Class<?>, Object> map;
-
- public Context() {
- map = new HashMap<>();
- }
-
- @SuppressWarnings("unchecked")
- public <T> T get(Class<T> key) {
- return (T) map.get(key);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T put(Class<T> key, T value) {
- return (T) map.put(key, value);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/DisassemblerTool.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2005, 2014, 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.
- */
-
-package com.sun.tools.javap; //javax.tools;
-
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.Locale;
-import java.util.concurrent.Callable;
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.OptionChecker;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-import javax.tools.Tool;
-
-/**
- * This class is intended to be put in javax.tools.
- *
- * @see DiagnosticListener
- * @see Diagnostic
- * @see JavaFileManager
- * @since 1.7
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public interface DisassemblerTool extends Tool, OptionChecker {
-
- /**
- * Creates a future for a disassembly task with the given
- * components and arguments. The task might not have
- * completed as described in the DissemblerTask interface.
- *
- * <p>If a file manager is provided, it must be able to handle all
- * locations defined in {@link StandardLocation}.
- *
- * @param out a Writer for additional output from the compiler;
- * use {@code System.err} if {@code null}
- * @param fileManager a file manager; if {@code null} use the
- * compiler's standard filemanager
- * @param diagnosticListener a diagnostic listener; if {@code
- * null} use the compiler's default method for reporting
- * diagnostics
- * @param options compiler options, {@code null} means no options
- * @param classes class names (for annotation processing), {@code
- * null} means no class names
- * @return a task to perform the disassembly
- * @throws RuntimeException if an unrecoverable error
- * occurred in a user supplied component. The
- * {@linkplain Throwable#getCause() cause} will be the error in
- * user code.
- * @throws IllegalArgumentException if any of the given
- * compilation units are of other kind than
- * {@linkplain JavaFileObject.Kind#SOURCE source}
- */
- DisassemblerTask getTask(Writer out,
- JavaFileManager fileManager,
- DiagnosticListener<? super JavaFileObject> diagnosticListener,
- Iterable<String> options,
- Iterable<String> classes);
-
- /**
- * Returns a new instance of the standard file manager implementation
- * for this tool. The file manager will use the given diagnostic
- * listener for producing any non-fatal diagnostics. Fatal errors
- * will be signalled with the appropriate exceptions.
- *
- * <p>The standard file manager will be automatically reopened if
- * it is accessed after calls to {@code flush} or {@code close}.
- * The standard file manager must be usable with other tools.
- *
- * @param diagnosticListener a diagnostic listener for non-fatal
- * diagnostics; if {@code null} use the compiler's default method
- * for reporting diagnostics
- * @param locale the locale to apply when formatting diagnostics;
- * {@code null} means the {@linkplain Locale#getDefault() default locale}.
- * @param charset the character set used for decoding bytes; if
- * {@code null} use the platform default
- * @return the standard file manager
- */
- StandardJavaFileManager getStandardFileManager(
- DiagnosticListener<? super JavaFileObject> diagnosticListener,
- Locale locale,
- Charset charset);
-
- /**
- * Interface representing a future for a disassembly task. The
- * task has not yet started. To start the task, call
- * the {@linkplain #call call} method.
- *
- * <p>Before calling the call method, additional aspects of the
- * task can be configured, for example, by calling the
- * {@linkplain #setLocale setLocale} method.
- */
- interface DisassemblerTask extends Callable<Boolean> {
-
- /**
- * Set the locale to be applied when formatting diagnostics and
- * other localized data.
- *
- * @param locale the locale to apply; {@code null} means apply no
- * locale
- * @throws IllegalStateException if the task has started
- */
- void setLocale(Locale locale);
-
- /**
- * Performs this compilation task. The compilation may only
- * be performed once. Subsequent calls to this method throw
- * IllegalStateException.
- *
- * @return true if and only all the files compiled without errors;
- * false otherwise
- *
- * @throws RuntimeException if an unrecoverable error occurred
- * in a user-supplied component. The
- * {@linkplain Throwable#getCause() cause} will be the error
- * in user code.
- * @throws IllegalStateException if called more than once
- */
- Boolean call();
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/InstructionDetailWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2009, 2013, 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.
- */
-
-package com.sun.tools.javap;
-
-import com.sun.tools.classfile.Instruction;
-
-
-/*
- * Write additional details for an instruction.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public abstract class InstructionDetailWriter extends BasicWriter {
- public enum Kind {
- LOCAL_VARS("localVariables"),
- LOCAL_VAR_TYPES("localVariableTypes"),
- SOURCE("source"),
- STACKMAPS("stackMaps"),
- TRY_BLOCKS("tryBlocks"),
- TYPE_ANNOS("typeAnnotations");
-
- Kind(String option) {
- this.option = option;
- }
-
- final String option;
- }
-
- InstructionDetailWriter(Context context) {
- super(context);
- }
-
- abstract void writeDetails(Instruction instr);
- void flush() { }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/InternalError.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2007, 2009, 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.
- */
-
-package com.sun.tools.javap;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class InternalError extends Error {
- private static final long serialVersionUID = 8114054446416187030L;
- InternalError(Throwable t, Object... args) {
- super("Internal error", t);
- this.args = args;
- }
-
- InternalError(Object... args) {
- super("Internal error");
- this.args = args;
- }
-
- public final Object[] args;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapFileManager.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2007, 2012, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.io.PrintWriter;
-import java.nio.charset.Charset;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.Context;
-
-/**
- * javap's implementation of JavaFileManager.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class JavapFileManager extends JavacFileManager {
- private JavapFileManager(Context context, Charset charset) {
- super(context, true, charset);
- setSymbolFileEnabled(false);
- }
-
- public static JavapFileManager create(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) {
- Context javac_context = new Context();
-
- if (dl != null)
- javac_context.put(DiagnosticListener.class, dl);
- javac_context.put(com.sun.tools.javac.util.Log.outKey, log);
-
- return new JavapFileManager(javac_context, null);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1068 +0,0 @@
-/*
- * Copyright (c) 2007, 2014, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.io.EOFException;
-import java.io.FileNotFoundException;
-import java.io.FilterInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.nio.file.NoSuchFileException;
-import java.security.DigestInputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.Objects;
-import java.util.ResourceBundle;
-
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.NestingKind;
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticListener;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-
-import com.sun.tools.classfile.*;
-import com.sun.tools.javac.util.DefinedBy;
-import com.sun.tools.javac.util.DefinedBy.Api;
-
-/**
- * "Main" class for javap, normally accessed from the command line
- * via Main, or from JSR199 via DisassemblerTool.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
- public class BadArgs extends Exception {
- static final long serialVersionUID = 8765093759964640721L;
- BadArgs(String key, Object... args) {
- super(JavapTask.this.getMessage(key, args));
- this.key = key;
- this.args = args;
- }
-
- BadArgs showUsage(boolean b) {
- showUsage = b;
- return this;
- }
-
- final String key;
- final Object[] args;
- boolean showUsage;
- }
-
- static abstract class Option {
- Option(boolean hasArg, String... aliases) {
- this.hasArg = hasArg;
- this.aliases = aliases;
- }
-
- boolean matches(String opt) {
- for (String a: aliases) {
- if (a.equals(opt))
- return true;
- }
- return false;
- }
-
- boolean ignoreRest() {
- return false;
- }
-
- abstract void process(JavapTask task, String opt, String arg) throws BadArgs;
-
- final boolean hasArg;
- final String[] aliases;
- }
-
- static final Option[] recognizedOptions = {
-
- new Option(false, "-help", "--help", "-?") {
- void process(JavapTask task, String opt, String arg) {
- task.options.help = true;
- }
- },
-
- new Option(false, "-version") {
- void process(JavapTask task, String opt, String arg) {
- task.options.version = true;
- }
- },
-
- new Option(false, "-fullversion") {
- void process(JavapTask task, String opt, String arg) {
- task.options.fullVersion = true;
- }
- },
-
- new Option(false, "-v", "-verbose", "-all") {
- void process(JavapTask task, String opt, String arg) {
- task.options.verbose = true;
- task.options.showDescriptors = true;
- task.options.showFlags = true;
- task.options.showAllAttrs = true;
- }
- },
-
- new Option(false, "-l") {
- void process(JavapTask task, String opt, String arg) {
- task.options.showLineAndLocalVariableTables = true;
- }
- },
-
- new Option(false, "-public") {
- void process(JavapTask task, String opt, String arg) {
- task.options.accessOptions.add(opt);
- task.options.showAccess = AccessFlags.ACC_PUBLIC;
- }
- },
-
- new Option(false, "-protected") {
- void process(JavapTask task, String opt, String arg) {
- task.options.accessOptions.add(opt);
- task.options.showAccess = AccessFlags.ACC_PROTECTED;
- }
- },
-
- new Option(false, "-package") {
- void process(JavapTask task, String opt, String arg) {
- task.options.accessOptions.add(opt);
- task.options.showAccess = 0;
- }
- },
-
- new Option(false, "-p", "-private") {
- void process(JavapTask task, String opt, String arg) {
- if (!task.options.accessOptions.contains("-p") &&
- !task.options.accessOptions.contains("-private")) {
- task.options.accessOptions.add(opt);
- }
- task.options.showAccess = AccessFlags.ACC_PRIVATE;
- }
- },
-
- new Option(false, "-c") {
- void process(JavapTask task, String opt, String arg) {
- task.options.showDisassembled = true;
- }
- },
-
- new Option(false, "-s") {
- void process(JavapTask task, String opt, String arg) {
- task.options.showDescriptors = true;
- }
- },
-
- new Option(false, "-sysinfo") {
- void process(JavapTask task, String opt, String arg) {
- task.options.sysInfo = true;
- }
- },
-
- new Option(false, "-XDdetails") {
- void process(JavapTask task, String opt, String arg) {
- task.options.details = EnumSet.allOf(InstructionDetailWriter.Kind.class);
- }
-
- },
-
- new Option(false, "-XDdetails:") {
- @Override
- boolean matches(String opt) {
- int sep = opt.indexOf(":");
- return sep != -1 && super.matches(opt.substring(0, sep + 1));
- }
-
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- int sep = opt.indexOf(":");
- for (String v: opt.substring(sep + 1).split("[,: ]+")) {
- if (!handleArg(task, v))
- throw task.new BadArgs("err.invalid.arg.for.option", v);
- }
- }
-
- boolean handleArg(JavapTask task, String arg) {
- if (arg.length() == 0)
- return true;
-
- if (arg.equals("all")) {
- task.options.details = EnumSet.allOf(InstructionDetailWriter.Kind.class);
- return true;
- }
-
- boolean on = true;
- if (arg.startsWith("-")) {
- on = false;
- arg = arg.substring(1);
- }
-
- for (InstructionDetailWriter.Kind k: InstructionDetailWriter.Kind.values()) {
- if (arg.equalsIgnoreCase(k.option)) {
- if (on)
- task.options.details.add(k);
- else
- task.options.details.remove(k);
- return true;
- }
- }
- return false;
- }
- },
-
- new Option(false, "-constants") {
- void process(JavapTask task, String opt, String arg) {
- task.options.showConstants = true;
- }
- },
-
- new Option(false, "-XDinner") {
- void process(JavapTask task, String opt, String arg) {
- task.options.showInnerClasses = true;
- }
- },
-
- new Option(false, "-XDindent:") {
- @Override
- boolean matches(String opt) {
- int sep = opt.indexOf(":");
- return sep != -1 && super.matches(opt.substring(0, sep + 1));
- }
-
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- int sep = opt.indexOf(":");
- try {
- int i = Integer.valueOf(opt.substring(sep + 1));
- if (i > 0) // silently ignore invalid values
- task.options.indentWidth = i;
- } catch (NumberFormatException e) {
- }
- }
- },
-
- new Option(false, "-XDtab:") {
- @Override
- boolean matches(String opt) {
- int sep = opt.indexOf(":");
- return sep != -1 && super.matches(opt.substring(0, sep + 1));
- }
-
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- int sep = opt.indexOf(":");
- try {
- int i = Integer.valueOf(opt.substring(sep + 1));
- if (i > 0) // silently ignore invalid values
- task.options.tabColumn = i;
- } catch (NumberFormatException e) {
- }
- }
- }
-
- };
-
- public JavapTask() {
- context = new Context();
- context.put(Messages.class, this);
- options = Options.instance(context);
- attributeFactory = new Attribute.Factory();
- }
-
- public JavapTask(Writer out,
- JavaFileManager fileManager,
- DiagnosticListener<? super JavaFileObject> diagnosticListener) {
- this();
- this.log = getPrintWriterForWriter(out);
- this.fileManager = fileManager;
- this.diagnosticListener = diagnosticListener;
- }
-
- public JavapTask(Writer out,
- JavaFileManager fileManager,
- DiagnosticListener<? super JavaFileObject> diagnosticListener,
- Iterable<String> options,
- Iterable<String> classes) {
- this(out, fileManager, diagnosticListener);
-
- this.classes = new ArrayList<>();
- for (String classname: classes) {
- Objects.requireNonNull(classname);
- this.classes.add(classname);
- }
-
- try {
- if (options != null)
- handleOptions(options, false);
- } catch (BadArgs e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
- public void setLocale(Locale locale) {
- if (locale == null)
- locale = Locale.getDefault();
- task_locale = locale;
- }
-
- public void setLog(Writer log) {
- this.log = getPrintWriterForWriter(log);
- }
-
- public void setLog(OutputStream s) {
- setLog(getPrintWriterForStream(s));
- }
-
- private static PrintWriter getPrintWriterForStream(OutputStream s) {
- return new PrintWriter(s == null ? System.err : s, true);
- }
-
- private static PrintWriter getPrintWriterForWriter(Writer w) {
- if (w == null)
- return getPrintWriterForStream(null);
- else if (w instanceof PrintWriter)
- return (PrintWriter) w;
- else
- return new PrintWriter(w, true);
- }
-
- public void setDiagnosticListener(DiagnosticListener<? super JavaFileObject> dl) {
- diagnosticListener = dl;
- }
-
- public void setDiagnosticListener(OutputStream s) {
- setDiagnosticListener(getDiagnosticListenerForStream(s));
- }
-
- private DiagnosticListener<JavaFileObject> getDiagnosticListenerForStream(OutputStream s) {
- return getDiagnosticListenerForWriter(getPrintWriterForStream(s));
- }
-
- private DiagnosticListener<JavaFileObject> getDiagnosticListenerForWriter(Writer w) {
- final PrintWriter pw = getPrintWriterForWriter(w);
- return new DiagnosticListener<JavaFileObject> () {
- @DefinedBy(Api.COMPILER)
- public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
- switch (diagnostic.getKind()) {
- case ERROR:
- pw.print(getMessage("err.prefix"));
- break;
- case WARNING:
- pw.print(getMessage("warn.prefix"));
- break;
- case NOTE:
- pw.print(getMessage("note.prefix"));
- break;
- }
- pw.print(" ");
- pw.println(diagnostic.getMessage(null));
- }
- };
- }
-
- /** Result codes.
- */
- static final int
- EXIT_OK = 0, // Compilation completed with no errors.
- EXIT_ERROR = 1, // Completed but reported errors.
- EXIT_CMDERR = 2, // Bad command-line arguments
- EXIT_SYSERR = 3, // System error or resource exhaustion.
- EXIT_ABNORMAL = 4; // Compiler terminated abnormally
-
- int run(String[] args) {
- try {
- try {
- handleOptions(args);
-
- // the following gives consistent behavior with javac
- if (classes == null || classes.size() == 0) {
- if (options.help || options.version || options.fullVersion)
- return EXIT_OK;
- else
- return EXIT_CMDERR;
- }
-
- return run();
- } finally {
- if (defaultFileManager != null) {
- try {
- defaultFileManager.close();
- defaultFileManager = null;
- } catch (IOException e) {
- throw new InternalError(e);
- }
- }
- }
- } catch (BadArgs e) {
- reportError(e.key, e.args);
- if (e.showUsage) {
- printLines(getMessage("main.usage.summary", progname));
- }
- return EXIT_CMDERR;
- } catch (InternalError e) {
- Object[] e_args;
- if (e.getCause() == null)
- e_args = e.args;
- else {
- e_args = new Object[e.args.length + 1];
- e_args[0] = e.getCause();
- System.arraycopy(e.args, 0, e_args, 1, e.args.length);
- }
- reportError("err.internal.error", e_args);
- return EXIT_ABNORMAL;
- } finally {
- log.flush();
- }
- }
-
- public void handleOptions(String[] args) throws BadArgs {
- handleOptions(Arrays.asList(args), true);
- }
-
- private void handleOptions(Iterable<String> args, boolean allowClasses) throws BadArgs {
- if (log == null) {
- log = getPrintWriterForStream(System.out);
- if (diagnosticListener == null)
- diagnosticListener = getDiagnosticListenerForStream(System.err);
- } else {
- if (diagnosticListener == null)
- diagnosticListener = getDiagnosticListenerForWriter(log);
- }
-
-
- if (fileManager == null)
- fileManager = getDefaultFileManager(diagnosticListener, log);
-
- Iterator<String> iter = args.iterator();
- boolean noArgs = !iter.hasNext();
-
- while (iter.hasNext()) {
- String arg = iter.next();
- if (arg.startsWith("-"))
- handleOption(arg, iter);
- else if (allowClasses) {
- if (classes == null)
- classes = new ArrayList<>();
- classes.add(arg);
- while (iter.hasNext())
- classes.add(iter.next());
- } else
- throw new BadArgs("err.unknown.option", arg).showUsage(true);
- }
-
- if (options.accessOptions.size() > 1) {
- StringBuilder sb = new StringBuilder();
- for (String opt: options.accessOptions) {
- if (sb.length() > 0)
- sb.append(" ");
- sb.append(opt);
- }
- throw new BadArgs("err.incompatible.options", sb);
- }
-
- if ((classes == null || classes.size() == 0) &&
- !(noArgs || options.help || options.version || options.fullVersion)) {
- throw new BadArgs("err.no.classes.specified");
- }
-
- if (noArgs || options.help)
- showHelp();
-
- if (options.version || options.fullVersion)
- showVersion(options.fullVersion);
- }
-
- private void handleOption(String name, Iterator<String> rest) throws BadArgs {
- for (Option o: recognizedOptions) {
- if (o.matches(name)) {
- if (o.hasArg) {
- if (rest.hasNext())
- o.process(this, name, rest.next());
- else
- throw new BadArgs("err.missing.arg", name).showUsage(true);
- } else
- o.process(this, name, null);
-
- if (o.ignoreRest()) {
- while (rest.hasNext())
- rest.next();
- }
- return;
- }
- }
-
- try {
- if (fileManager.handleOption(name, rest))
- return;
- } catch (IllegalArgumentException e) {
- throw new BadArgs("err.invalid.use.of.option", name).showUsage(true);
- }
-
- throw new BadArgs("err.unknown.option", name).showUsage(true);
- }
-
- public Boolean call() {
- return run() == 0;
- }
-
- public int run() {
- if (classes == null || classes.isEmpty()) {
- return EXIT_ERROR;
- }
-
- context.put(PrintWriter.class, log);
- ClassWriter classWriter = ClassWriter.instance(context);
- SourceWriter sourceWriter = SourceWriter.instance(context);
- sourceWriter.setFileManager(fileManager);
-
- int result = EXIT_OK;
-
- for (String className: classes) {
- try {
- result = writeClass(classWriter, className);
- } catch (ConstantPoolException e) {
- reportError("err.bad.constant.pool", className, e.getLocalizedMessage());
- result = EXIT_ERROR;
- } catch (EOFException e) {
- reportError("err.end.of.file", className);
- result = EXIT_ERROR;
- } catch (FileNotFoundException | NoSuchFileException e) {
- reportError("err.file.not.found", e.getLocalizedMessage());
- result = EXIT_ERROR;
- } catch (IOException e) {
- //e.printStackTrace();
- Object msg = e.getLocalizedMessage();
- if (msg == null) {
- msg = e;
- }
- reportError("err.ioerror", className, msg);
- result = EXIT_ERROR;
- } catch (OutOfMemoryError e) {
- reportError("err.nomem");
- result = EXIT_ERROR;
- } catch (Throwable t) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- t.printStackTrace(pw);
- pw.close();
- reportError("err.crash", t.toString(), sw.toString());
- result = EXIT_ABNORMAL;
- }
- }
-
- return result;
- }
-
- protected int writeClass(ClassWriter classWriter, String className)
- throws IOException, ConstantPoolException {
- JavaFileObject fo = open(className);
- if (fo == null) {
- reportError("err.class.not.found", className);
- return EXIT_ERROR;
- }
-
- ClassFileInfo cfInfo = read(fo);
- if (!className.endsWith(".class")) {
- String cfName = cfInfo.cf.getName();
- if (!cfName.replaceAll("[/$]", ".").equals(className.replaceAll("[/$]", "."))) {
- reportWarning("warn.unexpected.class", className, cfName.replace('/', '.'));
- }
- }
- write(cfInfo);
-
- if (options.showInnerClasses) {
- ClassFile cf = cfInfo.cf;
- Attribute a = cf.getAttribute(Attribute.InnerClasses);
- if (a instanceof InnerClasses_attribute) {
- InnerClasses_attribute inners = (InnerClasses_attribute) a;
- try {
- int result = EXIT_OK;
- for (int i = 0; i < inners.classes.length; i++) {
- int outerIndex = inners.classes[i].outer_class_info_index;
- ConstantPool.CONSTANT_Class_info outerClassInfo = cf.constant_pool.getClassInfo(outerIndex);
- String outerClassName = outerClassInfo.getName();
- if (outerClassName.equals(cf.getName())) {
- int innerIndex = inners.classes[i].inner_class_info_index;
- ConstantPool.CONSTANT_Class_info innerClassInfo = cf.constant_pool.getClassInfo(innerIndex);
- String innerClassName = innerClassInfo.getName();
- classWriter.println("// inner class " + innerClassName.replaceAll("[/$]", "."));
- classWriter.println();
- result = writeClass(classWriter, innerClassName);
- if (result != EXIT_OK) return result;
- }
- }
- return result;
- } catch (ConstantPoolException e) {
- reportError("err.bad.innerclasses.attribute", className);
- return EXIT_ERROR;
- }
- } else if (a != null) {
- reportError("err.bad.innerclasses.attribute", className);
- return EXIT_ERROR;
- }
- }
-
- return EXIT_OK;
- }
-
- protected JavaFileObject open(String className) throws IOException {
- // for compatibility, first see if it is a class name
- JavaFileObject fo = getClassFileObject(className);
- if (fo != null)
- return fo;
-
- // see if it is an inner class, by replacing dots to $, starting from the right
- String cn = className;
- int lastDot;
- while ((lastDot = cn.lastIndexOf(".")) != -1) {
- cn = cn.substring(0, lastDot) + "$" + cn.substring(lastDot + 1);
- fo = getClassFileObject(cn);
- if (fo != null)
- return fo;
- }
-
- if (!className.endsWith(".class"))
- return null;
-
- if (fileManager instanceof StandardJavaFileManager) {
- StandardJavaFileManager sfm = (StandardJavaFileManager) fileManager;
- try {
- fo = sfm.getJavaFileObjects(className).iterator().next();
- if (fo != null && fo.getLastModified() != 0) {
- return fo;
- }
- } catch (IllegalArgumentException ignore) {
- }
- }
-
- // see if it is a URL, and if so, wrap it in just enough of a JavaFileObject
- // to suit javap's needs
- if (className.matches("^[A-Za-z]+:.*")) {
- try {
- final URI uri = new URI(className);
- final URL url = uri.toURL();
- final URLConnection conn = url.openConnection();
- conn.setUseCaches(false);
- return new JavaFileObject() {
- @DefinedBy(Api.COMPILER)
- public Kind getKind() {
- return JavaFileObject.Kind.CLASS;
- }
-
- @DefinedBy(Api.COMPILER)
- public boolean isNameCompatible(String simpleName, Kind kind) {
- throw new UnsupportedOperationException();
- }
-
- @DefinedBy(Api.COMPILER)
- public NestingKind getNestingKind() {
- throw new UnsupportedOperationException();
- }
-
- @DefinedBy(Api.COMPILER)
- public Modifier getAccessLevel() {
- throw new UnsupportedOperationException();
- }
-
- @DefinedBy(Api.COMPILER)
- public URI toUri() {
- return uri;
- }
-
- @DefinedBy(Api.COMPILER)
- public String getName() {
- return uri.toString();
- }
-
- @DefinedBy(Api.COMPILER)
- public InputStream openInputStream() throws IOException {
- return conn.getInputStream();
- }
-
- @DefinedBy(Api.COMPILER)
- public OutputStream openOutputStream() throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @DefinedBy(Api.COMPILER)
- public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @DefinedBy(Api.COMPILER)
- public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @DefinedBy(Api.COMPILER)
- public Writer openWriter() throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @DefinedBy(Api.COMPILER)
- public long getLastModified() {
- return conn.getLastModified();
- }
-
- @DefinedBy(Api.COMPILER)
- public boolean delete() {
- throw new UnsupportedOperationException();
- }
-
- };
- } catch (URISyntaxException | IOException ignore) {
- }
- }
-
- return null;
- }
-
- public static class ClassFileInfo {
- ClassFileInfo(JavaFileObject fo, ClassFile cf, byte[] digest, int size) {
- this.fo = fo;
- this.cf = cf;
- this.digest = digest;
- this.size = size;
- }
- public final JavaFileObject fo;
- public final ClassFile cf;
- public final byte[] digest;
- public final int size;
- }
-
- public ClassFileInfo read(JavaFileObject fo) throws IOException, ConstantPoolException {
- InputStream in = fo.openInputStream();
- try {
- SizeInputStream sizeIn = null;
- MessageDigest md = null;
- if (options.sysInfo || options.verbose) {
- try {
- md = MessageDigest.getInstance("MD5");
- } catch (NoSuchAlgorithmException ignore) {
- }
- in = new DigestInputStream(in, md);
- in = sizeIn = new SizeInputStream(in);
- }
-
- ClassFile cf = ClassFile.read(in, attributeFactory);
- byte[] digest = (md == null) ? null : md.digest();
- int size = (sizeIn == null) ? -1 : sizeIn.size();
- return new ClassFileInfo(fo, cf, digest, size);
- } finally {
- in.close();
- }
- }
-
- public void write(ClassFileInfo info) {
- ClassWriter classWriter = ClassWriter.instance(context);
- if (options.sysInfo || options.verbose) {
- classWriter.setFile(info.fo.toUri());
- classWriter.setLastModified(info.fo.getLastModified());
- classWriter.setDigest("MD5", info.digest);
- classWriter.setFileSize(info.size);
- }
-
- classWriter.write(info.cf);
- }
-
- protected void setClassFile(ClassFile classFile) {
- ClassWriter classWriter = ClassWriter.instance(context);
- classWriter.setClassFile(classFile);
- }
-
- protected void setMethod(Method enclosingMethod) {
- ClassWriter classWriter = ClassWriter.instance(context);
- classWriter.setMethod(enclosingMethod);
- }
-
- protected void write(Attribute value) {
- AttributeWriter attrWriter = AttributeWriter.instance(context);
- ClassWriter classWriter = ClassWriter.instance(context);
- ClassFile cf = classWriter.getClassFile();
- attrWriter.write(cf, value, cf.constant_pool);
- }
-
- protected void write(Attributes attrs) {
- AttributeWriter attrWriter = AttributeWriter.instance(context);
- ClassWriter classWriter = ClassWriter.instance(context);
- ClassFile cf = classWriter.getClassFile();
- attrWriter.write(cf, attrs, cf.constant_pool);
- }
-
- protected void write(ConstantPool constant_pool) {
- ConstantWriter constantWriter = ConstantWriter.instance(context);
- constantWriter.writeConstantPool(constant_pool);
- }
-
- protected void write(ConstantPool constant_pool, int value) {
- ConstantWriter constantWriter = ConstantWriter.instance(context);
- constantWriter.write(value);
- }
-
- protected void write(ConstantPool.CPInfo value) {
- ConstantWriter constantWriter = ConstantWriter.instance(context);
- constantWriter.println(value);
- }
-
- protected void write(Field value) {
- ClassWriter classWriter = ClassWriter.instance(context);
- classWriter.writeField(value);
- }
-
- protected void write(Method value) {
- ClassWriter classWriter = ClassWriter.instance(context);
- classWriter.writeMethod(value);
- }
-
- private JavaFileManager getDefaultFileManager(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) {
- if (defaultFileManager == null)
- defaultFileManager = JavapFileManager.create(dl, log);
- return defaultFileManager;
- }
-
- private JavaFileObject getClassFileObject(String className) throws IOException {
- try {
- JavaFileObject fo;
- fo = fileManager.getJavaFileForInput(StandardLocation.PLATFORM_CLASS_PATH, className, JavaFileObject.Kind.CLASS);
- if (fo == null)
- fo = fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, className, JavaFileObject.Kind.CLASS);
- return fo;
- } catch (IllegalArgumentException e) {
- return null;
- }
- }
-
- private void showHelp() {
- printLines(getMessage("main.usage", progname));
- for (Option o: recognizedOptions) {
- String name = o.aliases[0].substring(1); // there must always be at least one name
- if (name.startsWith("X") || name.equals("fullversion") || name.equals("h") || name.equals("verify"))
- continue;
- printLines(getMessage("main.opt." + name));
- }
- String[] fmOptions = { "-classpath", "-cp", "-bootclasspath" };
- for (String o: fmOptions) {
- if (fileManager.isSupportedOption(o) == -1)
- continue;
- String name = o.substring(1);
- printLines(getMessage("main.opt." + name));
- }
-
- }
-
- private void showVersion(boolean full) {
- printLines(version(full ? "full" : "release"));
- }
-
- private void printLines(String msg) {
- log.println(msg.replace("\n", nl));
- }
-
- private static final String nl = System.getProperty("line.separator");
-
- private static final String versionRBName = "com.sun.tools.javap.resources.version";
- private static ResourceBundle versionRB;
-
- private String version(String key) {
- // key=version: mm.nn.oo[-milestone]
- // key=full: mm.mm.oo[-milestone]-build
- if (versionRB == null) {
- try {
- versionRB = ResourceBundle.getBundle(versionRBName);
- } catch (MissingResourceException e) {
- return getMessage("version.resource.missing", System.getProperty("java.version"));
- }
- }
- try {
- return versionRB.getString(key);
- }
- catch (MissingResourceException e) {
- return getMessage("version.unknown", System.getProperty("java.version"));
- }
- }
-
- private void reportError(String key, Object... args) {
- diagnosticListener.report(createDiagnostic(Diagnostic.Kind.ERROR, key, args));
- }
-
- private void reportNote(String key, Object... args) {
- diagnosticListener.report(createDiagnostic(Diagnostic.Kind.NOTE, key, args));
- }
-
- private void reportWarning(String key, Object... args) {
- diagnosticListener.report(createDiagnostic(Diagnostic.Kind.WARNING, key, args));
- }
-
- private Diagnostic<JavaFileObject> createDiagnostic(
- final Diagnostic.Kind kind, final String key, final Object... args) {
- return new Diagnostic<JavaFileObject>() {
- @DefinedBy(Api.COMPILER)
- public Kind getKind() {
- return kind;
- }
-
- @DefinedBy(Api.COMPILER)
- public JavaFileObject getSource() {
- return null;
- }
-
- @DefinedBy(Api.COMPILER)
- public long getPosition() {
- return Diagnostic.NOPOS;
- }
-
- @DefinedBy(Api.COMPILER)
- public long getStartPosition() {
- return Diagnostic.NOPOS;
- }
-
- @DefinedBy(Api.COMPILER)
- public long getEndPosition() {
- return Diagnostic.NOPOS;
- }
-
- @DefinedBy(Api.COMPILER)
- public long getLineNumber() {
- return Diagnostic.NOPOS;
- }
-
- @DefinedBy(Api.COMPILER)
- public long getColumnNumber() {
- return Diagnostic.NOPOS;
- }
-
- @DefinedBy(Api.COMPILER)
- public String getCode() {
- return key;
- }
-
- @DefinedBy(Api.COMPILER)
- public String getMessage(Locale locale) {
- return JavapTask.this.getMessage(locale, key, args);
- }
-
- @Override
- public String toString() {
- return getClass().getName() + "[key=" + key + ",args=" + Arrays.asList(args) + "]";
- }
-
- };
-
- }
-
- public String getMessage(String key, Object... args) {
- return getMessage(task_locale, key, args);
- }
-
- public String getMessage(Locale locale, String key, Object... args) {
- if (bundles == null) {
- // could make this a HashMap<Locale,SoftReference<ResourceBundle>>
- // and for efficiency, keep a hard reference to the bundle for the task
- // locale
- bundles = new HashMap<>();
- }
-
- if (locale == null)
- locale = Locale.getDefault();
-
- ResourceBundle b = bundles.get(locale);
- if (b == null) {
- try {
- b = ResourceBundle.getBundle("com.sun.tools.javap.resources.javap", locale);
- bundles.put(locale, b);
- } catch (MissingResourceException e) {
- throw new InternalError("Cannot find javap resource bundle for locale " + locale);
- }
- }
-
- try {
- return MessageFormat.format(b.getString(key), args);
- } catch (MissingResourceException e) {
- throw new InternalError(e, key);
- }
- }
-
- protected Context context;
- JavaFileManager fileManager;
- JavaFileManager defaultFileManager;
- PrintWriter log;
- DiagnosticListener<? super JavaFileObject> diagnosticListener;
- List<String> classes;
- Options options;
- //ResourceBundle bundle;
- Locale task_locale;
- Map<Locale, ResourceBundle> bundles;
- protected Attribute.Factory attributeFactory;
-
- private static final String progname = "javap";
-
- private static class SizeInputStream extends FilterInputStream {
- SizeInputStream(InputStream in) {
- super(in);
- }
-
- int size() {
- return size;
- }
-
- @Override
- public int read(byte[] buf, int offset, int length) throws IOException {
- int n = super.read(buf, offset, length);
- if (n > 0)
- size += n;
- return n;
- }
-
- @Override
- public int read() throws IOException {
- int b = super.read();
- size += 1;
- return b;
- }
-
- private int size;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- */
-
-package com.sun.tools.javap;
-
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.Descriptor;
-import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.LocalVariableTable_attribute;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * Annotate instructions with details about local variables.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class LocalVariableTableWriter extends InstructionDetailWriter {
- public enum NoteKind {
- START("start") {
- public boolean match(LocalVariableTable_attribute.Entry entry, int pc) {
- return (pc == entry.start_pc);
- }
- },
- END("end") {
- public boolean match(LocalVariableTable_attribute.Entry entry, int pc) {
- return (pc == entry.start_pc + entry.length);
- }
- };
- NoteKind(String text) {
- this.text = text;
- }
- public abstract boolean match(LocalVariableTable_attribute.Entry entry, int pc);
- public final String text;
- }
-
- static LocalVariableTableWriter instance(Context context) {
- LocalVariableTableWriter instance = context.get(LocalVariableTableWriter.class);
- if (instance == null)
- instance = new LocalVariableTableWriter(context);
- return instance;
- }
-
- protected LocalVariableTableWriter(Context context) {
- super(context);
- context.put(LocalVariableTableWriter.class, this);
- classWriter = ClassWriter.instance(context);
- }
-
- public void reset(Code_attribute attr) {
- codeAttr = attr;
- pcMap = new HashMap<>();
- LocalVariableTable_attribute lvt =
- (LocalVariableTable_attribute) (attr.attributes.get(Attribute.LocalVariableTable));
- if (lvt == null)
- return;
-
- for (int i = 0; i < lvt.local_variable_table.length; i++) {
- LocalVariableTable_attribute.Entry entry = lvt.local_variable_table[i];
- put(entry.start_pc, entry);
- put(entry.start_pc + entry.length, entry);
- }
- }
-
- public void writeDetails(Instruction instr) {
- int pc = instr.getPC();
- writeLocalVariables(pc, NoteKind.END);
- writeLocalVariables(pc, NoteKind.START);
- }
-
- @Override
- public void flush() {
- int pc = codeAttr.code_length;
- writeLocalVariables(pc, NoteKind.END);
- }
-
- public void writeLocalVariables(int pc, NoteKind kind) {
- ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
- String indent = space(2); // get from Options?
- List<LocalVariableTable_attribute.Entry> entries = pcMap.get(pc);
- if (entries != null) {
- for (ListIterator<LocalVariableTable_attribute.Entry> iter =
- entries.listIterator(kind == NoteKind.END ? entries.size() : 0);
- kind == NoteKind.END ? iter.hasPrevious() : iter.hasNext() ; ) {
- LocalVariableTable_attribute.Entry entry =
- kind == NoteKind.END ? iter.previous() : iter.next();
- if (kind.match(entry, pc)) {
- print(indent);
- print(kind.text);
- print(" local ");
- print(entry.index);
- print(" // ");
- Descriptor d = new Descriptor(entry.descriptor_index);
- try {
- print(d.getFieldType(constant_pool));
- } catch (InvalidDescriptor e) {
- print(report(e));
- } catch (ConstantPoolException e) {
- print(report(e));
- }
- print(" ");
- try {
- print(constant_pool.getUTF8Value(entry.name_index));
- } catch (ConstantPoolException e) {
- print(report(e));
- }
- println();
- }
- }
- }
- }
-
- private void put(int pc, LocalVariableTable_attribute.Entry entry) {
- List<LocalVariableTable_attribute.Entry> list = pcMap.get(pc);
- if (list == null) {
- list = new ArrayList<>();
- pcMap.put(pc, list);
- }
- if (!list.contains(entry))
- list.add(entry);
- }
-
- private ClassWriter classWriter;
- private Code_attribute codeAttr;
- private Map<Integer, List<LocalVariableTable_attribute.Entry>> pcMap;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- */
-
-package com.sun.tools.javap;
-
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.Descriptor;
-import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
-import com.sun.tools.classfile.Signature;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * Annotate instructions with details about local variables.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class LocalVariableTypeTableWriter extends InstructionDetailWriter {
- public enum NoteKind {
- START("start") {
- public boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc) {
- return (pc == entry.start_pc);
- }
- },
- END("end") {
- public boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc) {
- return (pc == entry.start_pc + entry.length);
- }
- };
- NoteKind(String text) {
- this.text = text;
- }
- public abstract boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc);
- public final String text;
- }
-
- static LocalVariableTypeTableWriter instance(Context context) {
- LocalVariableTypeTableWriter instance = context.get(LocalVariableTypeTableWriter.class);
- if (instance == null)
- instance = new LocalVariableTypeTableWriter(context);
- return instance;
- }
-
- protected LocalVariableTypeTableWriter(Context context) {
- super(context);
- context.put(LocalVariableTypeTableWriter.class, this);
- classWriter = ClassWriter.instance(context);
- }
-
- public void reset(Code_attribute attr) {
- codeAttr = attr;
- pcMap = new HashMap<>();
- LocalVariableTypeTable_attribute lvt =
- (LocalVariableTypeTable_attribute) (attr.attributes.get(Attribute.LocalVariableTypeTable));
- if (lvt == null)
- return;
-
- for (int i = 0; i < lvt.local_variable_table.length; i++) {
- LocalVariableTypeTable_attribute.Entry entry = lvt.local_variable_table[i];
- put(entry.start_pc, entry);
- put(entry.start_pc + entry.length, entry);
- }
- }
-
- public void writeDetails(Instruction instr) {
- int pc = instr.getPC();
- writeLocalVariables(pc, NoteKind.END);
- writeLocalVariables(pc, NoteKind.START);
- }
-
- @Override
- public void flush() {
- int pc = codeAttr.code_length;
- writeLocalVariables(pc, NoteKind.END);
- }
-
- public void writeLocalVariables(int pc, NoteKind kind) {
- ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
- String indent = space(2); // get from Options?
- List<LocalVariableTypeTable_attribute.Entry> entries = pcMap.get(pc);
- if (entries != null) {
- for (ListIterator<LocalVariableTypeTable_attribute.Entry> iter =
- entries.listIterator(kind == NoteKind.END ? entries.size() : 0);
- kind == NoteKind.END ? iter.hasPrevious() : iter.hasNext() ; ) {
- LocalVariableTypeTable_attribute.Entry entry =
- kind == NoteKind.END ? iter.previous() : iter.next();
- if (kind.match(entry, pc)) {
- print(indent);
- print(kind.text);
- print(" generic local ");
- print(entry.index);
- print(" // ");
- Descriptor d = new Signature(entry.signature_index);
- try {
- print(d.getFieldType(constant_pool).toString().replace("/", "."));
- } catch (InvalidDescriptor e) {
- print(report(e));
- } catch (ConstantPoolException e) {
- print(report(e));
- }
- print(" ");
- try {
- print(constant_pool.getUTF8Value(entry.name_index));
- } catch (ConstantPoolException e) {
- print(report(e));
- }
- println();
- }
- }
- }
- }
-
- private void put(int pc, LocalVariableTypeTable_attribute.Entry entry) {
- List<LocalVariableTypeTable_attribute.Entry> list = pcMap.get(pc);
- if (list == null) {
- list = new ArrayList<>();
- pcMap.put(pc, list);
- }
- if (!list.contains(entry))
- list.add(entry);
- }
-
- private ClassWriter classWriter;
- private Code_attribute codeAttr;
- private Map<Integer, List<LocalVariableTypeTable_attribute.Entry>> pcMap;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/Main.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.io.PrintWriter;
-
-/**
- * Main entry point.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Main {
- /**
- * Main entry point for the launcher.
- * Note: This method calls System.exit.
- * @param args command line arguments
- */
- public static void main(String[] args) {
- JavapTask t = new JavapTask();
- int rc = t.run(args);
- System.exit(rc);
- }
-
- /**
- * Entry point that does <i>not</i> call System.exit.
- * @param args command line arguments
- * @param out output stream
- * @return an exit code. 0 means success, non-zero means an error occurred.
- */
- public static int run(String[] args, PrintWriter out) {
- JavapTask t = new JavapTask();
- t.setLog(out);
- return t.run(args);
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/Messages.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2007, 2009, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.util.Locale;
-
-/**
- * Access to javap messages.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public interface Messages {
- String getMessage(String key, Object... args);
-
- String getMessage(Locale locale, String key, Object... args);
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/Options.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2007, 2014, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.util.EnumSet;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.sun.tools.classfile.AccessFlags;
-
-/*
- * Provides access to javap's options, set via the command line
- * or JSR 199 API.
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class Options {
- public static Options instance(Context context) {
- Options instance = context.get(Options.class);
- if (instance == null)
- instance = new Options(context);
- return instance;
- }
-
- protected Options(Context context) {
- context.put(Options.class, this);
- }
-
- /**
- * Checks access of class, field or method.
- */
- public boolean checkAccess(AccessFlags flags){
-
- boolean isPublic = flags.is(AccessFlags.ACC_PUBLIC);
- boolean isProtected = flags.is(AccessFlags.ACC_PROTECTED);
- boolean isPrivate = flags.is(AccessFlags.ACC_PRIVATE);
- boolean isPackage = !(isPublic || isProtected || isPrivate);
-
- if ((showAccess == AccessFlags.ACC_PUBLIC) && (isProtected || isPrivate || isPackage))
- return false;
- else if ((showAccess == AccessFlags.ACC_PROTECTED) && (isPrivate || isPackage))
- return false;
- else if ((showAccess == 0) && (isPrivate))
- return false;
- else
- return true;
- }
-
- public boolean help;
- public boolean verbose;
- public boolean version;
- public boolean fullVersion;
- public boolean showFlags;
- public boolean showLineAndLocalVariableTables;
- public int showAccess;
- public Set<String> accessOptions = new HashSet<>();
- public Set<InstructionDetailWriter.Kind> details = EnumSet.noneOf(InstructionDetailWriter.Kind.class);
- public boolean showDisassembled;
- public boolean showDescriptors;
- public boolean showAllAttrs;
- public boolean showConstants;
- public boolean sysInfo;
- public boolean showInnerClasses;
- public int indentWidth = 2; // #spaces per indentWidth level; must be > 0
- public int tabColumn = 40; // column number for comments; must be > 0
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/SourceWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileManager.Location;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardLocation;
-
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.LineNumberTable_attribute;
-import com.sun.tools.classfile.SourceFile_attribute;
-
-
-/**
- * Annotate instructions with source code.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class SourceWriter extends InstructionDetailWriter {
- static SourceWriter instance(Context context) {
- SourceWriter instance = context.get(SourceWriter.class);
- if (instance == null)
- instance = new SourceWriter(context);
- return instance;
- }
-
- protected SourceWriter(Context context) {
- super(context);
- context.put(SourceWriter.class, this);
- }
-
- void setFileManager(JavaFileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void reset(ClassFile cf, Code_attribute attr) {
- setSource(cf);
- setLineMap(attr);
- }
-
- public void writeDetails(Instruction instr) {
- String indent = space(40); // could get from Options?
- Set<Integer> lines = lineMap.get(instr.getPC());
- if (lines != null) {
- for (int line: lines) {
- print(indent);
- print(String.format(" %4d ", line));
- if (line < sourceLines.length)
- print(sourceLines[line]);
- println();
- int nextLine = nextLine(line);
- for (int i = line + 1; i < nextLine; i++) {
- print(indent);
- print(String.format("(%4d)", i));
- if (i < sourceLines.length)
- print(sourceLines[i]);
- println();
- }
- }
- }
- }
-
- public boolean hasSource() {
- return (sourceLines.length > 0);
- }
-
- private void setLineMap(Code_attribute attr) {
- SortedMap<Integer, SortedSet<Integer>> map = new TreeMap<>();
- SortedSet<Integer> allLines = new TreeSet<>();
- for (Attribute a: attr.attributes) {
- if (a instanceof LineNumberTable_attribute) {
- LineNumberTable_attribute t = (LineNumberTable_attribute) a;
- for (LineNumberTable_attribute.Entry e: t.line_number_table) {
- int start_pc = e.start_pc;
- int line = e.line_number;
- SortedSet<Integer> pcLines = map.get(start_pc);
- if (pcLines == null) {
- pcLines = new TreeSet<>();
- map.put(start_pc, pcLines);
- }
- pcLines.add(line);
- allLines.add(line);
- }
- }
- }
- lineMap = map;
- lineList = new ArrayList<>(allLines);
- }
-
- private void setSource(ClassFile cf) {
- if (cf != classFile) {
- classFile = cf;
- sourceLines = splitLines(readSource(cf));
- }
- }
-
- private String readSource(ClassFile cf) {
- if (fileManager == null)
- return null;
-
- Location location;
- if (fileManager.hasLocation((StandardLocation.SOURCE_PATH)))
- location = StandardLocation.SOURCE_PATH;
- else
- location = StandardLocation.CLASS_PATH;
-
- // Guess the source file for a class from the package name for this
- // class and the base of the source file. This avoids having to read
- // additional classes to determine the outmost class from any
- // InnerClasses and EnclosingMethod attributes.
- try {
- String className = cf.getName();
- SourceFile_attribute sf =
- (SourceFile_attribute) cf.attributes.get(Attribute.SourceFile);
- if (sf == null) {
- report(messages.getMessage("err.no.SourceFile.attribute"));
- return null;
- }
- String sourceFile = sf.getSourceFile(cf.constant_pool);
- String fileBase = sourceFile.endsWith(".java")
- ? sourceFile.substring(0, sourceFile.length() - 5) : sourceFile;
- int sep = className.lastIndexOf("/");
- String pkgName = (sep == -1 ? "" : className.substring(0, sep+1));
- String topClassName = (pkgName + fileBase).replace('/', '.');
- JavaFileObject fo =
- fileManager.getJavaFileForInput(location,
- topClassName,
- JavaFileObject.Kind.SOURCE);
- if (fo == null) {
- report(messages.getMessage("err.source.file.not.found"));
- return null;
- }
- return fo.getCharContent(true).toString();
- } catch (ConstantPoolException e) {
- report(e);
- return null;
- } catch (IOException e) {
- report(e.getLocalizedMessage());
- return null;
- }
- }
-
- private static String[] splitLines(String text) {
- if (text == null)
- return new String[0];
-
- List<String> lines = new ArrayList<>();
- lines.add(""); // dummy line 0
- try {
- BufferedReader r = new BufferedReader(new StringReader(text));
- String line;
- while ((line = r.readLine()) != null)
- lines.add(line);
- } catch (IOException ignore) {
- }
- return lines.toArray(new String[lines.size()]);
- }
-
- private int nextLine(int line) {
- int i = lineList.indexOf(line);
- if (i == -1 || i == lineList.size() - 1)
- return - 1;
- return lineList.get(i + 1);
- }
-
- private JavaFileManager fileManager;
- private ClassFile classFile;
- private SortedMap<Integer, SortedSet<Integer>> lineMap;
- private List<Integer> lineList;
- private String[] sourceLines;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/StackMapWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,289 +0,0 @@
-/*
- * Copyright (c) 2009, 2013, 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.
- */
-
-package com.sun.tools.javap;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.sun.tools.classfile.AccessFlags;
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.Descriptor;
-import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.Method;
-import com.sun.tools.classfile.StackMapTable_attribute;
-import com.sun.tools.classfile.StackMapTable_attribute.*;
-
-import static com.sun.tools.classfile.StackMapTable_attribute.verification_type_info.*;
-
-/**
- * Annotate instructions with stack map.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class StackMapWriter extends InstructionDetailWriter {
- static StackMapWriter instance(Context context) {
- StackMapWriter instance = context.get(StackMapWriter.class);
- if (instance == null)
- instance = new StackMapWriter(context);
- return instance;
- }
-
- protected StackMapWriter(Context context) {
- super(context);
- context.put(StackMapWriter.class, this);
- classWriter = ClassWriter.instance(context);
- }
-
- public void reset(Code_attribute attr) {
- setStackMap((StackMapTable_attribute) attr.attributes.get(Attribute.StackMapTable));
- }
-
- void setStackMap(StackMapTable_attribute attr) {
- if (attr == null) {
- map = null;
- return;
- }
-
- Method m = classWriter.getMethod();
- Descriptor d = m.descriptor;
- String[] args;
- try {
- ConstantPool cp = classWriter.getClassFile().constant_pool;
- String argString = d.getParameterTypes(cp);
- args = argString.substring(1, argString.length() - 1).split("[, ]+");
- } catch (ConstantPoolException | InvalidDescriptor e) {
- return;
- }
- boolean isStatic = m.access_flags.is(AccessFlags.ACC_STATIC);
-
- verification_type_info[] initialLocals = new verification_type_info[(isStatic ? 0 : 1) + args.length];
- if (!isStatic)
- initialLocals[0] = new CustomVerificationTypeInfo("this");
- for (int i = 0; i < args.length; i++) {
- initialLocals[(isStatic ? 0 : 1) + i] =
- new CustomVerificationTypeInfo(args[i].replace(".", "/"));
- }
-
- map = new HashMap<>();
- StackMapBuilder builder = new StackMapBuilder();
-
- // using -1 as the pc for the initial frame effectively compensates for
- // the difference in behavior for the first stack map frame (where the
- // pc offset is just offset_delta) compared to subsequent frames (where
- // the pc offset is always offset_delta+1).
- int pc = -1;
-
- map.put(pc, new StackMap(initialLocals, empty));
-
- for (int i = 0; i < attr.entries.length; i++)
- pc = attr.entries[i].accept(builder, pc);
- }
-
- public void writeInitialDetails() {
- writeDetails(-1);
- }
-
- public void writeDetails(Instruction instr) {
- writeDetails(instr.getPC());
- }
-
- private void writeDetails(int pc) {
- if (map == null)
- return;
-
- StackMap m = map.get(pc);
- if (m != null) {
- print("StackMap locals: ", m.locals);
- print("StackMap stack: ", m.stack);
- }
-
- }
-
- void print(String label, verification_type_info[] entries) {
- print(label);
- for (int i = 0; i < entries.length; i++) {
- print(" ");
- print(entries[i]);
- }
- println();
- }
-
- void print(verification_type_info entry) {
- if (entry == null) {
- print("ERROR");
- return;
- }
-
- switch (entry.tag) {
- case -1:
- print(((CustomVerificationTypeInfo) entry).text);
- break;
-
- case ITEM_Top:
- print("top");
- break;
-
- case ITEM_Integer:
- print("int");
- break;
-
- case ITEM_Float:
- print("float");
- break;
-
- case ITEM_Long:
- print("long");
- break;
-
- case ITEM_Double:
- print("double");
- break;
-
- case ITEM_Null:
- print("null");
- break;
-
- case ITEM_UninitializedThis:
- print("uninit_this");
- break;
-
- case ITEM_Object:
- try {
- ConstantPool cp = classWriter.getClassFile().constant_pool;
- ConstantPool.CONSTANT_Class_info class_info = cp.getClassInfo(((Object_variable_info) entry).cpool_index);
- print(cp.getUTF8Value(class_info.name_index));
- } catch (ConstantPoolException e) {
- print("??");
- }
- break;
-
- case ITEM_Uninitialized:
- print(((Uninitialized_variable_info) entry).offset);
- break;
- }
-
- }
-
- private Map<Integer, StackMap> map;
- private ClassWriter classWriter;
-
- class StackMapBuilder
- implements StackMapTable_attribute.stack_map_frame.Visitor<Integer, Integer> {
-
- public Integer visit_same_frame(same_frame frame, Integer pc) {
- int new_pc = pc + frame.getOffsetDelta() + 1;
- StackMap m = map.get(pc);
- assert (m != null);
- map.put(new_pc, m);
- return new_pc;
- }
-
- public Integer visit_same_locals_1_stack_item_frame(same_locals_1_stack_item_frame frame, Integer pc) {
- int new_pc = pc + frame.getOffsetDelta() + 1;
- StackMap prev = map.get(pc);
- assert (prev != null);
- StackMap m = new StackMap(prev.locals, frame.stack);
- map.put(new_pc, m);
- return new_pc;
- }
-
- public Integer visit_same_locals_1_stack_item_frame_extended(same_locals_1_stack_item_frame_extended frame, Integer pc) {
- int new_pc = pc + frame.getOffsetDelta() + 1;
- StackMap prev = map.get(pc);
- assert (prev != null);
- StackMap m = new StackMap(prev.locals, frame.stack);
- map.put(new_pc, m);
- return new_pc;
- }
-
- public Integer visit_chop_frame(chop_frame frame, Integer pc) {
- int new_pc = pc + frame.getOffsetDelta() + 1;
- StackMap prev = map.get(pc);
- assert (prev != null);
- int k = 251 - frame.frame_type;
- verification_type_info[] new_locals = Arrays.copyOf(prev.locals, prev.locals.length - k);
- StackMap m = new StackMap(new_locals, empty);
- map.put(new_pc, m);
- return new_pc;
- }
-
- public Integer visit_same_frame_extended(same_frame_extended frame, Integer pc) {
- int new_pc = pc + frame.getOffsetDelta();
- StackMap m = map.get(pc);
- assert (m != null);
- map.put(new_pc, m);
- return new_pc;
- }
-
- public Integer visit_append_frame(append_frame frame, Integer pc) {
- int new_pc = pc + frame.getOffsetDelta() + 1;
- StackMap prev = map.get(pc);
- assert (prev != null);
- verification_type_info[] new_locals = new verification_type_info[prev.locals.length + frame.locals.length];
- System.arraycopy(prev.locals, 0, new_locals, 0, prev.locals.length);
- System.arraycopy(frame.locals, 0, new_locals, prev.locals.length, frame.locals.length);
- StackMap m = new StackMap(new_locals, empty);
- map.put(new_pc, m);
- return new_pc;
- }
-
- public Integer visit_full_frame(full_frame frame, Integer pc) {
- int new_pc = pc + frame.getOffsetDelta() + 1;
- StackMap m = new StackMap(frame.locals, frame.stack);
- map.put(new_pc, m);
- return new_pc;
- }
-
- }
-
- static class StackMap {
- StackMap(verification_type_info[] locals, verification_type_info[] stack) {
- this.locals = locals;
- this.stack = stack;
- }
-
- private final verification_type_info[] locals;
- private final verification_type_info[] stack;
- }
-
- static class CustomVerificationTypeInfo extends verification_type_info {
- public CustomVerificationTypeInfo(String text) {
- super(-1);
- this.text = text;
- }
- private String text;
- }
-
- private final verification_type_info[] empty = { };
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/TryBlockWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- */
-
-package com.sun.tools.javap;
-
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.Code_attribute.Exception_data;
-import com.sun.tools.classfile.Instruction;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * Annotate instructions with details about try blocks.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class TryBlockWriter extends InstructionDetailWriter {
- public enum NoteKind {
- START("try") {
- public boolean match(Exception_data entry, int pc) {
- return (pc == entry.start_pc);
- }
- },
- END("end try") {
- public boolean match(Exception_data entry, int pc) {
- return (pc == entry.end_pc);
- }
- },
- HANDLER("catch") {
- public boolean match(Exception_data entry, int pc) {
- return (pc == entry.handler_pc);
- }
- };
- NoteKind(String text) {
- this.text = text;
- }
- public abstract boolean match(Exception_data entry, int pc);
- public final String text;
- }
-
- static TryBlockWriter instance(Context context) {
- TryBlockWriter instance = context.get(TryBlockWriter.class);
- if (instance == null)
- instance = new TryBlockWriter(context);
- return instance;
- }
-
- protected TryBlockWriter(Context context) {
- super(context);
- context.put(TryBlockWriter.class, this);
- constantWriter = ConstantWriter.instance(context);
- }
-
- public void reset(Code_attribute attr) {
- indexMap = new HashMap<>();
- pcMap = new HashMap<>();
- for (int i = 0; i < attr.exception_table.length; i++) {
- Exception_data entry = attr.exception_table[i];
- indexMap.put(entry, i);
- put(entry.start_pc, entry);
- put(entry.end_pc, entry);
- put(entry.handler_pc, entry);
- }
- }
-
- public void writeDetails(Instruction instr) {
- writeTrys(instr, NoteKind.END);
- writeTrys(instr, NoteKind.START);
- writeTrys(instr, NoteKind.HANDLER);
- }
-
- public void writeTrys(Instruction instr, NoteKind kind) {
- String indent = space(2); // get from Options?
- int pc = instr.getPC();
- List<Exception_data> entries = pcMap.get(pc);
- if (entries != null) {
- for (ListIterator<Exception_data> iter =
- entries.listIterator(kind == NoteKind.END ? entries.size() : 0);
- kind == NoteKind.END ? iter.hasPrevious() : iter.hasNext() ; ) {
- Exception_data entry =
- kind == NoteKind.END ? iter.previous() : iter.next();
- if (kind.match(entry, pc)) {
- print(indent);
- print(kind.text);
- print("[");
- print(indexMap.get(entry));
- print("] ");
- if (entry.catch_type == 0)
- print("finally");
- else {
- print("#" + entry.catch_type);
- print(" // ");
- constantWriter.write(entry.catch_type);
- }
- println();
- }
- }
- }
- }
-
- private void put(int pc, Exception_data entry) {
- List<Exception_data> list = pcMap.get(pc);
- if (list == null) {
- list = new ArrayList<>();
- pcMap.put(pc, list);
- }
- if (!list.contains(entry))
- list.add(entry);
- }
-
- private Map<Integer, List<Exception_data>> pcMap;
- private Map<Exception_data, Integer> indexMap;
- private ConstantWriter constantWriter;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2009, 2013, 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.
- */
-package com.sun.tools.javap;
-
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.TypeAnnotation;
-import com.sun.tools.classfile.TypeAnnotation.Position;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.Method;
-import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeTypeAnnotations_attribute;
-import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import com.sun.tools.javac.util.StringUtils;
-
-/**
- * Annotate instructions with details about type annotations.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class TypeAnnotationWriter extends InstructionDetailWriter {
- public enum NoteKind { VISIBLE, INVISIBLE }
-
- public static class Note {
- Note(NoteKind kind, TypeAnnotation anno) {
- this.kind = kind;
- this.anno = anno;
- }
- public final NoteKind kind;
- public final TypeAnnotation anno;
- }
-
- static TypeAnnotationWriter instance(Context context) {
- TypeAnnotationWriter instance = context.get(TypeAnnotationWriter.class);
- if (instance == null)
- instance = new TypeAnnotationWriter(context);
- return instance;
- }
-
- protected TypeAnnotationWriter(Context context) {
- super(context);
- context.put(TypeAnnotationWriter.class, this);
- annotationWriter = AnnotationWriter.instance(context);
- classWriter = ClassWriter.instance(context);
- }
-
- public void reset(Code_attribute attr) {
- Method m = classWriter.getMethod();
- pcMap = new HashMap<>();
- check(NoteKind.VISIBLE, (RuntimeVisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeVisibleTypeAnnotations));
- check(NoteKind.INVISIBLE, (RuntimeInvisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeInvisibleTypeAnnotations));
- }
-
- private void check(NoteKind kind, RuntimeTypeAnnotations_attribute attr) {
- if (attr == null)
- return;
-
- for (TypeAnnotation anno: attr.annotations) {
- Position p = anno.position;
- Note note = null;
- if (p.offset != -1)
- addNote(p.offset, note = new Note(kind, anno));
- if (p.lvarOffset != null) {
- for (int i = 0; i < p.lvarOffset.length; i++) {
- if (note == null)
- note = new Note(kind, anno);
- addNote(p.lvarOffset[i], note);
- }
- }
- }
- }
-
- private void addNote(int pc, Note note) {
- List<Note> list = pcMap.get(pc);
- if (list == null)
- pcMap.put(pc, list = new ArrayList<>());
- list.add(note);
- }
-
- @Override
- void writeDetails(Instruction instr) {
- String indent = space(2); // get from Options?
- int pc = instr.getPC();
- List<Note> notes = pcMap.get(pc);
- if (notes != null) {
- for (Note n: notes) {
- print(indent);
- print("@");
- annotationWriter.write(n.anno, false, true);
- print(", ");
- println(StringUtils.toLowerCase(n.kind.toString()));
- }
- }
- }
-
- private AnnotationWriter annotationWriter;
- private ClassWriter classWriter;
- private Map<Integer, List<Note>> pcMap;
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/overview.html Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
- <head>
- <title>javap: class file disassembler</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- </head>
- <body>
- Javap is a class file disassembler.
- </body>
-</html>
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/package-info.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.
- */
-
-/**
- Classes to dump class files in text format.
-
- <p><b>This is NOT part of any supported API.
- If you write code that depends on this, you do so at your own risk.
- This code and its internal interfaces are subject to change or
- deletion without notice.</b>
-*/
-@jdk.Exported(false)
-package com.sun.tools.javap;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/resources/javap.properties Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-
-err.prefix=Error:
-
-err.bad.constant.pool=error while reading constant pool for {0}: {1}
-err.class.not.found=class not found: {0}
-err.crash=A serious internal error has occurred: {0}\nPlease file a bug report, and include the following information:\n{1}
-err.end.of.file=unexpected end of file while reading {0}
-err.file.not.found=file not found: {0}
-err.incompatible.options=bad combination of options: {0}
-err.internal.error=internal error: {0} {1} {2}
-err.invalid.arg.for.option=invalid argument for option: {0}
-err.ioerror=IO error reading {0}: {1}
-err.missing.arg=no value given for {0}
-err.no.classes.specified=no classes specified
-err.not.standard.file.manager=can only specify class files when using a standard file manager
-err.invalid.use.of.option=invalid use of option: {0}
-err.unknown.option=unknown option: {0}
-err.no.SourceFile.attribute=no SourceFile attribute
-err.source.file.not.found=source file not found
-err.bad.innerclasses.attribute=bad InnerClasses attribute for {0}
-err.nomem=Insufficient memory. To increase memory use -J-Xmx option.
-
-main.usage.summary=\
-Usage: {0} <options> <classes>\n\
-use -help for a list of possible options
-
-warn.prefix=Warning:
-warn.unexpected.class=Binary file {0} contains {1}
-
-note.prefix=Note:
-
-main.usage.summary=\
-Usage: {0} <options> <classes>\n\
-use -help for a list of possible options
-
-main.usage=\
-Usage: {0} <options> <classes>\n\
-where possible options include:
-
-
-main.opt.help=\
-\ -help --help -? Print this usage message
-
-main.opt.version=\
-\ -version Version information
-
-main.opt.v=\
-\ -v -verbose Print additional information
-
-main.opt.l=\
-\ -l Print line number and local variable tables
-
-main.opt.public=\
-\ -public Show only public classes and members
-
-main.opt.protected=\
-\ -protected Show protected/public classes and members
-
-main.opt.package=\
-\ -package Show package/protected/public classes\n\
-\ and members (default)
-
-main.opt.p=\
-\ -p -private Show all classes and members
-
-main.opt.c=\
-\ -c Disassemble the code
-
-main.opt.s=\
-\ -s Print internal type signatures
-
-main.opt.classpath=\
-\ -classpath <path> Specify where to find user class files
-
-main.opt.cp=\
-\ -cp <path> Specify where to find user class files
-
-main.opt.bootclasspath=\
-\ -bootclasspath <path> Override location of bootstrap class files
-
-main.opt.constants=\
-\ -constants Show final constants
-
-
-main.opt.sysinfo=\
-\ -sysinfo Show system info (path, size, date, MD5 hash)\n\
-\ of class being processed
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/resources/javap_ja.properties Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-
-err.prefix=\u30A8\u30E9\u30FC:
-
-err.bad.constant.pool={0}\u306E\u5B9A\u6570\u30D7\u30FC\u30EB\u306E\u8AAD\u53D6\u308A\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {1}
-err.class.not.found=\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
-err.crash=\u91CD\u5927\u306A\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {0}\n\u6B21\u306E\u60C5\u5831\u3092\u542B\u3080\u30D0\u30B0\u30FB\u30EC\u30DD\u30FC\u30C8\u3092\u30D5\u30A1\u30A4\u30EB\u3057\u3066\u304F\u3060\u3055\u3044:\n{1}
-err.end.of.file={0}\u306E\u8AAD\u53D6\u308A\u4E2D\u306B\u4E88\u671F\u3057\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u306E\u7D42\u308F\u308A\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F
-err.file.not.found=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
-err.h.not.supported=-h\u306F\u4F7F\u7528\u53EF\u80FD\u3067\u306A\u304F\u306A\u308A\u307E\u3057\u305F - 'javah'\u30D7\u30ED\u30B0\u30E9\u30E0\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
-err.incompatible.options=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u304C\u4E0D\u6B63\u3067\u3059: {0}
-err.internal.error=\u5185\u90E8\u30A8\u30E9\u30FC: {0} {1} {2}
-err.invalid.arg.for.option=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: {0}
-err.ioerror={0}\u306E\u8AAD\u53D6\u308A\u4E2D\u306BIO\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {1}
-err.missing.arg={0}\u306B\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
-err.no.classes.specified=\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
-err.not.standard.file.manager=\u6A19\u6E96\u30D5\u30A1\u30A4\u30EB\u30FB\u30DE\u30CD\u30FC\u30B8\u30E3\u3092\u4F7F\u7528\u3057\u3066\u3044\u308B\u5834\u5408\u306F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u307F\u6307\u5B9A\u3067\u304D\u307E\u3059
-err.unknown.option=\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}
-err.verify.not.supported=-verify\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
-err.no.SourceFile.attribute=SourceFile\u5C5E\u6027\u304C\u3042\u308A\u307E\u305B\u3093
-err.source.file.not.found=\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-err.bad.innerclasses.attribute={0}\u306EInnerClasses\u5C5E\u6027\u304C\u4E0D\u6B63\u3067\u3059
-warn.Xold.not.supported=-Xold\u306F\u4F7F\u7528\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3057\u305F
-
-main.usage.summary=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u30EA\u30B9\u30C8\u306B\u3064\u3044\u3066\u306F\u3001-help\u3092\u4F7F\u7528\u3057\u307E\u3059
-
-warn.prefix=\u8B66\u544A:
-warn.unexpected.class=\u30D0\u30A4\u30CA\u30EA\u30FB\u30D5\u30A1\u30A4\u30EB{0}\u306B{1}\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
-
-note.prefix=\u6CE8:
-
-main.usage.summary=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u30EA\u30B9\u30C8\u306B\u3064\u3044\u3066\u306F\u3001-help\u3092\u4F7F\u7528\u3057\u307E\u3059
-
-main.usage=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059:
-
-
-main.opt.help=\ -help --help -? \u3053\u306E\u4F7F\u7528\u65B9\u6CD5\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B
-
-main.opt.version=\ -version \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831
-
-main.opt.v=\ -v -verbose \u8FFD\u52A0\u60C5\u5831\u3092\u51FA\u529B\u3059\u308B
-
-main.opt.l=\ -l \u884C\u756A\u53F7\u3068\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u8868\u3092\u51FA\u529B\u3059\u308B
-
-main.opt.public=\ -public public\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u8868\u793A\u3059\u308B
-
-main.opt.protected=\ -protected protected/public\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u8868\u793A\u3059\u308B
-
-main.opt.package=\ -package package/protected/public\u30AF\u30E9\u30B9\u304A\u3088\u3073\n \u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u8868\u793A\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)
-
-main.opt.p=\ -p -private \u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u8868\u793A\u3059\u308B
-
-main.opt.c=\ -c \u30B3\u30FC\u30C9\u3092\u9006\u30A2\u30BB\u30F3\u30D6\u30EB\u3059\u308B
-
-main.opt.s=\ -s \u5185\u90E8\u30BF\u30A4\u30D7\u7F72\u540D\u3092\u51FA\u529B\u3059\u308B
-
-main.opt.classpath=\ -classpath <path> \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B
-
-main.opt.cp=\ -cp <path> \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B
-
-main.opt.bootclasspath=\ -bootclasspath <path> \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u4F4D\u7F6E\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
-
-main.opt.constants=\ -constants \u9759\u7684final\u5B9A\u6570\u3092\u8868\u793A\u3059\u308B
-
-
-main.opt.sysinfo=\ -sysinfo \u51E6\u7406\u3057\u3066\u3044\u308B\u30AF\u30E9\u30B9\u306E\u30B7\u30B9\u30C6\u30E0\u60C5\u5831(\u30D1\u30B9\u3001\u30B5\u30A4\u30BA\u3001\u65E5\u4ED8\u3001MD5\u30CF\u30C3\u30B7\u30E5)\n \u3092\u8868\u793A\u3059\u308B
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-
-err.prefix=\u9519\u8BEF:
-
-err.bad.constant.pool=\u8BFB\u53D6{0}\u7684\u5E38\u91CF\u6C60\u65F6\u51FA\u9519: {1}
-err.class.not.found=\u627E\u4E0D\u5230\u7C7B: {0}
-err.crash=\u51FA\u73B0\u4E25\u91CD\u7684\u5185\u90E8\u9519\u8BEF: {0}\n\u8BF7\u5EFA\u7ACB Bug \u62A5\u544A, \u5E76\u5305\u62EC\u4EE5\u4E0B\u4FE1\u606F:\n{1}
-err.end.of.file=\u8BFB\u53D6{0}\u65F6\u51FA\u73B0\u610F\u5916\u7684\u6587\u4EF6\u7ED3\u5C3E
-err.file.not.found=\u627E\u4E0D\u5230\u6587\u4EF6: {0}
-err.h.not.supported=-h \u4E0D\u518D\u53EF\u7528 - \u8BF7\u4F7F\u7528 'javah' \u7A0B\u5E8F
-err.incompatible.options=\u9009\u9879\u7EC4\u5408\u9519\u8BEF: {0}
-err.internal.error=\u5185\u90E8\u9519\u8BEF: {0} {1} {2}
-err.invalid.arg.for.option=\u9009\u9879\u7684\u53C2\u6570\u65E0\u6548: {0}
-err.ioerror=\u8BFB\u53D6{0}\u65F6\u51FA\u73B0 IO \u9519\u8BEF: {1}
-err.missing.arg=\u6CA1\u6709\u4E3A{0}\u6307\u5B9A\u503C
-err.no.classes.specified=\u672A\u6307\u5B9A\u7C7B
-err.not.standard.file.manager=\u4F7F\u7528\u6807\u51C6\u6587\u4EF6\u7BA1\u7406\u5668\u65F6\u53EA\u80FD\u6307\u5B9A\u7C7B\u6587\u4EF6
-err.unknown.option=\u672A\u77E5\u9009\u9879: {0}
-err.verify.not.supported=\u4E0D\u652F\u6301 -verify
-err.no.SourceFile.attribute=\u6CA1\u6709 SourceFile \u5C5E\u6027
-err.source.file.not.found=\u627E\u4E0D\u5230\u6E90\u6587\u4EF6
-err.bad.innerclasses.attribute={0}\u7684 InnerClasses \u5C5E\u6027\u9519\u8BEF
-warn.Xold.not.supported=-Xold \u4E0D\u518D\u53EF\u7528
-
-main.usage.summary=\u7528\u6CD5: {0} <options> <classes>\n\u4F7F\u7528 -help \u5217\u51FA\u53EF\u80FD\u7684\u9009\u9879
-
-warn.prefix=\u8B66\u544A:
-warn.unexpected.class=\u4E8C\u8FDB\u5236\u6587\u4EF6{0}\u5305\u542B{1}
-
-note.prefix=\u6CE8:
-
-main.usage.summary=\u7528\u6CD5: {0} <options> <classes>\n\u4F7F\u7528 -help \u5217\u51FA\u53EF\u80FD\u7684\u9009\u9879
-
-main.usage=\u7528\u6CD5: {0} <options> <classes>\n\u5176\u4E2D, \u53EF\u80FD\u7684\u9009\u9879\u5305\u62EC:
-
-
-main.opt.help=\ -help --help -? \u8F93\u51FA\u6B64\u7528\u6CD5\u6D88\u606F
-
-main.opt.version=\ -version \u7248\u672C\u4FE1\u606F
-
-main.opt.v=\ -v -verbose \u8F93\u51FA\u9644\u52A0\u4FE1\u606F
-
-main.opt.l=\ -l \u8F93\u51FA\u884C\u53F7\u548C\u672C\u5730\u53D8\u91CF\u8868
-
-main.opt.public=\ -public \u4EC5\u663E\u793A\u516C\u5171\u7C7B\u548C\u6210\u5458
-
-main.opt.protected=\ -protected \u663E\u793A\u53D7\u4FDD\u62A4\u7684/\u516C\u5171\u7C7B\u548C\u6210\u5458
-
-main.opt.package=\ -package \u663E\u793A\u7A0B\u5E8F\u5305/\u53D7\u4FDD\u62A4\u7684/\u516C\u5171\u7C7B\n \u548C\u6210\u5458 (\u9ED8\u8BA4)
-
-main.opt.p=\ -p -private \u663E\u793A\u6240\u6709\u7C7B\u548C\u6210\u5458
-
-main.opt.c=\ -c \u5BF9\u4EE3\u7801\u8FDB\u884C\u53CD\u6C47\u7F16
-
-main.opt.s=\ -s \u8F93\u51FA\u5185\u90E8\u7C7B\u578B\u7B7E\u540D
-
-main.opt.classpath=\ -classpath <path> \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
-
-main.opt.cp=\ -cp <path> \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
-
-main.opt.bootclasspath=\ -bootclasspath <path> \u8986\u76D6\u5F15\u5BFC\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
-
-main.opt.constants=\ -constants \u663E\u793A\u9759\u6001\u6700\u7EC8\u5E38\u91CF
-
-
-main.opt.sysinfo=\ -sysinfo \u663E\u793A\u6B63\u5728\u5904\u7406\u7684\u7C7B\u7684\n \u7CFB\u7EDF\u4FE1\u606F (\u8DEF\u5F84, \u5927\u5C0F, \u65E5\u671F, MD5 \u6563\u5217)
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/resources/version.properties-template Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2007, 2008, 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.
-#
-
-jdk=$(JDK_VERSION)
-full=$(FULL_VERSION)
-release=$(RELEASE)
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Analyzer.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,442 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, 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.
- */
-package com.sun.tools.jdeps;
-
-import java.io.PrintStream;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import com.sun.tools.classfile.Dependency.Location;
-
-/**
- * Dependency Analyzer.
- */
-public class Analyzer {
- /**
- * Type of the dependency analysis. Appropriate level of data
- * will be stored.
- */
- public enum Type {
- SUMMARY,
- PACKAGE,
- CLASS,
- VERBOSE
- }
-
- /**
- * Filter to be applied when analyzing the dependencies from the given archives.
- * Only the accepted dependencies are recorded.
- */
- interface Filter {
- boolean accepts(Location origin, Archive originArchive, Location target, Archive targetArchive);
- }
-
- protected final Type type;
- protected final Filter filter;
- protected final Map<Archive, ArchiveDeps> results = new HashMap<>();
- protected final Map<Location, Archive> map = new HashMap<>();
- private static final Archive NOT_FOUND
- = new Archive(JdepsTask.getMessage("artifact.not.found"));
-
- /**
- * Constructs an Analyzer instance.
- *
- * @param type Type of the dependency analysis
- * @param filter
- */
- public Analyzer(Type type, Filter filter) {
- this.type = type;
- this.filter = filter;
- }
-
- /**
- * Performs the dependency analysis on the given archives.
- */
- public boolean run(List<Archive> archives) {
- // build a map from Location to Archive
- buildLocationArchiveMap(archives);
-
- // traverse and analyze all dependencies
- for (Archive archive : archives) {
- ArchiveDeps deps = new ArchiveDeps(archive, type);
- archive.visitDependences(deps);
- results.put(archive, deps);
- }
- return true;
- }
-
- protected void buildLocationArchiveMap(List<Archive> archives) {
- // build a map from Location to Archive
- for (Archive archive: archives) {
- for (Location l: archive.getClasses()) {
- if (!map.containsKey(l)) {
- map.put(l, archive);
- } else {
- // duplicated class warning?
- }
- }
- }
- }
-
- public boolean hasDependences(Archive archive) {
- if (results.containsKey(archive)) {
- return results.get(archive).dependencies().size() > 0;
- }
- return false;
- }
-
- public Set<String> dependences(Archive source) {
- ArchiveDeps result = results.get(source);
- return result.dependencies().stream()
- .map(Dep::target)
- .collect(Collectors.toSet());
- }
-
- public interface Visitor {
- /**
- * Visits a recorded dependency from origin to target which can be
- * a fully-qualified classname, a package name, a module or
- * archive name depending on the Analyzer's type.
- */
- public void visitDependence(String origin, Archive originArchive,
- String target, Archive targetArchive);
- }
-
- /**
- * Visit the dependencies of the given source.
- * If the requested level is SUMMARY, it will visit the required archives list.
- */
- public void visitDependences(Archive source, Visitor v, Type level) {
- if (level == Type.SUMMARY) {
- final ArchiveDeps result = results.get(source);
- result.requires().stream()
- .sorted(Comparator.comparing(Archive::getName))
- .forEach(archive -> {
- Profile profile = result.getTargetProfile(archive);
- v.visitDependence(source.getName(), source,
- profile != null ? profile.profileName() : archive.getName(), archive);
- });
- } else {
- ArchiveDeps result = results.get(source);
- if (level != type) {
- // requesting different level of analysis
- result = new ArchiveDeps(source, level);
- source.visitDependences(result);
- }
- result.dependencies().stream()
- .sorted(Comparator.comparing(Dep::origin)
- .thenComparing(Dep::target))
- .forEach(d -> v.visitDependence(d.origin(), d.originArchive(), d.target(), d.targetArchive()));
- }
- }
-
- public void visitDependences(Archive source, Visitor v) {
- visitDependences(source, v, type);
- }
-
- /**
- * ArchiveDeps contains the dependencies for an Archive that can have one or
- * more classes.
- */
- class ArchiveDeps implements Archive.Visitor {
- protected final Archive archive;
- protected final Set<Archive> requires;
- protected final Set<Dep> deps;
- protected final Type level;
- private Profile profile;
- ArchiveDeps(Archive archive, Type level) {
- this.archive = archive;
- this.deps = new HashSet<>();
- this.requires = new HashSet<>();
- this.level = level;
- }
-
- Set<Dep> dependencies() {
- return deps;
- }
-
- Set<Archive> requires() {
- return requires;
- }
-
- Profile getTargetProfile(Archive target) {
- if (target instanceof Module) {
- return Profile.getProfile((Module) target);
- } else {
- return null;
- }
- }
-
- Archive findArchive(Location t) {
- Archive target = archive.getClasses().contains(t) ? archive : map.get(t);
- if (target == null) {
- map.put(t, target = NOT_FOUND);
- }
- return target;
- }
-
- // return classname or package name depedning on the level
- private String getLocationName(Location o) {
- if (level == Type.CLASS || level == Type.VERBOSE) {
- return o.getClassName();
- } else {
- String pkg = o.getPackageName();
- return pkg.isEmpty() ? "<unnamed>" : pkg;
- }
- }
-
- @Override
- public void visit(Location o, Location t) {
- Archive targetArchive = findArchive(t);
- if (filter.accepts(o, archive, t, targetArchive)) {
- addDep(o, t);
- if (archive != targetArchive && !requires.contains(targetArchive)) {
- requires.add(targetArchive);
- }
- }
- if (targetArchive instanceof Module) {
- Profile p = Profile.getProfile(t.getPackageName());
- if (profile == null || (p != null && p.compareTo(profile) > 0)) {
- profile = p;
- }
- }
- }
-
- private Dep curDep;
- protected Dep addDep(Location o, Location t) {
- String origin = getLocationName(o);
- String target = getLocationName(t);
- Archive targetArchive = findArchive(t);
- if (curDep != null &&
- curDep.origin().equals(origin) &&
- curDep.originArchive() == archive &&
- curDep.target().equals(target) &&
- curDep.targetArchive() == targetArchive) {
- return curDep;
- }
-
- Dep e = new Dep(origin, archive, target, targetArchive);
- if (deps.contains(e)) {
- for (Dep e1 : deps) {
- if (e.equals(e1)) {
- curDep = e1;
- }
- }
- } else {
- deps.add(e);
- curDep = e;
- }
- return curDep;
- }
- }
-
- /*
- * Class-level or package-level dependency
- */
- class Dep {
- final String origin;
- final Archive originArchive;
- final String target;
- final Archive targetArchive;
-
- Dep(String origin, Archive originArchive, String target, Archive targetArchive) {
- this.origin = origin;
- this.originArchive = originArchive;
- this.target = target;
- this.targetArchive = targetArchive;
- }
-
- String origin() {
- return origin;
- }
-
- Archive originArchive() {
- return originArchive;
- }
-
- String target() {
- return target;
- }
-
- Archive targetArchive() {
- return targetArchive;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public boolean equals(Object o) {
- if (o instanceof Dep) {
- Dep d = (Dep) o;
- return this.origin.equals(d.origin) &&
- this.originArchive == d.originArchive &&
- this.target.equals(d.target) &&
- this.targetArchive == d.targetArchive;
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- int hash = 7;
- hash = 67*hash + Objects.hashCode(this.origin)
- + Objects.hashCode(this.originArchive)
- + Objects.hashCode(this.target)
- + Objects.hashCode(this.targetArchive);
- return hash;
- }
-
- public String toString() {
- return String.format("%s (%s) -> %s (%s)%n",
- origin, originArchive.getName(),
- target, targetArchive.getName());
- }
- }
-
- static Analyzer getExportedAPIsAnalyzer() {
- return new ModuleAccessAnalyzer(ModuleAccessAnalyzer.reexportsFilter, true);
- }
-
- static Analyzer getModuleAccessAnalyzer() {
- return new ModuleAccessAnalyzer(ModuleAccessAnalyzer.accessCheckFilter, false);
- }
-
- private static class ModuleAccessAnalyzer extends Analyzer {
- private final boolean apionly;
- ModuleAccessAnalyzer(Filter filter, boolean apionly) {
- super(Type.VERBOSE, filter);
- this.apionly = apionly;
- }
- /**
- * Verify module access
- */
- public boolean run(List<Archive> archives) {
- // build a map from Location to Archive
- buildLocationArchiveMap(archives);
-
- // traverse and analyze all dependencies
- int count = 0;
- for (Archive archive : archives) {
- ArchiveDeps checker = new ArchiveDeps(archive, type);
- archive.visitDependences(checker);
- count += checker.dependencies().size();
- // output if any error
- Module m = (Module)archive;
- printDependences(System.err, m, checker.dependencies());
- results.put(archive, checker);
- }
- return count == 0;
- }
-
- private void printDependences(PrintStream out, Module m, Set<Dep> deps) {
- if (deps.isEmpty())
- return;
-
- String msg = apionly ? "API reference:" : "inaccessible reference:";
- deps.stream().sorted(Comparator.comparing(Dep::origin)
- .thenComparing(Dep::target))
- .forEach(d -> out.format("%s %s (%s) -> %s (%s)%n", msg,
- d.origin(), d.originArchive().getName(),
- d.target(), d.targetArchive().getName()));
- if (apionly) {
- out.format("Dependences missing re-exports=\"true\" attribute:%n");
- deps.stream()
- .map(Dep::targetArchive)
- .map(Archive::getName)
- .distinct()
- .sorted()
- .forEach(d -> out.format(" %s -> %s%n", m.name(), d));
- }
- }
-
- private static Module findModule(Archive archive) {
- if (Module.class.isInstance(archive)) {
- return (Module) archive;
- } else {
- return null;
- }
- }
-
- // returns true if target is accessible by origin
- private static boolean canAccess(Location o, Archive originArchive, Location t, Archive targetArchive) {
- Module origin = findModule(originArchive);
- Module target = findModule(targetArchive);
-
- if (targetArchive == Analyzer.NOT_FOUND) {
- return false;
- }
-
- // unnamed module
- // ## should check public type?
- if (target == null)
- return true;
-
- // module-private
- if (origin == target)
- return true;
-
- return target.isAccessibleTo(t.getClassName(), origin);
- }
-
- static final Filter accessCheckFilter = new Filter() {
- @Override
- public boolean accepts(Location o, Archive originArchive, Location t, Archive targetArchive) {
- return !canAccess(o, originArchive, t, targetArchive);
- }
- };
-
- static final Filter reexportsFilter = new Filter() {
- @Override
- public boolean accepts(Location o, Archive originArchive, Location t, Archive targetArchive) {
- Module origin = findModule(originArchive);
- Module target = findModule(targetArchive);
- if (!origin.isExportedPackage(o.getPackageName())) {
- // filter non-exported classes
- return false;
- }
-
- boolean accessible = canAccess(o, originArchive, t, targetArchive);
- if (!accessible)
- return true;
-
- String mn = target.name();
- // skip checking re-exports for java.base
- if (origin == target || "java.base".equals(mn))
- return false;
-
- assert origin.requires().containsKey(mn); // otherwise, should not be accessible
- if (origin.requires().get(mn)) {
- return false;
- }
- return true;
- }
- };
- }
-}
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Archive.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, 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.
- */
-package com.sun.tools.jdeps;
-
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.Dependency.Location;
-
-import java.io.IOException;
-import java.io.UncheckedIOException;
-import java.nio.file.Path;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Represents the source of the class files.
- */
-public class Archive {
- public static Archive getInstance(Path p) {
- try {
- return new Archive(p, ClassFileReader.newInstance(p));
- } catch (IOException e) {
- throw new UncheckedIOException(e);
- }
- }
-
- private final Path path;
- private final String filename;
- private final ClassFileReader reader;
- protected Map<Location, Set<Location>> deps = new ConcurrentHashMap<>();
-
- protected Archive(String name) {
- this(name, null);
- }
- protected Archive(String name, ClassFileReader reader) {
- this.path = null;
- this.filename = name;
- this.reader = reader;
- }
- protected Archive(Path p, ClassFileReader reader) {
- this.path = p;
- this.filename = path.getFileName().toString();
- this.reader = reader;
- }
-
- public ClassFileReader reader() {
- return reader;
- }
-
- public String getName() {
- return filename;
- }
-
- public void addClass(Location origin) {
- deps.computeIfAbsent(origin, _k -> new HashSet<>());
- }
-
- public void addClass(Location origin, Location target) {
- deps.computeIfAbsent(origin, _k -> new HashSet<>()).add(target);
- }
-
- public Set<Location> getClasses() {
- return deps.keySet();
- }
-
- public void visitDependences(Visitor v) {
- for (Map.Entry<Location,Set<Location>> e: deps.entrySet()) {
- for (Location target : e.getValue()) {
- v.visit(e.getKey(), target);
- }
- }
- }
-
- public boolean isEmpty() {
- return getClasses().isEmpty();
- }
-
- public String getPathName() {
- return path != null ? path.toString() : filename;
- }
-
- public String toString() {
- return filename;
- }
-
- public Path path() {
- return path;
- }
-
- interface Visitor {
- void visit(Location origin, Location target);
- }
-}
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/ClassFileReader.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,398 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, 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.
- */
-package com.sun.tools.jdeps;
-
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.Dependencies.ClassFileError;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.FileSystem;
-import java.nio.file.FileSystems;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.*;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * ClassFileReader reads ClassFile(s) of a given path that can be
- * a .class file, a directory, or a JAR file.
- */
-public class ClassFileReader {
- /**
- * Returns a ClassFileReader instance of a given path.
- */
- public static ClassFileReader newInstance(Path path) throws IOException {
- if (!Files.exists(path)) {
- throw new FileNotFoundException(path.toString());
- }
-
- if (Files.isDirectory(path)) {
- return new DirectoryReader(path);
- } else if (path.getFileName().toString().endsWith(".jar")) {
- return new JarFileReader(path);
- } else {
- return new ClassFileReader(path);
- }
- }
-
- /**
- * Returns a ClassFileReader instance of a given JarFile.
- */
- public static ClassFileReader newInstance(Path path, JarFile jf) throws IOException {
- return new JarFileReader(path, jf);
- }
-
- protected final Path path;
- protected final String baseFileName;
- protected final List<String> skippedEntries = new ArrayList<>();
- protected ClassFileReader(Path path) {
- this.path = path;
- this.baseFileName = path.getFileName() != null
- ? path.getFileName().toString()
- : path.toString();
- }
-
- public String getFileName() {
- return baseFileName;
- }
-
- public List<String> skippedEntries() {
- return skippedEntries;
- }
-
- /**
- * Returns the ClassFile matching the given binary name
- * or a fully-qualified class name.
- */
- public ClassFile getClassFile(String name) throws IOException {
- if (name.indexOf('.') > 0) {
- int i = name.lastIndexOf('.');
- String pathname = name.replace('.', File.separatorChar) + ".class";
- if (baseFileName.equals(pathname) ||
- baseFileName.equals(pathname.substring(0, i) + "$" +
- pathname.substring(i+1, pathname.length()))) {
- return readClassFile(path);
- }
- } else {
- if (baseFileName.equals(name.replace('/', File.separatorChar) + ".class")) {
- return readClassFile(path);
- }
- }
- return null;
- }
-
- public Iterable<ClassFile> getClassFiles() throws IOException {
- return new Iterable<ClassFile>() {
- public Iterator<ClassFile> iterator() {
- return new FileIterator();
- }
- };
- }
-
- protected ClassFile readClassFile(Path p) throws IOException {
- InputStream is = null;
- try {
- is = Files.newInputStream(p);
- return ClassFile.read(is);
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- } finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- class FileIterator implements Iterator<ClassFile> {
- int count;
- FileIterator() {
- this.count = 0;
- }
- public boolean hasNext() {
- return count == 0 && baseFileName.endsWith(".class");
- }
-
- public ClassFile next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- }
- try {
- ClassFile cf = readClassFile(path);
- count++;
- return cf;
- } catch (IOException e) {
- throw new ClassFileError(e);
- }
- }
-
- public void remove() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
- }
-
- public String toString() {
- return path.toString();
- }
-
- private static class DirectoryReader extends ClassFileReader {
- protected final String fsSep;
- DirectoryReader(Path path) throws IOException {
- this(FileSystems.getDefault(), path);
- }
- DirectoryReader(FileSystem fs, Path path) throws IOException {
- super(path);
- this.fsSep = fs.getSeparator();
- }
-
- public ClassFile getClassFile(String name) throws IOException {
- if (name.indexOf('.') > 0) {
- int i = name.lastIndexOf('.');
- String pathname = name.replace(".", fsSep) + ".class";
- Path p = path.resolve(pathname);
- if (!Files.exists(p)) {
- p = path.resolve(pathname.substring(0, i) + "$" +
- pathname.substring(i+1, pathname.length()));
- }
- if (Files.exists(p)) {
- return readClassFile(p);
- }
- } else {
- Path p = path.resolve(name + ".class");
- if (Files.exists(p)) {
- return readClassFile(p);
- }
- }
- return null;
- }
-
- public Iterable<ClassFile> getClassFiles() throws IOException {
- final Iterator<ClassFile> iter = new DirectoryIterator();
- return new Iterable<ClassFile>() {
- public Iterator<ClassFile> iterator() {
- return iter;
- }
- };
- }
-
- private List<Path> entries;
- protected synchronized List<Path> walkTree() throws IOException {
- if (entries == null) {
- entries = new ArrayList<>();
- Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
- public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
- throws IOException {
- if (file.getFileName().toString().endsWith(".class")) {
- entries.add(file);
- }
- return FileVisitResult.CONTINUE;
- }
- });
- }
- return entries;
- }
-
- class DirectoryIterator implements Iterator<ClassFile> {
- private List<Path> entries;
- private int index = 0;
- DirectoryIterator() throws IOException {
- entries = walkTree();
- index = 0;
- }
-
- public boolean hasNext() {
- return index != entries.size();
- }
-
- public ClassFile next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- }
- Path path = entries.get(index++);
- try {
- return readClassFile(path);
- } catch (IOException e) {
- throw new ClassFileError(e);
- }
- }
-
- public void remove() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
- }
- }
-
- static class JarFileReader extends ClassFileReader {
- private final JarFile jarfile;
- JarFileReader(Path path) throws IOException {
- this(path, new JarFile(path.toFile(), false));
- }
-
- JarFileReader(Path path, JarFile jf) throws IOException {
- super(path);
- this.jarfile = jf;
- }
-
- public ClassFile getClassFile(String name) throws IOException {
- if (name.indexOf('.') > 0) {
- int i = name.lastIndexOf('.');
- String entryName = name.replace('.', '/') + ".class";
- JarEntry e = jarfile.getJarEntry(entryName);
- if (e == null) {
- e = jarfile.getJarEntry(entryName.substring(0, i) + "$"
- + entryName.substring(i + 1, entryName.length()));
- }
- if (e != null) {
- return readClassFile(jarfile, e);
- }
- } else {
- JarEntry e = jarfile.getJarEntry(name + ".class");
- if (e != null) {
- return readClassFile(jarfile, e);
- }
- }
- return null;
- }
-
- protected ClassFile readClassFile(JarFile jarfile, JarEntry e) throws IOException {
- InputStream is = null;
- try {
- is = jarfile.getInputStream(e);
- return ClassFile.read(is);
- } catch (ConstantPoolException ex) {
- throw new ClassFileError(ex);
- } finally {
- if (is != null)
- is.close();
- }
- }
-
- public Iterable<ClassFile> getClassFiles() throws IOException {
- final Iterator<ClassFile> iter = new JarFileIterator(this, jarfile);
- return new Iterable<ClassFile>() {
- public Iterator<ClassFile> iterator() {
- return iter;
- }
- };
- }
- }
-
- class JarFileIterator implements Iterator<ClassFile> {
- protected final JarFileReader reader;
- protected Enumeration<JarEntry> entries;
- protected JarFile jf;
- protected JarEntry nextEntry;
- protected ClassFile cf;
- JarFileIterator(JarFileReader reader) {
- this(reader, null);
- }
- JarFileIterator(JarFileReader reader, JarFile jarfile) {
- this.reader = reader;
- setJarFile(jarfile);
- }
-
- void setJarFile(JarFile jarfile) {
- if (jarfile == null) return;
-
- this.jf = jarfile;
- this.entries = jf.entries();
- this.nextEntry = nextEntry();
- }
-
- public boolean hasNext() {
- if (nextEntry != null && cf != null) {
- return true;
- }
- while (nextEntry != null) {
- try {
- cf = reader.readClassFile(jf, nextEntry);
- return true;
- } catch (ClassFileError | IOException ex) {
- skippedEntries.add(nextEntry.getName());
- }
- nextEntry = nextEntry();
- }
- return false;
- }
-
- public ClassFile next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- }
- ClassFile classFile = cf;
- cf = null;
- nextEntry = nextEntry();
- return classFile;
- }
-
- protected JarEntry nextEntry() {
- while (entries.hasMoreElements()) {
- JarEntry e = entries.nextElement();
- String name = e.getName();
- if (name.endsWith(".class")) {
- return e;
- }
- }
- return null;
- }
-
- public void remove() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
- }
-
- /**
- * ClassFileReader for modules.
- */
- static class ModuleClassReader extends DirectoryReader {
- final String modulename;
- ModuleClassReader(FileSystem fs, String mn, Path root) throws IOException {
- super(fs, root);
- this.modulename = mn;
- }
-
- public Set<String> packages() throws IOException {
- return walkTree().stream()
- .map(this::toPackageName)
- .sorted()
- .collect(Collectors.toSet());
- }
-
- String toPackageName(Path p) {
- if (p.getParent() == null) {
- return "";
- }
- return path.relativize(p.getParent()).toString().replace(fsSep, ".");
- }
- }
-}
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/JdepsTask.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1099 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, 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.
- */
-package com.sun.tools.jdeps;
-
-import com.sun.tools.classfile.AccessFlags;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.Dependencies;
-import com.sun.tools.classfile.Dependencies.ClassFileError;
-import com.sun.tools.classfile.Dependency;
-import com.sun.tools.classfile.Dependency.Location;
-import static com.sun.tools.jdeps.Analyzer.Type.*;
-import java.io.*;
-import java.nio.file.DirectoryStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.text.MessageFormat;
-import java.util.*;
-import java.util.regex.Pattern;
-
-/**
- * Implementation for the jdeps tool for static class dependency analysis.
- */
-class JdepsTask {
- static class BadArgs extends Exception {
- static final long serialVersionUID = 8765093759964640721L;
- BadArgs(String key, Object... args) {
- super(JdepsTask.getMessage(key, args));
- this.key = key;
- this.args = args;
- }
-
- BadArgs showUsage(boolean b) {
- showUsage = b;
- return this;
- }
- final String key;
- final Object[] args;
- boolean showUsage;
- }
-
- static abstract class Option {
- Option(boolean hasArg, String... aliases) {
- this.hasArg = hasArg;
- this.aliases = aliases;
- }
-
- boolean isHidden() {
- return false;
- }
-
- boolean matches(String opt) {
- for (String a : aliases) {
- if (a.equals(opt))
- return true;
- if (hasArg && opt.startsWith(a + "="))
- return true;
- }
- return false;
- }
-
- boolean ignoreRest() {
- return false;
- }
-
- abstract void process(JdepsTask task, String opt, String arg) throws BadArgs;
- final boolean hasArg;
- final String[] aliases;
- }
-
- static abstract class HiddenOption extends Option {
- HiddenOption(boolean hasArg, String... aliases) {
- super(hasArg, aliases);
- }
-
- boolean isHidden() {
- return true;
- }
- }
-
- static Option[] recognizedOptions = {
- new Option(false, "-h", "-?", "-help") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.help = true;
- }
- },
- new Option(true, "-dotoutput") {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- Path p = Paths.get(arg);
- if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) {
- throw new BadArgs("err.invalid.path", arg);
- }
- task.options.dotOutputDir = arg;
- }
- },
- new Option(false, "-s", "-summary") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.showSummary = true;
- task.options.verbose = SUMMARY;
- }
- },
- new Option(false, "-v", "-verbose",
- "-verbose:package",
- "-verbose:class") {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- switch (opt) {
- case "-v":
- case "-verbose":
- task.options.verbose = VERBOSE;
- task.options.filterSameArchive = false;
- task.options.filterSamePackage = false;
- break;
- case "-verbose:package":
- task.options.verbose = PACKAGE;
- break;
- case "-verbose:class":
- task.options.verbose = CLASS;
- break;
- default:
- throw new BadArgs("err.invalid.arg.for.option", opt);
- }
- }
- },
- new Option(true, "-cp", "-classpath") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.classpath = arg;
- }
- },
- new Option(true, "-p", "-package") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.packageNames.add(arg);
- }
- },
- new Option(true, "-e", "-regex") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.regex = arg;
- }
- },
-
- new Option(true, "-f", "-filter") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.filterRegex = arg;
- }
- },
- new Option(false, "-filter:package",
- "-filter:archive",
- "-filter:none") {
- void process(JdepsTask task, String opt, String arg) {
- switch (opt) {
- case "-filter:package":
- task.options.filterSamePackage = true;
- task.options.filterSameArchive = false;
- break;
- case "-filter:archive":
- task.options.filterSameArchive = true;
- task.options.filterSamePackage = false;
- break;
- case "-filter:none":
- task.options.filterSameArchive = false;
- task.options.filterSamePackage = false;
- break;
- }
- }
- },
- new Option(true, "-include") {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- task.options.includePattern = Pattern.compile(arg);
- }
- },
- new Option(false, "-P", "-profile") {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- task.options.showProfile = true;
- task.options.showModule = false;
- }
- },
- new Option(false, "-M", "-module") {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- task.options.showModule = true;
- task.options.showProfile = false;
- }
- },
- new Option(false, "-apionly") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.apiOnly = true;
- }
- },
- new Option(false, "-R", "-recursive") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.depth = 0;
- // turn off filtering
- task.options.filterSameArchive = false;
- task.options.filterSamePackage = false;
- }
- },
- new Option(false, "-jdkinternals") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.findJDKInternals = true;
- task.options.verbose = CLASS;
- if (task.options.includePattern == null) {
- task.options.includePattern = Pattern.compile(".*");
- }
- }
- },
- new HiddenOption(false, "-verify:access") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.verifyAccess = true;
- task.options.verbose = VERBOSE;
- task.options.filterSameArchive = false;
- task.options.filterSamePackage = false;
- }
- },
- new HiddenOption(true, "-mp") {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- task.options.mpath = Paths.get(arg);
- if (!Files.isDirectory(task.options.mpath)) {
- throw new BadArgs("err.invalid.path", arg);
- }
- if (task.options.includePattern == null) {
- task.options.includePattern = Pattern.compile(".*");
- }
- }
- },
- new Option(false, "-version") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.version = true;
- }
- },
- new HiddenOption(false, "-fullversion") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.fullVersion = true;
- }
- },
- new HiddenOption(false, "-showlabel") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.showLabel = true;
- }
- },
- new HiddenOption(false, "-q", "-quiet") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.nowarning = true;
- }
- },
- new HiddenOption(true, "-depth") {
- void process(JdepsTask task, String opt, String arg) throws BadArgs {
- try {
- task.options.depth = Integer.parseInt(arg);
- } catch (NumberFormatException e) {
- throw new BadArgs("err.invalid.arg.for.option", opt);
- }
- }
- },
- };
-
- private static final String PROGNAME = "jdeps";
- private final Options options = new Options();
- private final List<String> classes = new ArrayList<>();
-
- private PrintWriter log;
- void setLog(PrintWriter out) {
- log = out;
- }
-
- /**
- * Result codes.
- */
- static final int EXIT_OK = 0, // Completed with no errors.
- EXIT_ERROR = 1, // Completed but reported errors.
- EXIT_CMDERR = 2, // Bad command-line arguments
- EXIT_SYSERR = 3, // System error or resource exhaustion.
- EXIT_ABNORMAL = 4;// terminated abnormally
-
- int run(String[] args) {
- if (log == null) {
- log = new PrintWriter(System.out);
- }
- try {
- handleOptions(args);
- if (options.help) {
- showHelp();
- }
- if (options.version || options.fullVersion) {
- showVersion(options.fullVersion);
- }
- if (classes.isEmpty() && options.includePattern == null) {
- if (options.help || options.version || options.fullVersion) {
- return EXIT_OK;
- } else {
- showHelp();
- return EXIT_CMDERR;
- }
- }
- if (options.regex != null && options.packageNames.size() > 0) {
- showHelp();
- return EXIT_CMDERR;
- }
- if ((options.findJDKInternals || options.verifyAccess) &&
- (options.regex != null || options.packageNames.size() > 0 || options.showSummary)) {
- showHelp();
- return EXIT_CMDERR;
- }
- if (options.showSummary && options.verbose != SUMMARY) {
- showHelp();
- return EXIT_CMDERR;
- }
-
- boolean ok = run();
- return ok ? EXIT_OK : EXIT_ERROR;
- } catch (BadArgs e) {
- reportError(e.key, e.args);
- if (e.showUsage) {
- log.println(getMessage("main.usage.summary", PROGNAME));
- }
- return EXIT_CMDERR;
- } catch (IOException e) {
- return EXIT_ABNORMAL;
- } finally {
- log.flush();
- }
- }
-
- private final List<Archive> sourceLocations = new ArrayList<>();
- private final List<Archive> classpaths = new ArrayList<>();
- private final List<Archive> initialArchives = new ArrayList<>();
- private boolean run() throws IOException {
- buildArchives();
-
- if (options.verifyAccess) {
- return verifyModuleAccess();
- } else {
- return analyzeDeps();
- }
- }
-
- private boolean analyzeDeps() throws IOException {
- Analyzer analyzer = new Analyzer(options.verbose, new Analyzer.Filter() {
- @Override
- public boolean accepts(Location origin, Archive originArchive,
- Location target, Archive targetArchive)
- {
- if (options.findJDKInternals) {
- // accepts target that is JDK class but not exported
- return isJDKModule(targetArchive) &&
- !((Module) targetArchive).isExported(target.getClassName());
- } else if (options.filterSameArchive) {
- // accepts origin and target that from different archive
- return originArchive != targetArchive;
- }
- return true;
- }
- });
-
- // parse classfiles and find all dependencies
- findDependencies(options.apiOnly);
-
- // analyze the dependencies
- analyzer.run(sourceLocations);
-
- // output result
- if (options.dotOutputDir != null) {
- Path dir = Paths.get(options.dotOutputDir);
- Files.createDirectories(dir);
- generateDotFiles(dir, analyzer);
- } else {
- printRawOutput(log, analyzer);
- }
-
- if (options.findJDKInternals && !options.nowarning) {
- showReplacements(analyzer);
- }
- return true;
- }
-
- private boolean verifyModuleAccess() throws IOException {
- // two passes
- // 1. check API dependences where the types of dependences must be re-exported
- // 2. check all dependences where types must be accessible
-
- // pass 1
- findDependencies(true /* api only */);
- Analyzer analyzer = Analyzer.getExportedAPIsAnalyzer();
- boolean pass1 = analyzer.run(sourceLocations);
- if (!pass1) {
- System.out.println("ERROR: Failed API access verification");
- }
- // pass 2
- findDependencies(false);
- analyzer = Analyzer.getModuleAccessAnalyzer();
- boolean pass2 = analyzer.run(sourceLocations);
- if (!pass2) {
- System.out.println("ERROR: Failed module access verification");
- }
- if (pass1 & pass2) {
- System.out.println("Access verification succeeded.");
- }
- return pass1 & pass2;
- }
-
- private void generateSummaryDotFile(Path dir, Analyzer analyzer) throws IOException {
- // If verbose mode (-v or -verbose option),
- // the summary.dot file shows package-level dependencies.
- Analyzer.Type summaryType =
- (options.verbose == PACKAGE || options.verbose == SUMMARY) ? SUMMARY : PACKAGE;
- Path summary = dir.resolve("summary.dot");
- try (PrintWriter sw = new PrintWriter(Files.newOutputStream(summary));
- SummaryDotFile dotfile = new SummaryDotFile(sw, summaryType)) {
- for (Archive archive : sourceLocations) {
- if (!archive.isEmpty()) {
- if (options.verbose == PACKAGE || options.verbose == SUMMARY) {
- if (options.showLabel) {
- // build labels listing package-level dependencies
- analyzer.visitDependences(archive, dotfile.labelBuilder(), PACKAGE);
- }
- }
- analyzer.visitDependences(archive, dotfile, summaryType);
- }
- }
- }
- }
-
- private void generateDotFiles(Path dir, Analyzer analyzer) throws IOException {
- // output individual .dot file for each archive
- if (options.verbose != SUMMARY) {
- for (Archive archive : sourceLocations) {
- if (analyzer.hasDependences(archive)) {
- Path dotfile = dir.resolve(archive.getName() + ".dot");
- try (PrintWriter pw = new PrintWriter(Files.newOutputStream(dotfile));
- DotFileFormatter formatter = new DotFileFormatter(pw, archive)) {
- analyzer.visitDependences(archive, formatter);
- }
- }
- }
- }
- // generate summary dot file
- generateSummaryDotFile(dir, analyzer);
- }
-
- private void printRawOutput(PrintWriter writer, Analyzer analyzer) {
- RawOutputFormatter depFormatter = new RawOutputFormatter(writer);
- RawSummaryFormatter summaryFormatter = new RawSummaryFormatter(writer);
- for (Archive archive : sourceLocations) {
- if (!archive.isEmpty()) {
- analyzer.visitDependences(archive, summaryFormatter, SUMMARY);
- if (analyzer.hasDependences(archive) && options.verbose != SUMMARY) {
- analyzer.visitDependences(archive, depFormatter);
- }
- }
- }
- }
-
- private boolean isValidClassName(String name) {
- if (!Character.isJavaIdentifierStart(name.charAt(0))) {
- return false;
- }
- for (int i=1; i < name.length(); i++) {
- char c = name.charAt(i);
- if (c != '.' && !Character.isJavaIdentifierPart(c)) {
- return false;
- }
- }
- return true;
- }
-
- /*
- * Dep Filter configured based on the input jdeps option
- * 1. -p and -regex to match target dependencies
- * 2. -filter:package to filter out same-package dependencies
- *
- * This filter is applied when jdeps parses the class files
- * and filtered dependencies are not stored in the Analyzer.
- *
- * -filter:archive is applied later in the Analyzer as the
- * containing archive of a target class may not be known until
- * the entire archive
- */
- class DependencyFilter implements Dependency.Filter {
- final Dependency.Filter filter;
- final Pattern filterPattern;
- DependencyFilter() {
- if (options.regex != null) {
- this.filter = Dependencies.getRegexFilter(Pattern.compile(options.regex));
- } else if (options.packageNames.size() > 0) {
- this.filter = Dependencies.getPackageFilter(options.packageNames, false);
- } else {
- this.filter = null;
- }
-
- this.filterPattern =
- options.filterRegex != null ? Pattern.compile(options.filterRegex) : null;
- }
- @Override
- public boolean accepts(Dependency d) {
- if (d.getOrigin().equals(d.getTarget())) {
- return false;
- }
- String pn = d.getTarget().getPackageName();
- if (options.filterSamePackage && d.getOrigin().getPackageName().equals(pn)) {
- return false;
- }
-
- if (filterPattern != null && filterPattern.matcher(pn).matches()) {
- return false;
- }
- return filter != null ? filter.accepts(d) : true;
- }
- }
-
- /**
- * Tests if the given class matches the pattern given in the -include option
- */
- private boolean matches(String classname) {
- if (options.includePattern != null) {
- return options.includePattern.matcher(classname.replace('/', '.')).matches();
- } else {
- return true;
- }
- }
-
- private void buildArchives() throws IOException {
- for (String s : classes) {
- Path p = Paths.get(s);
- if (Files.exists(p)) {
- initialArchives.add(Archive.getInstance(p));
- }
- }
- sourceLocations.addAll(initialArchives);
-
- classpaths.addAll(getClassPathArchives(options.classpath));
- if (options.includePattern != null) {
- initialArchives.addAll(classpaths);
- }
- classpaths.addAll(PlatformClassPath.getModules(options.mpath));
- if (options.mpath != null) {
- initialArchives.addAll(PlatformClassPath.getModules(options.mpath));
- } else {
- classpaths.addAll(PlatformClassPath.getJarFiles());
- }
- // add all classpath archives to the source locations for reporting
- sourceLocations.addAll(classpaths);
- }
-
- private void findDependencies(boolean apiOnly) throws IOException {
- Dependency.Finder finder =
- apiOnly ? Dependencies.getAPIFinder(AccessFlags.ACC_PROTECTED)
- : Dependencies.getClassDependencyFinder();
- Dependency.Filter filter = new DependencyFilter();
-
- Deque<String> roots = new LinkedList<>();
- for (String s : classes) {
- Path p = Paths.get(s);
- if (!Files.exists(p)) {
- if (isValidClassName(s)) {
- roots.add(s);
- } else {
- warning("warn.invalid.arg", s);
- }
- }
- }
-
- // 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.
- Deque<String> deque = new LinkedList<>();
- Set<String> doneClasses = new HashSet<>();
-
- // get the immediate dependencies of the input files
- for (Archive a : initialArchives) {
- for (ClassFile cf : a.reader().getClassFiles()) {
- String classFileName;
- try {
- classFileName = cf.getName();
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- }
-
- // tests if this class matches the -include or -apiOnly option if specified
- if (!matches(classFileName) || (apiOnly && !cf.access_flags.is(AccessFlags.ACC_PUBLIC))) {
- continue;
- }
-
- if (!doneClasses.contains(classFileName)) {
- doneClasses.add(classFileName);
- }
-
- for (Dependency d : finder.findDependencies(cf)) {
- if (filter.accepts(d)) {
- String cn = d.getTarget().getName();
- if (!doneClasses.contains(cn) && !deque.contains(cn)) {
- deque.add(cn);
- }
- a.addClass(d.getOrigin(), d.getTarget());
- } else {
- // ensure that the parsed class is added the archive
- a.addClass(d.getOrigin());
- }
- }
- for (String name : a.reader().skippedEntries()) {
- warning("warn.skipped.entry", name, a.getPathName());
- }
- }
- }
-
- // add Archive for looking up classes from the classpath
- // for transitive dependency analysis
- Deque<String> unresolved = roots;
- int depth = options.depth > 0 ? options.depth : Integer.MAX_VALUE;
- do {
- String name;
- while ((name = unresolved.poll()) != null) {
- if (doneClasses.contains(name)) {
- continue;
- }
- ClassFile cf = null;
- for (Archive a : classpaths) {
- cf = a.reader().getClassFile(name);
- if (cf != null) {
- String classFileName;
- try {
- classFileName = cf.getName();
- } catch (ConstantPoolException e) {
- throw new ClassFileError(e);
- }
- if (!doneClasses.contains(classFileName)) {
- // if name is a fully-qualified class name specified
- // from command-line, this class might already be parsed
- doneClasses.add(classFileName);
-
- for (Dependency d : finder.findDependencies(cf)) {
- if (depth == 0) {
- // ignore the dependency
- a.addClass(d.getOrigin());
- break;
- } else if (filter.accepts(d)) {
- a.addClass(d.getOrigin(), d.getTarget());
- String cn = d.getTarget().getName();
- if (!doneClasses.contains(cn) && !deque.contains(cn)) {
- deque.add(cn);
- }
- } else {
- // ensure that the parsed class is added the archive
- a.addClass(d.getOrigin());
- }
- }
- }
- break;
- }
- }
- if (cf == null) {
- doneClasses.add(name);
- }
- }
- unresolved = deque;
- deque = new LinkedList<>();
- } while (!unresolved.isEmpty() && depth-- > 0);
- }
-
- public void handleOptions(String[] args) throws BadArgs {
- // process options
- for (int i=0; i < args.length; i++) {
- if (args[i].charAt(0) == '-') {
- String name = args[i];
- Option option = getOption(name);
- String param = null;
- if (option.hasArg) {
- if (name.startsWith("-") && name.indexOf('=') > 0) {
- param = name.substring(name.indexOf('=') + 1, name.length());
- } else if (i + 1 < args.length) {
- param = args[++i];
- }
- if (param == null || param.isEmpty() || param.charAt(0) == '-') {
- throw new BadArgs("err.missing.arg", name).showUsage(true);
- }
- }
- option.process(this, name, param);
- if (option.ignoreRest()) {
- i = args.length;
- }
- } else {
- // process rest of the input arguments
- for (; i < args.length; i++) {
- String name = args[i];
- if (name.charAt(0) == '-') {
- throw new BadArgs("err.option.after.class", name).showUsage(true);
- }
- classes.add(name);
- }
- }
- }
- }
-
- private Option getOption(String name) throws BadArgs {
- for (Option o : recognizedOptions) {
- if (o.matches(name)) {
- return o;
- }
- }
- throw new BadArgs("err.unknown.option", name).showUsage(true);
- }
-
- private void reportError(String key, Object... args) {
- log.println(getMessage("error.prefix") + " " + getMessage(key, args));
- }
-
- private void warning(String key, Object... args) {
- log.println(getMessage("warn.prefix") + " " + getMessage(key, args));
- }
-
- private void showHelp() {
- log.println(getMessage("main.usage", PROGNAME));
- for (Option o : recognizedOptions) {
- String name = o.aliases[0].substring(1); // there must always be at least one name
- name = name.charAt(0) == '-' ? name.substring(1) : name;
- if (o.isHidden() || name.equals("h") || name.startsWith("filter:")) {
- continue;
- }
- log.println(getMessage("main.opt." + name));
- }
- }
-
- private void showVersion(boolean full) {
- log.println(version(full ? "full" : "release"));
- }
-
- private String version(String key) {
- // key=version: mm.nn.oo[-milestone]
- // key=full: mm.mm.oo[-milestone]-build
- if (ResourceBundleHelper.versionRB == null) {
- return System.getProperty("java.version");
- }
- try {
- return ResourceBundleHelper.versionRB.getString(key);
- } catch (MissingResourceException e) {
- return getMessage("version.unknown", System.getProperty("java.version"));
- }
- }
-
- static String getMessage(String key, Object... args) {
- try {
- return MessageFormat.format(ResourceBundleHelper.bundle.getString(key), args);
- } catch (MissingResourceException e) {
- throw new InternalError("Missing message: " + key);
- }
- }
-
- private static class Options {
- boolean help;
- boolean version;
- boolean fullVersion;
- boolean showProfile;
- boolean showModule;
- boolean showSummary;
- boolean apiOnly;
- boolean showLabel;
- boolean findJDKInternals;
- boolean nowarning;
- // default is to show package-level dependencies
- // and filter references from same package
- Analyzer.Type verbose = PACKAGE;
- boolean filterSamePackage = true;
- boolean filterSameArchive = false;
- String filterRegex;
- String dotOutputDir;
- String classpath = "";
- int depth = 1;
- Set<String> packageNames = new HashSet<>();
- String regex; // apply to the dependences
- Pattern includePattern; // apply to classes
- // module boundary access check
- boolean verifyAccess;
- Path mpath;
- }
- private static class ResourceBundleHelper {
- static final ResourceBundle versionRB;
- static final ResourceBundle bundle;
- static final ResourceBundle jdkinternals;
-
- static {
- Locale locale = Locale.getDefault();
- try {
- bundle = ResourceBundle.getBundle("com.sun.tools.jdeps.resources.jdeps", locale);
- } catch (MissingResourceException e) {
- throw new InternalError("Cannot find jdeps resource bundle for locale " + locale);
- }
- try {
- versionRB = ResourceBundle.getBundle("com.sun.tools.jdeps.resources.version");
- } catch (MissingResourceException e) {
- throw new InternalError("version.resource.missing");
- }
- try {
- jdkinternals = ResourceBundle.getBundle("com.sun.tools.jdeps.resources.jdkinternals");
- } catch (MissingResourceException e) {
- throw new InternalError("Cannot find jdkinternals resource bundle");
- }
- }
- }
-
- /*
- * Returns the list of Archive specified in cpaths and not included
- * initialArchives
- */
- private List<Archive> getClassPathArchives(String cpaths)
- throws IOException
- {
- List<Archive> result = new ArrayList<>();
- if (cpaths.isEmpty()) {
- return result;
- }
- List<Path> paths = new ArrayList<>();
- for (String p : cpaths.split(File.pathSeparator)) {
- if (p.length() > 0) {
- // wildcard to parse all JAR files e.g. -classpath dir/*
- int i = p.lastIndexOf(".*");
- if (i > 0) {
- Path dir = Paths.get(p.substring(0, i));
- try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "*.jar")) {
- for (Path entry : stream) {
- paths.add(entry);
- }
- }
- } else {
- paths.add(Paths.get(p));
- }
- }
- }
- for (Path path : paths) {
- boolean found = initialArchives.stream()
- .map(Archive::path)
- .anyMatch(p -> isSameFile(path, p));
- if (!found && Files.exists(path)) {
- result.add(Archive.getInstance(path));
- }
- }
- return result;
- }
-
- private boolean isSameFile(Path p1, Path p2) {
- try {
- return Files.isSameFile(p1, p2);
- } catch (IOException e) {
- throw new UncheckedIOException(e);
- }
- }
-
- class RawOutputFormatter implements Analyzer.Visitor {
- private final PrintWriter writer;
- private String pkg = "";
- RawOutputFormatter(PrintWriter writer) {
- this.writer = writer;
- }
- @Override
- public void visitDependence(String origin, Archive originArchive,
- String target, Archive targetArchive) {
- String tag = toTag(target, targetArchive);
- if (options.verbose == VERBOSE) {
- writer.format(" %-50s -> %-50s %s%n", origin, target, tag);
- } else {
- if (!origin.equals(pkg)) {
- pkg = origin;
- writer.format(" %s (%s)%n", origin, originArchive.getName());
- }
- writer.format(" -> %-50s %s%n", target, tag);
- }
- }
- }
-
- class RawSummaryFormatter implements Analyzer.Visitor {
- private final PrintWriter writer;
- RawSummaryFormatter(PrintWriter writer) {
- this.writer = writer;
- }
- @Override
- public void visitDependence(String origin, Archive originArchive,
- String target, Archive targetArchive) {
- String targetName = targetArchive.getPathName();
- if (options.showModule && isJDKModule(targetArchive)) {
- targetName = ((Module)targetArchive).name();
- }
- writer.format("%s -> %s", originArchive.getName(), targetName);
- if (options.showProfile && isJDKModule(targetArchive)) {
- writer.format(" (%s)", target);
- }
- writer.format("%n");
- }
- }
-
- class DotFileFormatter implements Analyzer.Visitor, AutoCloseable {
- private final PrintWriter writer;
- private final String name;
- DotFileFormatter(PrintWriter writer, Archive archive) {
- this.writer = writer;
- this.name = archive.getName();
- writer.format("digraph \"%s\" {%n", name);
- writer.format(" // Path: %s%n", archive.getPathName());
- }
-
- @Override
- public void close() {
- writer.println("}");
- }
-
- @Override
- public void visitDependence(String origin, Archive originArchive,
- String target, Archive targetArchive) {
- String tag = toTag(target, targetArchive);
- writer.format(" %-50s -> \"%s\";%n",
- String.format("\"%s\"", origin),
- tag.isEmpty() ? target
- : String.format("%s (%s)", target, tag));
- }
- }
-
- class SummaryDotFile implements Analyzer.Visitor, AutoCloseable {
- private final PrintWriter writer;
- private final Analyzer.Type type;
- private final Map<Archive, Map<Archive,StringBuilder>> edges = new HashMap<>();
- SummaryDotFile(PrintWriter writer, Analyzer.Type type) {
- this.writer = writer;
- this.type = type;
- writer.format("digraph \"summary\" {%n");
- }
-
- @Override
- public void close() {
- writer.println("}");
- }
-
- @Override
- public void visitDependence(String origin, Archive originArchive,
- String target, Archive targetArchive) {
- String targetName = type == PACKAGE ? target : targetArchive.getName();
- if (isJDKModule(targetArchive)) {
- Module m = (Module)targetArchive;
- String n = showProfileOrModule(m);
- if (!n.isEmpty()) {
- targetName += " (" + n + ")";
- }
- } else if (type == PACKAGE) {
- targetName += " (" + targetArchive.getName() + ")";
- }
- String label = getLabel(originArchive, targetArchive);
- writer.format(" %-50s -> \"%s\"%s;%n",
- String.format("\"%s\"", origin), targetName, label);
- }
-
- String getLabel(Archive origin, Archive target) {
- if (edges.isEmpty())
- return "";
-
- StringBuilder label = edges.get(origin).get(target);
- return label == null ? "" : String.format(" [label=\"%s\",fontsize=9]", label.toString());
- }
-
- Analyzer.Visitor labelBuilder() {
- // show the package-level dependencies as labels in the dot graph
- return new Analyzer.Visitor() {
- @Override
- public void visitDependence(String origin, Archive originArchive, String target, Archive targetArchive) {
- edges.putIfAbsent(originArchive, new HashMap<>());
- edges.get(originArchive).putIfAbsent(targetArchive, new StringBuilder());
- StringBuilder sb = edges.get(originArchive).get(targetArchive);
- String tag = toTag(target, targetArchive);
- addLabel(sb, origin, target, tag);
- }
-
- void addLabel(StringBuilder label, String origin, String target, String tag) {
- label.append(origin).append(" -> ").append(target);
- if (!tag.isEmpty()) {
- label.append(" (" + tag + ")");
- }
- label.append("\\n");
- }
- };
- }
- }
-
- /**
- * Test if the given archive is part of the JDK
- */
- private boolean isJDKModule(Archive archive) {
- return Module.class.isInstance(archive);
- }
-
- /**
- * If the given archive is JDK archive, this method returns the profile name
- * only if -profile option is specified; it accesses a private JDK API and
- * the returned value will have "JDK internal API" prefix
- *
- * For non-JDK archives, this method returns the file name of the archive.
- */
- private String toTag(String name, Archive source) {
- if (!isJDKModule(source)) {
- return source.getName();
- }
-
- Module module = (Module)source;
- boolean isExported = false;
- if (options.verbose == CLASS || options.verbose == VERBOSE) {
- isExported = module.isExported(name);
- } else {
- isExported = module.isExportedPackage(name);
- }
- if (isExported) {
- // exported API
- return showProfileOrModule(module);
- } else {
- return "JDK internal API (" + source.getName() + ")";
- }
- }
-
- private String showProfileOrModule(Module m) {
- String tag = "";
- if (options.showProfile) {
- Profile p = Profile.getProfile(m);
- if (p != null) {
- tag = p.profileName();
- }
- } else if (options.showModule) {
- tag = m.name();
- }
- return tag;
- }
-
- private Profile getProfile(String name) {
- String pn = name;
- if (options.verbose == CLASS || options.verbose == VERBOSE) {
- int i = name.lastIndexOf('.');
- pn = i > 0 ? name.substring(0, i) : "";
- }
- return Profile.getProfile(pn);
- }
-
- /**
- * Returns the recommended replacement API for the given classname;
- * or return null if replacement API is not known.
- */
- private String replacementFor(String cn) {
- String name = cn;
- String value = null;
- while (value == null && name != null) {
- try {
- value = ResourceBundleHelper.jdkinternals.getString(name);
- } catch (MissingResourceException e) {
- // go up one subpackage level
- int i = name.lastIndexOf('.');
- name = i > 0 ? name.substring(0, i) : null;
- }
- }
- return value;
- };
-
- private void showReplacements(Analyzer analyzer) {
- Map<String,String> jdkinternals = new TreeMap<>();
- boolean useInternals = false;
- for (Archive source : sourceLocations) {
- useInternals = useInternals || analyzer.hasDependences(source);
- for (String cn : analyzer.dependences(source)) {
- String repl = replacementFor(cn);
- if (repl != null) {
- jdkinternals.putIfAbsent(cn, repl);
- }
- }
- }
- if (useInternals) {
- log.println();
- warning("warn.replace.useJDKInternals", getMessage("jdeps.wiki.url"));
- }
- if (!jdkinternals.isEmpty()) {
- log.println();
- log.format("%-40s %s%n", "JDK Internal API", "Suggested Replacement");
- log.format("%-40s %s%n", "----------------", "---------------------");
- for (Map.Entry<String,String> e : jdkinternals.entrySet()) {
- log.format("%-40s %s%n", e.getKey(), e.getValue());
- }
- }
-
- }
-}
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Main.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, 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.
- */
-
-package com.sun.tools.jdeps;
-
-import java.io.*;
-
-/**
- *
- * Usage:
- * jdeps [options] files ...
- * where options include:
- * -p package-name restrict analysis to classes in this package
- * (may be given multiple times)
- * -e regex restrict analysis to packages matching pattern
- * (-p and -e are exclusive)
- * -v show class-level dependencies
- * default: package-level dependencies
- * -r --recursive transitive dependencies analysis
- * -classpath paths Classpath to locate class files
- * -all process all class files in the given classpath
- */
-public class Main {
- public static void main(String... args) throws Exception {
- JdepsTask t = new JdepsTask();
- int rc = t.run(args);
- System.exit(rc);
- }
-
-
- /**
- * Entry point that does <i>not</i> call System.exit.
- *
- * @param args command line arguments
- * @param out output stream
- * @return an exit code. 0 means success, non-zero means an error occurred.
- */
- public static int run(String[] args, PrintWriter out) {
- JdepsTask t = new JdepsTask();
- t.setLog(out);
- return t.run(args);
- }
-}
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Module.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-package com.sun.tools.jdeps;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * JDeps internal representation of module for dependency analysis.
- */
-final class Module extends Archive {
- private final String moduleName;
- private final Map<String, Boolean> requires;
- private final Map<String, Set<String>> exports;
- private final Set<String> packages;
-
- private Module(ClassFileReader reader, String name,
- Map<String, Boolean> requires,
- Map<String, Set<String>> exports,
- Set<String> packages) {
- super(name, reader);
- this.moduleName = name;
- this.requires = Collections.unmodifiableMap(requires);
- this.exports = Collections.unmodifiableMap(exports);
- this.packages = Collections.unmodifiableSet(packages);
- }
-
- public String name() {
- return moduleName;
- }
-
- public Map<String, Boolean> requires() {
- return requires;
- }
-
- public Map<String, Set<String>> exports() {
- return exports;
- }
-
- public Set<String> packages() {
- return packages;
- }
-
- /**
- * Tests if this module can read m
- */
- public boolean canRead(Module m) {
- // ## TODO: handle "re-exported=true"
- // all JDK modules require all modules containing its direct dependences
- // should not be an issue
- return requires.containsKey(m.name());
- }
-
- /**
- * Tests if a given fully-qualified name is an exported type.
- */
- public boolean isExported(String cn) {
- int i = cn.lastIndexOf('.');
- String pn = i > 0 ? cn.substring(0, i) : "";
-
- return isExportedPackage(pn);
- }
-
- /**
- * Tests if a given package name is exported.
- */
- public boolean isExportedPackage(String pn) {
- return exports.containsKey(pn) ? exports.get(pn).isEmpty() : false;
- }
-
- /**
- * Tests if the given classname is accessible to module m
- */
- public boolean isAccessibleTo(String classname, Module m) {
- int i = classname.lastIndexOf('.');
- String pn = i > 0 ? classname.substring(0, i) : "";
- if (!packages.contains(pn)) {
- throw new IllegalArgumentException(classname + " is not a member of module " + name());
- }
-
- if (m != null && !m.canRead(this)) {
- trace("%s not readable by %s%n", this.name(), m.name());
- return false;
- }
-
- // exported API
- Set<String> ms = exports().get(pn);
- String mname = m != null ? m.name() : "unnamed";
- if (ms == null) {
- trace("%s not exported in %s%n", classname, this.name());
- } else if (!(ms.isEmpty() || ms.contains(mname))) {
- trace("%s not permit to %s %s%n", classname, mname, ms);
- }
- return ms != null && (ms.isEmpty() || ms.contains(mname));
- }
-
- private static final boolean traceOn = Boolean.getBoolean("jdeps.debug");
- private void trace(String fmt, Object... args) {
- if (traceOn) {
- System.err.format(fmt, args);
- }
- }
-
- @Override
- public boolean equals(Object ob) {
- if (!(ob instanceof Module))
- return false;
- Module that = (Module)ob;
- return (moduleName.equals(that.moduleName)
- && requires.equals(that.requires)
- && exports.equals(that.exports)
- && packages.equals(that.packages));
- }
-
- @Override
- public int hashCode() {
- int hc = moduleName.hashCode();
- hc = hc * 43 + requires.hashCode();
- hc = hc * 43 + exports.hashCode();
- hc = hc * 43 + packages.hashCode();
- return hc;
- }
-
- @Override
- public String toString() {
- return name();
- }
-
- public final static class Builder {
- String name;
- ClassFileReader reader;
- final Map<String, Boolean> requires = new HashMap<>();
- final Map<String, Set<String>> exports = new HashMap<>();
- final Set<String> packages = new HashSet<>();
-
- public Builder() {
- }
-
- public Builder name(String n) {
- name = n;
- return this;
- }
-
- public Builder require(String d, boolean reexport) {
- // System.err.format("%s depend %s reexports %s%n", name, d, reexport);
- requires.put(d, reexport);
- return this;
- }
-
- public Builder packages(Set<String> pkgs) {
- packages.addAll(pkgs);
- return this;
- }
-
- public Builder export(String p, Set<String> ms) {
- Objects.requireNonNull(p);
- Objects.requireNonNull(ms);
- exports.put(p, new HashSet<>(ms));
- return this;
- }
- public Builder classes(ClassFileReader.ModuleClassReader reader) {
- this.reader = reader;
- return this;
- }
-
- public Module build() {
- Module m = new Module(reader, name, requires, exports, packages);
- return m;
- }
- }
-}
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/ModulesXmlReader.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-package com.sun.tools.jdeps;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashSet;
-import java.util.Set;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.XMLEvent;
-import com.sun.tools.jdeps.ClassFileReader.ModuleClassReader;
-import com.sun.tools.jdeps.PlatformClassPath.ImageHelper;
-
-final class ModulesXmlReader {
- public static Set<Module> load(ImageHelper helper,InputStream in)
- throws IOException
- {
- try {
- ModulesXmlReader reader = new ModulesXmlReader(helper);
- return reader.load(in);
- } catch (XMLStreamException e) {
- throw new RuntimeException(e);
- }
- }
-
- private static final String MODULES = "modules";
- private static final String MODULE = "module";
- private static final String NAME = "name";
- private static final String DEPEND = "depend";
- private static final String EXPORT = "export";
- private static final String TO = "to";
- private static final QName REEXPORTS = new QName("re-exports");
- private final ImageHelper helper;
- ModulesXmlReader(ImageHelper helper) {
- this.helper = helper;
- }
-
- public Set<Module> load(InputStream in) throws XMLStreamException, IOException {
- Set<Module> modules = new HashSet<>();
- if (in == null) {
- throw new RuntimeException("jdeps-modules.xml doesn't exist");
- }
- XMLInputFactory factory = XMLInputFactory.newInstance();
- XMLEventReader reader = factory.createXMLEventReader(in, "UTF-8");
- Module.Builder mb = null;
- String modulename = null;
- String exportedPackage = null;
- Set<String> permits = new HashSet<>();
- while (reader.hasNext()) {
- XMLEvent event = reader.nextEvent();
- if (event.isStartElement()) {
- String startTag = event.asStartElement().getName().getLocalPart();
- switch (startTag) {
- case MODULES:
- break;
- case MODULE:
- if (mb != null) {
- throw new RuntimeException("end tag for module is missing");
- }
- modulename = getNextTag(reader, NAME);
- mb = new Module.Builder();
- mb.name(modulename);
- break;
- case NAME:
- throw new RuntimeException(event.toString());
- case DEPEND:
- boolean reexports = false;
- Attribute attr = event.asStartElement().getAttributeByName(REEXPORTS);
- if (attr != null) {
- String value = attr.getValue();
- if (value.equals("true") || value.equals("false")) {
- reexports = Boolean.parseBoolean(value);
- } else {
- throw new RuntimeException("unexpected attribute " + attr.toString());
- }
- }
- mb.require(getData(reader), reexports);
- break;
- case EXPORT:
- exportedPackage = getNextTag(reader, NAME);
- break;
- case TO:
- permits.add(getData(reader));
- break;
- default:
- throw new RuntimeException("invalid element: " + event);
- }
- } else if (event.isEndElement()) {
- String endTag = event.asEndElement().getName().getLocalPart();
- switch (endTag) {
- case MODULE:
- ModuleClassReader cfr = helper.getModuleClassReader(modulename);
- mb.classes(cfr);
- mb.packages(cfr.packages());
- modules.add(mb.build());
- mb = null;
- break;
- case EXPORT:
- if (exportedPackage == null) {
- throw new RuntimeException("export's name is missing");
- }
- mb.export(exportedPackage, permits);
- exportedPackage = null;
- permits.clear();
- break;
- default:
- }
- } else if (event.isCharacters()) {
- String s = event.asCharacters().getData();
- if (!s.trim().isEmpty()) {
- throw new RuntimeException("export-to is malformed");
- }
- }
- }
- return modules;
- }
- private String getData(XMLEventReader reader) throws XMLStreamException {
- XMLEvent e = reader.nextEvent();
- if (e.isCharacters()) {
- return e.asCharacters().getData();
- }
- throw new RuntimeException(e.toString());
- }
-
- private String getNextTag(XMLEventReader reader, String tag) throws XMLStreamException {
- XMLEvent e = reader.nextTag();
- if (e.isStartElement()) {
- String t = e.asStartElement().getName().getLocalPart();
- if (!tag.equals(t)) {
- throw new RuntimeException(e + " expected: " + tag);
- }
- return getData(reader);
- }
- throw new RuntimeException("export-to name is missing:" + e);
- }
-}
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, 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.
- */
-package com.sun.tools.jdeps;
-
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.jdeps.ClassFileReader.ModuleClassReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.BufferedInputStream;
-import java.net.URI;
-import java.nio.file.*;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * ClassPath for Java SE and JDK
- */
-class PlatformClassPath {
- private static List<Archive> modules;
- static synchronized List<Archive> getModules(Path mpath) throws IOException {
- if (modules == null) {
- initPlatformModules(mpath);
- }
- return modules;
- }
-
- private static void initPlatformModules(Path mpath) throws IOException {
- ImageHelper helper = ImageHelper.getInstance(mpath);
- String fn = System.getProperty("jdeps.modules.xml");
- if (fn != null) {
- Path p = Paths.get(fn);
- try (InputStream in = new BufferedInputStream(Files.newInputStream(p))) {
- modules = new ArrayList<>(ModulesXmlReader.load(helper, in));
- }
- } else {
- try (InputStream in = PlatformClassPath.class
- .getResourceAsStream("resources/jdeps-modules.xml")) {
- modules = new ArrayList<>(ModulesXmlReader.load(helper, in));
- }
- }
- if (findModule("java.base") != null) {
- Profile.initProfiles(modules);
- }
- }
-
- /**
- * Finds the module with the given name. Returns null
- * if such module doesn't exist.
- *
- * @param mn module name
- */
- static Module findModule(String mn) {
- for (Archive a : modules) {
- if (Module.class.isInstance(a)) {
- Module m = (Module)a;
- if (mn.equals(m.name())) {
- return m;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns JAR files in $java.home/lib. This is for transition until
- * all components are linked into jimage.
- */
- static List<Archive> getJarFiles() throws IOException {
- Path home = Paths.get(System.getProperty("java.home"), "lib");
- return Files.find(home, 1, (Path p, BasicFileAttributes attr)
- -> p.getFileName().toString().endsWith(".jar"))
- .map(Archive::getInstance)
- .collect(Collectors.toList());
- }
-
- static class ImageHelper {
- static ImageHelper getInstance(Path mpath) throws IOException {
- if (mpath != null) {
- return new ImageHelper(mpath);
- }
- Path home = Paths.get(System.getProperty("java.home"));
- Path mlib = home.resolve("lib").resolve("modules");
- if (Files.isDirectory(mlib)) {
- // jimage
- FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
- return new ImageHelper(fs, fs.getPath("/"));
- } else {
- // exploded modules
- mlib = home.resolve("modules");
- if (!Files.isDirectory(mlib)) {
- throw new InternalError(home + " not a modular image");
- }
- return new ImageHelper(mlib);
- }
- }
-
- private final FileSystem fs;
- private final Path mpath;
-
- ImageHelper(Path path) throws IOException {
- this(FileSystems.getDefault(), path);
- }
-
- ImageHelper(FileSystem fs, Path path) throws IOException {
- this.fs = fs;
- this.mpath = path;
- }
-
- /**
- * Returns a ModuleClassReader that only reads classes for the given modulename.
- */
- public ModuleClassReader getModuleClassReader(String modulename)
- throws IOException
- {
- Path mp = mpath.resolve(modulename);
- if (Files.exists(mp) && Files.isDirectory(mp)) {
- return new ModuleClassReader(fs, modulename, mp);
- } else {
- // aggregator module or os-specific module in jdeps-modules.xml
- // mdir not exist
- return new NonExistModuleReader(fs, modulename, mp);
- }
- }
-
- static class NonExistModuleReader extends ModuleClassReader {
- private final List<ClassFile> classes = Collections.emptyList();
-
- private NonExistModuleReader(FileSystem fs, String mn, Path mpath)
- throws IOException
- {
- super(fs, mn, mpath);
- }
-
- public ClassFile getClassFile(String name) throws IOException {
- return null;
- }
-
- public Iterable<ClassFile> getClassFiles() throws IOException {
- return classes;
- }
-
- public Set<String> packages() {
- return Collections.emptySet();
- }
- }
- }
-}
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Profile.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, 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.
- */
-package com.sun.tools.jdeps;
-
-import java.io.IOException;
-import java.util.*;
-
-/**
- * Build the profile information.
- */
-enum Profile {
- COMPACT1("compact1", 1, "java.compact1"),
- COMPACT2("compact2", 2, "java.compact2"),
- COMPACT3("compact3", 3, "java.compact3", "java.smartcardio", "jdk.sctp",
- "jdk.httpserver", "jdk.security.auth",
- "jdk.naming.dns", "jdk.naming.rmi",
- "jdk.management"),
- FULL_JRE("Full JRE", 4, "java.se", "jdk.deploy.osx", "jdk.charsets",
- "jdk.crypto.ec", "jdk.crypto.pkcs11",
- "jdk.crypto.mscapi", "jdk.crypto.ucrypto", "jdk.jvmstat",
- "jdk.localedata", "jdk.scripting.nashorn", "jdk.zipfs");
-
- final String name;
- final int profile;
- final String[] mnames;
- final Set<Module> modules = new HashSet<>();
-
- Profile(String name, int profile, String... mnames) {
- this.name = name;
- this.profile = profile;
- this.mnames = mnames;
- }
-
- public String profileName() {
- return name;
- }
-
- @Override
- public String toString() {
- return mnames[0];
- }
-
- public static int getProfileCount() {
- return JDK.isEmpty() ? 0 : Profile.values().length;
- }
-
- /**
- * Returns the Profile for the given package name; null if not found.
- */
- public static Profile getProfile(String pn) {
- for (Profile p : Profile.values()) {
- for (Module m : p.modules) {
- if (m.packages().contains(pn)) {
- return p;
- }
- }
- }
- return null;
- }
-
- /*
- * Returns the Profile for a given Module; null if not found.
- */
- public static Profile getProfile(Module m) {
- for (Profile p : Profile.values()) {
- if (p.modules.contains(m)) {
- return p;
- }
- }
- return null;
- }
-
- private final static Set<Module> JDK = new HashSet<>();
- static void initProfiles(List<Archive> modules) {
- // add all modules into JDK
- modules.forEach(m -> JDK.add((Module)m));
-
- for (Profile p : Profile.values()) {
- for (String mn : p.mnames) {
- // this includes platform-dependent module that may not exist
- Module m = PlatformClassPath.findModule(mn);
- if (m != null) {
- p.addModule(m);
- }
- }
- }
- }
-
- private void addModule(Module m) {
- modules.add(m);
- for (String n : m.requires().keySet()) {
- Module d = PlatformClassPath.findModule(n);
- if (d == null) {
- throw new InternalError("module " + n + " required by " +
- m.name() + " doesn't exist");
- }
- modules.add(d);
- }
- }
- // for debugging
- public static void main(String[] args) throws IOException {
- // find platform modules
- PlatformClassPath.getModules(null);
- if (Profile.getProfileCount() == 0) {
- System.err.println("No profile is present in this JDK");
- }
- for (Profile p : Profile.values()) {
- String profileName = p.name;
- System.out.format("%2d: %-10s %s%n", p.profile, profileName, p.modules);
- for (Module m: p.modules) {
- System.out.format("module %s%n", m.name());
- System.out.format(" requires %s%n", m.requires());
- for (Map.Entry<String,Set<String>> e: m.exports().entrySet()) {
- System.out.format(" exports %s %s%n", e.getKey(),
- e.getValue().isEmpty() ? "" : "to " + e.getValue());
- }
- }
- }
- System.out.println("All JDK modules:-");
- JDK.stream().sorted(Comparator.comparing(Module::name))
- .forEach(m -> System.out.println(m));
- }
-}
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-main.usage.summary=\
-Usage: {0} <options> <classes...>\n\
-use -h, -? or -help for a list of possible options
-
-main.usage=\
-Usage: {0} <options> <classes...>\n\
-where <classes> can be a pathname to a .class file, a directory, a JAR file,\n\
-or a fully-qualified class name. Possible options include:
-
-error.prefix=Error:
-warn.prefix=Warning:
-
-main.opt.h=\
-\ -h -? -help Print this usage message
-
-main.opt.version=\
-\ -version Version information
-
-main.opt.v=\
-\ -v -verbose Print all class level dependencies\n\
-\ Equivalent to -verbose:class -filter:none.\n\
-\ -verbose:package Print package-level dependencies excluding\n\
-\ dependencies within the same package by default\n\
-\ -verbose:class Print class-level dependencies excluding\n\
-\ dependencies within the same package by default
-
-main.opt.f=\
-\ -f <regex> -filter <regex> Filter dependences matching the given pattern\n\
-\ If given multiple times, the last one will be used.\n\
-\ -filter:package Filter dependences within the same package (default)\n\
-\ -filter:archive Filter dependences within the same archive\n\
-\ -filter:none No -filter:package and -filter:archive filtering\n\
-\ Filtering specified via the -filter option still applies.
-
-main.opt.s=\
-\ -s -summary Print dependency summary only
-
-main.opt.p=\
-\ -p <pkgname> -package <pkgname> Finds dependences matching the given package name\n\
-\ (may be given multiple times)
-
-main.opt.e=\
-\ -e <regex> -regex <regex> Finds dependences matching the given pattern\n\
-\ (-p and -e are exclusive)
-
-main.opt.include=\
-\ -include <regex> Restrict analysis to classes matching pattern\n\
-\ This option filters the list of classes to\n\
-\ be analyzed. It can be used together with\n\
-\ -p and -e which apply pattern to the dependences
-
-main.opt.P=\
-\ -P -profile Show profile or the file containing a package
-
-main.opt.M=\
-\ -M -module Show module containing the package
-
-main.opt.cp=\
-\ -cp <path> -classpath <path> Specify where to find class files
-
-main.opt.R=\
-\ -R -recursive Recursively traverse all dependencies.\n\
-\ The -R option implies -filter:none. If -p, -e, -f\n\
-\ option is specified, only the matching dependences\n\
-\ are analyzed.
-
-main.opt.apionly=\
-\ -apionly Restrict analysis to APIs i.e. dependences\n\
-\ from the signature of public and protected\n\
-\ members of public classes including field\n\
-\ type, method parameter types, returned type,\n\
-\ checked exception types etc
-
-main.opt.dotoutput=\
-\ -dotoutput <dir> Destination directory for DOT file output
-
-main.opt.jdkinternals=\
-\ -jdkinternals Finds class-level dependences on JDK internal APIs.\n\
-\ By default, it analyzes all classes on -classpath\n\
-\ and input files unless -include option is specified.\n\
-\ This option cannot be used with -p, -e and -s options.\n\
-\ WARNING: JDK internal APIs may not be accessible in\n\
-\ the next release.
-
-main.opt.depth=\
-\ -depth=<depth> Specify the depth of the transitive\n\
-\ dependency analysis
-
-
-err.unknown.option=unknown option: {0}
-err.missing.arg=no value given for {0}
-err.invalid.arg.for.option=invalid argument for option: {0}
-err.option.after.class=option must be specified before classes: {0}
-err.option.unsupported={0} not supported: {1}
-err.profiles.msg=No profile information
-err.invalid.path=invalid path: {0}
-warn.invalid.arg=Invalid classname or pathname not exist: {0}
-warn.split.package=package {0} defined in {1} {2}
-warn.replace.useJDKInternals=\
-JDK internal APIs are unsupported and private to JDK implementation that are\n\
-subject to be removed or changed incompatibly and could break your application.\n\
-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}
-
-artifact.not.found=not found
-jdeps.wiki.url=https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/resources/jdeps_ja.properties Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-main.usage.summary=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes...>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u30EA\u30B9\u30C8\u306B\u3064\u3044\u3066\u306F\u3001-h\u3001-?\u307E\u305F\u306F--help\u3092\u4F7F\u7528\u3057\u307E\u3059
-
-main.usage=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes...>\n<classes>\u306B\u306F\u3001.class\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u540D\u3001\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001JAR\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u5B8C\u5168\u4FEE\u98FE\n\u30AF\u30E9\u30B9\u540D\u3092\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002\u4F7F\u7528\u3067\u304D\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:
-
-error.prefix=\u30A8\u30E9\u30FC:
-warn.prefix=\u8B66\u544A:
-
-main.opt.h=\ -h -? -help \u3053\u306E\u4F7F\u7528\u65B9\u6CD5\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3057\u307E\u3059
-
-main.opt.version=\ -version \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831
-
-main.opt.v=\ -v -verbose \u30AF\u30E9\u30B9\u30FB\u30EC\u30D9\u30EB\u306E\u4F9D\u5B58\u6027\u3092\u3059\u3079\u3066\u51FA\u529B\u3057\u307E\u3059\n -verbose:package \u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EC\u30D9\u30EB\u306E\u4F9D\u5B58\u6027\u3092\u51FA\u529B\u3057\u307E\u3059\n (\u540C\u3058\u30A2\u30FC\u30AB\u30A4\u30D6\u5185\u306E\u4F9D\u5B58\u6027\u3092\u9664\u304F)\n -verbose:class \u30AF\u30E9\u30B9\u30FB\u30EC\u30D9\u30EB\u306E\u4F9D\u5B58\u6027\u3092\u51FA\u529B\u3057\u307E\u3059\n (\u540C\u3058\u30A2\u30FC\u30AB\u30A4\u30D6\u5185\u306E\u4F9D\u5B58\u6027\u3092\u9664\u304F)
-
-main.opt.s=\ -s -summary \u4F9D\u5B58\u6027\u306E\u8981\u7D04\u306E\u307F\u51FA\u529B\u3057\u307E\u3059
-
-main.opt.p=\ -p <pkgname> -package <pkgname> \u6307\u5B9A\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u306E\u4F9D\u5B58\u6027\u3092\u691C\u51FA\u3057\u307E\u3059\n (\u8907\u6570\u56DE\u6307\u5B9A\u53EF\u80FD)
-
-main.opt.e=\ -e <regex> -regex <regex> \u30D1\u30BF\u30FC\u30F3\u306B\u4E00\u81F4\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u306E\u4F9D\u5B58\u6027\u3092\u691C\u51FA\u3057\u307E\u3059\n (-p\u3068-e\u306F\u6392\u4ED6\u7684)
-
-main.opt.include=\ -include <regex> \u30D1\u30BF\u30FC\u30F3\u306B\u4E00\u81F4\u3059\u308B\u30AF\u30E9\u30B9\u306B\u5206\u6790\u3092\u5236\u9650\u3057\u307E\u3059\n \u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6307\u5B9A\u3059\u308B\u3068\u3001\u5206\u6790\u5BFE\u8C61\u30AF\u30E9\u30B9\u306E\n \u30EA\u30B9\u30C8\u304C\u30D5\u30A3\u30EB\u30BF\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\u30D1\u30BF\u30FC\u30F3\u3092\u4F9D\u5B58\u6027\u306B\n \u9069\u7528\u3059\u308B-p\u304A\u3088\u3073-e\u3068\u4E00\u7DD2\u306B\u4F7F\u7528\u3067\u304D\u307E\u3059
-
-main.opt.P=\ -P -profile \u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u3001\u307E\u305F\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u3092\u8868\u793A\u3057\u307E\u3059
-
-main.opt.cp=\ -cp <path> -classpath <path> \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3057\u307E\u3059
-
-main.opt.R=\ -R -recursive \u3059\u3079\u3066\u306E\u4F9D\u5B58\u6027\u3092\u53CD\u5FA9\u7684\u306B\u8D70\u67FB\u3057\u307E\u3059
-
-main.opt.apionly=\ -apionly \u5206\u6790\u3092API\u3001\u3064\u307E\u308A\u3001\u30D1\u30D6\u30EA\u30C3\u30AF\u30FB\u30AF\u30E9\u30B9\u306E\n \u30D1\u30D6\u30EA\u30C3\u30AF\u30FB\u30E1\u30F3\u30D0\u30FC\u304A\u3088\u3073\u4FDD\u8B77\u3055\u308C\u305F\u30E1\u30F3\u30D0\u30FC\u306E\n \u7F72\u540D\u306B\u304A\u3051\u308B\u4F9D\u5B58\u6027(\u30D5\u30A3\u30FC\u30EB\u30C9\u30FB\u30BF\u30A4\u30D7\u3001\u30E1\u30BD\u30C3\u30C9\u30FB\n \u30D1\u30E9\u30E1\u30FC\u30BF\u30FB\u30BF\u30A4\u30D7\u3001\u623B\u3055\u308C\u305F\u30BF\u30A4\u30D7\u3001\u30C1\u30A7\u30C3\u30AF\u3055\u308C\u305F\n \u4F8B\u5916\u30BF\u30A4\u30D7\u306A\u3069)\u306B\u5236\u9650\u3057\u307E\u3059
-
-main.opt.dotoutput=\ -dotoutput <dir> DOT\u30D5\u30A1\u30A4\u30EB\u51FA\u529B\u306E\u5B9B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA
-
-main.opt.depth=\ -depth=<depth> \u63A8\u79FB\u7684\u306A\u4F9D\u5B58\u6027\u5206\u6790\u306E\u6DF1\u3055\u3092\n \u6307\u5B9A\u3057\u307E\u3059
-
-err.unknown.option=\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}
-err.missing.arg={0}\u306B\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
-err.internal.error=\u5185\u90E8\u30A8\u30E9\u30FC: {0} {1} {2}
-err.invalid.arg.for.option=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: {0}
-err.option.after.class=\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u30AF\u30E9\u30B9\u306E\u524D\u306B\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
-err.option.unsupported={0}\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093: {1}
-err.profiles.msg=\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093
-err.dot.output.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
-
-artifact.not.found=\u898B\u3064\u304B\u308A\u307E\u305B\u3093
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/resources/jdeps_zh_CN.properties Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-main.usage.summary=\u7528\u6CD5: {0} <options> <classes...>\n\u4F7F\u7528 -h, -? \u6216 --help \u5217\u51FA\u53EF\u80FD\u7684\u9009\u9879
-
-main.usage=\u7528\u6CD5: {0} <options> <classes...>\n\u5176\u4E2D <classes> \u53EF\u4EE5\u662F .class \u6587\u4EF6, \u76EE\u5F55, JAR \u6587\u4EF6\u7684\u8DEF\u5F84\u540D,\n\u4E5F\u53EF\u4EE5\u662F\u5168\u9650\u5B9A\u7C7B\u540D\u3002\u53EF\u80FD\u7684\u9009\u9879\u5305\u62EC:
-
-error.prefix=\u9519\u8BEF:
-warn.prefix=\u8B66\u544A:
-
-main.opt.h=\ -h -? -help \u8F93\u51FA\u6B64\u7528\u6CD5\u6D88\u606F
-
-main.opt.version=\ -version \u7248\u672C\u4FE1\u606F
-
-main.opt.v=\ -v -verbose \u8F93\u51FA\u6240\u6709\u7C7B\u7EA7\u522B\u88AB\u4F9D\u8D56\u5BF9\u8C61\n -verbose:package \u8F93\u51FA\u7A0B\u5E8F\u5305\u7EA7\u522B\u88AB\u4F9D\u8D56\u5BF9\u8C61, \u4E0D\u5305\u62EC\n \u540C\u4E00\u6863\u6848\u4E2D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n -verbose:class \u8F93\u51FA\u7C7B\u7EA7\u522B\u88AB\u4F9D\u8D56\u5BF9\u8C61, \u4E0D\u5305\u62EC\n \u540C\u4E00\u6863\u6848\u4E2D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61
-
-main.opt.s=\ -s -summary \u4EC5\u8F93\u51FA\u88AB\u4F9D\u8D56\u5BF9\u8C61\u6982\u8981
-
-main.opt.p=\ -p <pkgname> -package <pkgname> \u67E5\u627E\u7ED9\u5B9A\u7A0B\u5E8F\u5305\u4E2D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n (\u53EF\u80FD\u591A\u6B21\u6307\u5B9A)
-
-main.opt.e=\ -e <regex> -regex <regex> \u67E5\u627E\u4E0E\u6A21\u5F0F\u5339\u914D\u7684\u7A0B\u5E8F\u5305\u4E2D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n (-p \u548C -e \u4E92\u76F8\u6392\u65A5)
-
-main.opt.include=\ -include <regex> \u5C06\u5206\u6790\u9650\u5236\u4E3A\u4E0E\u6A21\u5F0F\u5339\u914D\u7684\u7C7B\n \u6B64\u9009\u9879\u7B5B\u9009\u8981\u5206\u6790\u7684\u7C7B\u7684\u5217\u8868\u3002\n \u5B83\u53EF\u4EE5\u4E0E\u5411\u88AB\u4F9D\u8D56\u5BF9\u8C61\u5E94\u7528\u6A21\u5F0F\u7684\n -p \u548C -e \u7ED3\u5408\u4F7F\u7528
-
-main.opt.P=\ -P -profile \u663E\u793A\u914D\u7F6E\u6587\u4EF6\u6216\u5305\u542B\u7A0B\u5E8F\u5305\u7684\u6587\u4EF6
-
-main.opt.cp=\ -cp <path> -classpath <path> \u6307\u5B9A\u67E5\u627E\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
-
-main.opt.R=\ -R -recursive \u9012\u5F52\u904D\u5386\u6240\u6709\u88AB\u4F9D\u8D56\u5BF9\u8C61
-
-main.opt.apionly=\ -apionly \u901A\u8FC7\u516C\u5171\u7C7B (\u5305\u62EC\u5B57\u6BB5\u7C7B\u578B, \u65B9\u6CD5\u53C2\u6570\n \u7C7B\u578B, \u8FD4\u56DE\u7C7B\u578B, \u53D7\u63A7\u5F02\u5E38\u9519\u8BEF\u7C7B\u578B\n \u7B49) \u7684\u516C\u5171\u548C\u53D7\u4FDD\u62A4\u6210\u5458\u7684\u7B7E\u540D\n \u9650\u5236\u5BF9 API (\u5373\u88AB\u4F9D\u8D56\u5BF9\u8C61)\n \u8FDB\u884C\u5206\u6790
-
-main.opt.dotoutput=\ -dotoutput <dir> DOT \u6587\u4EF6\u8F93\u51FA\u7684\u76EE\u6807\u76EE\u5F55
-
-main.opt.depth=\ -depth=<depth> \u6307\u5B9A\u8FC7\u6E21\u88AB\u4F9D\u8D56\u5BF9\u8C61\u5206\u6790\n \u7684\u6DF1\u5EA6
-
-err.unknown.option=\u672A\u77E5\u9009\u9879: {0}
-err.missing.arg=\u6CA1\u6709\u4E3A{0}\u6307\u5B9A\u503C
-err.internal.error=\u5185\u90E8\u9519\u8BEF: {0} {1} {2}
-err.invalid.arg.for.option=\u9009\u9879\u7684\u53C2\u6570\u65E0\u6548: {0}
-err.option.after.class=\u5FC5\u987B\u5728\u7C7B\u4E4B\u524D\u6307\u5B9A\u9009\u9879: {0}
-err.option.unsupported=\u4E0D\u652F\u6301{0}: {1}
-err.profiles.msg=\u6CA1\u6709\u914D\u7F6E\u6587\u4EF6\u4FE1\u606F
-err.dot.output.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}
-
-artifact.not.found=\u627E\u4E0D\u5230
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/resources/jdkinternals.properties Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-// 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.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.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
-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.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
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/resources/version.properties-template Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#
-
-jdk=$(JDK_VERSION)
-full=$(FULL_VERSION)
-release=$(RELEASE)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/AccessFlags.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * See JVMS, sections 4.2, 4.6, 4.7.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class AccessFlags {
+ public static final int ACC_PUBLIC = 0x0001; // class, inner, field, method
+ public static final int ACC_PRIVATE = 0x0002; // inner, field, method
+ public static final int ACC_PROTECTED = 0x0004; // inner, field, method
+ public static final int ACC_STATIC = 0x0008; // inner, field, method
+ public static final int ACC_FINAL = 0x0010; // class, inner, field, method
+ public static final int ACC_SUPER = 0x0020; // class
+ public static final int ACC_SYNCHRONIZED = 0x0020; // method
+ public static final int ACC_VOLATILE = 0x0040; // field
+ public static final int ACC_BRIDGE = 0x0040; // method
+ public static final int ACC_TRANSIENT = 0x0080; // field
+ public static final int ACC_VARARGS = 0x0080; // method
+ public static final int ACC_NATIVE = 0x0100; // method
+ public static final int ACC_INTERFACE = 0x0200; // class, inner
+ public static final int ACC_ABSTRACT = 0x0400; // class, inner, method
+ public static final int ACC_STRICT = 0x0800; // method
+ public static final int ACC_SYNTHETIC = 0x1000; // class, inner, field, method
+ public static final int ACC_ANNOTATION = 0x2000; // class, inner
+ public static final int ACC_ENUM = 0x4000; // class, inner, field
+ public static final int ACC_MANDATED = 0x8000; // class, inner, field, method
+
+ public static enum Kind { Class, InnerClass, Field, Method}
+
+ AccessFlags(ClassReader cr) throws IOException {
+ this(cr.readUnsignedShort());
+ }
+
+ public AccessFlags(int flags) {
+ this.flags = flags;
+ }
+
+ public AccessFlags ignore(int mask) {
+ return new AccessFlags(flags & ~mask);
+ }
+
+ public boolean is(int mask) {
+ return (flags & mask) != 0;
+ }
+
+ public int byteLength() {
+ return 2;
+ }
+
+ private static final int[] classModifiers = {
+ ACC_PUBLIC, ACC_FINAL, ACC_ABSTRACT
+ };
+
+ private static final int[] classFlags = {
+ ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_INTERFACE, ACC_ABSTRACT,
+ ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM
+ };
+
+ public Set<String> getClassModifiers() {
+ int f = ((flags & ACC_INTERFACE) != 0 ? flags & ~ACC_ABSTRACT : flags);
+ return getModifiers(f, classModifiers, Kind.Class);
+ }
+
+ public Set<String> getClassFlags() {
+ return getFlags(classFlags, Kind.Class);
+ }
+
+ private static final int[] innerClassModifiers = {
+ ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
+ ACC_ABSTRACT
+ };
+
+ private static final int[] innerClassFlags = {
+ ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_SUPER,
+ ACC_INTERFACE, ACC_ABSTRACT, ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM
+ };
+
+ public Set<String> getInnerClassModifiers() {
+ int f = ((flags & ACC_INTERFACE) != 0 ? flags & ~ACC_ABSTRACT : flags);
+ return getModifiers(f, innerClassModifiers, Kind.InnerClass);
+ }
+
+ public Set<String> getInnerClassFlags() {
+ return getFlags(innerClassFlags, Kind.InnerClass);
+ }
+
+ private static final int[] fieldModifiers = {
+ ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
+ ACC_VOLATILE, ACC_TRANSIENT
+ };
+
+ private static final int[] fieldFlags = {
+ ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
+ ACC_VOLATILE, ACC_TRANSIENT, ACC_SYNTHETIC, ACC_ENUM
+ };
+
+ public Set<String> getFieldModifiers() {
+ return getModifiers(fieldModifiers, Kind.Field);
+ }
+
+ public Set<String> getFieldFlags() {
+ return getFlags(fieldFlags, Kind.Field);
+ }
+
+ private static final int[] methodModifiers = {
+ ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
+ ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT, ACC_STRICT
+ };
+
+ private static final int[] methodFlags = {
+ ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
+ ACC_SYNCHRONIZED, ACC_BRIDGE, ACC_VARARGS, ACC_NATIVE, ACC_ABSTRACT,
+ ACC_STRICT, ACC_SYNTHETIC
+ };
+
+ public Set<String> getMethodModifiers() {
+ return getModifiers(methodModifiers, Kind.Method);
+ }
+
+ public Set<String> getMethodFlags() {
+ return getFlags(methodFlags, Kind.Method);
+ }
+
+ private Set<String> getModifiers(int[] modifierFlags, Kind t) {
+ return getModifiers(flags, modifierFlags, t);
+ }
+
+ private static Set<String> getModifiers(int flags, int[] modifierFlags, Kind t) {
+ Set<String> s = new LinkedHashSet<>();
+ for (int m: modifierFlags) {
+ if ((flags & m) != 0)
+ s.add(flagToModifier(m, t));
+ }
+ return s;
+ }
+
+ private Set<String> getFlags(int[] expectedFlags, Kind t) {
+ Set<String> s = new LinkedHashSet<>();
+ int f = flags;
+ for (int e: expectedFlags) {
+ if ((f & e) != 0) {
+ s.add(flagToName(e, t));
+ f = f & ~e;
+ }
+ }
+ while (f != 0) {
+ int bit = Integer.highestOneBit(f);
+ s.add("0x" + Integer.toHexString(bit));
+ f = f & ~bit;
+ }
+ return s;
+ }
+
+ private static String flagToModifier(int flag, Kind t) {
+ switch (flag) {
+ case ACC_PUBLIC:
+ return "public";
+ case ACC_PRIVATE:
+ return "private";
+ case ACC_PROTECTED:
+ return "protected";
+ case ACC_STATIC:
+ return "static";
+ case ACC_FINAL:
+ return "final";
+ case ACC_SYNCHRONIZED:
+ return "synchronized";
+ case 0x80:
+ return (t == Kind.Field ? "transient" : null);
+ case ACC_VOLATILE:
+ return "volatile";
+ case ACC_NATIVE:
+ return "native";
+ case ACC_ABSTRACT:
+ return "abstract";
+ case ACC_STRICT:
+ return "strictfp";
+ case ACC_MANDATED:
+ return "mandated";
+ default:
+ return null;
+ }
+ }
+
+ private static String flagToName(int flag, Kind t) {
+ switch (flag) {
+ case ACC_PUBLIC:
+ return "ACC_PUBLIC";
+ case ACC_PRIVATE:
+ return "ACC_PRIVATE";
+ case ACC_PROTECTED:
+ return "ACC_PROTECTED";
+ case ACC_STATIC:
+ return "ACC_STATIC";
+ case ACC_FINAL:
+ return "ACC_FINAL";
+ case 0x20:
+ return (t == Kind.Class ? "ACC_SUPER" : "ACC_SYNCHRONIZED");
+ case 0x40:
+ return (t == Kind.Field ? "ACC_VOLATILE" : "ACC_BRIDGE");
+ case 0x80:
+ return (t == Kind.Field ? "ACC_TRANSIENT" : "ACC_VARARGS");
+ case ACC_NATIVE:
+ return "ACC_NATIVE";
+ case ACC_INTERFACE:
+ return "ACC_INTERFACE";
+ case ACC_ABSTRACT:
+ return "ACC_ABSTRACT";
+ case ACC_STRICT:
+ return "ACC_STRICT";
+ case ACC_SYNTHETIC:
+ return "ACC_SYNTHETIC";
+ case ACC_ANNOTATION:
+ return "ACC_ANNOTATION";
+ case ACC_ENUM:
+ return "ACC_ENUM";
+ case ACC_MANDATED:
+ return "ACC_MANDATED";
+ default:
+ return null;
+ }
+ }
+
+ public final int flags;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Annotation.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2007, 2009, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.16.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Annotation {
+ static class InvalidAnnotation extends AttributeException {
+ private static final long serialVersionUID = -4620480740735772708L;
+ InvalidAnnotation(String msg) {
+ super(msg);
+ }
+ }
+
+ Annotation(ClassReader cr) throws IOException, InvalidAnnotation {
+ type_index = cr.readUnsignedShort();
+ num_element_value_pairs = cr.readUnsignedShort();
+ element_value_pairs = new element_value_pair[num_element_value_pairs];
+ for (int i = 0; i < element_value_pairs.length; i++)
+ element_value_pairs[i] = new element_value_pair(cr);
+ }
+
+ public Annotation(ConstantPool constant_pool,
+ int type_index,
+ element_value_pair[] element_value_pairs) {
+ this.type_index = type_index;
+ num_element_value_pairs = element_value_pairs.length;
+ this.element_value_pairs = element_value_pairs;
+ }
+
+ public int length() {
+ int n = 2 /*type_index*/ + 2 /*num_element_value_pairs*/;
+ for (element_value_pair pair: element_value_pairs)
+ n += pair.length();
+ return n;
+ }
+
+ public final int type_index;
+ public final int num_element_value_pairs;
+ public final element_value_pair element_value_pairs[];
+
+ /**
+ * See JVMS, section 4.8.16.1.
+ */
+ public static abstract class element_value {
+ public static element_value read(ClassReader cr)
+ throws IOException, InvalidAnnotation {
+ int tag = cr.readUnsignedByte();
+ switch (tag) {
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'F':
+ case 'I':
+ case 'J':
+ case 'S':
+ case 'Z':
+ case 's':
+ return new Primitive_element_value(cr, tag);
+
+ case 'e':
+ return new Enum_element_value(cr, tag);
+
+ case 'c':
+ return new Class_element_value(cr, tag);
+
+ case '@':
+ return new Annotation_element_value(cr, tag);
+
+ case '[':
+ return new Array_element_value(cr, tag);
+
+ default:
+ throw new InvalidAnnotation("unrecognized tag: " + tag);
+ }
+ }
+
+ protected element_value(int tag) {
+ this.tag = tag;
+ }
+
+ public abstract int length();
+
+ public abstract <R,P> R accept(Visitor<R,P> visitor, P p);
+
+ public interface Visitor<R,P> {
+ R visitPrimitive(Primitive_element_value ev, P p);
+ R visitEnum(Enum_element_value ev, P p);
+ R visitClass(Class_element_value ev, P p);
+ R visitAnnotation(Annotation_element_value ev, P p);
+ R visitArray(Array_element_value ev, P p);
+ }
+
+ public final int tag;
+ }
+
+ public static class Primitive_element_value extends element_value {
+ Primitive_element_value(ClassReader cr, int tag) throws IOException {
+ super(tag);
+ const_value_index = cr.readUnsignedShort();
+ }
+
+ @Override
+ public int length() {
+ return 2;
+ }
+
+ public <R,P> R accept(Visitor<R,P> visitor, P p) {
+ return visitor.visitPrimitive(this, p);
+ }
+
+ public final int const_value_index;
+
+ }
+
+ public static class Enum_element_value extends element_value {
+ Enum_element_value(ClassReader cr, int tag) throws IOException {
+ super(tag);
+ type_name_index = cr.readUnsignedShort();
+ const_name_index = cr.readUnsignedShort();
+ }
+
+ @Override
+ public int length() {
+ return 4;
+ }
+
+ public <R,P> R accept(Visitor<R,P> visitor, P p) {
+ return visitor.visitEnum(this, p);
+ }
+
+ public final int type_name_index;
+ public final int const_name_index;
+ }
+
+ public static class Class_element_value extends element_value {
+ Class_element_value(ClassReader cr, int tag) throws IOException {
+ super(tag);
+ class_info_index = cr.readUnsignedShort();
+ }
+
+ @Override
+ public int length() {
+ return 2;
+ }
+
+ public <R,P> R accept(Visitor<R,P> visitor, P p) {
+ return visitor.visitClass(this, p);
+ }
+
+ public final int class_info_index;
+ }
+
+ public static class Annotation_element_value extends element_value {
+ Annotation_element_value(ClassReader cr, int tag)
+ throws IOException, InvalidAnnotation {
+ super(tag);
+ annotation_value = new Annotation(cr);
+ }
+
+ @Override
+ public int length() {
+ return annotation_value.length();
+ }
+
+ public <R,P> R accept(Visitor<R,P> visitor, P p) {
+ return visitor.visitAnnotation(this, p);
+ }
+
+ public final Annotation annotation_value;
+ }
+
+ public static class Array_element_value extends element_value {
+ Array_element_value(ClassReader cr, int tag)
+ throws IOException, InvalidAnnotation {
+ super(tag);
+ num_values = cr.readUnsignedShort();
+ values = new element_value[num_values];
+ for (int i = 0; i < values.length; i++)
+ values[i] = element_value.read(cr);
+ }
+
+ @Override
+ public int length() {
+ int n = 2;
+ for (int i = 0; i < values.length; i++)
+ n += values[i].length();
+ return n;
+ }
+
+ public <R,P> R accept(Visitor<R,P> visitor, P p) {
+ return visitor.visitArray(this, p);
+ }
+
+ public final int num_values;
+ public final element_value[] values;
+ }
+
+ public static class element_value_pair {
+ element_value_pair(ClassReader cr)
+ throws IOException, InvalidAnnotation {
+ element_name_index = cr.readUnsignedShort();
+ value = element_value.read(cr);
+ }
+
+ public int length() {
+ return 2 + value.length();
+ }
+
+ public final int element_name_index;
+ public final element_value value;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/AnnotationDefault_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.15.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class AnnotationDefault_attribute extends Attribute {
+ AnnotationDefault_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, Annotation.InvalidAnnotation {
+ super(name_index, length);
+ default_value = Annotation.element_value.read(cr);
+ }
+
+ public AnnotationDefault_attribute(ConstantPool constant_pool, Annotation.element_value default_value)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.AnnotationDefault), default_value);
+ }
+
+ public AnnotationDefault_attribute(int name_index, Annotation.element_value default_value) {
+ super(name_index, default_value.length());
+ this.default_value = default_value;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitAnnotationDefault(this, data);
+ }
+
+ public final Annotation.element_value default_value;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+
+public abstract class Attribute {
+ public static final String AnnotationDefault = "AnnotationDefault";
+ public static final String BootstrapMethods = "BootstrapMethods";
+ public static final String CharacterRangeTable = "CharacterRangeTable";
+ public static final String Code = "Code";
+ public static final String ConstantValue = "ConstantValue";
+ public static final String CompilationID = "CompilationID";
+ public static final String Deprecated = "Deprecated";
+ public static final String EnclosingMethod = "EnclosingMethod";
+ public static final String Exceptions = "Exceptions";
+ public static final String InnerClasses = "InnerClasses";
+ public static final String LineNumberTable = "LineNumberTable";
+ public static final String LocalVariableTable = "LocalVariableTable";
+ public static final String LocalVariableTypeTable = "LocalVariableTypeTable";
+ public static final String MethodParameters = "MethodParameters";
+ public static final String RuntimeVisibleAnnotations = "RuntimeVisibleAnnotations";
+ public static final String RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
+ public static final String RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
+ public static final String RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
+ public static final String RuntimeVisibleTypeAnnotations = "RuntimeVisibleTypeAnnotations";
+ public static final String RuntimeInvisibleTypeAnnotations = "RuntimeInvisibleTypeAnnotations";
+ public static final String Signature = "Signature";
+ public static final String SourceDebugExtension = "SourceDebugExtension";
+ public static final String SourceFile = "SourceFile";
+ public static final String SourceID = "SourceID";
+ public static final String StackMap = "StackMap";
+ public static final String StackMapTable = "StackMapTable";
+ public static final String Synthetic = "Synthetic";
+
+ public static class Factory {
+ public Factory() {
+ // defer init of standardAttributeClasses until after options set up
+ }
+
+ public Attribute createAttribute(ClassReader cr, int name_index, byte[] data)
+ throws IOException {
+ if (standardAttributes == null) {
+ init();
+ }
+
+ ConstantPool cp = cr.getConstantPool();
+ String reasonForDefaultAttr;
+ try {
+ String name = cp.getUTF8Value(name_index);
+ Class<? extends Attribute> attrClass = standardAttributes.get(name);
+ if (attrClass != null) {
+ try {
+ Class<?>[] constrArgTypes = {ClassReader.class, int.class, int.class};
+ Constructor<? extends Attribute> constr = attrClass.getDeclaredConstructor(constrArgTypes);
+ return constr.newInstance(cr, name_index, data.length);
+ } catch (Throwable t) {
+ reasonForDefaultAttr = t.toString();
+ // fall through and use DefaultAttribute
+ // t.printStackTrace();
+ }
+ } else {
+ reasonForDefaultAttr = "unknown attribute";
+ }
+ } catch (ConstantPoolException e) {
+ reasonForDefaultAttr = e.toString();
+ // fall through and use DefaultAttribute
+ }
+ return new DefaultAttribute(cr, name_index, data, reasonForDefaultAttr);
+ }
+
+ protected void init() {
+ standardAttributes = new HashMap<>();
+ standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
+ standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
+ standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
+ standardAttributes.put(Code, Code_attribute.class);
+ standardAttributes.put(CompilationID, CompilationID_attribute.class);
+ standardAttributes.put(ConstantValue, ConstantValue_attribute.class);
+ standardAttributes.put(Deprecated, Deprecated_attribute.class);
+ standardAttributes.put(EnclosingMethod, EnclosingMethod_attribute.class);
+ standardAttributes.put(Exceptions, Exceptions_attribute.class);
+ standardAttributes.put(InnerClasses, InnerClasses_attribute.class);
+ standardAttributes.put(LineNumberTable, LineNumberTable_attribute.class);
+ standardAttributes.put(LocalVariableTable, LocalVariableTable_attribute.class);
+ standardAttributes.put(LocalVariableTypeTable, LocalVariableTypeTable_attribute.class);
+ standardAttributes.put(MethodParameters, MethodParameters_attribute.class);
+ standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class);
+ standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
+ standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
+ standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
+ standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
+ standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
+ standardAttributes.put(Signature, Signature_attribute.class);
+ standardAttributes.put(SourceDebugExtension, SourceDebugExtension_attribute.class);
+ standardAttributes.put(SourceFile, SourceFile_attribute.class);
+ standardAttributes.put(SourceID, SourceID_attribute.class);
+ standardAttributes.put(StackMap, StackMap_attribute.class);
+ standardAttributes.put(StackMapTable, StackMapTable_attribute.class);
+ standardAttributes.put(Synthetic, Synthetic_attribute.class);
+ }
+
+ private Map<String,Class<? extends Attribute>> standardAttributes;
+ }
+
+ public static Attribute read(ClassReader cr) throws IOException {
+ return cr.readAttribute();
+ }
+
+ protected Attribute(int name_index, int length) {
+ attribute_name_index = name_index;
+ attribute_length = length;
+ }
+
+ public String getName(ConstantPool constant_pool) throws ConstantPoolException {
+ return constant_pool.getUTF8Value(attribute_name_index);
+ }
+
+ public abstract <R,D> R accept(Attribute.Visitor<R,D> visitor, D data);
+
+ public int byteLength() {
+ return 6 + attribute_length;
+ }
+
+ public final int attribute_name_index;
+ public final int attribute_length;
+
+
+ public interface Visitor<R,P> {
+ R visitBootstrapMethods(BootstrapMethods_attribute attr, P p);
+ R visitDefault(DefaultAttribute attr, P p);
+ R visitAnnotationDefault(AnnotationDefault_attribute attr, P p);
+ R visitCharacterRangeTable(CharacterRangeTable_attribute attr, P p);
+ R visitCode(Code_attribute attr, P p);
+ R visitCompilationID(CompilationID_attribute attr, P p);
+ R visitConstantValue(ConstantValue_attribute attr, P p);
+ R visitDeprecated(Deprecated_attribute attr, P p);
+ R visitEnclosingMethod(EnclosingMethod_attribute attr, P p);
+ R visitExceptions(Exceptions_attribute attr, P p);
+ R visitInnerClasses(InnerClasses_attribute attr, P p);
+ R visitLineNumberTable(LineNumberTable_attribute attr, P p);
+ R visitLocalVariableTable(LocalVariableTable_attribute attr, P p);
+ R visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, P p);
+ R visitMethodParameters(MethodParameters_attribute attr, P p);
+ R visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, P p);
+ R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p);
+ R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p);
+ R visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, P p);
+ R visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, P p);
+ R visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, P p);
+ R visitSignature(Signature_attribute attr, P p);
+ R visitSourceDebugExtension(SourceDebugExtension_attribute attr, P p);
+ R visitSourceFile(SourceFile_attribute attr, P p);
+ R visitSourceID(SourceID_attribute attr, P p);
+ R visitStackMap(StackMap_attribute attr, P p);
+ R visitStackMapTable(StackMapTable_attribute attr, P p);
+ R visitSynthetic(Synthetic_attribute attr, P p);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/AttributeException.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2008, 2009, 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.
+ */
+
+package com.sun.tools.classfile;
+
+/*
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class AttributeException extends Exception {
+ private static final long serialVersionUID = -4231486387714867770L;
+ AttributeException() { }
+
+ AttributeException(String msg) {
+ super(msg);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attributes.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/*
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Attributes implements Iterable<Attribute> {
+
+ public final Attribute[] attrs;
+ public final Map<String, Attribute> map;
+
+ Attributes(ClassReader cr) throws IOException {
+ map = new HashMap<>();
+ int attrs_count = cr.readUnsignedShort();
+ attrs = new Attribute[attrs_count];
+ for (int i = 0; i < attrs_count; i++) {
+ Attribute attr = Attribute.read(cr);
+ attrs[i] = attr;
+ try {
+ map.put(attr.getName(cr.getConstantPool()), attr);
+ } catch (ConstantPoolException e) {
+ // don't enter invalid names in map
+ }
+ }
+ }
+
+ public Attributes(ConstantPool constant_pool, Attribute[] attrs) {
+ this.attrs = attrs;
+ map = new HashMap<>();
+ for (Attribute attr : attrs) {
+ try {
+ map.put(attr.getName(constant_pool), attr);
+ } catch (ConstantPoolException e) {
+ // don't enter invalid names in map
+ }
+ }
+ }
+
+ public Iterator<Attribute> iterator() {
+ return Arrays.asList(attrs).iterator();
+ }
+
+ public Attribute get(int index) {
+ return attrs[index];
+ }
+
+ public Attribute get(String name) {
+ return map.get(name);
+ }
+
+ public int getIndex(ConstantPool constant_pool, String name) {
+ for (int i = 0; i < attrs.length; i++) {
+ Attribute attr = attrs[i];
+ try {
+ if (attr != null && attr.getName(constant_pool).equals(name))
+ return i;
+ } catch (ConstantPoolException e) {
+ // ignore invalid entries
+ }
+ }
+ return -1;
+ }
+
+ public int size() {
+ return attrs.length;
+ }
+
+ public int byteLength() {
+ int length = 2;
+ for (Attribute a: attrs)
+ length += a.byteLength();
+ return length;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/BootstrapMethods_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2011, 2012, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS 4.7.21
+ * http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.21
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class BootstrapMethods_attribute extends Attribute {
+ public final BootstrapMethodSpecifier[] bootstrap_method_specifiers;
+
+ BootstrapMethods_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, AttributeException {
+ super(name_index, length);
+ int bootstrap_method_count = cr.readUnsignedShort();
+ bootstrap_method_specifiers = new BootstrapMethodSpecifier[bootstrap_method_count];
+ for (int i = 0; i < bootstrap_method_specifiers.length; i++)
+ bootstrap_method_specifiers[i] = new BootstrapMethodSpecifier(cr);
+ }
+
+ public BootstrapMethods_attribute(int name_index, BootstrapMethodSpecifier[] bootstrap_method_specifiers) {
+ super(name_index, length(bootstrap_method_specifiers));
+ this.bootstrap_method_specifiers = bootstrap_method_specifiers;
+ }
+
+ public static int length(BootstrapMethodSpecifier[] bootstrap_method_specifiers) {
+ int n = 2;
+ for (BootstrapMethodSpecifier b : bootstrap_method_specifiers)
+ n += b.length();
+ return n;
+ }
+
+ @Override
+ public <R, P> R accept(Visitor<R, P> visitor, P p) {
+ return visitor.visitBootstrapMethods(this, p);
+ }
+
+ public static class BootstrapMethodSpecifier {
+ public int bootstrap_method_ref;
+ public int[] bootstrap_arguments;
+
+ public BootstrapMethodSpecifier(int bootstrap_method_ref, int[] bootstrap_arguments) {
+ this.bootstrap_method_ref = bootstrap_method_ref;
+ this.bootstrap_arguments = bootstrap_arguments;
+ }
+ BootstrapMethodSpecifier(ClassReader cr) throws IOException {
+ bootstrap_method_ref = cr.readUnsignedShort();
+ int method_count = cr.readUnsignedShort();
+ bootstrap_arguments = new int[method_count];
+ for (int i = 0; i < bootstrap_arguments.length; i++) {
+ bootstrap_arguments[i] = cr.readUnsignedShort();
+ }
+ }
+
+ int length() {
+ // u2 (method_ref) + u2 (argc) + u2 * argc
+ return 2 + 2 + (bootstrap_arguments.length * 2);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/CharacterRangeTable_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class CharacterRangeTable_attribute extends Attribute {
+ public static final int CRT_STATEMENT = 0x0001;
+ public static final int CRT_BLOCK = 0x0002;
+ public static final int CRT_ASSIGNMENT = 0x0004;
+ public static final int CRT_FLOW_CONTROLLER = 0x0008;
+ public static final int CRT_FLOW_TARGET = 0x0010;
+ public static final int CRT_INVOKE = 0x0020;
+ public static final int CRT_CREATE = 0x0040;
+ public static final int CRT_BRANCH_TRUE = 0x0080;
+ public static final int CRT_BRANCH_FALSE = 0x0100;
+
+ CharacterRangeTable_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ int character_range_table_length = cr.readUnsignedShort();
+ character_range_table = new Entry[character_range_table_length];
+ for (int i = 0; i < character_range_table_length; i++)
+ character_range_table[i] = new Entry(cr);
+ }
+
+ public CharacterRangeTable_attribute(ConstantPool constant_pool, Entry[] character_range_table)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.CharacterRangeTable), character_range_table);
+ }
+
+ public CharacterRangeTable_attribute(int name_index, Entry[] character_range_table) {
+ super(name_index, 2 + character_range_table.length * Entry.length());
+ this.character_range_table = character_range_table;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitCharacterRangeTable(this, data);
+ }
+
+ public final Entry[] character_range_table;
+
+ public static class Entry {
+ Entry(ClassReader cr) throws IOException {
+ start_pc = cr.readUnsignedShort();
+ end_pc = cr.readUnsignedShort();
+ character_range_start = cr.readInt();
+ character_range_end = cr.readInt();
+ flags = cr.readUnsignedShort();
+ }
+
+ public static int length() {
+ return 14;
+ }
+
+ public final int start_pc;
+ public final int end_pc;
+ public final int character_range_start;
+ public final int character_range_end;
+ public final int flags;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassFile.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import static com.sun.tools.classfile.AccessFlags.*;
+
+/**
+ * See JVMS, section 4.2.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class ClassFile {
+ public static ClassFile read(File file)
+ throws IOException, ConstantPoolException {
+ return read(file.toPath(), new Attribute.Factory());
+ }
+
+ public static ClassFile read(Path input)
+ throws IOException, ConstantPoolException {
+ return read(input, new Attribute.Factory());
+ }
+
+ public static ClassFile read(Path input, Attribute.Factory attributeFactory)
+ throws IOException, ConstantPoolException {
+ try (InputStream in = Files.newInputStream(input)) {
+ return new ClassFile(in, attributeFactory);
+ }
+ }
+
+ public static ClassFile read(File file, Attribute.Factory attributeFactory)
+ throws IOException, ConstantPoolException {
+ return read(file.toPath(), attributeFactory);
+ }
+
+ public static ClassFile read(InputStream in)
+ throws IOException, ConstantPoolException {
+ return new ClassFile(in, new Attribute.Factory());
+ }
+
+ public static ClassFile read(InputStream in, Attribute.Factory attributeFactory)
+ throws IOException, ConstantPoolException {
+ return new ClassFile(in, attributeFactory);
+ }
+
+ ClassFile(InputStream in, Attribute.Factory attributeFactory) throws IOException, ConstantPoolException {
+ ClassReader cr = new ClassReader(this, in, attributeFactory);
+ magic = cr.readInt();
+ minor_version = cr.readUnsignedShort();
+ major_version = cr.readUnsignedShort();
+ constant_pool = new ConstantPool(cr);
+ access_flags = new AccessFlags(cr);
+ this_class = cr.readUnsignedShort();
+ super_class = cr.readUnsignedShort();
+
+ int interfaces_count = cr.readUnsignedShort();
+ interfaces = new int[interfaces_count];
+ for (int i = 0; i < interfaces_count; i++)
+ interfaces[i] = cr.readUnsignedShort();
+
+ int fields_count = cr.readUnsignedShort();
+ fields = new Field[fields_count];
+ for (int i = 0; i < fields_count; i++)
+ fields[i] = new Field(cr);
+
+ int methods_count = cr.readUnsignedShort();
+ methods = new Method[methods_count];
+ for (int i = 0; i < methods_count; i++)
+ methods[i] = new Method(cr);
+
+ attributes = new Attributes(cr);
+ }
+
+ public ClassFile(int magic, int minor_version, int major_version,
+ ConstantPool constant_pool, AccessFlags access_flags,
+ int this_class, int super_class, int[] interfaces,
+ Field[] fields, Method[] methods, Attributes attributes) {
+ this.magic = magic;
+ this.minor_version = minor_version;
+ this.major_version = major_version;
+ this.constant_pool = constant_pool;
+ this.access_flags = access_flags;
+ this.this_class = this_class;
+ this.super_class = super_class;
+ this.interfaces = interfaces;
+ this.fields = fields;
+ this.methods = methods;
+ this.attributes = attributes;
+ }
+
+ public String getName() throws ConstantPoolException {
+ return constant_pool.getClassInfo(this_class).getName();
+ }
+
+ public String getSuperclassName() throws ConstantPoolException {
+ return constant_pool.getClassInfo(super_class).getName();
+ }
+
+ public String getInterfaceName(int i) throws ConstantPoolException {
+ return constant_pool.getClassInfo(interfaces[i]).getName();
+ }
+
+ public Attribute getAttribute(String name) {
+ return attributes.get(name);
+ }
+
+ public boolean isClass() {
+ return !isInterface();
+ }
+
+ public boolean isInterface() {
+ return access_flags.is(ACC_INTERFACE);
+ }
+
+ public int byteLength() {
+ return 4 + // magic
+ 2 + // minor
+ 2 + // major
+ constant_pool.byteLength() +
+ 2 + // access flags
+ 2 + // this_class
+ 2 + // super_class
+ byteLength(interfaces) +
+ byteLength(fields) +
+ byteLength(methods) +
+ attributes.byteLength();
+ }
+
+ private int byteLength(int[] indices) {
+ return 2 + 2 * indices.length;
+ }
+
+ private int byteLength(Field[] fields) {
+ int length = 2;
+ for (Field f: fields)
+ length += f.byteLength();
+ return length;
+ }
+
+ private int byteLength(Method[] methods) {
+ int length = 2;
+ for (Method m: methods)
+ length += m.byteLength();
+ return length;
+ }
+
+ public final int magic;
+ public final int minor_version;
+ public final int major_version;
+ public final ConstantPool constant_pool;
+ public final AccessFlags access_flags;
+ public final int this_class;
+ public final int super_class;
+ public final int[] interfaces;
+ public final Field[] fields;
+ public final Method[] methods;
+ public final Attributes attributes;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassReader.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Objects;
+
+/**
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class ClassReader {
+ ClassReader(ClassFile classFile, InputStream in, Attribute.Factory attributeFactory) throws IOException {
+ this.classFile = Objects.requireNonNull(classFile);
+ this.attributeFactory = Objects.requireNonNull(attributeFactory);
+ this.in = new DataInputStream(new BufferedInputStream(in));
+ }
+
+ ClassFile getClassFile() {
+ return classFile;
+ }
+
+ ConstantPool getConstantPool() {
+ return classFile.constant_pool;
+ }
+
+ public Attribute readAttribute() throws IOException {
+ int name_index = readUnsignedShort();
+ int length = readInt();
+ byte[] data = new byte[length];
+ readFully(data);
+
+ DataInputStream prev = in;
+ in = new DataInputStream(new ByteArrayInputStream(data));
+ try {
+ return attributeFactory.createAttribute(this, name_index, data);
+ } finally {
+ in = prev;
+ }
+ }
+
+ public void readFully(byte[] b) throws IOException {
+ in.readFully(b);
+ }
+
+ public int readUnsignedByte() throws IOException {
+ return in.readUnsignedByte();
+ }
+
+ public int readUnsignedShort() throws IOException {
+ return in.readUnsignedShort();
+ }
+
+ public int readInt() throws IOException {
+ return in.readInt();
+ }
+
+ public long readLong() throws IOException {
+ return in.readLong();
+ }
+
+ public float readFloat() throws IOException {
+ return in.readFloat();
+ }
+
+ public double readDouble() throws IOException {
+ return in.readDouble();
+ }
+
+ public String readUTF() throws IOException {
+ return in.readUTF();
+ }
+
+ private DataInputStream in;
+ private ClassFile classFile;
+ private Attribute.Factory attributeFactory;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassTranslator.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,410 @@
+/*
+ * Copyright (c) 2008, 2012, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.util.Map;
+
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Double_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Fieldref_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Float_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Integer_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_InterfaceMethodref_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_InvokeDynamic_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Long_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodHandle_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_MethodType_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Methodref_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_NameAndType_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_String_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info;
+import com.sun.tools.classfile.ConstantPool.CPInfo;
+
+/**
+ * Rewrites a class file using a map of translations.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class ClassTranslator
+ implements ConstantPool.Visitor<ConstantPool.CPInfo,Map<Object,Object>> {
+ /**
+ * Create a new ClassFile from {@code cf}, such that for all entries
+ * {@code k -\> v} in {@code translations},
+ * each occurrence of {@code k} in {@code cf} will be replaced by {@code v}.
+ * in
+ * @param cf the class file to be processed
+ * @param translations the set of translations to be applied
+ * @return a copy of {@code} with the values in {@code translations} substituted
+ */
+ public ClassFile translate(ClassFile cf, Map<Object,Object> translations) {
+ ClassFile cf2 = (ClassFile) translations.get(cf);
+ if (cf2 == null) {
+ ConstantPool constant_pool2 = translate(cf.constant_pool, translations);
+ Field[] fields2 = translate(cf.fields, cf.constant_pool, translations);
+ Method[] methods2 = translateMethods(cf.methods, cf.constant_pool, translations);
+ Attributes attributes2 = translateAttributes(cf.attributes, cf.constant_pool,
+ translations);
+
+ if (constant_pool2 == cf.constant_pool &&
+ fields2 == cf.fields &&
+ methods2 == cf.methods &&
+ attributes2 == cf.attributes)
+ cf2 = cf;
+ else
+ cf2 = new ClassFile(
+ cf.magic,
+ cf.minor_version,
+ cf.major_version,
+ constant_pool2,
+ cf.access_flags,
+ cf.this_class,
+ cf.super_class,
+ cf.interfaces,
+ fields2,
+ methods2,
+ attributes2);
+ translations.put(cf, cf2);
+ }
+ return cf2;
+ }
+
+ ConstantPool translate(ConstantPool cp, Map<Object,Object> translations) {
+ ConstantPool cp2 = (ConstantPool) translations.get(cp);
+ if (cp2 == null) {
+ ConstantPool.CPInfo[] pool2 = new ConstantPool.CPInfo[cp.size()];
+ boolean eq = true;
+ for (int i = 0; i < cp.size(); ) {
+ ConstantPool.CPInfo cpInfo;
+ try {
+ cpInfo = cp.get(i);
+ } catch (ConstantPool.InvalidIndex e) {
+ throw new IllegalStateException(e);
+ }
+ ConstantPool.CPInfo cpInfo2 = translate(cpInfo, translations);
+ eq &= (cpInfo == cpInfo2);
+ pool2[i] = cpInfo2;
+ if (cpInfo.getTag() != cpInfo2.getTag())
+ throw new IllegalStateException();
+ i += cpInfo.size();
+ }
+
+ if (eq)
+ cp2 = cp;
+ else
+ cp2 = new ConstantPool(pool2);
+
+ translations.put(cp, cp2);
+ }
+ return cp2;
+ }
+
+ ConstantPool.CPInfo translate(ConstantPool.CPInfo cpInfo, Map<Object,Object> translations) {
+ ConstantPool.CPInfo cpInfo2 = (ConstantPool.CPInfo) translations.get(cpInfo);
+ if (cpInfo2 == null) {
+ cpInfo2 = cpInfo.accept(this, translations);
+ translations.put(cpInfo, cpInfo2);
+ }
+ return cpInfo2;
+ }
+
+ Field[] translate(Field[] fields, ConstantPool constant_pool, Map<Object,Object> translations) {
+ Field[] fields2 = (Field[]) translations.get(fields);
+ if (fields2 == null) {
+ fields2 = new Field[fields.length];
+ for (int i = 0; i < fields.length; i++)
+ fields2[i] = translate(fields[i], constant_pool, translations);
+ if (equal(fields, fields2))
+ fields2 = fields;
+ translations.put(fields, fields2);
+ }
+ return fields2;
+ }
+
+ Field translate(Field field, ConstantPool constant_pool, Map<Object,Object> translations) {
+ Field field2 = (Field) translations.get(field);
+ if (field2 == null) {
+ Attributes attributes2 = translateAttributes(field.attributes, constant_pool,
+ translations);
+
+ if (attributes2 == field.attributes)
+ field2 = field;
+ else
+ field2 = new Field(
+ field.access_flags,
+ field.name_index,
+ field.descriptor,
+ attributes2);
+ translations.put(field, field2);
+ }
+ return field2;
+ }
+
+ Method[] translateMethods(Method[] methods, ConstantPool constant_pool, Map<Object,Object> translations) {
+ Method[] methods2 = (Method[]) translations.get(methods);
+ if (methods2 == null) {
+ methods2 = new Method[methods.length];
+ for (int i = 0; i < methods.length; i++)
+ methods2[i] = translate(methods[i], constant_pool, translations);
+ if (equal(methods, methods2))
+ methods2 = methods;
+ translations.put(methods, methods2);
+ }
+ return methods2;
+ }
+
+ Method translate(Method method, ConstantPool constant_pool, Map<Object,Object> translations) {
+ Method method2 = (Method) translations.get(method);
+ if (method2 == null) {
+ Attributes attributes2 = translateAttributes(method.attributes, constant_pool,
+ translations);
+
+ if (attributes2 == method.attributes)
+ method2 = method;
+ else
+ method2 = new Method(
+ method.access_flags,
+ method.name_index,
+ method.descriptor,
+ attributes2);
+ translations.put(method, method2);
+ }
+ return method2;
+ }
+
+ Attributes translateAttributes(Attributes attributes,
+ ConstantPool constant_pool, Map<Object,Object> translations) {
+ Attributes attributes2 = (Attributes) translations.get(attributes);
+ if (attributes2 == null) {
+ Attribute[] attrArray2 = new Attribute[attributes.size()];
+ ConstantPool constant_pool2 = translate(constant_pool, translations);
+ boolean attrsEqual = true;
+ for (int i = 0; i < attributes.size(); i++) {
+ Attribute attr = attributes.get(i);
+ Attribute attr2 = translate(attr, translations);
+ if (attr2 != attr)
+ attrsEqual = false;
+ attrArray2[i] = attr2;
+ }
+ if ((constant_pool2 == constant_pool) && attrsEqual)
+ attributes2 = attributes;
+ else
+ attributes2 = new Attributes(constant_pool2, attrArray2);
+ translations.put(attributes, attributes2);
+ }
+ return attributes2;
+ }
+
+ Attribute translate(Attribute attribute, Map<Object,Object> translations) {
+ Attribute attribute2 = (Attribute) translations.get(attribute);
+ if (attribute2 == null) {
+ attribute2 = attribute; // don't support translation within attributes yet
+ // (what about Code attribute)
+ translations.put(attribute, attribute2);
+ }
+ return attribute2;
+ }
+
+ private static <T> boolean equal(T[] a1, T[] a2) {
+ if (a1 == null || a2 == null)
+ return (a1 == a2);
+ if (a1.length != a2.length)
+ return false;
+ for (int i = 0; i < a1.length; i++) {
+ if (a1[i] != a2[i])
+ return false;
+ }
+ return true;
+ }
+
+ public CPInfo visitClass(CONSTANT_Class_info info, Map<Object, Object> translations) {
+ CONSTANT_Class_info info2 = (CONSTANT_Class_info) translations.get(info);
+ if (info2 == null) {
+ ConstantPool cp2 = translate(info.cp, translations);
+ if (cp2 == info.cp)
+ info2 = info;
+ else
+ info2 = new CONSTANT_Class_info(cp2, info.name_index);
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitDouble(CONSTANT_Double_info info, Map<Object, Object> translations) {
+ CONSTANT_Double_info info2 = (CONSTANT_Double_info) translations.get(info);
+ if (info2 == null) {
+ info2 = info;
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitFieldref(CONSTANT_Fieldref_info info, Map<Object, Object> translations) {
+ CONSTANT_Fieldref_info info2 = (CONSTANT_Fieldref_info) translations.get(info);
+ if (info2 == null) {
+ ConstantPool cp2 = translate(info.cp, translations);
+ if (cp2 == info.cp)
+ info2 = info;
+ else
+ info2 = new CONSTANT_Fieldref_info(cp2, info.class_index, info.name_and_type_index);
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitFloat(CONSTANT_Float_info info, Map<Object, Object> translations) {
+ CONSTANT_Float_info info2 = (CONSTANT_Float_info) translations.get(info);
+ if (info2 == null) {
+ info2 = info;
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitInteger(CONSTANT_Integer_info info, Map<Object, Object> translations) {
+ CONSTANT_Integer_info info2 = (CONSTANT_Integer_info) translations.get(info);
+ if (info2 == null) {
+ info2 = info;
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Map<Object, Object> translations) {
+ CONSTANT_InterfaceMethodref_info info2 = (CONSTANT_InterfaceMethodref_info) translations.get(info);
+ if (info2 == null) {
+ ConstantPool cp2 = translate(info.cp, translations);
+ if (cp2 == info.cp)
+ info2 = info;
+ else
+ info2 = new CONSTANT_InterfaceMethodref_info(cp2, info.class_index, info.name_and_type_index);
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Map<Object, Object> translations) {
+ CONSTANT_InvokeDynamic_info info2 = (CONSTANT_InvokeDynamic_info) translations.get(info);
+ if (info2 == null) {
+ ConstantPool cp2 = translate(info.cp, translations);
+ if (cp2 == info.cp) {
+ info2 = info;
+ } else {
+ info2 = new CONSTANT_InvokeDynamic_info(cp2, info.bootstrap_method_attr_index, info.name_and_type_index);
+ }
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitLong(CONSTANT_Long_info info, Map<Object, Object> translations) {
+ CONSTANT_Long_info info2 = (CONSTANT_Long_info) translations.get(info);
+ if (info2 == null) {
+ info2 = info;
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitNameAndType(CONSTANT_NameAndType_info info, Map<Object, Object> translations) {
+ CONSTANT_NameAndType_info info2 = (CONSTANT_NameAndType_info) translations.get(info);
+ if (info2 == null) {
+ ConstantPool cp2 = translate(info.cp, translations);
+ if (cp2 == info.cp)
+ info2 = info;
+ else
+ info2 = new CONSTANT_NameAndType_info(cp2, info.name_index, info.type_index);
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitMethodref(CONSTANT_Methodref_info info, Map<Object, Object> translations) {
+ CONSTANT_Methodref_info info2 = (CONSTANT_Methodref_info) translations.get(info);
+ if (info2 == null) {
+ ConstantPool cp2 = translate(info.cp, translations);
+ if (cp2 == info.cp)
+ info2 = info;
+ else
+ info2 = new CONSTANT_Methodref_info(cp2, info.class_index, info.name_and_type_index);
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitMethodHandle(CONSTANT_MethodHandle_info info, Map<Object, Object> translations) {
+ CONSTANT_MethodHandle_info info2 = (CONSTANT_MethodHandle_info) translations.get(info);
+ if (info2 == null) {
+ ConstantPool cp2 = translate(info.cp, translations);
+ if (cp2 == info.cp) {
+ info2 = info;
+ } else {
+ info2 = new CONSTANT_MethodHandle_info(cp2, info.reference_kind, info.reference_index);
+ }
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitMethodType(CONSTANT_MethodType_info info, Map<Object, Object> translations) {
+ CONSTANT_MethodType_info info2 = (CONSTANT_MethodType_info) translations.get(info);
+ if (info2 == null) {
+ ConstantPool cp2 = translate(info.cp, translations);
+ if (cp2 == info.cp) {
+ info2 = info;
+ } else {
+ info2 = new CONSTANT_MethodType_info(cp2, info.descriptor_index);
+ }
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitString(CONSTANT_String_info info, Map<Object, Object> translations) {
+ CONSTANT_String_info info2 = (CONSTANT_String_info) translations.get(info);
+ if (info2 == null) {
+ ConstantPool cp2 = translate(info.cp, translations);
+ if (cp2 == info.cp)
+ info2 = info;
+ else
+ info2 = new CONSTANT_String_info(cp2, info.string_index);
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+ public CPInfo visitUtf8(CONSTANT_Utf8_info info, Map<Object, Object> translations) {
+ CONSTANT_Utf8_info info2 = (CONSTANT_Utf8_info) translations.get(info);
+ if (info2 == null) {
+ info2 = info;
+ translations.put(info, info2);
+ }
+ return info;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,808 @@
+
+/*
+ * Copyright (c) 2008, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import static com.sun.tools.classfile.Annotation.*;
+import static com.sun.tools.classfile.ConstantPool.*;
+import static com.sun.tools.classfile.StackMapTable_attribute.*;
+import static com.sun.tools.classfile.StackMapTable_attribute.verification_type_info.*;
+
+/**
+ * Write a ClassFile data structure to a file or stream.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class ClassWriter {
+ public ClassWriter() {
+ attributeWriter = new AttributeWriter();
+ constantPoolWriter = new ConstantPoolWriter();
+ out = new ClassOutputStream();
+ }
+
+ /**
+ * Write a ClassFile data structure to a file.
+ */
+ public void write(ClassFile classFile, File f) throws IOException {
+ try (FileOutputStream f_out = new FileOutputStream(f)) {
+ write(classFile, f_out);
+ }
+ }
+
+ /**
+ * Write a ClassFile data structure to a stream.
+ */
+ public void write(ClassFile classFile, OutputStream s) throws IOException {
+ this.classFile = classFile;
+ out.reset();
+ write();
+ out.writeTo(s);
+ }
+
+ protected void write() throws IOException {
+ writeHeader();
+ writeConstantPool();
+ writeAccessFlags(classFile.access_flags);
+ writeClassInfo();
+ writeFields();
+ writeMethods();
+ writeAttributes(classFile.attributes);
+ }
+
+ protected void writeHeader() {
+ out.writeInt(classFile.magic);
+ out.writeShort(classFile.minor_version);
+ out.writeShort(classFile.major_version);
+ }
+
+ protected void writeAccessFlags(AccessFlags flags) {
+ out.writeShort(flags.flags);
+ }
+
+ protected void writeAttributes(Attributes attributes) {
+ int size = attributes.size();
+ out.writeShort(size);
+ for (Attribute attr: attributes)
+ attributeWriter.write(attr, out);
+ }
+
+ protected void writeClassInfo() {
+ out.writeShort(classFile.this_class);
+ out.writeShort(classFile.super_class);
+ int[] interfaces = classFile.interfaces;
+ out.writeShort(interfaces.length);
+ for (int i: interfaces)
+ out.writeShort(i);
+ }
+
+ protected void writeDescriptor(Descriptor d) {
+ out.writeShort(d.index);
+ }
+
+ protected void writeConstantPool() {
+ ConstantPool pool = classFile.constant_pool;
+ int size = pool.size();
+ out.writeShort(size);
+ for (CPInfo cpInfo: pool.entries())
+ constantPoolWriter.write(cpInfo, out);
+ }
+
+ protected void writeFields() throws IOException {
+ Field[] fields = classFile.fields;
+ out.writeShort(fields.length);
+ for (Field f: fields)
+ writeField(f);
+ }
+
+ protected void writeField(Field f) throws IOException {
+ writeAccessFlags(f.access_flags);
+ out.writeShort(f.name_index);
+ writeDescriptor(f.descriptor);
+ writeAttributes(f.attributes);
+ }
+
+ protected void writeMethods() throws IOException {
+ Method[] methods = classFile.methods;
+ out.writeShort(methods.length);
+ for (Method m: methods) {
+ writeMethod(m);
+ }
+ }
+
+ protected void writeMethod(Method m) throws IOException {
+ writeAccessFlags(m.access_flags);
+ out.writeShort(m.name_index);
+ writeDescriptor(m.descriptor);
+ writeAttributes(m.attributes);
+ }
+
+ protected ClassFile classFile;
+ protected ClassOutputStream out;
+ protected AttributeWriter attributeWriter;
+ protected ConstantPoolWriter constantPoolWriter;
+
+ /**
+ * Subtype of ByteArrayOutputStream with the convenience methods of
+ * a DataOutputStream. Since ByteArrayOutputStream does not throw
+ * IOException, there are no exceptions from the additional
+ * convenience methods either,
+ */
+ protected static class ClassOutputStream extends ByteArrayOutputStream {
+ public ClassOutputStream() {
+ d = new DataOutputStream(this);
+ }
+
+ public void writeByte(int value) {
+ try {
+ d.writeByte(value);
+ } catch (IOException ignore) {
+ }
+ }
+
+ public void writeShort(int value) {
+ try {
+ d.writeShort(value);
+ } catch (IOException ignore) {
+ }
+ }
+
+ public void writeInt(int value) {
+ try {
+ d.writeInt(value);
+ } catch (IOException ignore) {
+ }
+ }
+
+ public void writeLong(long value) {
+ try {
+ d.writeLong(value);
+ } catch (IOException ignore) {
+ }
+ }
+
+ public void writeFloat(float value) {
+ try {
+ d.writeFloat(value);
+ } catch (IOException ignore) {
+ }
+ }
+
+ public void writeDouble(double value) {
+ try {
+ d.writeDouble(value);
+ } catch (IOException ignore) {
+ }
+ }
+
+ public void writeUTF(String value) {
+ try {
+ d.writeUTF(value);
+ } catch (IOException ignore) {
+ }
+ }
+
+ public void writeTo(ClassOutputStream s) {
+ try {
+ super.writeTo(s);
+ } catch (IOException ignore) {
+ }
+ }
+
+ private DataOutputStream d;
+ }
+
+ /**
+ * Writer for the entries in the constant pool.
+ */
+ protected static class ConstantPoolWriter
+ implements ConstantPool.Visitor<Integer,ClassOutputStream> {
+ protected int write(CPInfo info, ClassOutputStream out) {
+ out.writeByte(info.getTag());
+ return info.accept(this, out);
+ }
+
+ public Integer visitClass(CONSTANT_Class_info info, ClassOutputStream out) {
+ out.writeShort(info.name_index);
+ return 1;
+ }
+
+ public Integer visitDouble(CONSTANT_Double_info info, ClassOutputStream out) {
+ out.writeDouble(info.value);
+ return 2;
+ }
+
+ public Integer visitFieldref(CONSTANT_Fieldref_info info, ClassOutputStream out) {
+ writeRef(info, out);
+ return 1;
+ }
+
+ public Integer visitFloat(CONSTANT_Float_info info, ClassOutputStream out) {
+ out.writeFloat(info.value);
+ return 1;
+ }
+
+ public Integer visitInteger(CONSTANT_Integer_info info, ClassOutputStream out) {
+ out.writeInt(info.value);
+ return 1;
+ }
+
+ public Integer visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, ClassOutputStream out) {
+ writeRef(info, out);
+ return 1;
+ }
+
+ public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, ClassOutputStream out) {
+ out.writeShort(info.bootstrap_method_attr_index);
+ out.writeShort(info.name_and_type_index);
+ return 1;
+ }
+
+ public Integer visitLong(CONSTANT_Long_info info, ClassOutputStream out) {
+ out.writeLong(info.value);
+ return 2;
+ }
+
+ public Integer visitNameAndType(CONSTANT_NameAndType_info info, ClassOutputStream out) {
+ out.writeShort(info.name_index);
+ out.writeShort(info.type_index);
+ return 1;
+ }
+
+ public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, ClassOutputStream out) {
+ out.writeByte(info.reference_kind.tag);
+ out.writeShort(info.reference_index);
+ return 1;
+ }
+
+ public Integer visitMethodType(CONSTANT_MethodType_info info, ClassOutputStream out) {
+ out.writeShort(info.descriptor_index);
+ return 1;
+ }
+
+ public Integer visitMethodref(CONSTANT_Methodref_info info, ClassOutputStream out) {
+ return writeRef(info, out);
+ }
+
+ public Integer visitString(CONSTANT_String_info info, ClassOutputStream out) {
+ out.writeShort(info.string_index);
+ return 1;
+ }
+
+ public Integer visitUtf8(CONSTANT_Utf8_info info, ClassOutputStream out) {
+ out.writeUTF(info.value);
+ return 1;
+ }
+
+ protected Integer writeRef(CPRefInfo info, ClassOutputStream out) {
+ out.writeShort(info.class_index);
+ out.writeShort(info.name_and_type_index);
+ return 1;
+ }
+ }
+
+ /**
+ * Writer for the different types of attribute.
+ */
+ protected static class AttributeWriter implements Attribute.Visitor<Void,ClassOutputStream> {
+ public void write(Attributes attributes, ClassOutputStream out) {
+ int size = attributes.size();
+ out.writeShort(size);
+ for (Attribute a: attributes)
+ write(a, out);
+ }
+
+ // Note: due to the use of shared resources, this method is not reentrant.
+ public void write(Attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.attribute_name_index);
+ sharedOut.reset();
+ attr.accept(this, sharedOut);
+ out.writeInt(sharedOut.size());
+ sharedOut.writeTo(out);
+ }
+
+ protected ClassOutputStream sharedOut = new ClassOutputStream();
+ protected AnnotationWriter annotationWriter = new AnnotationWriter();
+
+ public Void visitDefault(DefaultAttribute attr, ClassOutputStream out) {
+ out.write(attr.info, 0, attr.info.length);
+ return null;
+ }
+
+ public Void visitAnnotationDefault(AnnotationDefault_attribute attr, ClassOutputStream out) {
+ annotationWriter.write(attr.default_value, out);
+ return null;
+ }
+
+ public Void visitBootstrapMethods(BootstrapMethods_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.bootstrap_method_specifiers.length);
+ for (BootstrapMethods_attribute.BootstrapMethodSpecifier bsm : attr.bootstrap_method_specifiers) {
+ out.writeShort(bsm.bootstrap_method_ref);
+ int bsm_args_count = bsm.bootstrap_arguments.length;
+ out.writeShort(bsm_args_count);
+ for (int i : bsm.bootstrap_arguments) {
+ out.writeShort(i);
+ }
+ }
+ return null;
+ }
+
+ public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.character_range_table.length);
+ for (CharacterRangeTable_attribute.Entry e: attr.character_range_table)
+ writeCharacterRangeTableEntry(e, out);
+ return null;
+ }
+
+ protected void writeCharacterRangeTableEntry(CharacterRangeTable_attribute.Entry entry, ClassOutputStream out) {
+ out.writeShort(entry.start_pc);
+ out.writeShort(entry.end_pc);
+ out.writeInt(entry.character_range_start);
+ out.writeInt(entry.character_range_end);
+ out.writeShort(entry.flags);
+ }
+
+ public Void visitCode(Code_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.max_stack);
+ out.writeShort(attr.max_locals);
+ out.writeInt(attr.code.length);
+ out.write(attr.code, 0, attr.code.length);
+ out.writeShort(attr.exception_table.length);
+ for (Code_attribute.Exception_data e: attr.exception_table)
+ writeExceptionTableEntry(e, out);
+ new AttributeWriter().write(attr.attributes, out);
+ return null;
+ }
+
+ protected void writeExceptionTableEntry(Code_attribute.Exception_data exception_data, ClassOutputStream out) {
+ out.writeShort(exception_data.start_pc);
+ out.writeShort(exception_data.end_pc);
+ out.writeShort(exception_data.handler_pc);
+ out.writeShort(exception_data.catch_type);
+ }
+
+ public Void visitCompilationID(CompilationID_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.compilationID_index);
+ return null;
+ }
+
+ public Void visitConstantValue(ConstantValue_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.constantvalue_index);
+ return null;
+ }
+
+ public Void visitDeprecated(Deprecated_attribute attr, ClassOutputStream out) {
+ return null;
+ }
+
+ public Void visitEnclosingMethod(EnclosingMethod_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.class_index);
+ out.writeShort(attr.method_index);
+ return null;
+ }
+
+ public Void visitExceptions(Exceptions_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.exception_index_table.length);
+ for (int i: attr.exception_index_table)
+ out.writeShort(i);
+ return null;
+ }
+
+ public Void visitInnerClasses(InnerClasses_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.classes.length);
+ for (InnerClasses_attribute.Info info: attr.classes)
+ writeInnerClassesInfo(info, out);
+ return null;
+ }
+
+ protected void writeInnerClassesInfo(InnerClasses_attribute.Info info, ClassOutputStream out) {
+ out.writeShort(info.inner_class_info_index);
+ out.writeShort(info.outer_class_info_index);
+ out.writeShort(info.inner_name_index);
+ writeAccessFlags(info.inner_class_access_flags, out);
+ }
+
+ public Void visitLineNumberTable(LineNumberTable_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.line_number_table.length);
+ for (LineNumberTable_attribute.Entry e: attr.line_number_table)
+ writeLineNumberTableEntry(e, out);
+ return null;
+ }
+
+ protected void writeLineNumberTableEntry(LineNumberTable_attribute.Entry entry, ClassOutputStream out) {
+ out.writeShort(entry.start_pc);
+ out.writeShort(entry.line_number);
+ }
+
+ public Void visitLocalVariableTable(LocalVariableTable_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.local_variable_table.length);
+ for (LocalVariableTable_attribute.Entry e: attr.local_variable_table)
+ writeLocalVariableTableEntry(e, out);
+ return null;
+ }
+
+ protected void writeLocalVariableTableEntry(LocalVariableTable_attribute.Entry entry, ClassOutputStream out) {
+ out.writeShort(entry.start_pc);
+ out.writeShort(entry.length);
+ out.writeShort(entry.name_index);
+ out.writeShort(entry.descriptor_index);
+ out.writeShort(entry.index);
+ }
+
+ public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.local_variable_table.length);
+ for (LocalVariableTypeTable_attribute.Entry e: attr.local_variable_table)
+ writeLocalVariableTypeTableEntry(e, out);
+ return null;
+ }
+
+ protected void writeLocalVariableTypeTableEntry(LocalVariableTypeTable_attribute.Entry entry, ClassOutputStream out) {
+ out.writeShort(entry.start_pc);
+ out.writeShort(entry.length);
+ out.writeShort(entry.name_index);
+ out.writeShort(entry.signature_index);
+ out.writeShort(entry.index);
+ }
+
+ public Void visitMethodParameters(MethodParameters_attribute attr, ClassOutputStream out) {
+ out.writeByte(attr.method_parameter_table.length);
+ for (MethodParameters_attribute.Entry e : attr.method_parameter_table) {
+ out.writeShort(e.name_index);
+ out.writeShort(e.flags);
+ }
+ return null;
+ }
+
+ public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, ClassOutputStream out) {
+ annotationWriter.write(attr.annotations, out);
+ return null;
+ }
+
+ public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, ClassOutputStream out) {
+ annotationWriter.write(attr.annotations, out);
+ return null;
+ }
+
+ public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
+ annotationWriter.write(attr.annotations, out);
+ return null;
+ }
+
+ public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
+ annotationWriter.write(attr.annotations, out);
+ return null;
+ }
+
+ public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
+ out.writeByte(attr.parameter_annotations.length);
+ for (Annotation[] annos: attr.parameter_annotations)
+ annotationWriter.write(annos, out);
+ return null;
+ }
+
+ public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
+ out.writeByte(attr.parameter_annotations.length);
+ for (Annotation[] annos: attr.parameter_annotations)
+ annotationWriter.write(annos, out);
+ return null;
+ }
+
+ public Void visitSignature(Signature_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.signature_index);
+ return null;
+ }
+
+ public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr, ClassOutputStream out) {
+ out.write(attr.debug_extension, 0, attr.debug_extension.length);
+ return null;
+ }
+
+ public Void visitSourceFile(SourceFile_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.sourcefile_index);
+ return null;
+ }
+
+ public Void visitSourceID(SourceID_attribute attr, ClassOutputStream out) {
+ out.writeShort(attr.sourceID_index);
+ return null;
+ }
+
+ public Void visitStackMap(StackMap_attribute attr, ClassOutputStream out) {
+ if (stackMapWriter == null)
+ stackMapWriter = new StackMapTableWriter();
+
+ out.writeShort(attr.entries.length);
+ for (stack_map_frame f: attr.entries)
+ stackMapWriter.write(f, out);
+ return null;
+ }
+
+ public Void visitStackMapTable(StackMapTable_attribute attr, ClassOutputStream out) {
+ if (stackMapWriter == null)
+ stackMapWriter = new StackMapTableWriter();
+
+ out.writeShort(attr.entries.length);
+ for (stack_map_frame f: attr.entries)
+ stackMapWriter.write(f, out);
+ return null;
+ }
+
+ public Void visitSynthetic(Synthetic_attribute attr, ClassOutputStream out) {
+ return null;
+ }
+
+ protected void writeAccessFlags(AccessFlags flags, ClassOutputStream p) {
+ sharedOut.writeShort(flags.flags);
+ }
+
+ protected StackMapTableWriter stackMapWriter;
+ }
+
+ /**
+ * Writer for the frames of StackMap and StackMapTable attributes.
+ */
+ protected static class StackMapTableWriter
+ implements stack_map_frame.Visitor<Void,ClassOutputStream> {
+
+ public void write(stack_map_frame frame, ClassOutputStream out) {
+ out.write(frame.frame_type);
+ frame.accept(this, out);
+ }
+
+ public Void visit_same_frame(same_frame frame, ClassOutputStream p) {
+ return null;
+ }
+
+ public Void visit_same_locals_1_stack_item_frame(same_locals_1_stack_item_frame frame, ClassOutputStream out) {
+ writeVerificationTypeInfo(frame.stack[0], out);
+ return null;
+ }
+
+ public Void visit_same_locals_1_stack_item_frame_extended(same_locals_1_stack_item_frame_extended frame, ClassOutputStream out) {
+ out.writeShort(frame.offset_delta);
+ writeVerificationTypeInfo(frame.stack[0], out);
+ return null;
+ }
+
+ public Void visit_chop_frame(chop_frame frame, ClassOutputStream out) {
+ out.writeShort(frame.offset_delta);
+ return null;
+ }
+
+ public Void visit_same_frame_extended(same_frame_extended frame, ClassOutputStream out) {
+ out.writeShort(frame.offset_delta);
+ return null;
+ }
+
+ public Void visit_append_frame(append_frame frame, ClassOutputStream out) {
+ out.writeShort(frame.offset_delta);
+ for (verification_type_info l: frame.locals)
+ writeVerificationTypeInfo(l, out);
+ return null;
+ }
+
+ public Void visit_full_frame(full_frame frame, ClassOutputStream out) {
+ out.writeShort(frame.offset_delta);
+ out.writeShort(frame.locals.length);
+ for (verification_type_info l: frame.locals)
+ writeVerificationTypeInfo(l, out);
+ out.writeShort(frame.stack.length);
+ for (verification_type_info s: frame.stack)
+ writeVerificationTypeInfo(s, out);
+ return null;
+ }
+
+ protected void writeVerificationTypeInfo(verification_type_info info,
+ ClassOutputStream out) {
+ out.write(info.tag);
+ switch (info.tag) {
+ case ITEM_Top:
+ case ITEM_Integer:
+ case ITEM_Float:
+ case ITEM_Long:
+ case ITEM_Double:
+ case ITEM_Null:
+ case ITEM_UninitializedThis:
+ break;
+
+ case ITEM_Object:
+ Object_variable_info o = (Object_variable_info) info;
+ out.writeShort(o.cpool_index);
+ break;
+
+ case ITEM_Uninitialized:
+ Uninitialized_variable_info u = (Uninitialized_variable_info) info;
+ out.writeShort(u.offset);
+ break;
+
+ default:
+ throw new Error();
+ }
+ }
+ }
+
+ /**
+ * Writer for annotations and the values they contain.
+ */
+ protected static class AnnotationWriter
+ implements Annotation.element_value.Visitor<Void,ClassOutputStream> {
+ public void write(Annotation[] annos, ClassOutputStream out) {
+ out.writeShort(annos.length);
+ for (Annotation anno: annos)
+ write(anno, out);
+ }
+
+ public void write(TypeAnnotation[] annos, ClassOutputStream out) {
+ out.writeShort(annos.length);
+ for (TypeAnnotation anno: annos)
+ write(anno, out);
+ }
+
+ public void write(Annotation anno, ClassOutputStream out) {
+ out.writeShort(anno.type_index);
+ out.writeShort(anno.element_value_pairs.length);
+ for (element_value_pair p: anno.element_value_pairs)
+ write(p, out);
+ }
+
+ public void write(TypeAnnotation anno, ClassOutputStream out) {
+ write(anno.position, out);
+ write(anno.annotation, out);
+ }
+
+ public void write(element_value_pair pair, ClassOutputStream out) {
+ out.writeShort(pair.element_name_index);
+ write(pair.value, out);
+ }
+
+ public void write(element_value ev, ClassOutputStream out) {
+ out.writeByte(ev.tag);
+ ev.accept(this, out);
+ }
+
+ public Void visitPrimitive(Primitive_element_value ev, ClassOutputStream out) {
+ out.writeShort(ev.const_value_index);
+ return null;
+ }
+
+ public Void visitEnum(Enum_element_value ev, ClassOutputStream out) {
+ out.writeShort(ev.type_name_index);
+ out.writeShort(ev.const_name_index);
+ return null;
+ }
+
+ public Void visitClass(Class_element_value ev, ClassOutputStream out) {
+ out.writeShort(ev.class_info_index);
+ return null;
+ }
+
+ public Void visitAnnotation(Annotation_element_value ev, ClassOutputStream out) {
+ write(ev.annotation_value, out);
+ return null;
+ }
+
+ public Void visitArray(Array_element_value ev, ClassOutputStream out) {
+ out.writeShort(ev.num_values);
+ for (element_value v: ev.values)
+ write(v, out);
+ return null;
+ }
+
+ // TODO: Move this to TypeAnnotation to be closer with similar logic?
+ private void write(TypeAnnotation.Position p, ClassOutputStream out) {
+ out.writeByte(p.type.targetTypeValue());
+ switch (p.type) {
+ // instanceof
+ case INSTANCEOF:
+ // new expression
+ case NEW:
+ // constructor/method reference receiver
+ case CONSTRUCTOR_REFERENCE:
+ case METHOD_REFERENCE:
+ out.writeShort(p.offset);
+ break;
+ // local variable
+ case LOCAL_VARIABLE:
+ // resource variable
+ case RESOURCE_VARIABLE:
+ int table_length = p.lvarOffset.length;
+ out.writeShort(table_length);
+ for (int i = 0; i < table_length; ++i) {
+ out.writeShort(1); // for table length
+ out.writeShort(p.lvarOffset[i]);
+ out.writeShort(p.lvarLength[i]);
+ out.writeShort(p.lvarIndex[i]);
+ }
+ break;
+ // exception parameter
+ case EXCEPTION_PARAMETER:
+ out.writeShort(p.exception_index);
+ break;
+ // method receiver
+ case METHOD_RECEIVER:
+ // Do nothing
+ break;
+ // type parameters
+ case CLASS_TYPE_PARAMETER:
+ case METHOD_TYPE_PARAMETER:
+ out.writeByte(p.parameter_index);
+ break;
+ // type parameters bounds
+ case CLASS_TYPE_PARAMETER_BOUND:
+ case METHOD_TYPE_PARAMETER_BOUND:
+ out.writeByte(p.parameter_index);
+ out.writeByte(p.bound_index);
+ break;
+ // class extends or implements clause
+ case CLASS_EXTENDS:
+ out.writeShort(p.type_index);
+ break;
+ // throws
+ case THROWS:
+ out.writeShort(p.type_index);
+ break;
+ // method parameter
+ case METHOD_FORMAL_PARAMETER:
+ out.writeByte(p.parameter_index);
+ break;
+ // type cast
+ case CAST:
+ // method/constructor/reference type argument
+ case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+ case METHOD_INVOCATION_TYPE_ARGUMENT:
+ case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+ case METHOD_REFERENCE_TYPE_ARGUMENT:
+ out.writeShort(p.offset);
+ out.writeByte(p.type_index);
+ break;
+ // We don't need to worry about these
+ case METHOD_RETURN:
+ case FIELD:
+ break;
+ case UNKNOWN:
+ throw new AssertionError("ClassWriter: UNKNOWN target type should never occur!");
+ default:
+ throw new AssertionError("ClassWriter: Unknown target type for position: " + p);
+ }
+
+ { // Append location data for generics/arrays.
+ // TODO: check for overrun?
+ out.writeByte((byte)p.location.size());
+ for (int i : TypeAnnotation.Position.getBinaryFromTypePath(p.location))
+ out.writeByte((byte)i);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Code_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * See JVMS, section 4.8.3.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Code_attribute extends Attribute {
+ public static class InvalidIndex extends AttributeException {
+ private static final long serialVersionUID = -8904527774589382802L;
+ InvalidIndex(int index) {
+ this.index = index;
+ }
+
+ @Override
+ public String getMessage() {
+ // i18n
+ return "invalid index " + index + " in Code attribute";
+ }
+
+ public final int index;
+ }
+
+ Code_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, ConstantPoolException {
+ super(name_index, length);
+ max_stack = cr.readUnsignedShort();
+ max_locals = cr.readUnsignedShort();
+ code_length = cr.readInt();
+ code = new byte[code_length];
+ cr.readFully(code);
+ exception_table_length = cr.readUnsignedShort();
+ exception_table = new Exception_data[exception_table_length];
+ for (int i = 0; i < exception_table_length; i++)
+ exception_table[i] = new Exception_data(cr);
+ attributes = new Attributes(cr);
+ }
+
+ public int getByte(int offset) throws InvalidIndex {
+ if (offset < 0 || offset >= code.length)
+ throw new InvalidIndex(offset);
+ return code[offset];
+ }
+
+ public int getUnsignedByte(int offset) throws InvalidIndex {
+ if (offset < 0 || offset >= code.length)
+ throw new InvalidIndex(offset);
+ return code[offset] & 0xff;
+ }
+
+ public int getShort(int offset) throws InvalidIndex {
+ if (offset < 0 || offset + 1 >= code.length)
+ throw new InvalidIndex(offset);
+ return (code[offset] << 8) | (code[offset + 1] & 0xFF);
+ }
+
+ public int getUnsignedShort(int offset) throws InvalidIndex {
+ if (offset < 0 || offset + 1 >= code.length)
+ throw new InvalidIndex(offset);
+ return ((code[offset] << 8) | (code[offset + 1] & 0xFF)) & 0xFFFF;
+ }
+
+ public int getInt(int offset) throws InvalidIndex {
+ if (offset < 0 || offset + 3 >= code.length)
+ throw new InvalidIndex(offset);
+ return (getShort(offset) << 16) | (getShort(offset + 2) & 0xFFFF);
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitCode(this, data);
+ }
+
+ public Iterable<Instruction> getInstructions() {
+ return new Iterable<Instruction>() {
+ public Iterator<Instruction> iterator() {
+ return new Iterator<Instruction>() {
+
+ public boolean hasNext() {
+ return (next != null);
+ }
+
+ public Instruction next() {
+ if (next == null)
+ throw new NoSuchElementException();
+
+ current = next;
+ pc += current.length();
+ next = (pc < code.length ? new Instruction(code, pc) : null);
+ return current;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("Not supported.");
+ }
+
+ Instruction current = null;
+ int pc = 0;
+ Instruction next = new Instruction(code, pc);
+
+ };
+ }
+
+ };
+ }
+
+ public final int max_stack;
+ public final int max_locals;
+ public final int code_length;
+ public final byte[] code;
+ public final int exception_table_length;
+ public final Exception_data[] exception_table;
+ public final Attributes attributes;
+
+ public static class Exception_data {
+ Exception_data(ClassReader cr) throws IOException {
+ start_pc = cr.readUnsignedShort();
+ end_pc = cr.readUnsignedShort();
+ handler_pc = cr.readUnsignedShort();
+ catch_type = cr.readUnsignedShort();
+ }
+
+ public final int start_pc;
+ public final int end_pc;
+ public final int handler_pc;
+ public final int catch_type;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/CompilationID_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2008, 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.
+ */
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class CompilationID_attribute extends Attribute {
+
+ CompilationID_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ compilationID_index = cr.readUnsignedShort();
+ }
+
+ public CompilationID_attribute(ConstantPool constant_pool, int compilationID_index)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.CompilationID), compilationID_index);
+ }
+
+ public CompilationID_attribute(int name_index, int compilationID_index) {
+ super(name_index, 2);
+ this.compilationID_index = compilationID_index;
+ }
+
+ String getCompilationID(ConstantPool constant_pool)
+ throws ConstantPoolException {
+ return constant_pool.getUTF8Value(compilationID_index);
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitCompilationID(this, data);
+ }
+
+ public final int compilationID_index;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantPool.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,914 @@
+/*
+ * Copyright (c) 2007, 2011, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+/**
+ * See JVMS, section 4.5.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class ConstantPool {
+
+ public static class InvalidIndex extends ConstantPoolException {
+ private static final long serialVersionUID = -4350294289300939730L;
+ InvalidIndex(int index) {
+ super(index);
+ }
+
+ @Override
+ public String getMessage() {
+ // i18n
+ return "invalid index #" + index;
+ }
+ }
+
+ public static class UnexpectedEntry extends ConstantPoolException {
+ private static final long serialVersionUID = 6986335935377933211L;
+ UnexpectedEntry(int index, int expected_tag, int found_tag) {
+ super(index);
+ this.expected_tag = expected_tag;
+ this.found_tag = found_tag;
+ }
+
+ @Override
+ public String getMessage() {
+ // i18n?
+ return "unexpected entry at #" + index + " -- expected tag " + expected_tag + ", found " + found_tag;
+ }
+
+ public final int expected_tag;
+ public final int found_tag;
+ }
+
+ public static class InvalidEntry extends ConstantPoolException {
+ private static final long serialVersionUID = 1000087545585204447L;
+ InvalidEntry(int index, int tag) {
+ super(index);
+ this.tag = tag;
+ }
+
+ @Override
+ public String getMessage() {
+ // i18n?
+ return "unexpected tag at #" + index + ": " + tag;
+ }
+
+ public final int tag;
+ }
+
+ public static class EntryNotFound extends ConstantPoolException {
+ private static final long serialVersionUID = 2885537606468581850L;
+ EntryNotFound(Object value) {
+ super(-1);
+ this.value = value;
+ }
+
+ @Override
+ public String getMessage() {
+ // i18n?
+ return "value not found: " + value;
+ }
+
+ public final Object value;
+ }
+
+ public static final int CONSTANT_Utf8 = 1;
+ public static final int CONSTANT_Integer = 3;
+ public static final int CONSTANT_Float = 4;
+ public static final int CONSTANT_Long = 5;
+ public static final int CONSTANT_Double = 6;
+ public static final int CONSTANT_Class = 7;
+ public static final int CONSTANT_String = 8;
+ public static final int CONSTANT_Fieldref = 9;
+ public static final int CONSTANT_Methodref = 10;
+ public static final int CONSTANT_InterfaceMethodref = 11;
+ public static final int CONSTANT_NameAndType = 12;
+ public static final int CONSTANT_MethodHandle = 15;
+ public static final int CONSTANT_MethodType = 16;
+ public static final int CONSTANT_InvokeDynamic = 18;
+
+ public static enum RefKind {
+ REF_getField(1, "getfield"),
+ REF_getStatic(2, "getstatic"),
+ REF_putField(3, "putfield"),
+ REF_putStatic(4, "putstatic"),
+ REF_invokeVirtual(5, "invokevirtual"),
+ REF_invokeStatic(6, "invokestatic"),
+ REF_invokeSpecial(7, "invokespecial"),
+ REF_newInvokeSpecial(8, "newinvokespecial"),
+ REF_invokeInterface(9, "invokeinterface");
+
+ public final int tag;
+ public final String name;
+
+ RefKind(int tag, String name) {
+ this.tag = tag;
+ this.name = name;
+ }
+
+ static RefKind getRefkind(int tag) {
+ switch(tag) {
+ case 1:
+ return REF_getField;
+ case 2:
+ return REF_getStatic;
+ case 3:
+ return REF_putField;
+ case 4:
+ return REF_putStatic;
+ case 5:
+ return REF_invokeVirtual;
+ case 6:
+ return REF_invokeStatic;
+ case 7:
+ return REF_invokeSpecial;
+ case 8:
+ return REF_newInvokeSpecial;
+ case 9:
+ return REF_invokeInterface;
+ default:
+ return null;
+ }
+ }
+ }
+
+ ConstantPool(ClassReader cr) throws IOException, InvalidEntry {
+ int count = cr.readUnsignedShort();
+ pool = new CPInfo[count];
+ for (int i = 1; i < count; i++) {
+ int tag = cr.readUnsignedByte();
+ switch (tag) {
+ case CONSTANT_Class:
+ pool[i] = new CONSTANT_Class_info(this, cr);
+ break;
+
+ case CONSTANT_Double:
+ pool[i] = new CONSTANT_Double_info(cr);
+ i++;
+ break;
+
+ case CONSTANT_Fieldref:
+ pool[i] = new CONSTANT_Fieldref_info(this, cr);
+ break;
+
+ case CONSTANT_Float:
+ pool[i] = new CONSTANT_Float_info(cr);
+ break;
+
+ case CONSTANT_Integer:
+ pool[i] = new CONSTANT_Integer_info(cr);
+ break;
+
+ case CONSTANT_InterfaceMethodref:
+ pool[i] = new CONSTANT_InterfaceMethodref_info(this, cr);
+ break;
+
+ case CONSTANT_InvokeDynamic:
+ pool[i] = new CONSTANT_InvokeDynamic_info(this, cr);
+ break;
+
+ case CONSTANT_Long:
+ pool[i] = new CONSTANT_Long_info(cr);
+ i++;
+ break;
+
+ case CONSTANT_MethodHandle:
+ pool[i] = new CONSTANT_MethodHandle_info(this, cr);
+ break;
+
+ case CONSTANT_MethodType:
+ pool[i] = new CONSTANT_MethodType_info(this, cr);
+ break;
+
+ case CONSTANT_Methodref:
+ pool[i] = new CONSTANT_Methodref_info(this, cr);
+ break;
+
+ case CONSTANT_NameAndType:
+ pool[i] = new CONSTANT_NameAndType_info(this, cr);
+ break;
+
+ case CONSTANT_String:
+ pool[i] = new CONSTANT_String_info(this, cr);
+ break;
+
+ case CONSTANT_Utf8:
+ pool[i] = new CONSTANT_Utf8_info(cr);
+ break;
+
+ default:
+ throw new InvalidEntry(i, tag);
+ }
+ }
+ }
+
+ public ConstantPool(CPInfo[] pool) {
+ this.pool = pool;
+ }
+
+ public int size() {
+ return pool.length;
+ }
+
+ public int byteLength() {
+ int length = 2;
+ for (int i = 1; i < size(); ) {
+ CPInfo cpInfo = pool[i];
+ length += cpInfo.byteLength();
+ i += cpInfo.size();
+ }
+ return length;
+ }
+
+ public CPInfo get(int index) throws InvalidIndex {
+ if (index <= 0 || index >= pool.length)
+ throw new InvalidIndex(index);
+ CPInfo info = pool[index];
+ if (info == null) {
+ // this occurs for indices referencing the "second half" of an
+ // 8 byte constant, such as CONSTANT_Double or CONSTANT_Long
+ throw new InvalidIndex(index);
+ }
+ return pool[index];
+ }
+
+ private CPInfo get(int index, int expected_type) throws InvalidIndex, UnexpectedEntry {
+ CPInfo info = get(index);
+ if (info.getTag() != expected_type)
+ throw new UnexpectedEntry(index, expected_type, info.getTag());
+ return info;
+ }
+
+ public CONSTANT_Utf8_info getUTF8Info(int index) throws InvalidIndex, UnexpectedEntry {
+ return ((CONSTANT_Utf8_info) get(index, CONSTANT_Utf8));
+ }
+
+ public CONSTANT_Class_info getClassInfo(int index) throws InvalidIndex, UnexpectedEntry {
+ return ((CONSTANT_Class_info) get(index, CONSTANT_Class));
+ }
+
+ public CONSTANT_NameAndType_info getNameAndTypeInfo(int index) throws InvalidIndex, UnexpectedEntry {
+ return ((CONSTANT_NameAndType_info) get(index, CONSTANT_NameAndType));
+ }
+
+ public String getUTF8Value(int index) throws InvalidIndex, UnexpectedEntry {
+ return getUTF8Info(index).value;
+ }
+
+ public int getUTF8Index(String value) throws EntryNotFound {
+ for (int i = 1; i < pool.length; i++) {
+ CPInfo info = pool[i];
+ if (info instanceof CONSTANT_Utf8_info &&
+ ((CONSTANT_Utf8_info) info).value.equals(value))
+ return i;
+ }
+ throw new EntryNotFound(value);
+ }
+
+ public Iterable<CPInfo> entries() {
+ return new Iterable<CPInfo>() {
+ public Iterator<CPInfo> iterator() {
+ return new Iterator<CPInfo>() {
+
+ public boolean hasNext() {
+ return next < pool.length;
+ }
+
+ public CPInfo next() {
+ current = pool[next];
+ switch (current.getTag()) {
+ case CONSTANT_Double:
+ case CONSTANT_Long:
+ next += 2;
+ break;
+ default:
+ next += 1;
+ }
+ return current;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ private CPInfo current;
+ private int next = 1;
+
+ };
+ }
+ };
+ }
+
+ private CPInfo[] pool;
+
+ public interface Visitor<R,P> {
+ R visitClass(CONSTANT_Class_info info, P p);
+ R visitDouble(CONSTANT_Double_info info, P p);
+ R visitFieldref(CONSTANT_Fieldref_info info, P p);
+ R visitFloat(CONSTANT_Float_info info, P p);
+ R visitInteger(CONSTANT_Integer_info info, P p);
+ R visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, P p);
+ R visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, P p);
+ R visitLong(CONSTANT_Long_info info, P p);
+ R visitNameAndType(CONSTANT_NameAndType_info info, P p);
+ R visitMethodref(CONSTANT_Methodref_info info, P p);
+ R visitMethodHandle(CONSTANT_MethodHandle_info info, P p);
+ R visitMethodType(CONSTANT_MethodType_info info, P p);
+ R visitString(CONSTANT_String_info info, P p);
+ R visitUtf8(CONSTANT_Utf8_info info, P p);
+ }
+
+ public static abstract class CPInfo {
+ CPInfo() {
+ this.cp = null;
+ }
+
+ CPInfo(ConstantPool cp) {
+ this.cp = cp;
+ }
+
+ public abstract int getTag();
+
+ /** The number of slots in the constant pool used by this entry.
+ * 2 for CONSTANT_Double and CONSTANT_Long; 1 for everything else. */
+ public int size() {
+ return 1;
+ }
+
+ public abstract int byteLength();
+
+ public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
+
+ protected final ConstantPool cp;
+ }
+
+ public static abstract class CPRefInfo extends CPInfo {
+ protected CPRefInfo(ConstantPool cp, ClassReader cr, int tag) throws IOException {
+ super(cp);
+ this.tag = tag;
+ class_index = cr.readUnsignedShort();
+ name_and_type_index = cr.readUnsignedShort();
+ }
+
+ protected CPRefInfo(ConstantPool cp, int tag, int class_index, int name_and_type_index) {
+ super(cp);
+ this.tag = tag;
+ this.class_index = class_index;
+ this.name_and_type_index = name_and_type_index;
+ }
+
+ public int getTag() {
+ return tag;
+ }
+
+ public int byteLength() {
+ return 5;
+ }
+
+ public CONSTANT_Class_info getClassInfo() throws ConstantPoolException {
+ return cp.getClassInfo(class_index);
+ }
+
+ public String getClassName() throws ConstantPoolException {
+ return cp.getClassInfo(class_index).getName();
+ }
+
+ public CONSTANT_NameAndType_info getNameAndTypeInfo() throws ConstantPoolException {
+ return cp.getNameAndTypeInfo(name_and_type_index);
+ }
+
+ public final int tag;
+ public final int class_index;
+ public final int name_and_type_index;
+ }
+
+ public static class CONSTANT_Class_info extends CPInfo {
+ CONSTANT_Class_info(ConstantPool cp, ClassReader cr) throws IOException {
+ super(cp);
+ name_index = cr.readUnsignedShort();
+ }
+
+ public CONSTANT_Class_info(ConstantPool cp, int name_index) {
+ super(cp);
+ this.name_index = name_index;
+ }
+
+ public int getTag() {
+ return CONSTANT_Class;
+ }
+
+ public int byteLength() {
+ return 3;
+ }
+
+ /**
+ * Get the raw value of the class referenced by this constant pool entry.
+ * This will either be the name of the class, in internal form, or a
+ * descriptor for an array class.
+ * @return the raw value of the class
+ */
+ public String getName() throws ConstantPoolException {
+ return cp.getUTF8Value(name_index);
+ }
+
+ /**
+ * If this constant pool entry identifies either a class or interface type,
+ * or a possibly multi-dimensional array of a class of interface type,
+ * return the name of the class or interface in internal form. Otherwise,
+ * (i.e. if this is a possibly multi-dimensional array of a primitive type),
+ * return null.
+ * @return the base class or interface name
+ */
+ public String getBaseName() throws ConstantPoolException {
+ String name = getName();
+ if (name.startsWith("[")) {
+ int index = name.indexOf("[L");
+ if (index == -1)
+ return null;
+ return name.substring(index + 2, name.length() - 1);
+ } else
+ return name;
+ }
+
+ public int getDimensionCount() throws ConstantPoolException {
+ String name = getName();
+ int count = 0;
+ while (name.charAt(count) == '[')
+ count++;
+ return count;
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_Class_info[name_index: " + name_index + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitClass(this, data);
+ }
+
+ public final int name_index;
+ }
+
+ public static class CONSTANT_Double_info extends CPInfo {
+ CONSTANT_Double_info(ClassReader cr) throws IOException {
+ value = cr.readDouble();
+ }
+
+ public CONSTANT_Double_info(double value) {
+ this.value = value;
+ }
+
+ public int getTag() {
+ return CONSTANT_Double;
+ }
+
+ public int byteLength() {
+ return 9;
+ }
+
+ @Override
+ public int size() {
+ return 2;
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_Double_info[value: " + value + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitDouble(this, data);
+ }
+
+ public final double value;
+ }
+
+ public static class CONSTANT_Fieldref_info extends CPRefInfo {
+ CONSTANT_Fieldref_info(ConstantPool cp, ClassReader cr) throws IOException {
+ super(cp, cr, CONSTANT_Fieldref);
+ }
+
+ public CONSTANT_Fieldref_info(ConstantPool cp, int class_index, int name_and_type_index) {
+ super(cp, CONSTANT_Fieldref, class_index, name_and_type_index);
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_Fieldref_info[class_index: " + class_index + ", name_and_type_index: " + name_and_type_index + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitFieldref(this, data);
+ }
+ }
+
+ public static class CONSTANT_Float_info extends CPInfo {
+ CONSTANT_Float_info(ClassReader cr) throws IOException {
+ value = cr.readFloat();
+ }
+
+ public CONSTANT_Float_info(float value) {
+ this.value = value;
+ }
+
+ public int getTag() {
+ return CONSTANT_Float;
+ }
+
+ public int byteLength() {
+ return 5;
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_Float_info[value: " + value + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitFloat(this, data);
+ }
+
+ public final float value;
+ }
+
+ public static class CONSTANT_Integer_info extends CPInfo {
+ CONSTANT_Integer_info(ClassReader cr) throws IOException {
+ value = cr.readInt();
+ }
+
+ public CONSTANT_Integer_info(int value) {
+ this.value = value;
+ }
+
+ public int getTag() {
+ return CONSTANT_Integer;
+ }
+
+ public int byteLength() {
+ return 5;
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_Integer_info[value: " + value + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitInteger(this, data);
+ }
+
+ public final int value;
+ }
+
+ public static class CONSTANT_InterfaceMethodref_info extends CPRefInfo {
+ CONSTANT_InterfaceMethodref_info(ConstantPool cp, ClassReader cr) throws IOException {
+ super(cp, cr, CONSTANT_InterfaceMethodref);
+ }
+
+ public CONSTANT_InterfaceMethodref_info(ConstantPool cp, int class_index, int name_and_type_index) {
+ super(cp, CONSTANT_InterfaceMethodref, class_index, name_and_type_index);
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_InterfaceMethodref_info[class_index: " + class_index + ", name_and_type_index: " + name_and_type_index + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitInterfaceMethodref(this, data);
+ }
+ }
+
+ public static class CONSTANT_InvokeDynamic_info extends CPInfo {
+ CONSTANT_InvokeDynamic_info(ConstantPool cp, ClassReader cr) throws IOException {
+ super(cp);
+ bootstrap_method_attr_index = cr.readUnsignedShort();
+ name_and_type_index = cr.readUnsignedShort();
+ }
+
+ public CONSTANT_InvokeDynamic_info(ConstantPool cp, int bootstrap_method_index, int name_and_type_index) {
+ super(cp);
+ this.bootstrap_method_attr_index = bootstrap_method_index;
+ this.name_and_type_index = name_and_type_index;
+ }
+
+ public int getTag() {
+ return CONSTANT_InvokeDynamic;
+ }
+
+ public int byteLength() {
+ return 5;
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_InvokeDynamic_info[bootstrap_method_index: " + bootstrap_method_attr_index + ", name_and_type_index: " + name_and_type_index + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitInvokeDynamic(this, data);
+ }
+
+ public CONSTANT_NameAndType_info getNameAndTypeInfo() throws ConstantPoolException {
+ return cp.getNameAndTypeInfo(name_and_type_index);
+ }
+
+ public final int bootstrap_method_attr_index;
+ public final int name_and_type_index;
+ }
+
+ public static class CONSTANT_Long_info extends CPInfo {
+ CONSTANT_Long_info(ClassReader cr) throws IOException {
+ value = cr.readLong();
+ }
+
+ public CONSTANT_Long_info(long value) {
+ this.value = value;
+ }
+
+ public int getTag() {
+ return CONSTANT_Long;
+ }
+
+ @Override
+ public int size() {
+ return 2;
+ }
+
+ public int byteLength() {
+ return 9;
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_Long_info[value: " + value + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitLong(this, data);
+ }
+
+ public final long value;
+ }
+
+ public static class CONSTANT_MethodHandle_info extends CPInfo {
+ CONSTANT_MethodHandle_info(ConstantPool cp, ClassReader cr) throws IOException {
+ super(cp);
+ reference_kind = RefKind.getRefkind(cr.readUnsignedByte());
+ reference_index = cr.readUnsignedShort();
+ }
+
+ public CONSTANT_MethodHandle_info(ConstantPool cp, RefKind ref_kind, int member_index) {
+ super(cp);
+ this.reference_kind = ref_kind;
+ this.reference_index = member_index;
+ }
+
+ public int getTag() {
+ return CONSTANT_MethodHandle;
+ }
+
+ public int byteLength() {
+ return 4;
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_MethodHandle_info[ref_kind: " + reference_kind + ", member_index: " + reference_index + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitMethodHandle(this, data);
+ }
+
+ public CPRefInfo getCPRefInfo() throws ConstantPoolException {
+ int expected = CONSTANT_Methodref;
+ int actual = cp.get(reference_index).getTag();
+ // allow these tag types also:
+ switch (actual) {
+ case CONSTANT_Fieldref:
+ case CONSTANT_InterfaceMethodref:
+ expected = actual;
+ }
+ return (CPRefInfo) cp.get(reference_index, expected);
+ }
+
+ public final RefKind reference_kind;
+ public final int reference_index;
+ }
+
+ public static class CONSTANT_MethodType_info extends CPInfo {
+ CONSTANT_MethodType_info(ConstantPool cp, ClassReader cr) throws IOException {
+ super(cp);
+ descriptor_index = cr.readUnsignedShort();
+ }
+
+ public CONSTANT_MethodType_info(ConstantPool cp, int signature_index) {
+ super(cp);
+ this.descriptor_index = signature_index;
+ }
+
+ public int getTag() {
+ return CONSTANT_MethodType;
+ }
+
+ public int byteLength() {
+ return 3;
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_MethodType_info[signature_index: " + descriptor_index + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitMethodType(this, data);
+ }
+
+ public String getType() throws ConstantPoolException {
+ return cp.getUTF8Value(descriptor_index);
+ }
+
+ public final int descriptor_index;
+ }
+
+ public static class CONSTANT_Methodref_info extends CPRefInfo {
+ CONSTANT_Methodref_info(ConstantPool cp, ClassReader cr) throws IOException {
+ super(cp, cr, CONSTANT_Methodref);
+ }
+
+ public CONSTANT_Methodref_info(ConstantPool cp, int class_index, int name_and_type_index) {
+ super(cp, CONSTANT_Methodref, class_index, name_and_type_index);
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_Methodref_info[class_index: " + class_index + ", name_and_type_index: " + name_and_type_index + "]";
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitMethodref(this, data);
+ }
+ }
+
+ public static class CONSTANT_NameAndType_info extends CPInfo {
+ CONSTANT_NameAndType_info(ConstantPool cp, ClassReader cr) throws IOException {
+ super(cp);
+ name_index = cr.readUnsignedShort();
+ type_index = cr.readUnsignedShort();
+ }
+
+ public CONSTANT_NameAndType_info(ConstantPool cp, int name_index, int type_index) {
+ super(cp);
+ this.name_index = name_index;
+ this.type_index = type_index;
+ }
+
+ public int getTag() {
+ return CONSTANT_NameAndType;
+ }
+
+ public int byteLength() {
+ return 5;
+ }
+
+ public String getName() throws ConstantPoolException {
+ return cp.getUTF8Value(name_index);
+ }
+
+ public String getType() throws ConstantPoolException {
+ return cp.getUTF8Value(type_index);
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitNameAndType(this, data);
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_NameAndType_info[name_index: " + name_index + ", type_index: " + type_index + "]";
+ }
+
+ public final int name_index;
+ public final int type_index;
+ }
+
+ public static class CONSTANT_String_info extends CPInfo {
+ CONSTANT_String_info(ConstantPool cp, ClassReader cr) throws IOException {
+ super(cp);
+ string_index = cr.readUnsignedShort();
+ }
+
+ public CONSTANT_String_info(ConstantPool cp, int string_index) {
+ super(cp);
+ this.string_index = string_index;
+ }
+
+ public int getTag() {
+ return CONSTANT_String;
+ }
+
+ public int byteLength() {
+ return 3;
+ }
+
+ public String getString() throws ConstantPoolException {
+ return cp.getUTF8Value(string_index);
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitString(this, data);
+ }
+
+ @Override
+ public String toString() {
+ return "CONSTANT_String_info[class_index: " + string_index + "]";
+ }
+
+ public final int string_index;
+ }
+
+ public static class CONSTANT_Utf8_info extends CPInfo {
+ CONSTANT_Utf8_info(ClassReader cr) throws IOException {
+ value = cr.readUTF();
+ }
+
+ public CONSTANT_Utf8_info(String value) {
+ this.value = value;
+ }
+
+ public int getTag() {
+ return CONSTANT_Utf8;
+ }
+
+ public int byteLength() {
+ class SizeOutputStream extends OutputStream {
+ @Override
+ public void write(int b) {
+ size++;
+ }
+ int size;
+ }
+ SizeOutputStream sizeOut = new SizeOutputStream();
+ DataOutputStream out = new DataOutputStream(sizeOut);
+ try { out.writeUTF(value); } catch (IOException ignore) { }
+ return 1 + sizeOut.size;
+ }
+
+ @Override
+ public String toString() {
+ if (value.length() < 32 && isPrintableAscii(value))
+ return "CONSTANT_Utf8_info[value: \"" + value + "\"]";
+ else
+ return "CONSTANT_Utf8_info[value: (" + value.length() + " chars)]";
+ }
+
+ static boolean isPrintableAscii(String s) {
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ if (c < 32 || c >= 127)
+ return false;
+ }
+ return true;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitUtf8(this, data);
+ }
+
+ public final String value;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantPoolException.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008, 2009, 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.
+ */
+
+
+package com.sun.tools.classfile;
+
+/*
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class ConstantPoolException extends Exception {
+ private static final long serialVersionUID = -2324397349644754565L;
+ ConstantPoolException(int index) {
+ this.index = index;
+ }
+
+ public final int index;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ConstantValue_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.2.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class ConstantValue_attribute extends Attribute {
+ ConstantValue_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ constantvalue_index = cr.readUnsignedShort();
+ }
+
+ public ConstantValue_attribute(ConstantPool constant_pool, int constantvalue_index)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.ConstantValue), constantvalue_index);
+ }
+
+ public ConstantValue_attribute(int name_index, int constantvalue_index) {
+ super(name_index, 2);
+ this.constantvalue_index = constantvalue_index;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitConstantValue(this, data);
+ }
+
+ public final int constantvalue_index;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/DefaultAttribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+/*
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class DefaultAttribute extends Attribute {
+ DefaultAttribute(ClassReader cr, int name_index, byte[] data) {
+ this(cr, name_index, data, null);
+ }
+
+ DefaultAttribute(ClassReader cr, int name_index, byte[] data, String reason) {
+ super(name_index, data.length);
+ info = data;
+ this.reason = reason;
+ }
+
+ public DefaultAttribute(ConstantPool constant_pool, int name_index, byte[] info) {
+ this(constant_pool, name_index, info, null);
+ }
+
+ public DefaultAttribute(ConstantPool constant_pool, int name_index,
+ byte[] info, String reason) {
+ super(name_index, info.length);
+ this.info = info;
+ this.reason = reason;
+ }
+
+ public <R, P> R accept(Visitor<R, P> visitor, P p) {
+ return visitor.visitDefault(this, p);
+ }
+
+ public final byte[] info;
+ /** Why did we need to generate a DefaultAttribute
+ */
+ public final String reason;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Dependencies.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,794 @@
+/*
+ * Copyright (c) 2009, 2013, 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.
+ */
+package com.sun.tools.classfile;
+
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import com.sun.tools.classfile.Dependency.Filter;
+import com.sun.tools.classfile.Dependency.Finder;
+import com.sun.tools.classfile.Dependency.Location;
+import com.sun.tools.classfile.Type.ArrayType;
+import com.sun.tools.classfile.Type.ClassSigType;
+import com.sun.tools.classfile.Type.ClassType;
+import com.sun.tools.classfile.Type.MethodType;
+import com.sun.tools.classfile.Type.SimpleType;
+import com.sun.tools.classfile.Type.TypeParamType;
+import com.sun.tools.classfile.Type.WildcardType;
+
+import static com.sun.tools.classfile.ConstantPool.*;
+
+/**
+ * A framework for determining {@link Dependency dependencies} between class files.
+ *
+ * A {@link Dependency.Finder finder} is used to identify the dependencies of
+ * individual classes. Some finders may return subtypes of {@code Dependency} to
+ * further characterize the type of dependency, such as a dependency on a
+ * method within a class.
+ *
+ * A {@link Dependency.Filter filter} may be used to restrict the set of
+ * dependencies found by a finder.
+ *
+ * Dependencies that are found may be passed to a {@link Dependencies.Recorder
+ * recorder} so that the dependencies can be stored in a custom data structure.
+ */
+public class Dependencies {
+ /**
+ * Thrown when a class file cannot be found.
+ */
+ public static class ClassFileNotFoundException extends Exception {
+ private static final long serialVersionUID = 3632265927794475048L;
+
+ public ClassFileNotFoundException(String className) {
+ super(className);
+ this.className = className;
+ }
+
+ public ClassFileNotFoundException(String className, Throwable cause) {
+ this(className);
+ initCause(cause);
+ }
+
+ public final String className;
+ }
+
+ /**
+ * Thrown when an exception is found processing a class file.
+ */
+ public static class ClassFileError extends Error {
+ private static final long serialVersionUID = 4111110813961313203L;
+
+ public ClassFileError(Throwable cause) {
+ initCause(cause);
+ }
+ }
+
+ /**
+ * Service provider interface to locate and read class files.
+ */
+ public interface ClassFileReader {
+ /**
+ * Get the ClassFile object for a specified class.
+ * @param className the name of the class to be returned.
+ * @return the ClassFile for the given class
+ * @throws Dependencies.ClassFileNotFoundException if the classfile cannot be
+ * found
+ */
+ public ClassFile getClassFile(String className)
+ throws ClassFileNotFoundException;
+ }
+
+ /**
+ * Service provide interface to handle results.
+ */
+ public interface Recorder {
+ /**
+ * Record a dependency that has been found.
+ * @param d
+ */
+ public void addDependency(Dependency d);
+ }
+
+ /**
+ * Get the default finder used to locate the dependencies for a class.
+ * @return the default finder
+ */
+ public static Finder getDefaultFinder() {
+ return new APIDependencyFinder(AccessFlags.ACC_PRIVATE);
+ }
+
+ /**
+ * Get a finder used to locate the API dependencies for a class.
+ * These include the superclass, superinterfaces, and classes referenced in
+ * the declarations of fields and methods. The fields and methods that
+ * are checked can be limited according to a specified access.
+ * The access parameter must be one of {@link AccessFlags#ACC_PUBLIC ACC_PUBLIC},
+ * {@link AccessFlags#ACC_PRIVATE ACC_PRIVATE},
+ * {@link AccessFlags#ACC_PROTECTED ACC_PROTECTED}, or 0 for
+ * package private access. Members with greater than or equal accessibility
+ * to that specified will be searched for dependencies.
+ * @param access the access of members to be checked
+ * @return an API finder
+ */
+ public static Finder getAPIFinder(int access) {
+ return new APIDependencyFinder(access);
+ }
+
+ /**
+ * Get a finder to do class dependency analysis.
+ *
+ * @return a Class dependency finder
+ */
+ public static Finder getClassDependencyFinder() {
+ return new ClassDependencyFinder();
+ }
+
+ /**
+ * Get the finder used to locate the dependencies for a class.
+ * @return the finder
+ */
+ public Finder getFinder() {
+ if (finder == null)
+ finder = getDefaultFinder();
+ return finder;
+ }
+
+ /**
+ * Set the finder used to locate the dependencies for a class.
+ * @param f the finder
+ */
+ public void setFinder(Finder f) {
+ finder = Objects.requireNonNull(f);
+ }
+
+ /**
+ * Get the default filter used to determine included when searching
+ * the transitive closure of all the dependencies.
+ * Unless overridden, the default filter accepts all dependencies.
+ * @return the default filter.
+ */
+ public static Filter getDefaultFilter() {
+ return DefaultFilter.instance();
+ }
+
+ /**
+ * Get a filter which uses a regular expression on the target's class name
+ * to determine if a dependency is of interest.
+ * @param pattern the pattern used to match the target's class name
+ * @return a filter for matching the target class name with a regular expression
+ */
+ public static Filter getRegexFilter(Pattern pattern) {
+ return new TargetRegexFilter(pattern);
+ }
+
+ /**
+ * Get a filter which checks the package of a target's class name
+ * to determine if a dependency is of interest. The filter checks if the
+ * package of the target's class matches any of a set of given package
+ * names. The match may optionally match subpackages of the given names as well.
+ * @param packageNames the package names used to match the target's class name
+ * @param matchSubpackages whether or not to match subpackages as well
+ * @return a filter for checking the target package name against a list of package names
+ */
+ public static Filter getPackageFilter(Set<String> packageNames, boolean matchSubpackages) {
+ return new TargetPackageFilter(packageNames, matchSubpackages);
+ }
+
+ /**
+ * Get the filter used to determine the dependencies included when searching
+ * the transitive closure of all the dependencies.
+ * Unless overridden, the default filter accepts all dependencies.
+ * @return the filter
+ */
+ public Filter getFilter() {
+ if (filter == null)
+ filter = getDefaultFilter();
+ return filter;
+ }
+
+ /**
+ * Set the filter used to determine the dependencies included when searching
+ * the transitive closure of all the dependencies.
+ * @param f the filter
+ */
+ public void setFilter(Filter f) {
+ filter = Objects.requireNonNull(f);
+ }
+
+ /**
+ * Find the dependencies of a class, using the current
+ * {@link Dependencies#getFinder finder} and
+ * {@link Dependencies#getFilter filter}.
+ * The search may optionally include the transitive closure of all the
+ * filtered dependencies, by also searching in the classes named in those
+ * dependencies.
+ * @param classFinder a finder to locate class files
+ * @param rootClassNames the names of the root classes from which to begin
+ * searching
+ * @param transitiveClosure whether or not to also search those classes
+ * named in any filtered dependencies that are found.
+ * @return the set of dependencies that were found
+ * @throws ClassFileNotFoundException if a required class file cannot be found
+ * @throws ClassFileError if an error occurs while processing a class file,
+ * such as an error in the internal class file structure.
+ */
+ public Set<Dependency> findAllDependencies(
+ ClassFileReader classFinder, Set<String> rootClassNames,
+ boolean transitiveClosure)
+ throws ClassFileNotFoundException {
+ final Set<Dependency> results = new HashSet<>();
+ Recorder r = new Recorder() {
+ public void addDependency(Dependency d) {
+ results.add(d);
+ }
+ };
+ findAllDependencies(classFinder, rootClassNames, transitiveClosure, r);
+ return results;
+ }
+
+ /**
+ * Find the dependencies of a class, using the current
+ * {@link Dependencies#getFinder finder} and
+ * {@link Dependencies#getFilter filter}.
+ * The search may optionally include the transitive closure of all the
+ * filtered dependencies, by also searching in the classes named in those
+ * dependencies.
+ * @param classFinder a finder to locate class files
+ * @param rootClassNames the names of the root classes from which to begin
+ * searching
+ * @param transitiveClosure whether or not to also search those classes
+ * named in any filtered dependencies that are found.
+ * @param recorder a recorder for handling the results
+ * @throws ClassFileNotFoundException if a required class file cannot be found
+ * @throws ClassFileError if an error occurs while processing a class file,
+ * such as an error in the internal class file structure.
+ */
+ public void findAllDependencies(
+ ClassFileReader classFinder, Set<String> rootClassNames,
+ boolean transitiveClosure, Recorder recorder)
+ throws ClassFileNotFoundException {
+ Set<String> doneClasses = new HashSet<>();
+
+ getFinder(); // ensure initialized
+ getFilter(); // ensure initialized
+
+ // 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.
+ Deque<String> deque = new LinkedList<>(rootClassNames);
+
+ String className;
+ while ((className = deque.poll()) != null) {
+ assert (!doneClasses.contains(className));
+ doneClasses.add(className);
+
+ ClassFile cf = classFinder.getClassFile(className);
+
+ // The following code just applies the filter to the dependencies
+ // followed for the transitive closure.
+ for (Dependency d: finder.findDependencies(cf)) {
+ recorder.addDependency(d);
+ if (transitiveClosure && filter.accepts(d)) {
+ String cn = d.getTarget().getClassName();
+ if (!doneClasses.contains(cn))
+ deque.add(cn);
+ }
+ }
+ }
+ }
+
+ private Filter filter;
+ private Finder finder;
+
+ /**
+ * A location identifying a class.
+ */
+ static class SimpleLocation implements Location {
+ public SimpleLocation(String name) {
+ this.name = name;
+ this.className = name.replace('/', '.');
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public String getPackageName() {
+ int i = name.lastIndexOf('/');
+ return (i > 0) ? name.substring(0, i).replace('/', '.') : "";
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other)
+ return true;
+ if (!(other instanceof SimpleLocation))
+ return false;
+ return (name.equals(((SimpleLocation) other).name));
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ private String name;
+ private String className;
+ }
+
+ /**
+ * A dependency of one class on another.
+ */
+ static class SimpleDependency implements Dependency {
+ public SimpleDependency(Location origin, Location target) {
+ this.origin = origin;
+ this.target = target;
+ }
+
+ public Location getOrigin() {
+ return origin;
+ }
+
+ public Location getTarget() {
+ return target;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other)
+ return true;
+ if (!(other instanceof SimpleDependency))
+ return false;
+ SimpleDependency o = (SimpleDependency) other;
+ return (origin.equals(o.origin) && target.equals(o.target));
+ }
+
+ @Override
+ public int hashCode() {
+ return origin.hashCode() * 31 + target.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return origin + ":" + target;
+ }
+
+ private Location origin;
+ private Location target;
+ }
+
+
+ /**
+ * This class accepts all dependencies.
+ */
+ static class DefaultFilter implements Filter {
+ private static DefaultFilter instance;
+
+ static DefaultFilter instance() {
+ if (instance == null)
+ instance = new DefaultFilter();
+ return instance;
+ }
+
+ public boolean accepts(Dependency dependency) {
+ return true;
+ }
+ }
+
+ /**
+ * This class accepts those dependencies whose target's class name matches a
+ * regular expression.
+ */
+ static class TargetRegexFilter implements Filter {
+ TargetRegexFilter(Pattern pattern) {
+ this.pattern = pattern;
+ }
+
+ public boolean accepts(Dependency dependency) {
+ return pattern.matcher(dependency.getTarget().getClassName()).matches();
+ }
+
+ private final Pattern pattern;
+ }
+
+ /**
+ * This class accepts those dependencies whose class name is in a given
+ * package.
+ */
+ static class TargetPackageFilter implements Filter {
+ TargetPackageFilter(Set<String> packageNames, boolean matchSubpackages) {
+ for (String pn: packageNames) {
+ if (pn.length() == 0) // implies null check as well
+ throw new IllegalArgumentException();
+ }
+ this.packageNames = packageNames;
+ this.matchSubpackages = matchSubpackages;
+ }
+
+ public boolean accepts(Dependency dependency) {
+ String pn = dependency.getTarget().getPackageName();
+ if (packageNames.contains(pn))
+ return true;
+
+ if (matchSubpackages) {
+ for (String n: packageNames) {
+ if (pn.startsWith(n + "."))
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private final Set<String> packageNames;
+ private final boolean matchSubpackages;
+ }
+
+ /**
+ * This class identifies class names directly or indirectly in the constant pool.
+ */
+ static class ClassDependencyFinder extends BasicDependencyFinder {
+ public Iterable<? extends Dependency> findDependencies(ClassFile classfile) {
+ Visitor v = new Visitor(classfile);
+ for (CPInfo cpInfo: classfile.constant_pool.entries()) {
+ v.scan(cpInfo);
+ }
+ try {
+ v.addClass(classfile.super_class);
+ v.addClasses(classfile.interfaces);
+ v.scan(classfile.attributes);
+
+ for (Field f : classfile.fields) {
+ v.scan(f.descriptor, f.attributes);
+ }
+ for (Method m : classfile.methods) {
+ v.scan(m.descriptor, m.attributes);
+ Exceptions_attribute e =
+ (Exceptions_attribute)m.attributes.get(Attribute.Exceptions);
+ if (e != null) {
+ v.addClasses(e.exception_index_table);
+ }
+ }
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ }
+
+ return v.deps;
+ }
+ }
+
+ /**
+ * This class identifies class names in the signatures of classes, fields,
+ * and methods in a class.
+ */
+ static class APIDependencyFinder extends BasicDependencyFinder {
+ APIDependencyFinder(int access) {
+ switch (access) {
+ case AccessFlags.ACC_PUBLIC:
+ case AccessFlags.ACC_PROTECTED:
+ case AccessFlags.ACC_PRIVATE:
+ case 0:
+ showAccess = access;
+ break;
+ default:
+ throw new IllegalArgumentException("invalid access 0x"
+ + Integer.toHexString(access));
+ }
+ }
+
+ public Iterable<? extends Dependency> findDependencies(ClassFile classfile) {
+ try {
+ Visitor v = new Visitor(classfile);
+ v.addClass(classfile.super_class);
+ v.addClasses(classfile.interfaces);
+ // inner classes?
+ for (Field f : classfile.fields) {
+ if (checkAccess(f.access_flags))
+ v.scan(f.descriptor, f.attributes);
+ }
+ for (Method m : classfile.methods) {
+ if (checkAccess(m.access_flags)) {
+ v.scan(m.descriptor, m.attributes);
+ Exceptions_attribute e =
+ (Exceptions_attribute) m.attributes.get(Attribute.Exceptions);
+ if (e != null)
+ v.addClasses(e.exception_index_table);
+ }
+ }
+ return v.deps;
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ }
+ }
+
+ boolean checkAccess(AccessFlags flags) {
+ // code copied from javap.Options.checkAccess
+ boolean isPublic = flags.is(AccessFlags.ACC_PUBLIC);
+ boolean isProtected = flags.is(AccessFlags.ACC_PROTECTED);
+ boolean isPrivate = flags.is(AccessFlags.ACC_PRIVATE);
+ boolean isPackage = !(isPublic || isProtected || isPrivate);
+
+ if ((showAccess == AccessFlags.ACC_PUBLIC) && (isProtected || isPrivate || isPackage))
+ return false;
+ else if ((showAccess == AccessFlags.ACC_PROTECTED) && (isPrivate || isPackage))
+ return false;
+ else if ((showAccess == 0) && (isPrivate))
+ return false;
+ else
+ return true;
+ }
+
+ private int showAccess;
+ }
+
+ static abstract class BasicDependencyFinder implements Finder {
+ private Map<String,Location> locations = new HashMap<>();
+
+ Location getLocation(String className) {
+ Location l = locations.get(className);
+ if (l == null)
+ locations.put(className, l = new SimpleLocation(className));
+ return l;
+ }
+
+ class Visitor implements ConstantPool.Visitor<Void,Void>, Type.Visitor<Void, Void> {
+ private ConstantPool constant_pool;
+ private Location origin;
+ Set<Dependency> deps;
+
+ Visitor(ClassFile classFile) {
+ try {
+ constant_pool = classFile.constant_pool;
+ origin = getLocation(classFile.getName());
+ deps = new HashSet<>();
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ }
+ }
+
+ void scan(Descriptor d, Attributes attrs) {
+ try {
+ scan(new Signature(d.index).getType(constant_pool));
+ scan(attrs);
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ }
+ }
+
+ void scan(CPInfo cpInfo) {
+ cpInfo.accept(this, null);
+ }
+
+ void scan(Type t) {
+ t.accept(this, null);
+ }
+
+ void scan(Attributes attrs) {
+ try {
+ Signature_attribute sa = (Signature_attribute)attrs.get(Attribute.Signature);
+ if (sa != null)
+ scan(sa.getParsedSignature().getType(constant_pool));
+
+ scan((RuntimeVisibleAnnotations_attribute)
+ attrs.get(Attribute.RuntimeVisibleAnnotations));
+ scan((RuntimeVisibleParameterAnnotations_attribute)
+ attrs.get(Attribute.RuntimeVisibleParameterAnnotations));
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ }
+ }
+
+ private void scan(RuntimeAnnotations_attribute attr) throws ConstantPoolException {
+ if (attr == null) {
+ return;
+ }
+ for (int i = 0; i < attr.annotations.length; i++) {
+ int index = attr.annotations[i].type_index;
+ scan(new Signature(index).getType(constant_pool));
+ }
+ }
+
+ private void scan(RuntimeParameterAnnotations_attribute attr) throws ConstantPoolException {
+ if (attr == null) {
+ return;
+ }
+ for (int param = 0; param < attr.parameter_annotations.length; param++) {
+ for (int i = 0; i < attr.parameter_annotations[param].length; i++) {
+ int index = attr.parameter_annotations[param][i].type_index;
+ scan(new Signature(index).getType(constant_pool));
+ }
+ }
+ }
+
+ void addClass(int index) throws ConstantPoolException {
+ if (index != 0) {
+ String name = constant_pool.getClassInfo(index).getBaseName();
+ if (name != null)
+ addDependency(name);
+ }
+ }
+
+ void addClasses(int[] indices) throws ConstantPoolException {
+ for (int i: indices)
+ addClass(i);
+ }
+
+ private void addDependency(String name) {
+ deps.add(new SimpleDependency(origin, getLocation(name)));
+ }
+
+ // ConstantPool.Visitor methods
+
+ public Void visitClass(CONSTANT_Class_info info, Void p) {
+ try {
+ if (info.getName().startsWith("["))
+ new Signature(info.name_index).getType(constant_pool).accept(this, null);
+ else
+ addDependency(info.getBaseName());
+ return null;
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ }
+ }
+
+ public Void visitDouble(CONSTANT_Double_info info, Void p) {
+ return null;
+ }
+
+ public Void visitFieldref(CONSTANT_Fieldref_info info, Void p) {
+ return visitRef(info, p);
+ }
+
+ public Void visitFloat(CONSTANT_Float_info info, Void p) {
+ return null;
+ }
+
+ public Void visitInteger(CONSTANT_Integer_info info, Void p) {
+ return null;
+ }
+
+ public Void visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
+ return visitRef(info, p);
+ }
+
+ public Void visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
+ return null;
+ }
+
+ public Void visitLong(CONSTANT_Long_info info, Void p) {
+ return null;
+ }
+
+ public Void visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
+ return null;
+ }
+
+ public Void visitMethodType(CONSTANT_MethodType_info info, Void p) {
+ return null;
+ }
+
+ public Void visitMethodref(CONSTANT_Methodref_info info, Void p) {
+ return visitRef(info, p);
+ }
+
+ public Void visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
+ try {
+ new Signature(info.type_index).getType(constant_pool).accept(this, null);
+ return null;
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ }
+ }
+
+ public Void visitString(CONSTANT_String_info info, Void p) {
+ return null;
+ }
+
+ public Void visitUtf8(CONSTANT_Utf8_info info, Void p) {
+ return null;
+ }
+
+ private Void visitRef(CPRefInfo info, Void p) {
+ try {
+ visitClass(info.getClassInfo(), p);
+ return null;
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ }
+ }
+
+ // Type.Visitor methods
+
+ private void findDependencies(Type t) {
+ if (t != null)
+ t.accept(this, null);
+ }
+
+ private void findDependencies(List<? extends Type> ts) {
+ if (ts != null) {
+ for (Type t: ts)
+ t.accept(this, null);
+ }
+ }
+
+ public Void visitSimpleType(SimpleType type, Void p) {
+ return null;
+ }
+
+ public Void visitArrayType(ArrayType type, Void p) {
+ findDependencies(type.elemType);
+ return null;
+ }
+
+ public Void visitMethodType(MethodType type, Void p) {
+ findDependencies(type.paramTypes);
+ findDependencies(type.returnType);
+ findDependencies(type.throwsTypes);
+ findDependencies(type.typeParamTypes);
+ return null;
+ }
+
+ public Void visitClassSigType(ClassSigType type, Void p) {
+ findDependencies(type.superclassType);
+ findDependencies(type.superinterfaceTypes);
+ return null;
+ }
+
+ public Void visitClassType(ClassType type, Void p) {
+ findDependencies(type.outerType);
+ addDependency(type.getBinaryName());
+ findDependencies(type.typeArgs);
+ return null;
+ }
+
+ public Void visitTypeParamType(TypeParamType type, Void p) {
+ findDependencies(type.classBound);
+ findDependencies(type.interfaceBounds);
+ return null;
+ }
+
+ public Void visitWildcardType(WildcardType type, Void p) {
+ findDependencies(type.boundType);
+ return null;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Dependency.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2009, 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.
+ */
+
+package com.sun.tools.classfile;
+
+
+/**
+ * A directed relationship between two {@link Dependency.Location Location}s.
+ * Subtypes of {@code Dependency} may provide additional detail about the dependency.
+ *
+ * @see Dependency.Finder
+ * @see Dependency.Filter
+ * @see Dependencies
+ */
+public interface Dependency {
+ /**
+ * A filter used to select dependencies of interest, and to discard others.
+ */
+ public interface Filter {
+ /**
+ * Return true if the dependency is of interest.
+ * @param dependency the dependency to be considered
+ * @return true if and only if the dependency is of interest.
+ */
+ boolean accepts(Dependency dependency);
+ }
+
+ /**
+ * An interface for finding the immediate dependencies of a given class file.
+ */
+ public interface Finder {
+ /**
+ * Find the immediate dependencies of a given class file.
+ * @param classfile the class file to be examined
+ * @return the dependencies located in the given class file.
+ */
+ public Iterable<? extends Dependency> findDependencies(ClassFile classfile);
+ }
+
+
+ /**
+ * A location somewhere within a class. Subtypes of {@code Location}
+ * may be used to provide additional detail about the location.
+ */
+ public interface Location {
+ /**
+ * Get the name of the class containing the location.
+ * This name will be used to locate the class file for transitive
+ * dependency analysis.
+ * @return the name of the class containing the location.
+ */
+ String getName();
+
+ /**
+ * Get the fully-qualified name of the class containing the location.
+ * @return the fully-qualified name of the class containing the location.
+ */
+ String getClassName();
+
+ /**
+ * Get the package name of the class containing the location.
+ * @return the package name of the class containing the location.
+ */
+ String getPackageName();
+ }
+
+
+ /**
+ * Get the location that has the dependency.
+ * @return the location that has the dependency.
+ */
+ Location getOrigin();
+
+ /**
+ * Get the location that is being depended upon.
+ * @return the location that is being depended upon.
+ */
+ Location getTarget();
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Deprecated_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.15.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Deprecated_attribute extends Attribute {
+ Deprecated_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ }
+
+ public Deprecated_attribute(ConstantPool constant_pool)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.Deprecated));
+ }
+
+ public Deprecated_attribute(int name_index) {
+ super(name_index, 0);
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitDeprecated(this, data);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Descriptor.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.4.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Descriptor {
+ public static class InvalidDescriptor extends DescriptorException {
+ private static final long serialVersionUID = 1L;
+ InvalidDescriptor(String desc) {
+ this.desc = desc;
+ this.index = -1;
+ }
+
+ InvalidDescriptor(String desc, int index) {
+ this.desc = desc;
+ this.index = index;
+ }
+
+ @Override
+ public String getMessage() {
+ // i18n
+ if (index == -1)
+ return "invalid descriptor \"" + desc + "\"";
+ else
+ return "descriptor is invalid at offset " + index + " in \"" + desc + "\"";
+ }
+
+ public final String desc;
+ public final int index;
+
+ }
+
+ public Descriptor(ClassReader cr) throws IOException {
+ this(cr.readUnsignedShort());
+ }
+
+ public Descriptor(int index) {
+ this.index = index;
+
+ }
+
+ public String getValue(ConstantPool constant_pool) throws ConstantPoolException {
+ return constant_pool.getUTF8Value(index);
+ }
+
+ public int getParameterCount(ConstantPool constant_pool)
+ throws ConstantPoolException, InvalidDescriptor {
+ String desc = getValue(constant_pool);
+ int end = desc.indexOf(")");
+ if (end == -1)
+ throw new InvalidDescriptor(desc);
+ parse(desc, 0, end + 1);
+ return count;
+
+ }
+
+ public String getParameterTypes(ConstantPool constant_pool)
+ throws ConstantPoolException, InvalidDescriptor {
+ String desc = getValue(constant_pool);
+ int end = desc.indexOf(")");
+ if (end == -1)
+ throw new InvalidDescriptor(desc);
+ return parse(desc, 0, end + 1);
+ }
+
+ public String getReturnType(ConstantPool constant_pool)
+ throws ConstantPoolException, InvalidDescriptor {
+ String desc = getValue(constant_pool);
+ int end = desc.indexOf(")");
+ if (end == -1)
+ throw new InvalidDescriptor(desc);
+ return parse(desc, end + 1, desc.length());
+ }
+
+ public String getFieldType(ConstantPool constant_pool)
+ throws ConstantPoolException, InvalidDescriptor {
+ String desc = getValue(constant_pool);
+ return parse(desc, 0, desc.length());
+ }
+
+ private String parse(String desc, int start, int end)
+ throws InvalidDescriptor {
+ int p = start;
+ StringBuilder sb = new StringBuilder();
+ int dims = 0;
+ count = 0;
+
+ while (p < end) {
+ String type;
+ char ch;
+ switch (ch = desc.charAt(p++)) {
+ case '(':
+ sb.append('(');
+ continue;
+
+ case ')':
+ sb.append(')');
+ continue;
+
+ case '[':
+ dims++;
+ continue;
+
+ case 'B':
+ type = "byte";
+ break;
+
+ case 'C':
+ type = "char";
+ break;
+
+ case 'D':
+ type = "double";
+ break;
+
+ case 'F':
+ type = "float";
+ break;
+
+ case 'I':
+ type = "int";
+ break;
+
+ case 'J':
+ type = "long";
+ break;
+
+ case 'L':
+ int sep = desc.indexOf(';', p);
+ if (sep == -1)
+ throw new InvalidDescriptor(desc, p - 1);
+ type = desc.substring(p, sep).replace('/', '.');
+ p = sep + 1;
+ break;
+
+ case 'S':
+ type = "short";
+ break;
+
+ case 'Z':
+ type = "boolean";
+ break;
+
+ case 'V':
+ type = "void";
+ break;
+
+ default:
+ throw new InvalidDescriptor(desc, p - 1);
+ }
+
+ if (sb.length() > 1 && sb.charAt(0) == '(')
+ sb.append(", ");
+ sb.append(type);
+ for ( ; dims > 0; dims-- )
+ sb.append("[]");
+
+ count++;
+ }
+
+ return sb.toString();
+ }
+
+ public final int index;
+ private int count;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/DescriptorException.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2008, 2009, 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.
+ */
+
+
+package com.sun.tools.classfile;
+
+/*
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class DescriptorException extends Exception {
+ private static final long serialVersionUID = 2411890273788901032L;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/EnclosingMethod_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,73 @@
+
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.7.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class EnclosingMethod_attribute extends Attribute {
+ EnclosingMethod_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ class_index = cr.readUnsignedShort();
+ method_index = cr.readUnsignedShort();
+ }
+
+ public EnclosingMethod_attribute(ConstantPool constant_pool, int class_index, int method_index)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.EnclosingMethod), class_index, method_index);
+ }
+
+ public EnclosingMethod_attribute(int name_index, int class_index, int method_index) {
+ super(name_index, 4);
+ this.class_index = class_index;
+ this.method_index = method_index;
+ }
+
+ public String getClassName(ConstantPool constant_pool) throws ConstantPoolException {
+ return constant_pool.getClassInfo(class_index).getName();
+ }
+
+ public String getMethodName(ConstantPool constant_pool) throws ConstantPoolException {
+ if (method_index == 0)
+ return "";
+ return constant_pool.getNameAndTypeInfo(method_index).getName();
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitEnclosingMethod(this, data);
+ }
+
+ public final int class_index;
+ public final int method_index;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Exceptions_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.5.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Exceptions_attribute extends Attribute {
+ Exceptions_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ number_of_exceptions = cr.readUnsignedShort();
+ exception_index_table = new int[number_of_exceptions];
+ for (int i = 0; i < number_of_exceptions; i++)
+ exception_index_table[i] = cr.readUnsignedShort();
+ }
+
+ public Exceptions_attribute(ConstantPool constant_pool, int[] exception_index_table)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.Exceptions), exception_index_table);
+ }
+
+ public Exceptions_attribute(int name_index, int[] exception_index_table) {
+ super(name_index, 2 + 2 * exception_index_table.length);
+ this.number_of_exceptions = exception_index_table.length;
+ this.exception_index_table = exception_index_table;
+ }
+
+ public String getException(int index, ConstantPool constant_pool) throws ConstantPoolException {
+ int exception_index = exception_index_table[index];
+ return constant_pool.getClassInfo(exception_index).getName();
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitExceptions(this, data);
+ }
+
+ public final int number_of_exceptions;
+ public final int[] exception_index_table;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Field.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/*
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Field {
+ Field(ClassReader cr) throws IOException {
+ access_flags = new AccessFlags(cr);
+ name_index = cr.readUnsignedShort();
+ descriptor = new Descriptor(cr);
+ attributes = new Attributes(cr);
+ }
+
+ public Field(AccessFlags access_flags,
+ int name_index, Descriptor descriptor,
+ Attributes attributes) {
+ this.access_flags = access_flags;
+ this.name_index = name_index;
+ this.descriptor = descriptor;
+ this.attributes = attributes;
+ }
+
+ public int byteLength() {
+ return 6 + attributes.byteLength();
+ }
+
+ public String getName(ConstantPool constant_pool) throws ConstantPoolException {
+ return constant_pool.getUTF8Value(name_index);
+ }
+
+ public final AccessFlags access_flags;
+ public final int name_index;
+ public final Descriptor descriptor;
+ public final Attributes attributes;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/InnerClasses_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+import com.sun.tools.classfile.ConstantPool.*;
+
+/**
+ * See JVMS, section 4.8.6.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class InnerClasses_attribute extends Attribute {
+ InnerClasses_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ number_of_classes = cr.readUnsignedShort();
+ classes = new Info[number_of_classes];
+ for (int i = 0; i < number_of_classes; i++)
+ classes[i] = new Info(cr);
+ }
+
+ public InnerClasses_attribute(ConstantPool constant_pool, Info[] classes)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.InnerClasses), classes);
+ }
+
+ public InnerClasses_attribute(int name_index, Info[] classes) {
+ super(name_index, 2 + Info.length() * classes.length);
+ this.number_of_classes = classes.length;
+ this.classes = classes;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitInnerClasses(this, data);
+ }
+
+ public final int number_of_classes;
+ public final Info[] classes;
+
+ public static class Info {
+ Info(ClassReader cr) throws IOException {
+ inner_class_info_index = cr.readUnsignedShort();
+ outer_class_info_index = cr.readUnsignedShort();
+ inner_name_index = cr.readUnsignedShort();
+ inner_class_access_flags = new AccessFlags(cr.readUnsignedShort());
+ }
+
+ public CONSTANT_Class_info getInnerClassInfo(ConstantPool constant_pool) throws ConstantPoolException {
+ if (inner_class_info_index == 0)
+ return null;
+ return constant_pool.getClassInfo(inner_class_info_index);
+ }
+
+ public CONSTANT_Class_info getOuterClassInfo(ConstantPool constant_pool) throws ConstantPoolException {
+ if (outer_class_info_index == 0)
+ return null;
+ return constant_pool.getClassInfo(outer_class_info_index);
+ }
+
+ public String getInnerName(ConstantPool constant_pool) throws ConstantPoolException {
+ if (inner_name_index == 0)
+ return null;
+ return constant_pool.getUTF8Value(inner_name_index);
+ }
+
+ public static int length() {
+ return 8;
+ }
+
+ public final int inner_class_info_index;
+ public final int outer_class_info_index;
+ public final int inner_name_index;
+ public final AccessFlags inner_class_access_flags;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Instruction.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,353 @@
+/*
+ * Copyright (c) 2009, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.util.Locale;
+
+/**
+ * See JVMS, chapter 6.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ *
+ * @see Code_attribute#getInstructions
+ */
+public class Instruction {
+ /** The kind of an instruction, as determined by the position, size and
+ * types of its operands. */
+ public static enum Kind {
+ /** Opcode is not followed by any operands. */
+ NO_OPERANDS(1),
+ /** Opcode is followed by a byte indicating a type. */
+ ATYPE(2),
+ /** Opcode is followed by a 2-byte branch offset. */
+ BRANCH(3),
+ /** Opcode is followed by a 4-byte branch offset. */
+ BRANCH_W(5),
+ /** Opcode is followed by a signed byte value. */
+ BYTE(2),
+ /** Opcode is followed by a 1-byte index into the constant pool. */
+ CPREF(2),
+ /** Opcode is followed by a 2-byte index into the constant pool. */
+ CPREF_W(3),
+ /** Opcode is followed by a 2-byte index into the constant pool,
+ * an unsigned byte value. */
+ CPREF_W_UBYTE(4),
+ /** Opcode is followed by a 2-byte index into the constant pool.,
+ * an unsigned byte value, and a zero byte. */
+ CPREF_W_UBYTE_ZERO(5),
+ /** Opcode is followed by variable number of operands, depending
+ * on the instruction.*/
+ DYNAMIC(-1),
+ /** Opcode is followed by a 1-byte reference to a local variable. */
+ LOCAL(2),
+ /** Opcode is followed by a 1-byte reference to a local variable,
+ * and a signed byte value. */
+ LOCAL_BYTE(3),
+ /** Opcode is followed by a signed short value. */
+ SHORT(3),
+ /** Wide opcode is not followed by any operands. */
+ WIDE_NO_OPERANDS(2),
+ /** Wide opcode is followed by a 2-byte index into the local variables array. */
+ WIDE_LOCAL(4),
+ /** Wide opcode is followed by a 2-byte index into the constant pool. */
+ WIDE_CPREF_W(4),
+ /** Wide opcode is followed by a 2-byte index into the constant pool,
+ * and a signed short value. */
+ WIDE_CPREF_W_SHORT(6),
+ /** Wide opcode is followed by a 2-byte reference to a local variable,
+ * and a signed short value. */
+ WIDE_LOCAL_SHORT(6),
+ /** Opcode was not recognized. */
+ UNKNOWN(1);
+
+ Kind(int length) {
+ this.length = length;
+ }
+
+ /** The length, in bytes, of this kind of instruction, or -1 is the
+ * length depends on the specific instruction. */
+ public final int length;
+ }
+
+ /** A utility visitor to help decode the operands of an instruction.
+ * @see Instruction#accept */
+ public interface KindVisitor<R,P> {
+ /** See {@link Kind#NO_OPERANDS}, {@link Kind#WIDE_NO_OPERANDS}. */
+ R visitNoOperands(Instruction instr, P p);
+ /** See {@link Kind#ATYPE}. */
+ R visitArrayType(Instruction instr, TypeKind kind, P p);
+ /** See {@link Kind#BRANCH}, {@link Kind#BRANCH_W}. */
+ R visitBranch(Instruction instr, int offset, P p);
+ /** See {@link Kind#CPREF}, {@link Kind#CPREF_W}, {@link Kind#WIDE_CPREF_W}. */
+ R visitConstantPoolRef(Instruction instr, int index, P p);
+ /** See {@link Kind#CPREF_W_UBYTE}, {@link Kind#CPREF_W_UBYTE_ZERO}, {@link Kind#WIDE_CPREF_W_SHORT}. */
+ R visitConstantPoolRefAndValue(Instruction instr, int index, int value, P p);
+ /** See {@link Kind#LOCAL}, {@link Kind#WIDE_LOCAL}. */
+ R visitLocal(Instruction instr, int index, P p);
+ /** See {@link Kind#LOCAL_BYTE}. */
+ R visitLocalAndValue(Instruction instr, int index, int value, P p);
+ /** See {@link Kind#DYNAMIC}. */
+ R visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, P p);
+ /** See {@link Kind#DYNAMIC}. */
+ R visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, P p);
+ /** See {@link Kind#BYTE}, {@link Kind#SHORT}. */
+ R visitValue(Instruction instr, int value, P p);
+ /** Instruction is unrecognized. */
+ R visitUnknown(Instruction instr, P p);
+
+ }
+
+ /** The kind of primitive array type to create.
+ * See JVMS chapter 6, newarray. */
+ public static enum TypeKind {
+ T_BOOLEAN(4, "boolean"),
+ T_CHAR(5, "char"),
+ T_FLOAT(6, "float"),
+ T_DOUBLE(7, "double"),
+ T_BYTE(8, "byte"),
+ T_SHORT(9, "short"),
+ T_INT (10, "int"),
+ T_LONG (11, "long");
+ TypeKind(int value, String name) {
+ this.value = value;
+ this.name = name;
+ }
+
+ public static TypeKind get(int value) {
+ switch (value) {
+ case 4: return T_BOOLEAN;
+ case 5: return T_CHAR;
+ case 6: return T_FLOAT;
+ case 7: return T_DOUBLE;
+ case 8: return T_BYTE;
+ case 9: return T_SHORT;
+ case 10: return T_INT;
+ case 11: return T_LONG;
+ default: return null;
+ }
+ }
+
+ public final int value;
+ public final String name;
+ }
+
+ /** An instruction is defined by its position in a bytecode array. */
+ public Instruction(byte[] bytes, int pc) {
+ this.bytes = bytes;
+ this.pc = pc;
+ }
+
+ /** Get the position of the instruction within the bytecode array. */
+ public int getPC() {
+ return pc;
+ }
+
+ /** Get a byte value, relative to the start of this instruction. */
+ public int getByte(int offset) {
+ return bytes[pc + offset];
+ }
+
+ /** Get an unsigned byte value, relative to the start of this instruction. */
+ public int getUnsignedByte(int offset) {
+ return getByte(offset) & 0xff;
+ }
+
+ /** Get a 2-byte value, relative to the start of this instruction. */
+ public int getShort(int offset) {
+ return (getByte(offset) << 8) | getUnsignedByte(offset + 1);
+ }
+
+ /** Get a unsigned 2-byte value, relative to the start of this instruction. */
+ public int getUnsignedShort(int offset) {
+ return getShort(offset) & 0xFFFF;
+ }
+
+ /** Get a 4-byte value, relative to the start of this instruction. */
+ public int getInt(int offset) {
+ return (getShort(offset) << 16) | (getUnsignedShort(offset + 2));
+ }
+
+ /** Get the Opcode for this instruction, or null if the instruction is
+ * unrecognized. */
+ public Opcode getOpcode() {
+ int b = getUnsignedByte(0);
+ switch (b) {
+ case Opcode.NONPRIV:
+ case Opcode.PRIV:
+ case Opcode.WIDE:
+ return Opcode.get(b, getUnsignedByte(1));
+ }
+ return Opcode.get(b);
+ }
+
+ /** Get the mnemonic for this instruction, or a default string if the
+ * instruction is unrecognized. */
+ public String getMnemonic() {
+ Opcode opcode = getOpcode();
+ if (opcode == null)
+ return "bytecode " + getUnsignedByte(0);
+ else
+ return opcode.toString().toLowerCase(Locale.US);
+ }
+
+ /** Get the length, in bytes, of this instruction, including the opcode
+ * and all its operands. */
+ public int length() {
+ Opcode opcode = getOpcode();
+ if (opcode == null)
+ return 1;
+
+ switch (opcode) {
+ case TABLESWITCH: {
+ int pad = align(pc + 1) - pc;
+ int low = getInt(pad + 4);
+ int high = getInt(pad + 8);
+ return pad + 12 + 4 * (high - low + 1);
+ }
+ case LOOKUPSWITCH: {
+ int pad = align(pc + 1) - pc;
+ int npairs = getInt(pad + 4);
+ return pad + 8 + 8 * npairs;
+
+ }
+ default:
+ return opcode.kind.length;
+ }
+ }
+
+ /** Get the {@link Kind} of this instruction. */
+ public Kind getKind() {
+ Opcode opcode = getOpcode();
+ return (opcode != null ? opcode.kind : Kind.UNKNOWN);
+ }
+
+ /** Invoke a method on the visitor according to the kind of this
+ * instruction, passing in the decoded operands for the instruction. */
+ public <R,P> R accept(KindVisitor<R,P> visitor, P p) {
+ switch (getKind()) {
+ case NO_OPERANDS:
+ return visitor.visitNoOperands(this, p);
+
+ case ATYPE:
+ return visitor.visitArrayType(
+ this, TypeKind.get(getUnsignedByte(1)), p);
+
+ case BRANCH:
+ return visitor.visitBranch(this, getShort(1), p);
+
+ case BRANCH_W:
+ return visitor.visitBranch(this, getInt(1), p);
+
+ case BYTE:
+ return visitor.visitValue(this, getByte(1), p);
+
+ case CPREF:
+ return visitor.visitConstantPoolRef(this, getUnsignedByte(1), p);
+
+ case CPREF_W:
+ return visitor.visitConstantPoolRef(this, getUnsignedShort(1), p);
+
+ case CPREF_W_UBYTE:
+ case CPREF_W_UBYTE_ZERO:
+ return visitor.visitConstantPoolRefAndValue(
+ this, getUnsignedShort(1), getUnsignedByte(3), p);
+
+ case DYNAMIC: {
+ switch (getOpcode()) {
+ case TABLESWITCH: {
+ int pad = align(pc + 1) - pc;
+ int default_ = getInt(pad);
+ int low = getInt(pad + 4);
+ int high = getInt(pad + 8);
+ int[] values = new int[high - low + 1];
+ for (int i = 0; i < values.length; i++)
+ values[i] = getInt(pad + 12 + 4 * i);
+ return visitor.visitTableSwitch(
+ this, default_, low, high, values, p);
+ }
+ case LOOKUPSWITCH: {
+ int pad = align(pc + 1) - pc;
+ int default_ = getInt(pad);
+ int npairs = getInt(pad + 4);
+ int[] matches = new int[npairs];
+ int[] offsets = new int[npairs];
+ for (int i = 0; i < npairs; i++) {
+ matches[i] = getInt(pad + 8 + i * 8);
+ offsets[i] = getInt(pad + 12 + i * 8);
+ }
+ return visitor.visitLookupSwitch(
+ this, default_, npairs, matches, offsets, p);
+ }
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+ case LOCAL:
+ return visitor.visitLocal(this, getUnsignedByte(1), p);
+
+ case LOCAL_BYTE:
+ return visitor.visitLocalAndValue(
+ this, getUnsignedByte(1), getByte(2), p);
+
+ case SHORT:
+ return visitor.visitValue(this, getShort(1), p);
+
+ case WIDE_NO_OPERANDS:
+ return visitor.visitNoOperands(this, p);
+
+ case WIDE_LOCAL:
+ return visitor.visitLocal(this, getUnsignedShort(2), p);
+
+ case WIDE_CPREF_W:
+ return visitor.visitConstantPoolRef(this, getUnsignedShort(2), p);
+
+ case WIDE_CPREF_W_SHORT:
+ return visitor.visitConstantPoolRefAndValue(
+ this, getUnsignedShort(2), getUnsignedByte(4), p);
+
+ case WIDE_LOCAL_SHORT:
+ return visitor.visitLocalAndValue(
+ this, getUnsignedShort(2), getShort(4), p);
+
+ case UNKNOWN:
+ return visitor.visitUnknown(this, p);
+
+ default:
+ throw new IllegalStateException();
+ }
+ }
+
+ private static int align(int n) {
+ return (n + 3) & ~3;
+ }
+
+ private byte[] bytes;
+ private int pc;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/LineNumberTable_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.12.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class LineNumberTable_attribute extends Attribute {
+ LineNumberTable_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ line_number_table_length = cr.readUnsignedShort();
+ line_number_table = new Entry[line_number_table_length];
+ for (int i = 0; i < line_number_table_length; i++)
+ line_number_table[i] = new Entry(cr);
+ }
+
+ public LineNumberTable_attribute(ConstantPool constant_pool, Entry[] line_number_table)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.LineNumberTable), line_number_table);
+ }
+
+ public LineNumberTable_attribute(int name_index, Entry[] line_number_table) {
+ super(name_index, 2 + line_number_table.length * Entry.length());
+ this.line_number_table_length = line_number_table.length;
+ this.line_number_table = line_number_table;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitLineNumberTable(this, data);
+ }
+
+ public final int line_number_table_length;
+ public final Entry[] line_number_table;
+
+ public static class Entry {
+ Entry(ClassReader cr) throws IOException {
+ start_pc = cr.readUnsignedShort();
+ line_number = cr.readUnsignedShort();
+ }
+
+ public static int length() {
+ return 4;
+ }
+
+ public final int start_pc;
+ public final int line_number;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/LocalVariableTable_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.13.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class LocalVariableTable_attribute extends Attribute {
+ LocalVariableTable_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ local_variable_table_length = cr.readUnsignedShort();
+ local_variable_table = new Entry[local_variable_table_length];
+ for (int i = 0; i < local_variable_table_length; i++)
+ local_variable_table[i] = new Entry(cr);
+ }
+
+ public LocalVariableTable_attribute(ConstantPool constant_pool, Entry[] local_variable_table)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.LocalVariableTable), local_variable_table);
+ }
+
+ public LocalVariableTable_attribute(int name_index, Entry[] local_variable_table) {
+ super(name_index, 2 + local_variable_table.length * Entry.length());
+ this.local_variable_table_length = local_variable_table.length;
+ this.local_variable_table = local_variable_table;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitLocalVariableTable(this, data);
+ }
+
+ public final int local_variable_table_length;
+ public final Entry[] local_variable_table;
+
+ public static class Entry {
+ Entry(ClassReader cr) throws IOException {
+ start_pc = cr.readUnsignedShort();
+ length = cr.readUnsignedShort();
+ name_index = cr.readUnsignedShort();
+ descriptor_index = cr.readUnsignedShort();
+ index = cr.readUnsignedShort();
+ }
+
+ public static int length() {
+ return 10;
+ }
+
+ public final int start_pc;
+ public final int length;
+ public final int name_index;
+ public final int descriptor_index;
+ public final int index;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/LocalVariableTypeTable_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.14.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class LocalVariableTypeTable_attribute extends Attribute {
+ LocalVariableTypeTable_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ local_variable_table_length = cr.readUnsignedShort();
+ local_variable_table = new Entry[local_variable_table_length];
+ for (int i = 0; i < local_variable_table_length; i++)
+ local_variable_table[i] = new Entry(cr);
+ }
+
+ public LocalVariableTypeTable_attribute(ConstantPool constant_pool, Entry[] local_variable_table)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.LocalVariableTypeTable), local_variable_table);
+ }
+
+ public LocalVariableTypeTable_attribute(int name_index, Entry[] local_variable_table) {
+ super(name_index, 2 + local_variable_table.length * Entry.length());
+ this.local_variable_table_length = local_variable_table.length;
+ this.local_variable_table = local_variable_table;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitLocalVariableTypeTable(this, data);
+ }
+
+ public final int local_variable_table_length;
+ public final Entry[] local_variable_table;
+
+ public static class Entry {
+ Entry(ClassReader cr) throws IOException {
+ start_pc = cr.readUnsignedShort();
+ length = cr.readUnsignedShort();
+ name_index = cr.readUnsignedShort();
+ signature_index = cr.readUnsignedShort();
+ index = cr.readUnsignedShort();
+ }
+
+ public static int length() {
+ return 10;
+ }
+
+ public final int start_pc;
+ public final int length;
+ public final int name_index;
+ public final int signature_index;
+ public final int index;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Method.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/*
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Method {
+ Method(ClassReader cr) throws IOException {
+ access_flags = new AccessFlags(cr);
+ name_index = cr.readUnsignedShort();
+ descriptor = new Descriptor(cr);
+ attributes = new Attributes(cr);
+ }
+
+ public Method(AccessFlags access_flags,
+ int name_index, Descriptor descriptor,
+ Attributes attributes) {
+ this.access_flags = access_flags;
+ this.name_index = name_index;
+ this.descriptor = descriptor;
+ this.attributes = attributes;
+ }
+
+ public int byteLength() {
+ return 6 + attributes.byteLength();
+ }
+
+ public String getName(ConstantPool constant_pool) throws ConstantPoolException {
+ return constant_pool.getUTF8Value(name_index);
+ }
+
+ public final AccessFlags access_flags;
+ public final int name_index;
+ public final Descriptor descriptor;
+ public final Attributes attributes;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/MethodParameters_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2012, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.13.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class MethodParameters_attribute extends Attribute {
+
+ public final int method_parameter_table_length;
+ public final Entry[] method_parameter_table;
+
+ MethodParameters_attribute(ClassReader cr,
+ int name_index,
+ int length)
+ throws IOException {
+ super(name_index, length);
+
+ method_parameter_table_length = cr.readUnsignedByte();
+ method_parameter_table = new Entry[method_parameter_table_length];
+ for (int i = 0; i < method_parameter_table_length; i++)
+ method_parameter_table[i] = new Entry(cr);
+ }
+
+ public MethodParameters_attribute(ConstantPool constant_pool,
+ Entry[] method_parameter_table)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.MethodParameters),
+ method_parameter_table);
+ }
+
+ public MethodParameters_attribute(int name_index,
+ Entry[] method_parameter_table) {
+ super(name_index, 1 + method_parameter_table.length * Entry.length());
+ this.method_parameter_table_length = method_parameter_table.length;
+ this.method_parameter_table = method_parameter_table;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitMethodParameters(this, data);
+ }
+
+ public static class Entry {
+ Entry(ClassReader cr) throws IOException {
+ name_index = cr.readUnsignedShort();
+ flags = cr.readUnsignedShort();
+ }
+
+ public static int length() {
+ return 6;
+ }
+
+ public final int name_index;
+ public final int flags;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Opcode.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,472 @@
+/*
+ * Copyright (c) 2009, 2012, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import static com.sun.tools.classfile.Instruction.Kind.*;
+import static com.sun.tools.classfile.Opcode.Set.*;
+
+/**
+ * See JVMS, chapter 6.
+ *
+ * <p>In addition to providing all the standard opcodes defined in JVMS,
+ * this class also provides legacy support for the PicoJava extensions.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public enum Opcode {
+ NOP(0x0),
+ ACONST_NULL(0x1),
+ ICONST_M1(0x2),
+ ICONST_0(0x3),
+ ICONST_1(0x4),
+ ICONST_2(0x5),
+ ICONST_3(0x6),
+ ICONST_4(0x7),
+ ICONST_5(0x8),
+ LCONST_0(0x9),
+ LCONST_1(0xa),
+ FCONST_0(0xb),
+ FCONST_1(0xc),
+ FCONST_2(0xd),
+ DCONST_0(0xe),
+ DCONST_1(0xf),
+ BIPUSH(0x10, BYTE),
+ SIPUSH(0x11, SHORT),
+ LDC(0x12, CPREF),
+ LDC_W(0x13, CPREF_W),
+ LDC2_W(0x14, CPREF_W),
+ ILOAD(0x15, LOCAL),
+ LLOAD(0x16, LOCAL),
+ FLOAD(0x17, LOCAL),
+ DLOAD(0x18, LOCAL),
+ ALOAD(0x19, LOCAL),
+ ILOAD_0(0x1a),
+ ILOAD_1(0x1b),
+ ILOAD_2(0x1c),
+ ILOAD_3(0x1d),
+ LLOAD_0(0x1e),
+ LLOAD_1(0x1f),
+ LLOAD_2(0x20),
+ LLOAD_3(0x21),
+ FLOAD_0(0x22),
+ FLOAD_1(0x23),
+ FLOAD_2(0x24),
+ FLOAD_3(0x25),
+ DLOAD_0(0x26),
+ DLOAD_1(0x27),
+ DLOAD_2(0x28),
+ DLOAD_3(0x29),
+ ALOAD_0(0x2a),
+ ALOAD_1(0x2b),
+ ALOAD_2(0x2c),
+ ALOAD_3(0x2d),
+ IALOAD(0x2e),
+ LALOAD(0x2f),
+ FALOAD(0x30),
+ DALOAD(0x31),
+ AALOAD(0x32),
+ BALOAD(0x33),
+ CALOAD(0x34),
+ SALOAD(0x35),
+ ISTORE(0x36, LOCAL),
+ LSTORE(0x37, LOCAL),
+ FSTORE(0x38, LOCAL),
+ DSTORE(0x39, LOCAL),
+ ASTORE(0x3a, LOCAL),
+ ISTORE_0(0x3b),
+ ISTORE_1(0x3c),
+ ISTORE_2(0x3d),
+ ISTORE_3(0x3e),
+ LSTORE_0(0x3f),
+ LSTORE_1(0x40),
+ LSTORE_2(0x41),
+ LSTORE_3(0x42),
+ FSTORE_0(0x43),
+ FSTORE_1(0x44),
+ FSTORE_2(0x45),
+ FSTORE_3(0x46),
+ DSTORE_0(0x47),
+ DSTORE_1(0x48),
+ DSTORE_2(0x49),
+ DSTORE_3(0x4a),
+ ASTORE_0(0x4b),
+ ASTORE_1(0x4c),
+ ASTORE_2(0x4d),
+ ASTORE_3(0x4e),
+ IASTORE(0x4f),
+ LASTORE(0x50),
+ FASTORE(0x51),
+ DASTORE(0x52),
+ AASTORE(0x53),
+ BASTORE(0x54),
+ CASTORE(0x55),
+ SASTORE(0x56),
+ POP(0x57),
+ POP2(0x58),
+ DUP(0x59),
+ DUP_X1(0x5a),
+ DUP_X2(0x5b),
+ DUP2(0x5c),
+ DUP2_X1(0x5d),
+ DUP2_X2(0x5e),
+ SWAP(0x5f),
+ IADD(0x60),
+ LADD(0x61),
+ FADD(0x62),
+ DADD(0x63),
+ ISUB(0x64),
+ LSUB(0x65),
+ FSUB(0x66),
+ DSUB(0x67),
+ IMUL(0x68),
+ LMUL(0x69),
+ FMUL(0x6a),
+ DMUL(0x6b),
+ IDIV(0x6c),
+ LDIV(0x6d),
+ FDIV(0x6e),
+ DDIV(0x6f),
+ IREM(0x70),
+ LREM(0x71),
+ FREM(0x72),
+ DREM(0x73),
+ INEG(0x74),
+ LNEG(0x75),
+ FNEG(0x76),
+ DNEG(0x77),
+ ISHL(0x78),
+ LSHL(0x79),
+ ISHR(0x7a),
+ LSHR(0x7b),
+ IUSHR(0x7c),
+ LUSHR(0x7d),
+ IAND(0x7e),
+ LAND(0x7f),
+ IOR(0x80),
+ LOR(0x81),
+ IXOR(0x82),
+ LXOR(0x83),
+ IINC(0x84, LOCAL_BYTE),
+ I2L(0x85),
+ I2F(0x86),
+ I2D(0x87),
+ L2I(0x88),
+ L2F(0x89),
+ L2D(0x8a),
+ F2I(0x8b),
+ F2L(0x8c),
+ F2D(0x8d),
+ D2I(0x8e),
+ D2L(0x8f),
+ D2F(0x90),
+ I2B(0x91),
+ I2C(0x92),
+ I2S(0x93),
+ LCMP(0x94),
+ FCMPL(0x95),
+ FCMPG(0x96),
+ DCMPL(0x97),
+ DCMPG(0x98),
+ IFEQ(0x99, BRANCH),
+ IFNE(0x9a, BRANCH),
+ IFLT(0x9b, BRANCH),
+ IFGE(0x9c, BRANCH),
+ IFGT(0x9d, BRANCH),
+ IFLE(0x9e, BRANCH),
+ IF_ICMPEQ(0x9f, BRANCH),
+ IF_ICMPNE(0xa0, BRANCH),
+ IF_ICMPLT(0xa1, BRANCH),
+ IF_ICMPGE(0xa2, BRANCH),
+ IF_ICMPGT(0xa3, BRANCH),
+ IF_ICMPLE(0xa4, BRANCH),
+ IF_ACMPEQ(0xa5, BRANCH),
+ IF_ACMPNE(0xa6, BRANCH),
+ GOTO(0xa7, BRANCH),
+ JSR(0xa8, BRANCH),
+ RET(0xa9, LOCAL),
+ TABLESWITCH(0xaa, DYNAMIC),
+ LOOKUPSWITCH(0xab, DYNAMIC),
+ IRETURN(0xac),
+ LRETURN(0xad),
+ FRETURN(0xae),
+ DRETURN(0xaf),
+ ARETURN(0xb0),
+ RETURN(0xb1),
+ GETSTATIC(0xb2, CPREF_W),
+ PUTSTATIC(0xb3, CPREF_W),
+ GETFIELD(0xb4, CPREF_W),
+ PUTFIELD(0xb5, CPREF_W),
+ INVOKEVIRTUAL(0xb6, CPREF_W),
+ INVOKESPECIAL(0xb7, CPREF_W),
+ INVOKESTATIC(0xb8, CPREF_W),
+ INVOKEINTERFACE(0xb9, CPREF_W_UBYTE_ZERO),
+ INVOKEDYNAMIC(0xba, CPREF_W_UBYTE_ZERO),
+ NEW(0xbb, CPREF_W),
+ NEWARRAY(0xbc, ATYPE),
+ ANEWARRAY(0xbd, CPREF_W),
+ ARRAYLENGTH(0xbe),
+ ATHROW(0xbf),
+ CHECKCAST(0xc0, CPREF_W),
+ INSTANCEOF(0xc1, CPREF_W),
+ MONITORENTER(0xc2),
+ MONITOREXIT(0xc3),
+ // wide 0xc4
+ MULTIANEWARRAY(0xc5, CPREF_W_UBYTE),
+ IFNULL(0xc6, BRANCH),
+ IFNONNULL(0xc7, BRANCH),
+ GOTO_W(0xc8, BRANCH_W),
+ JSR_W(0xc9, BRANCH_W),
+ // impdep 0xfe: PicoJava nonpriv
+ // impdep 0xff: Picojava priv
+
+ // wide opcodes
+ ILOAD_W(0xc415, WIDE_LOCAL),
+ LLOAD_W(0xc416, WIDE_LOCAL),
+ FLOAD_W(0xc417, WIDE_LOCAL),
+ DLOAD_W(0xc418, WIDE_LOCAL),
+ ALOAD_W(0xc419, WIDE_LOCAL),
+ ISTORE_W(0xc436, WIDE_LOCAL),
+ LSTORE_W(0xc437, WIDE_LOCAL),
+ FSTORE_W(0xc438, WIDE_LOCAL),
+ DSTORE_W(0xc439, WIDE_LOCAL),
+ ASTORE_W(0xc43a, WIDE_LOCAL),
+ IINC_W(0xc484, WIDE_LOCAL_SHORT),
+ RET_W(0xc4a9, WIDE_LOCAL),
+
+ // PicoJava nonpriv instructions
+ LOAD_UBYTE(PICOJAVA, 0xfe00),
+ LOAD_BYTE(PICOJAVA, 0xfe01),
+ LOAD_CHAR(PICOJAVA, 0xfe02),
+ LOAD_SHORT(PICOJAVA, 0xfe03),
+ LOAD_WORD(PICOJAVA, 0xfe04),
+ RET_FROM_SUB(PICOJAVA, 0xfe05),
+ LOAD_CHAR_OE(PICOJAVA, 0xfe0a),
+ LOAD_SHORT_OE(PICOJAVA, 0xfe0b),
+ LOAD_WORD_OE(PICOJAVA, 0xfe0c),
+ NCLOAD_UBYTE(PICOJAVA, 0xfe10),
+ NCLOAD_BYTE(PICOJAVA, 0xfe11),
+ NCLOAD_CHAR(PICOJAVA, 0xfe12),
+ NCLOAD_SHORT(PICOJAVA, 0xfe13),
+ NCLOAD_WORD(PICOJAVA, 0xfe14),
+ NCLOAD_CHAR_OE(PICOJAVA, 0xfe1a),
+ NCLOAD_SHORT_OE(PICOJAVA, 0xfe1b),
+ NCLOAD_WORD_OE(PICOJAVA, 0xfe1c),
+ CACHE_FLUSH(PICOJAVA, 0xfe1e),
+ STORE_BYTE(PICOJAVA, 0xfe20),
+ STORE_SHORT(PICOJAVA, 0xfe22),
+ STORE_WORD(PICOJAVA, 0xfe24),
+ STORE_SHORT_OE(PICOJAVA, 0xfe2a),
+ STORE_WORD_OE(PICOJAVA, 0xfe2c),
+ NCSTORE_BYTE(PICOJAVA, 0xfe30),
+ NCSTORE_SHORT(PICOJAVA, 0xfe32),
+ NCSTORE_WORD(PICOJAVA, 0xfe34),
+ NCSTORE_SHORT_OE(PICOJAVA, 0xfe3a),
+ NCSTORE_WORD_OE(PICOJAVA, 0xfe3c),
+ ZERO_LINE(PICOJAVA, 0xfe3e),
+ ENTER_SYNC_METHOD(PICOJAVA, 0xfe3f),
+
+ // PicoJava priv instructions
+ PRIV_LOAD_UBYTE(PICOJAVA, 0xff00),
+ PRIV_LOAD_BYTE(PICOJAVA, 0xff01),
+ PRIV_LOAD_CHAR(PICOJAVA, 0xff02),
+ PRIV_LOAD_SHORT(PICOJAVA, 0xff03),
+ PRIV_LOAD_WORD(PICOJAVA, 0xff04),
+ PRIV_RET_FROM_TRAP(PICOJAVA, 0xff05),
+ PRIV_READ_DCACHE_TAG(PICOJAVA, 0xff06),
+ PRIV_READ_DCACHE_DATA(PICOJAVA, 0xff07),
+ PRIV_LOAD_CHAR_OE(PICOJAVA, 0xff0a),
+ PRIV_LOAD_SHORT_OE(PICOJAVA, 0xff0b),
+ PRIV_LOAD_WORD_OE(PICOJAVA, 0xff0c),
+ PRIV_READ_ICACHE_TAG(PICOJAVA, 0xff0e),
+ PRIV_READ_ICACHE_DATA(PICOJAVA, 0xff0f),
+ PRIV_NCLOAD_UBYTE(PICOJAVA, 0xff10),
+ PRIV_NCLOAD_BYTE(PICOJAVA, 0xff11),
+ PRIV_NCLOAD_CHAR(PICOJAVA, 0xff12),
+ PRIV_NCLOAD_SHORT(PICOJAVA, 0xff13),
+ PRIV_NCLOAD_WORD(PICOJAVA, 0xff14),
+ PRIV_POWERDOWN(PICOJAVA, 0xff16),
+ PRIV_READ_SCACHE_DATA(PICOJAVA, 0xff17),
+ PRIV_NCLOAD_CHAR_OE(PICOJAVA, 0xff1a),
+ PRIV_NCLOAD_SHORT_OE(PICOJAVA, 0xff1b),
+ PRIV_NCLOAD_WORD_OE(PICOJAVA, 0xff1c),
+ PRIV_CACHE_FLUSH(PICOJAVA, 0xff1e),
+ PRIV_CACHE_INDEX_FLUSH(PICOJAVA, 0xff1f),
+ PRIV_STORE_BYTE(PICOJAVA, 0xff20),
+ PRIV_STORE_SHORT(PICOJAVA, 0xff22),
+ PRIV_STORE_WORD(PICOJAVA, 0xff24),
+ PRIV_WRITE_DCACHE_TAG(PICOJAVA, 0xff26),
+ PRIV_WRITE_DCACHE_DATA(PICOJAVA, 0xff27),
+ PRIV_STORE_SHORT_OE(PICOJAVA, 0xff2a),
+ PRIV_STORE_WORD_OE(PICOJAVA, 0xff2c),
+ PRIV_WRITE_ICACHE_TAG(PICOJAVA, 0xff2e),
+ PRIV_WRITE_ICACHE_DATA(PICOJAVA, 0xff2f),
+ PRIV_NCSTORE_BYTE(PICOJAVA, 0xff30),
+ PRIV_NCSTORE_SHORT(PICOJAVA, 0xff32),
+ PRIV_NCSTORE_WORD(PICOJAVA, 0xff34),
+ PRIV_RESET(PICOJAVA, 0xff36),
+ PRIV_WRITE_SCACHE_DATA(PICOJAVA, 0xff37),
+ PRIV_NCSTORE_SHORT_OE(PICOJAVA, 0xff3a),
+ PRIV_NCSTORE_WORD_OE(PICOJAVA, 0xff3c),
+ PRIV_ZERO_LINE(PICOJAVA, 0xff3e),
+ PRIV_READ_REG_0(PICOJAVA, 0xff40),
+ PRIV_READ_REG_1(PICOJAVA, 0xff41),
+ PRIV_READ_REG_2(PICOJAVA, 0xff42),
+ PRIV_READ_REG_3(PICOJAVA, 0xff43),
+ PRIV_READ_REG_4(PICOJAVA, 0xff44),
+ PRIV_READ_REG_5(PICOJAVA, 0xff45),
+ PRIV_READ_REG_6(PICOJAVA, 0xff46),
+ PRIV_READ_REG_7(PICOJAVA, 0xff47),
+ PRIV_READ_REG_8(PICOJAVA, 0xff48),
+ PRIV_READ_REG_9(PICOJAVA, 0xff49),
+ PRIV_READ_REG_10(PICOJAVA, 0xff4a),
+ PRIV_READ_REG_11(PICOJAVA, 0xff4b),
+ PRIV_READ_REG_12(PICOJAVA, 0xff4c),
+ PRIV_READ_REG_13(PICOJAVA, 0xff4d),
+ PRIV_READ_REG_14(PICOJAVA, 0xff4e),
+ PRIV_READ_REG_15(PICOJAVA, 0xff4f),
+ PRIV_READ_REG_16(PICOJAVA, 0xff50),
+ PRIV_READ_REG_17(PICOJAVA, 0xff51),
+ PRIV_READ_REG_18(PICOJAVA, 0xff52),
+ PRIV_READ_REG_19(PICOJAVA, 0xff53),
+ PRIV_READ_REG_20(PICOJAVA, 0xff54),
+ PRIV_READ_REG_21(PICOJAVA, 0xff55),
+ PRIV_READ_REG_22(PICOJAVA, 0xff56),
+ PRIV_READ_REG_23(PICOJAVA, 0xff57),
+ PRIV_READ_REG_24(PICOJAVA, 0xff58),
+ PRIV_READ_REG_25(PICOJAVA, 0xff59),
+ PRIV_READ_REG_26(PICOJAVA, 0xff5a),
+ PRIV_READ_REG_27(PICOJAVA, 0xff5b),
+ PRIV_READ_REG_28(PICOJAVA, 0xff5c),
+ PRIV_READ_REG_29(PICOJAVA, 0xff5d),
+ PRIV_READ_REG_30(PICOJAVA, 0xff5e),
+ PRIV_READ_REG_31(PICOJAVA, 0xff5f),
+ PRIV_WRITE_REG_0(PICOJAVA, 0xff60),
+ PRIV_WRITE_REG_1(PICOJAVA, 0xff61),
+ PRIV_WRITE_REG_2(PICOJAVA, 0xff62),
+ PRIV_WRITE_REG_3(PICOJAVA, 0xff63),
+ PRIV_WRITE_REG_4(PICOJAVA, 0xff64),
+ PRIV_WRITE_REG_5(PICOJAVA, 0xff65),
+ PRIV_WRITE_REG_6(PICOJAVA, 0xff66),
+ PRIV_WRITE_REG_7(PICOJAVA, 0xff67),
+ PRIV_WRITE_REG_8(PICOJAVA, 0xff68),
+ PRIV_WRITE_REG_9(PICOJAVA, 0xff69),
+ PRIV_WRITE_REG_10(PICOJAVA, 0xff6a),
+ PRIV_WRITE_REG_11(PICOJAVA, 0xff6b),
+ PRIV_WRITE_REG_12(PICOJAVA, 0xff6c),
+ PRIV_WRITE_REG_13(PICOJAVA, 0xff6d),
+ PRIV_WRITE_REG_14(PICOJAVA, 0xff6e),
+ PRIV_WRITE_REG_15(PICOJAVA, 0xff6f),
+ PRIV_WRITE_REG_16(PICOJAVA, 0xff70),
+ PRIV_WRITE_REG_17(PICOJAVA, 0xff71),
+ PRIV_WRITE_REG_18(PICOJAVA, 0xff72),
+ PRIV_WRITE_REG_19(PICOJAVA, 0xff73),
+ PRIV_WRITE_REG_20(PICOJAVA, 0xff74),
+ PRIV_WRITE_REG_21(PICOJAVA, 0xff75),
+ PRIV_WRITE_REG_22(PICOJAVA, 0xff76),
+ PRIV_WRITE_REG_23(PICOJAVA, 0xff77),
+ PRIV_WRITE_REG_24(PICOJAVA, 0xff78),
+ PRIV_WRITE_REG_25(PICOJAVA, 0xff79),
+ PRIV_WRITE_REG_26(PICOJAVA, 0xff7a),
+ PRIV_WRITE_REG_27(PICOJAVA, 0xff7b),
+ PRIV_WRITE_REG_28(PICOJAVA, 0xff7c),
+ PRIV_WRITE_REG_29(PICOJAVA, 0xff7d),
+ PRIV_WRITE_REG_30(PICOJAVA, 0xff7e),
+ PRIV_WRITE_REG_31(PICOJAVA, 0xff7f);
+
+ Opcode(int opcode) {
+ this(STANDARD, opcode, NO_OPERANDS);
+ }
+
+ Opcode(int opcode, Instruction.Kind kind) {
+ this(STANDARD, opcode, kind);
+ }
+
+ Opcode(Set set, int opcode) {
+ this(set, opcode, (set == STANDARD ? NO_OPERANDS : WIDE_NO_OPERANDS));
+ }
+
+ Opcode(Set set, int opcode, Instruction.Kind kind) {
+ this.set = set;
+ this.opcode = opcode;
+ this.kind = kind;
+ }
+
+ public final Set set;
+ public final int opcode;
+ public final Instruction.Kind kind;
+
+ /** Get the Opcode for a simple standard 1-byte opcode. */
+ public static Opcode get(int opcode) {
+ return stdOpcodes[opcode];
+ }
+
+ /** Get the Opcode for 1- or 2-byte opcode. */
+ public static Opcode get(int opcodePrefix, int opcode) {
+ Opcode[] block = getOpcodeBlock(opcodePrefix);
+ return (block == null ? null : block[opcode]);
+ }
+
+ private static Opcode[] getOpcodeBlock(int opcodePrefix) {
+ switch (opcodePrefix) {
+ case 0:
+ return stdOpcodes;
+ case WIDE:
+ return wideOpcodes;
+ case NONPRIV:
+ return nonPrivOpcodes;
+ case PRIV:
+ return privOpcodes;
+ default:
+ return null;
+ }
+
+ }
+
+ private static final Opcode[] stdOpcodes = new Opcode[256];
+ private static final Opcode[] wideOpcodes = new Opcode[256];
+ private static final Opcode[] nonPrivOpcodes = new Opcode[256];
+ private static final Opcode[] privOpcodes = new Opcode[256];
+ static {
+ for (Opcode o: values())
+ getOpcodeBlock(o.opcode >> 8)[o.opcode & 0xff] = o;
+ }
+
+ /** The byte prefix for the wide instructions. */
+ public static final int WIDE = 0xc4;
+ /** The byte prefix for the PicoJava nonpriv instructions. */
+ public static final int NONPRIV = 0xfe;
+ /** The byte prefix for the PicoJava priv instructions. */
+ public static final int PRIV = 0xff;
+
+ public enum Set {
+ /** Standard opcodes. */
+ STANDARD,
+ /** Legacy support for PicoJava opcodes. */
+ PICOJAVA }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ReferenceFinder.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import com.sun.tools.classfile.Instruction.TypeKind;
+import static com.sun.tools.classfile.ConstantPool.*;
+
+/**
+ * A utility class to find where in a ClassFile references
+ * a {@link CONSTANT_Methodref_info method},
+ * a {@link CONSTANT_InterfaceMethodref_info interface method,
+ * or a {@link CONSTANT_Fieldref_info field}.
+ */
+public final class ReferenceFinder {
+ /**
+ * Filter for ReferenceFinder of what constant pool entries for reference lookup.
+ */
+ public interface Filter {
+ /**
+ * Decides if the given CPRefInfo entry should be accepted or filtered.
+ *
+ * @param cpool ConstantPool of the ClassFile being parsed
+ * @param cpref constant pool entry representing a reference to
+ * a fields method, and interface method.
+ * @return {@code true} if accepted; otherwise {@code false}
+ */
+ boolean accept(ConstantPool cpool, CPRefInfo cpref);
+ }
+
+ /**
+ * Visitor of individual method of a ClassFile that references the
+ * accepted field, method, or interface method references.
+ */
+ public interface Visitor {
+ /**
+ * Invoked for a method containing one or more accepted CPRefInfo entries
+ *
+ * @param cf ClassFile
+ * @param method Method that does the references the accepted references
+ * @param refs Accepted constant pool method/field reference
+ */
+ void visit(ClassFile cf, Method method, List<CPRefInfo> refConstantPool);
+ }
+
+ private final Filter filter;
+ private final Visitor visitor;
+
+ /**
+ * Constructor.
+ */
+ public ReferenceFinder(Filter filter, Visitor visitor) {
+ this.filter = Objects.requireNonNull(filter);
+ this.visitor = Objects.requireNonNull(visitor);
+ }
+
+ /**
+ * Parses a given ClassFile and invoke the visitor if there is any reference
+ * to the constant pool entries referencing field, method, or
+ * interface method that are accepted. This method will return
+ * {@code true} if there is one or more accepted constant pool entries
+ * to lookup; otherwise, it will return {@code false}.
+ *
+ * @param cf ClassFile
+ * @return {@code true} if the given class file is processed to lookup
+ * references
+ * @throws ConstantPoolException if an error of the constant pool
+ */
+ public boolean parse(ClassFile cf) throws ConstantPoolException {
+ List<Integer> cprefs = new ArrayList<>();
+ int index = 1;
+ for (ConstantPool.CPInfo cpInfo : cf.constant_pool.entries()) {
+ if (cpInfo.accept(cpVisitor, cf.constant_pool)) {
+ cprefs.add(index);
+ }
+ index += cpInfo.size();
+ }
+
+ if (cprefs.isEmpty()) {
+ return false;
+ }
+
+ for (Method m : cf.methods) {
+ Set<Integer> ids = new HashSet<>();
+ Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code);
+ if (c_attr != null) {
+ for (Instruction instr : c_attr.getInstructions()) {
+ int idx = instr.accept(codeVisitor, cprefs);
+ if (idx > 0) {
+ ids.add(idx);
+ }
+ }
+ }
+ if (ids.size() > 0) {
+ List<CPRefInfo> refInfos = new ArrayList<>(ids.size());
+ for (int id : ids) {
+ refInfos.add(CPRefInfo.class.cast(cf.constant_pool.get(id)));
+ }
+ visitor.visit(cf, m, refInfos);
+ }
+ }
+ return true;
+ }
+
+ private ConstantPool.Visitor<Boolean,ConstantPool> cpVisitor =
+ new ConstantPool.Visitor<Boolean,ConstantPool>()
+ {
+ public Boolean visitClass(CONSTANT_Class_info info, ConstantPool cpool) {
+ return false;
+ }
+
+ public Boolean visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, ConstantPool cpool) {
+ return filter.accept(cpool, info);
+ }
+
+ public Boolean visitMethodref(CONSTANT_Methodref_info info, ConstantPool cpool) {
+ return filter.accept(cpool, info);
+ }
+
+ public Boolean visitFieldref(CONSTANT_Fieldref_info info, ConstantPool cpool) {
+ return filter.accept(cpool, info);
+ }
+
+ public Boolean visitDouble(CONSTANT_Double_info info, ConstantPool cpool) {
+ return false;
+ }
+
+ public Boolean visitFloat(CONSTANT_Float_info info, ConstantPool cpool) {
+ return false;
+ }
+
+ public Boolean visitInteger(CONSTANT_Integer_info info, ConstantPool cpool) {
+ return false;
+ }
+
+ public Boolean visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, ConstantPool cpool) {
+ return false;
+ }
+
+ public Boolean visitLong(CONSTANT_Long_info info, ConstantPool cpool) {
+ return false;
+ }
+
+ public Boolean visitNameAndType(CONSTANT_NameAndType_info info, ConstantPool cpool) {
+ return false;
+ }
+
+ public Boolean visitMethodHandle(CONSTANT_MethodHandle_info info, ConstantPool cpool) {
+ return false;
+ }
+
+ public Boolean visitMethodType(CONSTANT_MethodType_info info, ConstantPool cpool) {
+ return false;
+ }
+
+ public Boolean visitString(CONSTANT_String_info info, ConstantPool cpool) {
+ return false;
+ }
+
+ public Boolean visitUtf8(CONSTANT_Utf8_info info, ConstantPool cpool) {
+ return false;
+ }
+ };
+
+ private Instruction.KindVisitor<Integer, List<Integer>> codeVisitor =
+ new Instruction.KindVisitor<Integer, List<Integer>>()
+ {
+ public Integer visitNoOperands(Instruction instr, List<Integer> p) {
+ return 0;
+ }
+
+ public Integer visitArrayType(Instruction instr, TypeKind kind, List<Integer> p) {
+ return 0;
+ }
+
+ public Integer visitBranch(Instruction instr, int offset, List<Integer> p) {
+ return 0;
+ }
+
+ public Integer visitConstantPoolRef(Instruction instr, int index, List<Integer> p) {
+ return p.contains(index) ? index : 0;
+ }
+
+ public Integer visitConstantPoolRefAndValue(Instruction instr, int index, int value, List<Integer> p) {
+ return p.contains(index) ? index : 0;
+ }
+
+ public Integer visitLocal(Instruction instr, int index, List<Integer> p) {
+ return 0;
+ }
+
+ public Integer visitLocalAndValue(Instruction instr, int index, int value, List<Integer> p) {
+ return 0;
+ }
+
+ public Integer visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, List<Integer> p) {
+ return 0;
+ }
+
+ public Integer visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, List<Integer> p) {
+ return 0;
+ }
+
+ public Integer visitValue(Instruction instr, int value, List<Integer> p) {
+ return 0;
+ }
+
+ public Integer visitUnknown(Instruction instr, List<Integer> p) {
+ return 0;
+ }
+ };
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RuntimeAnnotations_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.16 and 4.8.17.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public abstract class RuntimeAnnotations_attribute extends Attribute {
+ protected RuntimeAnnotations_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, Annotation.InvalidAnnotation {
+ super(name_index, length);
+ int num_annotations = cr.readUnsignedShort();
+ annotations = new Annotation[num_annotations];
+ for (int i = 0; i < annotations.length; i++)
+ annotations[i] = new Annotation(cr);
+ }
+
+ protected RuntimeAnnotations_attribute(int name_index, Annotation[] annotations) {
+ super(name_index, length(annotations));
+ this.annotations = annotations;
+ }
+
+ private static int length(Annotation[] annos) {
+ int n = 2;
+ for (Annotation anno: annos)
+ n += anno.length();
+ return n;
+ }
+
+ public final Annotation[] annotations;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RuntimeInvisibleAnnotations_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.17.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class RuntimeInvisibleAnnotations_attribute extends RuntimeAnnotations_attribute {
+ RuntimeInvisibleAnnotations_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, AttributeException {
+ super(cr, name_index, length);
+ }
+
+ public RuntimeInvisibleAnnotations_attribute(ConstantPool cp, Annotation[] annotations)
+ throws ConstantPoolException {
+ this(cp.getUTF8Index(Attribute.RuntimeInvisibleAnnotations), annotations);
+ }
+
+ public RuntimeInvisibleAnnotations_attribute(int name_index, Annotation[] annotations) {
+ super(name_index, annotations);
+ }
+
+ public <R, P> R accept(Visitor<R, P> visitor, P p) {
+ return visitor.visitRuntimeInvisibleAnnotations(this, p);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RuntimeInvisibleParameterAnnotations_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.18.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class RuntimeInvisibleParameterAnnotations_attribute extends RuntimeParameterAnnotations_attribute {
+ RuntimeInvisibleParameterAnnotations_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, Annotation.InvalidAnnotation {
+ super(cr, name_index, length);
+ }
+
+ public RuntimeInvisibleParameterAnnotations_attribute(ConstantPool cp, Annotation[][] parameter_annotations)
+ throws ConstantPoolException {
+ this(cp.getUTF8Index(Attribute.RuntimeInvisibleParameterAnnotations), parameter_annotations);
+ }
+
+ public RuntimeInvisibleParameterAnnotations_attribute(int name_index, Annotation[][] parameter_annotations) {
+ super(name_index, parameter_annotations);
+ }
+
+ public <R, P> R accept(Visitor<R, P> visitor, P p) {
+ return visitor.visitRuntimeInvisibleParameterAnnotations(this, p);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RuntimeInvisibleTypeAnnotations_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JSR 308 specification, Section 3.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class RuntimeInvisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
+ RuntimeInvisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, Annotation.InvalidAnnotation {
+ super(cr, name_index, length);
+ }
+
+ public RuntimeInvisibleTypeAnnotations_attribute(ConstantPool cp, TypeAnnotation[] annotations)
+ throws ConstantPoolException {
+ this(cp.getUTF8Index(Attribute.RuntimeInvisibleTypeAnnotations), annotations);
+ }
+
+ public RuntimeInvisibleTypeAnnotations_attribute(int name_index, TypeAnnotation[] annotations) {
+ super(name_index, annotations);
+ }
+
+ public <R, P> R accept(Visitor<R, P> visitor, P p) {
+ return visitor.visitRuntimeInvisibleTypeAnnotations(this, p);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RuntimeParameterAnnotations_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.18 and 4.8.19.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public abstract class RuntimeParameterAnnotations_attribute extends Attribute {
+ RuntimeParameterAnnotations_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, Annotation.InvalidAnnotation {
+ super(name_index, length);
+ int num_parameters = cr.readUnsignedByte();
+ parameter_annotations = new Annotation[num_parameters][];
+ for (int p = 0; p < parameter_annotations.length; p++) {
+ int num_annotations = cr.readUnsignedShort();
+ Annotation[] annotations = new Annotation[num_annotations];
+ for (int i = 0; i < num_annotations; i++)
+ annotations[i] = new Annotation(cr);
+ parameter_annotations[p] = annotations;
+ }
+ }
+
+ protected RuntimeParameterAnnotations_attribute(int name_index, Annotation[][] parameter_annotations) {
+ super(name_index, length(parameter_annotations));
+ this.parameter_annotations = parameter_annotations;
+ }
+
+ private static int length(Annotation[][] anno_arrays) {
+ int n = 1;
+ for (Annotation[] anno_array: anno_arrays) {
+ n += 2;
+ for (Annotation anno: anno_array)
+ n += anno.length();
+ }
+ return n;
+ }
+
+ public final Annotation[][] parameter_annotations;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RuntimeTypeAnnotations_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JSR 308 specification, Section 3.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public abstract class RuntimeTypeAnnotations_attribute extends Attribute {
+ protected RuntimeTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, Annotation.InvalidAnnotation {
+ super(name_index, length);
+ int num_annotations = cr.readUnsignedShort();
+ annotations = new TypeAnnotation[num_annotations];
+ for (int i = 0; i < annotations.length; i++)
+ annotations[i] = new TypeAnnotation(cr);
+ }
+
+ protected RuntimeTypeAnnotations_attribute(int name_index, TypeAnnotation[] annotations) {
+ super(name_index, length(annotations));
+ this.annotations = annotations;
+ }
+
+ private static int length(TypeAnnotation[] annos) {
+ int n = 2;
+ for (TypeAnnotation anno: annos)
+ n += anno.length();
+ return n;
+ }
+
+ public final TypeAnnotation[] annotations;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RuntimeVisibleAnnotations_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.16.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class RuntimeVisibleAnnotations_attribute extends RuntimeAnnotations_attribute {
+ RuntimeVisibleAnnotations_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, Annotation.InvalidAnnotation {
+ super(cr, name_index, length);
+ }
+
+ public RuntimeVisibleAnnotations_attribute(ConstantPool cp, Annotation[] annotations)
+ throws ConstantPoolException {
+ this(cp.getUTF8Index(Attribute.RuntimeVisibleAnnotations), annotations);
+ }
+
+ public RuntimeVisibleAnnotations_attribute(int name_index, Annotation[] annotations) {
+ super(name_index, annotations);
+ }
+
+ public <R, P> R accept(Visitor<R, P> visitor, P p) {
+ return visitor.visitRuntimeVisibleAnnotations(this, p);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RuntimeVisibleParameterAnnotations_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.18.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class RuntimeVisibleParameterAnnotations_attribute extends RuntimeParameterAnnotations_attribute {
+ RuntimeVisibleParameterAnnotations_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, Annotation.InvalidAnnotation {
+ super(cr, name_index, length);
+ }
+
+ public RuntimeVisibleParameterAnnotations_attribute(ConstantPool cp, Annotation[][] parameter_annotations)
+ throws ConstantPoolException {
+ this(cp.getUTF8Index(Attribute.RuntimeVisibleParameterAnnotations), parameter_annotations);
+ }
+
+ public RuntimeVisibleParameterAnnotations_attribute(int name_index, Annotation[][] parameter_annotations) {
+ super(name_index, parameter_annotations);
+ }
+
+ public <R, P> R accept(Visitor<R, P> visitor, P p) {
+ return visitor.visitRuntimeVisibleParameterAnnotations(this, p);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/RuntimeVisibleTypeAnnotations_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JSR 308 specification, Section 3.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class RuntimeVisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
+ RuntimeVisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, Annotation.InvalidAnnotation {
+ super(cr, name_index, length);
+ }
+
+ public RuntimeVisibleTypeAnnotations_attribute(ConstantPool cp, TypeAnnotation[] annotations)
+ throws ConstantPoolException {
+ this(cp.getUTF8Index(Attribute.RuntimeVisibleTypeAnnotations), annotations);
+ }
+
+ public RuntimeVisibleTypeAnnotations_attribute(int name_index, TypeAnnotation[] annotations) {
+ super(name_index, annotations);
+ }
+
+ public <R, P> R accept(Visitor<R, P> visitor, P p) {
+ return visitor.visitRuntimeVisibleTypeAnnotations(this, p);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Signature.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.sun.tools.classfile.Type.*;
+
+/**
+ * See JVMS 4.4.4.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Signature extends Descriptor {
+
+ public Signature(int index) {
+ super(index);
+ }
+
+ public Type getType(ConstantPool constant_pool) throws ConstantPoolException {
+ if (type == null)
+ type = parse(getValue(constant_pool));
+ return type;
+ }
+
+ @Override
+ public int getParameterCount(ConstantPool constant_pool) throws ConstantPoolException {
+ MethodType m = (MethodType) getType(constant_pool);
+ return m.paramTypes.size();
+ }
+
+ @Override
+ public String getParameterTypes(ConstantPool constant_pool) throws ConstantPoolException {
+ MethodType m = (MethodType) getType(constant_pool);
+ StringBuilder sb = new StringBuilder();
+ sb.append("(");
+ String sep = "";
+ for (Type paramType: m.paramTypes) {
+ sb.append(sep);
+ sb.append(paramType);
+ sep = ", ";
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ @Override
+ public String getReturnType(ConstantPool constant_pool) throws ConstantPoolException {
+ MethodType m = (MethodType) getType(constant_pool);
+ return m.returnType.toString();
+ }
+
+ @Override
+ public String getFieldType(ConstantPool constant_pool) throws ConstantPoolException {
+ return getType(constant_pool).toString();
+ }
+
+ private Type parse(String sig) {
+ this.sig = sig;
+ sigp = 0;
+
+ List<TypeParamType> typeParamTypes = null;
+ if (sig.charAt(sigp) == '<')
+ typeParamTypes = parseTypeParamTypes();
+
+ if (sig.charAt(sigp) == '(') {
+ List<Type> paramTypes = parseTypeSignatures(')');
+ Type returnType = parseTypeSignature();
+ List<Type> throwsTypes = null;
+ while (sigp < sig.length() && sig.charAt(sigp) == '^') {
+ sigp++;
+ if (throwsTypes == null)
+ throwsTypes = new ArrayList<>();
+ throwsTypes.add(parseTypeSignature());
+ }
+ return new MethodType(typeParamTypes, paramTypes, returnType, throwsTypes);
+ } else {
+ Type t = parseTypeSignature();
+ if (typeParamTypes == null && sigp == sig.length())
+ return t;
+ Type superclass = t;
+ List<Type> superinterfaces = null;
+ while (sigp < sig.length()) {
+ if (superinterfaces == null)
+ superinterfaces = new ArrayList<>();
+ superinterfaces.add(parseTypeSignature());
+ }
+ return new ClassSigType(typeParamTypes, superclass, superinterfaces);
+
+ }
+ }
+
+ private Type parseTypeSignature() {
+ switch (sig.charAt(sigp)) {
+ case 'B':
+ sigp++;
+ return new SimpleType("byte");
+
+ case 'C':
+ sigp++;
+ return new SimpleType("char");
+
+ case 'D':
+ sigp++;
+ return new SimpleType("double");
+
+ case 'F':
+ sigp++;
+ return new SimpleType("float");
+
+ case 'I':
+ sigp++;
+ return new SimpleType("int");
+
+ case 'J':
+ sigp++;
+ return new SimpleType("long");
+
+ case 'L':
+ return parseClassTypeSignature();
+
+ case 'S':
+ sigp++;
+ return new SimpleType("short");
+
+ case 'T':
+ return parseTypeVariableSignature();
+
+ case 'V':
+ sigp++;
+ return new SimpleType("void");
+
+ case 'Z':
+ sigp++;
+ return new SimpleType("boolean");
+
+ case '[':
+ sigp++;
+ return new ArrayType(parseTypeSignature());
+
+ case '*':
+ sigp++;
+ return new WildcardType();
+
+ case '+':
+ sigp++;
+ return new WildcardType(WildcardType.Kind.EXTENDS, parseTypeSignature());
+
+ case '-':
+ sigp++;
+ return new WildcardType(WildcardType.Kind.SUPER, parseTypeSignature());
+
+ default:
+ throw new IllegalStateException(debugInfo());
+ }
+ }
+
+ private List<Type> parseTypeSignatures(char term) {
+ sigp++;
+ List<Type> types = new ArrayList<>();
+ while (sig.charAt(sigp) != term)
+ types.add(parseTypeSignature());
+ sigp++;
+ return types;
+ }
+
+ private Type parseClassTypeSignature() {
+ assert sig.charAt(sigp) == 'L';
+ sigp++;
+ return parseClassTypeSignatureRest();
+ }
+
+ private Type parseClassTypeSignatureRest() {
+ StringBuilder sb = new StringBuilder();
+ List<Type> argTypes = null;
+ ClassType t = null;
+ char sigch ;
+
+ do {
+ switch (sigch = sig.charAt(sigp)) {
+ case '<':
+ argTypes = parseTypeSignatures('>');
+ break;
+
+ case '.':
+ case ';':
+ sigp++;
+ t = new ClassType(t, sb.toString(), argTypes);
+ sb.setLength(0);
+ argTypes = null;
+ break;
+
+ default:
+ sigp++;
+ sb.append(sigch);
+ break;
+ }
+ } while (sigch != ';');
+
+ return t;
+ }
+
+ private List<TypeParamType> parseTypeParamTypes() {
+ assert sig.charAt(sigp) == '<';
+ sigp++;
+ List<TypeParamType> types = new ArrayList<>();
+ while (sig.charAt(sigp) != '>')
+ types.add(parseTypeParamType());
+ sigp++;
+ return types;
+ }
+
+ private TypeParamType parseTypeParamType() {
+ int sep = sig.indexOf(":", sigp);
+ String name = sig.substring(sigp, sep);
+ Type classBound = null;
+ List<Type> interfaceBounds = null;
+ sigp = sep + 1;
+ if (sig.charAt(sigp) != ':')
+ classBound = parseTypeSignature();
+ while (sig.charAt(sigp) == ':') {
+ sigp++;
+ if (interfaceBounds == null)
+ interfaceBounds = new ArrayList<>();
+ interfaceBounds.add(parseTypeSignature());
+ }
+ return new TypeParamType(name, classBound, interfaceBounds);
+ }
+
+ private Type parseTypeVariableSignature() {
+ sigp++;
+ int sep = sig.indexOf(';', sigp);
+ Type t = new SimpleType(sig.substring(sigp, sep));
+ sigp = sep + 1;
+ return t;
+ }
+
+ private String debugInfo() {
+ return sig.substring(0, sigp) + "!" + sig.charAt(sigp) + "!" + sig.substring(sigp+1);
+ }
+
+ private String sig;
+ private int sigp;
+
+ private Type type;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Signature_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.9.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Signature_attribute extends Attribute {
+ Signature_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ signature_index = cr.readUnsignedShort();
+ }
+
+ public Signature_attribute(ConstantPool constant_pool, int signature_index)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.Signature), signature_index);
+ }
+
+ public Signature_attribute(int name_index, int signature_index) {
+ super(name_index, 2);
+ this.signature_index = signature_index;
+ }
+
+ public String getSignature(ConstantPool constant_pool) throws ConstantPoolException {
+ return constant_pool.getUTF8Value(signature_index);
+ }
+
+ public Signature getParsedSignature() {
+ return new Signature(signature_index);
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitSignature(this, data);
+ }
+
+ public final int signature_index;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/SourceDebugExtension_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+/**
+ * See JVMS, section 4.8.15.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class SourceDebugExtension_attribute extends Attribute {
+ private static final Charset UTF8 = Charset.forName("UTF-8");
+
+ SourceDebugExtension_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ debug_extension = new byte[attribute_length];
+ cr.readFully(debug_extension);
+ }
+
+ public SourceDebugExtension_attribute(ConstantPool constant_pool, byte[] debug_extension)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.SourceDebugExtension), debug_extension);
+ }
+
+ public SourceDebugExtension_attribute(int name_index, byte[] debug_extension) {
+ super(name_index, debug_extension.length);
+ this.debug_extension = debug_extension;
+ }
+
+ public String getValue() {
+ return new String(debug_extension, UTF8);
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitSourceDebugExtension(this, data);
+ }
+
+ public final byte[] debug_extension;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/SourceFile_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.10.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class SourceFile_attribute extends Attribute {
+ SourceFile_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ sourcefile_index = cr.readUnsignedShort();
+ }
+
+ public SourceFile_attribute(ConstantPool constant_pool, int sourcefile_index)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.SourceFile), sourcefile_index);
+ }
+
+ public SourceFile_attribute(int name_index, int sourcefile_index) {
+ super(name_index, 2);
+ this.sourcefile_index = sourcefile_index;
+ }
+
+ public String getSourceFile(ConstantPool constant_pool) throws ConstantPoolException {
+ return constant_pool.getUTF8Value(sourcefile_index);
+ }
+
+ public <R, P> R accept(Visitor<R, P> visitor, P p) {
+ return visitor.visitSourceFile(this, p);
+ }
+
+ public final int sourcefile_index;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/SourceID_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2008, 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.
+ */
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class SourceID_attribute extends Attribute {
+
+ SourceID_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ sourceID_index = cr.readUnsignedShort();
+ }
+
+ public SourceID_attribute(ConstantPool constant_pool, int sourceID_index)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.SourceID), sourceID_index);
+ }
+
+ public SourceID_attribute(int name_index, int sourceID_index) {
+ super(name_index, 2);
+ this.sourceID_index = sourceID_index;
+ }
+
+ String getSourceID(ConstantPool constant_pool) throws ConstantPoolException {
+ return constant_pool.getUTF8Value(sourceID_index);
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitSourceID(this, data);
+ }
+
+ public final int sourceID_index;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/StackMapTable_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2007, 2009, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.4.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class StackMapTable_attribute extends Attribute {
+ static class InvalidStackMap extends AttributeException {
+ private static final long serialVersionUID = -5659038410855089780L;
+ InvalidStackMap(String msg) {
+ super(msg);
+ }
+ }
+
+ StackMapTable_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, InvalidStackMap {
+ super(name_index, length);
+ number_of_entries = cr.readUnsignedShort();
+ entries = new stack_map_frame[number_of_entries];
+ for (int i = 0; i < number_of_entries; i++)
+ entries[i] = stack_map_frame.read(cr);
+ }
+
+ public StackMapTable_attribute(ConstantPool constant_pool, stack_map_frame[] entries)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.StackMapTable), entries);
+ }
+
+ public StackMapTable_attribute(int name_index, stack_map_frame[] entries) {
+ super(name_index, length(entries));
+ this.number_of_entries = entries.length;
+ this.entries = entries;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitStackMapTable(this, data);
+ }
+
+ static int length(stack_map_frame[] entries) {
+ int n = 2;
+ for (stack_map_frame entry: entries)
+ n += entry.length();
+ return n;
+ }
+
+ public final int number_of_entries;
+ public final stack_map_frame entries[];
+
+ public static abstract class stack_map_frame {
+ static stack_map_frame read(ClassReader cr)
+ throws IOException, InvalidStackMap {
+ int frame_type = cr.readUnsignedByte();
+ if (frame_type <= 63)
+ return new same_frame(frame_type);
+ else if (frame_type <= 127)
+ return new same_locals_1_stack_item_frame(frame_type, cr);
+ else if (frame_type <= 246)
+ throw new Error("unknown frame_type " + frame_type);
+ else if (frame_type == 247)
+ return new same_locals_1_stack_item_frame_extended(frame_type, cr);
+ else if (frame_type <= 250)
+ return new chop_frame(frame_type, cr);
+ else if (frame_type == 251)
+ return new same_frame_extended(frame_type, cr);
+ else if (frame_type <= 254)
+ return new append_frame(frame_type, cr);
+ else
+ return new full_frame(frame_type, cr);
+ }
+
+ protected stack_map_frame(int frame_type) {
+ this.frame_type = frame_type;
+ }
+
+ public int length() {
+ return 1;
+ }
+
+ public abstract int getOffsetDelta();
+
+ public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
+
+ public final int frame_type;
+
+ public static interface Visitor<R,P> {
+ R visit_same_frame(same_frame frame, P p);
+ R visit_same_locals_1_stack_item_frame(same_locals_1_stack_item_frame frame, P p);
+ R visit_same_locals_1_stack_item_frame_extended(same_locals_1_stack_item_frame_extended frame, P p);
+ R visit_chop_frame(chop_frame frame, P p);
+ R visit_same_frame_extended(same_frame_extended frame, P p);
+ R visit_append_frame(append_frame frame, P p);
+ R visit_full_frame(full_frame frame, P p);
+ }
+ }
+
+ public static class same_frame extends stack_map_frame {
+ same_frame(int frame_type) {
+ super(frame_type);
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visit_same_frame(this, data);
+ }
+
+ public int getOffsetDelta() {
+ return frame_type;
+ }
+ }
+
+ public static class same_locals_1_stack_item_frame extends stack_map_frame {
+ same_locals_1_stack_item_frame(int frame_type, ClassReader cr)
+ throws IOException, InvalidStackMap {
+ super(frame_type);
+ stack = new verification_type_info[1];
+ stack[0] = verification_type_info.read(cr);
+ }
+
+ @Override
+ public int length() {
+ return super.length() + stack[0].length();
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visit_same_locals_1_stack_item_frame(this, data);
+ }
+
+ public int getOffsetDelta() {
+ return frame_type - 64;
+ }
+
+ public final verification_type_info[] stack;
+ }
+
+ public static class same_locals_1_stack_item_frame_extended extends stack_map_frame {
+ same_locals_1_stack_item_frame_extended(int frame_type, ClassReader cr)
+ throws IOException, InvalidStackMap {
+ super(frame_type);
+ offset_delta = cr.readUnsignedShort();
+ stack = new verification_type_info[1];
+ stack[0] = verification_type_info.read(cr);
+ }
+
+ @Override
+ public int length() {
+ return super.length() + 2 + stack[0].length();
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visit_same_locals_1_stack_item_frame_extended(this, data);
+ }
+
+ public int getOffsetDelta() {
+ return offset_delta;
+ }
+
+ public final int offset_delta;
+ public final verification_type_info[] stack;
+ }
+
+ public static class chop_frame extends stack_map_frame {
+ chop_frame(int frame_type, ClassReader cr) throws IOException {
+ super(frame_type);
+ offset_delta = cr.readUnsignedShort();
+ }
+
+ @Override
+ public int length() {
+ return super.length() + 2;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visit_chop_frame(this, data);
+ }
+
+ public int getOffsetDelta() {
+ return offset_delta;
+ }
+
+ public final int offset_delta;
+ }
+
+ public static class same_frame_extended extends stack_map_frame {
+ same_frame_extended(int frame_type, ClassReader cr) throws IOException {
+ super(frame_type);
+ offset_delta = cr.readUnsignedShort();
+ }
+
+ @Override
+ public int length() {
+ return super.length() + 2;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visit_same_frame_extended(this, data);
+ }
+
+ public int getOffsetDelta() {
+ return offset_delta;
+ }
+
+ public final int offset_delta;
+ }
+
+ public static class append_frame extends stack_map_frame {
+ append_frame(int frame_type, ClassReader cr)
+ throws IOException, InvalidStackMap {
+ super(frame_type);
+ offset_delta = cr.readUnsignedShort();
+ locals = new verification_type_info[frame_type - 251];
+ for (int i = 0; i < locals.length; i++)
+ locals[i] = verification_type_info.read(cr);
+ }
+
+ @Override
+ public int length() {
+ int n = super.length() + 2;
+ for (verification_type_info local: locals)
+ n += local.length();
+ return n;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visit_append_frame(this, data);
+ }
+
+ public int getOffsetDelta() {
+ return offset_delta;
+ }
+
+ public final int offset_delta;
+ public final verification_type_info[] locals;
+ }
+
+ public static class full_frame extends stack_map_frame {
+ full_frame(int frame_type, ClassReader cr)
+ throws IOException, InvalidStackMap {
+ super(frame_type);
+ offset_delta = cr.readUnsignedShort();
+ number_of_locals = cr.readUnsignedShort();
+ locals = new verification_type_info[number_of_locals];
+ for (int i = 0; i < locals.length; i++)
+ locals[i] = verification_type_info.read(cr);
+ number_of_stack_items = cr.readUnsignedShort();
+ stack = new verification_type_info[number_of_stack_items];
+ for (int i = 0; i < stack.length; i++)
+ stack[i] = verification_type_info.read(cr);
+ }
+
+ @Override
+ public int length() {
+ int n = super.length() + 2;
+ for (verification_type_info local: locals)
+ n += local.length();
+ n += 2;
+ for (verification_type_info item: stack)
+ n += item.length();
+ return n;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visit_full_frame(this, data);
+ }
+
+ public int getOffsetDelta() {
+ return offset_delta;
+ }
+
+ public final int offset_delta;
+ public final int number_of_locals;
+ public final verification_type_info[] locals;
+ public final int number_of_stack_items;
+ public final verification_type_info[] stack;
+ }
+
+ public static class verification_type_info {
+ public static final int ITEM_Top = 0;
+ public static final int ITEM_Integer = 1;
+ public static final int ITEM_Float = 2;
+ public static final int ITEM_Long = 4;
+ public static final int ITEM_Double = 3;
+ public static final int ITEM_Null = 5;
+ public static final int ITEM_UninitializedThis = 6;
+ public static final int ITEM_Object = 7;
+ public static final int ITEM_Uninitialized = 8;
+
+ static verification_type_info read(ClassReader cr)
+ throws IOException, InvalidStackMap {
+ int tag = cr.readUnsignedByte();
+ switch (tag) {
+ case ITEM_Top:
+ case ITEM_Integer:
+ case ITEM_Float:
+ case ITEM_Long:
+ case ITEM_Double:
+ case ITEM_Null:
+ case ITEM_UninitializedThis:
+ return new verification_type_info(tag);
+
+ case ITEM_Object:
+ return new Object_variable_info(cr);
+
+ case ITEM_Uninitialized:
+ return new Uninitialized_variable_info(cr);
+
+ default:
+ throw new InvalidStackMap("unrecognized verification_type_info tag");
+ }
+ }
+
+ protected verification_type_info(int tag) {
+ this.tag = tag;
+ }
+
+ public int length() {
+ return 1;
+ }
+
+ public final int tag;
+ }
+
+ public static class Object_variable_info extends verification_type_info {
+ Object_variable_info(ClassReader cr) throws IOException {
+ super(ITEM_Object);
+ cpool_index = cr.readUnsignedShort();
+ }
+
+ @Override
+ public int length() {
+ return super.length() + 2;
+ }
+
+ public final int cpool_index;
+ }
+
+ public static class Uninitialized_variable_info extends verification_type_info {
+ Uninitialized_variable_info(ClassReader cr) throws IOException {
+ super(ITEM_Uninitialized);
+ offset = cr.readUnsignedShort();
+ }
+
+ @Override
+ public int length() {
+ return super.length() + 2;
+ }
+
+ public final int offset;
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/StackMap_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class StackMap_attribute extends Attribute {
+ StackMap_attribute(ClassReader cr, int name_index, int length)
+ throws IOException, StackMapTable_attribute.InvalidStackMap {
+ super(name_index, length);
+ number_of_entries = cr.readUnsignedShort();
+ entries = new stack_map_frame[number_of_entries];
+ for (int i = 0; i < number_of_entries; i++)
+ entries[i] = new stack_map_frame(cr);
+ }
+
+ public StackMap_attribute(ConstantPool constant_pool, stack_map_frame[] entries)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.StackMap), entries);
+ }
+
+ public StackMap_attribute(int name_index, stack_map_frame[] entries) {
+ super(name_index, StackMapTable_attribute.length(entries));
+ this.number_of_entries = entries.length;
+ this.entries = entries;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitStackMap(this, data);
+ }
+
+ public final int number_of_entries;
+ public final stack_map_frame entries[];
+
+ public static class stack_map_frame extends StackMapTable_attribute.full_frame {
+ stack_map_frame(ClassReader cr)
+ throws IOException, StackMapTable_attribute.InvalidStackMap {
+ super(255, cr);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Synthetic_attribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.8.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Synthetic_attribute extends Attribute {
+ Synthetic_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ super(name_index, length);
+ }
+
+ public Synthetic_attribute(ConstantPool constant_pool)
+ throws ConstantPoolException {
+ this(constant_pool.getUTF8Index(Attribute.Synthetic));
+ }
+
+ public Synthetic_attribute(int name_index) {
+ super(name_index, 0);
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitSynthetic(this, data);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Type.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,378 @@
+/*
+ * Copyright (c) 2008, 2011, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/*
+ * Family of classes used to represent the parsed form of a {@link Descriptor}
+ * or {@link Signature}.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public abstract class Type {
+ protected Type() { }
+
+ public boolean isObject() {
+ return false;
+ }
+
+ public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
+
+ protected static void append(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) {
+ sb.append(prefix);
+ String sep = "";
+ for (Type t: types) {
+ sb.append(sep);
+ sb.append(t);
+ sep = ", ";
+ }
+ sb.append(suffix);
+ }
+
+ protected static void appendIfNotEmpty(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) {
+ if (types != null && types.size() > 0)
+ append(sb, prefix, types, suffix);
+ }
+
+ public interface Visitor<R,P> {
+ R visitSimpleType(SimpleType type, P p);
+ R visitArrayType(ArrayType type, P p);
+ R visitMethodType(MethodType type, P p);
+ R visitClassSigType(ClassSigType type, P p);
+ R visitClassType(ClassType type, P p);
+ R visitTypeParamType(TypeParamType type, P p);
+ R visitWildcardType(WildcardType type, P p);
+ }
+
+ /**
+ * Represents a type signature with a simple name. The name may be that of a
+ * primitive type, such "{@code int}, {@code float}, etc
+ * or that of a type argument, such as {@code T}, {@code K}, {@code V}, etc.
+ *
+ * See:
+ * JVMS 4.3.2
+ * BaseType:
+ * {@code B}, {@code C}, {@code D}, {@code F}, {@code I},
+ * {@code J}, {@code S}, {@code Z};
+ * VoidDescriptor:
+ * {@code V};
+ * JVMS 4.3.4
+ * TypeVariableSignature:
+ * {@code T} Identifier {@code ;}
+ */
+ public static class SimpleType extends Type {
+ public SimpleType(String name) {
+ this.name = name;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitSimpleType(this, data);
+ }
+
+ public boolean isPrimitiveType() {
+ return primitiveTypes.contains(name);
+ }
+ // where
+ private static final Set<String> primitiveTypes = new HashSet<>(Arrays.asList(
+ "boolean", "byte", "char", "double", "float", "int", "long", "short", "void"));
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ public final String name;
+ }
+
+ /**
+ * Represents an array type signature.
+ *
+ * See:
+ * JVMS 4.3.4
+ * ArrayTypeSignature:
+ * {@code [} TypeSignature {@code ]}
+ */
+ public static class ArrayType extends Type {
+ public ArrayType(Type elemType) {
+ this.elemType = elemType;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitArrayType(this, data);
+ }
+
+ @Override
+ public String toString() {
+ return elemType + "[]";
+ }
+
+ public final Type elemType;
+ }
+
+ /**
+ * Represents a method type signature.
+ *
+ * See;
+ * JVMS 4.3.4
+ * MethodTypeSignature:
+ * FormalTypeParameters_opt {@code (} TypeSignature* {@code)} ReturnType
+ * ThrowsSignature*
+ */
+ public static class MethodType extends Type {
+ public MethodType(List<? extends Type> paramTypes, Type resultType) {
+ this(null, paramTypes, resultType, null);
+ }
+
+ public MethodType(List<? extends TypeParamType> typeParamTypes,
+ List<? extends Type> paramTypes,
+ Type returnType,
+ List<? extends Type> throwsTypes) {
+ this.typeParamTypes = typeParamTypes;
+ this.paramTypes = paramTypes;
+ this.returnType = returnType;
+ this.throwsTypes = throwsTypes;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitMethodType(this, data);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ appendIfNotEmpty(sb, "<", typeParamTypes, "> ");
+ sb.append(returnType);
+ append(sb, " (", paramTypes, ")");
+ appendIfNotEmpty(sb, " throws ", throwsTypes, "");
+ return sb.toString();
+ }
+
+ public final List<? extends TypeParamType> typeParamTypes;
+ public final List<? extends Type> paramTypes;
+ public final Type returnType;
+ public final List<? extends Type> throwsTypes;
+ }
+
+ /**
+ * Represents a class signature. These describe the signature of
+ * a class that has type arguments.
+ *
+ * See:
+ * JVMS 4.3.4
+ * ClassSignature:
+ * FormalTypeParameters_opt SuperclassSignature SuperinterfaceSignature*
+ */
+ public static class ClassSigType extends Type {
+ public ClassSigType(List<TypeParamType> typeParamTypes, Type superclassType,
+ List<Type> superinterfaceTypes) {
+ this.typeParamTypes = typeParamTypes;
+ this.superclassType = superclassType;
+ this.superinterfaceTypes = superinterfaceTypes;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitClassSigType(this, data);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ appendIfNotEmpty(sb, "<", typeParamTypes, ">");
+ if (superclassType != null) {
+ sb.append(" extends ");
+ sb.append(superclassType);
+ }
+ appendIfNotEmpty(sb, " implements ", superinterfaceTypes, "");
+ return sb.toString();
+ }
+
+ public final List<TypeParamType> typeParamTypes;
+ public final Type superclassType;
+ public final List<Type> superinterfaceTypes;
+ }
+
+ /**
+ * Represents a class type signature. This is used to represent a
+ * reference to a class, such as in a field, parameter, return type, etc.
+ *
+ * See:
+ * JVMS 4.3.4
+ * ClassTypeSignature:
+ * {@code L} PackageSpecifier_opt SimpleClassTypeSignature
+ * ClassTypeSignatureSuffix* {@code ;}
+ * PackageSpecifier:
+ * Identifier {@code /} PackageSpecifier*
+ * SimpleClassTypeSignature:
+ * Identifier TypeArguments_opt }
+ * ClassTypeSignatureSuffix:
+ * {@code .} SimpleClassTypeSignature
+ */
+ public static class ClassType extends Type {
+ public ClassType(ClassType outerType, String name, List<Type> typeArgs) {
+ this.outerType = outerType;
+ this.name = name;
+ this.typeArgs = typeArgs;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitClassType(this, data);
+ }
+
+ public String getBinaryName() {
+ if (outerType == null)
+ return name;
+ else
+ return (outerType.getBinaryName() + "$" + name);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ if (outerType != null) {
+ sb.append(outerType);
+ sb.append(".");
+ }
+ sb.append(name);
+ appendIfNotEmpty(sb, "<", typeArgs, ">");
+ return sb.toString();
+ }
+
+ @Override
+ public boolean isObject() {
+ return (outerType == null)
+ && name.equals("java/lang/Object")
+ && (typeArgs == null || typeArgs.isEmpty());
+ }
+
+ public final ClassType outerType;
+ public final String name;
+ public final List<Type> typeArgs;
+ }
+
+ /**
+ * Represents a FormalTypeParameter. These are used to declare the type
+ * parameters for generic classes and methods.
+ *
+ * See:
+ * JVMS 4.3.4
+ * FormalTypeParameters:
+ * {@code <} FormalTypeParameter+ {@code >}
+ * FormalTypeParameter:
+ * Identifier ClassBound InterfaceBound*
+ * ClassBound:
+ * {@code :} FieldTypeSignature_opt
+ * InterfaceBound:
+ * {@code :} FieldTypeSignature
+ */
+ public static class TypeParamType extends Type {
+ public TypeParamType(String name, Type classBound, List<Type> interfaceBounds) {
+ this.name = name;
+ this.classBound = classBound;
+ this.interfaceBounds = interfaceBounds;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitTypeParamType(this, data);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(name);
+ String sep = " extends ";
+ if (classBound != null) {
+ sb.append(sep);
+ sb.append(classBound);
+ sep = " & ";
+ }
+ if (interfaceBounds != null) {
+ for (Type bound: interfaceBounds) {
+ sb.append(sep);
+ sb.append(bound);
+ sep = " & ";
+ }
+ }
+ return sb.toString();
+ }
+
+ public final String name;
+ public final Type classBound;
+ public final List<Type> interfaceBounds;
+ }
+
+ /**
+ * Represents a wildcard type argument. A type argument that is not a
+ * wildcard type argument will be represented by a ClassType, ArrayType, etc.
+ *
+ * See:
+ * JVMS 4.3.4
+ * TypeArgument:
+ * WildcardIndicator_opt FieldTypeSignature
+ * {@code *}
+ * WildcardIndicator:
+ * {@code +}
+ * {@code -}
+ */
+ public static class WildcardType extends Type {
+ public enum Kind { UNBOUNDED, EXTENDS, SUPER }
+
+ public WildcardType() {
+ this(Kind.UNBOUNDED, null);
+ }
+ public WildcardType(Kind kind, Type boundType) {
+ this.kind = kind;
+ this.boundType = boundType;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitWildcardType(this, data);
+ }
+
+ @Override
+ public String toString() {
+ switch (kind) {
+ case UNBOUNDED:
+ return "?";
+ case EXTENDS:
+ return "? extends " + boundType;
+ case SUPER:
+ return "? super " + boundType;
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ public final Kind kind;
+ public final Type boundType;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/TypeAnnotation.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,657 @@
+/*
+ * Copyright (c) 2009, 2013, 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.sun.tools.classfile.TypeAnnotation.Position.TypePathEntry;
+
+/**
+ * See JSR 308 specification, Section 3.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class TypeAnnotation {
+ TypeAnnotation(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
+ constant_pool = cr.getConstantPool();
+ position = read_position(cr);
+ annotation = new Annotation(cr);
+ }
+
+ public TypeAnnotation(ConstantPool constant_pool,
+ Annotation annotation, Position position) {
+ this.constant_pool = constant_pool;
+ this.position = position;
+ this.annotation = annotation;
+ }
+
+ public int length() {
+ int n = annotation.length();
+ n += position_length(position);
+ return n;
+ }
+
+ @Override
+ public String toString() {
+ try {
+ return "@" + constant_pool.getUTF8Value(annotation.type_index).toString().substring(1) +
+ " pos: " + position.toString();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return e.toString();
+ }
+ }
+
+ public final ConstantPool constant_pool;
+ public final Position position;
+ public final Annotation annotation;
+
+ private static Position read_position(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
+ // Copied from ClassReader
+ int tag = cr.readUnsignedByte(); // TargetType tag is a byte
+ if (!TargetType.isValidTargetTypeValue(tag))
+ throw new Annotation.InvalidAnnotation("TypeAnnotation: Invalid type annotation target type value: " + String.format("0x%02X", tag));
+
+ TargetType type = TargetType.fromTargetTypeValue(tag);
+
+ Position position = new Position();
+ position.type = type;
+
+ switch (type) {
+ // instanceof
+ case INSTANCEOF:
+ // new expression
+ case NEW:
+ // constructor/method reference receiver
+ case CONSTRUCTOR_REFERENCE:
+ case METHOD_REFERENCE:
+ position.offset = cr.readUnsignedShort();
+ break;
+ // local variable
+ case LOCAL_VARIABLE:
+ // resource variable
+ case RESOURCE_VARIABLE:
+ int table_length = cr.readUnsignedShort();
+ position.lvarOffset = new int[table_length];
+ position.lvarLength = new int[table_length];
+ position.lvarIndex = new int[table_length];
+ for (int i = 0; i < table_length; ++i) {
+ position.lvarOffset[i] = cr.readUnsignedShort();
+ position.lvarLength[i] = cr.readUnsignedShort();
+ position.lvarIndex[i] = cr.readUnsignedShort();
+ }
+ break;
+ // exception parameter
+ case EXCEPTION_PARAMETER:
+ position.exception_index = cr.readUnsignedShort();
+ break;
+ // method receiver
+ case METHOD_RECEIVER:
+ // Do nothing
+ break;
+ // type parameter
+ case CLASS_TYPE_PARAMETER:
+ case METHOD_TYPE_PARAMETER:
+ position.parameter_index = cr.readUnsignedByte();
+ break;
+ // type parameter bound
+ case CLASS_TYPE_PARAMETER_BOUND:
+ case METHOD_TYPE_PARAMETER_BOUND:
+ position.parameter_index = cr.readUnsignedByte();
+ position.bound_index = cr.readUnsignedByte();
+ break;
+ // class extends or implements clause
+ case CLASS_EXTENDS:
+ int in = cr.readUnsignedShort();
+ if (in == 0xFFFF)
+ in = -1;
+ position.type_index = in;
+ break;
+ // throws
+ case THROWS:
+ position.type_index = cr.readUnsignedShort();
+ break;
+ // method parameter
+ case METHOD_FORMAL_PARAMETER:
+ position.parameter_index = cr.readUnsignedByte();
+ break;
+ // type cast
+ case CAST:
+ // method/constructor/reference type argument
+ case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+ case METHOD_INVOCATION_TYPE_ARGUMENT:
+ case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+ case METHOD_REFERENCE_TYPE_ARGUMENT:
+ position.offset = cr.readUnsignedShort();
+ position.type_index = cr.readUnsignedByte();
+ break;
+ // We don't need to worry about these
+ case METHOD_RETURN:
+ case FIELD:
+ break;
+ case UNKNOWN:
+ throw new AssertionError("TypeAnnotation: UNKNOWN target type should never occur!");
+ default:
+ throw new AssertionError("TypeAnnotation: Unknown target type: " + type);
+ }
+
+ { // Write type path
+ int len = cr.readUnsignedByte();
+ List<Integer> loc = new ArrayList<>(len);
+ for (int i = 0; i < len * TypePathEntry.bytesPerEntry; ++i)
+ loc.add(cr.readUnsignedByte());
+ position.location = Position.getTypePathFromBinary(loc);
+ }
+ return position;
+ }
+
+ private static int position_length(Position pos) {
+ int n = 0;
+ n += 1; // TargetType tag is a byte
+ switch (pos.type) {
+ // instanceof
+ case INSTANCEOF:
+ // new expression
+ case NEW:
+ // constructor/method reference receiver
+ case CONSTRUCTOR_REFERENCE:
+ case METHOD_REFERENCE:
+ n += 2; // offset
+ break;
+ // local variable
+ case LOCAL_VARIABLE:
+ // resource variable
+ case RESOURCE_VARIABLE:
+ n += 2; // table_length;
+ int table_length = pos.lvarOffset.length;
+ n += 2 * table_length; // offset
+ n += 2 * table_length; // length
+ n += 2 * table_length; // index
+ break;
+ // exception parameter
+ case EXCEPTION_PARAMETER:
+ n += 2; // exception_index
+ break;
+ // method receiver
+ case METHOD_RECEIVER:
+ // Do nothing
+ break;
+ // type parameter
+ case CLASS_TYPE_PARAMETER:
+ case METHOD_TYPE_PARAMETER:
+ n += 1; // parameter_index
+ break;
+ // type parameter bound
+ case CLASS_TYPE_PARAMETER_BOUND:
+ case METHOD_TYPE_PARAMETER_BOUND:
+ n += 1; // parameter_index
+ n += 1; // bound_index
+ break;
+ // class extends or implements clause
+ case CLASS_EXTENDS:
+ n += 2; // type_index
+ break;
+ // throws
+ case THROWS:
+ n += 2; // type_index
+ break;
+ // method parameter
+ case METHOD_FORMAL_PARAMETER:
+ n += 1; // parameter_index
+ break;
+ // type cast
+ case CAST:
+ // method/constructor/reference type argument
+ case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+ case METHOD_INVOCATION_TYPE_ARGUMENT:
+ case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+ case METHOD_REFERENCE_TYPE_ARGUMENT:
+ n += 2; // offset
+ n += 1; // type index
+ break;
+ // We don't need to worry about these
+ case METHOD_RETURN:
+ case FIELD:
+ break;
+ case UNKNOWN:
+ throw new AssertionError("TypeAnnotation: UNKNOWN target type should never occur!");
+ default:
+ throw new AssertionError("TypeAnnotation: Unknown target type: " + pos.type);
+ }
+
+ {
+ n += 1; // length
+ n += TypePathEntry.bytesPerEntry * pos.location.size(); // bytes for actual array
+ }
+
+ return n;
+ }
+
+ // Code duplicated from com.sun.tools.javac.code.TypeAnnotationPosition
+ public static class Position {
+ public enum TypePathEntryKind {
+ ARRAY(0),
+ INNER_TYPE(1),
+ WILDCARD(2),
+ TYPE_ARGUMENT(3);
+
+ public final int tag;
+
+ private TypePathEntryKind(int tag) {
+ this.tag = tag;
+ }
+ }
+
+ public static class TypePathEntry {
+ /** The fixed number of bytes per TypePathEntry. */
+ public static final int bytesPerEntry = 2;
+
+ public final TypePathEntryKind tag;
+ public final int arg;
+
+ public static final TypePathEntry ARRAY = new TypePathEntry(TypePathEntryKind.ARRAY);
+ public static final TypePathEntry INNER_TYPE = new TypePathEntry(TypePathEntryKind.INNER_TYPE);
+ public static final TypePathEntry WILDCARD = new TypePathEntry(TypePathEntryKind.WILDCARD);
+
+ private TypePathEntry(TypePathEntryKind tag) {
+ if (!(tag == TypePathEntryKind.ARRAY ||
+ tag == TypePathEntryKind.INNER_TYPE ||
+ tag == TypePathEntryKind.WILDCARD)) {
+ throw new AssertionError("Invalid TypePathEntryKind: " + tag);
+ }
+ this.tag = tag;
+ this.arg = 0;
+ }
+
+ public TypePathEntry(TypePathEntryKind tag, int arg) {
+ if (tag != TypePathEntryKind.TYPE_ARGUMENT) {
+ throw new AssertionError("Invalid TypePathEntryKind: " + tag);
+ }
+ this.tag = tag;
+ this.arg = arg;
+ }
+
+ public static TypePathEntry fromBinary(int tag, int arg) {
+ if (arg != 0 && tag != TypePathEntryKind.TYPE_ARGUMENT.tag) {
+ throw new AssertionError("Invalid TypePathEntry tag/arg: " + tag + "/" + arg);
+ }
+ switch (tag) {
+ case 0:
+ return ARRAY;
+ case 1:
+ return INNER_TYPE;
+ case 2:
+ return WILDCARD;
+ case 3:
+ return new TypePathEntry(TypePathEntryKind.TYPE_ARGUMENT, arg);
+ default:
+ throw new AssertionError("Invalid TypePathEntryKind tag: " + tag);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return tag.toString() +
+ (tag == TypePathEntryKind.TYPE_ARGUMENT ? ("(" + arg + ")") : "");
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (! (other instanceof TypePathEntry)) {
+ return false;
+ }
+ TypePathEntry tpe = (TypePathEntry) other;
+ return this.tag == tpe.tag && this.arg == tpe.arg;
+ }
+
+ @Override
+ public int hashCode() {
+ return this.tag.hashCode() * 17 + this.arg;
+ }
+ }
+
+ public TargetType type = TargetType.UNKNOWN;
+
+ // For generic/array types.
+ // TODO: or should we use null? Noone will use this object.
+ public List<TypePathEntry> location = new ArrayList<>(0);
+
+ // Tree position.
+ public int pos = -1;
+
+ // For typecasts, type tests, new (and locals, as start_pc).
+ public boolean isValidOffset = false;
+ public int offset = -1;
+
+ // For locals. arrays same length
+ public int[] lvarOffset = null;
+ public int[] lvarLength = null;
+ public int[] lvarIndex = null;
+
+ // For type parameter bound
+ public int bound_index = Integer.MIN_VALUE;
+
+ // For type parameter and method parameter
+ public int parameter_index = Integer.MIN_VALUE;
+
+ // For class extends, implements, and throws clauses
+ public int type_index = Integer.MIN_VALUE;
+
+ // For exception parameters, index into exception table
+ public int exception_index = Integer.MIN_VALUE;
+
+ public Position() {}
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append('[');
+ sb.append(type);
+
+ switch (type) {
+ // instanceof
+ case INSTANCEOF:
+ // new expression
+ case NEW:
+ // constructor/method reference receiver
+ case CONSTRUCTOR_REFERENCE:
+ case METHOD_REFERENCE:
+ sb.append(", offset = ");
+ sb.append(offset);
+ break;
+ // local variable
+ case LOCAL_VARIABLE:
+ // resource variable
+ case RESOURCE_VARIABLE:
+ if (lvarOffset == null) {
+ sb.append(", lvarOffset is null!");
+ break;
+ }
+ sb.append(", {");
+ for (int i = 0; i < lvarOffset.length; ++i) {
+ if (i != 0) sb.append("; ");
+ sb.append("start_pc = ");
+ sb.append(lvarOffset[i]);
+ sb.append(", length = ");
+ sb.append(lvarLength[i]);
+ sb.append(", index = ");
+ sb.append(lvarIndex[i]);
+ }
+ sb.append("}");
+ break;
+ // method receiver
+ case METHOD_RECEIVER:
+ // Do nothing
+ break;
+ // type parameter
+ case CLASS_TYPE_PARAMETER:
+ case METHOD_TYPE_PARAMETER:
+ sb.append(", param_index = ");
+ sb.append(parameter_index);
+ break;
+ // type parameter bound
+ case CLASS_TYPE_PARAMETER_BOUND:
+ case METHOD_TYPE_PARAMETER_BOUND:
+ sb.append(", param_index = ");
+ sb.append(parameter_index);
+ sb.append(", bound_index = ");
+ sb.append(bound_index);
+ break;
+ // class extends or implements clause
+ case CLASS_EXTENDS:
+ sb.append(", type_index = ");
+ sb.append(type_index);
+ break;
+ // throws
+ case THROWS:
+ sb.append(", type_index = ");
+ sb.append(type_index);
+ break;
+ // exception parameter
+ case EXCEPTION_PARAMETER:
+ sb.append(", exception_index = ");
+ sb.append(exception_index);
+ break;
+ // method parameter
+ case METHOD_FORMAL_PARAMETER:
+ sb.append(", param_index = ");
+ sb.append(parameter_index);
+ break;
+ // type cast
+ case CAST:
+ // method/constructor/reference type argument
+ case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+ case METHOD_INVOCATION_TYPE_ARGUMENT:
+ case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+ case METHOD_REFERENCE_TYPE_ARGUMENT:
+ sb.append(", offset = ");
+ sb.append(offset);
+ sb.append(", type_index = ");
+ sb.append(type_index);
+ break;
+ // We don't need to worry about these
+ case METHOD_RETURN:
+ case FIELD:
+ break;
+ case UNKNOWN:
+ sb.append(", position UNKNOWN!");
+ break;
+ default:
+ throw new AssertionError("Unknown target type: " + type);
+ }
+
+ // Append location data for generics/arrays.
+ if (!location.isEmpty()) {
+ sb.append(", location = (");
+ sb.append(location);
+ sb.append(")");
+ }
+
+ sb.append(", pos = ");
+ sb.append(pos);
+
+ sb.append(']');
+ return sb.toString();
+ }
+
+ /**
+ * Indicates whether the target tree of the annotation has been optimized
+ * away from classfile or not.
+ * @return true if the target has not been optimized away
+ */
+ public boolean emitToClassfile() {
+ return !type.isLocal() || isValidOffset;
+ }
+
+ /**
+ * Decode the binary representation for a type path and set
+ * the {@code location} field.
+ *
+ * @param list The bytecode representation of the type path.
+ */
+ public static List<TypePathEntry> getTypePathFromBinary(List<Integer> list) {
+ List<TypePathEntry> loc = new ArrayList<>(list.size() / TypePathEntry.bytesPerEntry);
+ int idx = 0;
+ while (idx < list.size()) {
+ if (idx + 1 == list.size()) {
+ throw new AssertionError("Could not decode type path: " + list);
+ }
+ loc.add(TypePathEntry.fromBinary(list.get(idx), list.get(idx + 1)));
+ idx += 2;
+ }
+ return loc;
+ }
+
+ public static List<Integer> getBinaryFromTypePath(List<TypePathEntry> locs) {
+ List<Integer> loc = new ArrayList<>(locs.size() * TypePathEntry.bytesPerEntry);
+ for (TypePathEntry tpe : locs) {
+ loc.add(tpe.tag.tag);
+ loc.add(tpe.arg);
+ }
+ return loc;
+ }
+ }
+
+ // Code duplicated from com.sun.tools.javac.code.TargetType
+ // The IsLocal flag could be removed here.
+ public enum TargetType {
+ /** For annotations on a class type parameter declaration. */
+ CLASS_TYPE_PARAMETER(0x00),
+
+ /** For annotations on a method type parameter declaration. */
+ METHOD_TYPE_PARAMETER(0x01),
+
+ /** For annotations on the type of an "extends" or "implements" clause. */
+ CLASS_EXTENDS(0x10),
+
+ /** For annotations on a bound of a type parameter of a class. */
+ CLASS_TYPE_PARAMETER_BOUND(0x11),
+
+ /** For annotations on a bound of a type parameter of a method. */
+ METHOD_TYPE_PARAMETER_BOUND(0x12),
+
+ /** For annotations on a field. */
+ FIELD(0x13),
+
+ /** For annotations on a method return type. */
+ METHOD_RETURN(0x14),
+
+ /** For annotations on the method receiver. */
+ METHOD_RECEIVER(0x15),
+
+ /** For annotations on a method parameter. */
+ METHOD_FORMAL_PARAMETER(0x16),
+
+ /** For annotations on a throws clause in a method declaration. */
+ THROWS(0x17),
+
+ /** For annotations on a local variable. */
+ LOCAL_VARIABLE(0x40, true),
+
+ /** For annotations on a resource variable. */
+ RESOURCE_VARIABLE(0x41, true),
+
+ /** For annotations on an exception parameter. */
+ EXCEPTION_PARAMETER(0x42, true),
+
+ /** For annotations on a type test. */
+ INSTANCEOF(0x43, true),
+
+ /** For annotations on an object creation expression. */
+ NEW(0x44, true),
+
+ /** For annotations on a constructor reference receiver. */
+ CONSTRUCTOR_REFERENCE(0x45, true),
+
+ /** For annotations on a method reference receiver. */
+ METHOD_REFERENCE(0x46, true),
+
+ /** For annotations on a typecast. */
+ CAST(0x47, true),
+
+ /** For annotations on a type argument of an object creation expression. */
+ CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x48, true),
+
+ /** For annotations on a type argument of a method call. */
+ METHOD_INVOCATION_TYPE_ARGUMENT(0x49, true),
+
+ /** For annotations on a type argument of a constructor reference. */
+ CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT(0x4A, true),
+
+ /** For annotations on a type argument of a method reference. */
+ METHOD_REFERENCE_TYPE_ARGUMENT(0x4B, true),
+
+ /** For annotations with an unknown target. */
+ UNKNOWN(0xFF);
+
+ private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x4B;
+
+ private final int targetTypeValue;
+ private final boolean isLocal;
+
+ private TargetType(int targetTypeValue) {
+ this(targetTypeValue, false);
+ }
+
+ private TargetType(int targetTypeValue, boolean isLocal) {
+ if (targetTypeValue < 0
+ || targetTypeValue > 255)
+ throw new AssertionError("Attribute type value needs to be an unsigned byte: " + String.format("0x%02X", targetTypeValue));
+ this.targetTypeValue = targetTypeValue;
+ this.isLocal = isLocal;
+ }
+
+ /**
+ * Returns whether or not this TargetType represents an annotation whose
+ * target is exclusively a tree in a method body
+ *
+ * Note: wildcard bound targets could target a local tree and a class
+ * member declaration signature tree
+ */
+ public boolean isLocal() {
+ return isLocal;
+ }
+
+ public int targetTypeValue() {
+ return this.targetTypeValue;
+ }
+
+ private static final TargetType[] targets;
+
+ static {
+ targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
+ TargetType[] alltargets = values();
+ for (TargetType target : alltargets) {
+ if (target.targetTypeValue != UNKNOWN.targetTypeValue)
+ targets[target.targetTypeValue] = target;
+ }
+ for (int i = 0; i <= MAXIMUM_TARGET_TYPE_VALUE; ++i) {
+ if (targets[i] == null)
+ targets[i] = UNKNOWN;
+ }
+ }
+
+ public static boolean isValidTargetTypeValue(int tag) {
+ if (tag == UNKNOWN.targetTypeValue)
+ return true;
+ return (tag >= 0 && tag < targets.length);
+ }
+
+ public static TargetType fromTargetTypeValue(int tag) {
+ if (tag == UNKNOWN.targetTypeValue)
+ return UNKNOWN;
+
+ if (tag < 0 || tag >= targets.length)
+ throw new AssertionError("Unknown TargetType: " + tag);
+ return targets[tag];
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/classfile/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+/**
+ A minimalist library to read and write class files into objects closely
+ based on the corresponding definitions in
+ <cite>The Java™ Virtual Machine Specification</cite> (JVMS).
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.classfile;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AnnotationWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.Annotation;
+import com.sun.tools.classfile.TypeAnnotation;
+import com.sun.tools.classfile.Annotation.Annotation_element_value;
+import com.sun.tools.classfile.Annotation.Array_element_value;
+import com.sun.tools.classfile.Annotation.Class_element_value;
+import com.sun.tools.classfile.Annotation.Enum_element_value;
+import com.sun.tools.classfile.Annotation.Primitive_element_value;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+
+/**
+ * A writer for writing annotations as text.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class AnnotationWriter extends BasicWriter {
+ static AnnotationWriter instance(Context context) {
+ AnnotationWriter instance = context.get(AnnotationWriter.class);
+ if (instance == null)
+ instance = new AnnotationWriter(context);
+ return instance;
+ }
+
+ protected AnnotationWriter(Context context) {
+ super(context);
+ classWriter = ClassWriter.instance(context);
+ constantWriter = ConstantWriter.instance(context);
+ }
+
+ public void write(Annotation annot) {
+ write(annot, false);
+ }
+
+ public void write(Annotation annot, boolean resolveIndices) {
+ writeDescriptor(annot.type_index, resolveIndices);
+ boolean showParens = annot.num_element_value_pairs > 0 || !resolveIndices;
+ if (showParens)
+ print("(");
+ for (int i = 0; i < annot.num_element_value_pairs; i++) {
+ if (i > 0)
+ print(",");
+ write(annot.element_value_pairs[i], resolveIndices);
+ }
+ if (showParens)
+ print(")");
+ }
+
+ public void write(TypeAnnotation annot) {
+ write(annot, true, false);
+ }
+
+ public void write(TypeAnnotation annot, boolean showOffsets, boolean resolveIndices) {
+ write(annot.annotation, resolveIndices);
+ print(": ");
+ write(annot.position, showOffsets);
+ }
+
+ public void write(TypeAnnotation.Position pos, boolean showOffsets) {
+ print(pos.type);
+
+ switch (pos.type) {
+ // instanceof
+ case INSTANCEOF:
+ // new expression
+ case NEW:
+ // constructor/method reference receiver
+ case CONSTRUCTOR_REFERENCE:
+ case METHOD_REFERENCE:
+ if (showOffsets) {
+ print(", offset=");
+ print(pos.offset);
+ }
+ break;
+ // local variable
+ case LOCAL_VARIABLE:
+ // resource variable
+ case RESOURCE_VARIABLE:
+ if (pos.lvarOffset == null) {
+ print(", lvarOffset is Null!");
+ break;
+ }
+ print(", {");
+ for (int i = 0; i < pos.lvarOffset.length; ++i) {
+ if (i != 0) print("; ");
+ if (showOffsets) {
+ print("start_pc=");
+ print(pos.lvarOffset[i]);
+ }
+ print(", length=");
+ print(pos.lvarLength[i]);
+ print(", index=");
+ print(pos.lvarIndex[i]);
+ }
+ print("}");
+ break;
+ // exception parameter
+ case EXCEPTION_PARAMETER:
+ print(", exception_index=");
+ print(pos.exception_index);
+ break;
+ // method receiver
+ case METHOD_RECEIVER:
+ // Do nothing
+ break;
+ // type parameter
+ case CLASS_TYPE_PARAMETER:
+ case METHOD_TYPE_PARAMETER:
+ print(", param_index=");
+ print(pos.parameter_index);
+ break;
+ // type parameter bound
+ case CLASS_TYPE_PARAMETER_BOUND:
+ case METHOD_TYPE_PARAMETER_BOUND:
+ print(", param_index=");
+ print(pos.parameter_index);
+ print(", bound_index=");
+ print(pos.bound_index);
+ break;
+ // class extends or implements clause
+ case CLASS_EXTENDS:
+ print(", type_index=");
+ print(pos.type_index);
+ break;
+ // throws
+ case THROWS:
+ print(", type_index=");
+ print(pos.type_index);
+ break;
+ // method parameter
+ case METHOD_FORMAL_PARAMETER:
+ print(", param_index=");
+ print(pos.parameter_index);
+ break;
+ // type cast
+ case CAST:
+ // method/constructor/reference type argument
+ case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+ case METHOD_INVOCATION_TYPE_ARGUMENT:
+ case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+ case METHOD_REFERENCE_TYPE_ARGUMENT:
+ if (showOffsets) {
+ print(", offset=");
+ print(pos.offset);
+ }
+ print(", type_index=");
+ print(pos.type_index);
+ break;
+ // We don't need to worry about these
+ case METHOD_RETURN:
+ case FIELD:
+ break;
+ case UNKNOWN:
+ throw new AssertionError("AnnotationWriter: UNKNOWN target type should never occur!");
+ default:
+ throw new AssertionError("AnnotationWriter: Unknown target type for position: " + pos);
+ }
+
+ // Append location data for generics/arrays.
+ if (!pos.location.isEmpty()) {
+ print(", location=");
+ print(pos.location);
+ }
+ }
+
+ public void write(Annotation.element_value_pair pair) {
+ write(pair, false);
+ }
+
+ public void write(Annotation.element_value_pair pair, boolean resolveIndices) {
+ writeIndex(pair.element_name_index, resolveIndices);
+ print("=");
+ write(pair.value, resolveIndices);
+ }
+
+ public void write(Annotation.element_value value) {
+ write(value, false);
+ }
+
+ public void write(Annotation.element_value value, boolean resolveIndices) {
+ ev_writer.write(value, resolveIndices);
+ }
+
+ private void writeDescriptor(int index, boolean resolveIndices) {
+ if (resolveIndices) {
+ try {
+ ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
+ Descriptor d = new Descriptor(index);
+ print(d.getFieldType(constant_pool));
+ return;
+ } catch (ConstantPoolException | InvalidDescriptor ignore) {
+ }
+ }
+
+ print("#" + index);
+ }
+
+ private void writeIndex(int index, boolean resolveIndices) {
+ if (resolveIndices) {
+ print(constantWriter.stringValue(index));
+ } else
+ print("#" + index);
+ }
+
+ element_value_Writer ev_writer = new element_value_Writer();
+
+ class element_value_Writer implements Annotation.element_value.Visitor<Void,Boolean> {
+ public void write(Annotation.element_value value, boolean resolveIndices) {
+ value.accept(this, resolveIndices);
+ }
+
+ public Void visitPrimitive(Primitive_element_value ev, Boolean resolveIndices) {
+ if (resolveIndices)
+ writeIndex(ev.const_value_index, resolveIndices);
+ else
+ print(((char) ev.tag) + "#" + ev.const_value_index);
+ return null;
+ }
+
+ public Void visitEnum(Enum_element_value ev, Boolean resolveIndices) {
+ if (resolveIndices) {
+ writeIndex(ev.type_name_index, resolveIndices);
+ print(".");
+ writeIndex(ev.const_name_index, resolveIndices);
+ } else
+ print(((char) ev.tag) + "#" + ev.type_name_index + ".#" + ev.const_name_index);
+ return null;
+ }
+
+ public Void visitClass(Class_element_value ev, Boolean resolveIndices) {
+ if (resolveIndices) {
+ writeIndex(ev.class_info_index, resolveIndices);
+ print(".class");
+ } else
+ print(((char) ev.tag) + "#" + ev.class_info_index);
+ return null;
+ }
+
+ public Void visitAnnotation(Annotation_element_value ev, Boolean resolveIndices) {
+ print((char) ev.tag);
+ AnnotationWriter.this.write(ev.annotation_value, resolveIndices);
+ return null;
+ }
+
+ public Void visitArray(Array_element_value ev, Boolean resolveIndices) {
+ print("[");
+ for (int i = 0; i < ev.num_values; i++) {
+ if (i > 0)
+ print(",");
+ write(ev.values[i], resolveIndices);
+ }
+ print("]");
+ return null;
+ }
+
+ }
+
+ private ClassWriter classWriter;
+ private ConstantWriter constantWriter;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,712 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.util.Formatter;
+
+import com.sun.tools.classfile.AccessFlags;
+import com.sun.tools.classfile.AnnotationDefault_attribute;
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Attributes;
+import com.sun.tools.classfile.BootstrapMethods_attribute;
+import com.sun.tools.classfile.CharacterRangeTable_attribute;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.CompilationID_attribute;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.ConstantValue_attribute;
+import com.sun.tools.classfile.DefaultAttribute;
+import com.sun.tools.classfile.Deprecated_attribute;
+import com.sun.tools.classfile.EnclosingMethod_attribute;
+import com.sun.tools.classfile.Exceptions_attribute;
+import com.sun.tools.classfile.InnerClasses_attribute;
+import com.sun.tools.classfile.LineNumberTable_attribute;
+import com.sun.tools.classfile.LocalVariableTable_attribute;
+import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
+import com.sun.tools.classfile.MethodParameters_attribute;
+import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
+import com.sun.tools.classfile.Signature_attribute;
+import com.sun.tools.classfile.SourceDebugExtension_attribute;
+import com.sun.tools.classfile.SourceFile_attribute;
+import com.sun.tools.classfile.SourceID_attribute;
+import com.sun.tools.classfile.StackMapTable_attribute;
+import com.sun.tools.classfile.StackMap_attribute;
+import com.sun.tools.classfile.Synthetic_attribute;
+
+import static com.sun.tools.classfile.AccessFlags.*;
+
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.StringUtils;
+
+/*
+ * A writer for writing Attributes as text.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class AttributeWriter extends BasicWriter
+ implements Attribute.Visitor<Void,Void>
+{
+ public static AttributeWriter instance(Context context) {
+ AttributeWriter instance = context.get(AttributeWriter.class);
+ if (instance == null)
+ instance = new AttributeWriter(context);
+ return instance;
+ }
+
+ protected AttributeWriter(Context context) {
+ super(context);
+ context.put(AttributeWriter.class, this);
+ annotationWriter = AnnotationWriter.instance(context);
+ codeWriter = CodeWriter.instance(context);
+ constantWriter = ConstantWriter.instance(context);
+ options = Options.instance(context);
+ }
+
+ public void write(Object owner, Attribute attr, ConstantPool constant_pool) {
+ if (attr != null) {
+ Assert.checkNonNull(constant_pool);
+ Assert.checkNonNull(owner);
+ this.constant_pool = constant_pool;
+ this.owner = owner;
+ attr.accept(this, null);
+ }
+ }
+
+ public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
+ if (attrs != null) {
+ Assert.checkNonNull(constant_pool);
+ Assert.checkNonNull(owner);
+ this.constant_pool = constant_pool;
+ this.owner = owner;
+ for (Attribute attr: attrs)
+ attr.accept(this, null);
+ }
+ }
+
+ public Void visitDefault(DefaultAttribute attr, Void ignore) {
+ if (attr.reason != null) {
+ report(attr.reason);
+ }
+ byte[] data = attr.info;
+ int i = 0;
+ int j = 0;
+ print(" ");
+ try {
+ print(attr.getName(constant_pool));
+ } catch (ConstantPoolException e) {
+ report(e);
+ print("attribute name = #" + attr.attribute_name_index);
+ }
+ print(": ");
+ println("length = 0x" + toHex(attr.info.length));
+
+ print(" ");
+
+ while (i < data.length) {
+ print(toHex(data[i], 2));
+
+ j++;
+ if (j == 16) {
+ println();
+ print(" ");
+ j = 0;
+ } else {
+ print(" ");
+ }
+ i++;
+ }
+ println();
+ return null;
+ }
+
+ public Void visitAnnotationDefault(AnnotationDefault_attribute attr, Void ignore) {
+ println("AnnotationDefault:");
+ indent(+1);
+ print("default_value: ");
+ annotationWriter.write(attr.default_value);
+ indent(-1);
+ return null;
+ }
+
+ public Void visitBootstrapMethods(BootstrapMethods_attribute attr, Void p) {
+ println(Attribute.BootstrapMethods + ":");
+ for (int i = 0; i < attr.bootstrap_method_specifiers.length ; i++) {
+ BootstrapMethods_attribute.BootstrapMethodSpecifier bsm = attr.bootstrap_method_specifiers[i];
+ indent(+1);
+ print(i + ": #" + bsm.bootstrap_method_ref + " ");
+ println(constantWriter.stringValue(bsm.bootstrap_method_ref));
+ indent(+1);
+ println("Method arguments:");
+ indent(+1);
+ for (int j = 0; j < bsm.bootstrap_arguments.length; j++) {
+ print("#" + bsm.bootstrap_arguments[j] + " ");
+ println(constantWriter.stringValue(bsm.bootstrap_arguments[j]));
+ }
+ indent(-3);
+ }
+ return null;
+ }
+
+ public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr, Void ignore) {
+ println("CharacterRangeTable:");
+ indent(+1);
+ for (int i = 0; i < attr.character_range_table.length; i++) {
+ CharacterRangeTable_attribute.Entry e = attr.character_range_table[i];
+ print(String.format(" %2d, %2d, %6x, %6x, %4x",
+ e.start_pc, e.end_pc,
+ e.character_range_start, e.character_range_end,
+ e.flags));
+ tab();
+ print(String.format("// %2d, %2d, %4d:%02d, %4d:%02d",
+ e.start_pc, e.end_pc,
+ (e.character_range_start >> 10), (e.character_range_start & 0x3ff),
+ (e.character_range_end >> 10), (e.character_range_end & 0x3ff)));
+ if ((e.flags & CharacterRangeTable_attribute.CRT_STATEMENT) != 0)
+ print(", statement");
+ if ((e.flags & CharacterRangeTable_attribute.CRT_BLOCK) != 0)
+ print(", block");
+ if ((e.flags & CharacterRangeTable_attribute.CRT_ASSIGNMENT) != 0)
+ print(", assignment");
+ if ((e.flags & CharacterRangeTable_attribute.CRT_FLOW_CONTROLLER) != 0)
+ print(", flow-controller");
+ if ((e.flags & CharacterRangeTable_attribute.CRT_FLOW_TARGET) != 0)
+ print(", flow-target");
+ if ((e.flags & CharacterRangeTable_attribute.CRT_INVOKE) != 0)
+ print(", invoke");
+ if ((e.flags & CharacterRangeTable_attribute.CRT_CREATE) != 0)
+ print(", create");
+ if ((e.flags & CharacterRangeTable_attribute.CRT_BRANCH_TRUE) != 0)
+ print(", branch-true");
+ if ((e.flags & CharacterRangeTable_attribute.CRT_BRANCH_FALSE) != 0)
+ print(", branch-false");
+ println();
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitCode(Code_attribute attr, Void ignore) {
+ codeWriter.write(attr, constant_pool);
+ return null;
+ }
+
+ public Void visitCompilationID(CompilationID_attribute attr, Void ignore) {
+ constantWriter.write(attr.compilationID_index);
+ return null;
+ }
+
+ public Void visitConstantValue(ConstantValue_attribute attr, Void ignore) {
+ print("ConstantValue: ");
+ constantWriter.write(attr.constantvalue_index);
+ println();
+ return null;
+ }
+
+ public Void visitDeprecated(Deprecated_attribute attr, Void ignore) {
+ println("Deprecated: true");
+ return null;
+ }
+
+ public Void visitEnclosingMethod(EnclosingMethod_attribute attr, Void ignore) {
+ print("EnclosingMethod: #" + attr.class_index + ".#" + attr.method_index);
+ tab();
+ print("// " + getJavaClassName(attr));
+ if (attr.method_index != 0)
+ print("." + getMethodName(attr));
+ println();
+ return null;
+ }
+
+ private String getJavaClassName(EnclosingMethod_attribute a) {
+ try {
+ return getJavaName(a.getClassName(constant_pool));
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ private String getMethodName(EnclosingMethod_attribute a) {
+ try {
+ return a.getMethodName(constant_pool);
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ public Void visitExceptions(Exceptions_attribute attr, Void ignore) {
+ println("Exceptions:");
+ indent(+1);
+ print("throws ");
+ for (int i = 0; i < attr.number_of_exceptions; i++) {
+ if (i > 0)
+ print(", ");
+ print(getJavaException(attr, i));
+ }
+ println();
+ indent(-1);
+ return null;
+ }
+
+ private String getJavaException(Exceptions_attribute attr, int index) {
+ try {
+ return getJavaName(attr.getException(index, constant_pool));
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ public Void visitInnerClasses(InnerClasses_attribute attr, Void ignore) {
+ boolean first = true;
+ for (int i = 0 ; i < attr.classes.length; i++) {
+ InnerClasses_attribute.Info info = attr.classes[i];
+ //access
+ AccessFlags access_flags = info.inner_class_access_flags;
+ if (options.checkAccess(access_flags)) {
+ if (first) {
+ writeInnerClassHeader();
+ first = false;
+ }
+ for (String name: access_flags.getInnerClassModifiers())
+ print(name + " ");
+ if (info.inner_name_index != 0) {
+ print("#" + info.inner_name_index + "= ");
+ }
+ print("#" + info.inner_class_info_index);
+ if (info.outer_class_info_index != 0) {
+ print(" of #" + info.outer_class_info_index);
+ }
+ print(";");
+ tab();
+ print("// ");
+ if (info.inner_name_index != 0) {
+ print(getInnerName(constant_pool, info) + "=");
+ }
+ constantWriter.write(info.inner_class_info_index);
+ if (info.outer_class_info_index != 0) {
+ print(" of ");
+ constantWriter.write(info.outer_class_info_index);
+ }
+ println();
+ }
+ }
+ if (!first)
+ indent(-1);
+ return null;
+ }
+
+ String getInnerName(ConstantPool constant_pool, InnerClasses_attribute.Info info) {
+ try {
+ return info.getInnerName(constant_pool);
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ private void writeInnerClassHeader() {
+ println("InnerClasses:");
+ indent(+1);
+ }
+
+ public Void visitLineNumberTable(LineNumberTable_attribute attr, Void ignore) {
+ println("LineNumberTable:");
+ indent(+1);
+ for (LineNumberTable_attribute.Entry entry: attr.line_number_table) {
+ println("line " + entry.line_number + ": " + entry.start_pc);
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitLocalVariableTable(LocalVariableTable_attribute attr, Void ignore) {
+ println("LocalVariableTable:");
+ indent(+1);
+ println("Start Length Slot Name Signature");
+ for (LocalVariableTable_attribute.Entry entry : attr.local_variable_table) {
+ println(String.format("%5d %7d %5d %5s %s",
+ entry.start_pc, entry.length, entry.index,
+ constantWriter.stringValue(entry.name_index),
+ constantWriter.stringValue(entry.descriptor_index)));
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, Void ignore) {
+ println("LocalVariableTypeTable:");
+ indent(+1);
+ println("Start Length Slot Name Signature");
+ for (LocalVariableTypeTable_attribute.Entry entry : attr.local_variable_table) {
+ println(String.format("%5d %7d %5d %5s %s",
+ entry.start_pc, entry.length, entry.index,
+ constantWriter.stringValue(entry.name_index),
+ constantWriter.stringValue(entry.signature_index)));
+ }
+ indent(-1);
+ return null;
+ }
+
+ private static final String format = "%-31s%s";
+
+ public Void visitMethodParameters(MethodParameters_attribute attr,
+ Void ignore) {
+
+ final String header = String.format(format, "Name", "Flags");
+ println("MethodParameters:");
+ indent(+1);
+ println(header);
+ for (MethodParameters_attribute.Entry entry :
+ attr.method_parameter_table) {
+ String namestr =
+ entry.name_index != 0 ?
+ constantWriter.stringValue(entry.name_index) : "<no name>";
+ String flagstr =
+ (0 != (entry.flags & ACC_FINAL) ? "final " : "") +
+ (0 != (entry.flags & ACC_MANDATED) ? "mandated " : "") +
+ (0 != (entry.flags & ACC_SYNTHETIC) ? "synthetic" : "");
+ println(String.format(format, namestr, flagstr));
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, Void ignore) {
+ println("RuntimeVisibleAnnotations:");
+ indent(+1);
+ for (int i = 0; i < attr.annotations.length; i++) {
+ print(i + ": ");
+ annotationWriter.write(attr.annotations[i]);
+ println();
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, Void ignore) {
+ println("RuntimeInvisibleAnnotations:");
+ indent(+1);
+ for (int i = 0; i < attr.annotations.length; i++) {
+ print(i + ": ");
+ annotationWriter.write(attr.annotations[i]);
+ println();
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, Void ignore) {
+ println("RuntimeVisibleTypeAnnotations:");
+ indent(+1);
+ for (int i = 0; i < attr.annotations.length; i++) {
+ print(i + ": ");
+ annotationWriter.write(attr.annotations[i]);
+ println();
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, Void ignore) {
+ println("RuntimeInvisibleTypeAnnotations:");
+ indent(+1);
+ for (int i = 0; i < attr.annotations.length; i++) {
+ print(i + ": ");
+ annotationWriter.write(attr.annotations[i]);
+ println();
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, Void ignore) {
+ println("RuntimeVisibleParameterAnnotations:");
+ indent(+1);
+ for (int param = 0; param < attr.parameter_annotations.length; param++) {
+ println("parameter " + param + ": ");
+ indent(+1);
+ for (int i = 0; i < attr.parameter_annotations[param].length; i++) {
+ print(i + ": ");
+ annotationWriter.write(attr.parameter_annotations[param][i]);
+ println();
+ }
+ indent(-1);
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, Void ignore) {
+ println("RuntimeInvisibleParameterAnnotations:");
+ indent(+1);
+ for (int param = 0; param < attr.parameter_annotations.length; param++) {
+ println(param + ": ");
+ indent(+1);
+ for (int i = 0; i < attr.parameter_annotations[param].length; i++) {
+ print(i + ": ");
+ annotationWriter.write(attr.parameter_annotations[param][i]);
+ println();
+ }
+ indent(-1);
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitSignature(Signature_attribute attr, Void ignore) {
+ print("Signature: #" + attr.signature_index);
+ tab();
+ println("// " + getSignature(attr));
+ return null;
+ }
+
+ String getSignature(Signature_attribute info) {
+ try {
+ return info.getSignature(constant_pool);
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr, Void ignore) {
+ println("SourceDebugExtension:");
+ indent(+1);
+ for (String s: attr.getValue().split("[\r\n]+")) {
+ println(s);
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitSourceFile(SourceFile_attribute attr, Void ignore) {
+ println("SourceFile: \"" + getSourceFile(attr) + "\"");
+ return null;
+ }
+
+ private String getSourceFile(SourceFile_attribute attr) {
+ try {
+ return attr.getSourceFile(constant_pool);
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ public Void visitSourceID(SourceID_attribute attr, Void ignore) {
+ constantWriter.write(attr.sourceID_index);
+ return null;
+ }
+
+ public Void visitStackMap(StackMap_attribute attr, Void ignore) {
+ println("StackMap: number_of_entries = " + attr.number_of_entries);
+ indent(+1);
+ StackMapTableWriter w = new StackMapTableWriter();
+ for (StackMapTable_attribute.stack_map_frame entry : attr.entries) {
+ w.write(entry);
+ }
+ indent(-1);
+ return null;
+ }
+
+ public Void visitStackMapTable(StackMapTable_attribute attr, Void ignore) {
+ println("StackMapTable: number_of_entries = " + attr.number_of_entries);
+ indent(+1);
+ StackMapTableWriter w = new StackMapTableWriter();
+ for (StackMapTable_attribute.stack_map_frame entry : attr.entries) {
+ w.write(entry);
+ }
+ indent(-1);
+ return null;
+ }
+
+ class StackMapTableWriter // also handles CLDC StackMap attributes
+ implements StackMapTable_attribute.stack_map_frame.Visitor<Void,Void> {
+ public void write(StackMapTable_attribute.stack_map_frame frame) {
+ frame.accept(this, null);
+ }
+
+ public Void visit_same_frame(StackMapTable_attribute.same_frame frame, Void p) {
+ printHeader(frame, "/* same */");
+ return null;
+ }
+
+ public Void visit_same_locals_1_stack_item_frame(StackMapTable_attribute.same_locals_1_stack_item_frame frame, Void p) {
+ printHeader(frame, "/* same_locals_1_stack_item */");
+ indent(+1);
+ printMap("stack", frame.stack);
+ indent(-1);
+ return null;
+ }
+
+ public Void visit_same_locals_1_stack_item_frame_extended(StackMapTable_attribute.same_locals_1_stack_item_frame_extended frame, Void p) {
+ printHeader(frame, "/* same_locals_1_stack_item_frame_extended */");
+ indent(+1);
+ println("offset_delta = " + frame.offset_delta);
+ printMap("stack", frame.stack);
+ indent(-1);
+ return null;
+ }
+
+ public Void visit_chop_frame(StackMapTable_attribute.chop_frame frame, Void p) {
+ printHeader(frame, "/* chop */");
+ indent(+1);
+ println("offset_delta = " + frame.offset_delta);
+ indent(-1);
+ return null;
+ }
+
+ public Void visit_same_frame_extended(StackMapTable_attribute.same_frame_extended frame, Void p) {
+ printHeader(frame, "/* same_frame_extended */");
+ indent(+1);
+ println("offset_delta = " + frame.offset_delta);
+ indent(-1);
+ return null;
+ }
+
+ public Void visit_append_frame(StackMapTable_attribute.append_frame frame, Void p) {
+ printHeader(frame, "/* append */");
+ indent(+1);
+ println("offset_delta = " + frame.offset_delta);
+ printMap("locals", frame.locals);
+ indent(-1);
+ return null;
+ }
+
+ public Void visit_full_frame(StackMapTable_attribute.full_frame frame, Void p) {
+ if (frame instanceof StackMap_attribute.stack_map_frame) {
+ printHeader(frame, "offset = " + frame.offset_delta);
+ indent(+1);
+ } else {
+ printHeader(frame, "/* full_frame */");
+ indent(+1);
+ println("offset_delta = " + frame.offset_delta);
+ }
+ printMap("locals", frame.locals);
+ printMap("stack", frame.stack);
+ indent(-1);
+ return null;
+ }
+
+ void printHeader(StackMapTable_attribute.stack_map_frame frame, String extra) {
+ print("frame_type = " + frame.frame_type + " ");
+ println(extra);
+ }
+
+ void printMap(String name, StackMapTable_attribute.verification_type_info[] map) {
+ print(name + " = [");
+ for (int i = 0; i < map.length; i++) {
+ StackMapTable_attribute.verification_type_info info = map[i];
+ int tag = info.tag;
+ switch (tag) {
+ case StackMapTable_attribute.verification_type_info.ITEM_Object:
+ print(" ");
+ constantWriter.write(((StackMapTable_attribute.Object_variable_info) info).cpool_index);
+ break;
+ case StackMapTable_attribute.verification_type_info.ITEM_Uninitialized:
+ print(" " + mapTypeName(tag));
+ print(" " + ((StackMapTable_attribute.Uninitialized_variable_info) info).offset);
+ break;
+ default:
+ print(" " + mapTypeName(tag));
+ }
+ print(i == (map.length - 1) ? " " : ",");
+ }
+ println("]");
+ }
+
+ String mapTypeName(int tag) {
+ switch (tag) {
+ case StackMapTable_attribute.verification_type_info.ITEM_Top:
+ return "top";
+
+ case StackMapTable_attribute.verification_type_info.ITEM_Integer:
+ return "int";
+
+ case StackMapTable_attribute.verification_type_info.ITEM_Float:
+ return "float";
+
+ case StackMapTable_attribute.verification_type_info.ITEM_Long:
+ return "long";
+
+ case StackMapTable_attribute.verification_type_info.ITEM_Double:
+ return "double";
+
+ case StackMapTable_attribute.verification_type_info.ITEM_Null:
+ return "null";
+
+ case StackMapTable_attribute.verification_type_info.ITEM_UninitializedThis:
+ return "this";
+
+ case StackMapTable_attribute.verification_type_info.ITEM_Object:
+ return "CP";
+
+ case StackMapTable_attribute.verification_type_info.ITEM_Uninitialized:
+ return "uninitialized";
+
+ default:
+ report("unrecognized verification_type_info tag: " + tag);
+ return "[tag:" + tag + "]";
+ }
+ }
+ }
+
+ public Void visitSynthetic(Synthetic_attribute attr, Void ignore) {
+ println("Synthetic: true");
+ return null;
+ }
+
+ static String getJavaName(String name) {
+ return name.replace('/', '.');
+ }
+
+ String toHex(byte b, int w) {
+ return toHex(b & 0xff, w);
+ }
+
+ static String toHex(int i) {
+ return StringUtils.toUpperCase(Integer.toString(i, 16));
+ }
+
+ static String toHex(int i, int w) {
+ String s = StringUtils.toUpperCase(Integer.toHexString(i));
+ while (s.length() < w)
+ s = "0" + s;
+ return StringUtils.toUpperCase(s);
+ }
+
+ private AnnotationWriter annotationWriter;
+ private CodeWriter codeWriter;
+ private ConstantWriter constantWriter;
+ private Options options;
+
+ private ConstantPool constant_pool;
+ private Object owner;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/BasicWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.io.PrintWriter;
+
+import com.sun.tools.classfile.AttributeException;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.DescriptorException;
+
+/*
+ * A writer similar to a PrintWriter but which does not hide exceptions.
+ * The standard print calls are line-buffered; report calls write messages directly.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class BasicWriter {
+ protected BasicWriter(Context context) {
+ lineWriter = LineWriter.instance(context);
+ out = context.get(PrintWriter.class);
+ messages = context.get(Messages.class);
+ if (messages == null)
+ throw new AssertionError();
+ }
+
+ protected void print(String s) {
+ lineWriter.print(s);
+ }
+
+ protected void print(Object o) {
+ lineWriter.print(o == null ? null : o.toString());
+ }
+
+ protected void println() {
+ lineWriter.println();
+ }
+
+ protected void println(String s) {
+ lineWriter.print(s);
+ lineWriter.println();
+ }
+
+ protected void println(Object o) {
+ lineWriter.print(o == null ? null : o.toString());
+ lineWriter.println();
+ }
+
+ protected void indent(int delta) {
+ lineWriter.indent(delta);
+ }
+
+ protected void tab() {
+ lineWriter.tab();
+ }
+
+ protected void setPendingNewline(boolean b) {
+ lineWriter.pendingNewline = b;
+ }
+
+ protected String report(AttributeException e) {
+ out.println("Error: " + e.getMessage()); // i18n?
+ return "???";
+ }
+
+ protected String report(ConstantPoolException e) {
+ out.println("Error: " + e.getMessage()); // i18n?
+ return "???";
+ }
+
+ protected String report(DescriptorException e) {
+ out.println("Error: " + e.getMessage()); // i18n?
+ return "???";
+ }
+
+ protected String report(String msg) {
+ out.println("Error: " + msg); // i18n?
+ return "???";
+ }
+
+ protected String space(int w) {
+ if (w < spaces.length && spaces[w] != null)
+ return spaces[w];
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < w; i++)
+ sb.append(" ");
+
+ String s = sb.toString();
+ if (w < spaces.length)
+ spaces[w] = s;
+
+ return s;
+ }
+
+ private String[] spaces = new String[80];
+
+ private LineWriter lineWriter;
+ private PrintWriter out;
+ protected Messages messages;
+
+ private static class LineWriter {
+ static LineWriter instance(Context context) {
+ LineWriter instance = context.get(LineWriter.class);
+ if (instance == null)
+ instance = new LineWriter(context);
+ return instance;
+ }
+
+ protected LineWriter(Context context) {
+ context.put(LineWriter.class, this);
+ Options options = Options.instance(context);
+ indentWidth = options.indentWidth;
+ tabColumn = options.tabColumn;
+ out = context.get(PrintWriter.class);
+ buffer = new StringBuilder();
+ }
+
+ protected void print(String s) {
+ if (pendingNewline) {
+ println();
+ pendingNewline = false;
+ }
+ if (s == null)
+ s = "null";
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ switch (c) {
+ case ' ':
+ pendingSpaces++;
+ break;
+
+ case '\n':
+ println();
+ break;
+
+ default:
+ if (buffer.length() == 0)
+ indent();
+ if (pendingSpaces > 0) {
+ for (int sp = 0; sp < pendingSpaces; sp++)
+ buffer.append(' ');
+ pendingSpaces = 0;
+ }
+ buffer.append(c);
+ }
+ }
+
+ }
+
+ protected void println() {
+ // ignore/discard pending spaces
+ pendingSpaces = 0;
+ out.println(buffer);
+ buffer.setLength(0);
+ }
+
+ protected void indent(int delta) {
+ indentCount += delta;
+ }
+
+ protected void tab() {
+ int col = indentCount * indentWidth + tabColumn;
+ pendingSpaces += (col <= buffer.length() ? 1 : col - buffer.length());
+ }
+
+ private void indent() {
+ pendingSpaces += (indentCount * indentWidth);
+ }
+
+ private final PrintWriter out;
+ private final StringBuilder buffer;
+ private int indentCount;
+ private final int indentWidth;
+ private final int tabColumn;
+ private boolean pendingNewline;
+ private int pendingSpaces;
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,756 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.net.URI;
+import java.text.DateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import com.sun.tools.classfile.AccessFlags;
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Attributes;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.ConstantValue_attribute;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.DescriptorException;
+import com.sun.tools.classfile.Exceptions_attribute;
+import com.sun.tools.classfile.Field;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.classfile.Signature;
+import com.sun.tools.classfile.Signature_attribute;
+import com.sun.tools.classfile.SourceFile_attribute;
+import com.sun.tools.classfile.Type;
+import com.sun.tools.classfile.Type.ArrayType;
+import com.sun.tools.classfile.Type.ClassSigType;
+import com.sun.tools.classfile.Type.ClassType;
+import com.sun.tools.classfile.Type.MethodType;
+import com.sun.tools.classfile.Type.SimpleType;
+import com.sun.tools.classfile.Type.TypeParamType;
+import com.sun.tools.classfile.Type.WildcardType;
+
+import static com.sun.tools.classfile.AccessFlags.*;
+
+/*
+ * The main javap class to write the contents of a class file as text.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class ClassWriter extends BasicWriter {
+ static ClassWriter instance(Context context) {
+ ClassWriter instance = context.get(ClassWriter.class);
+ if (instance == null)
+ instance = new ClassWriter(context);
+ return instance;
+ }
+
+ protected ClassWriter(Context context) {
+ super(context);
+ context.put(ClassWriter.class, this);
+ options = Options.instance(context);
+ attrWriter = AttributeWriter.instance(context);
+ codeWriter = CodeWriter.instance(context);
+ constantWriter = ConstantWriter.instance(context);
+ }
+
+ void setDigest(String name, byte[] digest) {
+ this.digestName = name;
+ this.digest = digest;
+ }
+
+ void setFile(URI uri) {
+ this.uri = uri;
+ }
+
+ void setFileSize(int size) {
+ this.size = size;
+ }
+
+ void setLastModified(long lastModified) {
+ this.lastModified = lastModified;
+ }
+
+ protected ClassFile getClassFile() {
+ return classFile;
+ }
+
+ protected void setClassFile(ClassFile cf) {
+ classFile = cf;
+ constant_pool = classFile.constant_pool;
+ }
+
+ protected Method getMethod() {
+ return method;
+ }
+
+ protected void setMethod(Method m) {
+ method = m;
+ }
+
+ public void write(ClassFile cf) {
+ setClassFile(cf);
+
+ if (options.sysInfo || options.verbose) {
+ if (uri != null) {
+ if (uri.getScheme().equals("file"))
+ println("Classfile " + uri.getPath());
+ else
+ println("Classfile " + uri);
+ }
+ indent(+1);
+ if (lastModified != -1) {
+ Date lm = new Date(lastModified);
+ DateFormat df = DateFormat.getDateInstance();
+ if (size > 0) {
+ println("Last modified " + df.format(lm) + "; size " + size + " bytes");
+ } else {
+ println("Last modified " + df.format(lm));
+ }
+ } else if (size > 0) {
+ println("Size " + size + " bytes");
+ }
+ if (digestName != null && digest != null) {
+ StringBuilder sb = new StringBuilder();
+ for (byte b: digest)
+ sb.append(String.format("%02x", b));
+ println(digestName + " checksum " + sb);
+ }
+ }
+
+ Attribute sfa = cf.getAttribute(Attribute.SourceFile);
+ if (sfa instanceof SourceFile_attribute) {
+ println("Compiled from \"" + getSourceFile((SourceFile_attribute) sfa) + "\"");
+ }
+
+ if (options.sysInfo || options.verbose) {
+ indent(-1);
+ }
+
+ String name = getJavaName(classFile);
+ AccessFlags flags = cf.access_flags;
+
+ writeModifiers(flags.getClassModifiers());
+
+ if (classFile.isClass())
+ print("class ");
+ else if (classFile.isInterface())
+ print("interface ");
+
+ print(name);
+
+ Signature_attribute sigAttr = getSignature(cf.attributes);
+ if (sigAttr == null) {
+ // use info from class file header
+ if (classFile.isClass() && classFile.super_class != 0 ) {
+ String sn = getJavaSuperclassName(cf);
+ if (!sn.equals("java.lang.Object")) {
+ print(" extends ");
+ print(sn);
+ }
+ }
+ for (int i = 0; i < classFile.interfaces.length; i++) {
+ print(i == 0 ? (classFile.isClass() ? " implements " : " extends ") : ",");
+ print(getJavaInterfaceName(classFile, i));
+ }
+ } else {
+ try {
+ Type t = sigAttr.getParsedSignature().getType(constant_pool);
+ JavaTypePrinter p = new JavaTypePrinter(classFile.isInterface());
+ // The signature parser cannot disambiguate between a
+ // FieldType and a ClassSignatureType that only contains a superclass type.
+ if (t instanceof Type.ClassSigType) {
+ print(p.print(t));
+ } else if (options.verbose || !t.isObject()) {
+ print(" extends ");
+ print(p.print(t));
+ }
+ } catch (ConstantPoolException e) {
+ print(report(e));
+ }
+ }
+
+ if (options.verbose) {
+ println();
+ indent(+1);
+ println("minor version: " + cf.minor_version);
+ println("major version: " + cf.major_version);
+ writeList("flags: ", flags.getClassFlags(), "\n");
+ indent(-1);
+ constantWriter.writeConstantPool();
+ } else {
+ print(" ");
+ }
+
+ println("{");
+ indent(+1);
+ writeFields();
+ writeMethods();
+ indent(-1);
+ println("}");
+
+ if (options.verbose) {
+ attrWriter.write(cf, cf.attributes, constant_pool);
+ }
+ }
+ // where
+ class JavaTypePrinter implements Type.Visitor<StringBuilder,StringBuilder> {
+ boolean isInterface;
+
+ JavaTypePrinter(boolean isInterface) {
+ this.isInterface = isInterface;
+ }
+
+ String print(Type t) {
+ return t.accept(this, new StringBuilder()).toString();
+ }
+
+ String printTypeArgs(List<? extends TypeParamType> typeParamTypes) {
+ StringBuilder builder = new StringBuilder();
+ appendIfNotEmpty(builder, "<", typeParamTypes, "> ");
+ return builder.toString();
+ }
+
+ public StringBuilder visitSimpleType(SimpleType type, StringBuilder sb) {
+ sb.append(getJavaName(type.name));
+ return sb;
+ }
+
+ public StringBuilder visitArrayType(ArrayType type, StringBuilder sb) {
+ append(sb, type.elemType);
+ sb.append("[]");
+ return sb;
+ }
+
+ public StringBuilder visitMethodType(MethodType type, StringBuilder sb) {
+ appendIfNotEmpty(sb, "<", type.typeParamTypes, "> ");
+ append(sb, type.returnType);
+ append(sb, " (", type.paramTypes, ")");
+ appendIfNotEmpty(sb, " throws ", type.throwsTypes, "");
+ return sb;
+ }
+
+ public StringBuilder visitClassSigType(ClassSigType type, StringBuilder sb) {
+ appendIfNotEmpty(sb, "<", type.typeParamTypes, ">");
+ if (isInterface) {
+ appendIfNotEmpty(sb, " extends ", type.superinterfaceTypes, "");
+ } else {
+ if (type.superclassType != null
+ && (options.verbose || !type.superclassType.isObject())) {
+ sb.append(" extends ");
+ append(sb, type.superclassType);
+ }
+ appendIfNotEmpty(sb, " implements ", type.superinterfaceTypes, "");
+ }
+ return sb;
+ }
+
+ public StringBuilder visitClassType(ClassType type, StringBuilder sb) {
+ if (type.outerType != null) {
+ append(sb, type.outerType);
+ sb.append(".");
+ }
+ sb.append(getJavaName(type.name));
+ appendIfNotEmpty(sb, "<", type.typeArgs, ">");
+ return sb;
+ }
+
+ public StringBuilder visitTypeParamType(TypeParamType type, StringBuilder sb) {
+ sb.append(type.name);
+ String sep = " extends ";
+ if (type.classBound != null
+ && (options.verbose || !type.classBound.isObject())) {
+ sb.append(sep);
+ append(sb, type.classBound);
+ sep = " & ";
+ }
+ if (type.interfaceBounds != null) {
+ for (Type bound: type.interfaceBounds) {
+ sb.append(sep);
+ append(sb, bound);
+ sep = " & ";
+ }
+ }
+ return sb;
+ }
+
+ public StringBuilder visitWildcardType(WildcardType type, StringBuilder sb) {
+ switch (type.kind) {
+ case UNBOUNDED:
+ sb.append("?");
+ break;
+ case EXTENDS:
+ sb.append("? extends ");
+ append(sb, type.boundType);
+ break;
+ case SUPER:
+ sb.append("? super ");
+ append(sb, type.boundType);
+ break;
+ default:
+ throw new AssertionError();
+ }
+ return sb;
+ }
+
+ private void append(StringBuilder sb, Type t) {
+ t.accept(this, sb);
+ }
+
+ private void append(StringBuilder sb, String prefix, List<? extends Type> list, String suffix) {
+ sb.append(prefix);
+ String sep = "";
+ for (Type t: list) {
+ sb.append(sep);
+ append(sb, t);
+ sep = ", ";
+ }
+ sb.append(suffix);
+ }
+
+ private void appendIfNotEmpty(StringBuilder sb, String prefix, List<? extends Type> list, String suffix) {
+ if (!isEmpty(list))
+ append(sb, prefix, list, suffix);
+ }
+
+ private boolean isEmpty(List<? extends Type> list) {
+ return (list == null || list.isEmpty());
+ }
+ }
+
+ protected void writeFields() {
+ for (Field f: classFile.fields) {
+ writeField(f);
+ }
+ }
+
+ protected void writeField(Field f) {
+ if (!options.checkAccess(f.access_flags))
+ return;
+
+ AccessFlags flags = f.access_flags;
+ writeModifiers(flags.getFieldModifiers());
+ Signature_attribute sigAttr = getSignature(f.attributes);
+ if (sigAttr == null)
+ print(getJavaFieldType(f.descriptor));
+ else {
+ try {
+ Type t = sigAttr.getParsedSignature().getType(constant_pool);
+ print(getJavaName(t.toString()));
+ } catch (ConstantPoolException e) {
+ // report error?
+ // fall back on non-generic descriptor
+ print(getJavaFieldType(f.descriptor));
+ }
+ }
+ print(" ");
+ print(getFieldName(f));
+ if (options.showConstants) {
+ Attribute a = f.attributes.get(Attribute.ConstantValue);
+ if (a instanceof ConstantValue_attribute) {
+ print(" = ");
+ ConstantValue_attribute cv = (ConstantValue_attribute) a;
+ print(getConstantValue(f.descriptor, cv.constantvalue_index));
+ }
+ }
+ print(";");
+ println();
+
+ indent(+1);
+
+ boolean showBlank = false;
+
+ if (options.showDescriptors)
+ println("descriptor: " + getValue(f.descriptor));
+
+ if (options.verbose)
+ writeList("flags: ", flags.getFieldFlags(), "\n");
+
+ if (options.showAllAttrs) {
+ for (Attribute attr: f.attributes)
+ attrWriter.write(f, attr, constant_pool);
+ showBlank = true;
+ }
+
+ indent(-1);
+
+ if (showBlank || options.showDisassembled || options.showLineAndLocalVariableTables)
+ println();
+ }
+
+ protected void writeMethods() {
+ for (Method m: classFile.methods)
+ writeMethod(m);
+ setPendingNewline(false);
+ }
+
+ protected void writeMethod(Method m) {
+ if (!options.checkAccess(m.access_flags))
+ return;
+
+ method = m;
+
+ AccessFlags flags = m.access_flags;
+
+ Descriptor d;
+ Type.MethodType methodType;
+ List<? extends Type> methodExceptions;
+
+ Signature_attribute sigAttr = getSignature(m.attributes);
+ if (sigAttr == null) {
+ d = m.descriptor;
+ methodType = null;
+ methodExceptions = null;
+ } else {
+ Signature methodSig = sigAttr.getParsedSignature();
+ d = methodSig;
+ try {
+ methodType = (Type.MethodType) methodSig.getType(constant_pool);
+ methodExceptions = methodType.throwsTypes;
+ if (methodExceptions != null && methodExceptions.isEmpty())
+ methodExceptions = null;
+ } catch (ConstantPoolException e) {
+ // report error?
+ // fall back on standard descriptor
+ methodType = null;
+ methodExceptions = null;
+ }
+ }
+
+ writeModifiers(flags.getMethodModifiers());
+ if (methodType != null) {
+ print(new JavaTypePrinter(false).printTypeArgs(methodType.typeParamTypes));
+ }
+ if (getName(m).equals("<init>")) {
+ print(getJavaName(classFile));
+ print(getJavaParameterTypes(d, flags));
+ } else if (getName(m).equals("<clinit>")) {
+ print("{}");
+ } else {
+ print(getJavaReturnType(d));
+ print(" ");
+ print(getName(m));
+ print(getJavaParameterTypes(d, flags));
+ }
+
+ Attribute e_attr = m.attributes.get(Attribute.Exceptions);
+ if (e_attr != null) { // if there are generic exceptions, there must be erased exceptions
+ if (e_attr instanceof Exceptions_attribute) {
+ Exceptions_attribute exceptions = (Exceptions_attribute) e_attr;
+ print(" throws ");
+ if (methodExceptions != null) { // use generic list if available
+ writeList("", methodExceptions, "");
+ } else {
+ for (int i = 0; i < exceptions.number_of_exceptions; i++) {
+ if (i > 0)
+ print(", ");
+ print(getJavaException(exceptions, i));
+ }
+ }
+ } else {
+ report("Unexpected or invalid value for Exceptions attribute");
+ }
+ }
+
+ println(";");
+
+ indent(+1);
+
+ if (options.showDescriptors) {
+ println("descriptor: " + getValue(m.descriptor));
+ }
+
+ if (options.verbose) {
+ writeList("flags: ", flags.getMethodFlags(), "\n");
+ }
+
+ Code_attribute code = null;
+ Attribute c_attr = m.attributes.get(Attribute.Code);
+ if (c_attr != null) {
+ if (c_attr instanceof Code_attribute)
+ code = (Code_attribute) c_attr;
+ else
+ report("Unexpected or invalid value for Code attribute");
+ }
+
+ if (options.showAllAttrs) {
+ Attribute[] attrs = m.attributes.attrs;
+ for (Attribute attr: attrs)
+ attrWriter.write(m, attr, constant_pool);
+ } else if (code != null) {
+ if (options.showDisassembled) {
+ println("Code:");
+ codeWriter.writeInstrs(code);
+ codeWriter.writeExceptionTable(code);
+ }
+
+ if (options.showLineAndLocalVariableTables) {
+ attrWriter.write(code, code.attributes.get(Attribute.LineNumberTable), constant_pool);
+ attrWriter.write(code, code.attributes.get(Attribute.LocalVariableTable), constant_pool);
+ }
+ }
+
+ indent(-1);
+
+ // set pendingNewline to write a newline before the next method (if any)
+ // if a separator is desired
+ setPendingNewline(
+ options.showDisassembled ||
+ options.showAllAttrs ||
+ options.showDescriptors ||
+ options.showLineAndLocalVariableTables ||
+ options.verbose);
+ }
+
+ void writeModifiers(Collection<String> items) {
+ for (Object item: items) {
+ print(item);
+ print(" ");
+ }
+ }
+
+ void writeList(String prefix, Collection<?> items, String suffix) {
+ print(prefix);
+ String sep = "";
+ for (Object item: items) {
+ print(sep);
+ print(item);
+ sep = ", ";
+ }
+ print(suffix);
+ }
+
+ void writeListIfNotEmpty(String prefix, List<?> items, String suffix) {
+ if (items != null && items.size() > 0)
+ writeList(prefix, items, suffix);
+ }
+
+ Signature_attribute getSignature(Attributes attributes) {
+ return (Signature_attribute) attributes.get(Attribute.Signature);
+ }
+
+ String adjustVarargs(AccessFlags flags, String params) {
+ if (flags.is(ACC_VARARGS)) {
+ int i = params.lastIndexOf("[]");
+ if (i > 0)
+ return params.substring(0, i) + "..." + params.substring(i+2);
+ }
+
+ return params;
+ }
+
+ String getJavaName(ClassFile cf) {
+ try {
+ return getJavaName(cf.getName());
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ String getJavaSuperclassName(ClassFile cf) {
+ try {
+ return getJavaName(cf.getSuperclassName());
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ String getJavaInterfaceName(ClassFile cf, int index) {
+ try {
+ return getJavaName(cf.getInterfaceName(index));
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ String getJavaFieldType(Descriptor d) {
+ try {
+ return getJavaName(d.getFieldType(constant_pool));
+ } catch (ConstantPoolException e) {
+ return report(e);
+ } catch (DescriptorException e) {
+ return report(e);
+ }
+ }
+
+ String getJavaReturnType(Descriptor d) {
+ try {
+ return getJavaName(d.getReturnType(constant_pool));
+ } catch (ConstantPoolException e) {
+ return report(e);
+ } catch (DescriptorException e) {
+ return report(e);
+ }
+ }
+
+ String getJavaParameterTypes(Descriptor d, AccessFlags flags) {
+ try {
+ return getJavaName(adjustVarargs(flags, d.getParameterTypes(constant_pool)));
+ } catch (ConstantPoolException e) {
+ return report(e);
+ } catch (DescriptorException e) {
+ return report(e);
+ }
+ }
+
+ String getJavaException(Exceptions_attribute attr, int index) {
+ try {
+ return getJavaName(attr.getException(index, constant_pool));
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ String getValue(Descriptor d) {
+ try {
+ return d.getValue(constant_pool);
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ String getFieldName(Field f) {
+ try {
+ return f.getName(constant_pool);
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ String getName(Method m) {
+ try {
+ return m.getName(constant_pool);
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ static String getJavaName(String name) {
+ return name.replace('/', '.');
+ }
+
+ String getSourceFile(SourceFile_attribute attr) {
+ try {
+ return attr.getSourceFile(constant_pool);
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ /**
+ * Get the value of an entry in the constant pool as a Java constant.
+ * Characters and booleans are represented by CONSTANT_Intgere entries.
+ * Character and string values are processed to escape characters outside
+ * the basic printable ASCII set.
+ * @param d the descriptor, giving the expected type of the constant
+ * @param index the index of the value in the constant pool
+ * @return a printable string containing the value of the constant.
+ */
+ String getConstantValue(Descriptor d, int index) {
+ try {
+ ConstantPool.CPInfo cpInfo = constant_pool.get(index);
+
+ switch (cpInfo.getTag()) {
+ case ConstantPool.CONSTANT_Integer: {
+ ConstantPool.CONSTANT_Integer_info info =
+ (ConstantPool.CONSTANT_Integer_info) cpInfo;
+ String t = d.getValue(constant_pool);
+ if (t.equals("C")) { // character
+ return getConstantCharValue((char) info.value);
+ } else if (t.equals("Z")) { // boolean
+ return String.valueOf(info.value == 1);
+ } else { // other: assume integer
+ return String.valueOf(info.value);
+ }
+ }
+
+ case ConstantPool.CONSTANT_String: {
+ ConstantPool.CONSTANT_String_info info =
+ (ConstantPool.CONSTANT_String_info) cpInfo;
+ return getConstantStringValue(info.getString());
+ }
+
+ default:
+ return constantWriter.stringValue(cpInfo);
+ }
+ } catch (ConstantPoolException e) {
+ return "#" + index;
+ }
+ }
+
+ private String getConstantCharValue(char c) {
+ StringBuilder sb = new StringBuilder();
+ sb.append('\'');
+ sb.append(esc(c, '\''));
+ sb.append('\'');
+ return sb.toString();
+ }
+
+ private String getConstantStringValue(String s) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("\"");
+ for (int i = 0; i < s.length(); i++) {
+ sb.append(esc(s.charAt(i), '"'));
+ }
+ sb.append("\"");
+ return sb.toString();
+ }
+
+ private String esc(char c, char quote) {
+ if (32 <= c && c <= 126 && c != quote)
+ return String.valueOf(c);
+ else switch (c) {
+ case '\b': return "\\b";
+ case '\n': return "\\n";
+ case '\t': return "\\t";
+ case '\f': return "\\f";
+ case '\r': return "\\r";
+ case '\\': return "\\\\";
+ case '\'': return "\\'";
+ case '\"': return "\\\"";
+ default: return String.format("\\u%04x", (int) c);
+ }
+ }
+
+ private Options options;
+ private AttributeWriter attrWriter;
+ private CodeWriter codeWriter;
+ private ConstantWriter constantWriter;
+ private ClassFile classFile;
+ private URI uri;
+ private long lastModified;
+ private String digestName;
+ private byte[] digest;
+ private int size;
+ private ConstantPool constant_pool;
+ private Method method;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/CodeWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.sun.tools.classfile.AccessFlags;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.DescriptorException;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.Instruction.TypeKind;
+import com.sun.tools.classfile.Method;
+
+/*
+ * Write the contents of a Code attribute.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class CodeWriter extends BasicWriter {
+ public static CodeWriter instance(Context context) {
+ CodeWriter instance = context.get(CodeWriter.class);
+ if (instance == null)
+ instance = new CodeWriter(context);
+ return instance;
+ }
+
+ protected CodeWriter(Context context) {
+ super(context);
+ context.put(CodeWriter.class, this);
+ attrWriter = AttributeWriter.instance(context);
+ classWriter = ClassWriter.instance(context);
+ constantWriter = ConstantWriter.instance(context);
+ sourceWriter = SourceWriter.instance(context);
+ tryBlockWriter = TryBlockWriter.instance(context);
+ stackMapWriter = StackMapWriter.instance(context);
+ localVariableTableWriter = LocalVariableTableWriter.instance(context);
+ localVariableTypeTableWriter = LocalVariableTypeTableWriter.instance(context);
+ typeAnnotationWriter = TypeAnnotationWriter.instance(context);
+ options = Options.instance(context);
+ }
+
+ void write(Code_attribute attr, ConstantPool constant_pool) {
+ println("Code:");
+ indent(+1);
+ writeVerboseHeader(attr, constant_pool);
+ writeInstrs(attr);
+ writeExceptionTable(attr);
+ attrWriter.write(attr, attr.attributes, constant_pool);
+ indent(-1);
+ }
+
+ public void writeVerboseHeader(Code_attribute attr, ConstantPool constant_pool) {
+ Method method = classWriter.getMethod();
+ String argCount;
+ try {
+ int n = method.descriptor.getParameterCount(constant_pool);
+ if (!method.access_flags.is(AccessFlags.ACC_STATIC))
+ ++n; // for 'this'
+ argCount = Integer.toString(n);
+ } catch (ConstantPoolException e) {
+ argCount = report(e);
+ } catch (DescriptorException e) {
+ argCount = report(e);
+ }
+
+ println("stack=" + attr.max_stack +
+ ", locals=" + attr.max_locals +
+ ", args_size=" + argCount);
+
+ }
+
+ public void writeInstrs(Code_attribute attr) {
+ List<InstructionDetailWriter> detailWriters = getDetailWriters(attr);
+
+ for (Instruction instr: attr.getInstructions()) {
+ try {
+ for (InstructionDetailWriter w: detailWriters)
+ w.writeDetails(instr);
+ writeInstr(instr);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ println(report("error at or after byte " + instr.getPC()));
+ break;
+ }
+ }
+
+ for (InstructionDetailWriter w: detailWriters)
+ w.flush();
+ }
+
+ public void writeInstr(Instruction instr) {
+ print(String.format("%4d: %-13s ", instr.getPC(), instr.getMnemonic()));
+ // compute the number of indentations for the body of multi-line instructions
+ // This is 6 (the width of "%4d: "), divided by the width of each indentation level,
+ // and rounded up to the next integer.
+ int indentWidth = options.indentWidth;
+ int indent = (6 + indentWidth - 1) / indentWidth;
+ instr.accept(instructionPrinter, indent);
+ println();
+ }
+ // where
+ Instruction.KindVisitor<Void,Integer> instructionPrinter =
+ new Instruction.KindVisitor<Void,Integer>() {
+
+ public Void visitNoOperands(Instruction instr, Integer indent) {
+ return null;
+ }
+
+ public Void visitArrayType(Instruction instr, TypeKind kind, Integer indent) {
+ print(" " + kind.name);
+ return null;
+ }
+
+ public Void visitBranch(Instruction instr, int offset, Integer indent) {
+ print((instr.getPC() + offset));
+ return null;
+ }
+
+ public Void visitConstantPoolRef(Instruction instr, int index, Integer indent) {
+ print("#" + index);
+ tab();
+ print("// ");
+ printConstant(index);
+ return null;
+ }
+
+ public Void visitConstantPoolRefAndValue(Instruction instr, int index, int value, Integer indent) {
+ print("#" + index + ", " + value);
+ tab();
+ print("// ");
+ printConstant(index);
+ return null;
+ }
+
+ public Void visitLocal(Instruction instr, int index, Integer indent) {
+ print(index);
+ return null;
+ }
+
+ public Void visitLocalAndValue(Instruction instr, int index, int value, Integer indent) {
+ print(index + ", " + value);
+ return null;
+ }
+
+ public Void visitLookupSwitch(Instruction instr,
+ int default_, int npairs, int[] matches, int[] offsets, Integer indent) {
+ int pc = instr.getPC();
+ print("{ // " + npairs);
+ indent(indent);
+ for (int i = 0; i < npairs; i++) {
+ print(String.format("%n%12d: %d", matches[i], (pc + offsets[i])));
+ }
+ print("\n default: " + (pc + default_) + "\n}");
+ indent(-indent);
+ return null;
+ }
+
+ public Void visitTableSwitch(Instruction instr,
+ int default_, int low, int high, int[] offsets, Integer indent) {
+ int pc = instr.getPC();
+ print("{ // " + low + " to " + high);
+ indent(indent);
+ for (int i = 0; i < offsets.length; i++) {
+ print(String.format("%n%12d: %d", (low + i), (pc + offsets[i])));
+ }
+ print("\n default: " + (pc + default_) + "\n}");
+ indent(-indent);
+ return null;
+ }
+
+ public Void visitValue(Instruction instr, int value, Integer indent) {
+ print(value);
+ return null;
+ }
+
+ public Void visitUnknown(Instruction instr, Integer indent) {
+ return null;
+ }
+ };
+
+
+ public void writeExceptionTable(Code_attribute attr) {
+ if (attr.exception_table_length > 0) {
+ println("Exception table:");
+ indent(+1);
+ println(" from to target type");
+ for (int i = 0; i < attr.exception_table.length; i++) {
+ Code_attribute.Exception_data handler = attr.exception_table[i];
+ print(String.format(" %5d %5d %5d",
+ handler.start_pc, handler.end_pc, handler.handler_pc));
+ print(" ");
+ int catch_type = handler.catch_type;
+ if (catch_type == 0) {
+ println("any");
+ } else {
+ print("Class ");
+ println(constantWriter.stringValue(catch_type));
+ }
+ }
+ indent(-1);
+ }
+
+ }
+
+ private void printConstant(int index) {
+ constantWriter.write(index);
+ }
+
+ private List<InstructionDetailWriter> getDetailWriters(Code_attribute attr) {
+ List<InstructionDetailWriter> detailWriters = new ArrayList<>();
+ if (options.details.contains(InstructionDetailWriter.Kind.SOURCE)) {
+ sourceWriter.reset(classWriter.getClassFile(), attr);
+ if (sourceWriter.hasSource())
+ detailWriters.add(sourceWriter);
+ else
+ println("(Source code not available)");
+ }
+
+ if (options.details.contains(InstructionDetailWriter.Kind.LOCAL_VARS)) {
+ localVariableTableWriter.reset(attr);
+ detailWriters.add(localVariableTableWriter);
+ }
+
+ if (options.details.contains(InstructionDetailWriter.Kind.LOCAL_VAR_TYPES)) {
+ localVariableTypeTableWriter.reset(attr);
+ detailWriters.add(localVariableTypeTableWriter);
+ }
+
+ if (options.details.contains(InstructionDetailWriter.Kind.STACKMAPS)) {
+ stackMapWriter.reset(attr);
+ stackMapWriter.writeInitialDetails();
+ detailWriters.add(stackMapWriter);
+ }
+
+ if (options.details.contains(InstructionDetailWriter.Kind.TRY_BLOCKS)) {
+ tryBlockWriter.reset(attr);
+ detailWriters.add(tryBlockWriter);
+ }
+
+ if (options.details.contains(InstructionDetailWriter.Kind.TYPE_ANNOS)) {
+ typeAnnotationWriter.reset(attr);
+ detailWriters.add(typeAnnotationWriter);
+ }
+
+ return detailWriters;
+ }
+
+ private AttributeWriter attrWriter;
+ private ClassWriter classWriter;
+ private ConstantWriter constantWriter;
+ private LocalVariableTableWriter localVariableTableWriter;
+ private LocalVariableTypeTableWriter localVariableTypeTableWriter;
+ private TypeAnnotationWriter typeAnnotationWriter;
+ private SourceWriter sourceWriter;
+ private StackMapWriter stackMapWriter;
+ private TryBlockWriter tryBlockWriter;
+ private Options options;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/ConstantWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+
+import static com.sun.tools.classfile.ConstantPool.*;
+
+/*
+ * Write a constant pool entry.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class ConstantWriter extends BasicWriter {
+ public static ConstantWriter instance(Context context) {
+ ConstantWriter instance = context.get(ConstantWriter.class);
+ if (instance == null)
+ instance = new ConstantWriter(context);
+ return instance;
+ }
+
+ protected ConstantWriter(Context context) {
+ super(context);
+ context.put(ConstantWriter.class, this);
+ classWriter = ClassWriter.instance(context);
+ options = Options.instance(context);
+ }
+
+ protected void writeConstantPool() {
+ ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
+ writeConstantPool(constant_pool);
+ }
+
+ protected void writeConstantPool(ConstantPool constant_pool) {
+ ConstantPool.Visitor<Integer, Void> v = new ConstantPool.Visitor<Integer,Void>() {
+ public Integer visitClass(CONSTANT_Class_info info, Void p) {
+ print("#" + info.name_index);
+ tab();
+ println("// " + stringValue(info));
+ return 1;
+ }
+
+ public Integer visitDouble(CONSTANT_Double_info info, Void p) {
+ println(stringValue(info));
+ return 2;
+ }
+
+ public Integer visitFieldref(CONSTANT_Fieldref_info info, Void p) {
+ print("#" + info.class_index + ".#" + info.name_and_type_index);
+ tab();
+ println("// " + stringValue(info));
+ return 1;
+ }
+
+ public Integer visitFloat(CONSTANT_Float_info info, Void p) {
+ println(stringValue(info));
+ return 1;
+ }
+
+ public Integer visitInteger(CONSTANT_Integer_info info, Void p) {
+ println(stringValue(info));
+ return 1;
+ }
+
+ public Integer visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
+ print("#" + info.class_index + ".#" + info.name_and_type_index);
+ tab();
+ println("// " + stringValue(info));
+ return 1;
+ }
+
+ public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
+ print("#" + info.bootstrap_method_attr_index + ":#" + info.name_and_type_index);
+ tab();
+ println("// " + stringValue(info));
+ return 1;
+ }
+
+ public Integer visitLong(CONSTANT_Long_info info, Void p) {
+ println(stringValue(info));
+ return 2;
+ }
+
+ public Integer visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
+ print("#" + info.name_index + ":#" + info.type_index);
+ tab();
+ println("// " + stringValue(info));
+ return 1;
+ }
+
+ public Integer visitMethodref(CONSTANT_Methodref_info info, Void p) {
+ print("#" + info.class_index + ".#" + info.name_and_type_index);
+ tab();
+ println("// " + stringValue(info));
+ return 1;
+ }
+
+ public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
+ print("#" + info.reference_kind.tag + ":#" + info.reference_index);
+ tab();
+ println("// " + stringValue(info));
+ return 1;
+ }
+
+ public Integer visitMethodType(CONSTANT_MethodType_info info, Void p) {
+ print("#" + info.descriptor_index);
+ tab();
+ println("// " + stringValue(info));
+ return 1;
+ }
+
+ public Integer visitString(CONSTANT_String_info info, Void p) {
+ print("#" + info.string_index);
+ tab();
+ println("// " + stringValue(info));
+ return 1;
+ }
+
+ public Integer visitUtf8(CONSTANT_Utf8_info info, Void p) {
+ println(stringValue(info));
+ return 1;
+ }
+
+ };
+ println("Constant pool:");
+ indent(+1);
+ int width = String.valueOf(constant_pool.size()).length() + 1;
+ int cpx = 1;
+ while (cpx < constant_pool.size()) {
+ print(String.format("%" + width + "s", ("#" + cpx)));
+ try {
+ CPInfo cpInfo = constant_pool.get(cpx);
+ print(String.format(" = %-18s ", cpTagName(cpInfo)));
+ cpx += cpInfo.accept(v, null);
+ } catch (ConstantPool.InvalidIndex ex) {
+ // should not happen
+ }
+ }
+ indent(-1);
+ }
+
+ protected void write(int cpx) {
+ ClassFile classFile = classWriter.getClassFile();
+ if (cpx == 0) {
+ print("#0");
+ return;
+ }
+
+ CPInfo cpInfo;
+ try {
+ cpInfo = classFile.constant_pool.get(cpx);
+ } catch (ConstantPoolException e) {
+ print("#" + cpx);
+ return;
+ }
+
+ int tag = cpInfo.getTag();
+ switch (tag) {
+ case CONSTANT_Methodref:
+ case CONSTANT_InterfaceMethodref:
+ case CONSTANT_Fieldref:
+ // simplify references within this class
+ CPRefInfo ref = (CPRefInfo) cpInfo;
+ try {
+ if (ref.class_index == classFile.this_class)
+ cpInfo = classFile.constant_pool.get(ref.name_and_type_index);
+ } catch (ConstantPool.InvalidIndex e) {
+ // ignore, for now
+ }
+ }
+ print(tagName(tag) + " " + stringValue(cpInfo));
+ }
+
+ String cpTagName(CPInfo cpInfo) {
+ String n = cpInfo.getClass().getSimpleName();
+ return n.replace("CONSTANT_", "").replace("_info", "");
+ }
+
+ String tagName(int tag) {
+ switch (tag) {
+ case CONSTANT_Utf8:
+ return "Utf8";
+ case CONSTANT_Integer:
+ return "int";
+ case CONSTANT_Float:
+ return "float";
+ case CONSTANT_Long:
+ return "long";
+ case CONSTANT_Double:
+ return "double";
+ case CONSTANT_Class:
+ return "class";
+ case CONSTANT_String:
+ return "String";
+ case CONSTANT_Fieldref:
+ return "Field";
+ case CONSTANT_MethodHandle:
+ return "MethodHandle";
+ case CONSTANT_MethodType:
+ return "MethodType";
+ case CONSTANT_Methodref:
+ return "Method";
+ case CONSTANT_InterfaceMethodref:
+ return "InterfaceMethod";
+ case CONSTANT_InvokeDynamic:
+ return "InvokeDynamic";
+ case CONSTANT_NameAndType:
+ return "NameAndType";
+ default:
+ return "(unknown tag " + tag + ")";
+ }
+ }
+
+ String stringValue(int constant_pool_index) {
+ ClassFile classFile = classWriter.getClassFile();
+ try {
+ return stringValue(classFile.constant_pool.get(constant_pool_index));
+ } catch (ConstantPool.InvalidIndex e) {
+ return report(e);
+ }
+ }
+
+ String stringValue(CPInfo cpInfo) {
+ return stringValueVisitor.visit(cpInfo);
+ }
+
+ StringValueVisitor stringValueVisitor = new StringValueVisitor();
+
+ private class StringValueVisitor implements ConstantPool.Visitor<String, Void> {
+ public String visit(CPInfo info) {
+ return info.accept(this, null);
+ }
+
+ public String visitClass(CONSTANT_Class_info info, Void p) {
+ return getCheckedName(info);
+ }
+
+ String getCheckedName(CONSTANT_Class_info info) {
+ try {
+ return checkName(info.getName());
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ public String visitDouble(CONSTANT_Double_info info, Void p) {
+ return info.value + "d";
+ }
+
+ public String visitFieldref(CONSTANT_Fieldref_info info, Void p) {
+ return visitRef(info, p);
+ }
+
+ public String visitFloat(CONSTANT_Float_info info, Void p) {
+ return info.value + "f";
+ }
+
+ public String visitInteger(CONSTANT_Integer_info info, Void p) {
+ return String.valueOf(info.value);
+ }
+
+ public String visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
+ return visitRef(info, p);
+ }
+
+ public String visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
+ try {
+ String callee = stringValue(info.getNameAndTypeInfo());
+ return "#" + info.bootstrap_method_attr_index + ":" + callee;
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ public String visitLong(CONSTANT_Long_info info, Void p) {
+ return info.value + "l";
+ }
+
+ public String visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
+ return getCheckedName(info) + ":" + getType(info);
+ }
+
+ String getCheckedName(CONSTANT_NameAndType_info info) {
+ try {
+ return checkName(info.getName());
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ String getType(CONSTANT_NameAndType_info info) {
+ try {
+ return info.getType();
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ public String visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
+ try {
+ return info.reference_kind.name + " " + stringValue(info.getCPRefInfo());
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ public String visitMethodType(CONSTANT_MethodType_info info, Void p) {
+ try {
+ return info.getType();
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ public String visitMethodref(CONSTANT_Methodref_info info, Void p) {
+ return visitRef(info, p);
+ }
+
+ public String visitString(CONSTANT_String_info info, Void p) {
+ try {
+ ClassFile classFile = classWriter.getClassFile();
+ int string_index = info.string_index;
+ return stringValue(classFile.constant_pool.getUTF8Info(string_index));
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+
+ public String visitUtf8(CONSTANT_Utf8_info info, Void p) {
+ String s = info.value;
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ switch (c) {
+ case '\t':
+ sb.append('\\').append('t');
+ break;
+ case '\n':
+ sb.append('\\').append('n');
+ break;
+ case '\r':
+ sb.append('\\').append('r');
+ break;
+ case '\b':
+ sb.append('\\').append('b');
+ break;
+ case '\f':
+ sb.append('\\').append('f');
+ break;
+ case '\"':
+ sb.append('\\').append('\"');
+ break;
+ case '\'':
+ sb.append('\\').append('\'');
+ break;
+ case '\\':
+ sb.append('\\').append('\\');
+ break;
+ default:
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
+
+ String visitRef(CPRefInfo info, Void p) {
+ String cn = getCheckedClassName(info);
+ String nat;
+ try {
+ nat = stringValue(info.getNameAndTypeInfo());
+ } catch (ConstantPoolException e) {
+ nat = report(e);
+ }
+ return cn + "." + nat;
+ }
+
+ String getCheckedClassName(CPRefInfo info) {
+ try {
+ return checkName(info.getClassName());
+ } catch (ConstantPoolException e) {
+ return report(e);
+ }
+ }
+ }
+
+ /* If name is a valid binary name, return it; otherwise quote it. */
+ private static String checkName(String name) {
+ if (name == null)
+ return "null";
+
+ int len = name.length();
+ if (len == 0)
+ return "\"\"";
+
+ int cc = '/';
+ int cp;
+ for (int k = 0; k < len; k += Character.charCount(cp)) {
+ cp = name.codePointAt(k);
+ if ((cc == '/' && !Character.isJavaIdentifierStart(cp))
+ || (cp != '/' && !Character.isJavaIdentifierPart(cp))) {
+ return "\"" + addEscapes(name) + "\"";
+ }
+ cc = cp;
+ }
+
+ return name;
+ }
+
+ /* If name requires escapes, put them in, so it can be a string body. */
+ private static String addEscapes(String name) {
+ String esc = "\\\"\n\t";
+ String rep = "\\\"nt";
+ StringBuilder buf = null;
+ int nextk = 0;
+ int len = name.length();
+ for (int k = 0; k < len; k++) {
+ char cp = name.charAt(k);
+ int n = esc.indexOf(cp);
+ if (n >= 0) {
+ if (buf == null)
+ buf = new StringBuilder(len * 2);
+ if (nextk < k)
+ buf.append(name, nextk, k);
+ buf.append('\\');
+ buf.append(rep.charAt(n));
+ nextk = k+1;
+ }
+ }
+ if (buf == null)
+ return name;
+ if (nextk < len)
+ buf.append(name, nextk, len);
+ return buf.toString();
+ }
+
+ private ClassWriter classWriter;
+ private Options options;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/Context.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/*
+ * Class from which to put/get shared resources.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Context {
+
+ Map<Class<?>, Object> map;
+
+ public Context() {
+ map = new HashMap<>();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T get(Class<T> key) {
+ return (T) map.get(key);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T put(Class<T> key, T value) {
+ return (T) map.put(key, value);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/DisassemblerTool.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2005, 2014, 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.
+ */
+
+package com.sun.tools.javap; //javax.tools;
+
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.util.Locale;
+import java.util.concurrent.Callable;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.OptionChecker;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.Tool;
+
+/**
+ * This class is intended to be put in javax.tools.
+ *
+ * @see DiagnosticListener
+ * @see Diagnostic
+ * @see JavaFileManager
+ * @since 1.7
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public interface DisassemblerTool extends Tool, OptionChecker {
+
+ /**
+ * Creates a future for a disassembly task with the given
+ * components and arguments. The task might not have
+ * completed as described in the DissemblerTask interface.
+ *
+ * <p>If a file manager is provided, it must be able to handle all
+ * locations defined in {@link StandardLocation}.
+ *
+ * @param out a Writer for additional output from the compiler;
+ * use {@code System.err} if {@code null}
+ * @param fileManager a file manager; if {@code null} use the
+ * compiler's standard filemanager
+ * @param diagnosticListener a diagnostic listener; if {@code
+ * null} use the compiler's default method for reporting
+ * diagnostics
+ * @param options compiler options, {@code null} means no options
+ * @param classes class names (for annotation processing), {@code
+ * null} means no class names
+ * @return a task to perform the disassembly
+ * @throws RuntimeException if an unrecoverable error
+ * occurred in a user supplied component. The
+ * {@linkplain Throwable#getCause() cause} will be the error in
+ * user code.
+ * @throws IllegalArgumentException if any of the given
+ * compilation units are of other kind than
+ * {@linkplain JavaFileObject.Kind#SOURCE source}
+ */
+ DisassemblerTask getTask(Writer out,
+ JavaFileManager fileManager,
+ DiagnosticListener<? super JavaFileObject> diagnosticListener,
+ Iterable<String> options,
+ Iterable<String> classes);
+
+ /**
+ * Returns a new instance of the standard file manager implementation
+ * for this tool. The file manager will use the given diagnostic
+ * listener for producing any non-fatal diagnostics. Fatal errors
+ * will be signalled with the appropriate exceptions.
+ *
+ * <p>The standard file manager will be automatically reopened if
+ * it is accessed after calls to {@code flush} or {@code close}.
+ * The standard file manager must be usable with other tools.
+ *
+ * @param diagnosticListener a diagnostic listener for non-fatal
+ * diagnostics; if {@code null} use the compiler's default method
+ * for reporting diagnostics
+ * @param locale the locale to apply when formatting diagnostics;
+ * {@code null} means the {@linkplain Locale#getDefault() default locale}.
+ * @param charset the character set used for decoding bytes; if
+ * {@code null} use the platform default
+ * @return the standard file manager
+ */
+ StandardJavaFileManager getStandardFileManager(
+ DiagnosticListener<? super JavaFileObject> diagnosticListener,
+ Locale locale,
+ Charset charset);
+
+ /**
+ * Interface representing a future for a disassembly task. The
+ * task has not yet started. To start the task, call
+ * the {@linkplain #call call} method.
+ *
+ * <p>Before calling the call method, additional aspects of the
+ * task can be configured, for example, by calling the
+ * {@linkplain #setLocale setLocale} method.
+ */
+ interface DisassemblerTask extends Callable<Boolean> {
+
+ /**
+ * Set the locale to be applied when formatting diagnostics and
+ * other localized data.
+ *
+ * @param locale the locale to apply; {@code null} means apply no
+ * locale
+ * @throws IllegalStateException if the task has started
+ */
+ void setLocale(Locale locale);
+
+ /**
+ * Performs this compilation task. The compilation may only
+ * be performed once. Subsequent calls to this method throw
+ * IllegalStateException.
+ *
+ * @return true if and only all the files compiled without errors;
+ * false otherwise
+ *
+ * @throws RuntimeException if an unrecoverable error occurred
+ * in a user-supplied component. The
+ * {@linkplain Throwable#getCause() cause} will be the error
+ * in user code.
+ * @throws IllegalStateException if called more than once
+ */
+ Boolean call();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/InstructionDetailWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2009, 2013, 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.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.Instruction;
+
+
+/*
+ * Write additional details for an instruction.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public abstract class InstructionDetailWriter extends BasicWriter {
+ public enum Kind {
+ LOCAL_VARS("localVariables"),
+ LOCAL_VAR_TYPES("localVariableTypes"),
+ SOURCE("source"),
+ STACKMAPS("stackMaps"),
+ TRY_BLOCKS("tryBlocks"),
+ TYPE_ANNOS("typeAnnotations");
+
+ Kind(String option) {
+ this.option = option;
+ }
+
+ final String option;
+ }
+
+ InstructionDetailWriter(Context context) {
+ super(context);
+ }
+
+ abstract void writeDetails(Instruction instr);
+ void flush() { }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/InternalError.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2009, 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.
+ */
+
+package com.sun.tools.javap;
+
+/**
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class InternalError extends Error {
+ private static final long serialVersionUID = 8114054446416187030L;
+ InternalError(Throwable t, Object... args) {
+ super("Internal error", t);
+ this.args = args;
+ }
+
+ InternalError(Object... args) {
+ super("Internal error");
+ this.args = args;
+ }
+
+ public final Object[] args;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapFileManager.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2007, 2012, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.io.PrintWriter;
+import java.nio.charset.Charset;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaFileObject;
+
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.Context;
+
+/**
+ * javap's implementation of JavaFileManager.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class JavapFileManager extends JavacFileManager {
+ private JavapFileManager(Context context, Charset charset) {
+ super(context, true, charset);
+ setSymbolFileEnabled(false);
+ }
+
+ public static JavapFileManager create(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) {
+ Context javac_context = new Context();
+
+ if (dl != null)
+ javac_context.put(DiagnosticListener.class, dl);
+ javac_context.put(com.sun.tools.javac.util.Log.outKey, log);
+
+ return new JavapFileManager(javac_context, null);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,1068 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.io.EOFException;
+import java.io.FileNotFoundException;
+import java.io.FilterInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.file.NoSuchFileException;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Objects;
+import java.util.ResourceBundle;
+
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.NestingKind;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.javac.util.DefinedBy;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
+/**
+ * "Main" class for javap, normally accessed from the command line
+ * via Main, or from JSR199 via DisassemblerTool.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
+ public class BadArgs extends Exception {
+ static final long serialVersionUID = 8765093759964640721L;
+ BadArgs(String key, Object... args) {
+ super(JavapTask.this.getMessage(key, args));
+ this.key = key;
+ this.args = args;
+ }
+
+ BadArgs showUsage(boolean b) {
+ showUsage = b;
+ return this;
+ }
+
+ final String key;
+ final Object[] args;
+ boolean showUsage;
+ }
+
+ static abstract class Option {
+ Option(boolean hasArg, String... aliases) {
+ this.hasArg = hasArg;
+ this.aliases = aliases;
+ }
+
+ boolean matches(String opt) {
+ for (String a: aliases) {
+ if (a.equals(opt))
+ return true;
+ }
+ return false;
+ }
+
+ boolean ignoreRest() {
+ return false;
+ }
+
+ abstract void process(JavapTask task, String opt, String arg) throws BadArgs;
+
+ final boolean hasArg;
+ final String[] aliases;
+ }
+
+ static final Option[] recognizedOptions = {
+
+ new Option(false, "-help", "--help", "-?") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.help = true;
+ }
+ },
+
+ new Option(false, "-version") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.version = true;
+ }
+ },
+
+ new Option(false, "-fullversion") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.fullVersion = true;
+ }
+ },
+
+ new Option(false, "-v", "-verbose", "-all") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.verbose = true;
+ task.options.showDescriptors = true;
+ task.options.showFlags = true;
+ task.options.showAllAttrs = true;
+ }
+ },
+
+ new Option(false, "-l") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.showLineAndLocalVariableTables = true;
+ }
+ },
+
+ new Option(false, "-public") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.accessOptions.add(opt);
+ task.options.showAccess = AccessFlags.ACC_PUBLIC;
+ }
+ },
+
+ new Option(false, "-protected") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.accessOptions.add(opt);
+ task.options.showAccess = AccessFlags.ACC_PROTECTED;
+ }
+ },
+
+ new Option(false, "-package") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.accessOptions.add(opt);
+ task.options.showAccess = 0;
+ }
+ },
+
+ new Option(false, "-p", "-private") {
+ void process(JavapTask task, String opt, String arg) {
+ if (!task.options.accessOptions.contains("-p") &&
+ !task.options.accessOptions.contains("-private")) {
+ task.options.accessOptions.add(opt);
+ }
+ task.options.showAccess = AccessFlags.ACC_PRIVATE;
+ }
+ },
+
+ new Option(false, "-c") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.showDisassembled = true;
+ }
+ },
+
+ new Option(false, "-s") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.showDescriptors = true;
+ }
+ },
+
+ new Option(false, "-sysinfo") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.sysInfo = true;
+ }
+ },
+
+ new Option(false, "-XDdetails") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.details = EnumSet.allOf(InstructionDetailWriter.Kind.class);
+ }
+
+ },
+
+ new Option(false, "-XDdetails:") {
+ @Override
+ boolean matches(String opt) {
+ int sep = opt.indexOf(":");
+ return sep != -1 && super.matches(opt.substring(0, sep + 1));
+ }
+
+ void process(JavapTask task, String opt, String arg) throws BadArgs {
+ int sep = opt.indexOf(":");
+ for (String v: opt.substring(sep + 1).split("[,: ]+")) {
+ if (!handleArg(task, v))
+ throw task.new BadArgs("err.invalid.arg.for.option", v);
+ }
+ }
+
+ boolean handleArg(JavapTask task, String arg) {
+ if (arg.length() == 0)
+ return true;
+
+ if (arg.equals("all")) {
+ task.options.details = EnumSet.allOf(InstructionDetailWriter.Kind.class);
+ return true;
+ }
+
+ boolean on = true;
+ if (arg.startsWith("-")) {
+ on = false;
+ arg = arg.substring(1);
+ }
+
+ for (InstructionDetailWriter.Kind k: InstructionDetailWriter.Kind.values()) {
+ if (arg.equalsIgnoreCase(k.option)) {
+ if (on)
+ task.options.details.add(k);
+ else
+ task.options.details.remove(k);
+ return true;
+ }
+ }
+ return false;
+ }
+ },
+
+ new Option(false, "-constants") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.showConstants = true;
+ }
+ },
+
+ new Option(false, "-XDinner") {
+ void process(JavapTask task, String opt, String arg) {
+ task.options.showInnerClasses = true;
+ }
+ },
+
+ new Option(false, "-XDindent:") {
+ @Override
+ boolean matches(String opt) {
+ int sep = opt.indexOf(":");
+ return sep != -1 && super.matches(opt.substring(0, sep + 1));
+ }
+
+ void process(JavapTask task, String opt, String arg) throws BadArgs {
+ int sep = opt.indexOf(":");
+ try {
+ int i = Integer.valueOf(opt.substring(sep + 1));
+ if (i > 0) // silently ignore invalid values
+ task.options.indentWidth = i;
+ } catch (NumberFormatException e) {
+ }
+ }
+ },
+
+ new Option(false, "-XDtab:") {
+ @Override
+ boolean matches(String opt) {
+ int sep = opt.indexOf(":");
+ return sep != -1 && super.matches(opt.substring(0, sep + 1));
+ }
+
+ void process(JavapTask task, String opt, String arg) throws BadArgs {
+ int sep = opt.indexOf(":");
+ try {
+ int i = Integer.valueOf(opt.substring(sep + 1));
+ if (i > 0) // silently ignore invalid values
+ task.options.tabColumn = i;
+ } catch (NumberFormatException e) {
+ }
+ }
+ }
+
+ };
+
+ public JavapTask() {
+ context = new Context();
+ context.put(Messages.class, this);
+ options = Options.instance(context);
+ attributeFactory = new Attribute.Factory();
+ }
+
+ public JavapTask(Writer out,
+ JavaFileManager fileManager,
+ DiagnosticListener<? super JavaFileObject> diagnosticListener) {
+ this();
+ this.log = getPrintWriterForWriter(out);
+ this.fileManager = fileManager;
+ this.diagnosticListener = diagnosticListener;
+ }
+
+ public JavapTask(Writer out,
+ JavaFileManager fileManager,
+ DiagnosticListener<? super JavaFileObject> diagnosticListener,
+ Iterable<String> options,
+ Iterable<String> classes) {
+ this(out, fileManager, diagnosticListener);
+
+ this.classes = new ArrayList<>();
+ for (String classname: classes) {
+ Objects.requireNonNull(classname);
+ this.classes.add(classname);
+ }
+
+ try {
+ if (options != null)
+ handleOptions(options, false);
+ } catch (BadArgs e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ }
+
+ public void setLocale(Locale locale) {
+ if (locale == null)
+ locale = Locale.getDefault();
+ task_locale = locale;
+ }
+
+ public void setLog(Writer log) {
+ this.log = getPrintWriterForWriter(log);
+ }
+
+ public void setLog(OutputStream s) {
+ setLog(getPrintWriterForStream(s));
+ }
+
+ private static PrintWriter getPrintWriterForStream(OutputStream s) {
+ return new PrintWriter(s == null ? System.err : s, true);
+ }
+
+ private static PrintWriter getPrintWriterForWriter(Writer w) {
+ if (w == null)
+ return getPrintWriterForStream(null);
+ else if (w instanceof PrintWriter)
+ return (PrintWriter) w;
+ else
+ return new PrintWriter(w, true);
+ }
+
+ public void setDiagnosticListener(DiagnosticListener<? super JavaFileObject> dl) {
+ diagnosticListener = dl;
+ }
+
+ public void setDiagnosticListener(OutputStream s) {
+ setDiagnosticListener(getDiagnosticListenerForStream(s));
+ }
+
+ private DiagnosticListener<JavaFileObject> getDiagnosticListenerForStream(OutputStream s) {
+ return getDiagnosticListenerForWriter(getPrintWriterForStream(s));
+ }
+
+ private DiagnosticListener<JavaFileObject> getDiagnosticListenerForWriter(Writer w) {
+ final PrintWriter pw = getPrintWriterForWriter(w);
+ return new DiagnosticListener<JavaFileObject> () {
+ @DefinedBy(Api.COMPILER)
+ public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+ switch (diagnostic.getKind()) {
+ case ERROR:
+ pw.print(getMessage("err.prefix"));
+ break;
+ case WARNING:
+ pw.print(getMessage("warn.prefix"));
+ break;
+ case NOTE:
+ pw.print(getMessage("note.prefix"));
+ break;
+ }
+ pw.print(" ");
+ pw.println(diagnostic.getMessage(null));
+ }
+ };
+ }
+
+ /** Result codes.
+ */
+ static final int
+ EXIT_OK = 0, // Compilation completed with no errors.
+ EXIT_ERROR = 1, // Completed but reported errors.
+ EXIT_CMDERR = 2, // Bad command-line arguments
+ EXIT_SYSERR = 3, // System error or resource exhaustion.
+ EXIT_ABNORMAL = 4; // Compiler terminated abnormally
+
+ int run(String[] args) {
+ try {
+ try {
+ handleOptions(args);
+
+ // the following gives consistent behavior with javac
+ if (classes == null || classes.size() == 0) {
+ if (options.help || options.version || options.fullVersion)
+ return EXIT_OK;
+ else
+ return EXIT_CMDERR;
+ }
+
+ return run();
+ } finally {
+ if (defaultFileManager != null) {
+ try {
+ defaultFileManager.close();
+ defaultFileManager = null;
+ } catch (IOException e) {
+ throw new InternalError(e);
+ }
+ }
+ }
+ } catch (BadArgs e) {
+ reportError(e.key, e.args);
+ if (e.showUsage) {
+ printLines(getMessage("main.usage.summary", progname));
+ }
+ return EXIT_CMDERR;
+ } catch (InternalError e) {
+ Object[] e_args;
+ if (e.getCause() == null)
+ e_args = e.args;
+ else {
+ e_args = new Object[e.args.length + 1];
+ e_args[0] = e.getCause();
+ System.arraycopy(e.args, 0, e_args, 1, e.args.length);
+ }
+ reportError("err.internal.error", e_args);
+ return EXIT_ABNORMAL;
+ } finally {
+ log.flush();
+ }
+ }
+
+ public void handleOptions(String[] args) throws BadArgs {
+ handleOptions(Arrays.asList(args), true);
+ }
+
+ private void handleOptions(Iterable<String> args, boolean allowClasses) throws BadArgs {
+ if (log == null) {
+ log = getPrintWriterForStream(System.out);
+ if (diagnosticListener == null)
+ diagnosticListener = getDiagnosticListenerForStream(System.err);
+ } else {
+ if (diagnosticListener == null)
+ diagnosticListener = getDiagnosticListenerForWriter(log);
+ }
+
+
+ if (fileManager == null)
+ fileManager = getDefaultFileManager(diagnosticListener, log);
+
+ Iterator<String> iter = args.iterator();
+ boolean noArgs = !iter.hasNext();
+
+ while (iter.hasNext()) {
+ String arg = iter.next();
+ if (arg.startsWith("-"))
+ handleOption(arg, iter);
+ else if (allowClasses) {
+ if (classes == null)
+ classes = new ArrayList<>();
+ classes.add(arg);
+ while (iter.hasNext())
+ classes.add(iter.next());
+ } else
+ throw new BadArgs("err.unknown.option", arg).showUsage(true);
+ }
+
+ if (options.accessOptions.size() > 1) {
+ StringBuilder sb = new StringBuilder();
+ for (String opt: options.accessOptions) {
+ if (sb.length() > 0)
+ sb.append(" ");
+ sb.append(opt);
+ }
+ throw new BadArgs("err.incompatible.options", sb);
+ }
+
+ if ((classes == null || classes.size() == 0) &&
+ !(noArgs || options.help || options.version || options.fullVersion)) {
+ throw new BadArgs("err.no.classes.specified");
+ }
+
+ if (noArgs || options.help)
+ showHelp();
+
+ if (options.version || options.fullVersion)
+ showVersion(options.fullVersion);
+ }
+
+ private void handleOption(String name, Iterator<String> rest) throws BadArgs {
+ for (Option o: recognizedOptions) {
+ if (o.matches(name)) {
+ if (o.hasArg) {
+ if (rest.hasNext())
+ o.process(this, name, rest.next());
+ else
+ throw new BadArgs("err.missing.arg", name).showUsage(true);
+ } else
+ o.process(this, name, null);
+
+ if (o.ignoreRest()) {
+ while (rest.hasNext())
+ rest.next();
+ }
+ return;
+ }
+ }
+
+ try {
+ if (fileManager.handleOption(name, rest))
+ return;
+ } catch (IllegalArgumentException e) {
+ throw new BadArgs("err.invalid.use.of.option", name).showUsage(true);
+ }
+
+ throw new BadArgs("err.unknown.option", name).showUsage(true);
+ }
+
+ public Boolean call() {
+ return run() == 0;
+ }
+
+ public int run() {
+ if (classes == null || classes.isEmpty()) {
+ return EXIT_ERROR;
+ }
+
+ context.put(PrintWriter.class, log);
+ ClassWriter classWriter = ClassWriter.instance(context);
+ SourceWriter sourceWriter = SourceWriter.instance(context);
+ sourceWriter.setFileManager(fileManager);
+
+ int result = EXIT_OK;
+
+ for (String className: classes) {
+ try {
+ result = writeClass(classWriter, className);
+ } catch (ConstantPoolException e) {
+ reportError("err.bad.constant.pool", className, e.getLocalizedMessage());
+ result = EXIT_ERROR;
+ } catch (EOFException e) {
+ reportError("err.end.of.file", className);
+ result = EXIT_ERROR;
+ } catch (FileNotFoundException | NoSuchFileException e) {
+ reportError("err.file.not.found", e.getLocalizedMessage());
+ result = EXIT_ERROR;
+ } catch (IOException e) {
+ //e.printStackTrace();
+ Object msg = e.getLocalizedMessage();
+ if (msg == null) {
+ msg = e;
+ }
+ reportError("err.ioerror", className, msg);
+ result = EXIT_ERROR;
+ } catch (OutOfMemoryError e) {
+ reportError("err.nomem");
+ result = EXIT_ERROR;
+ } catch (Throwable t) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+ pw.close();
+ reportError("err.crash", t.toString(), sw.toString());
+ result = EXIT_ABNORMAL;
+ }
+ }
+
+ return result;
+ }
+
+ protected int writeClass(ClassWriter classWriter, String className)
+ throws IOException, ConstantPoolException {
+ JavaFileObject fo = open(className);
+ if (fo == null) {
+ reportError("err.class.not.found", className);
+ return EXIT_ERROR;
+ }
+
+ ClassFileInfo cfInfo = read(fo);
+ if (!className.endsWith(".class")) {
+ String cfName = cfInfo.cf.getName();
+ if (!cfName.replaceAll("[/$]", ".").equals(className.replaceAll("[/$]", "."))) {
+ reportWarning("warn.unexpected.class", className, cfName.replace('/', '.'));
+ }
+ }
+ write(cfInfo);
+
+ if (options.showInnerClasses) {
+ ClassFile cf = cfInfo.cf;
+ Attribute a = cf.getAttribute(Attribute.InnerClasses);
+ if (a instanceof InnerClasses_attribute) {
+ InnerClasses_attribute inners = (InnerClasses_attribute) a;
+ try {
+ int result = EXIT_OK;
+ for (int i = 0; i < inners.classes.length; i++) {
+ int outerIndex = inners.classes[i].outer_class_info_index;
+ ConstantPool.CONSTANT_Class_info outerClassInfo = cf.constant_pool.getClassInfo(outerIndex);
+ String outerClassName = outerClassInfo.getName();
+ if (outerClassName.equals(cf.getName())) {
+ int innerIndex = inners.classes[i].inner_class_info_index;
+ ConstantPool.CONSTANT_Class_info innerClassInfo = cf.constant_pool.getClassInfo(innerIndex);
+ String innerClassName = innerClassInfo.getName();
+ classWriter.println("// inner class " + innerClassName.replaceAll("[/$]", "."));
+ classWriter.println();
+ result = writeClass(classWriter, innerClassName);
+ if (result != EXIT_OK) return result;
+ }
+ }
+ return result;
+ } catch (ConstantPoolException e) {
+ reportError("err.bad.innerclasses.attribute", className);
+ return EXIT_ERROR;
+ }
+ } else if (a != null) {
+ reportError("err.bad.innerclasses.attribute", className);
+ return EXIT_ERROR;
+ }
+ }
+
+ return EXIT_OK;
+ }
+
+ protected JavaFileObject open(String className) throws IOException {
+ // for compatibility, first see if it is a class name
+ JavaFileObject fo = getClassFileObject(className);
+ if (fo != null)
+ return fo;
+
+ // see if it is an inner class, by replacing dots to $, starting from the right
+ String cn = className;
+ int lastDot;
+ while ((lastDot = cn.lastIndexOf(".")) != -1) {
+ cn = cn.substring(0, lastDot) + "$" + cn.substring(lastDot + 1);
+ fo = getClassFileObject(cn);
+ if (fo != null)
+ return fo;
+ }
+
+ if (!className.endsWith(".class"))
+ return null;
+
+ if (fileManager instanceof StandardJavaFileManager) {
+ StandardJavaFileManager sfm = (StandardJavaFileManager) fileManager;
+ try {
+ fo = sfm.getJavaFileObjects(className).iterator().next();
+ if (fo != null && fo.getLastModified() != 0) {
+ return fo;
+ }
+ } catch (IllegalArgumentException ignore) {
+ }
+ }
+
+ // see if it is a URL, and if so, wrap it in just enough of a JavaFileObject
+ // to suit javap's needs
+ if (className.matches("^[A-Za-z]+:.*")) {
+ try {
+ final URI uri = new URI(className);
+ final URL url = uri.toURL();
+ final URLConnection conn = url.openConnection();
+ conn.setUseCaches(false);
+ return new JavaFileObject() {
+ @DefinedBy(Api.COMPILER)
+ public Kind getKind() {
+ return JavaFileObject.Kind.CLASS;
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public boolean isNameCompatible(String simpleName, Kind kind) {
+ throw new UnsupportedOperationException();
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public NestingKind getNestingKind() {
+ throw new UnsupportedOperationException();
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public Modifier getAccessLevel() {
+ throw new UnsupportedOperationException();
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public URI toUri() {
+ return uri;
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public String getName() {
+ return uri.toString();
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public InputStream openInputStream() throws IOException {
+ return conn.getInputStream();
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public OutputStream openOutputStream() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public Writer openWriter() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public long getLastModified() {
+ return conn.getLastModified();
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public boolean delete() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+ } catch (URISyntaxException | IOException ignore) {
+ }
+ }
+
+ return null;
+ }
+
+ public static class ClassFileInfo {
+ ClassFileInfo(JavaFileObject fo, ClassFile cf, byte[] digest, int size) {
+ this.fo = fo;
+ this.cf = cf;
+ this.digest = digest;
+ this.size = size;
+ }
+ public final JavaFileObject fo;
+ public final ClassFile cf;
+ public final byte[] digest;
+ public final int size;
+ }
+
+ public ClassFileInfo read(JavaFileObject fo) throws IOException, ConstantPoolException {
+ InputStream in = fo.openInputStream();
+ try {
+ SizeInputStream sizeIn = null;
+ MessageDigest md = null;
+ if (options.sysInfo || options.verbose) {
+ try {
+ md = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException ignore) {
+ }
+ in = new DigestInputStream(in, md);
+ in = sizeIn = new SizeInputStream(in);
+ }
+
+ ClassFile cf = ClassFile.read(in, attributeFactory);
+ byte[] digest = (md == null) ? null : md.digest();
+ int size = (sizeIn == null) ? -1 : sizeIn.size();
+ return new ClassFileInfo(fo, cf, digest, size);
+ } finally {
+ in.close();
+ }
+ }
+
+ public void write(ClassFileInfo info) {
+ ClassWriter classWriter = ClassWriter.instance(context);
+ if (options.sysInfo || options.verbose) {
+ classWriter.setFile(info.fo.toUri());
+ classWriter.setLastModified(info.fo.getLastModified());
+ classWriter.setDigest("MD5", info.digest);
+ classWriter.setFileSize(info.size);
+ }
+
+ classWriter.write(info.cf);
+ }
+
+ protected void setClassFile(ClassFile classFile) {
+ ClassWriter classWriter = ClassWriter.instance(context);
+ classWriter.setClassFile(classFile);
+ }
+
+ protected void setMethod(Method enclosingMethod) {
+ ClassWriter classWriter = ClassWriter.instance(context);
+ classWriter.setMethod(enclosingMethod);
+ }
+
+ protected void write(Attribute value) {
+ AttributeWriter attrWriter = AttributeWriter.instance(context);
+ ClassWriter classWriter = ClassWriter.instance(context);
+ ClassFile cf = classWriter.getClassFile();
+ attrWriter.write(cf, value, cf.constant_pool);
+ }
+
+ protected void write(Attributes attrs) {
+ AttributeWriter attrWriter = AttributeWriter.instance(context);
+ ClassWriter classWriter = ClassWriter.instance(context);
+ ClassFile cf = classWriter.getClassFile();
+ attrWriter.write(cf, attrs, cf.constant_pool);
+ }
+
+ protected void write(ConstantPool constant_pool) {
+ ConstantWriter constantWriter = ConstantWriter.instance(context);
+ constantWriter.writeConstantPool(constant_pool);
+ }
+
+ protected void write(ConstantPool constant_pool, int value) {
+ ConstantWriter constantWriter = ConstantWriter.instance(context);
+ constantWriter.write(value);
+ }
+
+ protected void write(ConstantPool.CPInfo value) {
+ ConstantWriter constantWriter = ConstantWriter.instance(context);
+ constantWriter.println(value);
+ }
+
+ protected void write(Field value) {
+ ClassWriter classWriter = ClassWriter.instance(context);
+ classWriter.writeField(value);
+ }
+
+ protected void write(Method value) {
+ ClassWriter classWriter = ClassWriter.instance(context);
+ classWriter.writeMethod(value);
+ }
+
+ private JavaFileManager getDefaultFileManager(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) {
+ if (defaultFileManager == null)
+ defaultFileManager = JavapFileManager.create(dl, log);
+ return defaultFileManager;
+ }
+
+ private JavaFileObject getClassFileObject(String className) throws IOException {
+ try {
+ JavaFileObject fo;
+ fo = fileManager.getJavaFileForInput(StandardLocation.PLATFORM_CLASS_PATH, className, JavaFileObject.Kind.CLASS);
+ if (fo == null)
+ fo = fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, className, JavaFileObject.Kind.CLASS);
+ return fo;
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
+
+ private void showHelp() {
+ printLines(getMessage("main.usage", progname));
+ for (Option o: recognizedOptions) {
+ String name = o.aliases[0].substring(1); // there must always be at least one name
+ if (name.startsWith("X") || name.equals("fullversion") || name.equals("h") || name.equals("verify"))
+ continue;
+ printLines(getMessage("main.opt." + name));
+ }
+ String[] fmOptions = { "-classpath", "-cp", "-bootclasspath" };
+ for (String o: fmOptions) {
+ if (fileManager.isSupportedOption(o) == -1)
+ continue;
+ String name = o.substring(1);
+ printLines(getMessage("main.opt." + name));
+ }
+
+ }
+
+ private void showVersion(boolean full) {
+ printLines(version(full ? "full" : "release"));
+ }
+
+ private void printLines(String msg) {
+ log.println(msg.replace("\n", nl));
+ }
+
+ private static final String nl = System.getProperty("line.separator");
+
+ private static final String versionRBName = "com.sun.tools.javap.resources.version";
+ private static ResourceBundle versionRB;
+
+ private String version(String key) {
+ // key=version: mm.nn.oo[-milestone]
+ // key=full: mm.mm.oo[-milestone]-build
+ if (versionRB == null) {
+ try {
+ versionRB = ResourceBundle.getBundle(versionRBName);
+ } catch (MissingResourceException e) {
+ return getMessage("version.resource.missing", System.getProperty("java.version"));
+ }
+ }
+ try {
+ return versionRB.getString(key);
+ }
+ catch (MissingResourceException e) {
+ return getMessage("version.unknown", System.getProperty("java.version"));
+ }
+ }
+
+ private void reportError(String key, Object... args) {
+ diagnosticListener.report(createDiagnostic(Diagnostic.Kind.ERROR, key, args));
+ }
+
+ private void reportNote(String key, Object... args) {
+ diagnosticListener.report(createDiagnostic(Diagnostic.Kind.NOTE, key, args));
+ }
+
+ private void reportWarning(String key, Object... args) {
+ diagnosticListener.report(createDiagnostic(Diagnostic.Kind.WARNING, key, args));
+ }
+
+ private Diagnostic<JavaFileObject> createDiagnostic(
+ final Diagnostic.Kind kind, final String key, final Object... args) {
+ return new Diagnostic<JavaFileObject>() {
+ @DefinedBy(Api.COMPILER)
+ public Kind getKind() {
+ return kind;
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public JavaFileObject getSource() {
+ return null;
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public long getPosition() {
+ return Diagnostic.NOPOS;
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public long getStartPosition() {
+ return Diagnostic.NOPOS;
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public long getEndPosition() {
+ return Diagnostic.NOPOS;
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public long getLineNumber() {
+ return Diagnostic.NOPOS;
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public long getColumnNumber() {
+ return Diagnostic.NOPOS;
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public String getCode() {
+ return key;
+ }
+
+ @DefinedBy(Api.COMPILER)
+ public String getMessage(Locale locale) {
+ return JavapTask.this.getMessage(locale, key, args);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getName() + "[key=" + key + ",args=" + Arrays.asList(args) + "]";
+ }
+
+ };
+
+ }
+
+ public String getMessage(String key, Object... args) {
+ return getMessage(task_locale, key, args);
+ }
+
+ public String getMessage(Locale locale, String key, Object... args) {
+ if (bundles == null) {
+ // could make this a HashMap<Locale,SoftReference<ResourceBundle>>
+ // and for efficiency, keep a hard reference to the bundle for the task
+ // locale
+ bundles = new HashMap<>();
+ }
+
+ if (locale == null)
+ locale = Locale.getDefault();
+
+ ResourceBundle b = bundles.get(locale);
+ if (b == null) {
+ try {
+ b = ResourceBundle.getBundle("com.sun.tools.javap.resources.javap", locale);
+ bundles.put(locale, b);
+ } catch (MissingResourceException e) {
+ throw new InternalError("Cannot find javap resource bundle for locale " + locale);
+ }
+ }
+
+ try {
+ return MessageFormat.format(b.getString(key), args);
+ } catch (MissingResourceException e) {
+ throw new InternalError(e, key);
+ }
+ }
+
+ protected Context context;
+ JavaFileManager fileManager;
+ JavaFileManager defaultFileManager;
+ PrintWriter log;
+ DiagnosticListener<? super JavaFileObject> diagnosticListener;
+ List<String> classes;
+ Options options;
+ //ResourceBundle bundle;
+ Locale task_locale;
+ Map<Locale, ResourceBundle> bundles;
+ protected Attribute.Factory attributeFactory;
+
+ private static final String progname = "javap";
+
+ private static class SizeInputStream extends FilterInputStream {
+ SizeInputStream(InputStream in) {
+ super(in);
+ }
+
+ int size() {
+ return size;
+ }
+
+ @Override
+ public int read(byte[] buf, int offset, int length) throws IOException {
+ int n = super.read(buf, offset, length);
+ if (n > 0)
+ size += n;
+ return n;
+ }
+
+ @Override
+ public int read() throws IOException {
+ int b = super.read();
+ size += 1;
+ return b;
+ }
+
+ private int size;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/LocalVariableTableWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2009, 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.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.LocalVariableTable_attribute;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * Annotate instructions with details about local variables.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class LocalVariableTableWriter extends InstructionDetailWriter {
+ public enum NoteKind {
+ START("start") {
+ public boolean match(LocalVariableTable_attribute.Entry entry, int pc) {
+ return (pc == entry.start_pc);
+ }
+ },
+ END("end") {
+ public boolean match(LocalVariableTable_attribute.Entry entry, int pc) {
+ return (pc == entry.start_pc + entry.length);
+ }
+ };
+ NoteKind(String text) {
+ this.text = text;
+ }
+ public abstract boolean match(LocalVariableTable_attribute.Entry entry, int pc);
+ public final String text;
+ }
+
+ static LocalVariableTableWriter instance(Context context) {
+ LocalVariableTableWriter instance = context.get(LocalVariableTableWriter.class);
+ if (instance == null)
+ instance = new LocalVariableTableWriter(context);
+ return instance;
+ }
+
+ protected LocalVariableTableWriter(Context context) {
+ super(context);
+ context.put(LocalVariableTableWriter.class, this);
+ classWriter = ClassWriter.instance(context);
+ }
+
+ public void reset(Code_attribute attr) {
+ codeAttr = attr;
+ pcMap = new HashMap<>();
+ LocalVariableTable_attribute lvt =
+ (LocalVariableTable_attribute) (attr.attributes.get(Attribute.LocalVariableTable));
+ if (lvt == null)
+ return;
+
+ for (int i = 0; i < lvt.local_variable_table.length; i++) {
+ LocalVariableTable_attribute.Entry entry = lvt.local_variable_table[i];
+ put(entry.start_pc, entry);
+ put(entry.start_pc + entry.length, entry);
+ }
+ }
+
+ public void writeDetails(Instruction instr) {
+ int pc = instr.getPC();
+ writeLocalVariables(pc, NoteKind.END);
+ writeLocalVariables(pc, NoteKind.START);
+ }
+
+ @Override
+ public void flush() {
+ int pc = codeAttr.code_length;
+ writeLocalVariables(pc, NoteKind.END);
+ }
+
+ public void writeLocalVariables(int pc, NoteKind kind) {
+ ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
+ String indent = space(2); // get from Options?
+ List<LocalVariableTable_attribute.Entry> entries = pcMap.get(pc);
+ if (entries != null) {
+ for (ListIterator<LocalVariableTable_attribute.Entry> iter =
+ entries.listIterator(kind == NoteKind.END ? entries.size() : 0);
+ kind == NoteKind.END ? iter.hasPrevious() : iter.hasNext() ; ) {
+ LocalVariableTable_attribute.Entry entry =
+ kind == NoteKind.END ? iter.previous() : iter.next();
+ if (kind.match(entry, pc)) {
+ print(indent);
+ print(kind.text);
+ print(" local ");
+ print(entry.index);
+ print(" // ");
+ Descriptor d = new Descriptor(entry.descriptor_index);
+ try {
+ print(d.getFieldType(constant_pool));
+ } catch (InvalidDescriptor e) {
+ print(report(e));
+ } catch (ConstantPoolException e) {
+ print(report(e));
+ }
+ print(" ");
+ try {
+ print(constant_pool.getUTF8Value(entry.name_index));
+ } catch (ConstantPoolException e) {
+ print(report(e));
+ }
+ println();
+ }
+ }
+ }
+ }
+
+ private void put(int pc, LocalVariableTable_attribute.Entry entry) {
+ List<LocalVariableTable_attribute.Entry> list = pcMap.get(pc);
+ if (list == null) {
+ list = new ArrayList<>();
+ pcMap.put(pc, list);
+ }
+ if (!list.contains(entry))
+ list.add(entry);
+ }
+
+ private ClassWriter classWriter;
+ private Code_attribute codeAttr;
+ private Map<Integer, List<LocalVariableTable_attribute.Entry>> pcMap;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/LocalVariableTypeTableWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2009, 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.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
+import com.sun.tools.classfile.Signature;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * Annotate instructions with details about local variables.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class LocalVariableTypeTableWriter extends InstructionDetailWriter {
+ public enum NoteKind {
+ START("start") {
+ public boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc) {
+ return (pc == entry.start_pc);
+ }
+ },
+ END("end") {
+ public boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc) {
+ return (pc == entry.start_pc + entry.length);
+ }
+ };
+ NoteKind(String text) {
+ this.text = text;
+ }
+ public abstract boolean match(LocalVariableTypeTable_attribute.Entry entry, int pc);
+ public final String text;
+ }
+
+ static LocalVariableTypeTableWriter instance(Context context) {
+ LocalVariableTypeTableWriter instance = context.get(LocalVariableTypeTableWriter.class);
+ if (instance == null)
+ instance = new LocalVariableTypeTableWriter(context);
+ return instance;
+ }
+
+ protected LocalVariableTypeTableWriter(Context context) {
+ super(context);
+ context.put(LocalVariableTypeTableWriter.class, this);
+ classWriter = ClassWriter.instance(context);
+ }
+
+ public void reset(Code_attribute attr) {
+ codeAttr = attr;
+ pcMap = new HashMap<>();
+ LocalVariableTypeTable_attribute lvt =
+ (LocalVariableTypeTable_attribute) (attr.attributes.get(Attribute.LocalVariableTypeTable));
+ if (lvt == null)
+ return;
+
+ for (int i = 0; i < lvt.local_variable_table.length; i++) {
+ LocalVariableTypeTable_attribute.Entry entry = lvt.local_variable_table[i];
+ put(entry.start_pc, entry);
+ put(entry.start_pc + entry.length, entry);
+ }
+ }
+
+ public void writeDetails(Instruction instr) {
+ int pc = instr.getPC();
+ writeLocalVariables(pc, NoteKind.END);
+ writeLocalVariables(pc, NoteKind.START);
+ }
+
+ @Override
+ public void flush() {
+ int pc = codeAttr.code_length;
+ writeLocalVariables(pc, NoteKind.END);
+ }
+
+ public void writeLocalVariables(int pc, NoteKind kind) {
+ ConstantPool constant_pool = classWriter.getClassFile().constant_pool;
+ String indent = space(2); // get from Options?
+ List<LocalVariableTypeTable_attribute.Entry> entries = pcMap.get(pc);
+ if (entries != null) {
+ for (ListIterator<LocalVariableTypeTable_attribute.Entry> iter =
+ entries.listIterator(kind == NoteKind.END ? entries.size() : 0);
+ kind == NoteKind.END ? iter.hasPrevious() : iter.hasNext() ; ) {
+ LocalVariableTypeTable_attribute.Entry entry =
+ kind == NoteKind.END ? iter.previous() : iter.next();
+ if (kind.match(entry, pc)) {
+ print(indent);
+ print(kind.text);
+ print(" generic local ");
+ print(entry.index);
+ print(" // ");
+ Descriptor d = new Signature(entry.signature_index);
+ try {
+ print(d.getFieldType(constant_pool).toString().replace("/", "."));
+ } catch (InvalidDescriptor e) {
+ print(report(e));
+ } catch (ConstantPoolException e) {
+ print(report(e));
+ }
+ print(" ");
+ try {
+ print(constant_pool.getUTF8Value(entry.name_index));
+ } catch (ConstantPoolException e) {
+ print(report(e));
+ }
+ println();
+ }
+ }
+ }
+ }
+
+ private void put(int pc, LocalVariableTypeTable_attribute.Entry entry) {
+ List<LocalVariableTypeTable_attribute.Entry> list = pcMap.get(pc);
+ if (list == null) {
+ list = new ArrayList<>();
+ pcMap.put(pc, list);
+ }
+ if (!list.contains(entry))
+ list.add(entry);
+ }
+
+ private ClassWriter classWriter;
+ private Code_attribute codeAttr;
+ private Map<Integer, List<LocalVariableTypeTable_attribute.Entry>> pcMap;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/Main.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.io.PrintWriter;
+
+/**
+ * Main entry point.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Main {
+ /**
+ * Main entry point for the launcher.
+ * Note: This method calls System.exit.
+ * @param args command line arguments
+ */
+ public static void main(String[] args) {
+ JavapTask t = new JavapTask();
+ int rc = t.run(args);
+ System.exit(rc);
+ }
+
+ /**
+ * Entry point that does <i>not</i> call System.exit.
+ * @param args command line arguments
+ * @param out output stream
+ * @return an exit code. 0 means success, non-zero means an error occurred.
+ */
+ public static int run(String[] args, PrintWriter out) {
+ JavapTask t = new JavapTask();
+ t.setLog(out);
+ return t.run(args);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/Messages.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007, 2009, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.util.Locale;
+
+/**
+ * Access to javap messages.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public interface Messages {
+ String getMessage(String key, Object... args);
+
+ String getMessage(Locale locale, String key, Object... args);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/Options.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.Set;
+
+import com.sun.tools.classfile.AccessFlags;
+
+/*
+ * Provides access to javap's options, set via the command line
+ * or JSR 199 API.
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class Options {
+ public static Options instance(Context context) {
+ Options instance = context.get(Options.class);
+ if (instance == null)
+ instance = new Options(context);
+ return instance;
+ }
+
+ protected Options(Context context) {
+ context.put(Options.class, this);
+ }
+
+ /**
+ * Checks access of class, field or method.
+ */
+ public boolean checkAccess(AccessFlags flags){
+
+ boolean isPublic = flags.is(AccessFlags.ACC_PUBLIC);
+ boolean isProtected = flags.is(AccessFlags.ACC_PROTECTED);
+ boolean isPrivate = flags.is(AccessFlags.ACC_PRIVATE);
+ boolean isPackage = !(isPublic || isProtected || isPrivate);
+
+ if ((showAccess == AccessFlags.ACC_PUBLIC) && (isProtected || isPrivate || isPackage))
+ return false;
+ else if ((showAccess == AccessFlags.ACC_PROTECTED) && (isPrivate || isPackage))
+ return false;
+ else if ((showAccess == 0) && (isPrivate))
+ return false;
+ else
+ return true;
+ }
+
+ public boolean help;
+ public boolean verbose;
+ public boolean version;
+ public boolean fullVersion;
+ public boolean showFlags;
+ public boolean showLineAndLocalVariableTables;
+ public int showAccess;
+ public Set<String> accessOptions = new HashSet<>();
+ public Set<InstructionDetailWriter.Kind> details = EnumSet.noneOf(InstructionDetailWriter.Kind.class);
+ public boolean showDisassembled;
+ public boolean showDescriptors;
+ public boolean showAllAttrs;
+ public boolean showConstants;
+ public boolean sysInfo;
+ public boolean showInnerClasses;
+ public int indentWidth = 2; // #spaces per indentWidth level; must be > 0
+ public int tabColumn = 40; // column number for comments; must be > 0
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/SourceWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2009, 2010, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardLocation;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.LineNumberTable_attribute;
+import com.sun.tools.classfile.SourceFile_attribute;
+
+
+/**
+ * Annotate instructions with source code.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class SourceWriter extends InstructionDetailWriter {
+ static SourceWriter instance(Context context) {
+ SourceWriter instance = context.get(SourceWriter.class);
+ if (instance == null)
+ instance = new SourceWriter(context);
+ return instance;
+ }
+
+ protected SourceWriter(Context context) {
+ super(context);
+ context.put(SourceWriter.class, this);
+ }
+
+ void setFileManager(JavaFileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void reset(ClassFile cf, Code_attribute attr) {
+ setSource(cf);
+ setLineMap(attr);
+ }
+
+ public void writeDetails(Instruction instr) {
+ String indent = space(40); // could get from Options?
+ Set<Integer> lines = lineMap.get(instr.getPC());
+ if (lines != null) {
+ for (int line: lines) {
+ print(indent);
+ print(String.format(" %4d ", line));
+ if (line < sourceLines.length)
+ print(sourceLines[line]);
+ println();
+ int nextLine = nextLine(line);
+ for (int i = line + 1; i < nextLine; i++) {
+ print(indent);
+ print(String.format("(%4d)", i));
+ if (i < sourceLines.length)
+ print(sourceLines[i]);
+ println();
+ }
+ }
+ }
+ }
+
+ public boolean hasSource() {
+ return (sourceLines.length > 0);
+ }
+
+ private void setLineMap(Code_attribute attr) {
+ SortedMap<Integer, SortedSet<Integer>> map = new TreeMap<>();
+ SortedSet<Integer> allLines = new TreeSet<>();
+ for (Attribute a: attr.attributes) {
+ if (a instanceof LineNumberTable_attribute) {
+ LineNumberTable_attribute t = (LineNumberTable_attribute) a;
+ for (LineNumberTable_attribute.Entry e: t.line_number_table) {
+ int start_pc = e.start_pc;
+ int line = e.line_number;
+ SortedSet<Integer> pcLines = map.get(start_pc);
+ if (pcLines == null) {
+ pcLines = new TreeSet<>();
+ map.put(start_pc, pcLines);
+ }
+ pcLines.add(line);
+ allLines.add(line);
+ }
+ }
+ }
+ lineMap = map;
+ lineList = new ArrayList<>(allLines);
+ }
+
+ private void setSource(ClassFile cf) {
+ if (cf != classFile) {
+ classFile = cf;
+ sourceLines = splitLines(readSource(cf));
+ }
+ }
+
+ private String readSource(ClassFile cf) {
+ if (fileManager == null)
+ return null;
+
+ Location location;
+ if (fileManager.hasLocation((StandardLocation.SOURCE_PATH)))
+ location = StandardLocation.SOURCE_PATH;
+ else
+ location = StandardLocation.CLASS_PATH;
+
+ // Guess the source file for a class from the package name for this
+ // class and the base of the source file. This avoids having to read
+ // additional classes to determine the outmost class from any
+ // InnerClasses and EnclosingMethod attributes.
+ try {
+ String className = cf.getName();
+ SourceFile_attribute sf =
+ (SourceFile_attribute) cf.attributes.get(Attribute.SourceFile);
+ if (sf == null) {
+ report(messages.getMessage("err.no.SourceFile.attribute"));
+ return null;
+ }
+ String sourceFile = sf.getSourceFile(cf.constant_pool);
+ String fileBase = sourceFile.endsWith(".java")
+ ? sourceFile.substring(0, sourceFile.length() - 5) : sourceFile;
+ int sep = className.lastIndexOf("/");
+ String pkgName = (sep == -1 ? "" : className.substring(0, sep+1));
+ String topClassName = (pkgName + fileBase).replace('/', '.');
+ JavaFileObject fo =
+ fileManager.getJavaFileForInput(location,
+ topClassName,
+ JavaFileObject.Kind.SOURCE);
+ if (fo == null) {
+ report(messages.getMessage("err.source.file.not.found"));
+ return null;
+ }
+ return fo.getCharContent(true).toString();
+ } catch (ConstantPoolException e) {
+ report(e);
+ return null;
+ } catch (IOException e) {
+ report(e.getLocalizedMessage());
+ return null;
+ }
+ }
+
+ private static String[] splitLines(String text) {
+ if (text == null)
+ return new String[0];
+
+ List<String> lines = new ArrayList<>();
+ lines.add(""); // dummy line 0
+ try {
+ BufferedReader r = new BufferedReader(new StringReader(text));
+ String line;
+ while ((line = r.readLine()) != null)
+ lines.add(line);
+ } catch (IOException ignore) {
+ }
+ return lines.toArray(new String[lines.size()]);
+ }
+
+ private int nextLine(int line) {
+ int i = lineList.indexOf(line);
+ if (i == -1 || i == lineList.size() - 1)
+ return - 1;
+ return lineList.get(i + 1);
+ }
+
+ private JavaFileManager fileManager;
+ private ClassFile classFile;
+ private SortedMap<Integer, SortedSet<Integer>> lineMap;
+ private List<Integer> lineList;
+ private String[] sourceLines;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/StackMapWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2009, 2013, 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.
+ */
+
+package com.sun.tools.javap;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.sun.tools.classfile.AccessFlags;
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.classfile.StackMapTable_attribute;
+import com.sun.tools.classfile.StackMapTable_attribute.*;
+
+import static com.sun.tools.classfile.StackMapTable_attribute.verification_type_info.*;
+
+/**
+ * Annotate instructions with stack map.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class StackMapWriter extends InstructionDetailWriter {
+ static StackMapWriter instance(Context context) {
+ StackMapWriter instance = context.get(StackMapWriter.class);
+ if (instance == null)
+ instance = new StackMapWriter(context);
+ return instance;
+ }
+
+ protected StackMapWriter(Context context) {
+ super(context);
+ context.put(StackMapWriter.class, this);
+ classWriter = ClassWriter.instance(context);
+ }
+
+ public void reset(Code_attribute attr) {
+ setStackMap((StackMapTable_attribute) attr.attributes.get(Attribute.StackMapTable));
+ }
+
+ void setStackMap(StackMapTable_attribute attr) {
+ if (attr == null) {
+ map = null;
+ return;
+ }
+
+ Method m = classWriter.getMethod();
+ Descriptor d = m.descriptor;
+ String[] args;
+ try {
+ ConstantPool cp = classWriter.getClassFile().constant_pool;
+ String argString = d.getParameterTypes(cp);
+ args = argString.substring(1, argString.length() - 1).split("[, ]+");
+ } catch (ConstantPoolException | InvalidDescriptor e) {
+ return;
+ }
+ boolean isStatic = m.access_flags.is(AccessFlags.ACC_STATIC);
+
+ verification_type_info[] initialLocals = new verification_type_info[(isStatic ? 0 : 1) + args.length];
+ if (!isStatic)
+ initialLocals[0] = new CustomVerificationTypeInfo("this");
+ for (int i = 0; i < args.length; i++) {
+ initialLocals[(isStatic ? 0 : 1) + i] =
+ new CustomVerificationTypeInfo(args[i].replace(".", "/"));
+ }
+
+ map = new HashMap<>();
+ StackMapBuilder builder = new StackMapBuilder();
+
+ // using -1 as the pc for the initial frame effectively compensates for
+ // the difference in behavior for the first stack map frame (where the
+ // pc offset is just offset_delta) compared to subsequent frames (where
+ // the pc offset is always offset_delta+1).
+ int pc = -1;
+
+ map.put(pc, new StackMap(initialLocals, empty));
+
+ for (int i = 0; i < attr.entries.length; i++)
+ pc = attr.entries[i].accept(builder, pc);
+ }
+
+ public void writeInitialDetails() {
+ writeDetails(-1);
+ }
+
+ public void writeDetails(Instruction instr) {
+ writeDetails(instr.getPC());
+ }
+
+ private void writeDetails(int pc) {
+ if (map == null)
+ return;
+
+ StackMap m = map.get(pc);
+ if (m != null) {
+ print("StackMap locals: ", m.locals);
+ print("StackMap stack: ", m.stack);
+ }
+
+ }
+
+ void print(String label, verification_type_info[] entries) {
+ print(label);
+ for (int i = 0; i < entries.length; i++) {
+ print(" ");
+ print(entries[i]);
+ }
+ println();
+ }
+
+ void print(verification_type_info entry) {
+ if (entry == null) {
+ print("ERROR");
+ return;
+ }
+
+ switch (entry.tag) {
+ case -1:
+ print(((CustomVerificationTypeInfo) entry).text);
+ break;
+
+ case ITEM_Top:
+ print("top");
+ break;
+
+ case ITEM_Integer:
+ print("int");
+ break;
+
+ case ITEM_Float:
+ print("float");
+ break;
+
+ case ITEM_Long:
+ print("long");
+ break;
+
+ case ITEM_Double:
+ print("double");
+ break;
+
+ case ITEM_Null:
+ print("null");
+ break;
+
+ case ITEM_UninitializedThis:
+ print("uninit_this");
+ break;
+
+ case ITEM_Object:
+ try {
+ ConstantPool cp = classWriter.getClassFile().constant_pool;
+ ConstantPool.CONSTANT_Class_info class_info = cp.getClassInfo(((Object_variable_info) entry).cpool_index);
+ print(cp.getUTF8Value(class_info.name_index));
+ } catch (ConstantPoolException e) {
+ print("??");
+ }
+ break;
+
+ case ITEM_Uninitialized:
+ print(((Uninitialized_variable_info) entry).offset);
+ break;
+ }
+
+ }
+
+ private Map<Integer, StackMap> map;
+ private ClassWriter classWriter;
+
+ class StackMapBuilder
+ implements StackMapTable_attribute.stack_map_frame.Visitor<Integer, Integer> {
+
+ public Integer visit_same_frame(same_frame frame, Integer pc) {
+ int new_pc = pc + frame.getOffsetDelta() + 1;
+ StackMap m = map.get(pc);
+ assert (m != null);
+ map.put(new_pc, m);
+ return new_pc;
+ }
+
+ public Integer visit_same_locals_1_stack_item_frame(same_locals_1_stack_item_frame frame, Integer pc) {
+ int new_pc = pc + frame.getOffsetDelta() + 1;
+ StackMap prev = map.get(pc);
+ assert (prev != null);
+ StackMap m = new StackMap(prev.locals, frame.stack);
+ map.put(new_pc, m);
+ return new_pc;
+ }
+
+ public Integer visit_same_locals_1_stack_item_frame_extended(same_locals_1_stack_item_frame_extended frame, Integer pc) {
+ int new_pc = pc + frame.getOffsetDelta() + 1;
+ StackMap prev = map.get(pc);
+ assert (prev != null);
+ StackMap m = new StackMap(prev.locals, frame.stack);
+ map.put(new_pc, m);
+ return new_pc;
+ }
+
+ public Integer visit_chop_frame(chop_frame frame, Integer pc) {
+ int new_pc = pc + frame.getOffsetDelta() + 1;
+ StackMap prev = map.get(pc);
+ assert (prev != null);
+ int k = 251 - frame.frame_type;
+ verification_type_info[] new_locals = Arrays.copyOf(prev.locals, prev.locals.length - k);
+ StackMap m = new StackMap(new_locals, empty);
+ map.put(new_pc, m);
+ return new_pc;
+ }
+
+ public Integer visit_same_frame_extended(same_frame_extended frame, Integer pc) {
+ int new_pc = pc + frame.getOffsetDelta();
+ StackMap m = map.get(pc);
+ assert (m != null);
+ map.put(new_pc, m);
+ return new_pc;
+ }
+
+ public Integer visit_append_frame(append_frame frame, Integer pc) {
+ int new_pc = pc + frame.getOffsetDelta() + 1;
+ StackMap prev = map.get(pc);
+ assert (prev != null);
+ verification_type_info[] new_locals = new verification_type_info[prev.locals.length + frame.locals.length];
+ System.arraycopy(prev.locals, 0, new_locals, 0, prev.locals.length);
+ System.arraycopy(frame.locals, 0, new_locals, prev.locals.length, frame.locals.length);
+ StackMap m = new StackMap(new_locals, empty);
+ map.put(new_pc, m);
+ return new_pc;
+ }
+
+ public Integer visit_full_frame(full_frame frame, Integer pc) {
+ int new_pc = pc + frame.getOffsetDelta() + 1;
+ StackMap m = new StackMap(frame.locals, frame.stack);
+ map.put(new_pc, m);
+ return new_pc;
+ }
+
+ }
+
+ static class StackMap {
+ StackMap(verification_type_info[] locals, verification_type_info[] stack) {
+ this.locals = locals;
+ this.stack = stack;
+ }
+
+ private final verification_type_info[] locals;
+ private final verification_type_info[] stack;
+ }
+
+ static class CustomVerificationTypeInfo extends verification_type_info {
+ public CustomVerificationTypeInfo(String text) {
+ super(-1);
+ this.text = text;
+ }
+ private String text;
+ }
+
+ private final verification_type_info[] empty = { };
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/TryBlockWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2009, 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.
+ */
+
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.Code_attribute.Exception_data;
+import com.sun.tools.classfile.Instruction;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * Annotate instructions with details about try blocks.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class TryBlockWriter extends InstructionDetailWriter {
+ public enum NoteKind {
+ START("try") {
+ public boolean match(Exception_data entry, int pc) {
+ return (pc == entry.start_pc);
+ }
+ },
+ END("end try") {
+ public boolean match(Exception_data entry, int pc) {
+ return (pc == entry.end_pc);
+ }
+ },
+ HANDLER("catch") {
+ public boolean match(Exception_data entry, int pc) {
+ return (pc == entry.handler_pc);
+ }
+ };
+ NoteKind(String text) {
+ this.text = text;
+ }
+ public abstract boolean match(Exception_data entry, int pc);
+ public final String text;
+ }
+
+ static TryBlockWriter instance(Context context) {
+ TryBlockWriter instance = context.get(TryBlockWriter.class);
+ if (instance == null)
+ instance = new TryBlockWriter(context);
+ return instance;
+ }
+
+ protected TryBlockWriter(Context context) {
+ super(context);
+ context.put(TryBlockWriter.class, this);
+ constantWriter = ConstantWriter.instance(context);
+ }
+
+ public void reset(Code_attribute attr) {
+ indexMap = new HashMap<>();
+ pcMap = new HashMap<>();
+ for (int i = 0; i < attr.exception_table.length; i++) {
+ Exception_data entry = attr.exception_table[i];
+ indexMap.put(entry, i);
+ put(entry.start_pc, entry);
+ put(entry.end_pc, entry);
+ put(entry.handler_pc, entry);
+ }
+ }
+
+ public void writeDetails(Instruction instr) {
+ writeTrys(instr, NoteKind.END);
+ writeTrys(instr, NoteKind.START);
+ writeTrys(instr, NoteKind.HANDLER);
+ }
+
+ public void writeTrys(Instruction instr, NoteKind kind) {
+ String indent = space(2); // get from Options?
+ int pc = instr.getPC();
+ List<Exception_data> entries = pcMap.get(pc);
+ if (entries != null) {
+ for (ListIterator<Exception_data> iter =
+ entries.listIterator(kind == NoteKind.END ? entries.size() : 0);
+ kind == NoteKind.END ? iter.hasPrevious() : iter.hasNext() ; ) {
+ Exception_data entry =
+ kind == NoteKind.END ? iter.previous() : iter.next();
+ if (kind.match(entry, pc)) {
+ print(indent);
+ print(kind.text);
+ print("[");
+ print(indexMap.get(entry));
+ print("] ");
+ if (entry.catch_type == 0)
+ print("finally");
+ else {
+ print("#" + entry.catch_type);
+ print(" // ");
+ constantWriter.write(entry.catch_type);
+ }
+ println();
+ }
+ }
+ }
+ }
+
+ private void put(int pc, Exception_data entry) {
+ List<Exception_data> list = pcMap.get(pc);
+ if (list == null) {
+ list = new ArrayList<>();
+ pcMap.put(pc, list);
+ }
+ if (!list.contains(entry))
+ list.add(entry);
+ }
+
+ private Map<Integer, List<Exception_data>> pcMap;
+ private Map<Exception_data, Integer> indexMap;
+ private ConstantWriter constantWriter;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2009, 2013, 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.
+ */
+package com.sun.tools.javap;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.TypeAnnotation;
+import com.sun.tools.classfile.TypeAnnotation.Position;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeTypeAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import com.sun.tools.javac.util.StringUtils;
+
+/**
+ * Annotate instructions with details about type annotations.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ */
+public class TypeAnnotationWriter extends InstructionDetailWriter {
+ public enum NoteKind { VISIBLE, INVISIBLE }
+
+ public static class Note {
+ Note(NoteKind kind, TypeAnnotation anno) {
+ this.kind = kind;
+ this.anno = anno;
+ }
+ public final NoteKind kind;
+ public final TypeAnnotation anno;
+ }
+
+ static TypeAnnotationWriter instance(Context context) {
+ TypeAnnotationWriter instance = context.get(TypeAnnotationWriter.class);
+ if (instance == null)
+ instance = new TypeAnnotationWriter(context);
+ return instance;
+ }
+
+ protected TypeAnnotationWriter(Context context) {
+ super(context);
+ context.put(TypeAnnotationWriter.class, this);
+ annotationWriter = AnnotationWriter.instance(context);
+ classWriter = ClassWriter.instance(context);
+ }
+
+ public void reset(Code_attribute attr) {
+ Method m = classWriter.getMethod();
+ pcMap = new HashMap<>();
+ check(NoteKind.VISIBLE, (RuntimeVisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeVisibleTypeAnnotations));
+ check(NoteKind.INVISIBLE, (RuntimeInvisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeInvisibleTypeAnnotations));
+ }
+
+ private void check(NoteKind kind, RuntimeTypeAnnotations_attribute attr) {
+ if (attr == null)
+ return;
+
+ for (TypeAnnotation anno: attr.annotations) {
+ Position p = anno.position;
+ Note note = null;
+ if (p.offset != -1)
+ addNote(p.offset, note = new Note(kind, anno));
+ if (p.lvarOffset != null) {
+ for (int i = 0; i < p.lvarOffset.length; i++) {
+ if (note == null)
+ note = new Note(kind, anno);
+ addNote(p.lvarOffset[i], note);
+ }
+ }
+ }
+ }
+
+ private void addNote(int pc, Note note) {
+ List<Note> list = pcMap.get(pc);
+ if (list == null)
+ pcMap.put(pc, list = new ArrayList<>());
+ list.add(note);
+ }
+
+ @Override
+ void writeDetails(Instruction instr) {
+ String indent = space(2); // get from Options?
+ int pc = instr.getPC();
+ List<Note> notes = pcMap.get(pc);
+ if (notes != null) {
+ for (Note n: notes) {
+ print(indent);
+ print("@");
+ annotationWriter.write(n.anno, false, true);
+ print(", ");
+ println(StringUtils.toLowerCase(n.kind.toString()));
+ }
+ }
+ }
+
+ private AnnotationWriter annotationWriter;
+ private ClassWriter classWriter;
+ private Map<Integer, List<Note>> pcMap;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/overview.html Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <title>javap: class file disassembler</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+ <body>
+ Javap is a class file disassembler.
+ </body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/package-info.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2007, 2013, 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.
+ */
+
+/**
+ Classes to dump class files in text format.
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.javap;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,87 @@
+
+err.prefix=Error:
+
+err.bad.constant.pool=error while reading constant pool for {0}: {1}
+err.class.not.found=class not found: {0}
+err.crash=A serious internal error has occurred: {0}\nPlease file a bug report, and include the following information:\n{1}
+err.end.of.file=unexpected end of file while reading {0}
+err.file.not.found=file not found: {0}
+err.incompatible.options=bad combination of options: {0}
+err.internal.error=internal error: {0} {1} {2}
+err.invalid.arg.for.option=invalid argument for option: {0}
+err.ioerror=IO error reading {0}: {1}
+err.missing.arg=no value given for {0}
+err.no.classes.specified=no classes specified
+err.not.standard.file.manager=can only specify class files when using a standard file manager
+err.invalid.use.of.option=invalid use of option: {0}
+err.unknown.option=unknown option: {0}
+err.no.SourceFile.attribute=no SourceFile attribute
+err.source.file.not.found=source file not found
+err.bad.innerclasses.attribute=bad InnerClasses attribute for {0}
+err.nomem=Insufficient memory. To increase memory use -J-Xmx option.
+
+main.usage.summary=\
+Usage: {0} <options> <classes>\n\
+use -help for a list of possible options
+
+warn.prefix=Warning:
+warn.unexpected.class=Binary file {0} contains {1}
+
+note.prefix=Note:
+
+main.usage.summary=\
+Usage: {0} <options> <classes>\n\
+use -help for a list of possible options
+
+main.usage=\
+Usage: {0} <options> <classes>\n\
+where possible options include:
+
+
+main.opt.help=\
+\ -help --help -? Print this usage message
+
+main.opt.version=\
+\ -version Version information
+
+main.opt.v=\
+\ -v -verbose Print additional information
+
+main.opt.l=\
+\ -l Print line number and local variable tables
+
+main.opt.public=\
+\ -public Show only public classes and members
+
+main.opt.protected=\
+\ -protected Show protected/public classes and members
+
+main.opt.package=\
+\ -package Show package/protected/public classes\n\
+\ and members (default)
+
+main.opt.p=\
+\ -p -private Show all classes and members
+
+main.opt.c=\
+\ -c Disassemble the code
+
+main.opt.s=\
+\ -s Print internal type signatures
+
+main.opt.classpath=\
+\ -classpath <path> Specify where to find user class files
+
+main.opt.cp=\
+\ -cp <path> Specify where to find user class files
+
+main.opt.bootclasspath=\
+\ -bootclasspath <path> Override location of bootstrap class files
+
+main.opt.constants=\
+\ -constants Show final constants
+
+
+main.opt.sysinfo=\
+\ -sysinfo Show system info (path, size, date, MD5 hash)\n\
+\ of class being processed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_ja.properties Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,65 @@
+
+err.prefix=\u30A8\u30E9\u30FC:
+
+err.bad.constant.pool={0}\u306E\u5B9A\u6570\u30D7\u30FC\u30EB\u306E\u8AAD\u53D6\u308A\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {1}
+err.class.not.found=\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
+err.crash=\u91CD\u5927\u306A\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {0}\n\u6B21\u306E\u60C5\u5831\u3092\u542B\u3080\u30D0\u30B0\u30FB\u30EC\u30DD\u30FC\u30C8\u3092\u30D5\u30A1\u30A4\u30EB\u3057\u3066\u304F\u3060\u3055\u3044:\n{1}
+err.end.of.file={0}\u306E\u8AAD\u53D6\u308A\u4E2D\u306B\u4E88\u671F\u3057\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u306E\u7D42\u308F\u308A\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F
+err.file.not.found=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
+err.h.not.supported=-h\u306F\u4F7F\u7528\u53EF\u80FD\u3067\u306A\u304F\u306A\u308A\u307E\u3057\u305F - 'javah'\u30D7\u30ED\u30B0\u30E9\u30E0\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
+err.incompatible.options=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u304C\u4E0D\u6B63\u3067\u3059: {0}
+err.internal.error=\u5185\u90E8\u30A8\u30E9\u30FC: {0} {1} {2}
+err.invalid.arg.for.option=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: {0}
+err.ioerror={0}\u306E\u8AAD\u53D6\u308A\u4E2D\u306BIO\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F: {1}
+err.missing.arg={0}\u306B\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+err.no.classes.specified=\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+err.not.standard.file.manager=\u6A19\u6E96\u30D5\u30A1\u30A4\u30EB\u30FB\u30DE\u30CD\u30FC\u30B8\u30E3\u3092\u4F7F\u7528\u3057\u3066\u3044\u308B\u5834\u5408\u306F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u307F\u6307\u5B9A\u3067\u304D\u307E\u3059
+err.unknown.option=\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}
+err.verify.not.supported=-verify\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+err.no.SourceFile.attribute=SourceFile\u5C5E\u6027\u304C\u3042\u308A\u307E\u305B\u3093
+err.source.file.not.found=\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+err.bad.innerclasses.attribute={0}\u306EInnerClasses\u5C5E\u6027\u304C\u4E0D\u6B63\u3067\u3059
+warn.Xold.not.supported=-Xold\u306F\u4F7F\u7528\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3057\u305F
+
+main.usage.summary=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u30EA\u30B9\u30C8\u306B\u3064\u3044\u3066\u306F\u3001-help\u3092\u4F7F\u7528\u3057\u307E\u3059
+
+warn.prefix=\u8B66\u544A:
+warn.unexpected.class=\u30D0\u30A4\u30CA\u30EA\u30FB\u30D5\u30A1\u30A4\u30EB{0}\u306B{1}\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
+
+note.prefix=\u6CE8:
+
+main.usage.summary=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u30EA\u30B9\u30C8\u306B\u3064\u3044\u3066\u306F\u3001-help\u3092\u4F7F\u7528\u3057\u307E\u3059
+
+main.usage=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059:
+
+
+main.opt.help=\ -help --help -? \u3053\u306E\u4F7F\u7528\u65B9\u6CD5\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B
+
+main.opt.version=\ -version \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831
+
+main.opt.v=\ -v -verbose \u8FFD\u52A0\u60C5\u5831\u3092\u51FA\u529B\u3059\u308B
+
+main.opt.l=\ -l \u884C\u756A\u53F7\u3068\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u8868\u3092\u51FA\u529B\u3059\u308B
+
+main.opt.public=\ -public public\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u8868\u793A\u3059\u308B
+
+main.opt.protected=\ -protected protected/public\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u8868\u793A\u3059\u308B
+
+main.opt.package=\ -package package/protected/public\u30AF\u30E9\u30B9\u304A\u3088\u3073\n \u30E1\u30F3\u30D0\u30FC\u306E\u307F\u3092\u8868\u793A\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)
+
+main.opt.p=\ -p -private \u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u3068\u30E1\u30F3\u30D0\u30FC\u3092\u8868\u793A\u3059\u308B
+
+main.opt.c=\ -c \u30B3\u30FC\u30C9\u3092\u9006\u30A2\u30BB\u30F3\u30D6\u30EB\u3059\u308B
+
+main.opt.s=\ -s \u5185\u90E8\u30BF\u30A4\u30D7\u7F72\u540D\u3092\u51FA\u529B\u3059\u308B
+
+main.opt.classpath=\ -classpath <path> \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B
+
+main.opt.cp=\ -cp <path> \u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B
+
+main.opt.bootclasspath=\ -bootclasspath <path> \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306E\u4F4D\u7F6E\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
+
+main.opt.constants=\ -constants \u9759\u7684final\u5B9A\u6570\u3092\u8868\u793A\u3059\u308B
+
+
+main.opt.sysinfo=\ -sysinfo \u51E6\u7406\u3057\u3066\u3044\u308B\u30AF\u30E9\u30B9\u306E\u30B7\u30B9\u30C6\u30E0\u60C5\u5831(\u30D1\u30B9\u3001\u30B5\u30A4\u30BA\u3001\u65E5\u4ED8\u3001MD5\u30CF\u30C3\u30B7\u30E5)\n \u3092\u8868\u793A\u3059\u308B
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,65 @@
+
+err.prefix=\u9519\u8BEF:
+
+err.bad.constant.pool=\u8BFB\u53D6{0}\u7684\u5E38\u91CF\u6C60\u65F6\u51FA\u9519: {1}
+err.class.not.found=\u627E\u4E0D\u5230\u7C7B: {0}
+err.crash=\u51FA\u73B0\u4E25\u91CD\u7684\u5185\u90E8\u9519\u8BEF: {0}\n\u8BF7\u5EFA\u7ACB Bug \u62A5\u544A, \u5E76\u5305\u62EC\u4EE5\u4E0B\u4FE1\u606F:\n{1}
+err.end.of.file=\u8BFB\u53D6{0}\u65F6\u51FA\u73B0\u610F\u5916\u7684\u6587\u4EF6\u7ED3\u5C3E
+err.file.not.found=\u627E\u4E0D\u5230\u6587\u4EF6: {0}
+err.h.not.supported=-h \u4E0D\u518D\u53EF\u7528 - \u8BF7\u4F7F\u7528 'javah' \u7A0B\u5E8F
+err.incompatible.options=\u9009\u9879\u7EC4\u5408\u9519\u8BEF: {0}
+err.internal.error=\u5185\u90E8\u9519\u8BEF: {0} {1} {2}
+err.invalid.arg.for.option=\u9009\u9879\u7684\u53C2\u6570\u65E0\u6548: {0}
+err.ioerror=\u8BFB\u53D6{0}\u65F6\u51FA\u73B0 IO \u9519\u8BEF: {1}
+err.missing.arg=\u6CA1\u6709\u4E3A{0}\u6307\u5B9A\u503C
+err.no.classes.specified=\u672A\u6307\u5B9A\u7C7B
+err.not.standard.file.manager=\u4F7F\u7528\u6807\u51C6\u6587\u4EF6\u7BA1\u7406\u5668\u65F6\u53EA\u80FD\u6307\u5B9A\u7C7B\u6587\u4EF6
+err.unknown.option=\u672A\u77E5\u9009\u9879: {0}
+err.verify.not.supported=\u4E0D\u652F\u6301 -verify
+err.no.SourceFile.attribute=\u6CA1\u6709 SourceFile \u5C5E\u6027
+err.source.file.not.found=\u627E\u4E0D\u5230\u6E90\u6587\u4EF6
+err.bad.innerclasses.attribute={0}\u7684 InnerClasses \u5C5E\u6027\u9519\u8BEF
+warn.Xold.not.supported=-Xold \u4E0D\u518D\u53EF\u7528
+
+main.usage.summary=\u7528\u6CD5: {0} <options> <classes>\n\u4F7F\u7528 -help \u5217\u51FA\u53EF\u80FD\u7684\u9009\u9879
+
+warn.prefix=\u8B66\u544A:
+warn.unexpected.class=\u4E8C\u8FDB\u5236\u6587\u4EF6{0}\u5305\u542B{1}
+
+note.prefix=\u6CE8:
+
+main.usage.summary=\u7528\u6CD5: {0} <options> <classes>\n\u4F7F\u7528 -help \u5217\u51FA\u53EF\u80FD\u7684\u9009\u9879
+
+main.usage=\u7528\u6CD5: {0} <options> <classes>\n\u5176\u4E2D, \u53EF\u80FD\u7684\u9009\u9879\u5305\u62EC:
+
+
+main.opt.help=\ -help --help -? \u8F93\u51FA\u6B64\u7528\u6CD5\u6D88\u606F
+
+main.opt.version=\ -version \u7248\u672C\u4FE1\u606F
+
+main.opt.v=\ -v -verbose \u8F93\u51FA\u9644\u52A0\u4FE1\u606F
+
+main.opt.l=\ -l \u8F93\u51FA\u884C\u53F7\u548C\u672C\u5730\u53D8\u91CF\u8868
+
+main.opt.public=\ -public \u4EC5\u663E\u793A\u516C\u5171\u7C7B\u548C\u6210\u5458
+
+main.opt.protected=\ -protected \u663E\u793A\u53D7\u4FDD\u62A4\u7684/\u516C\u5171\u7C7B\u548C\u6210\u5458
+
+main.opt.package=\ -package \u663E\u793A\u7A0B\u5E8F\u5305/\u53D7\u4FDD\u62A4\u7684/\u516C\u5171\u7C7B\n \u548C\u6210\u5458 (\u9ED8\u8BA4)
+
+main.opt.p=\ -p -private \u663E\u793A\u6240\u6709\u7C7B\u548C\u6210\u5458
+
+main.opt.c=\ -c \u5BF9\u4EE3\u7801\u8FDB\u884C\u53CD\u6C47\u7F16
+
+main.opt.s=\ -s \u8F93\u51FA\u5185\u90E8\u7C7B\u578B\u7B7E\u540D
+
+main.opt.classpath=\ -classpath <path> \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
+
+main.opt.cp=\ -cp <path> \u6307\u5B9A\u67E5\u627E\u7528\u6237\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
+
+main.opt.bootclasspath=\ -bootclasspath <path> \u8986\u76D6\u5F15\u5BFC\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
+
+main.opt.constants=\ -constants \u663E\u793A\u9759\u6001\u6700\u7EC8\u5E38\u91CF
+
+
+main.opt.sysinfo=\ -sysinfo \u663E\u793A\u6B63\u5728\u5904\u7406\u7684\u7C7B\u7684\n \u7CFB\u7EDF\u4FE1\u606F (\u8DEF\u5F84, \u5927\u5C0F, \u65E5\u671F, MD5 \u6563\u5217)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/version.properties-template Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2007, 2008, 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.
+#
+
+jdk=$(JDK_VERSION)
+full=$(FULL_VERSION)
+release=$(RELEASE)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,451 @@
+/*
+ * Copyright (c) 2013, 2014, 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.
+ */
+package com.sun.tools.jdeps;
+
+import java.io.PrintStream;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import com.sun.tools.classfile.Dependency.Location;
+
+/**
+ * Dependency Analyzer.
+ */
+public class Analyzer {
+ /**
+ * Type of the dependency analysis. Appropriate level of data
+ * will be stored.
+ */
+ public enum Type {
+ SUMMARY,
+ PACKAGE,
+ CLASS,
+ VERBOSE
+ }
+
+ /**
+ * Filter to be applied when analyzing the dependencies from the given archives.
+ * Only the accepted dependencies are recorded.
+ */
+ interface Filter {
+ boolean accepts(Location origin, Archive originArchive, Location target, Archive targetArchive);
+ }
+
+ protected final Type type;
+ protected final Filter filter;
+ protected final Map<Archive, ArchiveDeps> results = new HashMap<>();
+ protected final Map<Location, Archive> map = new HashMap<>();
+ private static final Archive NOT_FOUND
+ = new Archive(JdepsTask.getMessage("artifact.not.found"));
+
+ /**
+ * Constructs an Analyzer instance.
+ *
+ * @param type Type of the dependency analysis
+ * @param filter
+ */
+ public Analyzer(Type type, Filter filter) {
+ this.type = type;
+ this.filter = filter;
+ }
+
+ /**
+ * Performs the dependency analysis on the given archives.
+ */
+ public boolean run(List<Archive> archives) {
+ // build a map from Location to Archive
+ buildLocationArchiveMap(archives);
+
+ // traverse and analyze all dependencies
+ for (Archive archive : archives) {
+ ArchiveDeps deps = new ArchiveDeps(archive, type);
+ archive.visitDependences(deps);
+ results.put(archive, deps);
+ }
+ return true;
+ }
+
+ protected void buildLocationArchiveMap(List<Archive> archives) {
+ // build a map from Location to Archive
+ for (Archive archive: archives) {
+ for (Location l: archive.getClasses()) {
+ if (!map.containsKey(l)) {
+ map.put(l, archive);
+ } else {
+ // duplicated class warning?
+ }
+ }
+ }
+ }
+
+ public boolean hasDependences(Archive archive) {
+ if (results.containsKey(archive)) {
+ return results.get(archive).dependencies().size() > 0;
+ }
+ return false;
+ }
+
+ public Set<String> dependences(Archive source) {
+ ArchiveDeps result = results.get(source);
+ return result.dependencies().stream()
+ .map(Dep::target)
+ .collect(Collectors.toSet());
+ }
+
+ public interface Visitor {
+ /**
+ * Visits a recorded dependency from origin to target which can be
+ * a fully-qualified classname, a package name, a module or
+ * archive name depending on the Analyzer's type.
+ */
+ public void visitDependence(String origin, Archive originArchive,
+ String target, Archive targetArchive);
+ }
+
+ /**
+ * Visit the dependencies of the given source.
+ * If the requested level is SUMMARY, it will visit the required archives list.
+ */
+ public void visitDependences(Archive source, Visitor v, Type level) {
+ if (level == Type.SUMMARY) {
+ final ArchiveDeps result = results.get(source);
+ final Set<Archive> reqs = result.requires();
+ Stream<Archive> stream = reqs.stream();
+ if (reqs.isEmpty()) {
+ if (hasDependences(source)) {
+ // If reqs.isEmpty() and we have dependences, then it means
+ // that the dependences are from 'source' onto itself.
+ stream = Stream.of(source);
+ }
+ }
+ stream.sorted(Comparator.comparing(Archive::getName))
+ .forEach(archive -> {
+ Profile profile = result.getTargetProfile(archive);
+ v.visitDependence(source.getName(), source,
+ profile != null ? profile.profileName() : archive.getName(), archive);
+ });
+ } else {
+ ArchiveDeps result = results.get(source);
+ if (level != type) {
+ // requesting different level of analysis
+ result = new ArchiveDeps(source, level);
+ source.visitDependences(result);
+ }
+ result.dependencies().stream()
+ .sorted(Comparator.comparing(Dep::origin)
+ .thenComparing(Dep::target))
+ .forEach(d -> v.visitDependence(d.origin(), d.originArchive(), d.target(), d.targetArchive()));
+ }
+ }
+
+ public void visitDependences(Archive source, Visitor v) {
+ visitDependences(source, v, type);
+ }
+
+ /**
+ * ArchiveDeps contains the dependencies for an Archive that can have one or
+ * more classes.
+ */
+ class ArchiveDeps implements Archive.Visitor {
+ protected final Archive archive;
+ protected final Set<Archive> requires;
+ protected final Set<Dep> deps;
+ protected final Type level;
+ private Profile profile;
+ ArchiveDeps(Archive archive, Type level) {
+ this.archive = archive;
+ this.deps = new HashSet<>();
+ this.requires = new HashSet<>();
+ this.level = level;
+ }
+
+ Set<Dep> dependencies() {
+ return deps;
+ }
+
+ Set<Archive> requires() {
+ return requires;
+ }
+
+ Profile getTargetProfile(Archive target) {
+ if (target instanceof Module) {
+ return Profile.getProfile((Module) target);
+ } else {
+ return null;
+ }
+ }
+
+ Archive findArchive(Location t) {
+ Archive target = archive.getClasses().contains(t) ? archive : map.get(t);
+ if (target == null) {
+ map.put(t, target = NOT_FOUND);
+ }
+ return target;
+ }
+
+ // return classname or package name depedning on the level
+ private String getLocationName(Location o) {
+ if (level == Type.CLASS || level == Type.VERBOSE) {
+ return o.getClassName();
+ } else {
+ String pkg = o.getPackageName();
+ return pkg.isEmpty() ? "<unnamed>" : pkg;
+ }
+ }
+
+ @Override
+ public void visit(Location o, Location t) {
+ Archive targetArchive = findArchive(t);
+ if (filter.accepts(o, archive, t, targetArchive)) {
+ addDep(o, t);
+ if (archive != targetArchive && !requires.contains(targetArchive)) {
+ requires.add(targetArchive);
+ }
+ }
+ if (targetArchive instanceof Module) {
+ Profile p = Profile.getProfile(t.getPackageName());
+ if (profile == null || (p != null && p.compareTo(profile) > 0)) {
+ profile = p;
+ }
+ }
+ }
+
+ private Dep curDep;
+ protected Dep addDep(Location o, Location t) {
+ String origin = getLocationName(o);
+ String target = getLocationName(t);
+ Archive targetArchive = findArchive(t);
+ if (curDep != null &&
+ curDep.origin().equals(origin) &&
+ curDep.originArchive() == archive &&
+ curDep.target().equals(target) &&
+ curDep.targetArchive() == targetArchive) {
+ return curDep;
+ }
+
+ Dep e = new Dep(origin, archive, target, targetArchive);
+ if (deps.contains(e)) {
+ for (Dep e1 : deps) {
+ if (e.equals(e1)) {
+ curDep = e1;
+ }
+ }
+ } else {
+ deps.add(e);
+ curDep = e;
+ }
+ return curDep;
+ }
+ }
+
+ /*
+ * Class-level or package-level dependency
+ */
+ class Dep {
+ final String origin;
+ final Archive originArchive;
+ final String target;
+ final Archive targetArchive;
+
+ Dep(String origin, Archive originArchive, String target, Archive targetArchive) {
+ this.origin = origin;
+ this.originArchive = originArchive;
+ this.target = target;
+ this.targetArchive = targetArchive;
+ }
+
+ String origin() {
+ return origin;
+ }
+
+ Archive originArchive() {
+ return originArchive;
+ }
+
+ String target() {
+ return target;
+ }
+
+ Archive targetArchive() {
+ return targetArchive;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean equals(Object o) {
+ if (o instanceof Dep) {
+ Dep d = (Dep) o;
+ return this.origin.equals(d.origin) &&
+ this.originArchive == d.originArchive &&
+ this.target.equals(d.target) &&
+ this.targetArchive == d.targetArchive;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 67*hash + Objects.hashCode(this.origin)
+ + Objects.hashCode(this.originArchive)
+ + Objects.hashCode(this.target)
+ + Objects.hashCode(this.targetArchive);
+ return hash;
+ }
+
+ public String toString() {
+ return String.format("%s (%s) -> %s (%s)%n",
+ origin, originArchive.getName(),
+ target, targetArchive.getName());
+ }
+ }
+
+ static Analyzer getExportedAPIsAnalyzer() {
+ return new ModuleAccessAnalyzer(ModuleAccessAnalyzer.reexportsFilter, true);
+ }
+
+ static Analyzer getModuleAccessAnalyzer() {
+ return new ModuleAccessAnalyzer(ModuleAccessAnalyzer.accessCheckFilter, false);
+ }
+
+ private static class ModuleAccessAnalyzer extends Analyzer {
+ private final boolean apionly;
+ ModuleAccessAnalyzer(Filter filter, boolean apionly) {
+ super(Type.VERBOSE, filter);
+ this.apionly = apionly;
+ }
+ /**
+ * Verify module access
+ */
+ public boolean run(List<Archive> archives) {
+ // build a map from Location to Archive
+ buildLocationArchiveMap(archives);
+
+ // traverse and analyze all dependencies
+ int count = 0;
+ for (Archive archive : archives) {
+ ArchiveDeps checker = new ArchiveDeps(archive, type);
+ archive.visitDependences(checker);
+ count += checker.dependencies().size();
+ // output if any error
+ Module m = (Module)archive;
+ printDependences(System.err, m, checker.dependencies());
+ results.put(archive, checker);
+ }
+ return count == 0;
+ }
+
+ private void printDependences(PrintStream out, Module m, Set<Dep> deps) {
+ if (deps.isEmpty())
+ return;
+
+ String msg = apionly ? "API reference:" : "inaccessible reference:";
+ deps.stream().sorted(Comparator.comparing(Dep::origin)
+ .thenComparing(Dep::target))
+ .forEach(d -> out.format("%s %s (%s) -> %s (%s)%n", msg,
+ d.origin(), d.originArchive().getName(),
+ d.target(), d.targetArchive().getName()));
+ if (apionly) {
+ out.format("Dependences missing re-exports=\"true\" attribute:%n");
+ deps.stream()
+ .map(Dep::targetArchive)
+ .map(Archive::getName)
+ .distinct()
+ .sorted()
+ .forEach(d -> out.format(" %s -> %s%n", m.name(), d));
+ }
+ }
+
+ private static Module findModule(Archive archive) {
+ if (Module.class.isInstance(archive)) {
+ return (Module) archive;
+ } else {
+ return null;
+ }
+ }
+
+ // returns true if target is accessible by origin
+ private static boolean canAccess(Location o, Archive originArchive, Location t, Archive targetArchive) {
+ Module origin = findModule(originArchive);
+ Module target = findModule(targetArchive);
+
+ if (targetArchive == Analyzer.NOT_FOUND) {
+ return false;
+ }
+
+ // unnamed module
+ // ## should check public type?
+ if (target == null)
+ return true;
+
+ // module-private
+ if (origin == target)
+ return true;
+
+ return target.isAccessibleTo(t.getClassName(), origin);
+ }
+
+ static final Filter accessCheckFilter = new Filter() {
+ @Override
+ public boolean accepts(Location o, Archive originArchive, Location t, Archive targetArchive) {
+ return !canAccess(o, originArchive, t, targetArchive);
+ }
+ };
+
+ static final Filter reexportsFilter = new Filter() {
+ @Override
+ public boolean accepts(Location o, Archive originArchive, Location t, Archive targetArchive) {
+ Module origin = findModule(originArchive);
+ Module target = findModule(targetArchive);
+ if (!origin.isExportedPackage(o.getPackageName())) {
+ // filter non-exported classes
+ return false;
+ }
+
+ boolean accessible = canAccess(o, originArchive, t, targetArchive);
+ if (!accessible)
+ return true;
+
+ String mn = target.name();
+ // skip checking re-exports for java.base
+ if (origin == target || "java.base".equals(mn))
+ return false;
+
+ assert origin.requires().containsKey(mn); // otherwise, should not be accessible
+ if (origin.requires().get(mn)) {
+ return false;
+ }
+ return true;
+ }
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Archive.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2012, 2014, 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.
+ */
+package com.sun.tools.jdeps;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Dependency.Location;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.Path;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Represents the source of the class files.
+ */
+public class Archive {
+ public static Archive getInstance(Path p) {
+ try {
+ return new Archive(p, ClassFileReader.newInstance(p));
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ private final Path path;
+ private final String filename;
+ private final ClassFileReader reader;
+ protected Map<Location, Set<Location>> deps = new ConcurrentHashMap<>();
+
+ protected Archive(String name) {
+ this(name, null);
+ }
+ protected Archive(String name, ClassFileReader reader) {
+ this.path = null;
+ this.filename = name;
+ this.reader = reader;
+ }
+ protected Archive(Path p, ClassFileReader reader) {
+ this.path = p;
+ this.filename = path.getFileName().toString();
+ this.reader = reader;
+ }
+
+ public ClassFileReader reader() {
+ return reader;
+ }
+
+ public String getName() {
+ return filename;
+ }
+
+ public void addClass(Location origin) {
+ deps.computeIfAbsent(origin, _k -> new HashSet<>());
+ }
+
+ public void addClass(Location origin, Location target) {
+ deps.computeIfAbsent(origin, _k -> new HashSet<>()).add(target);
+ }
+
+ public Set<Location> getClasses() {
+ return deps.keySet();
+ }
+
+ public void visitDependences(Visitor v) {
+ for (Map.Entry<Location,Set<Location>> e: deps.entrySet()) {
+ for (Location target : e.getValue()) {
+ v.visit(e.getKey(), target);
+ }
+ }
+ }
+
+ public boolean isEmpty() {
+ return getClasses().isEmpty();
+ }
+
+ public String getPathName() {
+ return path != null ? path.toString() : filename;
+ }
+
+ public String toString() {
+ return filename;
+ }
+
+ public Path path() {
+ return path;
+ }
+
+ interface Visitor {
+ void visit(Location origin, Location target);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,398 @@
+/*
+ * Copyright (c) 2012, 2014, 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.
+ */
+package com.sun.tools.jdeps;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Dependencies.ClassFileError;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.*;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * ClassFileReader reads ClassFile(s) of a given path that can be
+ * a .class file, a directory, or a JAR file.
+ */
+public class ClassFileReader {
+ /**
+ * Returns a ClassFileReader instance of a given path.
+ */
+ public static ClassFileReader newInstance(Path path) throws IOException {
+ if (!Files.exists(path)) {
+ throw new FileNotFoundException(path.toString());
+ }
+
+ if (Files.isDirectory(path)) {
+ return new DirectoryReader(path);
+ } else if (path.getFileName().toString().endsWith(".jar")) {
+ return new JarFileReader(path);
+ } else {
+ return new ClassFileReader(path);
+ }
+ }
+
+ /**
+ * Returns a ClassFileReader instance of a given JarFile.
+ */
+ public static ClassFileReader newInstance(Path path, JarFile jf) throws IOException {
+ return new JarFileReader(path, jf);
+ }
+
+ protected final Path path;
+ protected final String baseFileName;
+ protected final List<String> skippedEntries = new ArrayList<>();
+ protected ClassFileReader(Path path) {
+ this.path = path;
+ this.baseFileName = path.getFileName() != null
+ ? path.getFileName().toString()
+ : path.toString();
+ }
+
+ public String getFileName() {
+ return baseFileName;
+ }
+
+ public List<String> skippedEntries() {
+ return skippedEntries;
+ }
+
+ /**
+ * Returns the ClassFile matching the given binary name
+ * or a fully-qualified class name.
+ */
+ public ClassFile getClassFile(String name) throws IOException {
+ if (name.indexOf('.') > 0) {
+ int i = name.lastIndexOf('.');
+ String pathname = name.replace('.', File.separatorChar) + ".class";
+ if (baseFileName.equals(pathname) ||
+ baseFileName.equals(pathname.substring(0, i) + "$" +
+ pathname.substring(i+1, pathname.length()))) {
+ return readClassFile(path);
+ }
+ } else {
+ if (baseFileName.equals(name.replace('/', File.separatorChar) + ".class")) {
+ return readClassFile(path);
+ }
+ }
+ return null;
+ }
+
+ public Iterable<ClassFile> getClassFiles() throws IOException {
+ return new Iterable<ClassFile>() {
+ public Iterator<ClassFile> iterator() {
+ return new FileIterator();
+ }
+ };
+ }
+
+ protected ClassFile readClassFile(Path p) throws IOException {
+ InputStream is = null;
+ try {
+ is = Files.newInputStream(p);
+ return ClassFile.read(is);
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ } finally {
+ if (is != null) {
+ is.close();
+ }
+ }
+ }
+
+ class FileIterator implements Iterator<ClassFile> {
+ int count;
+ FileIterator() {
+ this.count = 0;
+ }
+ public boolean hasNext() {
+ return count == 0 && baseFileName.endsWith(".class");
+ }
+
+ public ClassFile next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ try {
+ ClassFile cf = readClassFile(path);
+ count++;
+ return cf;
+ } catch (IOException e) {
+ throw new ClassFileError(e);
+ }
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ }
+
+ public String toString() {
+ return path.toString();
+ }
+
+ private static class DirectoryReader extends ClassFileReader {
+ protected final String fsSep;
+ DirectoryReader(Path path) throws IOException {
+ this(FileSystems.getDefault(), path);
+ }
+ DirectoryReader(FileSystem fs, Path path) throws IOException {
+ super(path);
+ this.fsSep = fs.getSeparator();
+ }
+
+ public ClassFile getClassFile(String name) throws IOException {
+ if (name.indexOf('.') > 0) {
+ int i = name.lastIndexOf('.');
+ String pathname = name.replace(".", fsSep) + ".class";
+ Path p = path.resolve(pathname);
+ if (!Files.exists(p)) {
+ p = path.resolve(pathname.substring(0, i) + "$" +
+ pathname.substring(i+1, pathname.length()));
+ }
+ if (Files.exists(p)) {
+ return readClassFile(p);
+ }
+ } else {
+ Path p = path.resolve(name + ".class");
+ if (Files.exists(p)) {
+ return readClassFile(p);
+ }
+ }
+ return null;
+ }
+
+ public Iterable<ClassFile> getClassFiles() throws IOException {
+ final Iterator<ClassFile> iter = new DirectoryIterator();
+ return new Iterable<ClassFile>() {
+ public Iterator<ClassFile> iterator() {
+ return iter;
+ }
+ };
+ }
+
+ private List<Path> entries;
+ protected synchronized List<Path> walkTree() throws IOException {
+ if (entries == null) {
+ entries = new ArrayList<>();
+ Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
+ throws IOException {
+ if (file.getFileName().toString().endsWith(".class")) {
+ entries.add(file);
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ }
+ return entries;
+ }
+
+ class DirectoryIterator implements Iterator<ClassFile> {
+ private List<Path> entries;
+ private int index = 0;
+ DirectoryIterator() throws IOException {
+ entries = walkTree();
+ index = 0;
+ }
+
+ public boolean hasNext() {
+ return index != entries.size();
+ }
+
+ public ClassFile next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ Path path = entries.get(index++);
+ try {
+ return readClassFile(path);
+ } catch (IOException e) {
+ throw new ClassFileError(e);
+ }
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ }
+ }
+
+ static class JarFileReader extends ClassFileReader {
+ private final JarFile jarfile;
+ JarFileReader(Path path) throws IOException {
+ this(path, new JarFile(path.toFile(), false));
+ }
+
+ JarFileReader(Path path, JarFile jf) throws IOException {
+ super(path);
+ this.jarfile = jf;
+ }
+
+ public ClassFile getClassFile(String name) throws IOException {
+ if (name.indexOf('.') > 0) {
+ int i = name.lastIndexOf('.');
+ String entryName = name.replace('.', '/') + ".class";
+ JarEntry e = jarfile.getJarEntry(entryName);
+ if (e == null) {
+ e = jarfile.getJarEntry(entryName.substring(0, i) + "$"
+ + entryName.substring(i + 1, entryName.length()));
+ }
+ if (e != null) {
+ return readClassFile(jarfile, e);
+ }
+ } else {
+ JarEntry e = jarfile.getJarEntry(name + ".class");
+ if (e != null) {
+ return readClassFile(jarfile, e);
+ }
+ }
+ return null;
+ }
+
+ protected ClassFile readClassFile(JarFile jarfile, JarEntry e) throws IOException {
+ InputStream is = null;
+ try {
+ is = jarfile.getInputStream(e);
+ return ClassFile.read(is);
+ } catch (ConstantPoolException ex) {
+ throw new ClassFileError(ex);
+ } finally {
+ if (is != null)
+ is.close();
+ }
+ }
+
+ public Iterable<ClassFile> getClassFiles() throws IOException {
+ final Iterator<ClassFile> iter = new JarFileIterator(this, jarfile);
+ return new Iterable<ClassFile>() {
+ public Iterator<ClassFile> iterator() {
+ return iter;
+ }
+ };
+ }
+ }
+
+ class JarFileIterator implements Iterator<ClassFile> {
+ protected final JarFileReader reader;
+ protected Enumeration<JarEntry> entries;
+ protected JarFile jf;
+ protected JarEntry nextEntry;
+ protected ClassFile cf;
+ JarFileIterator(JarFileReader reader) {
+ this(reader, null);
+ }
+ JarFileIterator(JarFileReader reader, JarFile jarfile) {
+ this.reader = reader;
+ setJarFile(jarfile);
+ }
+
+ void setJarFile(JarFile jarfile) {
+ if (jarfile == null) return;
+
+ this.jf = jarfile;
+ this.entries = jf.entries();
+ this.nextEntry = nextEntry();
+ }
+
+ public boolean hasNext() {
+ if (nextEntry != null && cf != null) {
+ return true;
+ }
+ while (nextEntry != null) {
+ try {
+ cf = reader.readClassFile(jf, nextEntry);
+ return true;
+ } catch (ClassFileError | IOException ex) {
+ skippedEntries.add(nextEntry.getName());
+ }
+ nextEntry = nextEntry();
+ }
+ return false;
+ }
+
+ public ClassFile next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ ClassFile classFile = cf;
+ cf = null;
+ nextEntry = nextEntry();
+ return classFile;
+ }
+
+ protected JarEntry nextEntry() {
+ while (entries.hasMoreElements()) {
+ JarEntry e = entries.nextElement();
+ String name = e.getName();
+ if (name.endsWith(".class")) {
+ return e;
+ }
+ }
+ return null;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ }
+
+ /**
+ * ClassFileReader for modules.
+ */
+ static class ModuleClassReader extends DirectoryReader {
+ final String modulename;
+ ModuleClassReader(FileSystem fs, String mn, Path root) throws IOException {
+ super(fs, root);
+ this.modulename = mn;
+ }
+
+ public Set<String> packages() throws IOException {
+ return walkTree().stream()
+ .map(this::toPackageName)
+ .sorted()
+ .collect(Collectors.toSet());
+ }
+
+ String toPackageName(Path p) {
+ if (p.getParent() == null) {
+ return "";
+ }
+ return path.relativize(p.getParent()).toString().replace(fsSep, ".");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,1099 @@
+/*
+ * Copyright (c) 2012, 2014, 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.
+ */
+package com.sun.tools.jdeps;
+
+import com.sun.tools.classfile.AccessFlags;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Dependencies;
+import com.sun.tools.classfile.Dependencies.ClassFileError;
+import com.sun.tools.classfile.Dependency;
+import com.sun.tools.classfile.Dependency.Location;
+import static com.sun.tools.jdeps.Analyzer.Type.*;
+import java.io.*;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.text.MessageFormat;
+import java.util.*;
+import java.util.regex.Pattern;
+
+/**
+ * Implementation for the jdeps tool for static class dependency analysis.
+ */
+class JdepsTask {
+ static class BadArgs extends Exception {
+ static final long serialVersionUID = 8765093759964640721L;
+ BadArgs(String key, Object... args) {
+ super(JdepsTask.getMessage(key, args));
+ this.key = key;
+ this.args = args;
+ }
+
+ BadArgs showUsage(boolean b) {
+ showUsage = b;
+ return this;
+ }
+ final String key;
+ final Object[] args;
+ boolean showUsage;
+ }
+
+ static abstract class Option {
+ Option(boolean hasArg, String... aliases) {
+ this.hasArg = hasArg;
+ this.aliases = aliases;
+ }
+
+ boolean isHidden() {
+ return false;
+ }
+
+ boolean matches(String opt) {
+ for (String a : aliases) {
+ if (a.equals(opt))
+ return true;
+ if (hasArg && opt.startsWith(a + "="))
+ return true;
+ }
+ return false;
+ }
+
+ boolean ignoreRest() {
+ return false;
+ }
+
+ abstract void process(JdepsTask task, String opt, String arg) throws BadArgs;
+ final boolean hasArg;
+ final String[] aliases;
+ }
+
+ static abstract class HiddenOption extends Option {
+ HiddenOption(boolean hasArg, String... aliases) {
+ super(hasArg, aliases);
+ }
+
+ boolean isHidden() {
+ return true;
+ }
+ }
+
+ static Option[] recognizedOptions = {
+ new Option(false, "-h", "-?", "-help") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.help = true;
+ }
+ },
+ new Option(true, "-dotoutput") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ Path p = Paths.get(arg);
+ if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) {
+ throw new BadArgs("err.invalid.path", arg);
+ }
+ task.options.dotOutputDir = arg;
+ }
+ },
+ new Option(false, "-s", "-summary") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.showSummary = true;
+ task.options.verbose = SUMMARY;
+ }
+ },
+ new Option(false, "-v", "-verbose",
+ "-verbose:package",
+ "-verbose:class") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ switch (opt) {
+ case "-v":
+ case "-verbose":
+ task.options.verbose = VERBOSE;
+ task.options.filterSameArchive = false;
+ task.options.filterSamePackage = false;
+ break;
+ case "-verbose:package":
+ task.options.verbose = PACKAGE;
+ break;
+ case "-verbose:class":
+ task.options.verbose = CLASS;
+ break;
+ default:
+ throw new BadArgs("err.invalid.arg.for.option", opt);
+ }
+ }
+ },
+ new Option(true, "-cp", "-classpath") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.classpath = arg;
+ }
+ },
+ new Option(true, "-p", "-package") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.packageNames.add(arg);
+ }
+ },
+ new Option(true, "-e", "-regex") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.regex = arg;
+ }
+ },
+
+ new Option(true, "-f", "-filter") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.filterRegex = arg;
+ }
+ },
+ new Option(false, "-filter:package",
+ "-filter:archive",
+ "-filter:none") {
+ void process(JdepsTask task, String opt, String arg) {
+ switch (opt) {
+ case "-filter:package":
+ task.options.filterSamePackage = true;
+ task.options.filterSameArchive = false;
+ break;
+ case "-filter:archive":
+ task.options.filterSameArchive = true;
+ task.options.filterSamePackage = false;
+ break;
+ case "-filter:none":
+ task.options.filterSameArchive = false;
+ task.options.filterSamePackage = false;
+ break;
+ }
+ }
+ },
+ new Option(true, "-include") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ task.options.includePattern = Pattern.compile(arg);
+ }
+ },
+ new Option(false, "-P", "-profile") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ task.options.showProfile = true;
+ task.options.showModule = false;
+ }
+ },
+ new Option(false, "-M", "-module") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ task.options.showModule = true;
+ task.options.showProfile = false;
+ }
+ },
+ new Option(false, "-apionly") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.apiOnly = true;
+ }
+ },
+ new Option(false, "-R", "-recursive") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.depth = 0;
+ // turn off filtering
+ task.options.filterSameArchive = false;
+ task.options.filterSamePackage = false;
+ }
+ },
+ new Option(false, "-jdkinternals") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.findJDKInternals = true;
+ task.options.verbose = CLASS;
+ if (task.options.includePattern == null) {
+ task.options.includePattern = Pattern.compile(".*");
+ }
+ }
+ },
+ new HiddenOption(false, "-verify:access") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.verifyAccess = true;
+ task.options.verbose = VERBOSE;
+ task.options.filterSameArchive = false;
+ task.options.filterSamePackage = false;
+ }
+ },
+ new HiddenOption(true, "-mp") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ task.options.mpath = Paths.get(arg);
+ if (!Files.isDirectory(task.options.mpath)) {
+ throw new BadArgs("err.invalid.path", arg);
+ }
+ if (task.options.includePattern == null) {
+ task.options.includePattern = Pattern.compile(".*");
+ }
+ }
+ },
+ new Option(false, "-version") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.version = true;
+ }
+ },
+ new HiddenOption(false, "-fullversion") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.fullVersion = true;
+ }
+ },
+ new HiddenOption(false, "-showlabel") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.showLabel = true;
+ }
+ },
+ new HiddenOption(false, "-q", "-quiet") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.nowarning = true;
+ }
+ },
+ new HiddenOption(true, "-depth") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ try {
+ task.options.depth = Integer.parseInt(arg);
+ } catch (NumberFormatException e) {
+ throw new BadArgs("err.invalid.arg.for.option", opt);
+ }
+ }
+ },
+ };
+
+ private static final String PROGNAME = "jdeps";
+ private final Options options = new Options();
+ private final List<String> classes = new ArrayList<>();
+
+ private PrintWriter log;
+ void setLog(PrintWriter out) {
+ log = out;
+ }
+
+ /**
+ * Result codes.
+ */
+ static final int EXIT_OK = 0, // Completed with no errors.
+ EXIT_ERROR = 1, // Completed but reported errors.
+ EXIT_CMDERR = 2, // Bad command-line arguments
+ EXIT_SYSERR = 3, // System error or resource exhaustion.
+ EXIT_ABNORMAL = 4;// terminated abnormally
+
+ int run(String[] args) {
+ if (log == null) {
+ log = new PrintWriter(System.out);
+ }
+ try {
+ handleOptions(args);
+ if (options.help) {
+ showHelp();
+ }
+ if (options.version || options.fullVersion) {
+ showVersion(options.fullVersion);
+ }
+ if (classes.isEmpty() && options.includePattern == null) {
+ if (options.help || options.version || options.fullVersion) {
+ return EXIT_OK;
+ } else {
+ showHelp();
+ return EXIT_CMDERR;
+ }
+ }
+ if (options.regex != null && options.packageNames.size() > 0) {
+ showHelp();
+ return EXIT_CMDERR;
+ }
+ if ((options.findJDKInternals || options.verifyAccess) &&
+ (options.regex != null || options.packageNames.size() > 0 || options.showSummary)) {
+ showHelp();
+ return EXIT_CMDERR;
+ }
+ if (options.showSummary && options.verbose != SUMMARY) {
+ showHelp();
+ return EXIT_CMDERR;
+ }
+
+ boolean ok = run();
+ return ok ? EXIT_OK : EXIT_ERROR;
+ } catch (BadArgs e) {
+ reportError(e.key, e.args);
+ if (e.showUsage) {
+ log.println(getMessage("main.usage.summary", PROGNAME));
+ }
+ return EXIT_CMDERR;
+ } catch (IOException e) {
+ return EXIT_ABNORMAL;
+ } finally {
+ log.flush();
+ }
+ }
+
+ private final List<Archive> sourceLocations = new ArrayList<>();
+ private final List<Archive> classpaths = new ArrayList<>();
+ private final List<Archive> initialArchives = new ArrayList<>();
+ private boolean run() throws IOException {
+ buildArchives();
+
+ if (options.verifyAccess) {
+ return verifyModuleAccess();
+ } else {
+ return analyzeDeps();
+ }
+ }
+
+ private boolean analyzeDeps() throws IOException {
+ Analyzer analyzer = new Analyzer(options.verbose, new Analyzer.Filter() {
+ @Override
+ public boolean accepts(Location origin, Archive originArchive,
+ Location target, Archive targetArchive)
+ {
+ if (options.findJDKInternals) {
+ // accepts target that is JDK class but not exported
+ return isJDKModule(targetArchive) &&
+ !((Module) targetArchive).isExported(target.getClassName());
+ } else if (options.filterSameArchive) {
+ // accepts origin and target that from different archive
+ return originArchive != targetArchive;
+ }
+ return true;
+ }
+ });
+
+ // parse classfiles and find all dependencies
+ findDependencies(options.apiOnly);
+
+ // analyze the dependencies
+ analyzer.run(sourceLocations);
+
+ // output result
+ if (options.dotOutputDir != null) {
+ Path dir = Paths.get(options.dotOutputDir);
+ Files.createDirectories(dir);
+ generateDotFiles(dir, analyzer);
+ } else {
+ printRawOutput(log, analyzer);
+ }
+
+ if (options.findJDKInternals && !options.nowarning) {
+ showReplacements(analyzer);
+ }
+ return true;
+ }
+
+ private boolean verifyModuleAccess() throws IOException {
+ // two passes
+ // 1. check API dependences where the types of dependences must be re-exported
+ // 2. check all dependences where types must be accessible
+
+ // pass 1
+ findDependencies(true /* api only */);
+ Analyzer analyzer = Analyzer.getExportedAPIsAnalyzer();
+ boolean pass1 = analyzer.run(sourceLocations);
+ if (!pass1) {
+ System.out.println("ERROR: Failed API access verification");
+ }
+ // pass 2
+ findDependencies(false);
+ analyzer = Analyzer.getModuleAccessAnalyzer();
+ boolean pass2 = analyzer.run(sourceLocations);
+ if (!pass2) {
+ System.out.println("ERROR: Failed module access verification");
+ }
+ if (pass1 & pass2) {
+ System.out.println("Access verification succeeded.");
+ }
+ return pass1 & pass2;
+ }
+
+ private void generateSummaryDotFile(Path dir, Analyzer analyzer) throws IOException {
+ // If verbose mode (-v or -verbose option),
+ // the summary.dot file shows package-level dependencies.
+ Analyzer.Type summaryType =
+ (options.verbose == PACKAGE || options.verbose == SUMMARY) ? SUMMARY : PACKAGE;
+ Path summary = dir.resolve("summary.dot");
+ try (PrintWriter sw = new PrintWriter(Files.newOutputStream(summary));
+ SummaryDotFile dotfile = new SummaryDotFile(sw, summaryType)) {
+ for (Archive archive : sourceLocations) {
+ if (!archive.isEmpty()) {
+ if (options.verbose == PACKAGE || options.verbose == SUMMARY) {
+ if (options.showLabel) {
+ // build labels listing package-level dependencies
+ analyzer.visitDependences(archive, dotfile.labelBuilder(), PACKAGE);
+ }
+ }
+ analyzer.visitDependences(archive, dotfile, summaryType);
+ }
+ }
+ }
+ }
+
+ private void generateDotFiles(Path dir, Analyzer analyzer) throws IOException {
+ // output individual .dot file for each archive
+ if (options.verbose != SUMMARY) {
+ for (Archive archive : sourceLocations) {
+ if (analyzer.hasDependences(archive)) {
+ Path dotfile = dir.resolve(archive.getName() + ".dot");
+ try (PrintWriter pw = new PrintWriter(Files.newOutputStream(dotfile));
+ DotFileFormatter formatter = new DotFileFormatter(pw, archive)) {
+ analyzer.visitDependences(archive, formatter);
+ }
+ }
+ }
+ }
+ // generate summary dot file
+ generateSummaryDotFile(dir, analyzer);
+ }
+
+ private void printRawOutput(PrintWriter writer, Analyzer analyzer) {
+ RawOutputFormatter depFormatter = new RawOutputFormatter(writer);
+ RawSummaryFormatter summaryFormatter = new RawSummaryFormatter(writer);
+ for (Archive archive : sourceLocations) {
+ if (!archive.isEmpty()) {
+ analyzer.visitDependences(archive, summaryFormatter, SUMMARY);
+ if (analyzer.hasDependences(archive) && options.verbose != SUMMARY) {
+ analyzer.visitDependences(archive, depFormatter);
+ }
+ }
+ }
+ }
+
+ private boolean isValidClassName(String name) {
+ if (!Character.isJavaIdentifierStart(name.charAt(0))) {
+ return false;
+ }
+ for (int i=1; i < name.length(); i++) {
+ char c = name.charAt(i);
+ if (c != '.' && !Character.isJavaIdentifierPart(c)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * Dep Filter configured based on the input jdeps option
+ * 1. -p and -regex to match target dependencies
+ * 2. -filter:package to filter out same-package dependencies
+ *
+ * This filter is applied when jdeps parses the class files
+ * and filtered dependencies are not stored in the Analyzer.
+ *
+ * -filter:archive is applied later in the Analyzer as the
+ * containing archive of a target class may not be known until
+ * the entire archive
+ */
+ class DependencyFilter implements Dependency.Filter {
+ final Dependency.Filter filter;
+ final Pattern filterPattern;
+ DependencyFilter() {
+ if (options.regex != null) {
+ this.filter = Dependencies.getRegexFilter(Pattern.compile(options.regex));
+ } else if (options.packageNames.size() > 0) {
+ this.filter = Dependencies.getPackageFilter(options.packageNames, false);
+ } else {
+ this.filter = null;
+ }
+
+ this.filterPattern =
+ options.filterRegex != null ? Pattern.compile(options.filterRegex) : null;
+ }
+ @Override
+ public boolean accepts(Dependency d) {
+ if (d.getOrigin().equals(d.getTarget())) {
+ return false;
+ }
+ String pn = d.getTarget().getPackageName();
+ if (options.filterSamePackage && d.getOrigin().getPackageName().equals(pn)) {
+ return false;
+ }
+
+ if (filterPattern != null && filterPattern.matcher(pn).matches()) {
+ return false;
+ }
+ return filter != null ? filter.accepts(d) : true;
+ }
+ }
+
+ /**
+ * Tests if the given class matches the pattern given in the -include option
+ */
+ private boolean matches(String classname) {
+ if (options.includePattern != null) {
+ return options.includePattern.matcher(classname.replace('/', '.')).matches();
+ } else {
+ return true;
+ }
+ }
+
+ private void buildArchives() throws IOException {
+ for (String s : classes) {
+ Path p = Paths.get(s);
+ if (Files.exists(p)) {
+ initialArchives.add(Archive.getInstance(p));
+ }
+ }
+ sourceLocations.addAll(initialArchives);
+
+ classpaths.addAll(getClassPathArchives(options.classpath));
+ if (options.includePattern != null) {
+ initialArchives.addAll(classpaths);
+ }
+ classpaths.addAll(PlatformClassPath.getModules(options.mpath));
+ if (options.mpath != null) {
+ initialArchives.addAll(PlatformClassPath.getModules(options.mpath));
+ } else {
+ classpaths.addAll(PlatformClassPath.getJarFiles());
+ }
+ // add all classpath archives to the source locations for reporting
+ sourceLocations.addAll(classpaths);
+ }
+
+ private void findDependencies(boolean apiOnly) throws IOException {
+ Dependency.Finder finder =
+ apiOnly ? Dependencies.getAPIFinder(AccessFlags.ACC_PROTECTED)
+ : Dependencies.getClassDependencyFinder();
+ Dependency.Filter filter = new DependencyFilter();
+
+ Deque<String> roots = new LinkedList<>();
+ for (String s : classes) {
+ Path p = Paths.get(s);
+ if (!Files.exists(p)) {
+ if (isValidClassName(s)) {
+ roots.add(s);
+ } else {
+ warning("warn.invalid.arg", s);
+ }
+ }
+ }
+
+ // 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.
+ Deque<String> deque = new LinkedList<>();
+ Set<String> doneClasses = new HashSet<>();
+
+ // get the immediate dependencies of the input files
+ for (Archive a : initialArchives) {
+ for (ClassFile cf : a.reader().getClassFiles()) {
+ String classFileName;
+ try {
+ classFileName = cf.getName();
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ }
+
+ // tests if this class matches the -include or -apiOnly option if specified
+ if (!matches(classFileName) || (apiOnly && !cf.access_flags.is(AccessFlags.ACC_PUBLIC))) {
+ continue;
+ }
+
+ if (!doneClasses.contains(classFileName)) {
+ doneClasses.add(classFileName);
+ }
+
+ for (Dependency d : finder.findDependencies(cf)) {
+ if (filter.accepts(d)) {
+ String cn = d.getTarget().getName();
+ if (!doneClasses.contains(cn) && !deque.contains(cn)) {
+ deque.add(cn);
+ }
+ a.addClass(d.getOrigin(), d.getTarget());
+ } else {
+ // ensure that the parsed class is added the archive
+ a.addClass(d.getOrigin());
+ }
+ }
+ for (String name : a.reader().skippedEntries()) {
+ warning("warn.skipped.entry", name, a.getPathName());
+ }
+ }
+ }
+
+ // add Archive for looking up classes from the classpath
+ // for transitive dependency analysis
+ Deque<String> unresolved = roots;
+ int depth = options.depth > 0 ? options.depth : Integer.MAX_VALUE;
+ do {
+ String name;
+ while ((name = unresolved.poll()) != null) {
+ if (doneClasses.contains(name)) {
+ continue;
+ }
+ ClassFile cf = null;
+ for (Archive a : classpaths) {
+ cf = a.reader().getClassFile(name);
+ if (cf != null) {
+ String classFileName;
+ try {
+ classFileName = cf.getName();
+ } catch (ConstantPoolException e) {
+ throw new ClassFileError(e);
+ }
+ if (!doneClasses.contains(classFileName)) {
+ // if name is a fully-qualified class name specified
+ // from command-line, this class might already be parsed
+ doneClasses.add(classFileName);
+
+ for (Dependency d : finder.findDependencies(cf)) {
+ if (depth == 0) {
+ // ignore the dependency
+ a.addClass(d.getOrigin());
+ break;
+ } else if (filter.accepts(d)) {
+ a.addClass(d.getOrigin(), d.getTarget());
+ String cn = d.getTarget().getName();
+ if (!doneClasses.contains(cn) && !deque.contains(cn)) {
+ deque.add(cn);
+ }
+ } else {
+ // ensure that the parsed class is added the archive
+ a.addClass(d.getOrigin());
+ }
+ }
+ }
+ break;
+ }
+ }
+ if (cf == null) {
+ doneClasses.add(name);
+ }
+ }
+ unresolved = deque;
+ deque = new LinkedList<>();
+ } while (!unresolved.isEmpty() && depth-- > 0);
+ }
+
+ public void handleOptions(String[] args) throws BadArgs {
+ // process options
+ for (int i=0; i < args.length; i++) {
+ if (args[i].charAt(0) == '-') {
+ String name = args[i];
+ Option option = getOption(name);
+ String param = null;
+ if (option.hasArg) {
+ if (name.startsWith("-") && name.indexOf('=') > 0) {
+ param = name.substring(name.indexOf('=') + 1, name.length());
+ } else if (i + 1 < args.length) {
+ param = args[++i];
+ }
+ if (param == null || param.isEmpty() || param.charAt(0) == '-') {
+ throw new BadArgs("err.missing.arg", name).showUsage(true);
+ }
+ }
+ option.process(this, name, param);
+ if (option.ignoreRest()) {
+ i = args.length;
+ }
+ } else {
+ // process rest of the input arguments
+ for (; i < args.length; i++) {
+ String name = args[i];
+ if (name.charAt(0) == '-') {
+ throw new BadArgs("err.option.after.class", name).showUsage(true);
+ }
+ classes.add(name);
+ }
+ }
+ }
+ }
+
+ private Option getOption(String name) throws BadArgs {
+ for (Option o : recognizedOptions) {
+ if (o.matches(name)) {
+ return o;
+ }
+ }
+ throw new BadArgs("err.unknown.option", name).showUsage(true);
+ }
+
+ private void reportError(String key, Object... args) {
+ log.println(getMessage("error.prefix") + " " + getMessage(key, args));
+ }
+
+ private void warning(String key, Object... args) {
+ log.println(getMessage("warn.prefix") + " " + getMessage(key, args));
+ }
+
+ private void showHelp() {
+ log.println(getMessage("main.usage", PROGNAME));
+ for (Option o : recognizedOptions) {
+ String name = o.aliases[0].substring(1); // there must always be at least one name
+ name = name.charAt(0) == '-' ? name.substring(1) : name;
+ if (o.isHidden() || name.equals("h") || name.startsWith("filter:")) {
+ continue;
+ }
+ log.println(getMessage("main.opt." + name));
+ }
+ }
+
+ private void showVersion(boolean full) {
+ log.println(version(full ? "full" : "release"));
+ }
+
+ private String version(String key) {
+ // key=version: mm.nn.oo[-milestone]
+ // key=full: mm.mm.oo[-milestone]-build
+ if (ResourceBundleHelper.versionRB == null) {
+ return System.getProperty("java.version");
+ }
+ try {
+ return ResourceBundleHelper.versionRB.getString(key);
+ } catch (MissingResourceException e) {
+ return getMessage("version.unknown", System.getProperty("java.version"));
+ }
+ }
+
+ static String getMessage(String key, Object... args) {
+ try {
+ return MessageFormat.format(ResourceBundleHelper.bundle.getString(key), args);
+ } catch (MissingResourceException e) {
+ throw new InternalError("Missing message: " + key);
+ }
+ }
+
+ private static class Options {
+ boolean help;
+ boolean version;
+ boolean fullVersion;
+ boolean showProfile;
+ boolean showModule;
+ boolean showSummary;
+ boolean apiOnly;
+ boolean showLabel;
+ boolean findJDKInternals;
+ boolean nowarning;
+ // default is to show package-level dependencies
+ // and filter references from same package
+ Analyzer.Type verbose = PACKAGE;
+ boolean filterSamePackage = true;
+ boolean filterSameArchive = false;
+ String filterRegex;
+ String dotOutputDir;
+ String classpath = "";
+ int depth = 1;
+ Set<String> packageNames = new HashSet<>();
+ String regex; // apply to the dependences
+ Pattern includePattern; // apply to classes
+ // module boundary access check
+ boolean verifyAccess;
+ Path mpath;
+ }
+ private static class ResourceBundleHelper {
+ static final ResourceBundle versionRB;
+ static final ResourceBundle bundle;
+ static final ResourceBundle jdkinternals;
+
+ static {
+ Locale locale = Locale.getDefault();
+ try {
+ bundle = ResourceBundle.getBundle("com.sun.tools.jdeps.resources.jdeps", locale);
+ } catch (MissingResourceException e) {
+ throw new InternalError("Cannot find jdeps resource bundle for locale " + locale);
+ }
+ try {
+ versionRB = ResourceBundle.getBundle("com.sun.tools.jdeps.resources.version");
+ } catch (MissingResourceException e) {
+ throw new InternalError("version.resource.missing");
+ }
+ try {
+ jdkinternals = ResourceBundle.getBundle("com.sun.tools.jdeps.resources.jdkinternals");
+ } catch (MissingResourceException e) {
+ throw new InternalError("Cannot find jdkinternals resource bundle");
+ }
+ }
+ }
+
+ /*
+ * Returns the list of Archive specified in cpaths and not included
+ * initialArchives
+ */
+ private List<Archive> getClassPathArchives(String cpaths)
+ throws IOException
+ {
+ List<Archive> result = new ArrayList<>();
+ if (cpaths.isEmpty()) {
+ return result;
+ }
+ List<Path> paths = new ArrayList<>();
+ for (String p : cpaths.split(File.pathSeparator)) {
+ if (p.length() > 0) {
+ // wildcard to parse all JAR files e.g. -classpath dir/*
+ int i = p.lastIndexOf(".*");
+ if (i > 0) {
+ Path dir = Paths.get(p.substring(0, i));
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "*.jar")) {
+ for (Path entry : stream) {
+ paths.add(entry);
+ }
+ }
+ } else {
+ paths.add(Paths.get(p));
+ }
+ }
+ }
+ for (Path path : paths) {
+ boolean found = initialArchives.stream()
+ .map(Archive::path)
+ .anyMatch(p -> isSameFile(path, p));
+ if (!found && Files.exists(path)) {
+ result.add(Archive.getInstance(path));
+ }
+ }
+ return result;
+ }
+
+ private boolean isSameFile(Path p1, Path p2) {
+ try {
+ return Files.isSameFile(p1, p2);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ class RawOutputFormatter implements Analyzer.Visitor {
+ private final PrintWriter writer;
+ private String pkg = "";
+ RawOutputFormatter(PrintWriter writer) {
+ this.writer = writer;
+ }
+ @Override
+ public void visitDependence(String origin, Archive originArchive,
+ String target, Archive targetArchive) {
+ String tag = toTag(target, targetArchive);
+ if (options.verbose == VERBOSE) {
+ writer.format(" %-50s -> %-50s %s%n", origin, target, tag);
+ } else {
+ if (!origin.equals(pkg)) {
+ pkg = origin;
+ writer.format(" %s (%s)%n", origin, originArchive.getName());
+ }
+ writer.format(" -> %-50s %s%n", target, tag);
+ }
+ }
+ }
+
+ class RawSummaryFormatter implements Analyzer.Visitor {
+ private final PrintWriter writer;
+ RawSummaryFormatter(PrintWriter writer) {
+ this.writer = writer;
+ }
+ @Override
+ public void visitDependence(String origin, Archive originArchive,
+ String target, Archive targetArchive) {
+ String targetName = targetArchive.getPathName();
+ if (options.showModule && isJDKModule(targetArchive)) {
+ targetName = ((Module)targetArchive).name();
+ }
+ writer.format("%s -> %s", originArchive.getName(), targetName);
+ if (options.showProfile && isJDKModule(targetArchive)) {
+ writer.format(" (%s)", target);
+ }
+ writer.format("%n");
+ }
+ }
+
+ class DotFileFormatter implements Analyzer.Visitor, AutoCloseable {
+ private final PrintWriter writer;
+ private final String name;
+ DotFileFormatter(PrintWriter writer, Archive archive) {
+ this.writer = writer;
+ this.name = archive.getName();
+ writer.format("digraph \"%s\" {%n", name);
+ writer.format(" // Path: %s%n", archive.getPathName());
+ }
+
+ @Override
+ public void close() {
+ writer.println("}");
+ }
+
+ @Override
+ public void visitDependence(String origin, Archive originArchive,
+ String target, Archive targetArchive) {
+ String tag = toTag(target, targetArchive);
+ writer.format(" %-50s -> \"%s\";%n",
+ String.format("\"%s\"", origin),
+ tag.isEmpty() ? target
+ : String.format("%s (%s)", target, tag));
+ }
+ }
+
+ class SummaryDotFile implements Analyzer.Visitor, AutoCloseable {
+ private final PrintWriter writer;
+ private final Analyzer.Type type;
+ private final Map<Archive, Map<Archive,StringBuilder>> edges = new HashMap<>();
+ SummaryDotFile(PrintWriter writer, Analyzer.Type type) {
+ this.writer = writer;
+ this.type = type;
+ writer.format("digraph \"summary\" {%n");
+ }
+
+ @Override
+ public void close() {
+ writer.println("}");
+ }
+
+ @Override
+ public void visitDependence(String origin, Archive originArchive,
+ String target, Archive targetArchive) {
+ String targetName = type == PACKAGE ? target : targetArchive.getName();
+ if (isJDKModule(targetArchive)) {
+ Module m = (Module)targetArchive;
+ String n = showProfileOrModule(m);
+ if (!n.isEmpty()) {
+ targetName += " (" + n + ")";
+ }
+ } else if (type == PACKAGE) {
+ targetName += " (" + targetArchive.getName() + ")";
+ }
+ String label = getLabel(originArchive, targetArchive);
+ writer.format(" %-50s -> \"%s\"%s;%n",
+ String.format("\"%s\"", origin), targetName, label);
+ }
+
+ String getLabel(Archive origin, Archive target) {
+ if (edges.isEmpty())
+ return "";
+
+ StringBuilder label = edges.get(origin).get(target);
+ return label == null ? "" : String.format(" [label=\"%s\",fontsize=9]", label.toString());
+ }
+
+ Analyzer.Visitor labelBuilder() {
+ // show the package-level dependencies as labels in the dot graph
+ return new Analyzer.Visitor() {
+ @Override
+ public void visitDependence(String origin, Archive originArchive, String target, Archive targetArchive) {
+ edges.putIfAbsent(originArchive, new HashMap<>());
+ edges.get(originArchive).putIfAbsent(targetArchive, new StringBuilder());
+ StringBuilder sb = edges.get(originArchive).get(targetArchive);
+ String tag = toTag(target, targetArchive);
+ addLabel(sb, origin, target, tag);
+ }
+
+ void addLabel(StringBuilder label, String origin, String target, String tag) {
+ label.append(origin).append(" -> ").append(target);
+ if (!tag.isEmpty()) {
+ label.append(" (" + tag + ")");
+ }
+ label.append("\\n");
+ }
+ };
+ }
+ }
+
+ /**
+ * Test if the given archive is part of the JDK
+ */
+ private boolean isJDKModule(Archive archive) {
+ return Module.class.isInstance(archive);
+ }
+
+ /**
+ * If the given archive is JDK archive, this method returns the profile name
+ * only if -profile option is specified; it accesses a private JDK API and
+ * the returned value will have "JDK internal API" prefix
+ *
+ * For non-JDK archives, this method returns the file name of the archive.
+ */
+ private String toTag(String name, Archive source) {
+ if (!isJDKModule(source)) {
+ return source.getName();
+ }
+
+ Module module = (Module)source;
+ boolean isExported = false;
+ if (options.verbose == CLASS || options.verbose == VERBOSE) {
+ isExported = module.isExported(name);
+ } else {
+ isExported = module.isExportedPackage(name);
+ }
+ if (isExported) {
+ // exported API
+ return showProfileOrModule(module);
+ } else {
+ return "JDK internal API (" + source.getName() + ")";
+ }
+ }
+
+ private String showProfileOrModule(Module m) {
+ String tag = "";
+ if (options.showProfile) {
+ Profile p = Profile.getProfile(m);
+ if (p != null) {
+ tag = p.profileName();
+ }
+ } else if (options.showModule) {
+ tag = m.name();
+ }
+ return tag;
+ }
+
+ private Profile getProfile(String name) {
+ String pn = name;
+ if (options.verbose == CLASS || options.verbose == VERBOSE) {
+ int i = name.lastIndexOf('.');
+ pn = i > 0 ? name.substring(0, i) : "";
+ }
+ return Profile.getProfile(pn);
+ }
+
+ /**
+ * Returns the recommended replacement API for the given classname;
+ * or return null if replacement API is not known.
+ */
+ private String replacementFor(String cn) {
+ String name = cn;
+ String value = null;
+ while (value == null && name != null) {
+ try {
+ value = ResourceBundleHelper.jdkinternals.getString(name);
+ } catch (MissingResourceException e) {
+ // go up one subpackage level
+ int i = name.lastIndexOf('.');
+ name = i > 0 ? name.substring(0, i) : null;
+ }
+ }
+ return value;
+ };
+
+ private void showReplacements(Analyzer analyzer) {
+ Map<String,String> jdkinternals = new TreeMap<>();
+ boolean useInternals = false;
+ for (Archive source : sourceLocations) {
+ useInternals = useInternals || analyzer.hasDependences(source);
+ for (String cn : analyzer.dependences(source)) {
+ String repl = replacementFor(cn);
+ if (repl != null) {
+ jdkinternals.putIfAbsent(cn, repl);
+ }
+ }
+ }
+ if (useInternals) {
+ log.println();
+ warning("warn.replace.useJDKInternals", getMessage("jdeps.wiki.url"));
+ }
+ if (!jdkinternals.isEmpty()) {
+ log.println();
+ log.format("%-40s %s%n", "JDK Internal API", "Suggested Replacement");
+ log.format("%-40s %s%n", "----------------", "---------------------");
+ for (Map.Entry<String,String> e : jdkinternals.entrySet()) {
+ log.format("%-40s %s%n", e.getKey(), e.getValue());
+ }
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Main.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012, 2014, 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.
+ */
+
+package com.sun.tools.jdeps;
+
+import java.io.*;
+
+/**
+ *
+ * Usage:
+ * jdeps [options] files ...
+ * where options include:
+ * -p package-name restrict analysis to classes in this package
+ * (may be given multiple times)
+ * -e regex restrict analysis to packages matching pattern
+ * (-p and -e are exclusive)
+ * -v show class-level dependencies
+ * default: package-level dependencies
+ * -r --recursive transitive dependencies analysis
+ * -classpath paths Classpath to locate class files
+ * -all process all class files in the given classpath
+ */
+public class Main {
+ public static void main(String... args) throws Exception {
+ JdepsTask t = new JdepsTask();
+ int rc = t.run(args);
+ System.exit(rc);
+ }
+
+
+ /**
+ * Entry point that does <i>not</i> call System.exit.
+ *
+ * @param args command line arguments
+ * @param out output stream
+ * @return an exit code. 0 means success, non-zero means an error occurred.
+ */
+ public static int run(String[] args, PrintWriter out) {
+ JdepsTask t = new JdepsTask();
+ t.setLog(out);
+ return t.run(args);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package com.sun.tools.jdeps;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * JDeps internal representation of module for dependency analysis.
+ */
+final class Module extends Archive {
+ private final String moduleName;
+ private final Map<String, Boolean> requires;
+ private final Map<String, Set<String>> exports;
+ private final Set<String> packages;
+
+ private Module(ClassFileReader reader, String name,
+ Map<String, Boolean> requires,
+ Map<String, Set<String>> exports,
+ Set<String> packages) {
+ super(name, reader);
+ this.moduleName = name;
+ this.requires = Collections.unmodifiableMap(requires);
+ this.exports = Collections.unmodifiableMap(exports);
+ this.packages = Collections.unmodifiableSet(packages);
+ }
+
+ public String name() {
+ return moduleName;
+ }
+
+ public Map<String, Boolean> requires() {
+ return requires;
+ }
+
+ public Map<String, Set<String>> exports() {
+ return exports;
+ }
+
+ public Set<String> packages() {
+ return packages;
+ }
+
+ /**
+ * Tests if this module can read m
+ */
+ public boolean canRead(Module m) {
+ // ## TODO: handle "re-exported=true"
+ // all JDK modules require all modules containing its direct dependences
+ // should not be an issue
+ return requires.containsKey(m.name());
+ }
+
+ /**
+ * Tests if a given fully-qualified name is an exported type.
+ */
+ public boolean isExported(String cn) {
+ int i = cn.lastIndexOf('.');
+ String pn = i > 0 ? cn.substring(0, i) : "";
+
+ return isExportedPackage(pn);
+ }
+
+ /**
+ * Tests if a given package name is exported.
+ */
+ public boolean isExportedPackage(String pn) {
+ return exports.containsKey(pn) ? exports.get(pn).isEmpty() : false;
+ }
+
+ /**
+ * Tests if the given classname is accessible to module m
+ */
+ public boolean isAccessibleTo(String classname, Module m) {
+ int i = classname.lastIndexOf('.');
+ String pn = i > 0 ? classname.substring(0, i) : "";
+ if (!packages.contains(pn)) {
+ throw new IllegalArgumentException(classname + " is not a member of module " + name());
+ }
+
+ if (m != null && !m.canRead(this)) {
+ trace("%s not readable by %s%n", this.name(), m.name());
+ return false;
+ }
+
+ // exported API
+ Set<String> ms = exports().get(pn);
+ String mname = m != null ? m.name() : "unnamed";
+ if (ms == null) {
+ trace("%s not exported in %s%n", classname, this.name());
+ } else if (!(ms.isEmpty() || ms.contains(mname))) {
+ trace("%s not permit to %s %s%n", classname, mname, ms);
+ }
+ return ms != null && (ms.isEmpty() || ms.contains(mname));
+ }
+
+ private static final boolean traceOn = Boolean.getBoolean("jdeps.debug");
+ private void trace(String fmt, Object... args) {
+ if (traceOn) {
+ System.err.format(fmt, args);
+ }
+ }
+
+ @Override
+ public boolean equals(Object ob) {
+ if (!(ob instanceof Module))
+ return false;
+ Module that = (Module)ob;
+ return (moduleName.equals(that.moduleName)
+ && requires.equals(that.requires)
+ && exports.equals(that.exports)
+ && packages.equals(that.packages));
+ }
+
+ @Override
+ public int hashCode() {
+ int hc = moduleName.hashCode();
+ hc = hc * 43 + requires.hashCode();
+ hc = hc * 43 + exports.hashCode();
+ hc = hc * 43 + packages.hashCode();
+ return hc;
+ }
+
+ @Override
+ public String toString() {
+ return name();
+ }
+
+ public final static class Builder {
+ String name;
+ ClassFileReader reader;
+ final Map<String, Boolean> requires = new HashMap<>();
+ final Map<String, Set<String>> exports = new HashMap<>();
+ final Set<String> packages = new HashSet<>();
+
+ public Builder() {
+ }
+
+ public Builder name(String n) {
+ name = n;
+ return this;
+ }
+
+ public Builder require(String d, boolean reexport) {
+ // System.err.format("%s depend %s reexports %s%n", name, d, reexport);
+ requires.put(d, reexport);
+ return this;
+ }
+
+ public Builder packages(Set<String> pkgs) {
+ packages.addAll(pkgs);
+ return this;
+ }
+
+ public Builder export(String p, Set<String> ms) {
+ Objects.requireNonNull(p);
+ Objects.requireNonNull(ms);
+ exports.put(p, new HashSet<>(ms));
+ return this;
+ }
+ public Builder classes(ClassFileReader.ModuleClassReader reader) {
+ this.reader = reader;
+ return this;
+ }
+
+ public Module build() {
+ Module m = new Module(reader, name, requires, exports, packages);
+ return m;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModulesXmlReader.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package com.sun.tools.jdeps;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Set;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.XMLEvent;
+import com.sun.tools.jdeps.ClassFileReader.ModuleClassReader;
+import com.sun.tools.jdeps.PlatformClassPath.ImageHelper;
+
+final class ModulesXmlReader {
+ public static Set<Module> load(ImageHelper helper,InputStream in)
+ throws IOException
+ {
+ try {
+ ModulesXmlReader reader = new ModulesXmlReader(helper);
+ return reader.load(in);
+ } catch (XMLStreamException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static final String MODULES = "modules";
+ private static final String MODULE = "module";
+ private static final String NAME = "name";
+ private static final String DEPEND = "depend";
+ private static final String EXPORT = "export";
+ private static final String TO = "to";
+ private static final QName REEXPORTS = new QName("re-exports");
+ private final ImageHelper helper;
+ ModulesXmlReader(ImageHelper helper) {
+ this.helper = helper;
+ }
+
+ public Set<Module> load(InputStream in) throws XMLStreamException, IOException {
+ Set<Module> modules = new HashSet<>();
+ if (in == null) {
+ throw new RuntimeException("jdeps-modules.xml doesn't exist");
+ }
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ XMLEventReader reader = factory.createXMLEventReader(in, "UTF-8");
+ Module.Builder mb = null;
+ String modulename = null;
+ String exportedPackage = null;
+ Set<String> permits = new HashSet<>();
+ while (reader.hasNext()) {
+ XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ String startTag = event.asStartElement().getName().getLocalPart();
+ switch (startTag) {
+ case MODULES:
+ break;
+ case MODULE:
+ if (mb != null) {
+ throw new RuntimeException("end tag for module is missing");
+ }
+ modulename = getNextTag(reader, NAME);
+ mb = new Module.Builder();
+ mb.name(modulename);
+ break;
+ case NAME:
+ throw new RuntimeException(event.toString());
+ case DEPEND:
+ boolean reexports = false;
+ Attribute attr = event.asStartElement().getAttributeByName(REEXPORTS);
+ if (attr != null) {
+ String value = attr.getValue();
+ if (value.equals("true") || value.equals("false")) {
+ reexports = Boolean.parseBoolean(value);
+ } else {
+ throw new RuntimeException("unexpected attribute " + attr.toString());
+ }
+ }
+ mb.require(getData(reader), reexports);
+ break;
+ case EXPORT:
+ exportedPackage = getNextTag(reader, NAME);
+ break;
+ case TO:
+ permits.add(getData(reader));
+ break;
+ default:
+ throw new RuntimeException("invalid element: " + event);
+ }
+ } else if (event.isEndElement()) {
+ String endTag = event.asEndElement().getName().getLocalPart();
+ switch (endTag) {
+ case MODULE:
+ ModuleClassReader cfr = helper.getModuleClassReader(modulename);
+ mb.classes(cfr);
+ mb.packages(cfr.packages());
+ modules.add(mb.build());
+ mb = null;
+ break;
+ case EXPORT:
+ if (exportedPackage == null) {
+ throw new RuntimeException("export's name is missing");
+ }
+ mb.export(exportedPackage, permits);
+ exportedPackage = null;
+ permits.clear();
+ break;
+ default:
+ }
+ } else if (event.isCharacters()) {
+ String s = event.asCharacters().getData();
+ if (!s.trim().isEmpty()) {
+ throw new RuntimeException("export-to is malformed");
+ }
+ }
+ }
+ return modules;
+ }
+ private String getData(XMLEventReader reader) throws XMLStreamException {
+ XMLEvent e = reader.nextEvent();
+ if (e.isCharacters()) {
+ return e.asCharacters().getData();
+ }
+ throw new RuntimeException(e.toString());
+ }
+
+ private String getNextTag(XMLEventReader reader, String tag) throws XMLStreamException {
+ XMLEvent e = reader.nextTag();
+ if (e.isStartElement()) {
+ String t = e.asStartElement().getName().getLocalPart();
+ if (!tag.equals(t)) {
+ throw new RuntimeException(e + " expected: " + tag);
+ }
+ return getData(reader);
+ }
+ throw new RuntimeException("export-to name is missing:" + e);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/PlatformClassPath.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012, 2014, 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.
+ */
+package com.sun.tools.jdeps;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.jdeps.ClassFileReader.ModuleClassReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.BufferedInputStream;
+import java.net.URI;
+import java.nio.file.*;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * ClassPath for Java SE and JDK
+ */
+class PlatformClassPath {
+ private static List<Archive> modules;
+ static synchronized List<Archive> getModules(Path mpath) throws IOException {
+ if (modules == null) {
+ initPlatformModules(mpath);
+ }
+ return modules;
+ }
+
+ private static void initPlatformModules(Path mpath) throws IOException {
+ ImageHelper helper = ImageHelper.getInstance(mpath);
+ String fn = System.getProperty("jdeps.modules.xml");
+ if (fn != null) {
+ Path p = Paths.get(fn);
+ try (InputStream in = new BufferedInputStream(Files.newInputStream(p))) {
+ modules = new ArrayList<>(ModulesXmlReader.load(helper, in));
+ }
+ } else {
+ try (InputStream in = PlatformClassPath.class
+ .getResourceAsStream("resources/jdeps-modules.xml")) {
+ modules = new ArrayList<>(ModulesXmlReader.load(helper, in));
+ }
+ }
+ if (findModule("java.base") != null) {
+ Profile.initProfiles(modules);
+ }
+ }
+
+ /**
+ * Finds the module with the given name. Returns null
+ * if such module doesn't exist.
+ *
+ * @param mn module name
+ */
+ static Module findModule(String mn) {
+ for (Archive a : modules) {
+ if (Module.class.isInstance(a)) {
+ Module m = (Module)a;
+ if (mn.equals(m.name())) {
+ return m;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns JAR files in $java.home/lib. This is for transition until
+ * all components are linked into jimage.
+ */
+ static List<Archive> getJarFiles() throws IOException {
+ Path home = Paths.get(System.getProperty("java.home"), "lib");
+ return Files.find(home, 1, (Path p, BasicFileAttributes attr)
+ -> p.getFileName().toString().endsWith(".jar"))
+ .map(Archive::getInstance)
+ .collect(Collectors.toList());
+ }
+
+ static class ImageHelper {
+ static ImageHelper getInstance(Path mpath) throws IOException {
+ if (mpath != null) {
+ return new ImageHelper(mpath);
+ }
+ Path home = Paths.get(System.getProperty("java.home"));
+ Path mlib = home.resolve("lib").resolve("modules");
+ if (Files.isDirectory(mlib)) {
+ // jimage
+ FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+ return new ImageHelper(fs, fs.getPath("/"));
+ } else {
+ // exploded modules
+ mlib = home.resolve("modules");
+ if (!Files.isDirectory(mlib)) {
+ throw new InternalError(home + " not a modular image");
+ }
+ return new ImageHelper(mlib);
+ }
+ }
+
+ private final FileSystem fs;
+ private final Path mpath;
+
+ ImageHelper(Path path) throws IOException {
+ this(FileSystems.getDefault(), path);
+ }
+
+ ImageHelper(FileSystem fs, Path path) throws IOException {
+ this.fs = fs;
+ this.mpath = path;
+ }
+
+ /**
+ * Returns a ModuleClassReader that only reads classes for the given modulename.
+ */
+ public ModuleClassReader getModuleClassReader(String modulename)
+ throws IOException
+ {
+ Path mp = mpath.resolve(modulename);
+ if (Files.exists(mp) && Files.isDirectory(mp)) {
+ return new ModuleClassReader(fs, modulename, mp);
+ } else {
+ // aggregator module or os-specific module in jdeps-modules.xml
+ // mdir not exist
+ return new NonExistModuleReader(fs, modulename, mp);
+ }
+ }
+
+ static class NonExistModuleReader extends ModuleClassReader {
+ private final List<ClassFile> classes = Collections.emptyList();
+
+ private NonExistModuleReader(FileSystem fs, String mn, Path mpath)
+ throws IOException
+ {
+ super(fs, mn, mpath);
+ }
+
+ public ClassFile getClassFile(String name) throws IOException {
+ return null;
+ }
+
+ public Iterable<ClassFile> getClassFiles() throws IOException {
+ return classes;
+ }
+
+ public Set<String> packages() {
+ return Collections.emptySet();
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Profile.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2013, 2014, 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.
+ */
+package com.sun.tools.jdeps;
+
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Build the profile information.
+ */
+enum Profile {
+ COMPACT1("compact1", 1, "java.compact1"),
+ COMPACT2("compact2", 2, "java.compact2"),
+ COMPACT3("compact3", 3, "java.compact3", "java.smartcardio", "jdk.sctp",
+ "jdk.httpserver", "jdk.security.auth",
+ "jdk.naming.dns", "jdk.naming.rmi",
+ "jdk.management"),
+ FULL_JRE("Full JRE", 4, "java.se", "jdk.deploy.osx", "jdk.charsets",
+ "jdk.crypto.ec", "jdk.crypto.pkcs11",
+ "jdk.crypto.mscapi", "jdk.crypto.ucrypto", "jdk.jvmstat",
+ "jdk.localedata", "jdk.scripting.nashorn", "jdk.zipfs");
+
+ final String name;
+ final int profile;
+ final String[] mnames;
+ final Set<Module> modules = new HashSet<>();
+
+ Profile(String name, int profile, String... mnames) {
+ this.name = name;
+ this.profile = profile;
+ this.mnames = mnames;
+ }
+
+ public String profileName() {
+ return name;
+ }
+
+ @Override
+ public String toString() {
+ return mnames[0];
+ }
+
+ public static int getProfileCount() {
+ return JDK.isEmpty() ? 0 : Profile.values().length;
+ }
+
+ /**
+ * Returns the Profile for the given package name; null if not found.
+ */
+ public static Profile getProfile(String pn) {
+ for (Profile p : Profile.values()) {
+ for (Module m : p.modules) {
+ if (m.packages().contains(pn)) {
+ return p;
+ }
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Returns the Profile for a given Module; null if not found.
+ */
+ public static Profile getProfile(Module m) {
+ for (Profile p : Profile.values()) {
+ if (p.modules.contains(m)) {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ private final static Set<Module> JDK = new HashSet<>();
+ static void initProfiles(List<Archive> modules) {
+ // add all modules into JDK
+ modules.forEach(m -> JDK.add((Module)m));
+
+ for (Profile p : Profile.values()) {
+ for (String mn : p.mnames) {
+ // this includes platform-dependent module that may not exist
+ Module m = PlatformClassPath.findModule(mn);
+ if (m != null) {
+ p.addModule(m);
+ }
+ }
+ }
+ }
+
+ private void addModule(Module m) {
+ modules.add(m);
+ for (String n : m.requires().keySet()) {
+ Module d = PlatformClassPath.findModule(n);
+ if (d == null) {
+ throw new InternalError("module " + n + " required by " +
+ m.name() + " doesn't exist");
+ }
+ modules.add(d);
+ }
+ }
+ // for debugging
+ public static void main(String[] args) throws IOException {
+ // find platform modules
+ PlatformClassPath.getModules(null);
+ if (Profile.getProfileCount() == 0) {
+ System.err.println("No profile is present in this JDK");
+ }
+ for (Profile p : Profile.values()) {
+ String profileName = p.name;
+ System.out.format("%2d: %-10s %s%n", p.profile, profileName, p.modules);
+ for (Module m: p.modules) {
+ System.out.format("module %s%n", m.name());
+ System.out.format(" requires %s%n", m.requires());
+ for (Map.Entry<String,Set<String>> e: m.exports().entrySet()) {
+ System.out.format(" exports %s %s%n", e.getKey(),
+ e.getValue().isEmpty() ? "" : "to " + e.getValue());
+ }
+ }
+ }
+ System.out.println("All JDK modules:-");
+ JDK.stream().sorted(Comparator.comparing(Module::name))
+ .forEach(m -> System.out.println(m));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,107 @@
+main.usage.summary=\
+Usage: {0} <options> <classes...>\n\
+use -h, -? or -help for a list of possible options
+
+main.usage=\
+Usage: {0} <options> <classes...>\n\
+where <classes> can be a pathname to a .class file, a directory, a JAR file,\n\
+or a fully-qualified class name. Possible options include:
+
+error.prefix=Error:
+warn.prefix=Warning:
+
+main.opt.h=\
+\ -h -? -help Print this usage message
+
+main.opt.version=\
+\ -version Version information
+
+main.opt.v=\
+\ -v -verbose Print all class level dependencies\n\
+\ Equivalent to -verbose:class -filter:none.\n\
+\ -verbose:package Print package-level dependencies excluding\n\
+\ dependencies within the same package by default\n\
+\ -verbose:class Print class-level dependencies excluding\n\
+\ dependencies within the same package by default
+
+main.opt.f=\
+\ -f <regex> -filter <regex> Filter dependences matching the given pattern\n\
+\ If given multiple times, the last one will be used.\n\
+\ -filter:package Filter dependences within the same package (default)\n\
+\ -filter:archive Filter dependences within the same archive\n\
+\ -filter:none No -filter:package and -filter:archive filtering\n\
+\ Filtering specified via the -filter option still applies.
+
+main.opt.s=\
+\ -s -summary Print dependency summary only
+
+main.opt.p=\
+\ -p <pkgname> -package <pkgname> Finds dependences matching the given package name\n\
+\ (may be given multiple times)
+
+main.opt.e=\
+\ -e <regex> -regex <regex> Finds dependences matching the given pattern\n\
+\ (-p and -e are exclusive)
+
+main.opt.include=\
+\ -include <regex> Restrict analysis to classes matching pattern\n\
+\ This option filters the list of classes to\n\
+\ be analyzed. It can be used together with\n\
+\ -p and -e which apply pattern to the dependences
+
+main.opt.P=\
+\ -P -profile Show profile or the file containing a package
+
+main.opt.M=\
+\ -M -module Show module containing the package
+
+main.opt.cp=\
+\ -cp <path> -classpath <path> Specify where to find class files
+
+main.opt.R=\
+\ -R -recursive Recursively traverse all dependencies.\n\
+\ The -R option implies -filter:none. If -p, -e, -f\n\
+\ option is specified, only the matching dependences\n\
+\ are analyzed.
+
+main.opt.apionly=\
+\ -apionly Restrict analysis to APIs i.e. dependences\n\
+\ from the signature of public and protected\n\
+\ members of public classes including field\n\
+\ type, method parameter types, returned type,\n\
+\ checked exception types etc
+
+main.opt.dotoutput=\
+\ -dotoutput <dir> Destination directory for DOT file output
+
+main.opt.jdkinternals=\
+\ -jdkinternals Finds class-level dependences on JDK internal APIs.\n\
+\ By default, it analyzes all classes on -classpath\n\
+\ and input files unless -include option is specified.\n\
+\ This option cannot be used with -p, -e and -s options.\n\
+\ WARNING: JDK internal APIs may not be accessible in\n\
+\ the next release.
+
+main.opt.depth=\
+\ -depth=<depth> Specify the depth of the transitive\n\
+\ dependency analysis
+
+
+err.unknown.option=unknown option: {0}
+err.missing.arg=no value given for {0}
+err.invalid.arg.for.option=invalid argument for option: {0}
+err.option.after.class=option must be specified before classes: {0}
+err.option.unsupported={0} not supported: {1}
+err.profiles.msg=No profile information
+err.invalid.path=invalid path: {0}
+warn.invalid.arg=Invalid classname or pathname not exist: {0}
+warn.split.package=package {0} defined in {1} {2}
+warn.replace.useJDKInternals=\
+JDK internal APIs are unsupported and private to JDK implementation that are\n\
+subject to be removed or changed incompatibly and could break your application.\n\
+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}
+
+artifact.not.found=not found
+jdeps.wiki.url=https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps_ja.properties Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,45 @@
+main.usage.summary=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes...>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u30EA\u30B9\u30C8\u306B\u3064\u3044\u3066\u306F\u3001-h\u3001-?\u307E\u305F\u306F--help\u3092\u4F7F\u7528\u3057\u307E\u3059
+
+main.usage=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <classes...>\n<classes>\u306B\u306F\u3001.class\u30D5\u30A1\u30A4\u30EB\u306E\u30D1\u30B9\u540D\u3001\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3001JAR\u30D5\u30A1\u30A4\u30EB\u307E\u305F\u306F\u5B8C\u5168\u4FEE\u98FE\n\u30AF\u30E9\u30B9\u540D\u3092\u6307\u5B9A\u3067\u304D\u307E\u3059\u3002\u4F7F\u7528\u3067\u304D\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:
+
+error.prefix=\u30A8\u30E9\u30FC:
+warn.prefix=\u8B66\u544A:
+
+main.opt.h=\ -h -? -help \u3053\u306E\u4F7F\u7528\u65B9\u6CD5\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3057\u307E\u3059
+
+main.opt.version=\ -version \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831
+
+main.opt.v=\ -v -verbose \u30AF\u30E9\u30B9\u30FB\u30EC\u30D9\u30EB\u306E\u4F9D\u5B58\u6027\u3092\u3059\u3079\u3066\u51FA\u529B\u3057\u307E\u3059\n -verbose:package \u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EC\u30D9\u30EB\u306E\u4F9D\u5B58\u6027\u3092\u51FA\u529B\u3057\u307E\u3059\n (\u540C\u3058\u30A2\u30FC\u30AB\u30A4\u30D6\u5185\u306E\u4F9D\u5B58\u6027\u3092\u9664\u304F)\n -verbose:class \u30AF\u30E9\u30B9\u30FB\u30EC\u30D9\u30EB\u306E\u4F9D\u5B58\u6027\u3092\u51FA\u529B\u3057\u307E\u3059\n (\u540C\u3058\u30A2\u30FC\u30AB\u30A4\u30D6\u5185\u306E\u4F9D\u5B58\u6027\u3092\u9664\u304F)
+
+main.opt.s=\ -s -summary \u4F9D\u5B58\u6027\u306E\u8981\u7D04\u306E\u307F\u51FA\u529B\u3057\u307E\u3059
+
+main.opt.p=\ -p <pkgname> -package <pkgname> \u6307\u5B9A\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u306E\u4F9D\u5B58\u6027\u3092\u691C\u51FA\u3057\u307E\u3059\n (\u8907\u6570\u56DE\u6307\u5B9A\u53EF\u80FD)
+
+main.opt.e=\ -e <regex> -regex <regex> \u30D1\u30BF\u30FC\u30F3\u306B\u4E00\u81F4\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u306E\u4F9D\u5B58\u6027\u3092\u691C\u51FA\u3057\u307E\u3059\n (-p\u3068-e\u306F\u6392\u4ED6\u7684)
+
+main.opt.include=\ -include <regex> \u30D1\u30BF\u30FC\u30F3\u306B\u4E00\u81F4\u3059\u308B\u30AF\u30E9\u30B9\u306B\u5206\u6790\u3092\u5236\u9650\u3057\u307E\u3059\n \u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6307\u5B9A\u3059\u308B\u3068\u3001\u5206\u6790\u5BFE\u8C61\u30AF\u30E9\u30B9\u306E\n \u30EA\u30B9\u30C8\u304C\u30D5\u30A3\u30EB\u30BF\u51E6\u7406\u3055\u308C\u307E\u3059\u3002\u30D1\u30BF\u30FC\u30F3\u3092\u4F9D\u5B58\u6027\u306B\n \u9069\u7528\u3059\u308B-p\u304A\u3088\u3073-e\u3068\u4E00\u7DD2\u306B\u4F7F\u7528\u3067\u304D\u307E\u3059
+
+main.opt.P=\ -P -profile \u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u3001\u307E\u305F\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u3092\u8868\u793A\u3057\u307E\u3059
+
+main.opt.cp=\ -cp <path> -classpath <path> \u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3057\u307E\u3059
+
+main.opt.R=\ -R -recursive \u3059\u3079\u3066\u306E\u4F9D\u5B58\u6027\u3092\u53CD\u5FA9\u7684\u306B\u8D70\u67FB\u3057\u307E\u3059
+
+main.opt.apionly=\ -apionly \u5206\u6790\u3092API\u3001\u3064\u307E\u308A\u3001\u30D1\u30D6\u30EA\u30C3\u30AF\u30FB\u30AF\u30E9\u30B9\u306E\n \u30D1\u30D6\u30EA\u30C3\u30AF\u30FB\u30E1\u30F3\u30D0\u30FC\u304A\u3088\u3073\u4FDD\u8B77\u3055\u308C\u305F\u30E1\u30F3\u30D0\u30FC\u306E\n \u7F72\u540D\u306B\u304A\u3051\u308B\u4F9D\u5B58\u6027(\u30D5\u30A3\u30FC\u30EB\u30C9\u30FB\u30BF\u30A4\u30D7\u3001\u30E1\u30BD\u30C3\u30C9\u30FB\n \u30D1\u30E9\u30E1\u30FC\u30BF\u30FB\u30BF\u30A4\u30D7\u3001\u623B\u3055\u308C\u305F\u30BF\u30A4\u30D7\u3001\u30C1\u30A7\u30C3\u30AF\u3055\u308C\u305F\n \u4F8B\u5916\u30BF\u30A4\u30D7\u306A\u3069)\u306B\u5236\u9650\u3057\u307E\u3059
+
+main.opt.dotoutput=\ -dotoutput <dir> DOT\u30D5\u30A1\u30A4\u30EB\u51FA\u529B\u306E\u5B9B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA
+
+main.opt.depth=\ -depth=<depth> \u63A8\u79FB\u7684\u306A\u4F9D\u5B58\u6027\u5206\u6790\u306E\u6DF1\u3055\u3092\n \u6307\u5B9A\u3057\u307E\u3059
+
+err.unknown.option=\u4E0D\u660E\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: {0}
+err.missing.arg={0}\u306B\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+err.internal.error=\u5185\u90E8\u30A8\u30E9\u30FC: {0} {1} {2}
+err.invalid.arg.for.option=\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: {0}
+err.option.after.class=\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u30AF\u30E9\u30B9\u306E\u524D\u306B\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}
+err.option.unsupported={0}\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093: {1}
+err.profiles.msg=\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093
+err.dot.output.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
+
+artifact.not.found=\u898B\u3064\u304B\u308A\u307E\u305B\u3093
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdeps_zh_CN.properties Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,45 @@
+main.usage.summary=\u7528\u6CD5: {0} <options> <classes...>\n\u4F7F\u7528 -h, -? \u6216 --help \u5217\u51FA\u53EF\u80FD\u7684\u9009\u9879
+
+main.usage=\u7528\u6CD5: {0} <options> <classes...>\n\u5176\u4E2D <classes> \u53EF\u4EE5\u662F .class \u6587\u4EF6, \u76EE\u5F55, JAR \u6587\u4EF6\u7684\u8DEF\u5F84\u540D,\n\u4E5F\u53EF\u4EE5\u662F\u5168\u9650\u5B9A\u7C7B\u540D\u3002\u53EF\u80FD\u7684\u9009\u9879\u5305\u62EC:
+
+error.prefix=\u9519\u8BEF:
+warn.prefix=\u8B66\u544A:
+
+main.opt.h=\ -h -? -help \u8F93\u51FA\u6B64\u7528\u6CD5\u6D88\u606F
+
+main.opt.version=\ -version \u7248\u672C\u4FE1\u606F
+
+main.opt.v=\ -v -verbose \u8F93\u51FA\u6240\u6709\u7C7B\u7EA7\u522B\u88AB\u4F9D\u8D56\u5BF9\u8C61\n -verbose:package \u8F93\u51FA\u7A0B\u5E8F\u5305\u7EA7\u522B\u88AB\u4F9D\u8D56\u5BF9\u8C61, \u4E0D\u5305\u62EC\n \u540C\u4E00\u6863\u6848\u4E2D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n -verbose:class \u8F93\u51FA\u7C7B\u7EA7\u522B\u88AB\u4F9D\u8D56\u5BF9\u8C61, \u4E0D\u5305\u62EC\n \u540C\u4E00\u6863\u6848\u4E2D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61
+
+main.opt.s=\ -s -summary \u4EC5\u8F93\u51FA\u88AB\u4F9D\u8D56\u5BF9\u8C61\u6982\u8981
+
+main.opt.p=\ -p <pkgname> -package <pkgname> \u67E5\u627E\u7ED9\u5B9A\u7A0B\u5E8F\u5305\u4E2D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n (\u53EF\u80FD\u591A\u6B21\u6307\u5B9A)
+
+main.opt.e=\ -e <regex> -regex <regex> \u67E5\u627E\u4E0E\u6A21\u5F0F\u5339\u914D\u7684\u7A0B\u5E8F\u5305\u4E2D\u7684\u88AB\u4F9D\u8D56\u5BF9\u8C61\n (-p \u548C -e \u4E92\u76F8\u6392\u65A5)
+
+main.opt.include=\ -include <regex> \u5C06\u5206\u6790\u9650\u5236\u4E3A\u4E0E\u6A21\u5F0F\u5339\u914D\u7684\u7C7B\n \u6B64\u9009\u9879\u7B5B\u9009\u8981\u5206\u6790\u7684\u7C7B\u7684\u5217\u8868\u3002\n \u5B83\u53EF\u4EE5\u4E0E\u5411\u88AB\u4F9D\u8D56\u5BF9\u8C61\u5E94\u7528\u6A21\u5F0F\u7684\n -p \u548C -e \u7ED3\u5408\u4F7F\u7528
+
+main.opt.P=\ -P -profile \u663E\u793A\u914D\u7F6E\u6587\u4EF6\u6216\u5305\u542B\u7A0B\u5E8F\u5305\u7684\u6587\u4EF6
+
+main.opt.cp=\ -cp <path> -classpath <path> \u6307\u5B9A\u67E5\u627E\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
+
+main.opt.R=\ -R -recursive \u9012\u5F52\u904D\u5386\u6240\u6709\u88AB\u4F9D\u8D56\u5BF9\u8C61
+
+main.opt.apionly=\ -apionly \u901A\u8FC7\u516C\u5171\u7C7B (\u5305\u62EC\u5B57\u6BB5\u7C7B\u578B, \u65B9\u6CD5\u53C2\u6570\n \u7C7B\u578B, \u8FD4\u56DE\u7C7B\u578B, \u53D7\u63A7\u5F02\u5E38\u9519\u8BEF\u7C7B\u578B\n \u7B49) \u7684\u516C\u5171\u548C\u53D7\u4FDD\u62A4\u6210\u5458\u7684\u7B7E\u540D\n \u9650\u5236\u5BF9 API (\u5373\u88AB\u4F9D\u8D56\u5BF9\u8C61)\n \u8FDB\u884C\u5206\u6790
+
+main.opt.dotoutput=\ -dotoutput <dir> DOT \u6587\u4EF6\u8F93\u51FA\u7684\u76EE\u6807\u76EE\u5F55
+
+main.opt.depth=\ -depth=<depth> \u6307\u5B9A\u8FC7\u6E21\u88AB\u4F9D\u8D56\u5BF9\u8C61\u5206\u6790\n \u7684\u6DF1\u5EA6
+
+err.unknown.option=\u672A\u77E5\u9009\u9879: {0}
+err.missing.arg=\u6CA1\u6709\u4E3A{0}\u6307\u5B9A\u503C
+err.internal.error=\u5185\u90E8\u9519\u8BEF: {0} {1} {2}
+err.invalid.arg.for.option=\u9009\u9879\u7684\u53C2\u6570\u65E0\u6548: {0}
+err.option.after.class=\u5FC5\u987B\u5728\u7C7B\u4E4B\u524D\u6307\u5B9A\u9009\u9879: {0}
+err.option.unsupported=\u4E0D\u652F\u6301{0}: {1}
+err.profiles.msg=\u6CA1\u6709\u914D\u7F6E\u6587\u4EF6\u4FE1\u606F
+err.dot.output.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}
+
+artifact.not.found=\u627E\u4E0D\u5230
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdkinternals.properties Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,22 @@
+// 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.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.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
+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.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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/version.properties-template Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2012, 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.
+#
+
+jdk=$(JDK_VERSION)
+full=$(FULL_VERSION)
+release=$(RELEASE)
--- a/langtools/test/tools/javac/4241573/T4241573.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/4241573/T4241573.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4241573
* @summary SourceFile attribute includes full path
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import com.sun.tools.classfile.Attribute;
--- a/langtools/test/tools/javac/4846262/CheckEBCDICLocaleTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/4846262/CheckEBCDICLocaleTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -34,6 +34,7 @@
*/
import java.io.File;
+import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -64,14 +65,11 @@
public void test() throws Exception {
ToolBox tb = new ToolBox();
- Path native2asciiBinary = tb.getJDKTool("native2ascii");
-
tb.writeFile("Test.java", TestSrc);
tb.createDirectories("output");
- tb.new ExecTask(native2asciiBinary)
- .args("-reverse", "-encoding", "IBM1047", "Test.java", "output/Test.java")
- .run();
+ Native2Ascii n2a = new Native2Ascii(Charset.forName("IBM1047"));
+ n2a.asciiToNative(Paths.get("Test.java"), Paths.get("output", "Test.java"));
tb.new JavacTask(ToolBox.Mode.EXEC)
.redirect(ToolBox.OutputKind.STDERR, "Test.tmp")
@@ -81,14 +79,25 @@
.files("output/Test.java")
.run(ToolBox.Expect.FAIL);
- tb.new ExecTask(native2asciiBinary)
- .args("-encoding", "IBM1047", "Test.tmp", "Test.out")
- .run();
+ n2a.nativeToAscii(Paths.get("Test.tmp"), Paths.get("Test.out"));
List<String> expectLines = Arrays.asList(
String.format(TestOutTemplate, File.separator).split("\n"));
List<String> actualLines = Files.readAllLines(Paths.get("Test.out"));
- tb.checkEqual(expectLines, actualLines);
+ try {
+ tb.checkEqual(expectLines, actualLines);
+ } catch (Throwable tt) {
+ System.err.println("current ouput don't have the expected number of lines. See output below");
+
+ System.err.println("Expected output:");
+ System.err.println(TestOutTemplate);
+ System.err.println();
+ System.err.println("Actual output:");
+ for (String s : actualLines) {
+ System.err.println(s);
+ }
+ System.err.println();
+ throw tt;
+ }
}
-
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/4846262/Native2Ascii.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FilterReader;
+import java.io.FilterWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import static java.nio.charset.StandardCharsets.*;
+
+/**
+ * Simple utility to convert from native encoding file to ascii or reverse
+ * including \udddd Unicode notation.
+ */
+public class Native2Ascii {
+ final Charset cs;
+ final CharsetEncoder encoder;
+ public Native2Ascii(Charset cs) {
+ this.cs = cs;
+ this.encoder = cs.newEncoder();
+ }
+
+ /**
+ * ASCII to Native conversion
+ */
+ public void asciiToNative(Path infile, Path outfile) throws IOException {
+ try (BufferedReader in = Files.newBufferedReader(infile, US_ASCII);
+ BufferedReader reader = new BufferedReader(new A2NFilter(in));
+ BufferedWriter writer = Files.newBufferedWriter(outfile, cs)) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ writer.write(line.toCharArray());
+ writer.newLine();
+ }
+ }
+ }
+
+ /**
+ * Native to ASCII conversion
+ */
+ public void nativeToAscii(Path infile, Path outfile) throws IOException {
+ try (BufferedReader reader = Files.newBufferedReader(infile, cs);
+ BufferedWriter out = Files.newBufferedWriter(outfile, US_ASCII);
+ BufferedWriter writer = new BufferedWriter(new N2AFilter(out))) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ writer.write(line.toCharArray());
+ writer.newLine();
+ }
+ }
+ }
+
+ // A copy of native2ascii N2AFilter
+ class N2AFilter extends FilterWriter {
+ public N2AFilter(Writer out) { super(out); }
+ public void write(char b) throws IOException {
+ char[] buf = new char[1];
+ buf[0] = b;
+ write(buf, 0, 1);
+ }
+
+ public void write(char[] buf, int off, int len) throws IOException {
+ for (int i = 0; i < len; i++) {
+ if ((buf[i] > '\u007f')) {
+ // write \udddd
+ out.write('\\');
+ out.write('u');
+ String hex = Integer.toHexString(buf[i]);
+ StringBuilder hex4 = new StringBuilder(hex);
+ hex4.reverse();
+ int length = 4 - hex4.length();
+ for (int j = 0; j < length; j++) {
+ hex4.append('0');
+ }
+ for (int j = 0; j < 4; j++) {
+ out.write(hex4.charAt(3 - j));
+ }
+ } else
+ out.write(buf[i]);
+ }
+ }
+ }
+
+ // A copy of native2ascii A2NFilter
+ class A2NFilter extends FilterReader {
+ // maintain a trailing buffer to hold any incompleted
+ // unicode escaped sequences
+ private char[] trailChars = null;
+
+ public A2NFilter(Reader in) {
+ super(in);
+ }
+
+ public int read(char[] buf, int off, int len) throws IOException {
+ int numChars = 0; // how many characters have been read
+ int retChars = 0; // how many characters we'll return
+
+ char[] cBuf = new char[len];
+ int cOffset = 0; // offset at which we'll start reading
+ boolean eof = false;
+
+ // copy trailing chars from previous invocation to input buffer
+ if (trailChars != null) {
+ for (int i = 0; i < trailChars.length; i++)
+ cBuf[i] = trailChars[i];
+ numChars = trailChars.length;
+ trailChars = null;
+ }
+
+ int n = in.read(cBuf, numChars, len - numChars);
+ if (n < 0) {
+ eof = true;
+ if (numChars == 0)
+ return -1; // EOF;
+ } else {
+ numChars += n;
+ }
+
+ for (int i = 0; i < numChars; ) {
+ char c = cBuf[i++];
+
+ if (c != '\\' || (eof && numChars <= 5)) {
+ // Not a backslash, so copy and continue
+ // Always pass non backslash chars straight thru
+ // for regular encoding. If backslash occurs in
+ // input stream at the final 5 chars then don't
+ // attempt to read-ahead and de-escape since these
+ // are literal occurrences of U+005C which need to
+ // be encoded verbatim in the target encoding.
+ buf[retChars++] = c;
+ continue;
+ }
+
+ int remaining = numChars - i;
+ if (remaining < 5) {
+ // Might be the first character of a unicode escape, but we
+ // don't have enough characters to tell, so save it and finish
+ trailChars = new char[1 + remaining];
+ trailChars[0] = c;
+ for (int j = 0; j < remaining; j++)
+ trailChars[1 + j] = cBuf[i + j];
+ break;
+ }
+ // At this point we have at least five characters remaining
+
+ c = cBuf[i++];
+ if (c != 'u') {
+ // Not a unicode escape, so copy and continue
+ buf[retChars++] = '\\';
+ buf[retChars++] = c;
+ continue;
+ }
+
+ // The next four characters are the hex part of a unicode escape
+ char rc = 0;
+ boolean isUE = true;
+ try {
+ rc = (char) Integer.parseInt(new String(cBuf, i, 4), 16);
+ } catch (NumberFormatException x) {
+ isUE = false;
+ }
+ if (isUE && encoder.canEncode(rc)) {
+ // We'll be able to convert this
+ buf[retChars++] = rc;
+ i += 4; // Align beyond the current uXXXX sequence
+ } else {
+ // We won't, so just retain the original sequence
+ buf[retChars++] = '\\';
+ buf[retChars++] = 'u';
+ continue;
+ }
+
+ }
+
+ return retChars;
+ }
+
+ public int read() throws IOException {
+ char[] buf = new char[1];
+
+ if (read(buf, 0, 1) == -1)
+ return -1;
+ else
+ return (int) buf[0];
+ }
+ }
+}
--- a/langtools/test/tools/javac/7003595/T7003595.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/7003595/T7003595.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 7003595
* @summary IncompatibleClassChangeError with unreferenced local class with subclass
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
*/
--- a/langtools/test/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 7153958
* @summary add constant pool reference to class containing inlined constants
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile pkg/ClassToBeStaticallyImported.java CPoolRefClassContainingInlinedCts.java
* @run main CPoolRefClassContainingInlinedCts
*/
--- a/langtools/test/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 7166455
* @summary javac doesn't set ACC_STRICT bit on <clinit> for strictfp class
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main CheckACC_STRICTFlagOnclinitTest
*/
--- a/langtools/test/tools/javac/7199823/InnerClassCannotBeVerified.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/7199823/InnerClassCannotBeVerified.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 7199823
* @summary javac generates inner class that can't be verified
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main InnerClassCannotBeVerified
*/
--- a/langtools/test/tools/javac/8000518/DuplicateConstantPoolEntry.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/8000518/DuplicateConstantPoolEntry.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8000518
* @summary Javac generates duplicate name_and_type constant pool entry for
* class BinaryOpValueExp.java
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main DuplicateConstantPoolEntry
*/
--- a/langtools/test/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8005931
* @summary javac doesn't set ACC_STRICT for classes with package access
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main CheckACC_STRICTFlagOnPkgAccessClassTest
*/
--- a/langtools/test/tools/javac/8009170/RedundantByteCodeInArrayTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/8009170/RedundantByteCodeInArrayTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8009170
* @summary Regression: javac generates redundant bytecode in assignop involving
* arrays
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main RedundantByteCodeInArrayTest
*/
--- a/langtools/test/tools/javac/MethodParameters/AnnotationTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParameters/AnnotationTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8006582
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build Tester
* @compile -parameters AnnotationTest.java
* @run main Tester AnnotationTest AnnotationTest.out
--- a/langtools/test/tools/javac/MethodParameters/AnonymousClass.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParameters/AnonymousClass.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8006582
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build Tester
* @compile -parameters AnonymousClass.java
* @run main Tester AnonymousClass AnonymousClass.out
--- a/langtools/test/tools/javac/MethodParameters/Constructors.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParameters/Constructors.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8006582
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build Tester
* @compile -parameters Constructors.java
* @run main Tester Constructors Constructors.out
--- a/langtools/test/tools/javac/MethodParameters/EnumTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParameters/EnumTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8006582 8008658
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build Tester
* @compile -parameters EnumTest.java
* @run main Tester EnumTest EnumTest.out
--- a/langtools/test/tools/javac/MethodParameters/InstanceMethods.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParameters/InstanceMethods.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8006582
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build Tester
* @compile -parameters InstanceMethods.java
* @run main Tester InstanceMethods InstanceMethods.out
--- a/langtools/test/tools/javac/MethodParameters/LambdaTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8006582 8037546
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build Tester
* @compile -parameters LambdaTest.java
* @run main Tester LambdaTest LambdaTest.out
--- a/langtools/test/tools/javac/MethodParameters/LocalClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParameters/LocalClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8006582 8008658
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build Tester
* @compile -parameters LocalClassTest.java
* @run main Tester LocalClassTest LocalClassTest.out
--- a/langtools/test/tools/javac/MethodParameters/MemberClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParameters/MemberClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8006582 8008658
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build Tester
* @compile -parameters MemberClassTest.java
* @run main Tester MemberClassTest MemberClassTest.out
--- a/langtools/test/tools/javac/MethodParameters/StaticMethods.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParameters/StaticMethods.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8006582
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build Tester
* @compile -parameters StaticMethods.java
* @run main Tester StaticMethods StaticMethods.out
--- a/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8006582
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build Tester
* @compile -parameters UncommonParamNames.java
* @run main Tester UncommonParamNames UncommonParamNames.out
--- a/langtools/test/tools/javac/MethodParametersTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/MethodParametersTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8004727
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/NoStringToLower.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/NoStringToLower.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8029800
* @summary String.toLowerCase()/toUpperCase is generally dangerous, check it is not used in langtools
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.io.*;
--- a/langtools/test/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 6695379
* @summary Copy method annotations and parameter annotations to synthetic
* bridge methods
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.util
* @run main AnnotationsAreNotCopiedToBridgeMethodsTest
*/
--- a/langtools/test/tools/javac/T6970173/DebugPointerAtBadPositionTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T6970173/DebugPointerAtBadPositionTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 6970173
* @summary Debug pointer at bad position
* @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 7008643
* @summary inlined finally clauses confuse debuggers
* @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/T7053059/DoubleCastTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T7053059/DoubleCastTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8015499
* @summary javac, Gen is generating extra checkcast instructions in some corner cases
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.util
* @run main DoubleCastTest
*/
--- a/langtools/test/tools/javac/T7093325.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T7093325.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @summary Redundant entry in bytecode exception table
* temporarily workaround combo tests are causing time out in several platforms
* @library lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build JavacTestingAbstractThreadedTest
* @run main/othervm T7093325
*/
--- a/langtools/test/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 7165659
* @summary javac incorrectly sets strictfp access flag on inner-classes
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.util
*/
--- a/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8003967
* @summary detect and remove all mutable implicit static enum fields in langtools
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.util
* @run main DetectMutableStaticFields
*/
--- a/langtools/test/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8010737
* @summary javac, known parameter's names should be copied to automatically
* generated constructors for inner classes
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.tree
--- a/langtools/test/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8011181
* @summary javac, empty UTF8 entry generated for inner class
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.util
*/
--- a/langtools/test/tools/javac/T8019486/WrongLNTForLambdaTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T8019486/WrongLNTForLambdaTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @bug 8019486 8026861 8027142
* @summary javac, generates erroneous LVT for a test case with lambda code
* @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8022186
* @summary javac generates dead code if a try with an empty body has a finalizer
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.util
*/
--- a/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @bug 8024039
* @summary javac, previous solution for JDK-8022186 was incorrect
* @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8028504
* @summary javac generates LocalVariableTable even with -g:none
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g:none DontGenerateLVTForGNoneOpTest.java
* @run main DontGenerateLVTForGNoneOpTest
*/
--- a/langtools/test/tools/javac/annotations/SyntheticParameters.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/SyntheticParameters.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8065132
* @summary Test generation of annotations on inner class parameters.
* @library /lib/annotations/
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main SyntheticParameters
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8005085 8005877 8004829 8005681 8006734 8006775
* @summary Combinations of Target ElementTypes on (repeated)type annotations.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import com.sun.tools.classfile.*;
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8005085 8005877 8004829 8005681 8006734 8006775 8006507
* @summary Combinations of Target ElementTypes on (repeated)type annotations.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import com.sun.tools.classfile.*;
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8005085 8005681 8008769 8010015
* @summary Check (repeating)type annotations on lambda usage.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main CombinationsTargetTest3
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,7 +32,7 @@
* @test
* @bug 6917130 8006775
* @summary test that optimized away annotations are not emited to classfile
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class DeadCode extends ClassfileTestHelper {
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java Mon Jun 01 10:15:20 2015 -0700
@@ -31,7 +31,7 @@
/*
* @test ClassLiterals
* @summary test that new type arguments are emitted to classfile
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class NewTypeArguments extends ClassfileTestHelper{
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java Mon Jun 01 10:15:20 2015 -0700
@@ -33,7 +33,7 @@
* @test NoTargetAnnotations
* @summary test that annotations with no Target meta type is emitted
* only once as declaration annotation
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class NoTargetAnnotations {
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/Scopes.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/Scopes.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,7 +32,7 @@
* @test
* @bug 6843077 8006775
* @summary Qualified inner type annotation accessible to the class.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
@Scopes.UniqueInner
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test SyntheticParameters
* @summary Test generation of annotations on inner class parameters.
* @library /lib/annotations/
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main SyntheticParameters
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8008762
* @summary Type annotation on inner class in anonymous class
* shows up as regular annotation
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.lang.annotation.*;
import static java.lang.annotation.RetentionPolicy.*;
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8008769.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8008769.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @summary Repeated type-annotations on type parm of local variable
* are not written to classfile.
* @bug 8008769
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.lang.annotation.*;
import static java.lang.annotation.RetentionPolicy.*;
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8010015.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8010015.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @summary Wrong classfile attribution in inner class of lambda expression.
* @bug 8010015
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.lang.annotation.*;
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java Mon Jun 01 10:15:20 2015 -0700
@@ -33,7 +33,7 @@
* results in 2). Elements with no annotations expect 0.
* Source template is read in from testanoninner.template
*
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.lang.annotation.*;
import java.io.*;
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestNewCastArray.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestNewCastArray.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8005681
* @summary Repeated annotations on new,array,cast.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.lang.annotation.*;
import java.io.*;
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java Mon Jun 01 10:15:20 2015 -0700
@@ -33,7 +33,7 @@
* @bug 6843077 8006775
* @summary test that typecasts annotation are emitted if only the cast
* expression is optimized away
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class TypeCasts extends ClassfileTestHelper{
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,7 +32,7 @@
* @test Wildcards
* @bug 6843077 8006775
* @summary test that annotations target wildcards get emitted to classfile
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class Wildcards extends ClassfileTestHelper {
public static void main(String[] args) throws Exception {
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for class extends clauses
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java ClassExtends.java
* @run main Driver ClassExtends
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for class type parameters
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java ClassTypeParam.java
* @run main Driver ClassTypeParam
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ConstructorInvocationTypeArgument.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ConstructorInvocationTypeArgument.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for constructor invocation type argument
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java ConstructorInvocationTypeArgument.java
* @run main Driver ConstructorInvocationTypeArgument
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8026791 8042451
* @summary Test population of reference info for constructor results
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java Constructors.java
* @run main Driver Constructors
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @bug 8028576 8042451
* @summary Test population of reference info for exception parameters
* @author Werner Dietl
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java ExceptionParameters.java
* @run main Driver ExceptionParameters
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for field
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java Fields.java
* @run main Driver Fields
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test that the examples from the manual are stored as expected
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java FromSpecification.java
* @run main Driver FromSpecification
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @bug 8013852 8042451
* @summary Test population of reference info for instance and class initializers
* @author Werner Dietl
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java Initializers.java
* @run main Driver Initializers
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8008077 8029721 8042451 8043974
* @summary Test population of reference info for lambda expressions
* javac crash for annotated parameter type of lambda in a field
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @ignore 8057687 emit correct byte code an attributes for type annotations
* @compile -g Driver.java ReferenceInfoUtil.java Lambda.java
* @run main Driver Lambda
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodInvocationTypeArgument.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodInvocationTypeArgument.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for method invocation type arguments
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java MethodInvocationTypeArgument.java
* @run main Driver MethodInvocationTypeArgument
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for method parameters
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java MethodParameters.java
* @run main Driver MethodParameters
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for method receivers
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java MethodReceivers.java
* @run main Driver MethodReceivers
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for method return
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java MethodReturns.java
* @run main Driver MethodReturns
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for method exception clauses
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java MethodThrows.java
* @run main Driver MethodThrows
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for method type parameters
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java MethodTypeParam.java
* @run main Driver MethodTypeParam
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @bug 8006732 8006775 8042451
* @summary Test population of reference info for multicatch exception parameters
* @author Werner Dietl
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java MultiCatch.java
* @run main Driver MultiCatch
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451 8044009 8044010
* @summary Test population of reference info for nested types
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @ignore 8057687 emit correct byte code an attributes for type annotations
* @compile -g Driver.java ReferenceInfoUtil.java NestedTypes.java
* @run main Driver NestedTypes
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for new object creations
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java NewObjects.java
* @run main Driver NewObjects
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
/*
* @test
* @summary Test population of reference info for repeating type annotations
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java RepeatingTypeAnnotations.java
* @run main Driver RepeatingTypeAnnotations
* @author Werner Dietl
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for resource variable
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java ResourceVariable.java
* @run main Driver ResourceVariable
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for type casts
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java TypeCasts.java
* @run main Driver TypeCasts
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8042451
* @summary Test population of reference info for class literals
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g Driver.java ReferenceInfoUtil.java TypeTests.java
* @run main Driver TypeTests
*/
--- a/langtools/test/tools/javac/classfiles/InnerClasses/SyntheticClasses.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/InnerClasses/SyntheticClasses.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @bug 8034854
* @summary Verify that the InnerClasses attribute has outer_class_info_index zero if it has
* inner_name_index zero (for synthetic classes)
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile SyntheticClasses.java
* @run main SyntheticClasses
*/
--- a/langtools/test/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042947
* @summary Checking AnnotationDefault attribute.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042931
* @summary Checking EnclosingMethod attribute of anonymous/local class.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @bug 8040131
*
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @summary local variable table attribute test.
* @bug 8040097
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @summary local variable type table attribute test.
* @bug 8040097
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/ConstructorTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ConstructorTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8049238
* @summary Checks Signature attribute for constructors.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/EnumTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/EnumTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8049238
* @summary Checks Signature attribute for enum.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/ExceptionTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ExceptionTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8049238
* @summary Checks Signature attribute for methods which throw exceptions.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/FieldTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/FieldTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8049238
* @summary Checks Signature attribute for fields.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/InnerClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/InnerClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8049238
* @summary Checks Signature attribute for inner classes.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8049238
* @summary Checks Signature attribute for method parameters.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8049238
* @summary Checks Signature attribute for type bounds.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @summary Checks Signature attribute for array return type of method.
* @library /tools/lib /tools/javac/lib ../lib
* @modules java.desktop
- * jdk.compiler/com.sun.tools.classfile
+ * jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @summary sourcefile attribute test for anonymous class.
* @bug 8040129
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @summary sourcefile attribute test for inner class.
* @bug 8040129
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @summary sourcefile attribute test for local class.
* @bug 8040129
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/MixTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/MixTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @summary sourcefile attribute test for complex structure of nested classes and other types.
* @bug 8040129
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @summary sourcefile attribute test for file compiled without debug information.
* @bug 8040129
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/SyntheticClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @summary sourcefile attribute test for synthetic class.
* @bug 8040129
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @summary sourcefile attribute test for two type in one file.
* @bug 8040129
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042261
* @summary Checking that deprecated attribute does not apply to classes of deprecated package.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @summary Checking what attribute is generated by annotation Deprecated
* or javadoc deprecated for field, method, class(inner/local), interface.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner annotations in inner annotation.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner annotations in inner class.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner annotations in inner enum.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner annotations in inner interface.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Test that inner classes have in its inner classes attribute enclosing classes and its immediate members.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251 8062373
* @summary Testing InnerClasses_attribute of inner classes in anonymous class.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner classes in inner annotation.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8034854 8042251
* @summary Testing InnerClasses_attribute of inner classes in inner class.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8034854 8042251
* @summary Testing InnerClasses_attribute of inner classes in inner enum.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner classes in inner interface.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner classes in local class.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Test that outer_class_info_index of local and anonymous class is zero.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @bug 8034854 8042251
* @summary Testing inner classes attributes.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner enums in inner annotation.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner enums in inner enum.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner enums in inner interface.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner enums in inner class.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner interfaces in inner annotation.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @summary Testing InnerClasses_attribute of inner interfaces in inner class.
* @author aeremeev
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner interfaces in inner enum.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Testing InnerClasses_attribute of inner interfaces in inner interface.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8042251
* @summary Test that there are no inner classes attributes in case of there are no inner classes.
* @library /tools/lib /tools/javac/lib ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/classreader/BadClass.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/classreader/BadClass.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6898851
* @summary Compiling against this corrupt class file causes a stacktrace from javac
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.io.File;
--- a/langtools/test/tools/javac/constDebug/ConstDebugTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/constDebug/ConstDebugTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4645152 4785453
* @summary javac compiler incorrectly inserts <clinit> when -g is specified
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run compile -g ConstDebugTest.java
* @run main ConstDebugTest
*/
--- a/langtools/test/tools/javac/defaultMethods/BadClassfile.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/defaultMethods/BadClassfile.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8025087
* @summary Verify that pre-JDK8 classfiles with default and/or static methods
* are refused correctly.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.jvm
--- a/langtools/test/tools/javac/defaultMethods/CheckACC_STRICTFlagOnDefaultMethodTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/defaultMethods/CheckACC_STRICTFlagOnDefaultMethodTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8012723
* @summary strictfp interface misses strictfp modifer on default method
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main CheckACC_STRICTFlagOnDefaultMethodTest
*/
--- a/langtools/test/tools/javac/defaultMethods/TestDefaultBody.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/defaultMethods/TestDefaultBody.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 7192246
* @summary check that code attributed for default methods is correctly generated
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import com.sun.tools.classfile.AccessFlags;
--- a/langtools/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 7192246
* @summary check that javac does not generate bridge methods for defaults
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import com.sun.tools.classfile.ClassFile;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/private/Private10.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8080726
+ * @summary Redundant error message on private abstract interface method with body.
+ * @compile/fail/ref=Private10.out -XDrawDiagnostics Private10.java
+ */
+
+
+public class Private10 {
+ interface I {
+ private abstract void foo() {}
+ }
+ class C {
+ private abstract void foo() {}
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/private/Private10.out Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,3 @@
+Private10.java:11:31: compiler.err.illegal.combination.of.modifiers: abstract, private
+Private10.java:14:31: compiler.err.illegal.combination.of.modifiers: abstract, private
+2 errors
--- a/langtools/test/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8027281
* @summary As per JVMS 4.9.2, invokespecial can only refer to direct superinterfaces
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile TestDirectSuperInterfaceInvoke.java
* @run main TestDirectSuperInterfaceInvoke
*/
--- a/langtools/test/tools/javac/diags/CheckResourceKeys.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/diags/CheckResourceKeys.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6964768 6964461 6964469 6964487 6964460 6964481 6980021
* @summary need test program to validate javac resource bundles
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.code
*/
--- a/langtools/test/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8027789
* @summary check that the direct superclass is used as the site when calling
* a superclass' method
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile Base.java NonDirectSuper.java
* @run main test.NonDirectSuper
*/
--- a/langtools/test/tools/javac/flow/LVTHarness.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/flow/LVTHarness.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* javac crash while creating LVT entry for a local variable defined in
* an inner block
* @library /tools/javac/lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @build JavacTestingAbstractProcessor LVTHarness
* @run main LVTHarness
*/
--- a/langtools/test/tools/javac/generics/bridges/BridgeHarness.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/generics/bridges/BridgeHarness.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8013789
* @summary Compiler should emit bridges in interfaces
* @library /tools/javac/lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.util
* @build JavacTestingAbstractProcessor BridgeHarness
--- a/langtools/test/tools/javac/jvm/ClassRefDupInConstantPoolTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/jvm/ClassRefDupInConstantPoolTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8015927
* @summary Class reference duplicates in constant pool
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @clean ClassRefDupInConstantPoolTest$Duplicates.class
* @run main ClassRefDupInConstantPoolTest
*/
--- a/langtools/test/tools/javac/lambda/ByteCodeTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/lambda/ByteCodeTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8011738
* @author sogoel
* @summary Code translation test for Lambda expressions, method references
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main ByteCodeTest
*/
--- a/langtools/test/tools/javac/lambda/LambdaTestStrictFPFlag.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/lambda/LambdaTestStrictFPFlag.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8046060
* @summary Different results of floating point multiplication for lambda code block
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.io.*;
--- a/langtools/test/tools/javac/lambda/LocalVariableTable.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/lambda/LocalVariableTable.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8025998 8026749 8054220 8058227
* @summary Missing LV table in lambda bodies
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g LocalVariableTable.java
* @run main LocalVariableTable
*/
--- a/langtools/test/tools/javac/lambda/TestInvokeDynamic.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/lambda/TestInvokeDynamic.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* Add back-end support for invokedynamic
* temporarily workaround combo tests are causing time out in several platforms
* @library ../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.code
* jdk.compiler/com.sun.tools.javac.jvm
--- a/langtools/test/tools/javac/lambda/bytecode/TestLambdaBytecode.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/lambda/bytecode/TestLambdaBytecode.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8009649
* @summary Lambda back-end should generate invokespecial for method handles referring to private instance methods
* @library ../../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* @build JavacTestingAbstractThreadedTest
* @run main/othervm TestLambdaBytecode
--- a/langtools/test/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8067422
* @summary Check that the lambda names are not unnecessarily unstable
* @library /tools/lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.main
--- a/langtools/test/tools/javac/linenumbers/ConditionalLineNumberTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/linenumbers/ConditionalLineNumberTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8034091
* @summary Add LineNumberTable attributes for conditional operator (?:) split across several lines.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import com.sun.tools.classfile.ClassFile;
--- a/langtools/test/tools/javac/linenumbers/NestedLineNumberTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/linenumbers/NestedLineNumberTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 8061778
* @summary Wrong LineNumberTable for default constructors
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import com.sun.tools.classfile.ClassFile;
--- a/langtools/test/tools/javac/meth/TestCP.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/meth/TestCP.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6991980
* @summary polymorphic signature calls don't share the same CP entries
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main TestCP
*/
--- a/langtools/test/tools/javac/multicatch/7005371/T7005371.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/multicatch/7005371/T7005371.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 7005371
* @summary Multicatch: assertion error while generating LocalVariableTypeTable attribute
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @compile -g SubTest.java
* @run main T7005371
*/
--- a/langtools/test/tools/javac/multicatch/Pos05.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/multicatch/Pos05.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6943289
* @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* @run main Pos05
*/
--- a/langtools/test/tools/javac/varargs/6199075/T6199075.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/varargs/6199075/T6199075.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @summary Unambiguous varargs method calls flagged as ambiguous
* @author mcimadamore
*
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
--- a/langtools/test/tools/javac/varargs/7042566/T7042566.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javac/varargs/7042566/T7042566.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @summary Unambiguous varargs method calls flagged as ambiguous
* temporarily workaround combo tests are causing time out in several platforms
* @library ../../lib
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.util
* @build JavacTestingAbstractThreadedTest
* @run main/othervm T7042566
--- a/langtools/test/tools/javadoc/CheckResourceKeys.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javadoc/CheckResourceKeys.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8000612
* @summary need test program to validate javadoc resource bundles
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.io.*;
--- a/langtools/test/tools/javap/4111861/T4111861.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/4111861/T4111861.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 4111861
* @summary static final field contents are not displayed
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
public class T4111861 {
public static void main(String... args) throws Exception {
--- a/langtools/test/tools/javap/4870651/T4870651.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/4870651/T4870651.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 4870651 6715757
* @summary javap should recognize generics, varargs, enum;
* javap prints "extends java.lang.Object"
- * @modules jdk.compiler
+ * @modules jdk.jdeps
* @build T4870651 Test
* @run main T4870651
*/
--- a/langtools/test/tools/javap/6937244/T6937244.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/6937244/T6937244.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6937244
* @summary fields display with JVMS names, not Java names
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/6937244/T6937244A.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/6937244/T6937244A.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6937244
* @summary fields display with JVMS names, not Java names
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/8006334/JavapTaskCtorFailWithNPE.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/8006334/JavapTaskCtorFailWithNPE.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8006334
* @summary javap: JavapTask constructor breaks with null pointer exception if
* parameter options is null
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.File;
--- a/langtools/test/tools/javap/8007907/JavapReturns0AfterClassNotFoundTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/8007907/JavapReturns0AfterClassNotFoundTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8007907
* @summary javap, method com.sun.tools.javap.Main.run returns 0 even in case
* of class not found error
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.IOException;
--- a/langtools/test/tools/javap/AccessModifiers.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/AccessModifiers.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8027530
* @summary test -public, -protected, -package, -private options
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/BadAttributeLength.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/BadAttributeLength.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8047072
* @summary javap OOM on fuzzed classfile
- * @modules jdk.compiler
+ * @modules jdk.jdeps
* @run main BadAttributeLength
*/
--- a/langtools/test/tools/javap/BoundsTypeVariableTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/BoundsTypeVariableTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8003537
* @summary javap should not use / in Bounds Type Variables
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.File;
--- a/langtools/test/tools/javap/DescriptorTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/DescriptorTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8007052
* @summary javap should include the descriptor for a method in verbose mode
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.File;
--- a/langtools/test/tools/javap/ExtPath.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/ExtPath.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @bug 6428896
* @summary javap cannot read multiple entries on the extension classpath
* @author Wei Tao
- * @modules jdk.compiler
+ * @modules jdk.jdeps
* @run main/othervm ExtPath com.sun.crypto.provider.SunJCE
*/
--- a/langtools/test/tools/javap/InvalidOptions.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/InvalidOptions.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8027411 8032869
* @summary test an invalid option
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/MethodParameters.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/MethodParameters.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8004727 8005647
* @summary javac should generate method parameters correctly.
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/StackMapTableTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/StackMapTableTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8033930 8033913
* @summary bad formatting of StackMapTable entries
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T4075403.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T4075403.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4075403
* @summary Use javap to inquire about a specific inner class
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
--- a/langtools/test/tools/javap/T4459541.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T4459541.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4459541
* @summary "javap -l" shows line numbers as signed short; they should be unsigned.
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T4501660.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T4501660.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 4501660
* @summary change diagnostic of -help as 'print this help message and exit'
* (actually, verify -help does not cause premature exit)
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T4501661.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T4501661.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @test
* @bug 4501661
* @summary disallow mixing -public, -private, and -protected
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
public class T4501661 {
public static void main(String... args) throws Exception {
--- a/langtools/test/tools/javap/T4777949.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T4777949.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,7 +30,7 @@
* @test
* @bug 4777949
* @summary Warn javap usage on package with simple name
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
public class T4777949 {
public static void main(String... args) throws Exception {
--- a/langtools/test/tools/javap/T4876942.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T4876942.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4876942 6715251
* @summary javap invoked without args does not print help screen
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T4880663.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T4880663.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 4880663 6715757 7031005
* @summary javap could output whitespace between class name and opening brace
* javap prints "extends java.lang.Object"
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
--- a/langtools/test/tools/javap/T4880672.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T4880672.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @test
* @bug 4880672 7031005
* @summary javap does not output inner interfaces of an interface
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T4884240.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T4884240.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 4884240
* @summary additional option required for javap
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T4975569.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T4975569.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4975569 6622215 8034861
* @summary javap doesn't print new flag bits
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6271787.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6271787.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6271787
* @summary javap dumps LocalVariableTypeTable attribute in hex, needs to print a table
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6474890.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6474890.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6474890
* @summary javap does not open .zip files in -classpath
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6587786.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6587786.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6587786
* @summary Javap throws error : "ERROR:Could not find <classname>" for JRE classes
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6622216.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6622216.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6622216
* @summary javap names some attributes incorrectly
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6622232.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6622232.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6622232
* @summary javap gets whitespace confused
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6622260.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6622260.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6622260
* @summary javap prints negative bytes incorrectly in hex
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6715251.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6715251.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @test
* @bug 6715251
* @summary javap should be consistent with javac and return 2 if given no arguments
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
public class T6715251 {
--- a/langtools/test/tools/javap/T6715753.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6715753.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 6715753
* @summary Use javap to inquire about a specific inner class
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
public class T6715753 {
--- a/langtools/test/tools/javap/T6715767.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6715767.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6715767
* @summary javap on java.lang.ClassLoader crashes
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6716452.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6716452.java Mon Jun 01 10:15:20 2015 -0700
@@ -24,7 +24,7 @@
/*
* @test 6716452
* @summary need a method to get an index of an attribute
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6824493.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6824493.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @test
* @bug 6824493
* @summary experimental support for additional info for instructions
- * @modules jdk.compiler
+ * @modules jdk.jdeps
* @compile -g T6824493.java
* @run main T6824493
*/
--- a/langtools/test/tools/javap/T6863746.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6863746.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 6863746
* @summary javap should not scan ct.sym by default
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
public class T6863746 {
--- a/langtools/test/tools/javap/T6866657.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6866657.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @test
* @bug 6866657
* @summary add byteLength() method to primary classfile types
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6868539.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6868539.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 6868539 6868548 8035364
* @summary javap should use current names for constant pool entries,
* remove spurious ';' from constant pool entries
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T6879371.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T6879371.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6879371
* @summary javap does not close internal default file manager
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T7004698.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T7004698.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 7004698
* @summary javap does not output CharacterRangeTable attributes correctly
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T7186925.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T7186925.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 7186925
* @summary JavapTask passes null to java.io.Writer
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.io.*;
--- a/langtools/test/tools/javap/T7190862.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T7190862.java Mon Jun 01 10:15:20 2015 -0700
@@ -3,7 +3,7 @@
* @test /nodynamiccopyright/
* @bug 7190862 7109747
* @summary javap shows an incorrect type for operands if the 'wide' prefix is used
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import com.sun.source.util.JavacTask;
--- a/langtools/test/tools/javap/T8032814.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T8032814.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8032814
* @summary LineNumberTable/LocalVariableTable tables duplication for the
* "-v -l" combination of options
- * @modules jdk.compiler
+ * @modules jdk.jdeps
* @compile -g T8032814.java
* @run main T8032814
*/
--- a/langtools/test/tools/javap/T8032819.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T8032819.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8032819
* @summary Extra empty line between field declarations for the "-v -c" and "-v -l" combination of options
- * @modules jdk.compiler
+ * @modules jdk.jdeps
* @compile -g T8032819.java
* @run main T8032819
*/
--- a/langtools/test/tools/javap/T8033180.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T8033180.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8033180
* @summary Bad newline characters
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T8033711.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T8033711.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8033711
* @summary An exception is thrown if using the "-classpath" option with no arguments
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
--- a/langtools/test/tools/javap/T8035104.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T8035104.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8035104
* @summary reorder class file attributes in javap listing
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/T8038414.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/T8038414.java Mon Jun 01 10:15:20 2015 -0700
@@ -32,7 +32,7 @@
* @test
* @bug 8038414
* @summary Constant pool's strings are not escaped properly
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
public class T8038414 {
private static final String NEW_LINE = System.getProperty("line.separator");
--- a/langtools/test/tools/javap/TestSuperclass.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/TestSuperclass.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 7031005
* @summary javap prints "extends java.lang.Object"
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.File;
--- a/langtools/test/tools/javap/WhitespaceTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/WhitespaceTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8033581 8033798 8033726
* @summary Check whitespace in generated output
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
import java.io.*;
--- a/langtools/test/tools/javap/classfile/T6887895.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/classfile/T6887895.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 6887895
* @summary CONSTANT_Class_info getBaseName does not handle arrays of primitives correctly
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
import java.io.*;
--- a/langtools/test/tools/javap/classfile/deps/T6907575.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/classfile/deps/T6907575.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
/*
* @test
* @bug 6907575
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.file
* jdk.compiler/com.sun.tools.javac.util
* @build GetDeps p.C1
--- a/langtools/test/tools/javap/typeAnnotations/JSR175Annotations.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/typeAnnotations/JSR175Annotations.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @test JSR175Annotations
* @bug 6843077
* @summary test that only type annotations are recorded as such in classfile
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class JSR175Annotations {
--- a/langtools/test/tools/javap/typeAnnotations/NewArray.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/typeAnnotations/NewArray.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @test NewArray
* @bug 6843077
* @summary Test type annotations on local array are in method's code attribute.
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class NewArray {
--- a/langtools/test/tools/javap/typeAnnotations/Presence.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/typeAnnotations/Presence.java Mon Jun 01 10:15:20 2015 -0700
@@ -30,7 +30,7 @@
* @test Presence
* @bug 6843077
* @summary test that all type annotations are present in the classfile
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class Presence {
--- a/langtools/test/tools/javap/typeAnnotations/PresenceInner.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/typeAnnotations/PresenceInner.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @test PresenceInner
* @bug 6843077
* @summary test that annotations in inner types count only once
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class PresenceInner {
--- a/langtools/test/tools/javap/typeAnnotations/T6855990.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/typeAnnotations/T6855990.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,7 +27,7 @@
* @test
* @bug 6855990
* @summary InstructionDetailWriter should support new 308 annotations attribute
- * @modules jdk.compiler
+ * @modules jdk.jdeps
*/
public class T6855990 {
--- a/langtools/test/tools/javap/typeAnnotations/TypeCasts.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/typeAnnotations/TypeCasts.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,7 +29,7 @@
* @bug 6843077
* @summary test that typecasts annotation are emitted if only the cast
* expression is optimized away
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class TypeCasts {
--- a/langtools/test/tools/javap/typeAnnotations/Visibility.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/typeAnnotations/Visibility.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @test Visibility
* @bug 6843077
* @summary test that type annotations are recorded in the classfile
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class Visibility {
--- a/langtools/test/tools/javap/typeAnnotations/Wildcards.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/javap/typeAnnotations/Wildcards.java Mon Jun 01 10:15:20 2015 -0700
@@ -28,7 +28,7 @@
* @test Wildcards
* @bug 6843077
* @summary test that annotations target wildcards get emitted to classfile
- * @modules jdk.compiler/com.sun.tools.classfile
+ * @modules jdk.jdeps/com.sun.tools.classfile
*/
public class Wildcards {
public static void main(String[] args) throws Exception {
--- a/langtools/test/tools/jdeps/APIDeps.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/jdeps/APIDeps.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,8 +27,8 @@
* @summary Test -apionly and -jdkinternals options
* @modules java.base/sun.misc
* java.management
- * jdk.compiler/com.sun.tools.classfile
- * jdk.dev/com.sun.tools.jdeps
+ * jdk.jdeps/com.sun.tools.classfile
+ * jdk.jdeps/com.sun.tools.jdeps
* @build m.Bar m.Foo m.Gee b.B c.C c.I d.D e.E f.F g.G
* @run main APIDeps
*/
--- a/langtools/test/tools/jdeps/Basic.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/jdeps/Basic.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8003562 8005428 8015912 8027481 8048063 8068937
* @summary Basic tests for jdeps tool
* @modules java.management
- * jdk.dev/com.sun.tools.jdeps
+ * jdk.jdeps/com.sun.tools.jdeps
* @build Test p.Foo p.Bar p.C p.SubClass q.Gee javax.activity.NotCompactProfile
* @run main Basic
*/
--- a/langtools/test/tools/jdeps/DotFileTest.java Thu May 28 11:37:13 2015 -0700
+++ b/langtools/test/tools/jdeps/DotFileTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -26,7 +26,7 @@
* @bug 8003562
* @summary Basic tests for jdeps -dotoutput option
* @modules java.management
- * jdk.dev/com.sun.tools.jdeps
+ * jdk.jdeps/com.sun.tools.jdeps
* @build Test p.Foo p.Bar javax.activity.NotCompactProfile
* @run main DotFileTest
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/VerboseFormat/JdepsDependencyClosure.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,496 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * @test
+ * @bug 8080608
+ * @summary Test that jdeps verbose output has a summary line when dependencies
+ * are found within the same archive. For each testcase, compare the
+ * result obtained from jdeps with the expected result.
+ * @modules jdk.jdeps/com.sun.tools.jdeps
+ * @build use.indirect.DontUseUnsafe2
+ * @build use.indirect.UseUnsafeIndirectly
+ * @build use.indirect2.DontUseUnsafe3
+ * @build use.indirect2.UseUnsafeIndirectly2
+ * @build use.unsafe.DontUseUnsafe
+ * @build use.unsafe.UseClassWithUnsafe
+ * @build use.unsafe.UseUnsafeClass
+ * @build use.unsafe.UseUnsafeClass2
+ * @run main JdepsDependencyClosure --test:0
+ * @run main JdepsDependencyClosure --test:1
+ * @run main JdepsDependencyClosure --test:2
+ * @run main JdepsDependencyClosure --test:3
+ */
+public class JdepsDependencyClosure {
+
+ static boolean VERBOSE = false;
+ static boolean COMPARE_TEXT = true;
+
+ static final String JDEPS_SUMMARY_TEXT_FORMAT = "%s -> %s%n";
+ static final String JDEPS_VERBOSE_TEXT_FORMAT = " %-50s -> %-50s %s%n";
+
+ /**
+ * Helper class used to store arguments to pass to
+ * {@code JdepsDependencyClosure.test} as well as expected
+ * results.
+ */
+ static class TestCaseData {
+ final Map<String, Set<String>> expectedDependencies;
+ final String expectedText;
+ final String[] args;
+ final boolean closure;
+
+ TestCaseData(Map<String, Set<String>> expectedDependencies,
+ String expectedText,
+ boolean closure,
+ String[] args) {
+ this.expectedDependencies = expectedDependencies;
+ this.expectedText = expectedText;
+ this.closure = closure;
+ this.args = args;
+ }
+
+ public void test() {
+ if (expectedDependencies != null) {
+ String format = closure
+ ? "Running (closure): jdeps %s %s %s %s"
+ : "Running: jdeps %s %s %s %s";
+ System.out.println(String.format(format, (Object[])args));
+ }
+ JdepsDependencyClosure.test(args, expectedDependencies, expectedText, closure);
+ }
+
+ /**
+ * Make a new test case data to invoke jdeps and test its output.
+ * @param pattern The pattern that will passed through to jdeps -e
+ * This is expected to match only one class.
+ * @param arcPath The archive to analyze. A jar or a class directory.
+ * @param classes For each reported archive dependency couple, the
+ * expected list of classes in the source that will
+ * be reported as having a dependency on the class
+ * in the target that matches the given pattern.
+ * @param dependencies For each archive dependency couple, a singleton list
+ * containing the name of the class in the target that
+ * matches the pattern. It is expected that the pattern
+ * will match only one class in the target.
+ * If the pattern matches several classes the
+ * expected text may no longer match the jdeps output.
+ * @param archives A list of archive dependency couple in the form
+ * {{sourceName1, sourcePath1, targetDescription1, targetPath1}
+ * {sourceName2, sourcePath2, targetDescription2, targetPath2}
+ * ... }
+ * For a JDK module - e.g. java.base, the targetDescription
+ * is usually something like "JDK internal API (java.base)"
+ * and the targetPath is usually the module name "java.base".
+ * @param closure Whether jdeps should be recursively invoked to build
+ * the closure.
+ * @return An instance of TestCaseData containing all the information
+ * needed to perform the jdeps invokation and test its output.
+ */
+ public static TestCaseData make(String pattern, String arcPath, String[][] classes,
+ String[][] dependencies, String[][] archives, boolean closure) {
+ final String[] args = new String[] {
+ "-e", pattern, "-v", arcPath
+ };
+ Map<String, Set<String>> expected = new HashMap<>();
+ String expectedText = "";
+ for (int i=0; i<classes.length; i++) {
+ final int index = i;
+ expectedText += Stream.of(classes[i])
+ .map((cn) -> String.format(JDEPS_VERBOSE_TEXT_FORMAT, cn,
+ dependencies[index][0], archives[index][2]))
+ .reduce(String.format(JDEPS_SUMMARY_TEXT_FORMAT, archives[i][0],
+ archives[index][3]), (s1,s2) -> s1.concat(s2));
+ for (String cn : classes[index]) {
+ expected.putIfAbsent(cn, new HashSet<>());
+ expected.get(cn).add(dependencies[index][0]);
+ }
+ }
+ return new TestCaseData(expected, expectedText, closure, args);
+ }
+
+ public static TestCaseData valueOf(String[] args) {
+ if (args.length == 1 && args[0].startsWith("--test:")) {
+ // invoked from jtreg. build test case data for selected test.
+ int index = Integer.parseInt(args[0].substring("--test:".length()));
+ if (index >= dataSuppliers.size()) {
+ throw new RuntimeException("No such test case: " + index
+ + " - available testcases are [0.."
+ + (dataSuppliers.size()-1) + "]");
+ }
+ return dataSuppliers.get(index).get();
+ } else {
+ // invoked in standalone. just take the given argument
+ // and perform no validation on the output (except that it
+ // must start with a summary line)
+ return new TestCaseData(null, null, true, args);
+ }
+ }
+
+ }
+
+ static TestCaseData makeTestCaseOne() {
+ final String arcPath = System.getProperty("test.classes", "build/classes");
+ final String arcName = Paths.get(arcPath).getFileName().toString();
+ final String[][] classes = new String[][] {
+ {"use.indirect2.UseUnsafeIndirectly2", "use.unsafe.UseClassWithUnsafe"},
+ };
+ final String[][] dependencies = new String[][] {
+ {"use.unsafe.UseUnsafeClass"},
+ };
+ final String[][] archives = new String[][] {
+ {arcName, arcPath, arcName, arcPath},
+ };
+ return TestCaseData.make("use.unsafe.UseUnsafeClass", arcPath, classes,
+ dependencies, archives, false);
+ }
+
+ static TestCaseData makeTestCaseTwo() {
+ String arcPath = System.getProperty("test.classes", "build/classes");
+ String arcName = Paths.get(arcPath).getFileName().toString();
+ String[][] classes = new String[][] {
+ {"use.unsafe.UseUnsafeClass", "use.unsafe.UseUnsafeClass2"}
+ };
+ String[][] dependencies = new String[][] {
+ {"sun.misc.Unsafe"}
+ };
+ String[][] archive = new String[][] {
+ {arcName, arcPath, "JDK internal API (java.base)", "java.base"},
+ };
+ return TestCaseData.make("sun.misc.Unsafe", arcPath, classes,
+ dependencies, archive, false);
+ }
+
+ static TestCaseData makeTestCaseThree() {
+ final String arcPath = System.getProperty("test.classes", "build/classes");
+ final String arcName = Paths.get(arcPath).getFileName().toString();
+ final String[][] classes = new String[][] {
+ {"use.indirect2.UseUnsafeIndirectly2", "use.unsafe.UseClassWithUnsafe"},
+ {"use.indirect.UseUnsafeIndirectly"}
+ };
+ final String[][] dependencies = new String[][] {
+ {"use.unsafe.UseUnsafeClass"},
+ {"use.unsafe.UseClassWithUnsafe"}
+ };
+ final String[][] archives = new String[][] {
+ {arcName, arcPath, arcName, arcPath},
+ {arcName, arcPath, arcName, arcPath}
+ };
+ return TestCaseData.make("use.unsafe.UseUnsafeClass", arcPath, classes,
+ dependencies, archives, true);
+ }
+
+
+ static TestCaseData makeTestCaseFour() {
+ final String arcPath = System.getProperty("test.classes", "build/classes");
+ final String arcName = Paths.get(arcPath).getFileName().toString();
+ final String[][] classes = new String[][] {
+ {"use.unsafe.UseUnsafeClass", "use.unsafe.UseUnsafeClass2"},
+ {"use.indirect2.UseUnsafeIndirectly2", "use.unsafe.UseClassWithUnsafe"},
+ {"use.indirect.UseUnsafeIndirectly"}
+ };
+ final String[][] dependencies = new String[][] {
+ {"sun.misc.Unsafe"},
+ {"use.unsafe.UseUnsafeClass"},
+ {"use.unsafe.UseClassWithUnsafe"}
+ };
+ final String[][] archives = new String[][] {
+ {arcName, arcPath, "JDK internal API (java.base)", "java.base"},
+ {arcName, arcPath, arcName, arcPath},
+ {arcName, arcPath, arcName, arcPath}
+ };
+ return TestCaseData.make("sun.misc.Unsafe", arcPath, classes, dependencies,
+ archives, true);
+ }
+
+ static final List<Supplier<TestCaseData>> dataSuppliers = Arrays.asList(
+ JdepsDependencyClosure::makeTestCaseOne,
+ JdepsDependencyClosure::makeTestCaseTwo,
+ JdepsDependencyClosure::makeTestCaseThree,
+ JdepsDependencyClosure::makeTestCaseFour
+ );
+
+
+
+ /**
+ * The OutputStreamParser is used to parse the format of jdeps.
+ * It is thus dependent on that format.
+ */
+ static class OutputStreamParser extends OutputStream {
+ // OutputStreamParser will populate this map:
+ //
+ // For each archive, a list of class in where dependencies where
+ // found...
+ final Map<String, Set<String>> deps;
+ final StringBuilder text = new StringBuilder();
+
+ StringBuilder[] lines = { new StringBuilder(), new StringBuilder() };
+ int line = 0;
+ int sepi = 0;
+ char[] sep;
+
+ public OutputStreamParser(Map<String, Set<String>> deps) {
+ this.deps = deps;
+ this.sep = System.getProperty("line.separator").toCharArray();
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ lines[line].append((char)b);
+ if (b == sep[sepi]) {
+ if (++sepi == sep.length) {
+ text.append(lines[line]);
+ if (lines[0].toString().startsWith(" ")) {
+ throw new RuntimeException("Bad formatting: "
+ + "summary line missing for\n"+lines[0]);
+ }
+ // Usually the output looks like that:
+ // <archive-1> -> java.base
+ // <class-1> -> <dependency> <dependency description>
+ // <class-2> -> <dependency> <dependency description>
+ // ...
+ // <archive-2> -> java.base
+ // <class-3> -> <dependency> <dependency description>
+ // <class-4> -> <dependency> <dependency description>
+ // ...
+ //
+ // We want to keep the <archive> line in lines[0]
+ // and have the ith <class-i> line in lines[1]
+ if (line == 1) {
+ // we have either a <class> line or an <archive> line.
+ String line1 = lines[0].toString();
+ String line2 = lines[1].toString();
+ if (line2.startsWith(" ")) {
+ // we have a class line, record it.
+ parse(line1, line2);
+ // prepare for next <class> line.
+ lines[1] = new StringBuilder();
+ } else {
+ // We have an archive line: We are switching to the next archive.
+ // put the new <archive> line in lines[0], and prepare
+ // for reading the next <class> line
+ lines[0] = lines[1];
+ lines[1] = new StringBuilder();
+ }
+ } else {
+ // we just read the first <archive> line.
+ // prepare to read <class> lines.
+ line = 1;
+ }
+ sepi = 0;
+ }
+ } else {
+ sepi = 0;
+ }
+ }
+
+ // Takes a couple of lines, where line1 is an <archive> line and
+ // line 2 is a <class> line. Parses the line to extract the archive
+ // name and dependent class name, and record them in the map...
+ void parse(String line1, String line2) {
+ String archive = line1.substring(0, line1.indexOf(" -> "));
+ int l2ArrowIndex = line2.indexOf(" -> ");
+ String className = line2.substring(2, l2ArrowIndex).replace(" ", "");
+ String depdescr = line2.substring(l2ArrowIndex + 4);
+ String depclass = depdescr.substring(0, depdescr.indexOf(" "));
+ deps.computeIfAbsent(archive, (k) -> new HashSet<>());
+ deps.get(archive).add(className);
+ if (VERBOSE) {
+ System.out.println(archive+": "+className+" depends on "+depclass);
+ }
+ }
+
+ }
+
+ /**
+ * The main method.
+ *
+ * Can be run in two modes:
+ * <ul>
+ * <li>From jtreg: expects 1 argument in the form {@code --test:<test-nb>}</li>
+ * <li>From command line: expected syntax is {@code -e <pattern> -v jar [jars..]}</li>
+ * </ul>
+ * <p>When called from the command line this method will call jdeps recursively
+ * to build a closure of the dependencies on {@code <pattern>} and print a summary.
+ * <p>When called from jtreg - it will call jdeps either once only or
+ * recursively depending on the pattern.
+ * @param args either {@code --test:<test-nb>} or {@code -e <pattern> -v jar [jars..]}.
+ */
+ public static void main(String[] args) {
+ runWithLocale(Locale.ENGLISH, TestCaseData.valueOf(args)::test);
+ }
+
+ private static void runWithLocale(Locale loc, Runnable run) {
+ final Locale defaultLocale = Locale.getDefault();
+ Locale.setDefault(loc);
+ try {
+ run.run();
+ } finally {
+ Locale.setDefault(defaultLocale);
+ }
+ }
+
+
+ public static void test(String[] args, Map<String, Set<String>> expected,
+ String expectedText, boolean closure) {
+ try {
+ doTest(args, expected, expectedText, closure);
+ } catch (Throwable t) {
+ try {
+ printDiagnostic(args, expectedText, t, closure);
+ } catch(Throwable tt) {
+ throw t;
+ }
+ throw t;
+ }
+ }
+
+ static class TextFormatException extends RuntimeException {
+ final String expected;
+ final String actual;
+ TextFormatException(String message, String expected, String actual) {
+ super(message);
+ this.expected = expected;
+ this.actual = actual;
+ }
+ }
+
+ public static void printDiagnostic(String[] args, String expectedText,
+ Throwable t, boolean closure) {
+ if (expectedText != null || t instanceof TextFormatException) {
+ System.err.println("===== TEST FAILED =======");
+ System.err.println("command: " + Stream.of(args)
+ .reduce("jdeps", (s1,s2) -> s1.concat(" ").concat(s2)));
+ System.err.println("===== Expected Output =======");
+ System.err.append(expectedText);
+ System.err.println("===== Command Output =======");
+ if (t instanceof TextFormatException) {
+ System.err.print(((TextFormatException)t).actual);
+ } else {
+ com.sun.tools.jdeps.Main.run(args, new PrintWriter(System.err));
+ if (closure) System.err.println("... (closure not available) ...");
+ }
+ System.err.println("=============================");
+ }
+ }
+
+ public static void doTest(String[] args, Map<String, Set<String>> expected,
+ String expectedText, boolean closure) {
+ if (args.length < 3 || !"-e".equals(args[0]) || !"-v".equals(args[2])) {
+ System.err.println("Syntax: -e <classname> -v [list of jars or directories]");
+ return;
+ }
+ Map<String, Map<String, Set<String>>> alldeps = new HashMap<>();
+ String depName = args[1];
+ List<String> search = new ArrayList<>();
+ search.add(depName);
+ Set<String> searched = new LinkedHashSet<>();
+ StringBuilder text = new StringBuilder();
+ while(!search.isEmpty()) {
+ args[1] = search.remove(0);
+ if (VERBOSE) {
+ System.out.println("Looking for " + args[1]);
+ }
+ searched.add(args[1]);
+ Map<String, Set<String>> deps =
+ alldeps.computeIfAbsent(args[1], (k) -> new HashMap<>());
+ OutputStreamParser parser = new OutputStreamParser(deps);
+ PrintWriter writer = new PrintWriter(parser);
+ com.sun.tools.jdeps.Main.run(args, writer);
+ if (VERBOSE) {
+ System.out.println("Found: " + deps.values().stream()
+ .flatMap(s -> s.stream()).collect(Collectors.toSet()));
+ }
+ if (expectedText != null) {
+ text.append(parser.text.toString());
+ }
+ search.addAll(deps.values().stream()
+ .flatMap(s -> s.stream())
+ .filter(k -> !searched.contains(k))
+ .collect(Collectors.toSet()));
+ if (!closure) break;
+ }
+
+ // Print summary...
+ final Set<String> classes = alldeps.values().stream()
+ .flatMap((m) -> m.values().stream())
+ .flatMap(s -> s.stream()).collect(Collectors.toSet());
+ Map<String, Set<String>> result = new HashMap<>();
+ for (String c : classes) {
+ Set<String> archives = new HashSet<>();
+ Set<String> dependencies = new HashSet<>();
+ for (String d : alldeps.keySet()) {
+ Map<String, Set<String>> m = alldeps.get(d);
+ for (String a : m.keySet()) {
+ Set<String> s = m.get(a);
+ if (s.contains(c)) {
+ archives.add(a);
+ dependencies.add(d);
+ }
+ }
+ }
+ result.put(c, dependencies);
+ System.out.println(c + " " + archives + " depends on " + dependencies);
+ }
+
+ // If we're in jtreg, then check result (expectedText != null)
+ if (expectedText != null && COMPARE_TEXT) {
+ //text.append(String.format("%n"));
+ if (text.toString().equals(expectedText)) {
+ System.out.println("SUCCESS - got expected text");
+ } else {
+ throw new TextFormatException("jdeps output is not as expected",
+ expectedText, text.toString());
+ }
+ }
+ if (expected != null) {
+ if (expected.equals(result)) {
+ System.out.println("SUCCESS - found expected dependencies");
+ } else if (expectedText == null) {
+ throw new RuntimeException("Bad dependencies: Expected " + expected
+ + " but found " + result);
+ } else {
+ throw new TextFormatException("Bad dependencies: Expected "
+ + expected
+ + " but found " + result,
+ expectedText, text.toString());
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/VerboseFormat/use/indirect/DontUseUnsafe2.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+package use.indirect;
+
+import use.unsafe.*;
+
+public class DontUseUnsafe2 {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/VerboseFormat/use/indirect/UseUnsafeIndirectly.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+package use.indirect;
+
+import use.unsafe.UseClassWithUnsafe;
+
+public class UseUnsafeIndirectly {
+ static UseClassWithUnsafe use = new UseClassWithUnsafe();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/VerboseFormat/use/indirect2/DontUseUnsafe3.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+package use.indirect2;
+
+import use.unsafe.*;
+
+public class DontUseUnsafe3 {
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/VerboseFormat/use/indirect2/UseUnsafeIndirectly2.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+package use.indirect2;
+
+import use.unsafe.UseUnsafeClass;
+
+public class UseUnsafeIndirectly2 {
+ static UseUnsafeClass use = new UseUnsafeClass();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/VerboseFormat/use/unsafe/DontUseUnsafe.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+package use.unsafe;
+
+public class DontUseUnsafe {
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/VerboseFormat/use/unsafe/UseClassWithUnsafe.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,7 @@
+package use.unsafe;
+
+public class UseClassWithUnsafe {
+
+ static UseUnsafeClass use = new UseUnsafeClass();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/VerboseFormat/use/unsafe/UseUnsafeClass.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+package use.unsafe;
+
+import sun.misc.Unsafe;
+
+public class UseUnsafeClass {
+ static Unsafe unsafe = Unsafe.getUnsafe();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/VerboseFormat/use/unsafe/UseUnsafeClass2.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+package use.unsafe;
+
+import sun.misc.Unsafe;
+
+public class UseUnsafeClass2 {
+ static Unsafe unsafe = Unsafe.getUnsafe();
+
+}
--- a/make/CheckModules.gmk Thu May 28 11:37:13 2015 -0700
+++ b/make/CheckModules.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -29,7 +29,7 @@
include $(SPEC)
include MakeBase.gmk
-JDEPS_MODULES_XML := $(JDK_OUTPUTDIR)/modules/jdk.dev/com/sun/tools/jdeps/resources/jdeps-modules.xml
+JDEPS_MODULES_XML := $(JDK_OUTPUTDIR)/modules/jdk.jdeps/com/sun/tools/jdeps/resources/jdeps-modules.xml
#
# Verify access across module boundaries
--- a/make/CompileJavaModules.gmk Thu May 28 11:37:13 2015 -0700
+++ b/make/CompileJavaModules.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -412,6 +412,12 @@
################################################################################
+jdk.jdeps_CLEAN_FILES := $(wildcard \
+ $(JDK_TOPDIR)/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/*.properties \
+ $(JDK_TOPDIR)/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/*.properties)
+
+################################################################################
+
jdk.jdi_EXCLUDES += \
com/sun/tools/example/debug/bdi \
com/sun/tools/example/debug/event \
--- a/make/Images.gmk Thu May 28 11:37:13 2015 -0700
+++ b/make/Images.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -46,7 +46,7 @@
# tools
TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev jdk.javadoc jdk.jcmd jdk.jconsole \
- jdk.hotspot.agent jdk.hprof.agent jdk.jartool jdk.jdi jdk.jdwp.agent \
+ jdk.hotspot.agent jdk.hprof.agent jdk.jartool jdk.jdeps jdk.jdi jdk.jdwp.agent \
jdk.policytool jdk.rmic jdk.xml.bind jdk.xml.ws
ifeq ($(OPENJDK_TARGET_OS), windows)
@@ -221,7 +221,6 @@
jstack.1 \
jstat.1 \
jstatd.1 \
- native2ascii.1 \
policytool.1 \
rmic.1 \
schemagen.1 \
--- a/make/Main.gmk Thu May 28 11:37:13 2015 -0700
+++ b/make/Main.gmk Mon Jun 01 10:15:20 2015 -0700
@@ -412,7 +412,7 @@
# Explicitly add dependencies for special targets
java.base-java: unpack-sec
- jdk.dev-gendata: java rmic
+ jdk.jdeps-gendata: java rmic
zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
$(filter jdk.crypto%, $(JAVA_TARGETS))
--- a/modules.xml Thu May 28 11:37:13 2015 -0700
+++ b/modules.xml Mon Jun 01 10:15:20 2015 -0700
@@ -1523,16 +1523,6 @@
<name>com.sun.tools.javac</name>
</export>
<export>
- <name>com.sun.tools.javah</name>
- </export>
- <export>
- <name>com.sun.tools.javap</name>
- </export>
- <export>
- <name>com.sun.tools.classfile</name>
- <to>jdk.dev</to>
- </export>
- <export>
<name>com.sun.tools.doclint</name>
<to>jdk.javadoc</to>
</export>
@@ -1551,6 +1541,7 @@
<export>
<name>com.sun.tools.javac.file</name>
<to>jdk.javadoc</to>
+ <to>jdk.jdeps</to>
</export>
<export>
<name>com.sun.tools.javac.jvm</name>
@@ -1575,6 +1566,7 @@
<export>
<name>com.sun.tools.javac.util</name>
<to>jdk.javadoc</to>
+ <to>jdk.jdeps</to>
</export>
</module>
<module>
@@ -1607,8 +1599,6 @@
<module>
<name>jdk.dev</name>
<depend>java.base</depend>
- <depend>java.xml</depend>
- <depend>jdk.compiler</depend>
</module>
<module>
<name>jdk.hotspot.agent</name>
@@ -1678,6 +1668,13 @@
</export>
</module>
<module>
+ <name>jdk.jdeps</name>
+ <depend>java.base</depend>
+ <depend>java.compiler</depend>
+ <depend>java.xml</depend>
+ <depend>jdk.compiler</depend>
+ </module>
+ <module>
<name>jdk.jdi</name>
<depend>java.base</depend>
<depend>jdk.attach</depend>
--- a/nashorn/.hgtags Thu May 28 11:37:13 2015 -0700
+++ b/nashorn/.hgtags Mon Jun 01 10:15:20 2015 -0700
@@ -299,3 +299,4 @@
bc8e67bec2f92772c4a67e20e66a4f216207f0af jdk9-b63
00df6e4fc75a83bdd958f9ef86d80e008c9ba967 jdk9-b64
2054d01ae32649d3179e93d14108fdd6259c1c0d jdk9-b65
+9dd95cff9dae897e8dee712f1f0303c460262288 jdk9-b66
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java Thu May 28 11:37:13 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java Mon Jun 01 10:15:20 2015 -0700
@@ -106,7 +106,12 @@
return new NativeArrayBuffer(0);
}
- return new NativeArrayBuffer(JSType.toInt32(args[0]));
+ final Object arg0 = args[0];
+ if (arg0 instanceof ByteBuffer) {
+ return new NativeArrayBuffer((ByteBuffer)arg0);
+ } else {
+ return new NativeArrayBuffer(JSType.toInt32(arg0));
+ }
}
private static ByteBuffer cloneBuffer(final ByteBuffer original, final int begin, final int end) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java Thu May 28 11:37:13 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java Mon Jun 01 10:15:20 2015 -0700
@@ -27,11 +27,13 @@
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Deque;
import java.util.List;
+import java.util.Queue;
import jdk.internal.dynalink.beans.StaticClass;
import jdk.internal.dynalink.support.TypeUtilities;
import jdk.nashorn.api.scripting.JSObject;
@@ -337,7 +339,8 @@
/**
* Given a script object and a Java type, converts the script object into the desired Java type. Currently it
- * performs shallow creation of Java arrays, as well as wrapping of objects in Lists and Dequeues. Example:
+ * performs shallow creation of Java arrays, as well as wrapping of objects in Lists, Dequeues, Queues,
+ * and Collections. Example:
* <pre>
* var anArray = [1, "13", false]
* var javaIntArray = Java.to(anArray, "int[]")
@@ -351,9 +354,10 @@
* object to create. Can not be null. If undefined, a "default" conversion is presumed (allowing the argument to be
* omitted).
* @return a Java object whose value corresponds to the original script object's value. Specifically, for array
- * target types, returns a Java array of the same type with contents converted to the array's component type. Does
- * not recursively convert for multidimensional arrays. For {@link List} or {@link Deque}, returns a live wrapper
- * around the object, see {@link ListAdapter} for details. Returns null if obj is null.
+ * target types, returns a Java array of the same type with contents converted to the array's component type.
+ * Converts recursively when the target type is multidimensional array. For {@link List}, {@link Deque},
+ * {@link Queue}, or {@link Collection}, returns a live wrapper around the object, see {@link ListAdapter} for
+ * details. Returns null if obj is null.
* @throws ClassNotFoundException if the class described by objType is not found
*/
@Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
@@ -383,7 +387,7 @@
return JSType.toJavaArray(obj, targetClass.getComponentType());
}
- if(targetClass == List.class || targetClass == Deque.class) {
+ if (targetClass == List.class || targetClass == Deque.class || targetClass == Queue.class || targetClass == Collection.class) {
return ListAdapter.create(obj);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSObjectListAdapter.java Thu May 28 11:37:13 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, 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.
- */
-
-package jdk.nashorn.internal.runtime;
-
-import jdk.nashorn.api.scripting.JSObject;
-
-/**
- * A ListAdapter that can wraps a JSObject.
- */
-public final class JSObjectListAdapter extends ListAdapter {
- /**
- * Creates a new list wrapper for the specified JSObject.
- * @param obj JSOcript the object to wrap
- */
- public JSObjectListAdapter(final JSObject obj) {
- super(obj);
- }
-
- @Override
- public int size() {
- return JSType.toInt32(((JSObject)obj).getMember("length"));
- }
-
- @Override
- protected Object getAt(final int index) {
- return ((JSObject)obj).getSlot(index);
- }
-
- @Override
- protected void setAt(final int index, final Object element) {
- ((JSObject)obj).setSlot(index, element);
- }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java Thu May 28 11:37:13 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java Mon Jun 01 10:15:20 2015 -0700
@@ -34,7 +34,6 @@
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Deque;
import java.util.List;
import jdk.internal.dynalink.beans.StaticClass;
import jdk.nashorn.api.scripting.JSObject;
@@ -201,12 +200,6 @@
/** Method handle to convert a JS Object to a Java array. */
public static final Call TO_JAVA_ARRAY = staticCall(JSTYPE_LOOKUP, JSType.class, "toJavaArray", Object.class, Object.class, Class.class);
- /** Method handle to convert a JS Object to a Java List. */
- public static final Call TO_JAVA_LIST = staticCall(JSTYPE_LOOKUP, JSType.class, "toJavaList", List.class, Object.class);
-
- /** Method handle to convert a JS Object to a Java deque. */
- public static final Call TO_JAVA_DEQUE = staticCall(JSTYPE_LOOKUP, JSType.class, "toJavaDeque", Deque.class, Object.class);
-
/** Method handle for void returns. */
public static final Call VOID_RETURN = staticCall(JSTYPE_LOOKUP, JSType.class, "voidReturn", void.class);
@@ -1351,24 +1344,6 @@
}
/**
- * Converts a JavaScript object to a Java List. See {@link ListAdapter} for details.
- * @param obj the object to convert. Can be any array-like object.
- * @return a List that is live-backed by the JavaScript object.
- */
- public static List<?> toJavaList(final Object obj) {
- return ListAdapter.create(obj);
- }
-
- /**
- * Converts a JavaScript object to a Java Deque. See {@link ListAdapter} for details.
- * @param obj the object to convert. Can be any array-like object.
- * @return a Deque that is live-backed by the JavaScript object.
- */
- public static Deque<?> toJavaDeque(final Object obj) {
- return ListAdapter.create(obj);
- }
-
- /**
* Check if an object is null or undefined
*
* @param obj object to check
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ListAdapter.java Thu May 28 11:37:13 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ListAdapter.java Mon Jun 01 10:15:20 2015 -0700
@@ -25,17 +25,19 @@
package jdk.nashorn.internal.runtime;
+import java.lang.invoke.MethodHandle;
import java.util.AbstractList;
import java.util.Deque;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
+import java.util.Objects;
import java.util.RandomAccess;
import java.util.concurrent.Callable;
import jdk.nashorn.api.scripting.JSObject;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.internal.objects.Global;
import jdk.nashorn.internal.runtime.linker.Bootstrap;
-import jdk.nashorn.internal.runtime.linker.InvokeByName;
/**
* An adapter that can wrap any ECMAScript Array-like object (that adheres to the array rules for the property
@@ -50,82 +52,47 @@
* operations respectively, while {@link #addLast(Object)} and {@link #removeLast()} will translate to {@code push} and
* {@code pop}.
*/
-public abstract class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> {
- // These add to the back and front of the list
- private static final Object PUSH = new Object();
- private static InvokeByName getPUSH() {
- return Context.getGlobal().getInvokeByName(PUSH,
- new Callable<InvokeByName>() {
- @Override
- public InvokeByName call() {
- return new InvokeByName("push", Object.class, void.class, Object.class);
- }
- });
- }
+public final class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> {
+ // Invoker creator for methods that add to the start or end of the list: PUSH and UNSHIFT. Takes fn, this, and value, returns void.
+ private static final Callable<MethodHandle> ADD_INVOKER_CREATOR = invokerCreator(void.class, Object.class, JSObject.class, Object.class);
+ // PUSH adds to the start of the list
+ private static final Object PUSH = new Object();
+ // UNSHIFT adds to the end of the list
private static final Object UNSHIFT = new Object();
- private static InvokeByName getUNSHIFT() {
- return Context.getGlobal().getInvokeByName(UNSHIFT,
- new Callable<InvokeByName>() {
- @Override
- public InvokeByName call() {
- return new InvokeByName("unshift", Object.class, void.class, Object.class);
- }
- });
- }
+
+ // Invoker creator for methods that remove from the tail or head of the list: POP and SHIFT. Takes fn, this, returns Object.
+ private static final Callable<MethodHandle> REMOVE_INVOKER_CREATOR = invokerCreator(Object.class, Object.class, JSObject.class);
+
+ // POP removes from the start of the list
+ private static final Object POP = new Object();
+ // SHIFT removes from the end of the list
+ private static final Object SHIFT = new Object();
+
+ // SPLICE can be used to add a value in the middle of the list.
+ private static final Object SPLICE_ADD = new Object();
+ private static final Callable<MethodHandle> SPLICE_ADD_INVOKER_CREATOR = invokerCreator(void.class, Object.class, JSObject.class, int.class, int.class, Object.class);
- // These remove from the back and front of the list
- private static final Object POP = new Object();
- private static InvokeByName getPOP() {
- return Context.getGlobal().getInvokeByName(POP,
- new Callable<InvokeByName>() {
- @Override
- public InvokeByName call() {
- return new InvokeByName("pop", Object.class, Object.class);
- }
- });
+ // SPLICE can also be used to remove values from the middle of the list.
+ private static final Object SPLICE_REMOVE = new Object();
+ private static final Callable<MethodHandle> SPLICE_REMOVE_INVOKER_CREATOR = invokerCreator(void.class, Object.class, JSObject.class, int.class, int.class);
+
+ /** wrapped object */
+ private final JSObject obj;
+ private final Global global;
+
+ // allow subclasses only in this package
+ ListAdapter(final JSObject obj) {
+ this.obj = obj;
+ this.global = getGlobalNonNull();
}
- private static final Object SHIFT = new Object();
- private static InvokeByName getSHIFT() {
- return Context.getGlobal().getInvokeByName(SHIFT,
- new Callable<InvokeByName>() {
- @Override
- public InvokeByName call() {
- return new InvokeByName("shift", Object.class, Object.class);
- }
- });
- }
-
- // These insert and remove in the middle of the list
- private static final Object SPLICE_ADD = new Object();
- private static InvokeByName getSPLICE_ADD() {
- return Context.getGlobal().getInvokeByName(SPLICE_ADD,
- new Callable<InvokeByName>() {
- @Override
- public InvokeByName call() {
- return new InvokeByName("splice", Object.class, void.class, int.class, int.class, Object.class);
- }
- });
- }
-
- private static final Object SPLICE_REMOVE = new Object();
- private static InvokeByName getSPLICE_REMOVE() {
- return Context.getGlobal().getInvokeByName(SPLICE_REMOVE,
- new Callable<InvokeByName>() {
- @Override
- public InvokeByName call() {
- return new InvokeByName("splice", Object.class, void.class, int.class, int.class);
- }
- });
- }
-
- /** wrapped object */
- protected final Object obj;
-
- // allow subclasses only in this package
- ListAdapter(final Object obj) {
- this.obj = obj;
+ private static Global getGlobalNonNull() {
+ final Global global = Context.getGlobal();
+ if (global != null) {
+ return global;
+ }
+ throw new IllegalStateException(ECMAErrors.getMessage("list.adapter.null.global"));
}
/**
@@ -135,14 +102,16 @@
* @return A ListAdapter wrapper object
*/
public static ListAdapter create(final Object obj) {
+ return new ListAdapter(getJSObject(obj));
+ }
+
+ private static JSObject getJSObject(final Object obj) {
if (obj instanceof ScriptObject) {
- final Object mirror = ScriptObjectMirror.wrap(obj, Context.getGlobal());
- return new JSObjectListAdapter((JSObject)mirror);
+ return (JSObject)ScriptObjectMirror.wrap(obj, Context.getGlobal());
} else if (obj instanceof JSObject) {
- return new JSObjectListAdapter((JSObject)obj);
- } else {
- throw new IllegalArgumentException("ScriptObject or JSObject expected");
+ return (JSObject)obj;
}
+ throw new IllegalArgumentException("ScriptObject or JSObject expected");
}
@Override
@@ -151,28 +120,18 @@
return getAt(index);
}
- /**
- * Get object at an index
- * @param index index in list
- * @return object
- */
- protected abstract Object getAt(final int index);
+ private Object getAt(final int index) {
+ return obj.getSlot(index);
+ }
@Override
public Object set(final int index, final Object element) {
checkRange(index);
final Object prevValue = getAt(index);
- setAt(index, element);
+ obj.setSlot(index, element);
return prevValue;
}
- /**
- * Set object at an index
- * @param index index in list
- * @param element element
- */
- protected abstract void setAt(final int index, final Object element);
-
private void checkRange(final int index) {
if(index < 0 || index >= size()) {
throw invalidIndex(index);
@@ -180,6 +139,11 @@
}
@Override
+ public int size() {
+ return JSType.toInt32(obj.getMember("length"));
+ }
+
+ @Override
public final void push(final Object e) {
addFirst(e);
}
@@ -193,10 +157,7 @@
@Override
public final void addFirst(final Object e) {
try {
- final InvokeByName unshiftInvoker = getUNSHIFT();
- final Object fn = unshiftInvoker.getGetter().invokeExact(obj);
- checkFunction(fn, unshiftInvoker);
- unshiftInvoker.getInvoker().invokeExact(fn, obj, e);
+ getDynamicInvoker(UNSHIFT, ADD_INVOKER_CREATOR).invokeExact(getFunction("unshift"), obj, e);
} catch(RuntimeException | Error ex) {
throw ex;
} catch(final Throwable t) {
@@ -207,10 +168,7 @@
@Override
public final void addLast(final Object e) {
try {
- final InvokeByName pushInvoker = getPUSH();
- final Object fn = pushInvoker.getGetter().invokeExact(obj);
- checkFunction(fn, pushInvoker);
- pushInvoker.getInvoker().invokeExact(fn, obj, e);
+ getDynamicInvoker(PUSH, ADD_INVOKER_CREATOR).invokeExact(getFunction("push"), obj, e);
} catch(RuntimeException | Error ex) {
throw ex;
} catch(final Throwable t) {
@@ -228,10 +186,7 @@
} else {
final int size = size();
if(index < size) {
- final InvokeByName spliceAddInvoker = getSPLICE_ADD();
- final Object fn = spliceAddInvoker.getGetter().invokeExact(obj);
- checkFunction(fn, spliceAddInvoker);
- spliceAddInvoker.getInvoker().invokeExact(fn, obj, index, 0, e);
+ getDynamicInvoker(SPLICE_ADD, SPLICE_ADD_INVOKER_CREATOR).invokeExact(obj.getMember("splice"), obj, index, 0, e);
} else if(index == size) {
addLast(e);
} else {
@@ -244,10 +199,12 @@
throw new RuntimeException(t);
}
}
- private static void checkFunction(final Object fn, final InvokeByName invoke) {
+ private Object getFunction(final String name) {
+ final Object fn = obj.getMember(name);
if(!(Bootstrap.isCallable(fn))) {
- throw new UnsupportedOperationException("The script object doesn't have a function named " + invoke.getName());
+ throw new UnsupportedOperationException("The script object doesn't have a function named " + name);
}
+ return fn;
}
private static IndexOutOfBoundsException invalidIndex(final int index) {
@@ -321,10 +278,7 @@
private Object invokeShift() {
try {
- final InvokeByName shiftInvoker = getSHIFT();
- final Object fn = shiftInvoker.getGetter().invokeExact(obj);
- checkFunction(fn, shiftInvoker);
- return shiftInvoker.getInvoker().invokeExact(fn, obj);
+ return getDynamicInvoker(SHIFT, REMOVE_INVOKER_CREATOR).invokeExact(getFunction("shift"), obj);
} catch(RuntimeException | Error ex) {
throw ex;
} catch(final Throwable t) {
@@ -334,10 +288,7 @@
private Object invokePop() {
try {
- final InvokeByName popInvoker = getPOP();
- final Object fn = popInvoker.getGetter().invokeExact(obj);
- checkFunction(fn, popInvoker);
- return popInvoker.getInvoker().invokeExact(fn, obj);
+ return getDynamicInvoker(POP, REMOVE_INVOKER_CREATOR).invokeExact(getFunction("pop"), obj);
} catch(RuntimeException | Error ex) {
throw ex;
} catch(final Throwable t) {
@@ -352,10 +303,7 @@
private void invokeSpliceRemove(final int fromIndex, final int count) {
try {
- final InvokeByName spliceRemoveInvoker = getSPLICE_REMOVE();
- final Object fn = spliceRemoveInvoker.getGetter().invokeExact(obj);
- checkFunction(fn, spliceRemoveInvoker);
- spliceRemoveInvoker.getInvoker().invokeExact(fn, obj, fromIndex, count);
+ getDynamicInvoker(SPLICE_REMOVE, SPLICE_REMOVE_INVOKER_CREATOR).invokeExact(getFunction("splice"), obj, fromIndex, count);
} catch(RuntimeException | Error ex) {
throw ex;
} catch(final Throwable t) {
@@ -443,12 +391,24 @@
private static boolean removeOccurrence(final Object o, final Iterator<Object> it) {
while(it.hasNext()) {
- final Object e = it.next();
- if(o == null ? e == null : o.equals(e)) {
+ if(Objects.equals(o, it.next())) {
it.remove();
return true;
}
}
return false;
}
+
+ private static Callable<MethodHandle> invokerCreator(final Class<?> rtype, final Class<?>... ptypes) {
+ return new Callable<MethodHandle>() {
+ @Override
+ public MethodHandle call() {
+ return Bootstrap.createDynamicInvoker("dyn:call", rtype, ptypes);
+ }
+ };
+ }
+
+ private MethodHandle getDynamicInvoker(final Object key, final Callable<MethodHandle> creator) {
+ return global.getDynamicInvoker(key, creator);
+ }
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptingFunctions.java Thu May 28 11:37:13 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptingFunctions.java Mon Jun 01 10:15:20 2015 -0700
@@ -245,7 +245,7 @@
* constitute the command line.
* @throws IOException in case {@link StreamTokenizer#nextToken()} raises it.
*/
- private static List<String> tokenizeCommandLine(final String execString) throws IOException {
+ public static List<String> tokenizeCommandLine(final String execString) throws IOException {
final StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(execString));
tokenizer.resetSyntax();
tokenizer.wordChars(0, 255);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornLinker.java Thu May 28 11:37:13 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornLinker.java Mon Jun 01 10:15:20 2015 -0700
@@ -29,13 +29,15 @@
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.Collection;
import java.util.Deque;
import java.util.List;
import java.util.Map;
+import java.util.Queue;
import javax.script.Bindings;
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.linker.ConversionComparator;
@@ -47,11 +49,13 @@
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.internal.dynalink.support.Guards;
import jdk.internal.dynalink.support.LinkerServicesImpl;
+import jdk.internal.dynalink.support.Lookup;
import jdk.nashorn.api.scripting.JSObject;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
import jdk.nashorn.api.scripting.ScriptUtils;
import jdk.nashorn.internal.objects.NativeArray;
import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.ListAdapter;
import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptObject;
import jdk.nashorn.internal.runtime.Undefined;
@@ -167,7 +171,7 @@
return null;
}
- private static Lookup getCurrentLookup() {
+ private static java.lang.invoke.MethodHandles.Lookup getCurrentLookup() {
final LinkRequest currentRequest = AccessController.doPrivileged(new PrivilegedAction<LinkRequest>() {
@Override
public LinkRequest run() {
@@ -179,12 +183,12 @@
/**
* Returns a guarded invocation that converts from a source type that is NativeArray to a Java array or List or
- * Deque type.
+ * Queue or Deque or Collection type.
* @param sourceType the source type (presumably NativeArray a superclass of it)
- * @param targetType the target type (presumably an array type, or List or Deque)
+ * @param targetType the target type (presumably an array type, or List or Queue, or Deque, or Collection)
* @return a guarded invocation that converts from the source type to the target type. null is returned if
* either the source type is neither NativeArray, nor a superclass of it, or if the target type is not an array
- * type, List, or Deque.
+ * type, List, Queue, Deque, or Collection.
*/
private static GuardedInvocation getArrayConverter(final Class<?> sourceType, final Class<?> targetType) {
final boolean isSourceTypeNativeArray = sourceType == NativeArray.class;
@@ -195,12 +199,14 @@
final MethodHandle guard = isSourceTypeGeneric ? IS_NATIVE_ARRAY : null;
if(targetType.isArray()) {
return new GuardedInvocation(ARRAY_CONVERTERS.get(targetType), guard);
- }
- if(targetType == List.class) {
- return new GuardedInvocation(JSType.TO_JAVA_LIST.methodHandle(), guard);
- }
- if(targetType == Deque.class) {
- return new GuardedInvocation(JSType.TO_JAVA_DEQUE.methodHandle(), guard);
+ } else if(targetType == List.class) {
+ return new GuardedInvocation(TO_LIST, guard);
+ } else if(targetType == Deque.class) {
+ return new GuardedInvocation(TO_DEQUE, guard);
+ } else if(targetType == Queue.class) {
+ return new GuardedInvocation(TO_QUEUE, guard);
+ } else if(targetType == Collection.class) {
+ return new GuardedInvocation(TO_COLLECTION, guard);
}
}
return null;
@@ -286,6 +292,23 @@
private static final MethodHandle IS_NASHORN_OR_UNDEFINED_TYPE = findOwnMH("isNashornTypeOrUndefined", Boolean.TYPE, Object.class);
private static final MethodHandle CREATE_MIRROR = findOwnMH("createMirror", Object.class, Object.class);
+ private static final MethodHandle TO_COLLECTION;
+ private static final MethodHandle TO_DEQUE;
+ private static final MethodHandle TO_LIST;
+ private static final MethodHandle TO_QUEUE;
+ static {
+ final MethodHandle listAdapterCreate = new Lookup(MethodHandles.lookup()).findStatic(
+ ListAdapter.class, "create", MethodType.methodType(ListAdapter.class, Object.class));
+ TO_COLLECTION = asReturning(listAdapterCreate, Collection.class);
+ TO_DEQUE = asReturning(listAdapterCreate, Deque.class);
+ TO_LIST = asReturning(listAdapterCreate, List.class);
+ TO_QUEUE = asReturning(listAdapterCreate, Queue.class);
+ }
+
+ private static MethodHandle asReturning(final MethodHandle mh, final Class<?> nrtype) {
+ return mh.asType(mh.type().changeReturnType(nrtype));
+ }
+
@SuppressWarnings("unused")
private static boolean isNashornTypeOrUndefined(final Object obj) {
return obj instanceof ScriptObject || obj instanceof Undefined;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/Options.java Thu May 28 11:37:13 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/Options.java Mon Jun 01 10:15:20 2015 -0700
@@ -424,9 +424,17 @@
public void process(final String[] args) {
final LinkedList<String> argList = new LinkedList<>();
addSystemProperties(NASHORN_ARGS_PREPEND_PROPERTY, argList);
+ processArgList(argList);
+ assert argList.isEmpty();
Collections.addAll(argList, args);
+ processArgList(argList);
+ assert argList.isEmpty();
addSystemProperties(NASHORN_ARGS_PROPERTY, argList);
+ processArgList(argList);
+ assert argList.isEmpty();
+ }
+ private void processArgList(final LinkedList<String> argList) {
while (!argList.isEmpty()) {
final String arg = argList.remove(0);
Objects.requireNonNull(arg);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties Thu May 28 11:37:13 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties Mon Jun 01 10:15:20 2015 -0700
@@ -174,4 +174,4 @@
config.error.no.dest=no destination directory supplied
uri.error.bad.uri=Bad URI "{0}" near offset {1}
-
+list.adapter.null.global=Attempted to create the adapter from outside a JavaScript execution context.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8007456.js Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+/**
+ * JDK-8007456: Nashorn test framework argument does not handle quoted strings
+ *
+ * @test
+ * @argument "hello world"
+ * @argument "This has spaces"
+ * @run
+ */
+
+print(arguments.length);
+print(arguments[0]);
+print(arguments[1]);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8007456.js.EXPECTED Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,3 @@
+2
+hello world
+This has spaces
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8036743.js Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+/**
+ * JDK-8036743: need ArrayBuffer constructor with specified data
+ *
+ * @test
+ * @run
+ */
+
+var ByteArray = Java.type("byte[]");
+var ByteBuffer = Java.type("java.nio.ByteBuffer");
+
+var ba = new ByteArray(4);
+// use constructor that accepts ByteBuffer as first arg.
+var abuf = new ArrayBuffer(ByteBuffer.wrap(ba));
+print("abuf.byteLength = " + abuf.byteLength);
+var view = new DataView(abuf);
+
+function setAndPrint(value, endian) {
+ view.setInt32(0, value, endian);
+ print("Little endian? " + endian);
+ print("view[0] = " + view.getInt32(0, endian));
+ print("ba[0] = " + ba[0]);
+ print("ba[1] = " + ba[1]);
+ print("ba[2] = " + ba[2]);
+ print("ba[3] = " + ba[3]);
+}
+
+setAndPrint(42, true);
+setAndPrint(42, false);
+setAndPrint(java.lang.Byte.MAX_VALUE, true);
+setAndPrint(java.lang.Byte.MAX_VALUE, false);
+setAndPrint(java.lang.Short.MAX_VALUE, true);
+setAndPrint(java.lang.Short.MAX_VALUE, false);
+setAndPrint(java.lang.Integer.MAX_VALUE, true);
+setAndPrint(java.lang.Integer.MAX_VALUE, false);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8036743.js.EXPECTED Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,49 @@
+abuf.byteLength = 4
+Little endian? true
+view[0] = 42
+ba[0] = 42
+ba[1] = 0
+ba[2] = 0
+ba[3] = 0
+Little endian? false
+view[0] = 42
+ba[0] = 0
+ba[1] = 0
+ba[2] = 0
+ba[3] = 42
+Little endian? true
+view[0] = 127
+ba[0] = 127
+ba[1] = 0
+ba[2] = 0
+ba[3] = 0
+Little endian? false
+view[0] = 127
+ba[0] = 0
+ba[1] = 0
+ba[2] = 0
+ba[3] = 127
+Little endian? true
+view[0] = 32767
+ba[0] = -1
+ba[1] = 127
+ba[2] = 0
+ba[3] = 0
+Little endian? false
+view[0] = 32767
+ba[0] = 0
+ba[1] = 0
+ba[2] = 127
+ba[3] = -1
+Little endian? true
+view[0] = 2147483647
+ba[0] = -1
+ba[1] = -1
+ba[2] = -1
+ba[3] = 127
+Little endian? false
+view[0] = 2147483647
+ba[0] = 127
+ba[1] = -1
+ba[2] = -1
+ba[3] = -1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8081156.js Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+/**
+ * JDK-8081156: jjs "nashorn.args" system property is not effective when script arguments are passed
+ *
+ * @test
+ * @fork
+ * @option -Dnashorn.args=-strict
+ * @argument foo
+ * @argument bar
+ * @run
+ */
+
+try {
+ x = 14;
+ throw new Error("should have thrown ReferenceError");
+} catch (e) {
+ if (! (e instanceof ReferenceError)) {
+ throw e;
+ }
+}
+
+Assert.assertTrue(arguments.length == 2);
+Assert.assertTrue(arguments[0] == "foo");
+Assert.assertTrue(arguments[1] == "bar");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/AddAndRemoveOnListAdapterOutsideOfJavaScriptContextTest.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Arrays;
+import java.util.Deque;
+import java.util.List;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import org.testng.annotations.Test;
+
+/**
+ * @bug 8081204
+ * @summary adding and removing elements to a ListAdapter outside of JS context should work.
+ */
+@SuppressWarnings("javadoc")
+public class AddAndRemoveOnListAdapterOutsideOfJavaScriptContextTest {
+
+ @SuppressWarnings("unchecked")
+ private static <T> T getListAdapter() throws ScriptException {
+ final ScriptEngine engine = new NashornScriptEngineFactory().getScriptEngine();
+ return (T)engine.eval("Java.to([1, 2, 3, 4], 'java.util.List')");
+ }
+
+ @Test
+ public void testInvokePush() throws ScriptException {
+ final Deque<Object> l = getListAdapter();
+ l.addLast(5);
+ assertEquals(l.size(), 5);
+ assertEquals(l.getLast(), 5);
+ assertEquals(l.getFirst(), 1);
+ }
+
+ @Test
+ public void testPop() throws ScriptException {
+ final Deque<Object> l = getListAdapter();
+ assertEquals(l.removeLast(), 4);
+ assertEquals(l.size(), 3);
+ assertEquals(l.getLast(), 3);
+ }
+
+ @Test
+ public void testUnshift() throws ScriptException {
+ final Deque<Object> l = getListAdapter();
+ l.addFirst(0);
+ assertEquals(l.getFirst(), 0);
+ assertEquals(l.getLast(), 4);
+ assertEquals(l.size(), 5);
+ }
+
+ @Test
+ public void testShift() throws ScriptException {
+ final Deque<Object> l = getListAdapter();
+ l.removeFirst();
+ assertEquals(l.getFirst(), 2);
+ assertEquals(l.getLast(), 4);
+ assertEquals(l.size(), 3);
+ }
+
+ @Test
+ public void testSpliceAdd() throws ScriptException {
+ final List<Object> l = getListAdapter();
+ assertEquals(l, Arrays.asList(1, 2, 3, 4));
+ l.add(2, "foo");
+ assertEquals(l, Arrays.asList(1, 2, "foo", 3, 4));
+ }
+
+
+ @Test
+ public void testSpliceRemove() throws ScriptException {
+ final List<Object> l = getListAdapter();
+ assertEquals(l, Arrays.asList(1, 2, 3, 4));
+ l.remove(2);
+ assertEquals(l, Arrays.asList(1, 2, 4));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/JDK_8081015_Test.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+
+import java.util.Collection;
+import java.util.Queue;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import jdk.nashorn.test.models.JDK_8081015_TestModel;
+import org.testng.annotations.Test;
+
+/**
+ * @bug 8081015
+ * @summary Test that native arrays get converted to {@link Queue} and {@link Collection}.
+ */
+@SuppressWarnings("javadoc")
+public class JDK_8081015_Test {
+ @Test
+ public void testConvertToCollection() throws ScriptException {
+ test("receiveCollection");
+ }
+
+ @Test
+ public void testConvertToDeque() throws ScriptException {
+ test("receiveDeque");
+ }
+
+ @Test
+ public void testConvertToList() throws ScriptException {
+ test("receiveList");
+ }
+
+ @Test
+ public void testConvertToQueue() throws ScriptException {
+ test("receiveQueue");
+ }
+
+ private static void test(final String methodName) throws ScriptException {
+ final ScriptEngine engine = new NashornScriptEngineFactory().getScriptEngine();
+ final JDK_8081015_TestModel model = new JDK_8081015_TestModel();
+ engine.put("test", model);
+
+ assertNull(model.getLastInvoked());
+ engine.eval("test." + methodName + "([1, 2, 3.3, 'foo'])");
+ assertEquals(model.getLastInvoked(), methodName );
+ }
+}
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java Thu May 28 11:37:13 2015 -0700
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java Mon Jun 01 10:15:20 2015 -0700
@@ -22,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package jdk.nashorn.internal.test.framework;
import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_CHECK_COMPILE_MSG;
@@ -61,14 +60,15 @@
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Scanner;
import java.util.Set;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
+import jdk.nashorn.internal.runtime.ScriptingFunctions;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
@@ -78,28 +78,33 @@
*/
@SuppressWarnings("javadoc")
public final class TestFinder {
- private TestFinder() {}
+
+ private TestFinder() {
+ }
interface TestFactory<T> {
+
// 'test' instance type is decided by the client.
+
T createTest(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> arguments);
+
// place to log messages from TestFinder
+
void log(String mg);
}
-
// finds all tests from configuration and calls TestFactory to create 'test' instance for each script test found
static <T> void findAllTests(final List<T> tests, final Set<String> orphans, final TestFactory<T> testFactory) throws Exception {
final String framework = System.getProperty(TEST_JS_FRAMEWORK);
final String testList = System.getProperty(TEST_JS_LIST);
final String failedTestFileName = System.getProperty(TEST_FAILED_LIST_FILE);
- if(failedTestFileName != null) {
+ if (failedTestFileName != null) {
final File failedTestFile = new File(failedTestFileName);
- if(failedTestFile.exists() && failedTestFile.length() > 0L) {
- try(final BufferedReader r = new BufferedReader(new FileReader(failedTestFile))) {
- for(;;) {
+ if (failedTestFile.exists() && failedTestFile.length() > 0L) {
+ try (final BufferedReader r = new BufferedReader(new FileReader(failedTestFile))) {
+ for (;;) {
final String testFileName = r.readLine();
- if(testFileName == null) {
+ if (testFileName == null) {
break;
}
handleOneTest(framework, new File(testFileName).toPath(), tests, orphans, testFactory);
@@ -151,7 +156,7 @@
final Exception[] exceptions = new Exception[1];
final List<String> excludedActualTests = new ArrayList<>();
- if (! dir.toFile().isDirectory()) {
+ if (!dir.toFile().isDirectory()) {
factory.log("WARNING: " + dir + " not found or not a directory");
}
@@ -219,27 +224,28 @@
boolean explicitOptimistic = false;
- try (Scanner scanner = new Scanner(testFile)) {
- while (scanner.hasNext()) {
- // TODO: Scan for /ref=file qualifiers, etc, to determine run
- // behavior
- String token = scanner.next();
- if (token.startsWith("/*")) {
- inComment = true;
- } else if (token.endsWith(("*/"))) {
- inComment = false;
- } else if (!inComment) {
- continue;
- }
+ String allContent = new String(Files.readAllBytes(testFile));
+ Iterator<String> scanner = ScriptingFunctions.tokenizeCommandLine(allContent).iterator();
+ while (scanner.hasNext()) {
+ // TODO: Scan for /ref=file qualifiers, etc, to determine run
+ // behavior
+ String token = scanner.next();
+ if (token.startsWith("/*")) {
+ inComment = true;
+ } else if (token.endsWith(("*/"))) {
+ inComment = false;
+ } else if (!inComment) {
+ continue;
+ }
- // remove whitespace and trailing semicolons, if any
- // (trailing semicolons are found in some sputnik tests)
- token = token.trim();
- final int semicolon = token.indexOf(';');
- if (semicolon > 0) {
- token = token.substring(0, semicolon);
- }
- switch (token) {
+ // remove whitespace and trailing semicolons, if any
+ // (trailing semicolons are found in some sputnik tests)
+ token = token.trim();
+ final int semicolon = token.indexOf(';');
+ if (semicolon > 0) {
+ token = token.substring(0, semicolon);
+ }
+ switch (token) {
case "@test":
isTest = true;
break;
@@ -308,24 +314,21 @@
break;
default:
break;
- }
+ }
- // negative tests are expected to fail at runtime only
- // for those tests that are expected to fail at compile time,
- // add @test/compile-error
- if (token.equals("@negative") || token.equals("@strict_mode_negative")) {
- shouldRun = true;
- runFailure = true;
- }
+ // negative tests are expected to fail at runtime only
+ // for those tests that are expected to fail at compile time,
+ // add @test/compile-error
+ if (token.equals("@negative") || token.equals("@strict_mode_negative")) {
+ shouldRun = true;
+ runFailure = true;
+ }
- if (token.equals("@strict_mode") || token.equals("@strict_mode_negative") || token.equals("@onlyStrict") || token.equals("@noStrict")) {
- if (!strictModeEnabled()) {
- return;
- }
+ if (token.equals("@strict_mode") || token.equals("@strict_mode_negative") || token.equals("@onlyStrict") || token.equals("@noStrict")) {
+ if (!strictModeEnabled()) {
+ return;
}
}
- } catch (final Exception ignored) {
- return;
}
if (isTest) {
@@ -369,8 +372,8 @@
private static final boolean OPTIMISTIC_OVERRIDE = false;
/**
- * Check if there is an optimistic override, that disables the default
- * false optimistic types and sets them to true, for testing purposes
+ * Check if there is an optimistic override, that disables the default false
+ * optimistic types and sets them to true, for testing purposes
*
* @return true if optimistic type override has been set by test suite
*/
@@ -379,10 +382,9 @@
}
/**
- * Add an optimistic-types=true option to an argument list if this
- * is set to override the default false. Add an optimistic-types=true
- * options to an argument list if this is set to override the default
- * true
+ * Add an optimistic-types=true option to an argument list if this is set to
+ * override the default false. Add an optimistic-types=true options to an
+ * argument list if this is set to override the default true
*
* @args new argument list array
*/
@@ -396,8 +398,8 @@
}
/**
- * Add an optimistic-types=true option to an argument list if this
- * is set to override the default false
+ * Add an optimistic-types=true option to an argument list if this is set to
+ * override the default false
*
* @args argument list
*/
@@ -438,7 +440,7 @@
private static void loadExcludesFile(final String testExcludesFile, final Set<String> testExcludeSet) throws XPathExpressionException {
final XPath xpath = XPathFactory.newInstance().newXPath();
- final NodeList testIds = (NodeList)xpath.evaluate("/excludeList/test/@id", new InputSource(testExcludesFile), XPathConstants.NODESET);
+ final NodeList testIds = (NodeList) xpath.evaluate("/excludeList/test/@id", new InputSource(testExcludesFile), XPathConstants.NODESET);
for (int i = testIds.getLength() - 1; i >= 0; i--) {
testExcludeSet.add(testIds.item(i).getNodeValue());
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/JDK_8081015_TestModel.java Mon Jun 01 10:15:20 2015 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package jdk.nashorn.test.models;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+
+import java.util.Collection;
+import java.util.Deque;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Queue;
+
+@SuppressWarnings("javadoc")
+public class JDK_8081015_TestModel {
+ private String lastInvoked;
+
+ public void receiveCollection(final Collection<Object> c) {
+ lastInvoked = "receiveCollection";
+ walkCollection(c);
+ }
+
+ public void receiveDeque(final Deque<Object> d) {
+ lastInvoked = "receiveDeque";
+ walkCollection(d);
+ }
+
+ public void receiveList(final List<Object> l) {
+ lastInvoked = "receiveList";
+ walkCollection(l);
+ }
+
+ public void receiveQueue(final Queue<Object> q) {
+ lastInvoked = "receiveQueue";
+ walkCollection(q);
+ }
+
+ public String getLastInvoked() {
+ return lastInvoked;
+ }
+
+ private static void walkCollection(final Collection<Object> c) {
+ final Iterator<Object> it = c.iterator();
+ assertEquals(it.next(), Integer.valueOf(1));
+ assertEquals(it.next(), Integer.valueOf(2));
+ assertEquals(it.next(), Double.valueOf(3.3));
+ assertEquals(it.next(), "foo");
+ assertFalse(it.hasNext());
+ }
+}