From 1c4f3aa56bf360ae8ccbf210cdccb5e8f9d10614 Mon Sep 17 00:00:00 2001
From: Jesse Wilson This class defines {#if[byte]?six:four} categories of operations upon
- * $fulltype$ buffers:
+ * $type$ buffers:
*
* Absolute and relative {@link #get() get
*
*
} and
* {@link #put($type$)
put} methods that read and write
- * single $fulltype$s;
Relative {@link #get($type$[]) bulk get}
- * methods that transfer contiguous sequences of $fulltype$s from this buffer
+ * methods that transfer contiguous sequences of $type$s from this buffer
* into an array; {#if[!byte]?and}
Relative {@link #put($type$[]) bulk put}
- * methods that transfer contiguous sequences of $fulltype$s from $a$
- * $fulltype$ array{#if[char]?, a string,} or some other $fulltype$
+ * methods that transfer contiguous sequences of $type$s from $a$
+ * $type$ array{#if[char]?, a string,} or some other $type$
* buffer into this buffer;{#if[!byte]? and}
Methods for {@link #compact compacting}, {@link
* #duplicate
duplicating}, and {@link #slice
- *
slicing} $a$ $fulltype$ buffer.
} $a$ $type$ buffer.
*
*
*
- * $Fulltype$ buffers can be created either by {@link #allocate
+ *
$Type$ buffers can be created either by {@link #allocate
*
allocation}, which allocates space for the buffer's
*
#if[byte]
*
* content, or by {@link #wrap($type$[])
wrapping} an
- * existing $fulltype$ array {#if[char]?or string} into a buffer.
+ * existing $type$ array {#if[char]?or string} into a buffer.
*
#else[byte]
*
* content, by {@link #wrap($type$[])
wrapping} an existing
- * $fulltype$ array {#if[char]?or string} into a buffer, or by creating a
+ * $type$ array {#if[char]?or string} into a buffer, or by creating a
* view of an existing byte buffer.
*
#end[byte]
@@ -189,12 +189,12 @@ import java.io.IOException;
*
#if[!byte]
*
- * Like a byte buffer, $a$ $fulltype$ buffer is either Like a byte buffer, $a$ $type$ buffer is either direct or non-direct. A
- * $fulltype$ buffer created via the wrap methods of this class will
- * be non-direct. $A$ $fulltype$ buffer created as a view of a byte buffer will
+ * $type$ buffer created via the wrap methods of this class will
+ * be non-direct. $A$ $type$ buffer created as a view of a byte buffer will
* be direct if, and only if, the byte buffer itself is direct. Whether or not
- * $a$ $fulltype$ buffer is direct may be determined by invoking the {@link
+ * $a$ $type$ buffer is direct may be determined by invoking the {@link
* #isDirect isDirect} method.
*
#end[!byte]
@@ -287,7 +287,7 @@ public abstract class $Type$Buffer
#if[byte]
/**
- * Allocates a new direct $fulltype$ buffer.
+ * Allocates a new direct $type$ buffer.
*
* The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
@@ -295,9 +295,9 @@ public abstract class $Type$Buffer
* {@link #hasArray
backing array} is unspecified.
*
* @param capacity
- * The new buffer's capacity, in $fulltype$s
+ * The new buffer's capacity, in $type$s
*
- * @return The new $fulltype$ buffer
+ * @return The new $type$ buffer
*
* @throws IllegalArgumentException
* If the capacity is a negative integer
@@ -309,7 +309,7 @@ public abstract class $Type$Buffer
#end[byte]
/**
- * Allocates a new $fulltype$ buffer.
+ * Allocates a new $type$ buffer.
*
* The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
@@ -318,9 +318,9 @@ public abstract class $Type$Buffer
* offset} will be zero.
*
* @param capacity
- * The new buffer's capacity, in $fulltype$s
+ * The new buffer's capacity, in $type$s
*
- * @return The new $fulltype$ buffer
+ * @return The new $type$ buffer
*
* @throws IllegalArgumentException
* If the capacity is a negative integer
@@ -332,9 +332,9 @@ public abstract class $Type$Buffer
}
/**
- * Wraps $a$ $fulltype$ array into a buffer.
+ * Wraps $a$ $type$ array into a buffer.
*
- * The new buffer will be backed by the given $fulltype$ array;
+ *
The new buffer will be backed by the given $type$ array;
* that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity will be
* array.length, its position will be offset, its limit
@@ -356,7 +356,7 @@ public abstract class $Type$Buffer
* array.length - offset.
* The new buffer's limit will be set to offset + length.
*
- * @return The new $fulltype$ buffer
+ * @return The new $type$ buffer
*
* @throws IndexOutOfBoundsException
* If the preconditions on the offset and length
@@ -373,9 +373,9 @@ public abstract class $Type$Buffer
}
/**
- * Wraps $a$ $fulltype$ array into a buffer.
+ * Wraps $a$ $type$ array into a buffer.
*
- *
The new buffer will be backed by the given $fulltype$ array;
+ *
The new buffer will be backed by the given $type$ array;
* that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity and limit will be
* array.length, its position will be zero, and its mark will be
@@ -386,7 +386,7 @@ public abstract class $Type$Buffer
* @param array
* The array that will back this buffer
*
- * @return The new $fulltype$ buffer
+ * @return The new $type$ buffer
*/
public static $Type$Buffer wrap($type$[] array) {
return wrap(array, 0, array.length);
@@ -486,7 +486,7 @@ public abstract class $Type$Buffer
#end[char]
/**
- * Creates a new $fulltype$ buffer whose content is a shared subsequence of
+ * Creates a new $type$ buffer whose content is a shared subsequence of
* this buffer's content.
*
*
The content of the new buffer will start at this buffer's current
@@ -495,17 +495,17 @@ public abstract class $Type$Buffer
* values will be independent.
*
*
The new buffer's position will be zero, its capacity and its limit
- * will be the number of $fulltype$s remaining in this buffer, and its mark
+ * will be the number of $type$s remaining in this buffer, and its mark
* will be undefined. The new buffer will be direct if, and only if, this
* buffer is direct, and it will be read-only if, and only if, this buffer
* is read-only.
*
- * @return The new $fulltype$ buffer
+ * @return The new $type$ buffer
*/
public abstract $Type$Buffer slice();
/**
- * Creates a new $fulltype$ buffer that shares this buffer's content.
+ * Creates a new $type$ buffer that shares this buffer's content.
*
* The content of the new buffer will be that of this buffer. Changes
* to this buffer's content will be visible in the new buffer, and vice
@@ -517,12 +517,12 @@ public abstract class $Type$Buffer
* and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only.
*
- * @return The new $fulltype$ buffer
+ * @return The new $type$ buffer
*/
public abstract $Type$Buffer duplicate();
/**
- * Creates a new, read-only $fulltype$ buffer that shares this buffer's
+ * Creates a new, read-only $type$ buffer that shares this buffer's
* content.
*
* The content of the new buffer will be that of this buffer. Changes
@@ -537,7 +537,7 @@ public abstract class $Type$Buffer
*
If this buffer is itself read-only then this method behaves in
* exactly the same way as the {@link #duplicate duplicate} method.
*
- * @return The new, read-only $fulltype$ buffer
+ * @return The new, read-only $type$ buffer
*/
public abstract $Type$Buffer asReadOnlyBuffer();
@@ -545,10 +545,10 @@ public abstract class $Type$Buffer
// -- Singleton get/put methods --
/**
- * Relative get method. Reads the $fulltype$ at this buffer's
+ * Relative get method. Reads the $type$ at this buffer's
* current position, and then increments the position.
*
- * @return The $fulltype$ at the buffer's current position
+ * @return The $type$ at the buffer's current position
*
* @throws BufferUnderflowException
* If the buffer's current position is not smaller than its limit
@@ -558,11 +558,11 @@ public abstract class $Type$Buffer
/**
* Relative put method (optional operation).
*
- * Writes the given $fulltype$ into this buffer at the current
+ *
Writes the given $type$ into this buffer at the current
* position, and then increments the position.
*
* @param $x$
- * The $fulltype$ to be written
+ * The $type$ to be written
*
* @return This buffer
*
@@ -575,13 +575,13 @@ public abstract class $Type$Buffer
public abstract $Type$Buffer put($type$ $x$);
/**
- * Absolute get method. Reads the $fulltype$ at the given
+ * Absolute get method. Reads the $type$ at the given
* index.
*
* @param index
- * The index from which the $fulltype$ will be read
+ * The index from which the $type$ will be read
*
- * @return The $fulltype$ at the given index
+ * @return The $type$ at the given index
*
* @throws IndexOutOfBoundsException
* If index is negative
@@ -592,14 +592,14 @@ public abstract class $Type$Buffer
/**
* Absolute put method (optional operation).
*
- * Writes the given $fulltype$ into this buffer at the given
+ *
Writes the given $type$ into this buffer at the given
* index.
*
* @param index
- * The index at which the $fulltype$ will be written
+ * The index at which the $type$ will be written
*
* @param $x$
- * The $fulltype$ value to be written
+ * The $type$ value to be written
*
* @return This buffer
*
@@ -618,14 +618,14 @@ public abstract class $Type$Buffer
/**
* Relative bulk get method.
*
- * This method transfers $fulltype$s from this buffer into the given
- * destination array. If there are fewer $fulltype$s remaining in the
+ *
This method transfers $type$s from this buffer into the given
+ * destination array. If there are fewer $type$s remaining in the
* buffer than are required to satisfy the request, that is, if
* length > remaining(), then no
- * $fulltype$s are transferred and a {@link BufferUnderflowException} is
+ * $type$s are transferred and a {@link BufferUnderflowException} is
* thrown.
*
- *
Otherwise, this method copies length $fulltype$s from this
+ *
Otherwise, this method copies length $type$s from this
* buffer into the given array, starting at the current position of this
* buffer and at the given offset in the array. The position of this
* buffer is then incremented by length.
@@ -638,26 +638,26 @@ public abstract class $Type$Buffer
* for (int i = off; i < off + len; i++)
* dst[i] = src.get();
*
- * except that it first checks that there are sufficient $fulltype$s in
+ * except that it first checks that there are sufficient $type$s in
* this buffer and it is potentially much more efficient.
*
* @param dst
- * The array into which $fulltype$s are to be written
+ * The array into which $type$s are to be written
*
* @param offset
- * The offset within the array of the first $fulltype$ to be
+ * The offset within the array of the first $type$ to be
* written; must be non-negative and no larger than
* dst.length
*
* @param length
- * The maximum number of $fulltype$s to be written to the given
+ * The maximum number of $type$s to be written to the given
* array; must be non-negative and no larger than
* dst.length - offset
*
* @return This buffer
*
* @throws BufferUnderflowException
- * If there are fewer than length $fulltype$s
+ * If there are fewer than length $type$s
* remaining in this buffer
*
* @throws IndexOutOfBoundsException
@@ -677,7 +677,7 @@ public abstract class $Type$Buffer
/**
* Relative bulk get method.
*
- * This method transfers $fulltype$s from this buffer into the given
+ *
This method transfers $type$s from this buffer into the given
* destination array. An invocation of this method of the form
* src.get(a) behaves in exactly the same way as the invocation
*
@@ -687,7 +687,7 @@ public abstract class $Type$Buffer
* @return This buffer
*
* @throws BufferUnderflowException
- * If there are fewer than length $fulltype$s
+ * If there are fewer than length $type$s
* remaining in this buffer
*/
public $Type$Buffer get($type$[] dst) {
@@ -700,15 +700,15 @@ public abstract class $Type$Buffer
/**
* Relative bulk put method (optional operation).
*
- *
This method transfers the $fulltype$s remaining in the given source
- * buffer into this buffer. If there are more $fulltype$s remaining in the
+ *
This method transfers the $type$s remaining in the given source
+ * buffer into this buffer. If there are more $type$s remaining in the
* source buffer than in this buffer, that is, if
* src.remaining() > remaining(),
- * then no $fulltype$s are transferred and a {@link
+ * then no $type$s are transferred and a {@link
* BufferOverflowException} is thrown.
*
*
Otherwise, this method copies
- * n = src.remaining() $fulltype$s from the given
+ * n = src.remaining() $type$s from the given
* buffer into this buffer, starting at each buffer's current position.
* The positions of both buffers are then incremented by n.
*
@@ -723,14 +723,14 @@ public abstract class $Type$Buffer
* buffer and it is potentially much more efficient.
*
* @param src
- * The source buffer from which $fulltype$s are to be read;
+ * The source buffer from which $type$s are to be read;
* must not be this buffer
*
* @return This buffer
*
* @throws BufferOverflowException
* If there is insufficient space in this buffer
- * for the remaining $fulltype$s in the source buffer
+ * for the remaining $type$s in the source buffer
*
* @throws IllegalArgumentException
* If the source buffer is this buffer
@@ -752,14 +752,14 @@ public abstract class $Type$Buffer
/**
* Relative bulk put method (optional operation).
*
- * This method transfers $fulltype$s into this buffer from the given
- * source array. If there are more $fulltype$s to be copied from the array
+ *
This method transfers $type$s into this buffer from the given
+ * source array. If there are more $type$s to be copied from the array
* than remain in this buffer, that is, if
* length > remaining(), then no
- * $fulltype$s are transferred and a {@link BufferOverflowException} is
+ * $type$s are transferred and a {@link BufferOverflowException} is
* thrown.
*
- *
Otherwise, this method copies length $fulltype$s from the
+ *
Otherwise, this method copies length $type$s from the
* given array into this buffer, starting at the given offset in the array
* and at the current position of this buffer. The position of this buffer
* is then incremented by length.
@@ -776,14 +776,14 @@ public abstract class $Type$Buffer
* buffer and it is potentially much more efficient.
*
* @param src
- * The array from which $fulltype$s are to be read
+ * The array from which $type$s are to be read
*
* @param offset
- * The offset within the array of the first $fulltype$ to be read;
+ * The offset within the array of the first $type$ to be read;
* must be non-negative and no larger than array.length
*
* @param length
- * The number of $fulltype$s to be read from the given array;
+ * The number of $type$s to be read from the given array;
* must be non-negative and no larger than
* array.length - offset
*
@@ -813,7 +813,7 @@ public abstract class $Type$Buffer
* Relative bulk put method (optional operation).
*
* This method transfers the entire content of the given source
- * $fulltype$ array into this buffer. An invocation of this method of the
+ * $type$ array into this buffer. An invocation of this method of the
* form dst.put(a) behaves in exactly the same way as the
* invocation
*
@@ -837,15 +837,15 @@ public abstract class $Type$Buffer
/**
* Relative bulk put method (optional operation).
*
- *
This method transfers $fulltype$s from the given string into this
- * buffer. If there are more $fulltype$s to be copied from the string than
+ *
This method transfers $type$s from the given string into this
+ * buffer. If there are more $type$s to be copied from the string than
* remain in this buffer, that is, if
* end - start > remaining(),
- * then no $fulltype$s are transferred and a {@link
+ * then no $type$s are transferred and a {@link
* BufferOverflowException} is thrown.
*
*
Otherwise, this method copies
- * n = end - start $fulltype$s
+ * n = end - start $type$s
* from the given string into this buffer, starting at the given
* start index and at the current position of this buffer. The
* position of this buffer is then incremented by n.
@@ -862,15 +862,15 @@ public abstract class $Type$Buffer
* buffer and it is potentially much more efficient.
*
* @param src
- * The string from which $fulltype$s are to be read
+ * The string from which $type$s are to be read
*
* @param start
- * The offset within the string of the first $fulltype$ to be read;
+ * The offset within the string of the first $type$ to be read;
* must be non-negative and no larger than
* string.length()
*
* @param end
- * The offset within the string of the last $fulltype$ to be read,
+ * The offset within the string of the last $type$ to be read,
* plus one; must be non-negative and no larger than
* string.length()
*
@@ -921,7 +921,7 @@ public abstract class $Type$Buffer
// -- Other stuff --
/**
- * Tells whether or not this buffer is backed by an accessible $fulltype$
+ * Tells whether or not this buffer is backed by an accessible $type$
* array.
*
* If this method returns true then the {@link #array() array}
@@ -936,7 +936,7 @@ public abstract class $Type$Buffer
}
/**
- * Returns the $fulltype$ array that backs this
+ * Returns the $type$ array that backs this
* buffer (optional operation).
*
*
Modifications to this buffer's content will cause the returned
@@ -993,17 +993,17 @@ public abstract class $Type$Buffer
/**
* Compacts this buffer (optional operation).
*
- *
The $fulltype$s between the buffer's current position and its limit,
+ *
The $type$s between the buffer's current position and its limit,
* if any, are copied to the beginning of the buffer. That is, the
- * $fulltype$ at index p = position() is copied
- * to index zero, the $fulltype$ at index p + 1 is copied
- * to index one, and so forth until the $fulltype$ at index
+ * $type$ at index p = position() is copied
+ * to index zero, the $type$ at index p + 1 is copied
+ * to index one, and so forth until the $type$ at index
* limit() - 1 is copied to index
* n = limit() - 1 - p.
* The buffer's position is then set to n+1 and its limit is set to
* its capacity. The mark, if defined, is discarded.
*
- *
The buffer's position is set to the number of $fulltype$s copied,
+ *
The buffer's position is set to the number of $type$s copied,
* rather than to zero, so that an invocation of this method can be
* followed immediately by an invocation of another relative put
* method.
@@ -1032,7 +1032,7 @@ public abstract class $Type$Buffer
public abstract $Type$Buffer compact();
/**
- * Tells whether or not this $fulltype$ buffer is direct.
+ * Tells whether or not this $type$ buffer is direct.
*
* @return true if, and only if, this buffer is direct
*/
@@ -1098,6 +1098,13 @@ public abstract class $Type$Buffer
*
* The two sequences of remaining elements, considered
* independently of their starting positions, are pointwise equal.
+#if[floatingPointType]
+ * This method considers two $type$ elements {@code a} and {@code b}
+ * to be equal if
+ * {@code (a == b) || ($Fulltype$.isNaN(a) && $Fulltype$.isNaN(b))}.
+ * The values {@code -0.0} and {@code +0.0} are considered to be
+ * equal, unlike {@link $Fulltype$#equals(Object)}.
+#end[floatingPointType]
*
*
*
@@ -1118,24 +1125,37 @@ public abstract class $Type$Buffer
if (this.remaining() != that.remaining())
return false;
int p = this.position();
- for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--) {
- $type$ v1 = this.get(i);
- $type$ v2 = that.get(j);
- if (v1 != v2) {
- if ((v1 != v1) && (v2 != v2)) // For float and double
- continue;
+ for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--)
+ if (!equals(this.get(i), that.get(j)))
return false;
- }
- }
return true;
}
+ private static boolean equals($type$ x, $type$ y) {
+#if[floatingPointType]
+ return (x == y) || ($Fulltype$.isNaN(x) && $Fulltype$.isNaN(y));
+#else[floatingPointType]
+ return x == y;
+#end[floatingPointType]
+ }
+
/**
* Compares this buffer to another.
*
* Two $type$ buffers are compared by comparing their sequences of
* remaining elements lexicographically, without regard to the starting
* position of each sequence within its corresponding buffer.
+#if[floatingPointType]
+ * Pairs of {@code $type$} elements are compared as if by invoking
+ * {@link $Fulltype$#compare($type$,$type$)}, except that
+ * {@code -0.0} and {@code 0.0} are considered to be equal.
+ * {@code $Fulltype$.NaN} is considered by this method to be equal
+ * to itself and greater than all other {@code $type$} values
+ * (including {@code $Fulltype$.POSITIVE_INFINITY}).
+#else[floatingPointType]
+ * Pairs of {@code $type$} elements are compared as if by invoking
+ * {@link $Fulltype$#compare($type$,$type$)}.
+#end[floatingPointType]
*
*
A $type$ buffer is not comparable to any other type of object.
*
@@ -1145,20 +1165,23 @@ public abstract class $Type$Buffer
public int compareTo($Type$Buffer that) {
int n = this.position() + Math.min(this.remaining(), that.remaining());
for (int i = this.position(), j = that.position(); i < n; i++, j++) {
- $type$ v1 = this.get(i);
- $type$ v2 = that.get(j);
- if (v1 == v2)
- continue;
- if ((v1 != v1) && (v2 != v2)) // For float and double
- continue;
- if (v1 < v2)
- return -1;
- return +1;
+ int cmp = compare(this.get(i), that.get(j));
+ if (cmp != 0)
+ return cmp;
}
return this.remaining() - that.remaining();
}
-
+ private static int compare($type$ x, $type$ y) {
+#if[floatingPointType]
+ return ((x < y) ? -1 :
+ (x > y) ? +1 :
+ (x == y) ? 0 :
+ $Fulltype$.isNaN(x) ? ($Fulltype$.isNaN(y) ? 0 : +1) : -1);
+#else[floatingPointType]
+ return $Fulltype$.compare(x, y);
+#end[floatingPointType]
+ }
// -- Other char stuff --
@@ -1326,7 +1349,7 @@ public abstract class $Type$Buffer
}
/**
- * Appends the specified $fulltype$ to this
+ * Appends the specified $type$ to this
* buffer (optional operation).
*
*
An invocation of this method of the form dst.append($x$)
@@ -1336,7 +1359,7 @@ public abstract class $Type$Buffer
* dst.put($x$)
*
* @param $x$
- * The 16-bit $fulltype$ to append
+ * The 16-bit $type$ to append
*
* @return This buffer
*
@@ -1362,10 +1385,10 @@ public abstract class $Type$Buffer
/**
* Retrieves this buffer's byte order.
*
- *
The byte order of $a$ $fulltype$ buffer created by allocation or by
+ *
The byte order of $a$ $type$ buffer created by allocation or by
* wrapping an existing $type$ array is the {@link
* ByteOrder#nativeOrder
native order} of the underlying
- * hardware. The byte order of $a$ $fulltype$ buffer created as a view of a byte buffer is that of the
* byte buffer at the moment that the view is created.
*
diff --git a/jdk/test/java/nio/Buffer/Basic-X.java.template b/jdk/test/java/nio/Buffer/Basic-X.java.template
index 6612771def4..93cbe8eb5ee 100644
--- a/jdk/test/java/nio/Buffer/Basic-X.java.template
+++ b/jdk/test/java/nio/Buffer/Basic-X.java.template
@@ -38,6 +38,26 @@ public class Basic$Type$
extends Basic
{
+ private static final $type$[] VALUES = {
+ $Fulltype$.MIN_VALUE,
+ ($type$) -1,
+ ($type$) 0,
+ ($type$) 1,
+ $Fulltype$.MAX_VALUE,
+#if[float]
+ $Fulltype$.NEGATIVE_INFINITY,
+ $Fulltype$.POSITIVE_INFINITY,
+ $Fulltype$.NaN,
+ ($type$) -0.0,
+#end[float]
+#if[double]
+ $Fulltype$.NEGATIVE_INFINITY,
+ $Fulltype$.POSITIVE_INFINITY,
+ $Fulltype$.NaN,
+ ($type$) -0.0,
+#end[double]
+ };
+
private static void relGet($Type$Buffer b) {
int n = b.capacity();
$type$ v;
@@ -309,6 +329,12 @@ public class Basic$Type$
#end[byte]
+ private static void fail(String problem,
+ $Type$Buffer xb, $Type$Buffer yb,
+ $type$ x, $type$ y) {
+ fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
+ }
+
private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
boolean caught = false;
try {
@@ -522,6 +548,42 @@ public class Basic$Type$
if (b.compareTo(b2) <= 0)
fail("Comparison to lesser buffer <= 0", b, b2);
+ // Check equals and compareTo with interesting values
+ for ($type$ x : VALUES) {
+ $Type$Buffer xb = $Type$Buffer.wrap(new $type$[] { x });
+ if (xb.compareTo(xb) != 0) {
+ fail("compareTo not reflexive", xb, xb, x, x);
+ }
+ if (! xb.equals(xb)) {
+ fail("equals not reflexive", xb, xb, x, x);
+ }
+ for ($type$ y : VALUES) {
+ $Type$Buffer yb = $Type$Buffer.wrap(new $type$[] { y });
+ if (xb.compareTo(yb) != - yb.compareTo(xb)) {
+ fail("compareTo not anti-symmetric",
+ xb, yb, x, y);
+ }
+ if ((xb.compareTo(yb) == 0) != xb.equals(yb)) {
+ fail("compareTo inconsistent with equals",
+ xb, yb, x, y);
+ }
+ if (xb.compareTo(yb) != $Fulltype$.compare(x, y)) {
+#if[float]
+ if (x == 0.0 && y == 0.0) continue;
+#end[float]
+#if[double]
+ if (x == 0.0 && y == 0.0) continue;
+#end[double]
+ fail("Incorrect results for $Type$Buffer.compareTo",
+ xb, yb, x, y);
+ }
+ if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) {
+ fail("Incorrect results for $Type$Buffer.equals",
+ xb, yb, x, y);
+ }
+ }
+ }
+
// Sub, dup
relPut(b);
diff --git a/jdk/test/java/nio/Buffer/BasicByte.java b/jdk/test/java/nio/Buffer/BasicByte.java
index 7e259a1416d..78b209936d7 100644
--- a/jdk/test/java/nio/Buffer/BasicByte.java
+++ b/jdk/test/java/nio/Buffer/BasicByte.java
@@ -38,6 +38,26 @@ public class BasicByte
extends Basic
{
+ private static final byte[] VALUES = {
+ Byte.MIN_VALUE,
+ (byte) -1,
+ (byte) 0,
+ (byte) 1,
+ Byte.MAX_VALUE,
+
+
+
+
+
+
+
+
+
+
+
+
+ };
+
private static void relGet(ByteBuffer b) {
int n = b.capacity();
byte v;
@@ -309,6 +329,12 @@ public class BasicByte
+ private static void fail(String problem,
+ ByteBuffer xb, ByteBuffer yb,
+ byte x, byte y) {
+ fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
+ }
+
private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
boolean caught = false;
try {
@@ -522,6 +548,42 @@ public class BasicByte
if (b.compareTo(b2) <= 0)
fail("Comparison to lesser buffer <= 0", b, b2);
+ // Check equals and compareTo with interesting values
+ for (byte x : VALUES) {
+ ByteBuffer xb = ByteBuffer.wrap(new byte[] { x });
+ if (xb.compareTo(xb) != 0) {
+ fail("compareTo not reflexive", xb, xb, x, x);
+ }
+ if (! xb.equals(xb)) {
+ fail("equals not reflexive", xb, xb, x, x);
+ }
+ for (byte y : VALUES) {
+ ByteBuffer yb = ByteBuffer.wrap(new byte[] { y });
+ if (xb.compareTo(yb) != - yb.compareTo(xb)) {
+ fail("compareTo not anti-symmetric",
+ xb, yb, x, y);
+ }
+ if ((xb.compareTo(yb) == 0) != xb.equals(yb)) {
+ fail("compareTo inconsistent with equals",
+ xb, yb, x, y);
+ }
+ if (xb.compareTo(yb) != Byte.compare(x, y)) {
+
+
+
+
+
+
+ fail("Incorrect results for ByteBuffer.compareTo",
+ xb, yb, x, y);
+ }
+ if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) {
+ fail("Incorrect results for ByteBuffer.equals",
+ xb, yb, x, y);
+ }
+ }
+ }
+
// Sub, dup
relPut(b);
diff --git a/jdk/test/java/nio/Buffer/BasicChar.java b/jdk/test/java/nio/Buffer/BasicChar.java
index a0df9fcf3a9..9f3c5e4219c 100644
--- a/jdk/test/java/nio/Buffer/BasicChar.java
+++ b/jdk/test/java/nio/Buffer/BasicChar.java
@@ -38,6 +38,26 @@ public class BasicChar
extends Basic
{
+ private static final char[] VALUES = {
+ Character.MIN_VALUE,
+ (char) -1,
+ (char) 0,
+ (char) 1,
+ Character.MAX_VALUE,
+
+
+
+
+
+
+
+
+
+
+
+
+ };
+
private static void relGet(CharBuffer b) {
int n = b.capacity();
char v;
@@ -308,6 +328,12 @@ public class BasicChar
+
+ private static void fail(String problem,
+ CharBuffer xb, CharBuffer yb,
+ char x, char y) {
+ fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
+ }
private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
boolean caught = false;
@@ -522,6 +548,42 @@ public class BasicChar
if (b.compareTo(b2) <= 0)
fail("Comparison to lesser buffer <= 0", b, b2);
+ // Check equals and compareTo with interesting values
+ for (char x : VALUES) {
+ CharBuffer xb = CharBuffer.wrap(new char[] { x });
+ if (xb.compareTo(xb) != 0) {
+ fail("compareTo not reflexive", xb, xb, x, x);
+ }
+ if (! xb.equals(xb)) {
+ fail("equals not reflexive", xb, xb, x, x);
+ }
+ for (char y : VALUES) {
+ CharBuffer yb = CharBuffer.wrap(new char[] { y });
+ if (xb.compareTo(yb) != - yb.compareTo(xb)) {
+ fail("compareTo not anti-symmetric",
+ xb, yb, x, y);
+ }
+ if ((xb.compareTo(yb) == 0) != xb.equals(yb)) {
+ fail("compareTo inconsistent with equals",
+ xb, yb, x, y);
+ }
+ if (xb.compareTo(yb) != Character.compare(x, y)) {
+
+
+
+
+
+
+ fail("Incorrect results for CharBuffer.compareTo",
+ xb, yb, x, y);
+ }
+ if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) {
+ fail("Incorrect results for CharBuffer.equals",
+ xb, yb, x, y);
+ }
+ }
+ }
+
// Sub, dup
relPut(b);
diff --git a/jdk/test/java/nio/Buffer/BasicDouble.java b/jdk/test/java/nio/Buffer/BasicDouble.java
index a627d0e9194..97f5fa200de 100644
--- a/jdk/test/java/nio/Buffer/BasicDouble.java
+++ b/jdk/test/java/nio/Buffer/BasicDouble.java
@@ -38,6 +38,26 @@ public class BasicDouble
extends Basic
{
+ private static final double[] VALUES = {
+ Double.MIN_VALUE,
+ (double) -1,
+ (double) 0,
+ (double) 1,
+ Double.MAX_VALUE,
+
+
+
+
+
+
+
+ Double.NEGATIVE_INFINITY,
+ Double.POSITIVE_INFINITY,
+ Double.NaN,
+ (double) -0.0,
+
+ };
+
private static void relGet(DoubleBuffer b) {
int n = b.capacity();
double v;
@@ -308,6 +328,12 @@ public class BasicDouble
+
+ private static void fail(String problem,
+ DoubleBuffer xb, DoubleBuffer yb,
+ double x, double y) {
+ fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
+ }
private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
boolean caught = false;
@@ -522,6 +548,42 @@ public class BasicDouble
if (b.compareTo(b2) <= 0)
fail("Comparison to lesser buffer <= 0", b, b2);
+ // Check equals and compareTo with interesting values
+ for (double x : VALUES) {
+ DoubleBuffer xb = DoubleBuffer.wrap(new double[] { x });
+ if (xb.compareTo(xb) != 0) {
+ fail("compareTo not reflexive", xb, xb, x, x);
+ }
+ if (! xb.equals(xb)) {
+ fail("equals not reflexive", xb, xb, x, x);
+ }
+ for (double y : VALUES) {
+ DoubleBuffer yb = DoubleBuffer.wrap(new double[] { y });
+ if (xb.compareTo(yb) != - yb.compareTo(xb)) {
+ fail("compareTo not anti-symmetric",
+ xb, yb, x, y);
+ }
+ if ((xb.compareTo(yb) == 0) != xb.equals(yb)) {
+ fail("compareTo inconsistent with equals",
+ xb, yb, x, y);
+ }
+ if (xb.compareTo(yb) != Double.compare(x, y)) {
+
+
+
+
+ if (x == 0.0 && y == 0.0) continue;
+
+ fail("Incorrect results for DoubleBuffer.compareTo",
+ xb, yb, x, y);
+ }
+ if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) {
+ fail("Incorrect results for DoubleBuffer.equals",
+ xb, yb, x, y);
+ }
+ }
+ }
+
// Sub, dup
relPut(b);
diff --git a/jdk/test/java/nio/Buffer/BasicFloat.java b/jdk/test/java/nio/Buffer/BasicFloat.java
index 730dcbeac95..46bdfe163cb 100644
--- a/jdk/test/java/nio/Buffer/BasicFloat.java
+++ b/jdk/test/java/nio/Buffer/BasicFloat.java
@@ -38,6 +38,26 @@ public class BasicFloat
extends Basic
{
+ private static final float[] VALUES = {
+ Float.MIN_VALUE,
+ (float) -1,
+ (float) 0,
+ (float) 1,
+ Float.MAX_VALUE,
+
+ Float.NEGATIVE_INFINITY,
+ Float.POSITIVE_INFINITY,
+ Float.NaN,
+ (float) -0.0,
+
+
+
+
+
+
+
+ };
+
private static void relGet(FloatBuffer b) {
int n = b.capacity();
float v;
@@ -308,6 +328,12 @@ public class BasicFloat
+
+ private static void fail(String problem,
+ FloatBuffer xb, FloatBuffer yb,
+ float x, float y) {
+ fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
+ }
private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
boolean caught = false;
@@ -522,6 +548,42 @@ public class BasicFloat
if (b.compareTo(b2) <= 0)
fail("Comparison to lesser buffer <= 0", b, b2);
+ // Check equals and compareTo with interesting values
+ for (float x : VALUES) {
+ FloatBuffer xb = FloatBuffer.wrap(new float[] { x });
+ if (xb.compareTo(xb) != 0) {
+ fail("compareTo not reflexive", xb, xb, x, x);
+ }
+ if (! xb.equals(xb)) {
+ fail("equals not reflexive", xb, xb, x, x);
+ }
+ for (float y : VALUES) {
+ FloatBuffer yb = FloatBuffer.wrap(new float[] { y });
+ if (xb.compareTo(yb) != - yb.compareTo(xb)) {
+ fail("compareTo not anti-symmetric",
+ xb, yb, x, y);
+ }
+ if ((xb.compareTo(yb) == 0) != xb.equals(yb)) {
+ fail("compareTo inconsistent with equals",
+ xb, yb, x, y);
+ }
+ if (xb.compareTo(yb) != Float.compare(x, y)) {
+
+ if (x == 0.0 && y == 0.0) continue;
+
+
+
+
+ fail("Incorrect results for FloatBuffer.compareTo",
+ xb, yb, x, y);
+ }
+ if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) {
+ fail("Incorrect results for FloatBuffer.equals",
+ xb, yb, x, y);
+ }
+ }
+ }
+
// Sub, dup
relPut(b);
diff --git a/jdk/test/java/nio/Buffer/BasicInt.java b/jdk/test/java/nio/Buffer/BasicInt.java
index b20e4bb1056..478debd76e1 100644
--- a/jdk/test/java/nio/Buffer/BasicInt.java
+++ b/jdk/test/java/nio/Buffer/BasicInt.java
@@ -38,6 +38,26 @@ public class BasicInt
extends Basic
{
+ private static final int[] VALUES = {
+ Integer.MIN_VALUE,
+ (int) -1,
+ (int) 0,
+ (int) 1,
+ Integer.MAX_VALUE,
+
+
+
+
+
+
+
+
+
+
+
+
+ };
+
private static void relGet(IntBuffer b) {
int n = b.capacity();
int v;
@@ -308,6 +328,12 @@ public class BasicInt
+
+ private static void fail(String problem,
+ IntBuffer xb, IntBuffer yb,
+ int x, int y) {
+ fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
+ }
private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
boolean caught = false;
@@ -522,6 +548,42 @@ public class BasicInt
if (b.compareTo(b2) <= 0)
fail("Comparison to lesser buffer <= 0", b, b2);
+ // Check equals and compareTo with interesting values
+ for (int x : VALUES) {
+ IntBuffer xb = IntBuffer.wrap(new int[] { x });
+ if (xb.compareTo(xb) != 0) {
+ fail("compareTo not reflexive", xb, xb, x, x);
+ }
+ if (! xb.equals(xb)) {
+ fail("equals not reflexive", xb, xb, x, x);
+ }
+ for (int y : VALUES) {
+ IntBuffer yb = IntBuffer.wrap(new int[] { y });
+ if (xb.compareTo(yb) != - yb.compareTo(xb)) {
+ fail("compareTo not anti-symmetric",
+ xb, yb, x, y);
+ }
+ if ((xb.compareTo(yb) == 0) != xb.equals(yb)) {
+ fail("compareTo inconsistent with equals",
+ xb, yb, x, y);
+ }
+ if (xb.compareTo(yb) != Integer.compare(x, y)) {
+
+
+
+
+
+
+ fail("Incorrect results for IntBuffer.compareTo",
+ xb, yb, x, y);
+ }
+ if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) {
+ fail("Incorrect results for IntBuffer.equals",
+ xb, yb, x, y);
+ }
+ }
+ }
+
// Sub, dup
relPut(b);
diff --git a/jdk/test/java/nio/Buffer/BasicLong.java b/jdk/test/java/nio/Buffer/BasicLong.java
index 0d4c568e1e3..0abc7cdf2f4 100644
--- a/jdk/test/java/nio/Buffer/BasicLong.java
+++ b/jdk/test/java/nio/Buffer/BasicLong.java
@@ -38,6 +38,26 @@ public class BasicLong
extends Basic
{
+ private static final long[] VALUES = {
+ Long.MIN_VALUE,
+ (long) -1,
+ (long) 0,
+ (long) 1,
+ Long.MAX_VALUE,
+
+
+
+
+
+
+
+
+
+
+
+
+ };
+
private static void relGet(LongBuffer b) {
int n = b.capacity();
long v;
@@ -308,6 +328,12 @@ public class BasicLong
+
+ private static void fail(String problem,
+ LongBuffer xb, LongBuffer yb,
+ long x, long y) {
+ fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
+ }
private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
boolean caught = false;
@@ -522,6 +548,42 @@ public class BasicLong
if (b.compareTo(b2) <= 0)
fail("Comparison to lesser buffer <= 0", b, b2);
+ // Check equals and compareTo with interesting values
+ for (long x : VALUES) {
+ LongBuffer xb = LongBuffer.wrap(new long[] { x });
+ if (xb.compareTo(xb) != 0) {
+ fail("compareTo not reflexive", xb, xb, x, x);
+ }
+ if (! xb.equals(xb)) {
+ fail("equals not reflexive", xb, xb, x, x);
+ }
+ for (long y : VALUES) {
+ LongBuffer yb = LongBuffer.wrap(new long[] { y });
+ if (xb.compareTo(yb) != - yb.compareTo(xb)) {
+ fail("compareTo not anti-symmetric",
+ xb, yb, x, y);
+ }
+ if ((xb.compareTo(yb) == 0) != xb.equals(yb)) {
+ fail("compareTo inconsistent with equals",
+ xb, yb, x, y);
+ }
+ if (xb.compareTo(yb) != Long.compare(x, y)) {
+
+
+
+
+
+
+ fail("Incorrect results for LongBuffer.compareTo",
+ xb, yb, x, y);
+ }
+ if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) {
+ fail("Incorrect results for LongBuffer.equals",
+ xb, yb, x, y);
+ }
+ }
+ }
+
// Sub, dup
relPut(b);
diff --git a/jdk/test/java/nio/Buffer/BasicShort.java b/jdk/test/java/nio/Buffer/BasicShort.java
index 58e5a3e6d68..861d356b6df 100644
--- a/jdk/test/java/nio/Buffer/BasicShort.java
+++ b/jdk/test/java/nio/Buffer/BasicShort.java
@@ -38,6 +38,26 @@ public class BasicShort
extends Basic
{
+ private static final short[] VALUES = {
+ Short.MIN_VALUE,
+ (short) -1,
+ (short) 0,
+ (short) 1,
+ Short.MAX_VALUE,
+
+
+
+
+
+
+
+
+
+
+
+
+ };
+
private static void relGet(ShortBuffer b) {
int n = b.capacity();
short v;
@@ -308,6 +328,12 @@ public class BasicShort
+
+ private static void fail(String problem,
+ ShortBuffer xb, ShortBuffer yb,
+ short x, short y) {
+ fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
+ }
private static void tryCatch(Buffer b, Class ex, Runnable thunk) {
boolean caught = false;
@@ -522,6 +548,42 @@ public class BasicShort
if (b.compareTo(b2) <= 0)
fail("Comparison to lesser buffer <= 0", b, b2);
+ // Check equals and compareTo with interesting values
+ for (short x : VALUES) {
+ ShortBuffer xb = ShortBuffer.wrap(new short[] { x });
+ if (xb.compareTo(xb) != 0) {
+ fail("compareTo not reflexive", xb, xb, x, x);
+ }
+ if (! xb.equals(xb)) {
+ fail("equals not reflexive", xb, xb, x, x);
+ }
+ for (short y : VALUES) {
+ ShortBuffer yb = ShortBuffer.wrap(new short[] { y });
+ if (xb.compareTo(yb) != - yb.compareTo(xb)) {
+ fail("compareTo not anti-symmetric",
+ xb, yb, x, y);
+ }
+ if ((xb.compareTo(yb) == 0) != xb.equals(yb)) {
+ fail("compareTo inconsistent with equals",
+ xb, yb, x, y);
+ }
+ if (xb.compareTo(yb) != Short.compare(x, y)) {
+
+
+
+
+
+
+ fail("Incorrect results for ShortBuffer.compareTo",
+ xb, yb, x, y);
+ }
+ if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y)))) {
+ fail("Incorrect results for ShortBuffer.equals",
+ xb, yb, x, y);
+ }
+ }
+ }
+
// Sub, dup
relPut(b);
diff --git a/jdk/test/java/nio/Buffer/genBasic.sh b/jdk/test/java/nio/Buffer/genBasic.sh
index da5fca5df33..009cf2dbb1b 100644
--- a/jdk/test/java/nio/Buffer/genBasic.sh
+++ b/jdk/test/java/nio/Buffer/genBasic.sh
@@ -36,5 +36,3 @@ gen int Int Integer
gen long Long Long
gen float Float Float
gen double Double Double
-
-rm -rf build
From 8e1f9a0dd399f0fc81ea1b61eadb2097909206a5 Mon Sep 17 00:00:00 2001
From: Weijun Wang
Date: Wed, 9 Dec 2009 11:15:25 +0800
Subject: [PATCH 02/17] 6908628: ObjectIdentifier s11n test fails
Reviewed-by: xuelei
---
jdk/test/sun/security/util/Oid/S11N.sh | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/jdk/test/sun/security/util/Oid/S11N.sh b/jdk/test/sun/security/util/Oid/S11N.sh
index 081cd52298f..82046f360c0 100644
--- a/jdk/test/sun/security/util/Oid/S11N.sh
+++ b/jdk/test/sun/security/util/Oid/S11N.sh
@@ -1,5 +1,5 @@
#
-# Copyright 2004-2005 Sun Microsystems, Inc. All Rights Reserved.
+# Copyright 2004-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -21,8 +21,8 @@
# have any questions.
#
# @test
-# @bug 4811968
-# @summary Serialization compatibility with old versions
+# @bug 4811968 6908628
+# @summary Serialization compatibility with old versions (and fix)
# @author Weijun Wang
#
# set a few environment variables so that the shell-script can run stand-alone
@@ -99,7 +99,8 @@ esac
# the test code
-${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}SerialTest.java || exit 10
+${TESTJAVA}${FS}bin${FS}javac -target 1.4 -source 1.4 \
+ -d . ${TESTSRC}${FS}SerialTest.java || exit 10
OLDJAVA="
/java/re/j2se/1.6.0/latest/binaries/${PF}
@@ -161,4 +162,10 @@ rm -f tmp.oid.serial
rm -f tmp.oid.serial.old
rm -f SerialTest.class
+for oldj in ${OLDJAVA}; do
+ if [ ! -d ${oldj} ]; then
+ echo WARNING: ${oldj} is missing. Test incomplete! > /dev/stderr
+ fi
+done
+
exit 0
From 61c09153f3ae8b5b1ed7933e42d0cf3e106469dc Mon Sep 17 00:00:00 2001
From: Kelly O'Hair
Date: Wed, 9 Dec 2009 09:46:57 -0800
Subject: [PATCH 03/17] 6906210: Fix another minor typo in test/Makefile
Reviewed-by: tbell, dcubed
---
jdk/test/Makefile | 35 +++++++--
jdk/test/ProblemList.txt | 82 ++++++++++++++++++++
jdk/test/com/sun/jdi/NoLaunchOptionTest.java | 12 ++-
jdk/test/com/sun/jdi/OptionTest.java | 11 ++-
jdk/test/sun/tools/jhat/HatRun.java | 6 +-
5 files changed, 134 insertions(+), 12 deletions(-)
diff --git a/jdk/test/Makefile b/jdk/test/Makefile
index 25f0dc1ed6f..c3e0ad3a62c 100644
--- a/jdk/test/Makefile
+++ b/jdk/test/Makefile
@@ -291,7 +291,7 @@ TESTEXIT = \
fi ; \
testExitCode=`$(CAT) $(EXITCODE)`; \
$(ECHO) "EXIT CODE: $${testExitCode}"; \
- exit ${testExitCode}
+ exit $${testExitCode}
BUNDLE_UP_AND_EXIT = \
( \
@@ -300,7 +300,7 @@ BUNDLE_UP_AND_EXIT = \
$(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
$(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
if [ -r "$${_summary}" ] ; then \
- $(ECHO) "Summary: $${_summary}" > $(STATS_TXT); \
+ $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
$(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
$(EGREP) ' Passed\.' $(RUNLIST) \
| $(EGREP) -v ' Error\.' \
@@ -418,8 +418,9 @@ $(ECHO) "Running tests in othervm mode: $(call TestDirs, $?)"
$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
endef
define SummaryInfo
-$(ECHO) "Summary for: $?"
+$(ECHO) "########################################################"
$(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME))
+$(ECHO) "########################################################"
endef
# ------------------------------------------------------------------
@@ -446,10 +447,14 @@ JDK_ALL_TARGETS += jdk_beans2
jdk_beans2: java/beans/Beans java/beans/EventHandler java/beans/XMLDecoder \
java/beans/PropertyEditor
$(call RunOthervmBatch)
+
+# Stable othervm testruns (minus items from PROBLEM_LIST)
+# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_beans3
jdk_beans3: java/beans/XMLEncoder
$(call RunOthervmBatch)
+# All beans tests
jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3
@$(SummaryInfo)
@@ -475,6 +480,7 @@ JDK_ALL_TARGETS += jdk_management2
jdk_management2: com/sun/jmx com/sun/management sun/management
$(call RunOthervmBatch)
+# All management tests
jdk_management: jdk_management1 jdk_management2
@$(SummaryInfo)
@@ -506,10 +512,14 @@ JDK_ALL_TARGETS += jdk_nio2
jdk_nio2: java/nio/Buffer java/nio/ByteOrder \
java/nio/channels java/nio/BufferPoolMXBean java/nio/MappedByteBuffer
$(call RunOthervmBatch)
+
+# Stable othervm testruns (minus items from PROBLEM_LIST)
+# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_nio3
jdk_nio3: com/sun/nio sun/nio
$(call RunOthervmBatch)
+# All nio tests
jdk_nio: jdk_nio1 jdk_nio2 jdk_nio3
@$(SummaryInfo)
@@ -529,10 +539,14 @@ jdk_security1: java/security
JDK_ALL_TARGETS += jdk_security2
jdk_security2: javax/crypto com/sun/crypto
$(call RunOthervmBatch)
+
+# Stable othervm testruns (minus items from PROBLEM_LIST)
+# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_security3
jdk_security3: com/sun/security lib/security javax/security sun/security
$(call RunOthervmBatch)
+# All security tests
jdk_security: jdk_security1 jdk_security2 jdk_security3
@$(SummaryInfo)
@@ -547,15 +561,18 @@ JDK_ALL_TARGETS += jdk_text
jdk_text: java/text sun/text
$(call RunSamevmBatch)
-# Stable othervm testruns (minus items from PROBLEM_LIST)
-# Using samevm has serious problems with these tests
+# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_tools1
jdk_tools1: com/sun/jdi
$(call RunSamevmBatch)
+
+# Stable othervm testruns (minus items from PROBLEM_LIST)
+# Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_tools2
jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing
$(call RunOthervmBatch)
+# All tools tests
jdk_tools: jdk_tools1 jdk_tools2
@$(SummaryInfo)
@@ -567,7 +584,9 @@ jdk_util: java/util sun/util
# ------------------------------------------------------------------
# Run all tests
-jdk_all: $(filter-out jdk_awt jdk_rmi jdk_swing, $(JDK_ALL_TARGETS))
+FILTER_OUT_LIST=jdk_awt jdk_rmi jdk_swing
+JDK_ALL_STABLE_TARGETS := $(filter-out $(FILTER_OUT_LIST), $(JDK_ALL_TARGETS))
+jdk_all: $(JDK_ALL_STABLE_TARGETS)
@$(SummaryInfo)
# These are all phony targets
@@ -587,8 +606,8 @@ JTREG_BASIC_OPTIONS += -v:fail,error,time
JTREG_BASIC_OPTIONS += -retain:fail,error
# Ignore tests are not run and completely silent about it
JTREG_BASIC_OPTIONS += -ignore:quiet
-# Multiple by 2 the timeout numbers
-JTREG_BASIC_OPTIONS += -timeoutFactor:2
+# Multiple by 4 the timeout numbers
+JTREG_BASIC_OPTIONS += -timeoutFactor:4
# Boost the max memory for jtreg to avoid gc thrashing
JTREG_BASIC_OPTIONS += -J-Xmx512m
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 2edcfd4d595..3a5d2f10584 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -431,6 +431,11 @@ java/lang/ClassLoader/deadlock/TestCrossDelegate.sh generic-all
# jdk_management
+# Fails on Windows 2000, Test failed for iiop java.lang.NullPointerException
+# at org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(Unknown Source)
+# at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:653)
+javax/management/remote/mandatory/connection/ReconnectTest.java generic-all
+
# Solaris 10 sparc, NPE from org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke
javax/management/remote/mandatory/threads/ExecutorTest.java generic-all
@@ -717,6 +722,9 @@ sun/net/www/http/KeepAliveCache/KeepAliveTimerThread.java generic-all
# Connection refused, windows samevm
sun/net/www/protocol/http/DigestTest.java generic-all
+# Fails on Fedora 9 32bit & 64bit & Solaris 10, wrong proxy for http://localhost/index.html
+java/net/ProxySelector/B6737819.java generic-all
+
############################################################################
# jdk_nio
@@ -724,6 +732,29 @@ sun/net/www/protocol/http/DigestTest.java generic-all
# Suspect many of these tests auffer from using fixed ports, no concrete
# evidence.
+# Fails on Windows 2000, Can't delete test directory .\x.SetLastModified.dir
+# at SetLastModified.main(SetLastModified.java:107)
+java/io/File/SetLastModified.java generic-all
+
+# Fails on Solaris 10 x64, address already in use
+java/nio/channels/DatagramChannel/SRTest.java generic-all
+
+# Fails on Solaris 10 x86, times out
+java/nio/channels/DatagramChannel/Sender.java generic-all
+
+# Fails on Fedora 9 x86, address in use
+java/nio/channels/Selector/SelectWrite.java generic-all
+
+# Fails on Fedora 9 32bit times out
+java/nio/channels/DatagramChannel/EmptyBuffer.java generic-all
+
+# Fails on Windows 2000, ExceptionInInitializerError
+# in WindowsAsynchronousServerSocketChannelImpl.java:316
+java/nio/channels/AsynchronousChannelGroup/Unbounded.java generic-all
+
+# Fails on Windows 2000, times out
+java/nio/channels/FileChannel/Transfer.java generic-all
+
# Fails on OpenSolaris, IllegalStateException: Cannot add or remove addresses
# from a channel that is bound to the wildcard address
com/sun/nio/sctp/SctpChannel/Bind.java generic-all
@@ -893,6 +924,45 @@ java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java generic-all
# jdk_security
+# Fails on Solaris 10 X64, address already in use
+sun/security/krb5/auto/HttpNegotiateServer.java generic-all
+
+# Fails on almost all platforms
+# java.lang.UnsupportedClassVersionError: SerialTest :
+# Unsupported major.minor version 51.0
+# at java.lang.ClassLoader.defineClass1(Native Method)
+sun/security/util/Oid/S11N.sh generic-all
+
+# Fails on Fedora 9 32bit
+# GSSException: Failure unspecified at GSS-API level (Mechanism level:
+# Invalid argument (400) - Cannot find key of appropriate type to decrypt
+# AP REP - DES CBC mode with MD5)
+# at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:778)
+sun/security/krb5/auto/NonMutualSpnego.java generic-all
+
+# Fails on Solaris 10 sparc, GSSException: Failure unspecified at GSS-API level
+# Also fails on Windows 2000 similar way
+sun/security/krb5/auto/ok-as-delegate.sh generic-all
+
+# Fails on Windows 2000, GSSException: Failure unspecified at GSS-API level
+# (Mechanism level: Request is a replay (34))
+sun/security/krb5/auto/ok-as-delegate-xrealm.sh generic-all
+
+# Fails on Windows 2000, ExceptionInInitializerError
+sun/security/mscapi/AccessKeyStore.sh generic-all
+
+# Fails on Windows 2000, UnsatisfiedLinkError: libnspr4.dll: Access is denied
+sun/security/pkcs11/KeyAgreement/TestDH.java generic-all
+
+# Fails on Windows 2000, UnsatisfiedLinkError: libnspr4.dll: Access is denied
+sun/security/pkcs11/fips/ClientJSSEServerJSSE.java generic-all
+
+# Fails on Solaris 10, KrbException: Additional pre-authentication required (25)
+sun/security/krb5/auto/basic.sh generic-all
+
+# Fails on Fedora 9 64bit, PKCS11Exception: CKR_DEVICE_ERROR
+sun/security/pkcs11/KeyAgreement/TestDH.java generic-all
+
# Run too slow on Solaris 10 sparc
sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/SSLSocketTimeoutNulls.java solaris-sparc
sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientTimeout.java solaris-sparc
@@ -1088,6 +1158,13 @@ java/text/Bidi/Bug6665028.java linux-x64
# So most if not all tools tests are now being run with "othervm" mode.
# Some of these tools tests have a tendency to use fixed ports, bad idea.
+# Fails on Fedora 9 32bit, jps output differs problem
+sun/tools/jstatd/jstatdDefaults.sh generic-all
+
+# Fails on Linux Fedora 9 32bit, Could not read data for remote JVM 16133
+# jstat output differs from expected output
+sun/tools/jstatd/jstatdExternalRegistry.sh generic-all
+
# Output of jps differs from expected output.
# Invalid argument count on solaris-sparc and x64
sun/tools/jstatd/jstatdPort.sh generic-all
@@ -1099,6 +1176,11 @@ sun/tools/jps/jps-lm.sh generic-all
sun/tools/jps/jps-Vvml_2.sh generic-all
sun/tools/jps/jps-m_2.sh generic-all
+# Fails on Solaris 10 sparcv9, shell exits with 1
+# Turning off use of shared archive because of choice of garbage collector or large pages
+# Could not synchronize with target
+sun/tools/jps/jps-v_1.sh generic-all
+
# Fails on OpenSolaris "Could not synchronize with target"
sun/tools/jps/jps-Defaults.sh generic-all
sun/tools/jps/jps-V_2.sh generic-all
diff --git a/jdk/test/com/sun/jdi/NoLaunchOptionTest.java b/jdk/test/com/sun/jdi/NoLaunchOptionTest.java
index b65b375c85e..14e6acd2c5d 100644
--- a/jdk/test/com/sun/jdi/NoLaunchOptionTest.java
+++ b/jdk/test/com/sun/jdi/NoLaunchOptionTest.java
@@ -31,6 +31,9 @@
* @build VMConnection
* @run main/othervm NoLaunchOptionTest
*/
+
+import java.net.ServerSocket;
+
public class NoLaunchOptionTest extends Object {
private Process subprocess;
private int subprocessStatus;
@@ -121,12 +124,19 @@ public class NoLaunchOptionTest extends Object {
}
public static void main(String[] args) throws Exception {
+ // find a free port
+ ServerSocket ss = new ServerSocket(0);
+ int port = ss.getLocalPort();
+ ss.close();
+ String address = String.valueOf(port);
+
String javaExe = System.getProperty("java.home") +
java.io.File.separator + "bin" +
java.io.File.separator + "java";
String targetClass = "NotAClass";
String cmds [] = {javaExe,
- "-agentlib:jdwp=transport=dt_socket,address=8000," +
+ "-agentlib:jdwp=transport=dt_socket,address=" +
+ address + "," +
"onthrow=java.lang.ClassNotFoundException,suspend=n",
targetClass};
NoLaunchOptionTest myTest = new NoLaunchOptionTest();
diff --git a/jdk/test/com/sun/jdi/OptionTest.java b/jdk/test/com/sun/jdi/OptionTest.java
index e3d6eb60b2d..f6124d3e02a 100644
--- a/jdk/test/com/sun/jdi/OptionTest.java
+++ b/jdk/test/com/sun/jdi/OptionTest.java
@@ -32,6 +32,9 @@
* @run compile -g VMConnection.java
* @run main/othervm OptionTest
*/
+
+import java.net.ServerSocket;
+
public class OptionTest extends Object {
private Process subprocess;
private int subprocessStatus;
@@ -122,12 +125,18 @@ public class OptionTest extends Object {
}
public static void main(String[] args) throws Exception {
+ // find a free port
+ ServerSocket ss = new ServerSocket(0);
+ int port = ss.getLocalPort();
+ ss.close();
+ String address = String.valueOf(port);
+
String javaExe = System.getProperty("java.home") +
java.io.File.separator + "bin" +
java.io.File.separator + "java";
String targetClass = "HelloWorld";
String baseOptions = "transport=dt_socket" +
- ",address=8000" +
+ ",address=" + address +
",server=y" +
",suspend=n";
diff --git a/jdk/test/sun/tools/jhat/HatRun.java b/jdk/test/sun/tools/jhat/HatRun.java
index cb1e41b248e..6d736f83193 100644
--- a/jdk/test/sun/tools/jhat/HatRun.java
+++ b/jdk/test/sun/tools/jhat/HatRun.java
@@ -166,8 +166,10 @@ public class HatRun {
jre_home );
String cdir = System.getProperty("test.classes", ".");
String os_arch = System.getProperty("os.arch");
- boolean d64 = os_arch.equals("sparcv9") ||
- os_arch.equals("amd64");
+ String os_name = System.getProperty("os.name");
+ boolean d64 = os_name.equals("SunOS") && (
+ os_arch.equals("sparcv9") ||
+ os_arch.equals("amd64"));
String isa_dir = d64?(File.separator+os_arch):"";
String java = jre_home
+ File.separator + "bin" + isa_dir
From 07d94668d2dca9e256570e3e1429d16d7ff89cc3 Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Wed, 9 Dec 2009 17:55:48 -0800
Subject: [PATCH 04/17] 6909057: @see Arrays#hashCode missing particular method
specification in j.u.Objects.hash
Reviewed-by: ksrini
---
jdk/src/share/classes/java/util/Objects.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/share/classes/java/util/Objects.java b/jdk/src/share/classes/java/util/Objects.java
index 3ef61bde98d..8b009243eb9 100644
--- a/jdk/src/share/classes/java/util/Objects.java
+++ b/jdk/src/share/classes/java/util/Objects.java
@@ -119,7 +119,7 @@ public final class Objects {
*
* @param values the values to be hashed
* @return a hash value of the sequence of input values
- * @see Arrays#hashCode
+ * @see Arrays#hashCode(Object[])
* @see List#hashCode
*/
public static int hash(Object... values) {
From 642c276d6cbaee44f1cafea3fff2ca6b6ffec15d Mon Sep 17 00:00:00 2001
From: Mandy Chung
Date: Wed, 9 Dec 2009 21:09:38 -0800
Subject: [PATCH 05/17] 6909082: Docs warning from
java.util.logging.PlatformLoggingMXBean
Fix incorrect tag @See with @see.
Reviewed-by: darcy
---
.../share/classes/java/util/logging/PlatformLoggingMXBean.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java b/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java
index f994e285bcd..b27339461cb 100644
--- a/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java
+++ b/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java
@@ -51,7 +51,7 @@ import java.lang.management.PlatformManagedObject;
* The {@link PlatformManagedObject#getObjectName} method
* can be used to obtain its {@code ObjectName}.
*
- * @See java.lang.management.PlatformManagedObject
+ * @see java.lang.management.PlatformManagedObject
*
* @author Mandy Chung
* @since 1.7
From 526f2c6d7fee7ebe53692e11279d9ff5cdac4b14 Mon Sep 17 00:00:00 2001
From: Chris Hegarty
Date: Thu, 10 Dec 2009 15:52:19 +0000
Subject: [PATCH 06/17] 6909089: Memory leak occurs by lack of free for read
buffer in SocketInputStream#read()
Reviewed-by: alanb, jccollet
---
jdk/src/windows/native/java/net/SocketInputStream.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/jdk/src/windows/native/java/net/SocketInputStream.c b/jdk/src/windows/native/java/net/SocketInputStream.c
index 54c9a8a88fe..bbf6a9ac6fc 100644
--- a/jdk/src/windows/native/java/net/SocketInputStream.c
+++ b/jdk/src/windows/native/java/net/SocketInputStream.c
@@ -121,6 +121,9 @@ Java_java_net_SocketInputStream_socketRead0(JNIEnv *env, jobject this,
newfd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
if (newfd == -1) {
NET_ThrowSocketException(env, "Socket Closed");
+ if (bufP != BUF) {
+ free(bufP);
+ }
return -1;
}
}
From 317dfd520520459203b192db11593c5439397939 Mon Sep 17 00:00:00 2001
From: Sean Mullan
Date: Thu, 10 Dec 2009 11:31:22 -0500
Subject: [PATCH 07/17] 6867348: Digest Value of References inside Manifest -
calculation order problem
Reviewed-by: xuelei
---
.../dsig/internal/dom/DOMXMLSignature.java | 5 +-
.../xml/crypto/dsig/GenerationTests.java | 56 ++++++++++++++++++-
2 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
index a758486e0cb..092681bd92d 100644
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
@@ -326,7 +326,7 @@ public final class DOMXMLSignature extends DOMStructure
}
// generate references and signature value
- List allReferences = new ArrayList(si.getReferences());
+ List allReferences = new ArrayList();
// traverse the Signature and register all objects with IDs that
// may contain References
@@ -356,6 +356,9 @@ public final class DOMXMLSignature extends DOMStructure
}
}
}
+ // always add SignedInfo references after Manifest references so
+ // that Manifest reference are digested first
+ allReferences.addAll(si.getReferences());
// generate/digest each reference
for (int i = 0, size = allReferences.size(); i < size; i++) {
diff --git a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java
index 13881966d32..1ed649cd83a 100644
--- a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java
+++ b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 4635230 6283345 6303830 6824440
+ * @bug 4635230 6283345 6303830 6824440 6867348
* @summary Basic unit tests for generating XML Signatures with JSR 105
* @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
* X509KeySelector.java GenerationTests.java
@@ -126,13 +126,14 @@ public class GenerationTests {
test_create_signature_x509_is();
test_create_signature_x509_ski();
test_create_signature_x509_sn();
-// test_create_signature();
+ test_create_signature();
test_create_exc_signature();
test_create_sign_spec();
test_create_signature_enveloping_sha256_dsa();
test_create_signature_enveloping_sha384_rsa_sha256();
test_create_signature_enveloping_sha512_rsa_sha384();
test_create_signature_enveloping_sha512_rsa_sha512();
+ test_create_signature_reference_dependency();
}
private static void setup() throws Exception {
@@ -410,6 +411,55 @@ public class GenerationTests {
System.out.println();
}
+ static void test_create_signature_reference_dependency() throws Exception {
+ System.out.println("* Generating signature-reference-dependency.xml");
+ // create references
+ List refs = Collections.singletonList
+ (fac.newReference("#object-1", sha1));
+
+ // create SignedInfo
+ SignedInfo si = fac.newSignedInfo(withoutComments, rsaSha1, refs);
+
+ // create objects
+ List objs = new ArrayList();
+
+ // Object 1
+ List manRefs = Collections.singletonList
+ (fac.newReference("#object-2", sha1));
+ objs.add(fac.newXMLObject(Collections.singletonList
+ (fac.newManifest(manRefs, "manifest-1")), "object-1", null, null));
+
+ // Object 2
+ Document doc = db.newDocument();
+ Element nc = doc.createElementNS(null, "NonCommentandus");
+ nc.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", "");
+ nc.appendChild(doc.createComment(" Commentandum "));
+ objs.add(fac.newXMLObject(Collections.singletonList
+ (new DOMStructure(nc)), "object-2", null, null));
+
+ // create XMLSignature
+ XMLSignature sig = fac.newXMLSignature(si, rsa, objs, "signature", null);
+ DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc);
+
+ sig.sign(dsc);
+
+// dumpDocument(doc, new PrintWriter(System.out));
+
+ DOMValidateContext dvc = new DOMValidateContext
+ (kvks, doc.getDocumentElement());
+ XMLSignature sig2 = fac.unmarshalXMLSignature(dvc);
+
+ if (sig.equals(sig2) == false) {
+ throw new Exception
+ ("Unmarshalled signature is not equal to generated signature");
+ }
+ if (sig2.validate(dvc) == false) {
+ throw new Exception("Validation of generated signature failed");
+ }
+
+ System.out.println();
+ }
+
static void test_create_signature() throws Exception {
System.out.println("* Generating signature.xml");
@@ -645,6 +695,7 @@ public class GenerationTests {
envDoc.getElementsByTagName("YoursSincerely").item(0);
DOMSignContext dsc = new DOMSignContext(signingKey, ys);
+ dsc.setURIDereferencer(httpUd);
sig.sign(dsc);
@@ -660,6 +711,7 @@ public class GenerationTests {
DOMValidateContext dvc = new DOMValidateContext
(new X509KeySelector(ks), sigElement);
+ dvc.setURIDereferencer(httpUd);
File f = new File(
System.getProperty("dir.test.vector.baltimore") +
System.getProperty("file.separator") +
From d4acc8e0fcfc193351378efcd9b4f1d3ea0f0cc8 Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Thu, 10 Dec 2009 13:04:13 -0800
Subject: [PATCH 08/17] 6909070: Missing package statements in java.text.Bidi
@see links
Reviewed-by: anthony
---
jdk/src/share/classes/java/text/Bidi.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/jdk/src/share/classes/java/text/Bidi.java b/jdk/src/share/classes/java/text/Bidi.java
index e4db4b2d086..504021ff143 100644
--- a/jdk/src/share/classes/java/text/Bidi.java
+++ b/jdk/src/share/classes/java/text/Bidi.java
@@ -121,9 +121,9 @@ public final class Bidi {
*
* @param paragraph a paragraph of text with optional character and paragraph attribute information
*
- * @see TextAttribute#BIDI_EMBEDDING
- * @see TextAttribute#NUMERIC_SHAPING
- * @see TextAttribute#RUN_DIRECTION
+ * @see java.awt.font.TextAttribute#BIDI_EMBEDDING
+ * @see java.awt.font.TextAttribute#NUMERIC_SHAPING
+ * @see java.awt.font.TextAttribute#RUN_DIRECTION
*/
public Bidi(AttributedCharacterIterator paragraph) {
if (paragraph == null) {
From 5d2842c0cf3c8a10ae4c798cc5a914d6448e351e Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Thu, 10 Dec 2009 13:28:07 -0800
Subject: [PATCH 09/17] 4891262: API spec, javax/accessibility: few invalid
javadoc tags
Reviewed-by: jjg
---
.../accessibility/AccessibleContext.java | 6 ++---
.../accessibility/AccessibleExtendedText.java | 1 -
.../accessibility/AccessibleKeyBinding.java | 23 ++-----------------
3 files changed, 5 insertions(+), 25 deletions(-)
diff --git a/jdk/src/share/classes/javax/accessibility/AccessibleContext.java b/jdk/src/share/classes/javax/accessibility/AccessibleContext.java
index fbe7e9b1d6f..d4a093f72ec 100644
--- a/jdk/src/share/classes/javax/accessibility/AccessibleContext.java
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleContext.java
@@ -296,7 +296,7 @@ public abstract class AccessibleContext {
*
* @see #getAccessibleText
* @see #addPropertyChangeListener
- * @see #AccessibleText.AccessibleTextSequence
+ * @see AccessibleTextSequence
*/
public static final String ACCESSIBLE_TEXT_PROPERTY
= "AccessibleText";
@@ -311,7 +311,7 @@ public abstract class AccessibleContext {
*
* @see #getAccessibleText
* @see #addPropertyChangeListener
- * @see #AccessibleText.AccessibleTextSequence
+ * @see AccessibleTextSequence
*
* @since 1.5
*/
@@ -334,7 +334,7 @@ public abstract class AccessibleContext {
*
* @see #getAccessibleText
* @see #addPropertyChangeListener
- * @see #AccessibleText.AccessibleAttributeSequence
+ * @see AccessibleAttributeSequence
*
* @since 1.5
*/
diff --git a/jdk/src/share/classes/javax/accessibility/AccessibleExtendedText.java b/jdk/src/share/classes/javax/accessibility/AccessibleExtendedText.java
index 4868ab85e8f..f7a04252136 100644
--- a/jdk/src/share/classes/javax/accessibility/AccessibleExtendedText.java
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleExtendedText.java
@@ -45,7 +45,6 @@ import javax.swing.text.*;
* @see Accessible#getAccessibleContext
* @see AccessibleContext
* @see AccessibleContext#getAccessibleText
- * @see AccessibleText.AccessibleTextChunk
*
* @author Peter Korn
* @author Lynn Monsanto
diff --git a/jdk/src/share/classes/javax/accessibility/AccessibleKeyBinding.java b/jdk/src/share/classes/javax/accessibility/AccessibleKeyBinding.java
index cdf4c493a62..e50e9f54259 100644
--- a/jdk/src/share/classes/javax/accessibility/AccessibleKeyBinding.java
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleKeyBinding.java
@@ -32,16 +32,11 @@ package javax.accessibility;
* the standard mechanism for an assistive technology to determine the
* key bindings which exist for this object.
* Any object that has such key bindings should support this
- * interface. Applications can determine if an object supports the
- * AccessibleKeyBinding interface by first obtaining its AccessibleContext
- * (see @link Accessible} and then calling the
- * {@link AccessibleContext#getAccessibleKeyBinding} method. If the return
- * value is not null, the object supports this interface.
+ * interface.
*
* @see Accessible
* @see Accessible#getAccessibleContext
* @see AccessibleContext
- * @see AccessibleContext#getAccessibleKeyBinding
*
* @author Lynn Monsanto
* @since 1.4
@@ -58,21 +53,7 @@ public interface AccessibleKeyBinding {
/**
* Returns a key binding for this object. The value returned is an
* java.lang.Object which must be cast to appropriate type depending
- * on the underlying implementation of the key. For example, if the
- * Object returned is a javax.swing.KeyStroke, the user of this
- * method should do the following:
- *
- * Component c =
- * AccessibleContext ac = c.getAccessibleContext();
- * AccessibleKeyBinding akb = ac.getAccessibleKeyBinding();
- * for (int i = 0; i < akb.getAccessibleKeyBindingCount(); i++) {
- * Object o = akb.getAccessibleKeyBinding(i);
- * if (o instanceof javax.swing.KeyStroke) {
- * javax.swing.KeyStroke keyStroke = (javax.swing.KeyStroke)o;
- *
- * }
- * }
- *
+ * on the underlying implementation of the key.
*
* @param i zero-based index of the key bindings
* @return a javax.lang.Object which specifies the key binding
From 7f5baa6fe830b7622eeda16ddab41cbcf18415b3 Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Fri, 11 Dec 2009 10:40:14 -0800
Subject: [PATCH 10/17] 6909563: Javadoc build warnings in rmi, security,
management
Reviewed-by: mchung, mullan
---
.../classes/java/lang/management/PlatformManagedObject.java | 2 +-
jdk/src/share/classes/java/rmi/activation/Activatable.java | 6 +++---
jdk/src/share/classes/java/rmi/registry/LocateRegistry.java | 4 ++--
.../java/rmi/server/RemoteObjectInvocationHandler.java | 1 -
.../java/security/cert/CertPathValidatorException.java | 2 +-
5 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java b/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java
index 5f68635d4fe..ca5edbeb518 100644
--- a/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java
+++ b/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java
@@ -32,7 +32,7 @@ import javax.management.ObjectName;
* for monitoring and managing a component in the Java platform.
* Each platform managed object has a unique
* object name
- * for the {@linkplain ManagementFactory.getPlatformMBeanServer
+ * for the {@linkplain ManagementFactory#getPlatformMBeanServer
* platform MBeanServer} access.
* All platform MXBeans will implement this interface.
*
diff --git a/jdk/src/share/classes/java/rmi/activation/Activatable.java b/jdk/src/share/classes/java/rmi/activation/Activatable.java
index 07879812774..de02b0d6e31 100644
--- a/jdk/src/share/classes/java/rmi/activation/Activatable.java
+++ b/jdk/src/share/classes/java/rmi/activation/Activatable.java
@@ -73,7 +73,7 @@ public abstract class Activatable extends RemoteServer {
* can be handled properly.
*
* This method invokes the {@link
- * exportObject(Remote,String,MarshalledObject,boolean,port)
+ * #exportObject(Remote,String,MarshalledObject,boolean,int)
* exportObject} method with this object, and the specified location,
* data, restart mode, and port. Subsequent calls to {@link #getID}
* will return the activation identifier returned from the call to
@@ -120,7 +120,7 @@ public abstract class Activatable extends RemoteServer {
* can be handled properly.
*
*
This method invokes the {@link
- * exportObject(Remote,String,MarshalledObject,boolean,port,RMIClientSocketFactory,RMIServerSocketFactory)
+ * #exportObject(Remote,String,MarshalledObject,boolean,int,RMIClientSocketFactory,RMIServerSocketFactory)
* exportObject} method with this object, and the specified location,
* data, restart mode, port, and client and server socket factories.
* Subsequent calls to {@link #getID} will return the activation
@@ -312,7 +312,7 @@ public abstract class Activatable extends RemoteServer {
* separately, so that exceptions can be handled properly.
*
*
This method invokes the {@link
- * exportObject(Remote,String,MarshalledObject,boolean,port,RMIClientSocketFactory,RMIServerSocketFactory)
+ * #exportObject(Remote,String,MarshalledObject,boolean,int,RMIClientSocketFactory,RMIServerSocketFactory)
* exportObject} method with the specified object, location, data,
* restart mode, and port, and null
for both client and
* server socket factories, and then returns the resulting activation
diff --git a/jdk/src/share/classes/java/rmi/registry/LocateRegistry.java b/jdk/src/share/classes/java/rmi/registry/LocateRegistry.java
index d32e4035749..b65feca8c80 100644
--- a/jdk/src/share/classes/java/rmi/registry/LocateRegistry.java
+++ b/jdk/src/share/classes/java/rmi/registry/LocateRegistry.java
@@ -187,7 +187,7 @@ public final class LocateRegistry {
* host that accepts requests on the specified port
.
*
*
The Registry
instance is exported as if the static
- * {@link UnicastRemoteObject.exportObject(Remote,int)
+ * {@link UnicastRemoteObject#exportObject(Remote,int)
* UnicastRemoteObject.exportObject} method is invoked, passing the
* Registry
instance and the specified port
as
* arguments, except that the Registry
instance is
@@ -213,7 +213,7 @@ public final class LocateRegistry {
*
*
The Registry
instance is exported as if
* the static {@link
- * UnicastRemoteObject.exportObject(Remote,int,RMIClientSocketFactory,RMIServerSocketFactory)
+ * UnicastRemoteObject#exportObject(Remote,int,RMIClientSocketFactory,RMIServerSocketFactory)
* UnicastRemoteObject.exportObject} method is invoked, passing the
* Registry
instance, the specified port
, the
* specified RMIClientSocketFactory
, and the specified
diff --git a/jdk/src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java b/jdk/src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java
index 59de6cfad02..06647bac951 100644
--- a/jdk/src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java
+++ b/jdk/src/share/classes/java/rmi/server/RemoteObjectInvocationHandler.java
@@ -138,7 +138,6 @@ public class RemoteObjectInvocationHandler
* instance
* @throws Throwable the exception to throw from the method invocation
* on the proxy instance
- * @see
**/
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable
diff --git a/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java b/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java
index c1ca1d2b8de..86b0b45e276 100644
--- a/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java
+++ b/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java
@@ -216,7 +216,7 @@ public class CertPathValidatorException extends GeneralSecurityException {
/**
* Returns the reason that the validation failed. The reason is
* associated with the index of the certificate returned by
- * {@link getIndex}.
+ * {@link #getIndex}.
*
* @return the reason that the validation failed, or
* BasicReason.UNSPECIFIED
if a reason has not been
From d44fe667d85bdb441b8a976447c4eed33be14ae8 Mon Sep 17 00:00:00 2001
From: Kelly O'Hair
Date: Fri, 11 Dec 2009 15:29:22 -0800
Subject: [PATCH 11/17] 6909373: Add -ea to the testing done by
jdk/test/Makefile
Reviewed-by: darcy
---
jdk/test/Makefile | 15 +++++++++++----
jdk/test/ProblemList.txt | 24 ++++++++++++++++++++++++
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/jdk/test/Makefile b/jdk/test/Makefile
index c3e0ad3a62c..bffa3ad7cb0 100644
--- a/jdk/test/Makefile
+++ b/jdk/test/Makefile
@@ -370,7 +370,8 @@ ifndef USE_JTREG_SAMEVM
endif
# With samevm, you cannot use -javaoptions?
ifeq ($(USE_JTREG_SAMEVM),true)
- EXTRA_JTREG_OPTIONS += -samevm $(JAVA_ARGS) $(JAVA_ARGS:%=-vmoption:%)
+ JTREG_SAMEVM_OPTION = -samevm
+ EXTRA_JTREG_OPTIONS += $(JTREG_SAMEVM_OPTION) $(JAVA_ARGS) $(JAVA_ARGS:%=-vmoption:%)
JTREG_TEST_OPTIONS = $(JAVA_VM_ARGS:%=-vmoption:%)
else
JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
@@ -600,16 +601,22 @@ JTREG = $(JT_HOME)/win32/bin/jtreg
JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
# Only run automatic tests
JTREG_BASIC_OPTIONS += -a
+# Always turn on assertions
+JTREG_ASSERT_OPTION = -ea -esa
+JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
# Report details on all failed or error tests, times too
JTREG_BASIC_OPTIONS += -v:fail,error,time
# Retain all files for failing tests
JTREG_BASIC_OPTIONS += -retain:fail,error
# Ignore tests are not run and completely silent about it
-JTREG_BASIC_OPTIONS += -ignore:quiet
+JTREG_IGNORE_OPTION = -ignore:quiet
+JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
# Multiple by 4 the timeout numbers
-JTREG_BASIC_OPTIONS += -timeoutFactor:4
+JTREG_TIMEOUT_OPTION = -timeoutFactor:4
+JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
# Boost the max memory for jtreg to avoid gc thrashing
-JTREG_BASIC_OPTIONS += -J-Xmx512m
+JTREG_MEMORY_OPTION = -J-Xmx512m
+JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
# Make sure jtreg exists
$(JTREG): $(JT_HOME)
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 3a5d2f10584..9cf24b2a5e1 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -586,6 +586,14 @@ javax/print/attribute/MediaMappingsTest.java generic-all
# Suspect many of these tests auffer from using fixed ports, no concrete
# evidence.
+# Dies on Solaris 10 sparc and sparcv9, Linux -ea -esa with
+# Interrupted or IO exception, maybe writing to non-unique named file?
+com/sun/net/httpserver/bugs/B6373555.java generic-all
+
+# Dies on pretty much all platforms when run with -ea -esa, Assertion error
+java/net/CookieHandler/TestHttpCookie.java generic-all
+java/net/URLClassLoader/closetest/CloseTest.java generic-all
+
# Fails on OpenSolaris, BindException unexpected
java/net/BindException/Test.java generic-all
@@ -732,6 +740,10 @@ java/net/ProxySelector/B6737819.java generic-all
# Suspect many of these tests auffer from using fixed ports, no concrete
# evidence.
+# Fails with -ea -esa, Assertion error, but only on Solaris 10 machines?
+com/sun/nio/sctp/SctpChannel/Send.java generic-all
+com/sun/nio/sctp/SctpChannel/Shutdown.java generic-all
+
# Fails on Windows 2000, Can't delete test directory .\x.SetLastModified.dir
# at SetLastModified.main(SetLastModified.java:107)
java/io/File/SetLastModified.java generic-all
@@ -924,6 +936,9 @@ java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java generic-all
# jdk_security
+# Fails with -ea -esa, but only on Solaris sparc? Suspect it is timing out
+sun/security/tools/keytool/standard.sh generic-all
+
# Fails on Solaris 10 X64, address already in use
sun/security/krb5/auto/HttpNegotiateServer.java generic-all
@@ -1158,6 +1173,9 @@ java/text/Bidi/Bug6665028.java linux-x64
# So most if not all tools tests are now being run with "othervm" mode.
# Some of these tools tests have a tendency to use fixed ports, bad idea.
+# Fails with -ea -esa on Solaris, Assertion error (Solaris specific test)
+com/sun/tracing/BasicFunctionality.java generic-all
+
# Fails on Fedora 9 32bit, jps output differs problem
sun/tools/jstatd/jstatdDefaults.sh generic-all
@@ -1242,6 +1260,12 @@ tools/jar/index/MetaInf.java windows-all
# jdk_util
+# Fails with -ea -esa on all platforms with Assertion error
+java/util/ResourceBundle/Test4300693.java generic-all
+
+# Failing on all -client 32bit platforms starting with b77? See 6908348.
+java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java generic-all
+
# Assert error, failures, on Linux Fedora 9 -server
# Windows samevm failure, assert error "Passed = 134, failed = 2"
java/util/Arrays/ArrayObjectMethods.java generic-all
From d610594e7395dac5257f4512f5fc7654aa330063 Mon Sep 17 00:00:00 2001
From: Andrew John Hughes
Date: Fri, 11 Dec 2009 23:47:10 +0000
Subject: [PATCH 12/17] 6909442: Fix comments in
test/sun/tools/jhat/HatRun.java
Update the comments in this test to match the changes in 6902325
Reviewed-by: ohair
---
jdk/test/sun/tools/jhat/HatRun.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/jdk/test/sun/tools/jhat/HatRun.java b/jdk/test/sun/tools/jhat/HatRun.java
index cb1e41b248e..41f6911291e 100644
--- a/jdk/test/sun/tools/jhat/HatRun.java
+++ b/jdk/test/sun/tools/jhat/HatRun.java
@@ -176,13 +176,15 @@ public class HatRun {
+ File.separator + "jhat";
/* Array of strings to be passed in for exec:
* 1. java
- * 2. -Dtest.classes=.
- * 3. -d64 (optional)
- * 4. -Xcheck:jni (Just because it finds bugs)
- * 5. -Xverify:all (Make sure verification is on full blast)
- * 6. -agent
+ * 2. -cp
+ * 3. cdir
+ * 4. -Dtest.classes=.
+ * 5. -d64 (optional)
+ * 6. -Xcheck:jni (Just because it finds bugs)
+ * 7. -Xverify:all (Make sure verification is on full blast)
+ * 8. -agent
* vm_options
- * 7+i. classname
+ * 9+i. classname
*/
int nvm_options = 0;
if ( vm_options != null ) nvm_options = vm_options.length;
From 37a980650b7382127511d6ccdd871957191cef16 Mon Sep 17 00:00:00 2001
From: Joe Darcy
Date: Tue, 15 Dec 2009 13:51:44 -0800
Subject: [PATCH 13/17] 6908131: Pure Java implementations of
StrictMath.floor(double) & StrictMath.ceil(double)
Reviewed-by: alanb
---
jdk/make/java/java/mapfile-vers | 2 -
jdk/make/java/java/reorder-i586 | 1 -
jdk/make/java/java/reorder-sparc | 1 -
jdk/make/java/java/reorder-sparcv9 | 1 -
.../share/classes/java/lang/StrictMath.java | 54 ++++-
jdk/src/share/native/java/lang/StrictMath.c | 12 --
.../java/lang/Math/CeilAndFloorTests.java | 201 ++++++++++++++++++
7 files changed, 253 insertions(+), 19 deletions(-)
create mode 100644 jdk/test/java/lang/Math/CeilAndFloorTests.java
diff --git a/jdk/make/java/java/mapfile-vers b/jdk/make/java/java/mapfile-vers
index 661db2f463c..24c8d21a789 100644
--- a/jdk/make/java/java/mapfile-vers
+++ b/jdk/make/java/java/mapfile-vers
@@ -150,10 +150,8 @@ SUNWprivate_1.1 {
Java_java_lang_StrictMath_asin;
Java_java_lang_StrictMath_atan;
Java_java_lang_StrictMath_atan2;
- Java_java_lang_StrictMath_ceil;
Java_java_lang_StrictMath_cos;
Java_java_lang_StrictMath_exp;
- Java_java_lang_StrictMath_floor;
Java_java_lang_StrictMath_log;
Java_java_lang_StrictMath_log10;
Java_java_lang_StrictMath_pow;
diff --git a/jdk/make/java/java/reorder-i586 b/jdk/make/java/java/reorder-i586
index 6489abcdc2c..fc3202a8439 100644
--- a/jdk/make/java/java/reorder-i586
+++ b/jdk/make/java/java/reorder-i586
@@ -107,4 +107,3 @@ text: .text%Java_java_lang_Class_isInstance;
text: .text%Java_java_util_TimeZone_getSystemTimeZoneID;
text: .text%findJavaTZ_md;
text: .text%Java_java_lang_StrictMath_log;
-text: .text%Java_java_lang_StrictMath_floor;
diff --git a/jdk/make/java/java/reorder-sparc b/jdk/make/java/java/reorder-sparc
index 22a178b6498..090f0001da2 100644
--- a/jdk/make/java/java/reorder-sparc
+++ b/jdk/make/java/java/reorder-sparc
@@ -105,4 +105,3 @@ text: .text%Java_java_util_TimeZone_getSystemTimeZoneID;
text: .text%findJavaTZ_md;
text: .text%Java_java_lang_StrictMath_log;
text: .text%Java_java_lang_StrictMath_sqrt;
-text: .text%Java_java_lang_StrictMath_floor;
diff --git a/jdk/make/java/java/reorder-sparcv9 b/jdk/make/java/java/reorder-sparcv9
index d5f49f21ac6..b20b45ab960 100644
--- a/jdk/make/java/java/reorder-sparcv9
+++ b/jdk/make/java/java/reorder-sparcv9
@@ -101,4 +101,3 @@ text: .text%Java_java_util_TimeZone_getSystemTimeZoneID;
text: .text%findJavaTZ_md;
text: .text%Java_java_lang_StrictMath_log;
text: .text%Java_java_lang_StrictMath_sqrt;
-text: .text%Java_java_lang_StrictMath_floor;
diff --git a/jdk/src/share/classes/java/lang/StrictMath.java b/jdk/src/share/classes/java/lang/StrictMath.java
index dad91405741..704be3e310e 100644
--- a/jdk/src/share/classes/java/lang/StrictMath.java
+++ b/jdk/src/share/classes/java/lang/StrictMath.java
@@ -26,6 +26,7 @@
package java.lang;
import java.util.Random;
import sun.misc.FpUtils;
+import sun.misc.DoubleConsts;
/**
* The class {@code StrictMath} contains methods for performing basic
@@ -316,7 +317,9 @@ public final class StrictMath {
* floating-point value that is greater than or equal to
* the argument and is equal to a mathematical integer.
*/
- public static native double ceil(double a);
+ public static double ceil(double a) {
+ return floorOrCeil(a, -0.0, 1.0, 1.0);
+ }
/**
* Returns the largest (closest to positive infinity)
@@ -333,7 +336,54 @@ public final class StrictMath {
* floating-point value that less than or equal to the argument
* and is equal to a mathematical integer.
*/
- public static native double floor(double a);
+ public static double floor(double a) {
+ return floorOrCeil(a, -1.0, 0.0, -1.0);
+ }
+
+ /**
+ * Internal method to share logic between floor and ceil.
+ *
+ * @param a the value to be floored or ceiled
+ * @param negativeBoundary result for values in (-1, 0)
+ * @param positiveBoundary result for values in (0, 1)
+ * @param increment value to add when the argument is non-integral
+ */
+ private static double floorOrCeil(double a,
+ double negativeBoundary,
+ double positiveBoundary,
+ double sign) {
+ int exponent = Math.getExponent(a);
+
+ if (exponent < 0) {
+ /*
+ * Absolute value of argument is less than 1.
+ * floorOrceil(-0.0) => -0.0
+ * floorOrceil(+0.0) => +0.0
+ */
+ return ((a == 0.0) ? a :
+ ( (a < 0.0) ? negativeBoundary : positiveBoundary) );
+ } else if (exponent >= 52) {
+ /*
+ * Infinity, NaN, or a value so large it must be integral.
+ */
+ return a;
+ }
+ // Else the argument is either an integral value already XOR it
+ // has to be rounded to one.
+ assert exponent >= 0 && exponent <= 51;
+
+ long doppel = Double.doubleToRawLongBits(a);
+ long mask = DoubleConsts.SIGNIF_BIT_MASK >> exponent;
+
+ if ( (mask & doppel) == 0L )
+ return a; // integral value
+ else {
+ double result = Double.longBitsToDouble(doppel & (~mask));
+ if (sign*a > 0.0)
+ result = result + sign;
+ return result;
+ }
+ }
/**
* Returns the {@code double} value that is closest in value
diff --git a/jdk/src/share/native/java/lang/StrictMath.c b/jdk/src/share/native/java/lang/StrictMath.c
index 2bf12e3b71e..01024b309d3 100644
--- a/jdk/src/share/native/java/lang/StrictMath.c
+++ b/jdk/src/share/native/java/lang/StrictMath.c
@@ -94,18 +94,6 @@ Java_java_lang_StrictMath_cbrt(JNIEnv *env, jclass unused, jdouble d)
return (jdouble) jcbrt((double)d);
}
-JNIEXPORT jdouble JNICALL
-Java_java_lang_StrictMath_ceil(JNIEnv *env, jclass unused, jdouble d)
-{
- return (jdouble) jceil((double)d);
-}
-
-JNIEXPORT jdouble JNICALL
-Java_java_lang_StrictMath_floor(JNIEnv *env, jclass unused, jdouble d)
-{
- return (jdouble) jfloor((double)d);
-}
-
JNIEXPORT jdouble JNICALL
Java_java_lang_StrictMath_atan2(JNIEnv *env, jclass unused, jdouble d1, jdouble d2)
{
diff --git a/jdk/test/java/lang/Math/CeilAndFloorTests.java b/jdk/test/java/lang/Math/CeilAndFloorTests.java
new file mode 100644
index 00000000000..12d899d8180
--- /dev/null
+++ b/jdk/test/java/lang/Math/CeilAndFloorTests.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6908131
+ * @summary Check for correct implementation of Math.ceil and Math.floor
+ */
+
+import sun.misc.FpUtils;
+import sun.misc.DoubleConsts;
+
+public class CeilAndFloorTests {
+ private static int testCeilCase(double input, double expected) {
+ int failures = 0;
+ failures += Tests.test("Math.ceil", input, Math.ceil(input), expected);
+ failures += Tests.test("StrictMath.ceil", input, StrictMath.ceil(input), expected);
+ return failures;
+ }
+
+ private static int testFloorCase(double input, double expected) {
+ int failures = 0;
+ failures += Tests.test("Math.floor", input, Math.floor(input), expected);
+ failures += Tests.test("StrictMath.floor", input, StrictMath.floor(input), expected);
+ return failures;
+ }
+
+ private static int nearIntegerTests() {
+ int failures = 0;
+
+ double [] fixedPoints = {
+ -0.0,
+ 0.0,
+ -1.0,
+ 1.0,
+ -0x1.0p52,
+ 0x1.0p52,
+ -Double.MAX_VALUE,
+ Double.MAX_VALUE,
+ Double.NEGATIVE_INFINITY,
+ Double.POSITIVE_INFINITY,
+ Double.NaN,
+ };
+
+ for(double fixedPoint : fixedPoints) {
+ failures += testCeilCase(fixedPoint, fixedPoint);
+ failures += testFloorCase(fixedPoint, fixedPoint);
+ }
+
+ for(int i = Double.MIN_EXPONENT; i <= Double.MAX_EXPONENT; i++) {
+ double powerOfTwo = Math.scalb(1.0, i);
+ double neighborDown = FpUtils.nextDown(powerOfTwo);
+ double neighborUp = Math.nextUp(powerOfTwo);
+
+ if (i < 0) {
+ failures += testCeilCase( powerOfTwo, 1.0);
+ failures += testCeilCase(-powerOfTwo, -0.0);
+
+ failures += testFloorCase( powerOfTwo, 0.0);
+ failures += testFloorCase(-powerOfTwo, -1.0);
+
+ failures += testCeilCase( neighborDown, 1.0);
+ failures += testCeilCase(-neighborDown, -0.0);
+
+ failures += testFloorCase( neighborUp, 0.0);
+ failures += testFloorCase(-neighborUp, -1.0);
+ } else {
+ failures += testCeilCase(powerOfTwo, powerOfTwo);
+ failures += testFloorCase(powerOfTwo, powerOfTwo);
+
+ if (neighborDown==Math.rint(neighborDown)) {
+ failures += testCeilCase( neighborDown, neighborDown);
+ failures += testCeilCase(-neighborDown, -neighborDown);
+
+ failures += testFloorCase( neighborDown, neighborDown);
+ failures += testFloorCase(-neighborDown,-neighborDown);
+ } else {
+ failures += testCeilCase( neighborDown, powerOfTwo);
+ failures += testFloorCase(-neighborDown, -powerOfTwo);
+ }
+
+ if (neighborUp==Math.rint(neighborUp)) {
+ failures += testCeilCase(neighborUp, neighborUp);
+ failures += testCeilCase(-neighborUp, -neighborUp);
+
+ failures += testFloorCase(neighborUp, neighborUp);
+ failures += testFloorCase(-neighborUp, -neighborUp);
+ } else {
+ failures += testFloorCase(neighborUp, powerOfTwo);
+ failures += testCeilCase(-neighborUp, -powerOfTwo);
+ }
+ }
+ }
+
+ for(int i = -(0x10000); i <= 0x10000; i++) {
+ double d = (double) i;
+ double neighborDown = FpUtils.nextDown(d);
+ double neighborUp = Math.nextUp(d);
+
+ failures += testCeilCase( d, d);
+ failures += testCeilCase(-d, -d);
+
+ failures += testFloorCase( d, d);
+ failures += testFloorCase(-d, -d);
+
+ if (Math.abs(d) > 1.0) {
+ failures += testCeilCase( neighborDown, d);
+ failures += testCeilCase(-neighborDown, -d+1);
+
+ failures += testFloorCase( neighborUp, d);
+ failures += testFloorCase(-neighborUp, -d-1);
+ }
+ }
+
+ return failures;
+ }
+
+ public static int roundingTests() {
+ int failures = 0;
+ double [][] testCases = {
+ { Double.MIN_VALUE, 1.0},
+ {-Double.MIN_VALUE, -0.0},
+ { FpUtils.nextDown(DoubleConsts.MIN_NORMAL), 1.0},
+ {-FpUtils.nextDown(DoubleConsts.MIN_NORMAL), -0.0},
+ { DoubleConsts.MIN_NORMAL, 1.0},
+ {-DoubleConsts.MIN_NORMAL, -0.0},
+
+ { 0.1, 1.0},
+ {-0.1, -0.0},
+
+ { 0.5, 1.0},
+ {-0.5, -0.0},
+
+ { 1.5, 2.0},
+ {-1.5, -1.0},
+
+ { 2.5, 3.0},
+ {-2.5, -2.0},
+
+ { FpUtils.nextDown(1.0), 1.0},
+ { FpUtils.nextDown(-1.0), -1.0},
+
+ { Math.nextUp(1.0), 2.0},
+ { Math.nextUp(-1.0), -0.0},
+
+ { 0x1.0p51, 0x1.0p51},
+ {-0x1.0p51, -0x1.0p51},
+
+ { FpUtils.nextDown(0x1.0p51), 0x1.0p51},
+ {-Math.nextUp(0x1.0p51), -0x1.0p51},
+
+ { Math.nextUp(0x1.0p51), 0x1.0p51+1},
+ {-FpUtils.nextDown(0x1.0p51), -0x1.0p51+1},
+
+ { FpUtils.nextDown(0x1.0p52), 0x1.0p52},
+ {-Math.nextUp(0x1.0p52), -0x1.0p52-1.0},
+
+ { Math.nextUp(0x1.0p52), 0x1.0p52+1.0},
+ {-FpUtils.nextDown(0x1.0p52), -0x1.0p52+1.0},
+ };
+
+ for(double[] testCase : testCases) {
+ failures += testCeilCase(testCase[0], testCase[1]);
+ failures += testFloorCase(-testCase[0], -testCase[1]);
+ }
+ return failures;
+ }
+
+ public static void main(String... args) {
+ int failures = 0;
+
+ failures += nearIntegerTests();
+ failures += roundingTests();
+
+ if (failures > 0) {
+ System.err.println("Testing {Math, StrictMath}.ceil incurred "
+ + failures + " failures.");
+ throw new RuntimeException();
+ }
+ }
+}
From 6d3a4136f989872fe37d32be1a29cb48dc28212c Mon Sep 17 00:00:00 2001
From: Kelly O'Hair
Date: Wed, 16 Dec 2009 12:45:18 -0800
Subject: [PATCH 14/17] 6558110: tmp/java/jli/obj_g/static is not deleted
automatically
Reviewed-by: ksrini
---
jdk/make/java/jli/Makefile | 1 -
1 file changed, 1 deletion(-)
diff --git a/jdk/make/java/jli/Makefile b/jdk/make/java/jli/Makefile
index eeb64ca6e34..7aad6e9892d 100644
--- a/jdk/make/java/jli/Makefile
+++ b/jdk/make/java/jli/Makefile
@@ -152,7 +152,6 @@ STATIC_LIBRARY_NAME = $(LIBPREFIX)$(LIBRARY).lib
STATIC_LIBRARY = $(STATIC_LIBRARY_DIR)/$(STATIC_LIBRARY_NAME)
$(STATIC_LIBRARY_DIR): $(OBJDIR)
- @$(prep-target)
@$(MKDIR) $(STATIC_LIBRARY_DIR)
$(STATIC_LIBRARY): $(STATIC_LIBRARY_DIR)
From 886a7ade8fc5c35f0811cd72d343d020efb3c2ea Mon Sep 17 00:00:00 2001
From: Mandy Chung
Date: Thu, 17 Dec 2009 08:11:21 -0800
Subject: [PATCH 15/17] 6898747: Allow JNDI cosnaming provider to be used when
java.applet is not present
Check if java.applet.Applet is present before accessing the type
Reviewed-by: alanb, vinnie
---
.../sun/jndi/toolkit/corba/CorbaUtils.java | 48 +++++++++++++++----
1 file changed, 40 insertions(+), 8 deletions(-)
diff --git a/jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java b/jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java
index 00cdf1ee6a7..b56aea82e42 100644
--- a/jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java
+++ b/jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java
@@ -33,10 +33,10 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Hashtable;
import java.util.Properties;
import java.util.Enumeration;
-import java.applet.Applet;
import org.omg.CORBA.ORB;
+import javax.naming.Context;
import javax.naming.ConfigurationException;
/**
@@ -191,16 +191,48 @@ public class CorbaUtils {
}
// Get Applet from environment
- Applet applet = null;
if (env != null) {
- applet = (Applet) env.get("java.naming.applet");
+ Object applet = env.get(Context.APPLET);
+ if (applet != null) {
+ // Create ORBs for an applet
+ return initAppletORB(applet, orbProp);
+ }
}
- // Create ORBs using applet and orbProp
- if (applet != null) {
- return ORB.init(applet, orbProp);
- } else {
- return ORB.init(new String[0], orbProp);
+ // Create ORBs using orbProp for a standalone application
+ return ORB.init(new String[0], orbProp);
+ }
+
+ /**
+ * This method returns a new ORB instance for the given applet
+ * without creating a static dependency on java.applet.
+ */
+ private static ORB initAppletORB(Object applet, Properties orbProp) {
+ try {
+ Class> appletClass = Class.forName("java.applet.Applet", true, null);
+ if (!appletClass.isInstance(applet)) {
+ throw new ClassCastException(applet.getClass().getName());
+ }
+
+ // invoke the static method ORB.init(applet, orbProp);
+ Method method = ORB.class.getMethod("init", appletClass, Properties.class);
+ return (ORB) method.invoke(null, applet, orbProp);
+ } catch (ClassNotFoundException e) {
+ // java.applet.Applet doesn't exist and the applet parameter is
+ // non-null; so throw CCE
+ throw new ClassCastException(applet.getClass().getName());
+ } catch (NoSuchMethodException e) {
+ throw new AssertionError(e);
+ } catch (InvocationTargetException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof RuntimeException) {
+ throw (RuntimeException) cause;
+ } else if (cause instanceof Error) {
+ throw (Error) cause;
+ }
+ throw new AssertionError(e);
+ } catch (IllegalAccessException iae) {
+ throw new AssertionError(iae);
}
}
From 146de76334869bace32391f3b69f113f735fd66c Mon Sep 17 00:00:00 2001
From: Mandy Chung
Date: Fri, 18 Dec 2009 11:36:23 -0800
Subject: [PATCH 16/17] 6909572: Add a new target for building modules
Add a new "modules" build target that builds jdk and jre module image
Reviewed-by: alanb, ohair
---
jdk/make/Makefile | 2 +
jdk/make/common/Modules.gmk | 442 +++++++++
jdk/make/modules/Makefile | 145 +++
jdk/make/modules/bootmodule.roots | 199 ++++
jdk/make/modules/jdk7.depconfig | 473 ++++++++++
jdk/make/modules/modules.config | 858 ++++++++++++++++++
jdk/make/modules/modules.group | 29 +
jdk/make/modules/optional.depconfig | 124 +++
jdk/make/modules/tools/Makefile | 85 ++
jdk/make/modules/tools/build.xml | 33 +
.../tools/nbproject/project.properties | 92 ++
jdk/make/modules/tools/nbproject/project.xml | 45 +
.../classanalyzer/AnnotatedDependency.java | 627 +++++++++++++
.../sun/classanalyzer/AnnotationParser.java | 293 ++++++
.../com/sun/classanalyzer/BootAnalyzer.java | 819 +++++++++++++++++
.../src/com/sun/classanalyzer/CheckDeps.java | 181 ++++
.../com/sun/classanalyzer/ClassAnalyzer.java | 354 ++++++++
.../sun/classanalyzer/ClassFileParser.java | 629 +++++++++++++
.../src/com/sun/classanalyzer/ClassPath.java | 275 ++++++
.../classanalyzer/CodeAttributeParser.java | 157 ++++
.../classanalyzer/ConstantPoolAnalyzer.java | 60 ++
.../sun/classanalyzer/ConstantPoolParser.java | 377 ++++++++
.../sun/classanalyzer/DependencyConfig.java | 99 ++
.../src/com/sun/classanalyzer/Klass.java | 357 ++++++++
.../src/com/sun/classanalyzer/Module.java | 693 ++++++++++++++
.../com/sun/classanalyzer/ModuleConfig.java | 562 ++++++++++++
.../com/sun/classanalyzer/ResolutionInfo.java | 201 ++++
.../com/sun/classanalyzer/ResourceFile.java | 186 ++++
.../src/com/sun/classanalyzer/ShowDeps.java | 100 ++
29 files changed, 8497 insertions(+)
create mode 100644 jdk/make/common/Modules.gmk
create mode 100644 jdk/make/modules/Makefile
create mode 100644 jdk/make/modules/bootmodule.roots
create mode 100644 jdk/make/modules/jdk7.depconfig
create mode 100644 jdk/make/modules/modules.config
create mode 100644 jdk/make/modules/modules.group
create mode 100644 jdk/make/modules/optional.depconfig
create mode 100644 jdk/make/modules/tools/Makefile
create mode 100644 jdk/make/modules/tools/build.xml
create mode 100644 jdk/make/modules/tools/nbproject/project.properties
create mode 100644 jdk/make/modules/tools/nbproject/project.xml
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/BootAnalyzer.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/CheckDeps.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/ClassAnalyzer.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/ClassFileParser.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/ClassPath.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/CodeAttributeParser.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolAnalyzer.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/ConstantPoolParser.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/DependencyConfig.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/Klass.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/Module.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/ModuleConfig.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/ResolutionInfo.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/ResourceFile.java
create mode 100644 jdk/make/modules/tools/src/com/sun/classanalyzer/ShowDeps.java
diff --git a/jdk/make/Makefile b/jdk/make/Makefile
index c78e4c27e01..04c5a563ee7 100644
--- a/jdk/make/Makefile
+++ b/jdk/make/Makefile
@@ -74,6 +74,7 @@ import -- copy in the pre-built components (e.g. VM) \n\
import_product -- copy in the product components \n\
import_fastdebug -- copy in the fastdebug components \n\
import_debug -- copy in the debug components \n\
+modules -- build the jdk and jre module images (experimental) \n\
sccs_get -- make sure all SCCS files are up-to-date (need SCCS) \n\
create_links -- create softlinks in Solaris 32bit build to 64bit dirs \n\
"
@@ -257,6 +258,7 @@ docs:: sanity-docs post-sanity-docs
# Release engineering targets.
#
include $(BUILDDIR)/common/Release.gmk
+include $(BUILDDIR)/common/Modules.gmk
#
# Cscope targets.
diff --git a/jdk/make/common/Modules.gmk b/jdk/make/common/Modules.gmk
new file mode 100644
index 00000000000..d277a11920a
--- /dev/null
+++ b/jdk/make/common/Modules.gmk
@@ -0,0 +1,442 @@
+#
+# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+JDK_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jdk-module-image
+JRE_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jre-module-image
+
+#
+# modules Target to build jdk and jre module image
+#
+# There is one jar file per module containing classes only.
+# All module jars are currently placed under jre/lib directory.
+#
+# Open issues that need further investigation:
+# 1. Classes in jre/lib/ext/dnsns.jar are currently put in jre/lib/jndi-dns
+# module.
+# 2. Signed jars
+# For JDK build, signed jars are copied to the build.
+# All jars in the module image are unsigned.
+# 3. jre/lib/security/US_export_policy.jar and local_policy.jar
+# are not included in the module image yet.
+
+MODULE_IMAGEBINDIR = bin
+
+#
+# Targets.
+#
+INITIAL_MODULE_IMAGE_JRE=initial-module-image-jre
+INITIAL_MODULE_IMAGE_JDK=initial-module-image-jdk
+ifeq ($(PLATFORM), solaris)
+ ifeq ($(ARCH_DATA_MODEL), 64)
+ INITIAL_MODULE_IMAGE_JRE=initial-module-image-jre-sol64
+ INITIAL_MODULE_IMAGE_JDK=initial-module-image-jdk-sol64
+ endif
+endif
+
+modules modules-clobber \
+initial-module-image-jre initial-module-image-jdk \
+initial-module-image-jre-sol64 initial-module-image-jdk-sol64 \
+trim-module-image-jre trim-module-image-jdk \
+process-module-image-jre process-module-image-jdk ::
+ @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
+
+# Order is important here, trim jre after jdk image is created
+modules:: sanity-module-images post-sanity-module-images \
+ $(INITIAL_MODULE_IMAGE_JRE) $(INITIAL_MODULE_IMAGE_JDK) \
+ trim-module-image-jre trim-module-image-jdk \
+ process-module-image-jre process-module-image-jdk
+
+# Don't use these
+module-image-jre:: initial-module-image-jre trim-module-image-jre process-module-image-jre
+module-image-jdk:: initial-module-image-jdk trim-module-image-jdk process-module-image-jdk
+
+#
+# Paths to these files we need
+JDK_MODULE_LICENSES = $(LICENSE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%)
+JDK_MODULE_64_LICENSES = $(LICENSE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%64)
+JDK_MODULE_DOCFILES = $(OTHER_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%)
+
+JRE_MODULE_LICENSES = $(LICENSE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%)
+JRE_MODULE_64_LICENSES = $(LICENSE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%64)
+JRE_MODULE_DOCFILES = $(OTHER_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%)
+JRE_MODULE_DOCFILES += $(JRE_NAMECHANGE_DOCLIST:%=$(JRE_MODULE_IMAGE_DIR)/%$(TEXT_SUFFIX))
+
+###### RULES
+
+# JDK files
+$(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%
+ $(process-doc-file)
+# Removes LICENSE_VERSION or not
+ifdef LICENSE_VERSION
+$(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION)
+ $(process-doc-file)
+$(JDK_MODULE_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION)
+ $(process-doc-file)
+else
+$(JDK_MODULE_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%
+ $(process-doc-file)
+endif
+
+# JRE files
+$(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%
+ $(process-doc-file)
+# Add $(TEXT_SUFFIX) suffix
+ifdef TEXT_SUFFIX
+$(JRE_MODULE_IMAGE_DIR)/%$(TEXT_SUFFIX): $(SHARE_JRE_DOC_SRC)/%
+ $(process-doc-file)
+endif
+# Removes LICENSE_VERSION or not
+ifdef LICENSE_VERSION
+$(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION)
+ $(process-doc-file)
+$(JRE_MODULE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION)
+ $(process-doc-file)
+else
+$(JRE_MODULE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%
+ $(process-doc-file)
+endif
+
+######################################################
+# JRE Image
+######################################################
+
+MODULES_TEMPDIR=$(ABS_TEMPDIR)/modules
+MODULES_LIB = $(ABS_OUTPUTDIR)/modules
+
+gen-modules:
+ $(CD) modules; $(MAKE) all
+
+initial-module-image-jre-setup:
+ $(RM) -r $(JRE_MODULE_IMAGE_DIR)
+ $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)
+
+# 64-bit solaris jre image contains only the 64-bit add-on files.
+initial-module-image-jre-sol64:: initial-module-image-jre-setup \
+ $(JRE_MODULE_LICENSES) $(JRE_MODULE_64_LICENSES)
+ @# Use tar instead of cp to preserve the symbolic links
+ for dir in bin lib ; do \
+ ( $(CD) $(OUTPUTDIR) && \
+ $(TAR) cf - `$(FIND) $$dir -name '$(ARCH)' -print` | \
+ ($(CD) $(JRE_MODULE_IMAGE_DIR) && $(TAR) xf -) ) ; \
+ done
+ @# Remove some files from the jre area
+ for t in $(NOTJRETOOLS) ; do \
+ $(RM) $(JRE_MODULE_IMAGE_DIR)/bin$(ISA_DIR)/$$t ; \
+ done
+ $(RM) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'orb.idl'`
+ $(RM) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'ir.idl'`
+
+# Construct an initial jre image (initial jdk jre) no trimming or stripping
+initial-module-image-jre:: initial-module-image-jre-setup \
+ $(JRE_LICENSES) $(JRE_MODULE_DOCFILES) \
+ gen-modules \
+ $(BUILDMETAINDEX_JARFILE)
+ @# Copy in bin directory
+ $(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR)
+ @# CTE plugin security change require new empty directory lib/applet
+ $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/applet
+ @# Copy files but not .jar in lib directory
+ $(CD) $(OUTPUTDIR) && $(FIND) lib -depth | $(EGREP) -v ".jar$$" | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR)
+ @#
+ @# copy modules to jre/lib
+ @#
+ $(CP) -rf $(MODULES_LIB)/jre/lib/* $(JRE_MODULE_IMAGE_DIR)/lib
+ @# Make sure all directories are read/execute for everyone
+ $(CHMOD) a+rx `$(FIND) $(JRE_MODULE_IMAGE_DIR) -type d`
+ @# Remove some files from the jre area
+ for t in $(NOTJRETOOLS) ; do \
+ $(RM) $(JRE_MODULE_IMAGE_DIR)/bin$(ISA_DIR)/$$t ; \
+ done
+ @# Remove orb.idl and ir.idl from jre
+ $(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'orb.idl' -exec $(RM) \{} \;
+ $(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'ir.idl' -exec $(RM) \{} \;
+ @# Generate meta-index to make boot and extension class loaders lazier
+ $(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \
+ $(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \
+ -o meta-index *.jar
+ @$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && $(java-vm-cleanup)
+ $(CD) $(JRE_MODULE_IMAGE_DIR)/lib/ext && \
+ $(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \
+ -o meta-index *.jar
+ @$(CD) $(JRE_MODULE_IMAGE_DIR)/lib/ext && $(java-vm-cleanup)
+ifeq ($(PLATFORM), windows)
+ @# Remove certain *.lib files
+ $(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \
+ $(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \
+ hpi.$(LIB_SUFFIX) awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX)
+ ifeq ($(ARCH_DATA_MODEL), 32)
+ @# The Java Kernel JRE image ships with a special VM. It is not included
+ @# in the full JRE image, so remove it. Also, is it only for 32-bit windows.
+ $(CD) $(JRE_MODULE_IMAGE_DIR)/bin && $(RM) -r kernel
+ endif
+endif # Windows
+ifneq ($(PLATFORM), windows)
+ $(call copy-man-pages,$(JRE_MODULE_IMAGE_DIR),$(JRE_MAN_PAGES))
+endif # !windows
+
+# Trim out any extra files not for the jre shipment but wanted in the jdk jre.
+# (Note the jdk WILL want the jre image before this trimming)
+# Removes server VM on Windows 32bit.
+# Remove certain shared libraries that should not be in the jre image
+# but should be in the jdk jre image.
+trim-module-image-jre::
+ifeq ($(PLATFORM), windows)
+ ifeq ($(ARCH_DATA_MODEL), 32)
+ $(RM) -r $(JRE_MODULE_IMAGE_DIR)/bin/server
+ endif
+ ifdef NOTJRE_SHARED_LIBS
+ for l in $(NOTJRE_SHARED_LIBS) ; do \
+ $(RM) $(JRE_MODULE_IMAGE_DIR)/bin/$$l ; \
+ done ;
+ endif
+else # PLATFORM
+ ifdef NOTJRE_SHARED_LIBS
+ for l in $(NOTJRE_SHARED_LIBS) ; do \
+ $(RM) $(JRE_MODULE_IMAGE_DIR)/lib/$(LIBARCH)/$$l ; \
+ done ;
+ endif
+endif # PLATFORM
+
+# Get list of all Elf files in the jre
+JRE_MODULE_ELF_LIST=$(MODULES_TEMPDIR)/jre-elf-files.list
+$(JRE_MODULE_ELF_LIST):
+ @$(prep-target)
+ifneq ($(PLATFORM), windows)
+ $(RM) $@
+ $(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -type f -name \*.$(LIB_SUFFIX) >> $@
+ $(FILE) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
+ | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
+endif
+
+# Post process the image (strips and mcs on Elf files we are shipping)
+# (Note the jdk WILL want the jre image before this processing)
+process-module-image-jre:: $(JRE_MODULE_ELF_LIST)
+ifneq ($(POST_STRIP_PROCESS), )
+ for f in `$(CAT) $(JRE_MODULE_ELF_LIST)`; do \
+ $(CHMOD) u+w $${f}; \
+ $(ECHO) $(POST_STRIP_PROCESS) $${f}; \
+ $(POST_STRIP_PROCESS) $${f}; \
+ $(CHMOD) go-w $${f}; \
+ done
+endif
+ifneq ($(POST_MCS_PROCESS), )
+ for f in `$(CAT) $(JRE_MODULE_ELF_LIST)`; do \
+ $(CHMOD) u+w $${f}; \
+ $(ECHO) $(POST_MCS_PROCESS) $${f}; \
+ $(POST_MCS_PROCESS) $${f}; \
+ $(CHMOD) go-w $${f}; \
+ done
+endif
+ $(RM) $(JRE_MODULE_ELF_LIST)
+
+######################################################
+# JDK Image
+######################################################
+# Note: cpio ($(CPIO)) sometimes leaves directories without rx access.
+
+initial-module-image-jdk-setup:
+ $(RM) -r $(JDK_MODULE_IMAGE_DIR)
+ $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/jre
+ ($(CD) $(JRE_MODULE_IMAGE_DIR) && $(FIND) . -depth -print \
+ | $(CPIO) -pdum $(JDK_MODULE_IMAGE_DIR)/jre )
+ $(RM) -rf $(JDK_MODULE_IMAGE_DIR)/jre/man
+ $(CHMOD) a+rx `$(FIND) $(JDK_MODULE_IMAGE_DIR) -type d`
+
+initial-module-image-jdk64-bindemos:
+ for dir in bin demo ; do \
+ ( $(CD) $(OUTPUTDIR) && \
+ $(TAR) cf - `$(FIND) $$dir -name '$(LIBARCH)' -print` | \
+ ($(CD) $(JDK_MODULE_IMAGE_DIR) && $(TAR) xf -) ) ; \
+ done
+
+# Solaris 64 bit image is special
+initial-module-image-jdk-sol64:: initial-module-image-jdk-setup \
+ initial-module-image-jdk64-bindemos \
+ $(JDK_MODULE_LICENSES) $(JDK_MODULARLIZED_64_LICENSES)
+
+# DB files to add
+ifeq ($(OPENJDK),true)
+
+initial-module-image-jdk-db:
+
+else
+
+# Create the list of db *.zip files to bundle with jdk
+ABS_DB_PATH :=$(call FullPath,$(CLOSED_SHARE_SRC)/db)
+DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null)
+
+initial-module-image-jdk-db: $(DB_ZIP_LIST)
+ $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/db
+ for d in $(DB_ZIP_LIST); do \
+ ($(CD) $(JDK_MODULE_IMAGE_DIR)/db && $(UNZIP) -o $$d); \
+ done
+
+endif
+
+# Standard jdk image
+initial-module-image-jdk:: initial-module-image-jdk-setup \
+ initial-module-image-jdk-db \
+ $(JDK_MODULE_LICENSES) $(JDK_MODULE_DOCFILES)
+ $(MKDIR) $(JDK_MODULE_IMAGE_DIR)/lib
+ @#
+ @# copy jdk modules to jdk/lib
+ @#
+ $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/lib
+ $(CP) -rf $(MODULES_LIB)/lib/* $(JDK_MODULE_IMAGE_DIR)/lib
+ ifeq ($(PLATFORM), windows)
+ @#
+ @# lib/
+ @#
+ $(CP) $(LIBDIR)/$(LIB_PREFIX)jvm.$(LIB_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/lib
+ $(CP) $(LIBDIR)/$(LIB_PREFIX)jawt.$(LIB_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/lib
+ @#
+ @# bin/
+ @#
+ @# copy all EXE files and only certain DLL files from BINDIR
+ $(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/bin
+ $(CP) $(BINDIR)/*$(EXE_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
+ $(CP) $(BINDIR)/jli.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
+ ifeq ($(ARCH_DATA_MODEL), 32)
+ ifeq ($(COMPILER_VERSION), VS2003)
+ $(CP) $(BINDIR)/msvc*71.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
+ endif
+ endif
+ else # PLATFORM
+ @#
+ @# bin/
+ @#
+ ($(CD) $(BINDIR)/.. && $(TAR) cf - \
+ `$(FIND) bin \( -type f -o -type l \) -print `) | \
+ ($(CD) $(JDK_MODULE_IMAGE_DIR) && $(TAR) xf -)
+ endif # PLATFORM
+ @#
+ @# lib/ct.sym
+ @#
+ $(MKDIR) -p $(OUTPUTDIR)/symbols/META-INF/sym
+ $(JAVAC_CMD) -XDprocess.packages -proc:only \
+ -processor com.sun.tools.javac.sym.CreateSymbols \
+ -Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \
+ -Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
+ $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS)
+ $(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \
+ -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS)
+ @$(java-vm-cleanup)
+ $(CP) $(LIBDIR)/ct.sym $(JDK_MODULE_IMAGE_DIR)/lib/ct.sym
+ @#
+ @# CORBA supported orb.idl and ir.idl should be copied to lib
+ @#
+ $(CP) $(LIBDIR)/orb.idl $(JDK_MODULE_IMAGE_DIR)/lib/orb.idl
+ $(CP) $(LIBDIR)/ir.idl $(JDK_MODULE_IMAGE_DIR)/lib/ir.idl
+ ifeq ($(PLATFORM), linux)
+ @#
+ @# on Linux copy jexec from jre/lib to /lib
+ @#
+ $(CP) $(LIBDIR)/jexec $(JDK_MODULE_IMAGE_DIR)/lib/jexec
+ endif # PLATFORM
+ @#
+ @# demo, include
+ @#
+ $(CP) -r -f $(DEMODIR) $(JDK_MODULE_IMAGE_DIR)
+ $(CP) -r -f $(SAMPLEDIR) $(JDK_MODULE_IMAGE_DIR)
+ $(CP) -r $(INCLUDEDIR) $(JDK_MODULE_IMAGE_DIR)
+ @#
+ @# Swing BeanInfo generation
+ @#
+ $(CD) javax/swing/beaninfo && $(MAKE) JDK_IMAGE_DIR=$(JDK_MODULE_IMAGE_DIR) swing-1.2-beans
+ifneq ($(PLATFORM), windows)
+ $(call copy-man-pages,$(JDK_MODULE_IMAGE_DIR),$(JDK_MAN_PAGES))
+endif # !windows
+
+# Trim out files we don't want to ship
+trim-module-image-jdk::
+ @# Remove tools that should not be part of SDK.
+ for t in $(NOTJDKTOOLS); do \
+ $(RM) $(JDK_MODULE_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX) \
+ $(JDK_MODULE_IMAGE_DIR)/bin/*/native_threads/$${t}$(EXE_SUFFIX); \
+ done
+
+# Get list of Elf files in the jdk
+JDK_MODULE_ELF_LIST=$(MODULES_TEMPDIR)/jdk-elf-files.list
+$(JDK_MODULE_ELF_LIST):
+ @$(prep-target)
+ifneq ($(PLATFORM), windows)
+ $(RM) $@
+ $(FIND) $(JDK_MODULE_IMAGE_DIR)/jre/lib -type f -name \*.$(LIB_SUFFIX) >> $@
+ $(FILE) `$(FIND) $(JDK_MODULE_IMAGE_DIR)/jre/bin -type f -name \*$(EXE_SUFFIX)` \
+ | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
+ file `$(FIND) $(JDK_MODULE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
+ | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
+endif
+
+# Post process the image (strips and mcs on files we are shipping)
+process-module-image-jdk:: $(JDK_MODULE_ELF_LIST)
+ifneq ($(POST_STRIP_PROCESS), )
+ for f in `$(CAT) $(JDK_MODULE_ELF_LIST)`; do \
+ $(CHMOD) u+w $${f}; \
+ $(ECHO) $(POST_STRIP_PROCESS) $${f}; \
+ $(POST_STRIP_PROCESS) $${f}; \
+ $(CHMOD) go-w $${f}; \
+ done
+endif
+ifneq ($(POST_MCS_PROCESS), )
+ for f in `$(CAT) $(JDK_MODULE_ELF_LIST)`; do \
+ $(CHMOD) u+w $${f}; \
+ $(ECHO) $(POST_MCS_PROCESS) $${f}; \
+ $(POST_MCS_PROCESS) $${f}; \
+ $(CHMOD) go-w $${f}; \
+ done
+endif
+ $(RM) $(JDK_MODULE_ELF_LIST)
+
+######################################################
+# clobber
+######################################################
+modules-clobber::
+ $(RM) -r $(JDK_MODULE_IMAGE_DIR)
+ $(RM) -r $(JRE_MODULE_IMAGE_DIR)
+
+#
+# TODO - nop for now
+sanity-module-images post-sanity-module-images:
+
+modules modules-clobber::
+ @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
+ @$(java-vm-cleanup)
+
+.PHONY: modules module-image-jre module-image-jdk \
+ initial-module-image-jre initial-module-image-jdk \
+ initial-module-image-jre-sol64 initial-module-image-jdk-sol64 \
+ initial-module-image-jdk-setup \
+ initial-module-image-jdk-db \
+ initial-module-image-jdk64-bindemos \
+ initial-module-image-jre-setup \
+ trim-module-image-jre trim-module-image-jdk \
+ process-module-image-jre process-module-image-jdk \
+ install-previous-jre install-previous-jdk \
+ modules-clobber
+
+# Force rule
+FRC:
+
diff --git a/jdk/make/modules/Makefile b/jdk/make/modules/Makefile
new file mode 100644
index 00000000000..039682e871a
--- /dev/null
+++ b/jdk/make/modules/Makefile
@@ -0,0 +1,145 @@
+#
+# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+#
+# Modularizing the JDK
+#
+
+BUILDDIR = ..
+include $(BUILDDIR)/common/Defs.gmk
+
+CLASSANALYZER_JAR=$(BUILDTOOLJARDIR)/classanalyzer.jar
+JAVA_FLAGS=$(JAVA_TOOLS_FLAGS) -Xbootclasspath:$(CLASSBINDIR)
+
+MODULE_LIB = $(ABS_OUTPUTDIR)/modules
+MAINMANIFEST=$(JDK_TOPDIR)/make/tools/manifest.mf
+MODULE_JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp
+
+TMP=$(ABS_TEMPDIR)/modules
+MODULE_CLASSLIST = $(TMP)/classlist
+MODULE_CLASSES = $(TMP)/classes
+MODULE_LIST = $(MODULE_CLASSLIST)/modules.list
+
+# Modules in the modules/ext directory
+EXT_MODULES = localedata security-sunec security-sunjce
+
+# Build PKCS#11 on all platforms except 64-bit Windows.
+# We exclude windows-amd64 because we don't have any
+# 64-bit PKCS#11 implementations to test with on that platform.
+PKCS11 = security-sunpkcs11
+ifeq ($(ARCH_DATA_MODEL), 64)
+ ifeq ($(PLATFORM), windows)
+ PKCS11 =
+ endif
+endif
+
+EXT_MODULES += $(PKCS11)
+
+# Build Microsoft CryptoAPI provider only on (non-64-bit) Windows platform.
+ifeq ($(PLATFORM), windows)
+ ifneq ($(ARCH_DATA_MODEL), 64)
+ EXT_MODULES += security-sunmscapi
+ endif
+endif
+
+
+JDK_MODULES = tools
+
+SUBDIRS = tools
+all build clean clobber::
+ $(SUBDIRS-loop)
+
+all:: unpack-jars gen-classlist modularize
+
+$(CLASSANALYZER_JAR):
+ $(CD) tools && $(MAKE) all
+
+JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -depth)
+unpack-jars:
+ $(RM) -rf $(MODULE_CLASSES)
+ $(MKDIR) -p $(MODULE_CLASSES)
+ $(CP) -rf $(CLASSBINDIR)/* $(MODULE_CLASSES)
+ for jf in $(JAR_LIST) ; do \
+ $(CD) $(MODULE_CLASSES) && $(BOOT_JAR_CMD) xf $$jf $(BOOT_JAR_JFLAGS);\
+ done
+
+gen-classlist: $(CLASSANALYZER_JAR)
+ @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
+ @$(RM) -rf $(MODULE_CLASSLIST)
+ @$(MKDIR) -p $(MODULE_CLASSLIST)
+
+ @# Use java in the default tool directory.
+ @# OUTPUTDIR for solaris 64-bit doesn't have the tools.
+ $(JAVA_TOOLS_DIR)/java $(JAVA_FLAGS) \
+ -Dclassanalyzer.debug \
+ -jar $(CLASSANALYZER_JAR) \
+ -jdkhome $(OUTPUTDIR) \
+ -config modules.config \
+ -config modules.group \
+ -depconfig jdk7.depconfig \
+ -depconfig optional.depconfig \
+ -showdynamic \
+ -output $(MODULE_CLASSLIST)
+ @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
+
+modularize: $(MODULE_JAR_MANIFEST_FILE)
+ @$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
+ @$(RM) -rf $(MODULE_LIB)
+ @$(MKDIR) -p $(MODULE_LIB)/lib
+ @$(MKDIR) -p $(MODULE_LIB)/jre/lib/ext
+
+ @# create modules
+ for m in `$(NAWK) '{print $$1}' $(MODULE_LIST)` ; do \
+ $(ECHO) "Creating module $$m" ; \
+ $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.classlist > $(TMP)/tmp.cf ; \
+ if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \
+ $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \
+ fi ; \
+ $(CD) $(MODULE_CLASSES) && \
+ $(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \
+ $(MODULE_LIB)/$$m.jar \
+ @$(TMP)/tmp.cf \
+ $(BOOT_JAR_JFLAGS) ; \
+ done
+ @$(CD) $(MODULE_CLASSES) && $(java-vm-cleanup)
+ @# move modules to lib, jre/lib, or jre/lib/ext
+ for m in $(EXT_MODULES) ; do \
+ $(MV) $(MODULE_LIB)/$$m.jar $(MODULE_LIB)/jre/lib/ext ; \
+ done
+ for m in $(JDK_MODULES) ; do \
+ $(MV) $(MODULE_LIB)/$$m.jar $(MODULE_LIB)/lib ; \
+ done
+ $(MV) $(MODULE_LIB)/*.jar $(MODULE_LIB)/jre/lib
+ @$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
+
+$(MODULE_JAR_MANIFEST_FILE):
+ $(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) > $@
+
+clean clobber::
+ $(RM) -rf $(MODULE_CLASSLIST)
+ $(RM) -rf $(MODULE_LIB)
+ $(RM) -f $(MODULE_JAR_MANIFEST_FILE)
+ $(RM) -f $(CLASSANALYZER_JAR)
+
diff --git a/jdk/make/modules/bootmodule.roots b/jdk/make/modules/bootmodule.roots
new file mode 100644
index 00000000000..cd0b264b254
--- /dev/null
+++ b/jdk/make/modules/bootmodule.roots
@@ -0,0 +1,199 @@
+#
+# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+#
+# List of root classes/methods, each line of the following syntax:
+#
+# |*
+# exclude |
+
+# The boot module generated based on this rootset does not support
+# - security permission check
+# - non-standard charset
+# - logging output
+# - resource bundles
+# including error output from the launcher
+
+# VM preloaded classes
+java.lang.Object
+java.lang.String
+java.lang.Class
+java.lang.Cloneable
+java.lang.ClassLoader
+java.lang.System
+java.lang.Throwable
+java.lang.Error
+java.lang.ThreadDeath
+java.lang.Exception
+java.lang.RuntimeException
+java.security.ProtectionDomain
+java.security.AccessControlContext
+java.lang.ClassNotFoundException
+java.lang.NoClassDefFoundError
+java.lang.ClassCastException
+java.lang.ArrayStoreException
+java.lang.VirtualMachineError
+java.lang.OutOfMemoryError
+java.lang.StackOverflowError
+java.lang.IllegalMonitorStateException
+java.lang.ref.Reference
+java.lang.ref.SoftReference
+java.lang.ref.WeakReference
+java.lang.ref.FinalReference
+java.lang.ref.PhantomReference
+java.lang.ref.Finalizer
+java.lang.Runnable
+java.lang.Thread
+java.lang.ThreadGroup
+java.util.Properties
+java.lang.reflect.AccessibleObject
+java.lang.reflect.Member
+java.lang.reflect.Field
+java.lang.reflect.Method
+java.lang.reflect.Constructor
+java.lang.reflect.Type
+sun.reflect.MagicAccessorImpl
+sun.reflect.MethodAccessorImpl
+sun.reflect.ConstructorAccessorImpl
+sun.reflect.DelegatingClassLoader
+sun.reflect.ConstantPool
+sun.reflect.UnsafeStaticFieldAccessorImpl
+java.util.Vector
+java.lang.StringBuffer
+java.lang.StackTraceElement
+java.nio.Buffer
+java.lang.Boolean
+java.lang.Character
+java.lang.Float
+java.lang.Double
+java.lang.Byte
+java.lang.Short
+java.lang.Integer
+java.lang.Long
+java.lang.NullPointerException
+java.lang.ArithmeticException
+java.lang.Compiler
+
+
+# Root methods
+java.lang.ClassLoader.getSystemClassLoader ()Ljava/lang/ClassLoader;
+java.lang.System.initializeSystemClass ()V
+sun.launcher.LauncherHelper.checkAndLoadMain (ZZLjava/lang/String;)Ljava/lang/Object;
+
+# The tool doesn't automatically find superclasses and parse the method
+# if overridden as it tries to reduce unnecessary classes being pulled in.
+# The following forces the dependency to be included the result.
+sun.net.www.protocol.file.Handler. ()V
+sun.net.www.protocol.jar.Handler. ()V
+sun.net.www.protocol.file.Handler.openConnection *
+sun.net.www.protocol.jar.Handler.openConnection *
+sun.misc.URLClassPath$JarLoader. (Ljava/net/URL;Ljava/net/URLStreamHandler;Ljava/util/HashMap;)V
+sun.misc.URLClassPath$FileLoader. (Ljava/net/URL;)V
+sun.misc.URLClassPath$FileLoader.getClassPath *
+sun.misc.URLClassPath$FileLoader.getResource *
+sun.misc.URLClassPath$JarLoader.getResource *
+sun.misc.URLClassPath$JarLoader.getClassPath *
+
+# permission collections
+java.io.FilePermission.newPermissionCollection ()Ljava/security/PermissionCollection;
+java.security.BasicPermission.newPermissionCollection ()Ljava/security/PermissionCollection;
+
+# native
+java.io.UnixFileSystem
+java.io.UnixFileSystem. ()V
+java.io.UnixFileSystem.canonicalize *
+java.io.Win32FileSystem
+java.io.Win32FileSystem. ()V
+java.io.Win32FileSystem.canonicalize *
+java.io.WinNTFileSystem
+java.io.WinNTFileSystem. ()V
+java.io.WinNTFileSystem.canonicalize *
+
+# missing
+java.util.HashMap. ()V
+java.util.HashMap$EntrySet.iterator *
+
+# Called from native GetStringPlatformChars (jni_util.c)
+java.lang.String.getBytes *
+
+# charset
+sun.nio.cs.US_ASCII.newEncoder ()Ljava/nio/charset/CharsetEncoder;
+sun.nio.cs.UTF_8.newEncoder ()Ljava/nio/charset/CharsetEncoder;
+sun.nio.cs.UTF_8.newDecoder *
+sun.nio.cs.UTF_16.newEncoder ()Ljava/nio/charset/CharsetEncoder;
+sun.nio.cs.UTF_16.newDecoder *
+sun.nio.cs.UTF_32.newEncoder ()Ljava/nio/charset/CharsetEncoder;
+sun.nio.cs.UTF_32.newDecoder *
+
+# hashcode
+java.util.jar.Attributes$Name.hashCode *
+
+# nio
+sun.nio.ByteBuffered
+sun.nio.ch.DirectBuffer
+java.nio.DirectByteBuffer
+java.nio.MappedByteBuffer
+java.nio.DirectLongBufferU
+
+# resource files
+sun.launcher.resources.launcher
+
+sun.misc.Launcher$AppClassLoader.getPermissions *
+sun.misc.Launcher$AppClassLoader.loadClass (Ljava/lang/String;)Ljava/lang/Class;
+sun.misc.Launcher$AppClassLoader.findClass (Ljava/lang/String;)Ljava/lang/Class;
+sun.misc.Launcher$ExtClassLoader.getPermissions *
+sun.misc.Launcher$ExtClassLoader.loadClass (Ljava/lang/String;)Ljava/lang/Class;
+sun.misc.Launcher$ExtClassLoader.findClass (Ljava/lang/String;)Ljava/lang/Class;
+java.lang.ClassLoader.checkPackageAccess *
+java.lang.ClassLoader.findClass *
+java.lang.ClassLoader.defineClass *
+java.net.URLClassLoader.getPermissions *
+java.net.URLClassLoader.findClass *
+java.net.URLClassLoader.defineClass *
+java.security.SecureClassLoader.defineClass *
+# need to parse superclasses
+java.security.SecureClassLoader. ()V
+
+exclude sun.security.provider.PolicyFile.
+exclude java.lang.ClassLoader.compareCerts
+exclude java.security.cert.Certificate.equals
+# unsigned jars - no verifier
+exclude java.util.jar.JarFile.initializeVerifier
+exclude java.util.jar.JarVerifier
+exclude sun.security.util.SignatureFileVerifier.
+
+
+# what about other charset
+exclude sun.misc.Service
+exclude java.util.ServiceLoader
+
+# exclude support for localized messages
+exclude java.util.ResourceBundle.getBundle
+exclude java.text.MessageFormat
+exclude sun.util.logging.PlatformLogger$LoggerProxy.format *
+
+# exclude nio and miscellaneous classes
+exclude java.nio.channels.**
+exclude sun.misc.FloatingDecimal
+exclude sun.misc.FormattedFloatingDecimal
+exclude sun.misc.FDBigInt
diff --git a/jdk/make/modules/jdk7.depconfig b/jdk/make/modules/jdk7.depconfig
new file mode 100644
index 00000000000..286b19e3ad0
--- /dev/null
+++ b/jdk/make/modules/jdk7.depconfig
@@ -0,0 +1,473 @@
+#
+# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+# private java.lang.Object createInetSocketAddress(java.lang.String, int)
+@ClassForName
+ com.sun.jndi.ldap.Connection -> java.net.InetSocketAddress
+ com.sun.jndi.ldap.Connection -> java.net.SocketAddress
+
+# com.sun.jndi.ldap.VersionHelper
+@ClassForName(optional)
+ com.sun.jndi.ldap.VersionHelper -> com.sun.jndi.ldap.VersionHelper*
+
+# private static void initMethodHandles()
+@ClassForName
+ com.sun.jndi.toolkit.corba.CorbaUtils -> javax.rmi.CORBA.Stub
+ com.sun.jndi.toolkit.corba.CorbaUtils -> javax.rmi.PortableRemoteObject
+
+# com.sun.naming.internal.ResourceManager$AppletParameter
+@ClassForName(optional)
+ com.sun.naming.internal.ResourceManager$AppletParameter -> java.applet.Applet
+
+# private static boolean loadProviderAsService()
+@Provider
+ com.sun.net.httpserver.spi.HttpServerProvider -> META-INF/services/com.sun.net.httpserver.spi.HttpServerProvider
+
+# com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT
+@ClassForName
+ com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT -> javax.xml.XMLConstants
+
+# public static java.beans.PersistenceDelegate getPersistenceDelegate(java.lang.Class)
+@ClassForName
+ java.beans.MetaData -> java.beans.*_PersistenceDelegate
+
+# private static java.lang.reflect.Method getNanosMethod()
+@ClassForName(optional)
+ java.beans.java_sql_Timestamp_PersistenceDelegate -> java.sql.Timestamp
+
+# java.beans.java_util_Collections$CheckedCollection_PersistenceDelegate
+@ClassForName
+ java.beans.java_util_Collections$CheckedCollection_PersistenceDelegate -> java.util.Collections$CheckedCollection
+
+# java.beans.java_util_Collections$CheckedMap_PersistenceDelegate
+@ClassForName
+ java.beans.java_util_Collections$CheckedMap_PersistenceDelegate -> java.util.Collections$CheckedMap
+
+# private static java.lang.Object getType(java.lang.Object)
+@ClassForName
+ java.beans.java_util_EnumMap_PersistenceDelegate -> java.util.EnumMap
+
+# private java.lang.Integer getAxis(java.lang.Object)
+@ClassForName
+ java.beans.javax_swing_Box_PersistenceDelegate -> javax.swing.BoxLayout
+
+# java.lang.Double
+@Inline
+ java.lang.Double -> sun.misc.FloatConsts
+ java.lang.Double -> sun.misc.DoubleConsts
+
+# java.lang.Float
+@Inline
+ java.lang.Float -> sun.misc.FloatConsts
+ java.lang.Float -> sun.misc.DoubleConsts
+
+# java.net.DefaultDatagramSocketImplFactory
+@ClassForName(optional)
+ java.net.DefaultDatagramSocketImplFactory -> java.net.*DatagramSocketImpl
+
+# private static sun.net.spi.nameservice.NameService createNSProvider(java.lang.String)
+@Provider
+ java.net.InetAddress -> META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor
+
+# static java.net.InetAddressImpl create()
+@ClassForName
+ java.net.InetAddressImplFactory -> java.net.*Inet[46]AddressImpl
+
+# private static void init()
+@NativeFindClass
+ java.net.PlainDatagramSocketImpl -> java.io.FileDescriptor
+
+# java.net.ProxySelector
+@ClassForName
+ java.net.ProxySelector -> sun.net.spi.DefaultProxySelector
+
+# static java.net.URLStreamHandler getURLStreamHandler(java.lang.String)
+@ClassForName(optional)
+ java.net.URL -> sun.net.www.protocol.*.Handler
+
+# private java.net.ContentHandler lookupContentHandlerClassFor(java.lang.String)
+@ClassForName
+ java.net.URLConnection -> sun.net.www.content.*
+
+# private static java.nio.channels.spi.AsynchronousChannelProvider loadProviderAsService()
+@Provider
+ java.nio.channels.spi.AsynchronousChannelProvider$ProviderHolder -> META-INF/services/java.nio.channels.spi.AsynchronousChannelProvider
+
+# private static boolean loadProviderFromProperty()
+@ClassForName
+ java.nio.channels.spi.SelectorProvider -> sun.nio.ch.DefaultSelectorProvider
+
+# private static boolean loadProviderAsService()
+@Provider
+ java.nio.channels.spi.SelectorProvider -> META-INF/services/java.nio.channels.spi.SelectorProvider
+
+# private static java.util.Iterator providers()
+@Provider
+ java.nio.charset.Charset -> META-INF/services/java.nio.charset.spi.CharsetProvider
+
+# private static void probeExtendedProvider()
+@ClassForName(optional)
+ java.nio.charset.Charset -> sun.nio.cs.ext.ExtendedCharsets
+
+# public static java.nio.file.FileSystem newFileSystem(java.net.URI, java.util.Map, java.lang.ClassLoader)
+@Provider
+ java.nio.file.FileSystems -> META-INF/services/java.nio.file.FileSystemProvider
+
+# private static java.util.List loadInstalledDetectors()
+@Provider
+ java.nio.file.Files$DefaultFileTypeDetectorHolder -> META-INF/services/java.nio.file.spi.FileTypeDetector
+
+# public static java.util.List installedProviders()
+@Provider
+ java.nio.file.spi.FileSystemProvider -> META-INF/services/java.nio.file.FileSystemProvider
+
+# private static java.rmi.server.RMIClassLoaderSpi initializeProvider()
+@Provider
+ java.rmi.server.RMIClassLoader -> META-INF/services/java.rmi.server.RMIClassLoaderSpi
+
+# private static void initializeSystemScope()
+@ClassForName(optional)
+ java.security.IdentityScope -> sun.security.provider.IdentityDatabase
+
+# static java.security.Policy getPolicyNoCheck()
+@ClassForName
+ java.security.Policy -> sun.security.provider.PolicyFile
+
+# private static java.lang.Class getSpiClass(java.lang.String)
+@ClassForName
+ java.security.Security -> java.security.*Spi
+
+# private static void invalidateSMCache(java.lang.String)
+@ClassForName
+ java.security.Security -> java.lang.SecurityManager
+
+# private static void loadInitialDrivers()
+@Provider
+ java.sql.DriverManager -> META-INF/services/java.sql.Driver
+
+# private static java.text.BreakIterator createBreakInstance(java.util.Locale, int, java.lang.String, java.lang.String)
+@Provider
+ java.text.BreakIterator -> META-INF/services/java.util.spi.BreakIteratorProvider
+
+# public static java.text.Collator getInstance(java.util.Locale)
+@Provider
+ java.text.Collator -> META-INF/services/java.util.spi.CollatorProvider
+
+# private static java.text.DateFormat get(int, int, int, java.util.Locale)
+@Provider
+ java.text.DateFormat -> META-INF/services/java.util.spi.DateNameProvider
+
+# public static java.util.Locale[] getAvailableLocales()
+@Provider
+ java.text.DateFormatSymbols -> META-INF/services/java.util.spi.DateFormatSymbolsProvider
+
+# public static java.util.Locale[] getAvailableLocales()
+@Provider
+ java.text.DecimalFormatSymbols -> META-INF/services/java.util.spi.DecimalFormatSymbolsProvider
+
+# public static java.util.Locale[] getAvailableLocales()
+@Provider
+ java.text.NumberFormat -> META-INF/services/java.util.spi.NumberFormatProvider
+
+# public java.lang.String getDisplayName(java.util.Locale)
+@Provider
+ java.util.Currency -> META-INF/services/java.util.spi.CurrencyNameProvider
+
+# java.util.Formatter
+@Inline
+ java.util.Formatter -> sun.misc.DoubleConsts
+
+# java.util.Locale
+@Inline
+ java.util.Locale -> java.util.LocaleISOData
+
+# private java.lang.String getDisplayString(java.lang.String, java.util.Locale, int)
+@Provider
+ java.util.Locale -> META-INF/services/java.util.spi.LocaleNameProvider
+
+# private static java.util.prefs.PreferencesFactory factory1()
+@ClassForName
+ java.util.prefs.Preferences -> java.util.prefs.WindowsPreferencesFactory
+ java.util.prefs.Preferences -> java.util.prefs.FileSystemPreferencesFactory
+
+# private static java.util.prefs.PreferencesFactory factory1()
+@Provider
+ java.util.prefs.Preferences -> META-INF/services/java.util.prefs.PreferencesFactory
+
+# public void registerApplicationClasspathSpis()
+@Provider
+ javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.IIOServiceProvider
+
+# private void registerInstalledProviders()
+@Provider
+ javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageReaderSpi
+ javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageWriterSpi
+ javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageReaderWriterSpi
+ javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageTranscoderSpi
+ javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageInputStreamSpi
+ javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageOutputStreamSpi
+
+# public javax.naming.ldap.ExtendedResponse createExtendedResponse(java.lang.String, byte[], int, int)
+@Provider
+ javax.naming.ldap.StartTlsRequest -> META-INF/services/javax.naming.ldap.StartTlsResponse
+
+# private static java.util.ArrayList getAllLookupServices()
+@Provider
+ javax.print.PrintServiceLookup -> META-INF/services/javax.print.PrintServiceLookup
+
+# private static java.util.ArrayList getAllFactories()
+@Provider
+ javax.print.StreamPrintServiceFactory -> META-INF/services/javax.print.StreamPrintServiceFactory
+
+# private void initEngines(java.lang.ClassLoader)
+@Provider
+ javax.script.ScriptEngineManager -> META-INF/services/javax.script.ScriptEngineFactory
+
+# private void initializeInputMethodLocatorList()
+@Provider
+ sun.awt.im.ExecutableInputMethodManager -> META-INF/services/java.awt.im.spi.InputMethodDescriptor
+
+# private static java.lang.Class getConverterClass(int, java.lang.String)
+@ClassForName(optional)
+ sun.io.Converters -> sun.io.*
+
+# public static sun.java2d.cmm.PCMM getModule()
+@Provider
+ sun.java2d.cmm.CMSManager -> META-INF/services/sun.java2d.cmm.PCMM
+
+# public static sun.java2d.pipe.RenderingEngine getInstance()
+@Provider
+ sun.java2d.pipe.RenderingEngine -> META-INF/services/sun.java2d.pipe.RenderingEngine
+
+# public static sun.java2d.pipe.RenderingEngine getInstance()
+@ClassForName(optional)
+ sun.java2d.pipe.RenderingEngine -> sun.dc.DuctusRenderingEngine
+
+# sun.misc.FloatingDecimal
+@Inline
+ sun.misc.FloatingDecimal -> sun.misc.FloatConsts
+ sun.misc.FloatingDecimal -> sun.misc.DoubleConsts
+
+# sun.misc.FormattedFloatingDecimal
+@Inline
+ sun.misc.FormattedFloatingDecimal -> sun.misc.FloatConsts
+ sun.misc.FormattedFloatingDecimal -> sun.misc.DoubleConsts
+
+# sun.misc.FpUtils
+@Inline
+ sun.misc.FpUtils -> sun.misc.FloatConsts
+ sun.misc.FpUtils -> sun.misc.DoubleConsts
+
+# public java.net.URLStreamHandler createURLStreamHandler(java.lang.String)
+@ClassForName(optional)
+ sun.misc.Launcher$Factory -> sun.net.www.protocol.*.Handler
+
+# private static sun.net.NetHooks$Provider loadProvider(java.lang.String)
+@ClassForName(optional)
+ sun.net.NetHooks -> sun.net.spi.SdpProvider
+
+# sun.net.idn.StringPrep
+@Inline
+ sun.net.idn.StringPrep -> sun.net.idn.UCharacterDirection
+
+# private static boolean init()
+@NativeFindClass
+ sun.net.spi.DefaultProxySelector -> java.net.Proxy
+ sun.net.spi.DefaultProxySelector -> java.net.Proxy$Type
+ sun.net.spi.DefaultProxySelector -> java.net.InetSocketAddress
+
+# private static java.nio.channels.Channel createChannel()
+@ClassForName
+ sun.nio.ch.InheritedChannel -> java.io.FileDescriptor
+
+# private static void initDBBConstructor()
+@ClassForName
+ sun.nio.ch.Util -> java.nio.DirectByteBuffer
+
+# private static void initDBBRConstructor()
+@ClassForName
+ sun.nio.ch.Util -> java.nio.DirectByteBufferR
+
+# private java.nio.charset.Charset lookup(java.lang.String)
+@ClassForName(optional)
+ sun.nio.cs.FastCharsetProvider -> sun.nio.cs.*
+
+# sun.nio.cs.ext.ExtendedCharsets
+@ClassForName(optional)
+ sun.nio.cs.ext.ExtendedCharsets -> sun.nio.cs.ext.*
+
+# sun.nio.cs.ext.ExtendedCharsets
+@ClassForName(optional)
+ sun.nio.cs.ext.ExtendedCharsets -> sun.nio.cs.ext.*
+
+# public static java.nio.file.spi.FileSystemProvider create()
+@ClassForName
+ sun.nio.fs.DefaultFileSystemProvider -> sun.nio.fs.SolarisFileSystemProvider
+ sun.nio.fs.DefaultFileSystemProvider -> sun.nio.fs.LinuxFileSystemProvider
+
+# sun.rmi.server.MarshalInputStream
+@ClassForName
+ sun.rmi.server.MarshalInputStream -> sun.rmi.server.Activation$ActivationSystemImpl_Stub
+ sun.rmi.server.MarshalInputStream -> sun.rmi.registry.RegistryImpl_Stub
+
+# private java.security.Provider doLoadProvider()
+@ClassForName(optional)
+ sun.security.jca.ProviderConfig -> sun.security.pkcs11.SunPKCS11
+ sun.security.jca.ProviderConfig -> sun.security.provider.Sun
+ sun.security.jca.ProviderConfig -> sun.security.rsa.SunRsaSign
+ sun.security.jca.ProviderConfig -> sun.security.ec.SunEC
+ sun.security.jca.ProviderConfig -> com.sun.net.ssl.internal.ssl.Provider
+ sun.security.jca.ProviderConfig -> com.sun.crypto.provider.SunJCE
+ sun.security.jca.ProviderConfig -> sun.security.jgss.SunProvider
+ sun.security.jca.ProviderConfig -> com.sun.security.sasl.Provider
+ sun.security.jca.ProviderConfig -> org.jcp.xml.dsig.internal.dom.XMLDSigRI
+ sun.security.jca.ProviderConfig -> sun.security.smartcardio.SunPCSC
+ sun.security.jca.ProviderConfig -> sun.security.mscapi.SunMSCAPI
+
+# public static java.security.Provider getSunProvider()
+@ClassForName
+ sun.security.jca.Providers -> sun.security.provider.Sun
+ sun.security.jca.Providers -> sun.security.provider.VerificationProvider
+
+# private static sun.security.jgss.spi.MechanismFactory getMechFactoryImpl(java.security.Provider, java.lang.String, org.ietf.jgss.Oid, sun.security.jgss.GSSCaller)
+@ClassForName
+ sun.security.jgss.ProviderList -> sun.security.jgss.spi.MechanismFactory
+
+# sun.security.jgss.wrapper.SunNativeProvider
+@NativeFindClass
+ sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.Oid
+ sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.GSSException
+ sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSNameElement
+ sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSCredElement
+ sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.NativeGSSContext
+ sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.SunNativeProvider
+ sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.MessageProp
+ sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.ChannelBinding
+ sun.security.jgss.wrapper.SunNativeProvider -> java.net.InetAddress
+ sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSLibStub
+
+# static void ensureLoaded()
+@NativeFindClass
+ sun.security.krb5.Credentials -> sun.security.krb5.internal.Krb5
+ sun.security.krb5.Credentials -> sun.security.krb5.internal.Ticket
+ sun.security.krb5.Credentials -> sun.security.krb5.PrincipalName
+ sun.security.krb5.Credentials -> sun.security.util.DerValue
+ sun.security.krb5.Credentials -> sun.security.krb5.EncryptionKey
+ sun.security.krb5.Credentials -> sun.security.krb5.internal.TicketFlags
+ sun.security.krb5.Credentials -> sun.security.krb5.internal.KerberosTime
+
+# public static java.lang.String getDefaultCacheName()
+@ClassForName(optional)
+ sun.security.krb5.internal.ccache.FileCredentialsCache -> com.sun.security.auth.module.UnixSystem
+
+# sun.security.pkcs.PKCS9Attribute
+@ClassForName
+ sun.security.pkcs.PKCS9Attribute -> sun.security.util.ObjectIdentifier
+ sun.security.pkcs.PKCS9Attribute -> java.util.Date
+ sun.security.pkcs.PKCS9Attribute -> sun.security.pkcs.SignerInfo
+ sun.security.pkcs.PKCS9Attribute -> sun.security.x509.CertificateExtensions
+
+# protected T engineGetKeySpec(java.security.Key, java.lang.Class)
+@ClassForName
+ sun.security.provider.DSAKeyFactory -> java.security.spec.DSAPublicKeySpec
+ sun.security.provider.DSAKeyFactory -> java.security.spec.X509EncodedKeySpec
+ sun.security.provider.DSAKeyFactory -> java.security.spec.DSAPrivateKeySpec
+ sun.security.provider.DSAKeyFactory -> java.security.spec.PKCS8EncodedKeySpec
+
+# protected T engineGetParameterSpec(java.lang.Class)
+@ClassForName
+ sun.security.provider.DSAParameters -> java.security.spec.DSAParameterSpec
+
+# sun.security.provider.VerificationProvider
+@ClassForName(optional)
+ sun.security.provider.VerificationProvider -> sun.security.provider.Sun
+ sun.security.provider.VerificationProvider -> sun.security.rsa.SunRsaSign
+
+# sun.security.provider.certpath.URICertStore$LDAP
+@ClassForName(optional)
+ sun.security.provider.certpath.URICertStore$LDAP -> sun.security.provider.certpath.ldap.LDAPCertStoreHelper
+
+# sun.security.smartcardio.PCSC
+@NativeFindClass
+ sun.security.smartcardio.PCSC -> sun.security.smartcardio.PCSCException
+
+# sun.security.ssl.HandshakeMessage
+@ClassForName
+ sun.security.ssl.HandshakeMessage -> java.security.MessageDigest$Delegate
+
+# sun.security.ssl.JsseJce
+@ClassForName(optional)
+ sun.security.ssl.JsseJce -> sun.security.krb5.PrincipalName
+
+# sun.security.x509.OIDMap$OIDInfo
+@ClassForName
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectKeyIdentifierExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.KeyUsageExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PrivateKeyUsageExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectAlternativeNameExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.IssuerAlternativeNameExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.BasicConstraintsExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLNumberExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLReasonCodeExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.NameConstraintsExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PolicyMappingsExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.AuthorityKeyIdentifierExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PolicyConstraintsExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.NetscapeCertTypeExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CertificatePoliciesExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.ExtendedKeyUsageExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.InhibitAnyPolicyExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLDistributionPointsExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CertificateIssuerExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectInfoAccessExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.AuthorityInfoAccessExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.IssuingDistributionPointExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.DeltaCRLIndicatorExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.FreshestCRLExtension
+ sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.OCSPNoCheckExtension
+
+# sun.util.LocaleServiceProviderPool$AllAvailableLocales
+@Provider
+ sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.BreakIteratorProvider
+ sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.CollatorProvider
+ sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DateFormatProvider
+ sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DateFormatSymbolsProvider
+ sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DecimalFormatSymbolsProvider
+ sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.NumberFormatProvider
+ sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.CurrencyNameProvider
+ sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.LocaleNameProvider
+ sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.TimeZoneNameProvider
+
+# private static final java.lang.String[] retrieveDisplayNames(sun.util.resources.OpenListResourceBundle, java.lang.String, java.util.Locale)
+@Provider
+ sun.util.TimeZoneNameUtility -> META-INF/services/java.util.spi.TimeZoneNamePProvider
+
+# public static sun.util.calendar.CalendarSystem forName(java.lang.String)
+@ClassForName
+ sun.util.calendar.CalendarSystem -> sun.util.calendar.Gregorian
+ sun.util.calendar.CalendarSystem -> sun.util.calendar.LocalGregorianCalendar
+ sun.util.calendar.CalendarSystem -> sun.util.calendar.JulianCalendar
+
+# sun.util.logging.LoggingSupport
+@ClassForName(optional)
+ sun.util.logging.LoggingSupport -> java.util.logging.LoggingProxyImpl
diff --git a/jdk/make/modules/modules.config b/jdk/make/modules/modules.config
new file mode 100644
index 00000000000..04b71ea6a51
--- /dev/null
+++ b/jdk/make/modules/modules.config
@@ -0,0 +1,858 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+// These classes are not referenced in the JDK but we can't
+// remove them for compatibility reason. Define this module
+// first so that other modules don't need to exclude these clases
+module private-legacy {
+ include sun.misc.Cache*,
+ sun.misc.ClassLoaderUtil,
+ sun.misc.Compare,
+ sun.misc.ConditionLock,
+ sun.misc.CRC16,
+ sun.misc.Lock,
+ sun.misc.Regexp,
+ sun.misc.RequestProcessor,
+ sun.misc.Sort,
+ sun.misc.Request,
+ sun.misc.Timeable,
+ sun.misc.Timer,
+ sun.misc.TimerThread,
+ sun.misc.TimerTickThread,
+ sun.misc.UCDecoder,
+ sun.misc.UCEncoder,
+ sun.misc.UUDecoder,
+ sun.misc.UUEncoder,
+ com.sun.net.ssl.SSLContext,
+ sun.net.NetworkServer,
+ sun.net.URLCanonicalizer,
+ sun.reflect.misc.ConstructorUtil,
+ sun.reflect.FieldInfo,
+ sun.reflect.SignatureIterator,
+ sun.reflect.generics.reflectiveObjects.NotImplementedException,
+ sunw.io.Serializable,
+ sunw.util.EventListener,
+ sunw.util.EventObject;
+}
+
+// Deprecated classes that aren't referenced/used go here.
+module deprecated {
+ // add deprecated security classes once b78 is promoted
+}
+
+/**************************************************************************/
+
+module base {
+ // core classes
+ include java.lang.*,
+ java.lang.annotation.*,
+ java.lang.ref.*,
+ java.lang.reflect.*,
+ java.math.*,
+ java.net.*,
+ java.util.*,
+ java.util.concurrent.**,
+ java.util.jar.*,
+ java.util.regex.*,
+ java.util.spi.*,
+ java.util.zip.*,
+ java.text.**;
+
+ exclude java.util.jar.Pack200*,
+ java.util.XMLUtils,
+ java.text.Bidi;
+
+ include java.io.*, java.nio.*, java.nio.charset.**;
+ exclude java.io.TempFileHelper, java.nio.BufferPoolMXBean;
+
+ // security APIs
+ // javax.crypto and javax.security.auth are included to avoid inconsistent
+ // spliting of JCA and JAAS. This adds about 85k. Also note that some deprecated
+ // classes must be included for now (see 6876158, 6876170)
+ include java.security.*,
+ java.security.cert.*,
+ java.security.interfaces.*,
+ java.security.spec.*,
+ javax.security.auth.**,
+ javax.crypto.**;
+
+ // Sun and RSA security providers (except LDAP CertStore)
+ // roots sun.security.provider.* sun.security.provider.certpath.* sun.security.rsa.*
+ include com.sun.security.auth.PrincipalComparator,
+ com.sun.security.auth.SubjectCodeSource,
+ com.sun.security.auth.login.**,
+ com.sun.security.auth.Policy*,
+ sun.security.action.*,
+ sun.security.ec.*,
+ sun.security.jca.*,
+ sun.security.pkcs.*,
+ sun.security.provider.*,
+ sun.security.provider.certpath.*,
+ sun.security.rsa.*,
+ sun.security.util.*,
+ sun.security.validator.*,
+ sun.security.x509.*,
+ sun.security.timestamp.*;
+
+ // this list is based on the classlist generated from the rootset
+ // need investigation
+ exclude sun.security.ec.ECD*,
+ sun.security.ec.ECKeyPairGenerator,
+ sun.security.ec.SunEC*,
+ sun.security.pkcs.PKCS10*,
+ sun.security.pkcs.EncodingException,
+ sun.security.util.AuthResources_*,
+ sun.security.util.Resources_*,
+ sun.security.util.BigInt,
+ sun.security.util.HostnameChecker,
+ sun.security.x509.CertAndKeyGen,
+ sun.security.util.PathList;
+
+ // Kerberos not needed
+ exclude javax.security.auth.kerberos.**,
+ sun.security.jgss.**,
+ sun.security.krb5.**,
+ sun.security.ssl.Kerberos*,
+ org.ietf.jgss.**;
+
+ // property events and annotations
+ include java.beans.ChangeListenerMap,
+ java.beans.IndexedPropertyChangeEvent,
+ java.beans.PropertyChange*,
+ java.beans.PropertyVetoException,
+ java.beans.VetoableChange*,
+ java.beans.ConstructorProperties;
+
+ // mandatory charsets
+ include sun.nio.cs.*;
+
+ exclude sun.nio.cs.AbstractCharsetProvider,
+ sun.nio.cs.CharsetMapping,
+ sun.nio.cs.IBM*,
+ sun.nio.cs.ISO*,
+ sun.nio.cs.KOI8_*,
+ sun.nio.cs.MS125*,
+ sun.nio.cs.UTF_32*,
+ sun.nio.cs.SingleByteDecoder,
+ sun.nio.cs.SingleByteEncoder;
+
+ allow sun.nio.cs.ISO_8859_1,
+ sun.nio.cs.ISO_8859_15,
+ sun.nio.cs.MS1252;
+
+ include sun.text.*,
+ sun.text.normalizer.*;
+
+ // resource files
+ include sun/text/resources/*.icu;
+
+ exclude sun.text.bidi.*,
+ sun.text.CharArrayCodePointIterator,
+ sun.text.CharSequenceCodePointIterator,
+ sun.text.CharacterIteratorCodePointIterator,
+ sun.text.CodePointIterator;
+
+ include sun.util.*,
+ sun.util.calendar.*,
+ sun.util.logging.*,
+ sun.util.resources.LocaleData,
+ sun.util.resources.LocaleNamesBundle,
+ sun.util.resources.OpenListResourceBundle;
+
+ // US_en locale
+ include sun.text.resources.BreakIteratorInfo,
+ sun.text.resources.FormatData,
+ sun.text.resources.FormatData_en_US,
+ sun.util.resources.CalendarData,
+ sun.util.resources.CalendarData_en,
+ sun.util.resources.TimeZoneNames,
+ sun.util.resources.TimeZoneNames_en,
+ sun.util.resources.TimeZoneNamesBundle,
+ sun.util.resources.LocaleNames,
+ sun.util.resources.LocaleNames_en,
+ sun.util.resources.LocalenamesBundles,
+ sun.util.resources.CurrencyNames,
+ sun.util.resources.CurrencyNames_en_US,
+ sun.util.EmptyListResourceBundle;
+
+ // resources file needed by
+ // - sun.misc.ExtensionInfo
+ // - sun.security.provider.PolicyFile
+ // - com.sun.security.auth.PolicyFile
+ include sun.misc.resources.Messages,
+ sun.security.util.Resources,
+ sun.security.util.AuthResources;
+
+ // java.nio.channels and java.nio.file not in base
+ include sun.nio.ch.Interruptible,
+ sun.nio.ch.DirectBuffer,
+ sun.nio.ByteBuffered;
+
+ include sun.reflect.**;
+
+ // protocol handlers
+ include sun.net.www.protocol.file.*,
+ sun.net.www.protocol.jar.*,
+ sun.net.www.protocol.http.*;
+
+ include sun.net.*,
+ sun.net.spi.*,
+ sun.net.idn.*,
+ sun.net.util.*,
+ sun.net.www.*,
+ sun.net.www.http.*,
+ sun.net.spi.nameservice.*;
+
+ // resource file for sun.net.idn
+ include sun/net/idn/*;
+
+ // classes in net-compat
+ exclude sun.net.Telnet*, sun.net.TransferProtocolClient;
+
+ // classes in deploy
+ exclude sun.net.www.protocol.http.AuthCacheBridge;
+
+ // classes in security-jsse
+ exclude java.net.SecureCacheResponse;
+
+ // launcher
+ include sun.launcher.LauncherHelper, sun.launcher.resources.launcher;
+
+ include sun.misc.*;
+ exclude sun.misc.FIFOQueueEnumerator,
+ sun.misc.LIFOQueueEnumerator,
+ sun.misc.GC,
+ sun.misc.PerformanceLogger,
+ sun.misc.Queue,
+ sun.misc.QueueElement,
+ sun.misc.Ref,
+ sun.misc.VMSupport;
+
+ // On Windows, OSEnvironment dependency
+ include sun.io.Win32ErrorMode;
+}
+
+/**************************************************************************/
+
+module charsets {
+ include sun.nio.cs.ext.**;
+
+ include sun.nio.cs.AbstractCharsetProvider,
+ sun.nio.cs.CharsetMapping,
+ sun.nio.cs.IBM*,
+ sun.nio.cs.ISO*,
+ sun.nio.cs.KOI8_*,
+ sun.nio.cs.MS125*,
+ sun.nio.cs.SingleByte*,
+ sun.nio.cs.UTF_32*;
+
+ exclude sun.nio.cs.ISO_8859_1,
+ sun.nio.cs.MS1252;
+
+ // legacy sun.io converters
+ include sun.io.*;
+}
+
+/**************************************************************************/
+
+// For now, retains the current JRE extensions where localedata.jar in jre/lib/ext
+module localedata {
+ include sun.util.resources.*_ar,
+ sun.util.resources.*_ar_*,
+ sun.util.resources.*_hi,
+ sun.util.resources.*_hi_*,
+ sun.util.resources.*_iw,
+ sun.util.resources.*_iw_*,
+ sun.util.resources.*_ja,
+ sun.util.resources.*_ja_*,
+ sun.util.resources.*_ko,
+ sun.util.resources.*_ko_*,
+ sun.util.resources.*_th,
+ sun.util.resources.*_th_*,
+ sun.util.resources.*_vi,
+ sun.util.resources.*_vi_*,
+ sun.util.resources.*_zh,
+ sun.util.resources.*_zh_*;
+ include sun.text.resources.*_ar,
+ sun.text.resources.*_ar_*,
+ sun.text.resources.*_hi,
+ sun.text.resources.*_hi_*,
+ sun.text.resources.*_iw,
+ sun.text.resources.*_iw_*,
+ sun.text.resources.*_ja,
+ sun.text.resources.*_ja_*,
+ sun.text.resources.*_ko,
+ sun.text.resources.*_ko_*,
+ sun.text.resources.*_th,
+ sun.text.resources.*_th_*,
+ sun.text.resources.*_vi,
+ sun.text.resources.*_vi_*,
+ sun.text.resources.*_zh,
+ sun.text.resources.*_zh_*;
+}
+
+module resources {
+ include sun.text.resources.*, sun.util.resources.*, sun.misc.resources.*;
+}
+
+/**************************************************************************/
+
+module nio {
+ include java.nio.channels.**, java.nio.file.**, com.sun.nio.file.**;
+
+ // this is excluded from base
+ include java.io.TempFileHelper;
+
+ // provider implementations and their dependencies
+ include sun.nio.ch.*, sun.nio.fs.**;
+ exclude sun.nio.ch.Sctp*;
+}
+
+/**************************************************************************/
+
+module pack200 {
+ include java.util.jar.Pack200*, com.sun.java.util.jar.pack.**;
+}
+
+/**************************************************************************/
+
+module logging {
+ include java.util.logging.*, sun.util.logging.**;
+ exclude java.util.logging.PlatformLoggingMXBean;
+
+ // Formatter for HTTP messages
+ include sun.net.www.protocol.http.logging.*;
+}
+
+/**************************************************************************/
+
+module management-snmp {
+ include com.sun.jmx.snmp.**, sun.management.snmp.**;
+}
+
+module management-iiop {
+ include com.sun.jmx.remote.protocol.iiop.*;
+
+ // stubs and ties
+ include javax.management.remote.rmi._*,
+ org.omg.stub.javax.management.remote.rmi.**;
+}
+
+module management {
+ include java.lang.management.*, com.sun.management.**, sun.management.**;
+ include javax.management.**, com.sun.jmx.**;
+
+ // other management interfaces
+ include java.nio.BufferPoolMXBean;
+ include java.util.logging.PlatformLoggingMXBean;
+
+ // supporting classes in sun.misc
+ include sun.misc.VMSupport;
+}
+
+/**************************************************************************/
+
+module instrument {
+ // java.lang.instrument
+ include java.lang.instrument.*, sun.instrument.*;
+
+ // tracing
+ include com.sun.tracing.**, sun.tracing.**;
+
+ // HPROF support
+ include com.sun.demo.jvmti.hprof.*;
+}
+
+/**************************************************************************/
+
+module rmi-activation {
+ include java.rmi.activation.**,
+ sun.rmi.server.Act*,
+ sun.rmi.server.InactiveGroupException;
+}
+
+module rmi {
+ include java.rmi.**, sun.rmi.**, com.sun.rmi.**;
+
+ // SSL factories are in rmi
+ include javax.rmi.ssl.**;
+
+ // rmic is in tools
+ exclude sun.rmi.rmic.**;
+
+ // supporting classes in sun.misc and dependencies
+ include sun.misc.GC;
+}
+
+/**************************************************************************/
+
+module prefs {
+ include java.util.prefs.*;
+}
+
+/**************************************************************************/
+
+module security-jsse {
+ include javax.net.**,
+ javax.security.cert.*,
+ java.net.SecureCacheResponse,
+ com.sun.net.ssl.**,
+ com.sun.security.cert.internal.x509.*,
+ sun.security.ssl.*,
+ sun.net.www.protocol.https.**,
+ sun.security.internal.interfaces.Tls*,
+ sun.security.internal.spec.Tls*,
+ sun.security.util.HostnameChecker;
+}
+
+module security-sunpkcs11 {
+ include sun.security.pkcs11.**;
+}
+
+module security-sunjce {
+ include com.sun.crypto.provider.*;
+}
+
+module security-sunec {
+ include sun.security.ec.*;
+}
+
+module security-sunmscapi {
+ include sun.security.mscapi.*;
+}
+
+module security-kerberos {
+ include javax.security.auth.kerberos.*,
+ com.sun.security.jgss.**,
+ com.sun.security.auth.module.Krb5LoginModule,
+ com.sun.security.sasl.gsskerb.**, // GSSAPI SASL mechanism
+ sun.security.jgss.**,
+ sun.security.ssl.krb5.**,
+ sun.security.krb5.**,
+ org.ietf.jgss.**,
+ sun.net.www.protocol.http.spnego.*;
+}
+
+module security-sasl {
+ include javax.security.sasl.**,
+ com.sun.security.sasl.**;
+}
+
+module security-xmldsig {
+ include javax.xml.crypto.**,
+ org.jcp.xml.dsig.**,
+ com.sun.org.apache.xml.internal.security.**;
+}
+
+module security-smartcardio {
+ include javax.smartcardio.**, sun.security.smartcardio.**;
+}
+
+module security-misc {
+ include com.sun.security.auth.**, sun.security.util.AuthResources_*,
+ sun.security.pkcs.*,
+ sun.security.pkcs12.*;
+
+ // this class is a candidate to be removed.
+ include sun.security.util.BigInt;
+}
+
+module security-resources {
+ include sun.security.util.Resources_*;
+}
+
+module security-compat {
+ include java.security.acl.*, sun.security.acl.*;
+}
+
+/**************************************************************************/
+
+module jndi-ldap {
+ include javax.naming.ldap.**,
+ com.sun.jndi.ldap.**,
+ com.sun.jndi.url.ldap.*,
+ com.sun.jndi.url.ldaps.*,
+ sun.security.provider.certpath.ldap.**;
+}
+
+module jndi-rmiregistry {
+ include com.sun.jndi.rmi.**, com.sun.jndi.url.rmi.**;
+}
+
+module jndi-dns {
+ include com.sun.jndi.dns.**, com.sun.jndi.url.dns.**;
+ include sun.net.dns.**; // to access DNS config.
+ include sun.net.spi.nameservice.dns.**; // for DNS-only name service.
+}
+
+module jndi-cosnaming {
+ include com.sun.jndi.cosnaming.**,
+ com.sun.jndi.toolkit.corba.**,
+ com.sun.jndi.url.corbaname.**,
+ com.sun.jndi.url.iiop.**,
+ com.sun.jndi.url.iiopname.**;
+}
+
+// framework/API and classes used by providers
+module jndi {
+ include javax.naming.**,
+ com.sun.naming.**,
+ com.sun.jndi.toolkit.ctx.**,
+ com.sun.jndi.toolkit.dir.**,
+ com.sun.jndi.toolkit.url.**;
+}
+
+/**************************************************************************/
+
+module jdbc-base {
+ include java.sql.**, javax.sql.*;
+ exclude javax.sql.XA*;
+}
+
+module jdbc-enterprise {
+ include javax.sql.**, com.sun.rowset.**;
+}
+
+module jdbc-odbc {
+ include sun.jdbc.odbc.**;
+}
+
+/**************************************************************************/
+
+module scripting {
+ include javax.script.**;
+
+ // supporting classes for scripting engines
+ include com.sun.script.util.**;
+}
+
+module scripting-rhino {
+ include com.sun.script.javascript.**, sun.org.mozilla.javascript.**;
+}
+
+/**************************************************************************/
+
+module httpserver {
+ include com.sun.net.httpserver.**, sun.net.httpserver.**;
+}
+
+/**************************************************************************/
+
+module sctp {
+ // API and dependencies
+ include com.sun.nio.sctp.**, sun.nio.ch.Sctp*;
+}
+
+/**************************************************************************/
+
+module langtools {
+ include javax.tools.**, javax.lang.model.**, javax.annotation.processing.**;
+
+ // include mirror API for now
+ include com.sun.mirror.**;
+
+ // include the JSR292 APIs for now
+ include java.dyn.**, sun.dyn.**;
+}
+
+/**************************************************************************/
+
+module beans {
+ include java.beans.**, com.sun.beans.**, sun.beans.**;
+}
+
+/**************************************************************************/
+
+module jaxp-parsers-api {
+ include javax.xml.*, javax.xml.parsers.**,
+ org.w3c.dom.**, org.w3c.sax.**, org.xml.sax.**;
+}
+
+module jaxp-api {
+ include javax.xml.**;
+ exclude javax.xml.crypto.**, // XML-DSIG
+ javax.xml.bind.**, // JAX-WS
+ javax.xml.soap.**,
+ javax.xml.ws.**;
+}
+
+module jaxp-xerces-impl {
+ include com.sun.org.apache.xerces.internal.**;
+
+ // include in xerces-impl due to circular dependencies
+ include com.sun.org.apache.xml.internal.serialize.**,
+ com.sun.xml.internal.stream.**;
+ exclude com.sun.xml.internal.stream.buffer.**; // JAX-WS
+}
+
+// required by Xerces and JAX-WS
+module jaxp-xerces-resolver {
+ include com.sun.org.apache.xml.internal.resolver.**;
+}
+
+module jaxp-xalan {
+ include com.sun.org.apache.xalan.internal.**,
+ com.sun.org.apache.xpath.internal.**,
+ com.sun.org.apache.xml.internal.dtm.**,
+ com.sun.org.apache.xml.internal.res.**,
+ com.sun.org.apache.xml.internal.serializer.**,
+ com.sun.org.apache.xml.internal.utils.**,
+ com.sun.org.apache.bcel.internal.**,
+ com.sun.org.apache.regexp.internal.**,
+ com.sun.java_cup.internal.**;
+}
+
+/**************************************************************************/
+
+module jaxws-tools {
+ include com.sun.codemodel.**,
+ com.sun.xml.internal.dtdparser.**,
+ com.sun.xml.internal.rngom.**,
+ com.sun.xml.internal.xsom.**,
+ com.sun.istack.internal.tools.**,
+ com.sun.istack.internal.ws.**,
+ com.sun.tools.internal.xjc.**,
+ com.sun.tools.internal.ws.**,
+ com.sun.tools.internal.jxc.**,
+ org.relaxng.datatype.**;
+}
+
+module jaxws {
+ include javax.jws.**,
+ javax.xml.bind.**,
+ javax.xml.soap.**,
+ javax.xml.ws.**,
+ org.relaxng.**,
+ com.sun.istack.internal.*,
+ com.sun.istack.internal.localization.*,
+ com.sun.xml.internal.**;
+
+ // include JAF in this module
+ include javax.activation.**, com.sun.activation.**;
+
+ include META-INF/mailcap.default,
+ META-INF/mimetypes.default;
+}
+
+/**************************************************************************/
+module enterprise-base {
+ include javax.transaction.**, // JTA
+ javax.annotation.*; // Common annotations (JSR-250)
+}
+
+/**************************************************************************/
+module corba {
+ include javax.activity.**,
+ javax.rmi.*,
+ javax.rmi.CORBA.*,
+ javax.transaction.**,
+ com.sun.corba.**,
+ com.sun.org.omg.**,
+ org.omg.**,
+ sun.corba.**;
+
+ // JMX remote API
+ exclude org.omg.stub.javax.management.**;
+}
+
+/**************************************************************************/
+
+module client {
+ include java.applet.**,
+ java.awt.**,
+ javax.accessibility.*,
+ javax.imageio.**,
+ javax.print.**,
+ javax.sound.**,
+ javax.swing.**,
+ sun.applet.**,
+ sun.audio.**,
+ sun.awt.**,
+ sun.dc.**,
+ sun.font.**,
+ sun.java2d.**,
+ sun.print.**,
+ sun.swing.**,
+ com.sun.accessibility.**,
+ com.sun.awt.**,
+ com.sun.image.**,
+ com.sun.imageio.**,
+ com.sun.java.swing.*, // sajdi also contains classes in a subpackage;
+ // so use '*' instead of '**'
+ com.sun.java.swing.plaf.**,
+ com.sun.media.**,
+ com.sun.swing.**;
+
+ // Bidi class in client module for now
+ include java.text.Bidi, sun.text.bidi.*;
+
+ // PerformanceLogger and dependencies
+ include sun.misc.Ref, sun.misc.PerformanceLogger;
+
+ // misc. dependencies that we need to examine
+ include sun.text.CodePointIterator,
+ sun.text.Char*,
+ sun.misc.Queue*,
+ sun.misc.FIFOQueueEnumerator,
+ sun.misc.LIFOQueueEnumerator;
+
+ // content handlers
+ include sun.net.www.content.audio.**,
+ sun.net.www.content.image.**;
+}
+
+/**************************************************************************/
+
+module deploy {
+ // For now, all plugin and JNLP
+ include com.sun.java.browser.**,
+ netscape.**,
+ sun.plugin.**,
+ sun.plugin2.**,,
+ com.sun.deploy.**,
+ com.sun.javaws.**,
+ javax.jnlp.*,
+ com.sun.jnlp.*,
+ sun.jkernel.*;
+
+ // Hook for http authentication
+ include sun.net.www.protocol.http.AuthCacheBridge;
+}
+
+/**************************************************************************/
+
+module net-compat {
+ // NTLM authentication support
+ include sun.net.www.protocol.http.ntlm.*;
+
+ // ftp and mail clients
+ include sun.net.ftp.**, sun.net.smtp.**;
+
+ // Legacy protocol handlers
+ include sun.net.www.protocol.**;
+
+ // Legacy content handlers
+ include sun.net.www.content.**;
+
+ include sun.net.Telnet*,
+ sun.net.TransferProtocolClient;
+}
+
+/**************************************************************************/
+
+// jar-tool and security-tools are JRE tools
+module jar-tool {
+ include sun.tools.jar.**;
+}
+
+module security-tools {
+ include sun.security.tools.**;
+
+ // Used by security tools
+ include sun.security.util.PathList, sun.security.x509.CertAndKeyGen;
+
+ exclude sun.security.tools.JarBASE64Encoder,
+ sun.security.tools.JarSigner,
+ sun.security.tools.JarSignerParameters,
+ sun.security.tools.JarSignerResources*,
+ sun.security.tools.SignatureFile,
+ sun.security.tools.TimestampedSigner;
+}
+
+module jconsole {
+ include sun.tools.jconsole.**,
+ com.sun.tools.jconsole.*;
+}
+
+module serialver {
+ include sun.tools.serialver.**;
+}
+
+module gui-tools {
+ include jconsole,
+ serialver;
+
+ include com.sun.tools.example.debug.bdi.**,
+ com.sun.tools.example.debug.gui.**,
+ com.sun.tools.internal.xjc.**;
+}
+
+module attach {
+ include com.sun.tools.attach.**,
+ sun.tools.attach.**;
+}
+
+module debugging {
+ include com.sun.jdi.**, com.sun.tools.jdi.**;
+}
+
+module jdb {
+ include com.sun.tools.example.debug.**;
+}
+
+module sajdi {
+ include sun.jvm.hotspot.**,
+ com.sun.java.swing.ui.**,
+ com.sun.java.swing.action.**;
+
+ include toolbarButtonGraphics/**;
+ include sa.properties;
+}
+
+module tools {
+ include attach,
+ debugging,
+ jaxws-tools,
+ jdb,
+ sajdi;
+
+ // include gui-tools in tools module unless the tool binaries
+ // are modified to load the new gui-tools.jar
+ include gui-tools;
+
+ include com.sun.tools.**, sun.tools.**, sun.security.tools.**,
+ com.sun.jarsigner.**,
+ com.sun.javac.**,
+ com.sun.javadoc.**, com.sun.source.**,
+ sun.jvmstat.**,
+ sun.rmi.rmic.**;
+}
+
+/**************************************************************************/
+
+module servicetag {
+ include com.sun.servicetag.**;
+}
+
+/**************************************************************************/
+
+// these classes will be removed from JRE - see 6909002
+module inputmethods-ext {
+ include com.sun.inputmethods.internal.**;
+}
+
+/**************************************************************************/
+
+module other {
+ include **;
+}
diff --git a/jdk/make/modules/modules.group b/jdk/make/modules/modules.group
new file mode 100644
index 00000000000..64abd180718
--- /dev/null
+++ b/jdk/make/modules/modules.group
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * Example:
+ * module jdbc {
+ * include jdbc-base, jdbc-enterprise, jdbc-odbc;
+ * }
+ */
diff --git a/jdk/make/modules/optional.depconfig b/jdk/make/modules/optional.depconfig
new file mode 100644
index 00000000000..0811163e715
--- /dev/null
+++ b/jdk/make/modules/optional.depconfig
@@ -0,0 +1,124 @@
+# public final java.nio.channels.SocketChannel getChannel()
+@Optional
+ sun.security.ssl.BaseSSLSocketImpl -> java.nio.channels.SocketChannel
+
+# public XMLDecoder(java.io.InputStream)
+# public XMLDecoder(java.io.InputStream, java.lang.Object)
+# public XMLDecoder(java.io.InputStream, java.lang.Object, java.beans.ExceptionListener)
+# public XMLDecoder(java.io.InputStream, java.lang.Object, java.beans.ExceptionListener, java.lang.ClassLoader)
+# public XMLDecoder(org.xml.sax.InputSource)
+@Optional
+ java.beans.XMLDecoder -> com.sun.beans.decoder.DocumentHandler
+ java.beans.XMLDecoder -> org.xml.sax.InputSource
+
+# public static org.xml.sax.helpers.DefaultHandler createHandler(java.lang.Object, java.beans.ExceptionListener, java.lang.ClassLoader)
+@Optional
+ java.beans.XMLDecoder -> com.sun.beans.decoder.DocumentHandler
+ java.beans.XMLDecoder -> org.xml.sax.helpers.DefaultHandler
+
+# public final java.nio.channels.FileChannel getChannel()
+@Optional
+ java.net.SocketInputStream -> java.nio.channels.FileChannel
+
+# public final java.nio.channels.FileChannel getChannel()
+@Optional
+ java.net.SocketOutputStream -> java.nio.channels.FileChannel
+
+# public Scanner(java.io.File)
+# public Scanner(java.io.File, java.lang.String)
+@Optional
+ java.util.Scanner -> java.nio.channels.ReadableByteChannel
+ java.util.Scanner -> java.nio.channels.Channels
+
+# public Scanner(java.nio.file.FileRef)
+# public Scanner(java.nio.file.FileRef, java.lang.String)
+@Optional
+ java.util.Scanner -> java.nio.file.FileRef
+ java.util.Scanner -> java.nio.file.OpenOption
+
+# public Scanner(java.nio.channels.ReadableByteChannel)
+# public Scanner(java.nio.channels.ReadableByteChannel, java.lang.String)
+@Optional
+ java.util.Scanner -> java.nio.channels.ReadableByteChannel
+ java.util.Scanner -> java.nio.channels.Channels
+
+# private static void loadSnmpAgent(java.lang.String, java.util.Properties)
+@Optional
+ sun.management.Agent -> sun.management.snmp.AdaptorBootstrap
+
+# public void connect()
+@Optional
+ sun.net.www.protocol.http.HttpURLConnection -> java.net.SecureCacheResponse
+
+# private static sun.security.util.PermissionFactory> permissionFactory()
+@Optional
+ sun.security.util.SecurityConstants$AWT -> sun.awt.AWTPermissionFactory
+
+# sun.util.logging.LoggingSupport
+@Optional
+ sun.util.logging.LoggingSupport -> java.util.logging.LoggingProxyImpl
+
+# public java.nio.channels.DatagramChannel getChannel()
+@Optional
+ java.net.DatagramSocket -> java.nio.channels.DatagramChannel
+
+# public java.nio.channels.SocketChannel getChannel()
+@Optional
+ java.net.Socket -> java.nio.channels.SocketChannel
+
+# public java.nio.channels.ServerSocketChannel getChannel()
+@Optional
+ java.net.ServerSocket -> java.nio.channels.ServerSocketChannel
+
+# public final java.nio.channels.FileChannel getChannel()
+@Optional
+ java.io.RandomAccessFile -> java.nio.channels.FileChannel
+ java.io.RandomAccessFile -> sun.nio.ch.FileChannelImpl
+
+# public static sun.nio.cs.StreamDecoder forDecoder(java.nio.channels.ReadableByteChannel, java.nio.charset.CharsetDecoder, int)
+@Optional
+ sun.nio.cs.StreamDecoder -> java.nio.channels.ReadableByteChannel
+
+# private static java.nio.channels.FileChannel getChannel(java.io.FileInputStream)
+# StreamDecoder(java.io.InputStream, java.lang.Object, java.nio.charset.CharsetDecoder)
+@Optional
+ sun.nio.cs.StreamDecoder -> java.nio.channels.FileChannel
+
+# StreamDecoder(java.nio.channels.ReadableByteChannel, java.nio.charset.CharsetDecoder, int)
+@Optional
+ sun.nio.cs.StreamDecoder -> java.nio.channels.ReadableByteChannel
+
+# public static java.io.File createTemporaryFile(java.lang.String, java.lang.String, java.nio.file.attribute.FileAttribute>[])
+@Optional
+ java.io.File -> java.io.TempFileHelper
+ java.io.File -> java.nio.file.attribute.FileAttribute
+
+# public java.nio.file.Path toPath()
+@Optional
+ java.io.File -> java.nio.file.Paths
+ java.io.File -> java.nio.file.Path
+
+# public static sun.nio.cs.StreamEncoder forEncoder(java.nio.channels.WritableByteChannel, java.nio.charset.CharsetEncoder, int)
+# private StreamEncoder(java.nio.channels.WritableByteChannel, java.nio.charset.CharsetEncoder, int)
+@Optional
+ sun.nio.cs.StreamEncoder -> java.nio.channels.WritableByteChannel
+
+# public java.nio.channels.FileChannel getChannel()
+@Optional
+ java.io.FileOutputStream -> java.nio.channels.FileChannel
+ java.io.FileOutputStream -> sun.nio.ch.FileChannelImpl
+
+# public java.nio.channels.FileChannel getChannel()
+@Optional
+ java.io.FileInputStream -> java.nio.channels.FileChannel
+ java.io.FileInputStream -> sun.nio.ch.FileChannelImpl
+
+# public void loadFromXML(java.io.InputStream)
+# public void storeToXML(java.io.OutputStream, java.lang.String, java.lang.String)
+@Optional
+ java.util.Properties -> java.util.XMLUtils
+
+# public static java.nio.channels.Channel inheritedChannel()
+@Optional
+ java.lang.System -> java.nio.channels.Channel
+ java.lang.System -> java.nio.channels.spi.SelectorProvider
diff --git a/jdk/make/modules/tools/Makefile b/jdk/make/modules/tools/Makefile
new file mode 100644
index 00000000000..fcf514bec88
--- /dev/null
+++ b/jdk/make/modules/tools/Makefile
@@ -0,0 +1,85 @@
+#
+# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+#
+# Makefile for building the classanalyzer tool
+#
+
+BUILDDIR = ../..
+PACKAGE = com.sun.classanalyzer
+PRODUCT = tools
+PROGRAM = classanalyzer
+include $(BUILDDIR)/common/Defs.gmk
+
+BUILDTOOL_SOURCE_ROOT = src
+BUILDTOOL_MAIN = $(PKGDIR)/ClassAnalyzer.java
+BUILTTOOL_MAINCLASS = $(subst /,.,$(BUILDTOOL_MAIN:%.java=%))
+
+BUILDTOOL_MAIN_SOURCE_FILE = $(BUILDTOOL_SOURCE_ROOT)/$(BUILDTOOL_MAIN)
+BUILDTOOL_MANIFEST_FILE = $(BUILDTOOLCLASSDIR)/$(PROGRAM)_manifest.mf
+BUILDTOOL_JAR_FILE = $(BUILDTOOLJARDIR)/$(PROGRAM).jar
+
+FILES_java := $(shell $(CD) $(BUILDTOOL_SOURCE_ROOT) \
+ && $(FIND) $(PKGDIR) $(SCM_DIRS_prune) -o -type f -print)
+FILES_class = $(FILES_java:%.java=$(BUILDTOOLCLASSDIR)/%.class)
+
+all build: $(BUILDTOOL_JAR_FILE) tool_info
+
+$(BUILDTOOL_MANIFEST_FILE): $(BUILDTOOL_MAIN_SOURCE_FILE)
+ @$(prep-target)
+ $(ECHO) "Main-Class: $(BUILTTOOL_MAINCLASS)" > $@
+
+$(BUILDTOOLCLASSDIR)/%.class : $(BUILDTOOL_SOURCE_ROOT)/%.java
+ @$(prep-target)
+ $(JAVAC_CMD) \
+ -sourcepath $(BUILDTOOL_SOURCE_ROOT) \
+ -d $(BUILDTOOLCLASSDIR) $<
+
+$(BUILDTOOL_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class)
+ @$(prep-target)
+ $(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \
+ -C $(BUILDTOOLCLASSDIR) $(PKGDIR) \
+ $(BOOT_JAR_JFLAGS) || $(RM) $@
+ $(java-vm-cleanup)
+
+# Printing out a build tool information line
+define printBuildToolSetting
+if [ "$2" != "" ] ; then $(PRINTF) "%-25s %s\n" "$1:" "$2"; fi
+endef
+
+# Print out the build tool information
+tool_info:
+ @$(ECHO) "========================================================="
+ @$(call printBuildToolSetting,BUILDTOOL,$(PROGRAM))
+ @$(call printBuildToolSetting,PACKAGE,$(PACKAGE))
+ @$(call printBuildToolSetting,BUILDTOOL_SOURCE_ROOT,$(BUILDTOOL_SOURCE_ROOT))
+ @$(call printBuildToolSetting,BUILTTOOL_MAINCLASS,$(BUILTTOOL_MAINCLASS))
+ @$(call printBuildToolSetting,BUILDTOOL_JAR_FILE,$(BUILDTOOL_JAR_FILE))
+ @$(ECHO) "========================================================="
+
+clean clobber::
+ @$(RM) -rf $(BUILDTOOLCLASSDIR)/$(PKGDIR)
+ @$(RM) $(BUILDTOOL_MANIFEST_FILE)
+ @$(RM) $(BUILDTOOL_JAR_FILE)
diff --git a/jdk/make/modules/tools/build.xml b/jdk/make/modules/tools/build.xml
new file mode 100644
index 00000000000..993ccb8de07
--- /dev/null
+++ b/jdk/make/modules/tools/build.xml
@@ -0,0 +1,33 @@
+
+
+
+
diff --git a/jdk/make/modules/tools/nbproject/project.properties b/jdk/make/modules/tools/nbproject/project.properties
new file mode 100644
index 00000000000..00b74962d97
--- /dev/null
+++ b/jdk/make/modules/tools/nbproject/project.properties
@@ -0,0 +1,92 @@
+#
+# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# - Neither the name of Sun Microsystems nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+application.title=classanalyzer
+application.vendor=mchung
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+
+cp.extra=${tools.jar}
+
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/classanalyzer.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+
+excludes=
+
+file.reference.tools.jar=${jdk.home}/lib/tools.jar
+file.reference.tools-src=src
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${file.reference.tools.jar}
+javac.deprecation=false
+javac.source=1.5
+javac.target=1.5
+javac.test.classpath=
+javadoc.author=false
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=false
+javadoc.use=false
+javadoc.version=false
+main.class=com.sun.classanalyzer.ClassAnalyzer
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=JDK_1.6
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=-Xmx256m
+run.test.classpath=
+source.encoding=UTF-8
+src.dir=${file.reference.tools-src}
diff --git a/jdk/make/modules/tools/nbproject/project.xml b/jdk/make/modules/tools/nbproject/project.xml
new file mode 100644
index 00000000000..b8b0aeafe07
--- /dev/null
+++ b/jdk/make/modules/tools/nbproject/project.xml
@@ -0,0 +1,45 @@
+
+
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ classanalyzer
+
+
+
+
+
+
+
+
diff --git a/jdk/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java b/jdk/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java
new file mode 100644
index 00000000000..72b21d9949e
--- /dev/null
+++ b/jdk/make/modules/tools/src/com/sun/classanalyzer/AnnotatedDependency.java
@@ -0,0 +1,627 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+package com.sun.classanalyzer;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.Map;
+
+import com.sun.classanalyzer.Module.Reference;
+import java.util.LinkedList;
+import java.util.TreeMap;
+
+/**
+ *
+ * @author Mandy Chung
+ */
+public abstract class AnnotatedDependency implements Comparable {
+
+ final Klass from;
+ final List classes;
+ protected boolean optional;
+ String description;
+ Klass.Method method;
+ private List filters = null;
+
+ public AnnotatedDependency(Klass klass) {
+ this(klass, false);
+ }
+
+ public AnnotatedDependency(Klass klass, boolean optional) {
+ this.from = klass;
+ this.classes = new ArrayList();
+ this.optional = optional;
+ }
+
+ abstract String getTag();
+
+ abstract boolean isDynamic();
+
+ void setMethod(Klass.Method m) {
+ this.method = m;
+ }
+
+ void addElement(String element, List value) {
+ if (element.equals("value")) {
+ addValue(value);
+ } else if (element.equals("description")) {
+ description = value.get(0);
+ } else if (element.equals("optional")) {
+ optional = value.get(0).equals("1") || Boolean.parseBoolean(value.get(0));
+ }
+ }
+
+ void addValue(List value) {
+ for (String s : value) {
+ if ((s = s.trim()).length() > 0) {
+ classes.add(s);
+ }
+ }
+ }
+
+ List getValue() {
+ return classes;
+ }
+
+ boolean isOptional() {
+ return optional;
+ }
+
+ boolean isEmpty() {
+ return classes.isEmpty();
+ }
+
+ boolean matches(String classname) {
+ synchronized (this) {
+ // initialize filters
+ if (filters == null) {
+ filters = new ArrayList();
+ for (String pattern : classes) {
+ filters.add(new Filter(pattern));
+ }
+
+ }
+ }
+
+ for (Filter f : filters) {
+ if (f.matches(classname)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ for (String v : getValue()) {
+ if (sb.length() == 0) {
+ sb.append(getTag());
+ sb.append("\n");
+ } else {
+ sb.append("\n");
+ }
+ sb.append(" ");
+ sb.append(from.getClassName()).append(" -> ");
+ sb.append(v);
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int compareTo(AnnotatedDependency o) {
+ if (from == o.from) {
+ if (this.getClass().getName().equals(o.getClass().getName())) {
+ String s1 = classes.isEmpty() ? "" : classes.get(0);
+ String s2 = o.classes.isEmpty() ? "" : o.classes.get(0);
+ return s1.compareTo(s2);
+ } else {
+ return this.getClass().getName().compareTo(o.getClass().getName());
+ }
+
+ } else {
+ return from.compareTo(o.from);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ int hashcode = 7 + 73 * from.hashCode();
+ for (String s : classes) {
+ hashcode ^= s.hashCode();
+ }
+ return hashcode;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof AnnotatedDependency)) {
+ return false;
+ }
+ AnnotatedDependency other = (AnnotatedDependency) obj;
+ boolean ret = this.from.equals(other.from) && this.classes.size() == other.classes.size();
+ if (ret == true) {
+ for (int i = 0; i < this.classes.size(); i++) {
+ ret = ret && this.classes.get(i).equals(other.classes.get(i));
+ }
+ }
+ return ret;
+ }
+
+ static class ClassForName extends AnnotatedDependency {
+
+ public ClassForName(Klass klass, boolean optional) {
+ super(klass, optional);
+ }
+
+ @Override
+ String getTag() {
+ if (this.optional) {
+ return TAG + "(optional)";
+ } else {
+ return TAG;
+ }
+ }
+
+ @Override
+ boolean isDynamic() {
+ return true;
+ }
+ static final String TYPE = "sun.annotation.ClassForName";
+ static final String TAG = "@ClassForName";
+ }
+
+ static class NativeFindClass extends AnnotatedDependency {
+
+ public NativeFindClass(Klass klass, boolean optional) {
+ super(klass, optional);
+ }
+
+ @Override
+ String getTag() {
+ if (this.optional) {
+ return TAG + "(optional)";
+ } else {
+ return TAG;
+ }
+ }
+
+ @Override
+ boolean isDynamic() {
+ return true;
+ }
+ static final String TYPE = "sun.annotation.NativeFindClass";
+ static final String TAG = "@NativeFindClass";
+ }
+
+ static class Provider extends AnnotatedDependency {
+
+ private List services = new ArrayList();
+
+ Provider(Klass klass) {
+ super(klass, true);
+ }
+
+ @Override
+ boolean isDynamic() {
+ return true;
+ }
+
+ public List services() {
+ return services;
+ }
+
+ @Override
+ void addElement(String element, List value) {
+ if (element.equals("service")) {
+ List configFiles = new ArrayList();
+ for (String s : value) {
+ if ((s = s.trim()).length() > 0) {
+ configFiles.add(metaInfPath + s);
+ }
+ }
+ addValue(configFiles);
+ }
+ }
+
+ @Override
+ void addValue(List value) {
+ for (String s : value) {
+ if ((s = s.trim()).length() > 0) {
+ if (s.startsWith("META-INF")) {
+ services.add(s);
+ readServiceConfiguration(s, classes);
+ } else {
+ throw new RuntimeException("invalid value" + s);
+ }
+ }
+ }
+ }
+
+ boolean isEmpty() {
+ return services.isEmpty();
+ }
+ static final String metaInfPath =
+ "META-INF" + File.separator + "services" + File.separator;
+
+ static void readServiceConfiguration(String config, List names) {
+ BufferedReader br = null;
+ try {
+ InputStream is = ClassPath.open(config);
+ if (is != null) {
+ // Properties doesn't perserve the order of the input file
+ br = new BufferedReader(new InputStreamReader(is, "utf-8"));
+ int lc = 1;
+ while ((lc = parseLine(br, lc, names)) >= 0);
+ }
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ }
+
+ // Parse a single line from the given configuration file, adding the name
+ // on the line to the names list.
+ //
+ private static int parseLine(BufferedReader r, int lc, List names) throws IOException {
+ String ln = r.readLine();
+ if (ln == null) {
+ return -1;
+ }
+ int ci = ln.indexOf('#');
+ if (ci >= 0) {
+ ln = ln.substring(0, ci);
+ }
+ ln = ln.trim();
+ int n = ln.length();
+ if (n != 0) {
+ if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0)) {
+ throw new RuntimeException("Illegal configuration-file syntax");
+ }
+ int cp = ln.codePointAt(0);
+ if (!Character.isJavaIdentifierStart(cp)) {
+ throw new RuntimeException("Illegal provider-class name: " + ln);
+ }
+ for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) {
+ cp = ln.codePointAt(i);
+ if (!Character.isJavaIdentifierPart(cp) && (cp != '.')) {
+ throw new RuntimeException("Illegal provider-class name: " + ln);
+ }
+ }
+ if (!names.contains(ln)) {
+ names.add(ln);
+ }
+ }
+ return lc + 1;
+ }
+
+ @Override
+ String getTag() {
+ return TAG;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof AnnotatedDependency)) {
+ return false;
+ }
+ Provider other = (Provider) obj;
+ boolean ret = this.from.equals(other.from) &&
+ this.services.size() == other.services.size();
+ if (ret == true) {
+ for (int i = 0; i < this.services.size(); i++) {
+ ret = ret && this.services.get(i).equals(other.services.get(i));
+ }
+ }
+ return ret;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashcode = 7 + 73 * from.hashCode();
+ for (String s : services) {
+ hashcode ^= s.hashCode();
+ }
+ return hashcode;
+ }
+
+ @Override
+ public List getValue() {
+ List result = new ArrayList();
+ result.addAll(services);
+ return result;
+ }
+ static final String TYPE = "sun.annotation.Provider";
+ static final String TAG = "@Provider";
+ }
+
+ static class OptionalDependency extends AnnotatedDependency {
+
+ static boolean isOptional(Klass from, Klass to) {
+ synchronized (OptionalDependency.class) {
+ if (optionalDepsMap == null) {
+ // Build a map of classes to its optional dependencies
+ initDependencies();
+ }
+ }
+ for (Reference ref : optionalDepsMap.keySet()) {
+ if (ref.referrer() == from && ref.referree() == to) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ OptionalDependency(Klass klass) {
+ super(klass, true);
+ }
+
+ @Override
+ boolean isDynamic() {
+ return false;
+ }
+
+ @Override
+ String getTag() {
+ return TAG;
+ }
+ static final String TYPE = "sun.annotation.Optional";
+ static final String TAG = "@Optional";
+ }
+
+ static class CompilerInline extends AnnotatedDependency {
+
+ public CompilerInline(Klass klass) {
+ super(klass);
+ }
+
+ @Override
+ String getTag() {
+ return TAG;
+ }
+
+ @Override
+ boolean isDynamic() {
+ return false;
+ }
+ static final String TYPE = "sun.annotation.Inline";
+ static final String TAG = "@Inline";
+ }
+
+ static class Filter {
+
+ final String pattern;
+ final String regex;
+
+ Filter(String pattern) {
+ this.pattern = pattern;
+
+ boolean isRegex = false;
+ for (int i = 0; i < pattern.length(); i++) {
+ char p = pattern.charAt(i);
+ if (p == '*' || p == '[' || p == ']') {
+ isRegex = true;
+ break;
+ }
+ }
+
+ if (isRegex) {
+ this.regex = convertToRegex(pattern);
+ } else {
+ this.regex = null;
+ }
+ }
+
+ private String convertToRegex(String pattern) {
+ StringBuilder sb = new StringBuilder();
+ int i = 0;
+ int index = 0;
+ int plen = pattern.length();
+ while (i < plen) {
+ char p = pattern.charAt(i);
+ if (p == '*') {
+ sb.append("(").append(pattern.substring(index, i)).append(")");
+ if (i + 1 < plen && pattern.charAt(i + 1) == '*') {
+ sb.append(".*");
+ index = i + 2;
+ } else {
+ sb.append("[^\\.]*");
+ index = i + 1;
+ }
+ } else if (p == '[') {
+ int j = i + 1;
+ while (j < plen) {
+ if (pattern.charAt(j) == ']') {
+ break;
+ }
+ j++;
+ }
+ if (j >= plen || pattern.charAt(j) != ']') {
+ throw new RuntimeException("Malformed pattern " + pattern);
+ }
+ sb.append("(").append(pattern.substring(index, i)).append(")");
+ sb.append(pattern.substring(i, j + 1));
+ index = j + 1;
+ i = j;
+ }
+ i++;
+ }
+ if (index < plen) {
+ sb.append("(").append(pattern.substring(index, plen)).append(")");
+ }
+ return sb.toString();
+ }
+
+ boolean matches(String name) {
+ if (regex == null) {
+ // the pattern is not a regex
+ return name.equals(pattern);
+ } else {
+ return name.matches(regex);
+ }
+ }
+ }
+
+ static boolean isValidType(String type) {
+ if (type.endsWith("(optional)")) {
+ int len = type.length() - "(optional)".length();
+ type = type.substring(0, len);
+ }
+ return type.equals(ClassForName.TYPE) || type.equals(ClassForName.TAG) ||
+ type.equals(NativeFindClass.TYPE) || type.equals(NativeFindClass.TAG) ||
+ type.equals(Provider.TYPE) || type.equals(Provider.TAG) ||
+ type.equals(CompilerInline.TYPE) || type.equals(CompilerInline.TAG) ||
+ type.equals(OptionalDependency.TYPE) || type.equals(OptionalDependency.TAG);
+ }
+
+ static AnnotatedDependency newAnnotatedDependency(String tag, String value, Klass klass) {
+ AnnotatedDependency dep = newAnnotatedDependency(tag, klass);
+ if (dep != null) {
+ dep.addValue(Collections.singletonList(value));
+ }
+ return dep;
+ }
+ static List annotatedDependencies = new LinkedList();
+ static List optionalDependencies = new LinkedList();
+
+ static AnnotatedDependency newAnnotatedDependency(String type, Klass klass) {
+ boolean optional = false;
+ if (type.endsWith("(optional)")) {
+ optional = true;
+ int len = type.length() - "(optional)".length();
+ type = type.substring(0, len);
+ }
+
+ if (type.equals(OptionalDependency.TYPE) || type.equals(OptionalDependency.TAG)) {
+ return newOptionalDependency(klass);
+ }
+
+ AnnotatedDependency dep;
+ if (type.equals(ClassForName.TYPE) || type.equals(ClassForName.TAG)) {
+ dep = new ClassForName(klass, optional);
+ } else if (type.equals(NativeFindClass.TYPE) || type.equals(NativeFindClass.TAG)) {
+ dep = new NativeFindClass(klass, optional);
+ } else if (type.equals(Provider.TYPE) || type.equals(Provider.TAG)) {
+ dep = new Provider(klass);
+ } else if (type.equals(CompilerInline.TYPE) || type.equals(CompilerInline.TAG)) {
+ dep = new CompilerInline(klass);
+ } else {
+ return null;
+ }
+ klass.addAnnotatedDep(dep);
+ annotatedDependencies.add(dep);
+ return dep;
+ }
+
+ static OptionalDependency newOptionalDependency(Klass klass) {
+ OptionalDependency dep = new OptionalDependency(klass);
+ optionalDependencies.add(dep);
+ return dep;
+ }
+ static Map> annotatedDepsMap = null;
+ static Map> optionalDepsMap = null;
+
+ static Map> getReferences(Module m) {
+ // ensure it's initialized
+ initDependencies();
+
+ Map> result = new TreeMap>();
+ for (Reference ref : annotatedDepsMap.keySet()) {
+ if (m.contains(ref.referrer()) && m.isModuleDependence(ref.referree())) {
+ result.put(ref, annotatedDepsMap.get(ref));
+ }
+ }
+ return result;
+ }
+
+ static Set getDependencies(Module m) {
+ // ensure it's initialized
+ initDependencies();
+
+ Set deps = new TreeSet();
+ for (Reference ref : annotatedDepsMap.keySet()) {
+ if (m.contains(ref.referrer())) {
+ Module other = m.getModuleDependence(ref.referree());
+ if (other != null) {
+ for (AnnotatedDependency ad : annotatedDepsMap.get(ref)) {
+ Module.Dependency d = new Module.Dependency(other, ad.isOptional(), ad.isDynamic());
+ deps.add(d);
+ }
+ }
+ }
+ }
+ return deps;
+ }
+
+ synchronized static void initDependencies() {
+ if (annotatedDepsMap != null) {
+ return;
+ }
+
+ // Build a map of references to its dependencies
+ annotatedDepsMap = new TreeMap>();
+ optionalDepsMap = new TreeMap>();
+
+ for (Klass k : Klass.getAllClasses()) {
+ for (AnnotatedDependency ad : annotatedDependencies) {
+ if (ad.matches(k.getClassName())) {
+ Reference ref = new Reference(ad.from, k);
+ Set set = annotatedDepsMap.get(ref);
+ if (set == null) {
+ set = new TreeSet();
+ annotatedDepsMap.put(ref, set);
+ }
+ set.add(ad);
+ }
+ }
+
+ for (AnnotatedDependency ad : optionalDependencies) {
+ if (ad.matches(k.getClassName())) {
+ Reference ref = new Reference(ad.from, k);
+ Set set = optionalDepsMap.get(ref);
+ if (set == null) {
+ set = new TreeSet();
+ optionalDepsMap.put(ref, set);
+ }
+ set.add(ad);
+ }
+ }
+ }
+ }
+}
diff --git a/jdk/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java b/jdk/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java
new file mode 100644
index 00000000000..7d984aa2e74
--- /dev/null
+++ b/jdk/make/modules/tools/src/com/sun/classanalyzer/AnnotationParser.java
@@ -0,0 +1,293 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package com.sun.classanalyzer;
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.classfile.Annotation;
+import com.sun.tools.classfile.ExtendedAnnotation;
+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.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.sun.classanalyzer.AnnotatedDependency.*;
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * @author Mandy Chung
+ */
+public class AnnotationParser {
+
+ static boolean parseAnnotation = false;
+ static void setParseAnnotation(boolean newValue) {
+ parseAnnotation = newValue;
+ }
+
+ private final ClassFileParser cfparser;
+ public AnnotationParser(ClassFileParser cfparser) {
+ this.cfparser = cfparser;
+ }
+
+ private AnnotatedDependency addAnnotation(Annotation annot, Klass.Method method) {
+ String type = getType(annot.type_index);
+ AnnotatedDependency dep = AnnotatedDependency.newAnnotatedDependency(type, cfparser.this_klass);
+ if (dep != null) {
+ for (int i = 0; i < annot.num_element_value_pairs; i++) {
+ Element element = getElement(annot.element_value_pairs[i]);
+ dep.addElement(element.name, element.value);
+ }
+ dep.setMethod(method);
+ }
+ return dep;
+ }
+
+ private AnnotatedDependency addAnnotation(ExtendedAnnotation annot, Klass.Method method) {
+ return addAnnotation(annot.annotation, method);
+ }
+
+ class Element {
+
+ String name;
+ List value;
+
+ Element(String name) {
+ this.name = name;
+ this.value = new ArrayList();
+ }
+
+ void add(String v) {
+ value.add(v);
+ }
+ }
+
+ Element getElement(Annotation.element_value_pair pair) {
+ Element element = new Element(getName(pair.element_name_index));
+ evp.parse(pair.value, element);
+ return element;
+ }
+
+ private String getType(int index) {
+ try {
+ Descriptor d = new Descriptor(index);
+ return d.getFieldType(cfparser.classfile.constant_pool);
+ } catch (ConstantPoolException ignore) {
+ } catch (InvalidDescriptor ignore) {
+ }
+ return "Unknown";
+ }
+
+ private String getName(int index) {
+ return cfparser.constantPoolParser.stringValue(index);
+ }
+ element_value_Parser evp = new element_value_Parser();
+
+ class element_value_Parser implements Annotation.element_value.Visitor {
+
+ public Void parse(Annotation.element_value value, Element element) {
+ value.accept(this, element);
+ return null;
+ }
+
+ public Void visitPrimitive(Primitive_element_value ev, Element element) {
+ String value = getName(ev.const_value_index);
+ element.add(value);
+ return null;
+ }
+
+ public Void visitEnum(Enum_element_value ev, Element element) {
+ String value = getName(ev.type_name_index) + "." + getName(ev.const_name_index);
+ element.add(value);
+ return null;
+ }
+
+ public Void visitClass(Class_element_value ev, Element element) {
+ String value = getName(ev.class_info_index) + ".class";
+ element.add(value);
+ return null;
+ }
+
+ public Void visitAnnotation(Annotation_element_value ev, Element element) {
+ // AnnotationParser.this.addAnnotation(ev.annotation_value);
+ throw new UnsupportedOperationException("Not supported: " + ev);
+ }
+
+ public Void visitArray(Array_element_value ev, Element element) {
+ for (int i = 0; i < ev.num_values; i++) {
+ parse(ev.values[i], element);
+ }
+ return null;
+ }
+ }
+
+ void parseAttributes(Attributes attributes, Klass.Method method) {
+ if (!parseAnnotation) {
+ return;
+ }
+
+ visitRuntimeAnnotations((RuntimeVisibleAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleAnnotations), method);
+ visitRuntimeAnnotations((RuntimeInvisibleAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleAnnotations), method);
+ visitRuntimeTypeAnnotations((RuntimeVisibleTypeAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleTypeAnnotations), method);
+ visitRuntimeTypeAnnotations((RuntimeInvisibleTypeAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleTypeAnnotations), method);
+ visitRuntimeParameterAnnotations((RuntimeVisibleParameterAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleParameterAnnotations), method);
+ visitRuntimeParameterAnnotations((RuntimeInvisibleParameterAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleParameterAnnotations), method);
+ }
+
+ public void visitRuntimeAnnotations(RuntimeAnnotations_attribute attr, Klass.Method method) {
+ if (attr == null) {
+ return;
+ }
+
+ for (int i = 0; i < attr.annotations.length; i++) {
+ addAnnotation(attr.annotations[i], method);
+ }
+ }
+
+ public void visitRuntimeTypeAnnotations(RuntimeTypeAnnotations_attribute attr, Klass.Method method) {
+ if (attr == null) {
+ return;
+ }
+
+ for (int i = 0; i < attr.annotations.length; i++) {
+ addAnnotation(attr.annotations[i], method);
+ }
+ }
+
+ public void visitRuntimeParameterAnnotations(RuntimeParameterAnnotations_attribute attr, Klass.Method method) {
+ 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++) {
+ addAnnotation(attr.parameter_annotations[param][i], method);
+ }
+ }
+ }
+
+ void parseAttributes(Attributes attributes) {
+ parseAttributes(attributes, null);
+ }
+
+ public static void main(String[] args) throws Exception {
+ String jdkhome = null;
+ String output = ".";
+
+ // process arguments
+ int i = 0;
+ while (i < args.length) {
+ String arg = args[i++];
+ if (arg.equals("-jdkhome")) {
+ if (i < args.length) {
+ jdkhome = args[i++];
+ } else {
+ usage();
+ }
+ } else if (arg.equals("-output")) {
+ output = args[i++];
+ } else {
+ usage();
+ }
+ }
+ if (jdkhome == null) {
+ usage();
+ }
+
+ // parse annotation and code attribute to find all references
+ // to Class.forName etc
+ CodeAttributeParser.setParseCodeAttribute(true);
+ AnnotationParser.setParseAnnotation(true);
+
+ ClassPath.setJDKHome(jdkhome);
+ ClassPath.parseAllClassFiles();
+
+ PrintWriter writer = new PrintWriter(new File(output, "jdk7.depconfig"));
+
+ try {
+ for (Klass k : Klass.getAllClasses()) {
+ for (AnnotatedDependency dep : k.getAnnotatedDeps()) {
+ if (dep.isEmpty()) {
+ continue;
+ }
+ writer.format("# %s \n", dep.method == null ? dep.from : dep.method);
+ writer.format("%s\n\n", dep);
+ }
+ }
+ } finally {
+ writer.close();
+ }
+
+ writer = new PrintWriter(new File(output, "optional.depconfig"));
+ try {
+ AnnotatedDependency prev = null;
+ for (AnnotatedDependency dep : AnnotatedDependency.optionalDependencies) {
+ if (prev != null && !dep.equals(prev)) {
+ writer.format("%s\n\n", prev);
+ }
+ writer.format("# %s \n", dep.method == null ? dep.from : dep.method);
+ prev = dep;
+ }
+ if (prev != null) {
+ writer.format("%s\n\n", prev);
+ }
+ } finally {
+ writer.close();
+ }
+
+ writer = new PrintWriter(new File(output, "runtime.references"));
+ try {
+ for (Map.Entry> entry : CodeAttributeParser.runtimeReferences.entrySet()) {
+ writer.format("References to %s\n", entry.getKey());
+ Klass prev = null;
+ for (Klass.Method m : entry.getValue()) {
+ if (prev == null || prev != m.getKlass()) {
+ writer.format(" %-50s # %s\n", m.getKlass(), m);
+ } else if (prev == m.getKlass()) {
+ writer.format(" %-50s # %s\n", "", m);
+ }
+ prev = m.getKlass();
+ }
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ private static void usage() {
+ System.out.println("Usage: AnnotationParser ");
+ System.out.println("Options: ");
+ System.out.println("\t-jdkhome where all jars will be parsed");
+ System.out.println("\t-depconfig