Mercurial > hg > openjdk > aarch64-port > jdk
changeset 10920:009d3bbe66bd
Merge
author | mfang |
---|---|
date | Thu, 25 Jun 2015 16:49:08 -0700 |
parents | 3f44d82b41fb (current diff) 0dac92241a13 (diff) |
children | a49d60c55b74 |
files | |
diffstat | 74 files changed, 1592 insertions(+), 702 deletions(-) [+] |
line wrap: on
line diff
--- a/make/lib/CoreLibraries.gmk Thu Jun 25 16:46:26 2015 -0700 +++ b/make/lib/CoreLibraries.gmk Thu Jun 25 16:49:08 2015 -0700 @@ -207,7 +207,7 @@ LDFLAGS_SUFFIX_windows := -export:winFileHandleOpen -export:handleLseek \ jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \ shell32.lib delayimp.lib -DELAYLOAD:shell32.dll \ - advapi32.lib, \ + advapi32.lib version.lib, \ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ RC_FLAGS := $(RC_FLAGS) \ -D "JDK_FNAME=java.dll" \
--- a/src/share/classes/com/sun/jndi/ldap/LdapURL.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/com/sun/jndi/ldap/LdapURL.java Thu Jun 25 16:49:08 2015 -0700 @@ -26,9 +26,6 @@ package com.sun.jndi.ldap; import javax.naming.*; -import javax.naming.directory.*; -import javax.naming.spi.*; -import java.net.URL; import java.net.MalformedURLException; import java.io.UnsupportedEncodingException; import java.util.StringTokenizer; @@ -211,43 +208,52 @@ // query begins with a '?' or is null - if (query == null) { + if (query == null || query.length() < 2) { + return; + } + + int currentIndex = 1; + int nextQmark; + int endIndex; + + // attributes: + nextQmark = query.indexOf('?', currentIndex); + endIndex = nextQmark == -1 ? query.length() : nextQmark; + if (endIndex - currentIndex > 0) { + attributes = query.substring(currentIndex, endIndex); + } + currentIndex = endIndex + 1; + if (currentIndex >= query.length()) { return; } - int qmark2 = query.indexOf('?', 1); - - if (qmark2 < 0) { - attributes = query.substring(1); + // scope: + nextQmark = query.indexOf('?', currentIndex); + endIndex = nextQmark == -1 ? query.length() : nextQmark; + if (endIndex - currentIndex > 0) { + scope = query.substring(currentIndex, endIndex); + } + currentIndex = endIndex + 1; + if (currentIndex >= query.length()) { return; - } else if (qmark2 != 1) { - attributes = query.substring(1, qmark2); } - int qmark3 = query.indexOf('?', qmark2 + 1); - - if (qmark3 < 0) { - scope = query.substring(qmark2 + 1); + // filter: + nextQmark = query.indexOf('?', currentIndex); + endIndex = nextQmark == -1 ? query.length() : nextQmark; + if (endIndex - currentIndex > 0) { + filter = query.substring(currentIndex, endIndex); + filter = UrlUtil.decode(filter, "UTF8"); + } + currentIndex = endIndex + 1; + if (currentIndex >= query.length()) { return; - } else if (qmark3 != qmark2 + 1) { - scope = query.substring(qmark2 + 1, qmark3); } - int qmark4 = query.indexOf('?', qmark3 + 1); - - if (qmark4 < 0) { - filter = query.substring(qmark3 + 1); - } else { - if (qmark4 != qmark3 + 1) { - filter = query.substring(qmark3 + 1, qmark4); - } - extensions = query.substring(qmark4 + 1); - if (extensions.length() > 0) { - extensions = UrlUtil.decode(extensions, "UTF8"); - } - } - if (filter != null && filter.length() > 0) { - filter = UrlUtil.decode(filter, "UTF8"); + // extensions: + if (query.length() - currentIndex > 0) { + extensions = query.substring(currentIndex); + extensions = UrlUtil.decode(extensions, "UTF8"); } }
--- a/src/share/classes/java/time/DayOfWeek.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/DayOfWeek.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -201,7 +201,7 @@ * Gets the day-of-week {@code int} value. * <p> * The values are numbered following the ISO-8601 standard, from 1 (Monday) to 7 (Sunday). - * See {@link WeekFields#dayOfWeek} for localized week-numbering. + * See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week-numbering. * * @return the day-of-week, from 1 (Monday) to 7 (Sunday) */ @@ -288,7 +288,7 @@ /** * Gets the value of the specified field from this day-of-week as an {@code int}. * <p> - * This queries this day-of-week for the value for the specified field. + * This queries this day-of-week for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -321,7 +321,7 @@ /** * Gets the value of the specified field from this day-of-week as a {@code long}. * <p> - * This queries this day-of-week for the value for the specified field. + * This queries this day-of-week for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> @@ -419,7 +419,7 @@ * The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} * passing {@link ChronoField#DAY_OF_WEEK} as the field. * Note that this adjusts forwards or backwards within a Monday to Sunday week. - * See {@link WeekFields#dayOfWeek} for localized week start days. + * See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week start days. * See {@code TemporalAdjuster} for other adjusters with more control, * such as {@code next(MONDAY)}. * <p>
--- a/src/share/classes/java/time/Duration.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/Duration.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -546,7 +546,7 @@ * They are returned in the order seconds, nanos. * <p> * This set can be used in conjunction with {@link #get(TemporalUnit)} - * to access the entire state of the period. + * to access the entire state of the duration. * * @return a list containing the seconds and nanos units, not null */ @@ -686,8 +686,8 @@ * <p> * This instance is immutable and unaffected by this method call. * - * @param amountToAdd the amount of the period, measured in terms of the unit, positive or negative - * @param unit the unit that the period is measured in, must have an exact duration, not null + * @param amountToAdd the amount to add, measured in terms of the unit, positive or negative + * @param unit the unit that the amount is measured in, must have an exact duration, not null * @return a {@code Duration} based on this duration with the specified duration added, not null * @throws UnsupportedTemporalTypeException if the unit is not supported * @throws ArithmeticException if numeric overflow occurs @@ -848,8 +848,8 @@ * <p> * This instance is immutable and unaffected by this method call. * - * @param amountToSubtract the amount of the period, measured in terms of the unit, positive or negative - * @param unit the unit that the period is measured in, must have an exact duration, not null + * @param amountToSubtract the amount to subtract, measured in terms of the unit, positive or negative + * @param unit the unit that the amount is measured in, must have an exact duration, not null * @return a {@code Duration} based on this duration with the specified duration subtracted, not null * @throws ArithmeticException if numeric overflow occurs */
--- a/src/share/classes/java/time/Instant.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/Instant.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -530,7 +530,7 @@ /** * Gets the value of the specified field from this instant as an {@code int}. * <p> - * This queries this instant for the value for the specified field. + * This queries this instant for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -571,7 +571,7 @@ /** * Gets the value of the specified field from this instant as a {@code long}. * <p> - * This queries this instant for the value for the specified field. + * This queries this instant for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p>
--- a/src/share/classes/java/time/LocalDate.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/LocalDate.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -280,7 +280,7 @@ * @param dayOfYear the day-of-year to represent, from 1 to 366 * @return the local date, not null * @throws DateTimeException if the value of any field is out of range, - * or if the day-of-year is invalid for the month-year + * or if the day-of-year is invalid for the year */ public static LocalDate ofYearDay(int year, int dayOfYear) { YEAR.checkValidValue(year); @@ -308,7 +308,7 @@ * * @param epochDay the Epoch Day to convert, based on the epoch 1970-01-01 * @return the local date, not null - * @throws DateTimeException if the epoch days exceeds the supported date range + * @throws DateTimeException if the epoch day exceeds the supported date range */ public static LocalDate ofEpochDay(long epochDay) { long zeroDay = epochDay + DAYS_0000_TO_1970; @@ -515,7 +515,7 @@ /** * Checks if the specified unit is supported. * <p> - * This checks if the specified unit can be added to, or subtracted from, this date-time. + * This checks if the specified unit can be added to, or subtracted from, this date. * If false, then calling the {@link #plus(long, TemporalUnit)} and * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. * <p> @@ -592,7 +592,7 @@ /** * Gets the value of the specified field from this date as an {@code int}. * <p> - * This queries this date for the value for the specified field. + * This queries this date for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -627,7 +627,7 @@ /** * Gets the value of the specified field from this date as a {@code long}. * <p> - * This queries this date for the value for the specified field. + * This queries this date for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> @@ -875,7 +875,9 @@ * <p> * A simple adjuster might simply set the one of the fields, such as the year field. * A more complex adjuster might set the date to the last day of the month. - * A selection of common adjustments is provided in {@link TemporalAdjuster}. + * <p> + * A selection of common adjustments is provided in + * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}. * These include finding the "last day of the month" and "next Wednesday". * Key date-time classes also implement the {@code TemporalAdjuster} interface, * such as {@link Month} and {@link java.time.MonthDay MonthDay}. @@ -885,7 +887,7 @@ * For example this code returns a date on the last day of July: * <pre> * import static java.time.Month.*; - * import static java.time.temporal.Adjusters.*; + * import static java.time.temporal.TemporalAdjusters.*; * * result = localDate.with(JULY).with(lastDayOfMonth()); * </pre> @@ -1041,7 +1043,8 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this date with the year altered. + * Returns a copy of this {@code LocalDate} with the year altered. + * <p> * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. * <p> * This instance is immutable and unaffected by this method call. @@ -1059,7 +1062,8 @@ } /** - * Returns a copy of this date with the month-of-year altered. + * Returns a copy of this {@code LocalDate} with the month-of-year altered. + * <p> * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. * <p> * This instance is immutable and unaffected by this method call. @@ -1077,7 +1081,8 @@ } /** - * Returns a copy of this date with the day-of-month altered. + * Returns a copy of this {@code LocalDate} with the day-of-month altered. + * <p> * If the resulting date is invalid, an exception is thrown. * <p> * This instance is immutable and unaffected by this method call. @@ -1095,7 +1100,8 @@ } /** - * Returns a copy of this date with the day-of-year altered. + * Returns a copy of this {@code LocalDate} with the day-of-year altered. + * <p> * If the resulting date is invalid, an exception is thrown. * <p> * This instance is immutable and unaffected by this method call. @@ -1245,7 +1251,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code LocalDate} with the specified period in years added. + * Returns a copy of this {@code LocalDate} with the specified number of years added. * <p> * This method adds the specified amount to the years field in three steps: * <ol> @@ -1273,7 +1279,7 @@ } /** - * Returns a copy of this {@code LocalDate} with the specified period in months added. + * Returns a copy of this {@code LocalDate} with the specified number of months added. * <p> * This method adds the specified amount to the months field in three steps: * <ol> @@ -1304,7 +1310,7 @@ } /** - * Returns a copy of this {@code LocalDate} with the specified period in weeks added. + * Returns a copy of this {@code LocalDate} with the specified number of weeks added. * <p> * This method adds the specified amount in weeks to the days field incrementing * the month and year fields as necessary to ensure the result remains valid. @@ -1402,11 +1408,11 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code LocalDate} with the specified period in years subtracted. + * Returns a copy of this {@code LocalDate} with the specified number of years subtracted. * <p> * This method subtracts the specified amount from the years field in three steps: * <ol> - * <li>Subtract the input years to the year field</li> + * <li>Subtract the input years from the year field</li> * <li>Check if the resulting date would be invalid</li> * <li>Adjust the day-of-month to the last valid day if necessary</li> * </ol> @@ -1426,11 +1432,11 @@ } /** - * Returns a copy of this {@code LocalDate} with the specified period in months subtracted. + * Returns a copy of this {@code LocalDate} with the specified number of months subtracted. * <p> * This method subtracts the specified amount from the months field in three steps: * <ol> - * <li>Subtract the input months to the month-of-year field</li> + * <li>Subtract the input months from the month-of-year field</li> * <li>Check if the resulting date would be invalid</li> * <li>Adjust the day-of-month to the last valid day if necessary</li> * </ol> @@ -1450,7 +1456,7 @@ } /** - * Returns a copy of this {@code LocalDate} with the specified period in weeks subtracted. + * Returns a copy of this {@code LocalDate} with the specified number of weeks subtracted. * <p> * This method subtracts the specified amount in weeks from the days field decrementing * the month and year fields as necessary to ensure the result remains valid.
--- a/src/share/classes/java/time/LocalDateTime.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/LocalDateTime.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -428,7 +428,7 @@ /** * Obtains an instance of {@code LocalDateTime} from a temporal object. * <p> - * This obtains an offset time based on the specified temporal. + * This obtains a local date-time based on the specified temporal. * A {@code TemporalAccessor} represents an arbitrary set of date and time information, * which this factory converts to an instance of {@code LocalDateTime}. * <p> @@ -656,7 +656,7 @@ /** * Gets the value of the specified field from this date-time as an {@code int}. * <p> - * This queries this date-time for the value for the specified field. + * This queries this date-time for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -693,7 +693,7 @@ /** * Gets the value of the specified field from this date-time as a {@code long}. * <p> - * This queries this date-time for the value for the specified field. + * This queries this date-time for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> @@ -878,7 +878,9 @@ * <p> * A simple adjuster might simply set the one of the fields, such as the year field. * A more complex adjuster might set the date to the last day of the month. - * A selection of common adjustments is provided in {@link TemporalAdjuster}. + * <p> + * A selection of common adjustments is provided in + * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}. * These include finding the "last day of the month" and "next Wednesday". * Key date-time classes also implement the {@code TemporalAdjuster} interface, * such as {@link Month} and {@link java.time.MonthDay MonthDay}. @@ -888,7 +890,7 @@ * For example this code returns a date on the last day of July: * <pre> * import static java.time.Month.*; - * import static java.time.temporal.Adjusters.*; + * import static java.time.temporal.TemporalAdjusters.*; * * result = localDateTime.with(JULY).with(lastDayOfMonth()); * </pre> @@ -974,6 +976,7 @@ //----------------------------------------------------------------------- /** * Returns a copy of this {@code LocalDateTime} with the year altered. + * <p> * The time does not affect the calculation and will be the same in the result. * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. * <p> @@ -989,6 +992,7 @@ /** * Returns a copy of this {@code LocalDateTime} with the month-of-year altered. + * <p> * The time does not affect the calculation and will be the same in the result. * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. * <p> @@ -1004,7 +1008,8 @@ /** * Returns a copy of this {@code LocalDateTime} with the day-of-month altered. - * If the resulting {@code LocalDateTime} is invalid, an exception is thrown. + * <p> + * If the resulting date-time is invalid, an exception is thrown. * The time does not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. @@ -1020,7 +1025,8 @@ /** * Returns a copy of this {@code LocalDateTime} with the day-of-year altered. - * If the resulting {@code LocalDateTime} is invalid, an exception is thrown. + * <p> + * If the resulting date-time is invalid, an exception is thrown. * <p> * This instance is immutable and unaffected by this method call. * @@ -1035,7 +1041,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code LocalDateTime} with the hour-of-day value altered. + * Returns a copy of this {@code LocalDateTime} with the hour-of-day altered. * <p> * This instance is immutable and unaffected by this method call. * @@ -1049,7 +1055,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the minute-of-hour value altered. + * Returns a copy of this {@code LocalDateTime} with the minute-of-hour altered. * <p> * This instance is immutable and unaffected by this method call. * @@ -1063,7 +1069,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the second-of-minute value altered. + * Returns a copy of this {@code LocalDateTime} with the second-of-minute altered. * <p> * This instance is immutable and unaffected by this method call. * @@ -1077,7 +1083,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the nano-of-second value altered. + * Returns a copy of this {@code LocalDateTime} with the nano-of-second altered. * <p> * This instance is immutable and unaffected by this method call. * @@ -1109,7 +1115,7 @@ * @param unit the unit to truncate to, not null * @return a {@code LocalDateTime} based on this date-time with the time truncated, not null * @throws DateTimeException if unable to truncate - * @throws UnsupportedTemporalTypeException if the field is not supported + * @throws UnsupportedTemporalTypeException if the unit is not supported */ public LocalDateTime truncatedTo(TemporalUnit unit) { return with(date, time.truncatedTo(unit)); @@ -1192,7 +1198,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code LocalDateTime} with the specified period in years added. + * Returns a copy of this {@code LocalDateTime} with the specified number of years added. * <p> * This method adds the specified amount to the years field in three steps: * <ol> @@ -1217,7 +1223,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in months added. + * Returns a copy of this {@code LocalDateTime} with the specified number of months added. * <p> * This method adds the specified amount to the months field in three steps: * <ol> @@ -1242,7 +1248,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in weeks added. + * Returns a copy of this {@code LocalDateTime} with the specified number of weeks added. * <p> * This method adds the specified amount in weeks to the days field incrementing * the month and year fields as necessary to ensure the result remains valid. @@ -1262,7 +1268,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in days added. + * Returns a copy of this {@code LocalDateTime} with the specified number of days added. * <p> * This method adds the specified amount to the days field incrementing the * month and year fields as necessary to ensure the result remains valid. @@ -1283,7 +1289,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code LocalDateTime} with the specified period in hours added. + * Returns a copy of this {@code LocalDateTime} with the specified number of hours added. * <p> * This instance is immutable and unaffected by this method call. * @@ -1296,7 +1302,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in minutes added. + * Returns a copy of this {@code LocalDateTime} with the specified number of minutes added. * <p> * This instance is immutable and unaffected by this method call. * @@ -1309,7 +1315,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in seconds added. + * Returns a copy of this {@code LocalDateTime} with the specified number of seconds added. * <p> * This instance is immutable and unaffected by this method call. * @@ -1322,7 +1328,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in nanoseconds added. + * Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds added. * <p> * This instance is immutable and unaffected by this method call. * @@ -1391,7 +1397,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code LocalDateTime} with the specified period in years subtracted. + * Returns a copy of this {@code LocalDateTime} with the specified number of years subtracted. * <p> * This method subtracts the specified amount from the years field in three steps: * <ol> @@ -1415,7 +1421,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in months subtracted. + * Returns a copy of this {@code LocalDateTime} with the specified number of months subtracted. * <p> * This method subtracts the specified amount from the months field in three steps: * <ol> @@ -1439,7 +1445,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in weeks subtracted. + * Returns a copy of this {@code LocalDateTime} with the specified number of weeks subtracted. * <p> * This method subtracts the specified amount in weeks from the days field decrementing * the month and year fields as necessary to ensure the result remains valid. @@ -1458,9 +1464,9 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in days subtracted. + * Returns a copy of this {@code LocalDateTime} with the specified number of days subtracted. * <p> - * This method subtracts the specified amount from the days field incrementing the + * This method subtracts the specified amount from the days field decrementing the * month and year fields as necessary to ensure the result remains valid. * The result is only invalid if the maximum/minimum year is exceeded. * <p> @@ -1478,7 +1484,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code LocalDateTime} with the specified period in hours subtracted. + * Returns a copy of this {@code LocalDateTime} with the specified number of hours subtracted. * <p> * This instance is immutable and unaffected by this method call. * @@ -1491,7 +1497,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in minutes subtracted. + * Returns a copy of this {@code LocalDateTime} with the specified number of minutes subtracted. * <p> * This instance is immutable and unaffected by this method call. * @@ -1504,7 +1510,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in seconds subtracted. + * Returns a copy of this {@code LocalDateTime} with the specified number of seconds subtracted. * <p> * This instance is immutable and unaffected by this method call. * @@ -1517,7 +1523,7 @@ } /** - * Returns a copy of this {@code LocalDateTime} with the specified period in nanoseconds subtracted. + * Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds subtracted. * <p> * This instance is immutable and unaffected by this method call. * @@ -1575,7 +1581,7 @@ * what the result of this method will be. * <p> * The result of this method is obtained by invoking the - * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the + * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the * specified query passing {@code this} as the argument. * * @param <R> the type of the result
--- a/src/share/classes/java/time/LocalTime.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/LocalTime.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -93,7 +93,7 @@ import java.util.Objects; /** - * A time without time-zone in the ISO-8601 calendar system, + * A time without a time-zone in the ISO-8601 calendar system, * such as {@code 10:15:30}. * <p> * {@code LocalTime} is an immutable date-time object that represents a time, @@ -101,7 +101,7 @@ * Time is represented to nanosecond precision. * For example, the value "13:45.30.123456789" can be stored in a {@code LocalTime}. * <p> - * It does not store or represent a date or time-zone. + * This class does not store or represent a date or time-zone. * Instead, it is a description of the local time as seen on a wall clock. * It cannot represent an instant on the time-line without additional information * such as an offset or time-zone. @@ -280,7 +280,7 @@ return ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + now.getNano()); } - //------------------------get----------------------------------------------- + //----------------------------------------------------------------------- /** * Obtains an instance of {@code LocalTime} from an hour and minute. * <p> @@ -395,7 +395,7 @@ * on extracting the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} field. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code LocalTime::from}. + * allowing it to be used as a query via method reference, {@code LocalTime::from}. * * @param temporal the temporal object to convert, not null * @return the local time, not null @@ -418,7 +418,7 @@ * The string must represent a valid time and is parsed using * {@link java.time.format.DateTimeFormatter#ISO_LOCAL_TIME}. * - * @param text the text to parse such as "10:15:30", not null + * @param text the text to parse such as "10:15:30", not null * @return the parsed local time, not null * @throws DateTimeParseException if the text cannot be parsed */ @@ -524,7 +524,7 @@ /** * Checks if the specified unit is supported. * <p> - * This checks if the specified unit can be added to, or subtracted from, this date-time. + * This checks if the specified unit can be added to, or subtracted from, this time. * If false, then calling the {@link #plus(long, TemporalUnit)} and * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. * <p> @@ -589,7 +589,7 @@ /** * Gets the value of the specified field from this time as an {@code int}. * <p> - * This queries this time for the value for the specified field. + * This queries this time for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -624,7 +624,7 @@ /** * Gets the value of the specified field from this time as a {@code long}. * <p> - * This queries this time for the value for the specified field. + * This queries this time for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> @@ -858,7 +858,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code LocalTime} with the hour-of-day value altered. + * Returns a copy of this {@code LocalTime} with the hour-of-day altered. * <p> * This instance is immutable and unaffected by this method call. * @@ -875,7 +875,7 @@ } /** - * Returns a copy of this {@code LocalTime} with the minute-of-hour value altered. + * Returns a copy of this {@code LocalTime} with the minute-of-hour altered. * <p> * This instance is immutable and unaffected by this method call. * @@ -892,7 +892,7 @@ } /** - * Returns a copy of this {@code LocalTime} with the second-of-minute value altered. + * Returns a copy of this {@code LocalTime} with the second-of-minute altered. * <p> * This instance is immutable and unaffected by this method call. * @@ -909,7 +909,7 @@ } /** - * Returns a copy of this {@code LocalTime} with the nano-of-second value altered. + * Returns a copy of this {@code LocalTime} with the nano-of-second altered. * <p> * This instance is immutable and unaffected by this method call. * @@ -929,7 +929,7 @@ /** * Returns a copy of this {@code LocalTime} with the time truncated. * <p> - * Truncating the time returns a copy of the original time with fields + * Truncation returns a copy of the original time with fields * smaller than the specified unit set to zero. * For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit * will set the second-of-minute and nano-of-second field to zero. @@ -1059,7 +1059,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code LocalTime} with the specified period in hours added. + * Returns a copy of this {@code LocalTime} with the specified number of hours added. * <p> * This adds the specified number of hours to this time, returning a new time. * The calculation wraps around midnight. @@ -1078,7 +1078,7 @@ } /** - * Returns a copy of this {@code LocalTime} with the specified period in minutes added. + * Returns a copy of this {@code LocalTime} with the specified number of minutes added. * <p> * This adds the specified number of minutes to this time, returning a new time. * The calculation wraps around midnight. @@ -1103,7 +1103,7 @@ } /** - * Returns a copy of this {@code LocalTime} with the specified period in seconds added. + * Returns a copy of this {@code LocalTime} with the specified number of seconds added. * <p> * This adds the specified number of seconds to this time, returning a new time. * The calculation wraps around midnight. @@ -1130,7 +1130,7 @@ } /** - * Returns a copy of this {@code LocalTime} with the specified period in nanoseconds added. + * Returns a copy of this {@code LocalTime} with the specified number of nanoseconds added. * <p> * This adds the specified number of nanoseconds to this time, returning a new time. * The calculation wraps around midnight. @@ -1208,7 +1208,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code LocalTime} with the specified period in hours subtracted. + * Returns a copy of this {@code LocalTime} with the specified number of hours subtracted. * <p> * This subtracts the specified number of hours from this time, returning a new time. * The calculation wraps around midnight. @@ -1223,7 +1223,7 @@ } /** - * Returns a copy of this {@code LocalTime} with the specified period in minutes subtracted. + * Returns a copy of this {@code LocalTime} with the specified number of minutes subtracted. * <p> * This subtracts the specified number of minutes from this time, returning a new time. * The calculation wraps around midnight. @@ -1238,7 +1238,7 @@ } /** - * Returns a copy of this {@code LocalTime} with the specified period in seconds subtracted. + * Returns a copy of this {@code LocalTime} with the specified number of seconds subtracted. * <p> * This subtracts the specified number of seconds from this time, returning a new time. * The calculation wraps around midnight. @@ -1253,7 +1253,7 @@ } /** - * Returns a copy of this {@code LocalTime} with the specified period in nanoseconds subtracted. + * Returns a copy of this {@code LocalTime} with the specified number of nanoseconds subtracted. * <p> * This subtracts the specified number of nanoseconds from this time, returning a new time. * The calculation wraps around midnight. @@ -1470,7 +1470,7 @@ //----------------------------------------------------------------------- /** - * Compares this {@code LocalTime} to another time. + * Compares this time to another time. * <p> * The comparison is based on the time-line position of the local times within a day. * It is "consistent with equals", as defined by {@link Comparable}. @@ -1495,7 +1495,7 @@ } /** - * Checks if this {@code LocalTime} is after the specified time. + * Checks if this time is after the specified time. * <p> * The comparison is based on the time-line position of the time within a day. * @@ -1508,7 +1508,7 @@ } /** - * Checks if this {@code LocalTime} is before the specified time. + * Checks if this time is before the specified time. * <p> * The comparison is based on the time-line position of the time within a day. *
--- a/src/share/classes/java/time/Month.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/Month.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -202,7 +202,7 @@ * chronology, or can be converted to a {@code LocalDate}. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code Month::from}. + * allowing it to be used as a query via method reference, {@code Month::from}. * * @param temporal the temporal object to convert, not null * @return the month-of-year, not null @@ -315,7 +315,7 @@ /** * Gets the value of the specified field from this month-of-year as an {@code int}. * <p> - * This queries this month for the value for the specified field. + * This queries this month for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -348,7 +348,7 @@ /** * Gets the value of the specified field from this month-of-year as a {@code long}. * <p> - * This queries this month for the value for the specified field. + * This queries this month for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p>
--- a/src/share/classes/java/time/MonthDay.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/MonthDay.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -90,8 +90,8 @@ * A month-day in the ISO-8601 calendar system, such as {@code --12-03}. * <p> * {@code MonthDay} is an immutable date-time object that represents the combination - * of a year and month. Any field that can be derived from a month and day, such as - * quarter-of-year, can be obtained. + * of a month and day-of-month. Any field that can be derived from a month and day, + * such as quarter-of-year, can be obtained. * <p> * This class does not store or represent a year, time or time-zone. * For example, the value "December 3rd" can be stored in a {@code MonthDay}. @@ -154,7 +154,7 @@ /** * Obtains the current month-day from the system clock in the default time-zone. * <p> - * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default + * This will query the {@link Clock#systemDefaultZone() system clock} in the default * time-zone to obtain the current month-day. * <p> * Using this method will prevent the ability to use an alternate clock for testing @@ -169,7 +169,7 @@ /** * Obtains the current month-day from the system clock in the specified time-zone. * <p> - * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current month-day. + * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current month-day. * Specifying the time-zone avoids dependence on the default time-zone. * <p> * Using this method will prevent the ability to use an alternate clock for testing @@ -258,7 +258,7 @@ * chronology, or can be converted to a {@code LocalDate}. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code MonthDay::from}. + * allowing it to be used as a query via method reference, {@code MonthDay::from}. * * @param temporal the temporal object to convert, not null * @return the month-day, not null @@ -389,7 +389,7 @@ /** * Gets the value of the specified field from this month-day as an {@code int}. * <p> - * This queries this month-day for the value for the specified field. + * This queries this month-day for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -420,7 +420,7 @@ /** * Gets the value of the specified field from this month-day as a {@code long}. * <p> - * This queries this month-day for the value for the specified field. + * This queries this month-day for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> @@ -501,7 +501,7 @@ * This method checks whether this month and day and the input year form * a valid date. This can only return false for February 29th. * - * @param year the year to validate, an out of range value returns false + * @param year the year to validate * @return true if the year is valid for this month-day * @see Year#isValidMonthDay(MonthDay) */ @@ -685,7 +685,7 @@ } /** - * Is this month-day after the specified month-day. + * Checks if this month-day is after the specified month-day. * * @param other the other month-day to compare to, not null * @return true if this is after the specified month-day @@ -695,7 +695,7 @@ } /** - * Is this month-day before the specified month-day. + * Checks if this month-day is before the specified month-day. * * @param other the other month-day to compare to, not null * @return true if this point is before the specified month-day
--- a/src/share/classes/java/time/OffsetDateTime.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/OffsetDateTime.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -199,7 +199,7 @@ /** * Obtains the current date-time from the system clock in the default time-zone. * <p> - * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default + * This will query the {@link Clock#systemDefaultZone() system clock} in the default * time-zone to obtain the current date-time. * The offset will be calculated from the time-zone in the clock. * <p> @@ -215,7 +215,7 @@ /** * Obtains the current date-time from the system clock in the specified time-zone. * <p> - * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current date-time. + * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current date-time. * Specifying the time-zone avoids dependence on the default time-zone. * The offset will be calculated from the specified time-zone. * <p> @@ -345,7 +345,7 @@ * those fields that are equivalent to the relevant objects. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code OffsetDateTime::from}. + * allowing it to be used as a query via method reference, {@code OffsetDateTime::from}. * * @param temporal the temporal object to convert, not null * @return the offset date-time, not null @@ -567,7 +567,7 @@ /** * Gets the value of the specified field from this date-time as an {@code int}. * <p> - * This queries this date-time for the value for the specified field. + * This queries this date-time for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -609,7 +609,7 @@ /** * Gets the value of the specified field from this date-time as a {@code long}. * <p> - * This queries this date-time for the value for the specified field. + * This queries this date-time for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> @@ -704,7 +704,7 @@ //----------------------------------------------------------------------- /** - * Gets the {@code LocalDateTime} part of this offset date-time. + * Gets the {@code LocalDateTime} part of this date-time. * <p> * This returns a {@code LocalDateTime} with the same year, month, day and time * as this date-time. @@ -796,10 +796,10 @@ /** * Gets the day-of-week field, which is an enum {@code DayOfWeek}. * <p> - * This method returns the enum {@link java.time.DayOfWeek} for the day-of-week. + * This method returns the enum {@link DayOfWeek} for the day-of-week. * This avoids confusion as to what {@code int} values mean. * If you need access to the primitive {@code int} value then the enum - * provides the {@link java.time.DayOfWeek#getValue() int value}. + * provides the {@link DayOfWeek#getValue() int value}. * <p> * Additional information can be obtained from the {@code DayOfWeek}. * This includes textual names of the values. @@ -869,7 +869,8 @@ * <p> * A simple adjuster might simply set the one of the fields, such as the year field. * A more complex adjuster might set the date to the last day of the month. - * A selection of common adjustments is provided in {@link TemporalAdjuster}. + * A selection of common adjustments is provided in + * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}. * These include finding the "last day of the month" and "next Wednesday". * Key date-time classes also implement the {@code TemporalAdjuster} interface, * such as {@link Month} and {@link java.time.MonthDay MonthDay}. @@ -879,7 +880,7 @@ * For example this code returns a date on the last day of July: * <pre> * import static java.time.Month.*; - * import static java.time.temporal.Adjusters.*; + * import static java.time.temporal.TemporalAdjusters.*; * * result = offsetDateTime.with(JULY).with(lastDayOfMonth()); * </pre> @@ -921,7 +922,7 @@ /** * Returns a copy of this date-time with the specified field set to a new value. * <p> - * TThis returns an {@code OffsetDateTime}, based on this one, with the value + * This returns an {@code OffsetDateTime}, based on this one, with the value * for the specified field changed. * This can be used to change any supported field, such as the year, month or day-of-month. * If it is not possible to set the value, because the field is not supported or for @@ -980,7 +981,8 @@ //----------------------------------------------------------------------- /** * Returns a copy of this {@code OffsetDateTime} with the year altered. - * The offset does not affect the calculation and will be the same in the result. + * <p> + * The time and offset do not affect the calculation and will be the same in the result. * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. * <p> * This instance is immutable and unaffected by this method call. @@ -995,7 +997,8 @@ /** * Returns a copy of this {@code OffsetDateTime} with the month-of-year altered. - * The offset does not affect the calculation and will be the same in the result. + * <p> + * The time and offset do not affect the calculation and will be the same in the result. * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. * <p> * This instance is immutable and unaffected by this method call. @@ -1010,8 +1013,9 @@ /** * Returns a copy of this {@code OffsetDateTime} with the day-of-month altered. + * <p> * If the resulting {@code OffsetDateTime} is invalid, an exception is thrown. - * The offset does not affect the calculation and will be the same in the result. + * The time and offset do not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * @@ -1026,6 +1030,8 @@ /** * Returns a copy of this {@code OffsetDateTime} with the day-of-year altered. + * <p> + * The time and offset do not affect the calculation and will be the same in the result. * If the resulting {@code OffsetDateTime} is invalid, an exception is thrown. * <p> * This instance is immutable and unaffected by this method call. @@ -1041,9 +1047,9 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code OffsetDateTime} with the hour-of-day value altered. + * Returns a copy of this {@code OffsetDateTime} with the hour-of-day altered. * <p> - * The offset does not affect the calculation and will be the same in the result. + * The date and offset do not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * @@ -1056,9 +1062,9 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the minute-of-hour value altered. + * Returns a copy of this {@code OffsetDateTime} with the minute-of-hour altered. * <p> - * The offset does not affect the calculation and will be the same in the result. + * The date and offset do not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * @@ -1071,9 +1077,9 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the second-of-minute value altered. + * Returns a copy of this {@code OffsetDateTime} with the second-of-minute altered. * <p> - * The offset does not affect the calculation and will be the same in the result. + * The date and offset do not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * @@ -1086,15 +1092,15 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the nano-of-second value altered. + * Returns a copy of this {@code OffsetDateTime} with the nano-of-second altered. * <p> - * The offset does not affect the calculation and will be the same in the result. + * The date and offset do not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * * @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 * @return an {@code OffsetDateTime} based on this date-time with the requested nanosecond, not null - * @throws DateTimeException if the nanos value is invalid + * @throws DateTimeException if the nano value is invalid */ public OffsetDateTime withNano(int nanoOfSecond) { return with(dateTime.withNano(nanoOfSecond), offset); @@ -1188,7 +1194,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in years added. + * Returns a copy of this {@code OffsetDateTime} with the specified number of years added. * <p> * This method adds the specified amount to the years field in three steps: * <ol> @@ -1212,7 +1218,7 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in months added. + * Returns a copy of this {@code OffsetDateTime} with the specified number of months added. * <p> * This method adds the specified amount to the months field in three steps: * <ol> @@ -1236,13 +1242,13 @@ } /** - * Returns a copy of this OffsetDateTime with the specified period in weeks added. + * Returns a copy of this OffsetDateTime with the specified number of weeks added. * <p> * This method adds the specified amount in weeks to the days field incrementing * the month and year fields as necessary to ensure the result remains valid. * The result is only invalid if the maximum/minimum year is exceeded. * <p> - * For example, 2008-12-31 plus one week would result in the 2009-01-07. + * For example, 2008-12-31 plus one week would result in 2009-01-07. * <p> * This instance is immutable and unaffected by this method call. * @@ -1255,13 +1261,13 @@ } /** - * Returns a copy of this OffsetDateTime with the specified period in days added. + * Returns a copy of this OffsetDateTime with the specified number of days added. * <p> * This method adds the specified amount to the days field incrementing the * month and year fields as necessary to ensure the result remains valid. * The result is only invalid if the maximum/minimum year is exceeded. * <p> - * For example, 2008-12-31 plus one day would result in the 2009-01-01. + * For example, 2008-12-31 plus one day would result in 2009-01-01. * <p> * This instance is immutable and unaffected by this method call. * @@ -1274,7 +1280,7 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in hours added. + * Returns a copy of this {@code OffsetDateTime} with the specified number of hours added. * <p> * This instance is immutable and unaffected by this method call. * @@ -1287,7 +1293,7 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in minutes added. + * Returns a copy of this {@code OffsetDateTime} with the specified number of minutes added. * <p> * This instance is immutable and unaffected by this method call. * @@ -1300,7 +1306,7 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in seconds added. + * Returns a copy of this {@code OffsetDateTime} with the specified number of seconds added. * <p> * This instance is immutable and unaffected by this method call. * @@ -1313,7 +1319,7 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds added. + * Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds added. * <p> * This instance is immutable and unaffected by this method call. * @@ -1377,11 +1383,11 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in years subtracted. + * Returns a copy of this {@code OffsetDateTime} with the specified number of years subtracted. * <p> * This method subtracts the specified amount from the years field in three steps: * <ol> - * <li>Subtract the input years to the year field</li> + * <li>Subtract the input years from the year field</li> * <li>Check if the resulting date would be invalid</li> * <li>Adjust the day-of-month to the last valid day if necessary</li> * </ol> @@ -1401,11 +1407,11 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in months subtracted. + * Returns a copy of this {@code OffsetDateTime} with the specified number of months subtracted. * <p> * This method subtracts the specified amount from the months field in three steps: * <ol> - * <li>Subtract the input months to the month-of-year field</li> + * <li>Subtract the input months from the month-of-year field</li> * <li>Check if the resulting date would be invalid</li> * <li>Adjust the day-of-month to the last valid day if necessary</li> * </ol> @@ -1425,13 +1431,13 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in weeks subtracted. + * Returns a copy of this {@code OffsetDateTime} with the specified number of weeks subtracted. * <p> * This method subtracts the specified amount in weeks from the days field decrementing * the month and year fields as necessary to ensure the result remains valid. * The result is only invalid if the maximum/minimum year is exceeded. * <p> - * For example, 2008-12-31 minus one week would result in the 2009-01-07. + * For example, 2008-12-31 minus one week would result in 2009-01-07. * <p> * This instance is immutable and unaffected by this method call. * @@ -1444,13 +1450,13 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in days subtracted. + * Returns a copy of this {@code OffsetDateTime} with the specified number of days subtracted. * <p> - * This method subtracts the specified amount from the days field incrementing the + * This method subtracts the specified amount from the days field decrementing the * month and year fields as necessary to ensure the result remains valid. * The result is only invalid if the maximum/minimum year is exceeded. * <p> - * For example, 2008-12-31 minus one day would result in the 2009-01-01. + * For example, 2008-12-31 minus one day would result in 2009-01-01. * <p> * This instance is immutable and unaffected by this method call. * @@ -1463,7 +1469,7 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in hours subtracted. + * Returns a copy of this {@code OffsetDateTime} with the specified number of hours subtracted. * <p> * This instance is immutable and unaffected by this method call. * @@ -1476,7 +1482,7 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in minutes subtracted. + * Returns a copy of this {@code OffsetDateTime} with the specified number of minutes subtracted. * <p> * This instance is immutable and unaffected by this method call. * @@ -1489,7 +1495,7 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in seconds subtracted. + * Returns a copy of this {@code OffsetDateTime} with the specified number of seconds subtracted. * <p> * This instance is immutable and unaffected by this method call. * @@ -1502,7 +1508,7 @@ } /** - * Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds subtracted. + * Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds subtracted. * <p> * This instance is immutable and unaffected by this method call. * @@ -1599,7 +1605,7 @@ * objects in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified date-time. * The result will be negative if the end is before the start. - * For example, the period in days between two date-times can be calculated + * For example, the amount in days between two date-times can be calculated * using {@code startDateTime.until(endDateTime, DAYS)}. * <p> * The {@code Temporal} passed to this method is converted to a @@ -1609,7 +1615,7 @@ * <p> * The calculation returns a whole number, representing the number of * complete units between the two date-times. - * For example, the period in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z + * For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z * will only be one month as it is one minute short of two months. * <p> * There are two equivalent ways of using this method. @@ -1770,7 +1776,7 @@ //----------------------------------------------------------------------- /** - * Compares this {@code OffsetDateTime} to another date-time. + * Compares this date-time to another date-time. * <p> * The comparison is based on the instant then on the local date-time. * It is "consistent with equals", as defined by {@link Comparable}.
--- a/src/share/classes/java/time/OffsetTime.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/OffsetTime.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -153,14 +153,14 @@ /** * Obtains the current time from the system clock in the default time-zone. * <p> - * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default + * This will query the {@link Clock#systemDefaultZone() system clock} in the default * time-zone to obtain the current time. * The offset will be calculated from the time-zone in the clock. * <p> * Using this method will prevent the ability to use an alternate clock for testing * because the clock is hard-coded. * - * @return the current time using the system clock, not null + * @return the current time using the system clock and default time-zone, not null */ public static OffsetTime now() { return now(Clock.systemDefaultZone()); @@ -169,7 +169,7 @@ /** * Obtains the current time from the system clock in the specified time-zone. * <p> - * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current time. + * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current time. * Specifying the time-zone avoids dependence on the default time-zone. * The offset will be calculated from the specified time-zone. * <p> @@ -277,7 +277,7 @@ * those fields that are equivalent to the relevant objects. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code OffsetTime::from}. + * allowing it to be used as a query via method reference, {@code OffsetTime::from}. * * @param temporal the temporal object to convert, not null * @return the offset time, not null @@ -402,7 +402,7 @@ /** * Checks if the specified unit is supported. * <p> - * This checks if the specified unit can be added to, or subtracted from, this date-time. + * This checks if the specified unit can be added to, or subtracted from, this offset-time. * If false, then calling the {@link #plus(long, TemporalUnit)} and * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. * <p> @@ -473,7 +473,7 @@ /** * Gets the value of the specified field from this time as an {@code int}. * <p> - * This queries this time for the value for the specified field. + * This queries this time for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -505,7 +505,7 @@ /** * Gets the value of the specified field from this time as a {@code long}. * <p> - * This queries this time for the value for the specified field. + * This queries this time for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> @@ -575,7 +575,7 @@ * <p> * This method returns an object with the specified {@code ZoneOffset} and a {@code LocalTime} * adjusted by the difference between the two offsets. - * This will result in the old and new objects representing the same instant an an implied day. + * This will result in the old and new objects representing the same instant on an implied day. * This is useful for finding the local time in a different offset. * For example, if this time represents {@code 10:30+02:00} and the offset specified is * {@code +03:00}, then this method will return {@code 11:30+03:00}. @@ -737,7 +737,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code OffsetTime} with the hour-of-day value altered. + * Returns a copy of this {@code OffsetTime} with the hour-of-day altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> @@ -752,7 +752,7 @@ } /** - * Returns a copy of this {@code OffsetTime} with the minute-of-hour value altered. + * Returns a copy of this {@code OffsetTime} with the minute-of-hour altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> @@ -767,7 +767,7 @@ } /** - * Returns a copy of this {@code OffsetTime} with the second-of-minute value altered. + * Returns a copy of this {@code OffsetTime} with the second-of-minute altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> @@ -782,7 +782,7 @@ } /** - * Returns a copy of this {@code OffsetTime} with the nano-of-second value altered. + * Returns a copy of this {@code OffsetTime} with the nano-of-second altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> @@ -884,7 +884,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code OffsetTime} with the specified period in hours added. + * Returns a copy of this {@code OffsetTime} with the specified number of hours added. * <p> * This adds the specified number of hours to this time, returning a new time. * The calculation wraps around midnight. @@ -899,7 +899,7 @@ } /** - * Returns a copy of this {@code OffsetTime} with the specified period in minutes added. + * Returns a copy of this {@code OffsetTime} with the specified number of minutes added. * <p> * This adds the specified number of minutes to this time, returning a new time. * The calculation wraps around midnight. @@ -914,7 +914,7 @@ } /** - * Returns a copy of this {@code OffsetTime} with the specified period in seconds added. + * Returns a copy of this {@code OffsetTime} with the specified number of seconds added. * <p> * This adds the specified number of seconds to this time, returning a new time. * The calculation wraps around midnight. @@ -929,7 +929,7 @@ } /** - * Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds added. + * Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds added. * <p> * This adds the specified number of nanoseconds to this time, returning a new time. * The calculation wraps around midnight. @@ -995,7 +995,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code OffsetTime} with the specified period in hours subtracted. + * Returns a copy of this {@code OffsetTime} with the specified number of hours subtracted. * <p> * This subtracts the specified number of hours from this time, returning a new time. * The calculation wraps around midnight. @@ -1010,7 +1010,7 @@ } /** - * Returns a copy of this {@code OffsetTime} with the specified period in minutes subtracted. + * Returns a copy of this {@code OffsetTime} with the specified number of minutes subtracted. * <p> * This subtracts the specified number of minutes from this time, returning a new time. * The calculation wraps around midnight. @@ -1025,7 +1025,7 @@ } /** - * Returns a copy of this {@code OffsetTime} with the specified period in seconds subtracted. + * Returns a copy of this {@code OffsetTime} with the specified number of seconds subtracted. * <p> * This subtracts the specified number of seconds from this time, returning a new time. * The calculation wraps around midnight. @@ -1040,7 +1040,7 @@ } /** - * Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds subtracted. + * Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds subtracted. * <p> * This subtracts the specified number of nanoseconds from this time, returning a new time. * The calculation wraps around midnight. @@ -1130,7 +1130,7 @@ * objects in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified time. * The result will be negative if the end is before the start. - * For example, the period in hours between two times can be calculated + * For example, the amount in hours between two times can be calculated * using {@code startTime.until(endTime, HOURS)}. * <p> * The {@code Temporal} passed to this method is converted to a @@ -1140,7 +1140,7 @@ * <p> * The calculation returns a whole number, representing the number of * complete units between the two times. - * For example, the period in hours between 11:30Z and 13:29Z will only + * For example, the amount in hours between 11:30Z and 13:29Z will only * be one hour as it is one minute short of two hours. * <p> * There are two equivalent ways of using this method. @@ -1165,7 +1165,7 @@ * <p> * This instance is immutable and unaffected by this method call. * - * @param endExclusive the end date, exclusive, which is converted to an {@code OffsetTime}, not null + * @param endExclusive the end time, exclusive, which is converted to an {@code OffsetTime}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this time and the end time * @throws DateTimeException if the amount cannot be calculated, or the end
--- a/src/share/classes/java/time/Period.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/Period.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -616,7 +616,7 @@ * <p> * This instance is immutable and unaffected by this method call. * - * @param amountToAdd the period to add, not null + * @param amountToAdd the amount to add, not null * @return a {@code Period} based on this period with the requested period added, not null * @throws DateTimeException if the specified amount has a non-ISO chronology or * contains an invalid unit @@ -705,7 +705,7 @@ * <p> * This instance is immutable and unaffected by this method call. * - * @param amountToSubtract the period to subtract, not null + * @param amountToSubtract the amount to subtract, not null * @return a {@code Period} based on this period with the requested period subtracted, not null * @throws DateTimeException if the specified amount has a non-ISO chronology or * contains an invalid unit
--- a/src/share/classes/java/time/Year.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/Year.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -164,7 +164,7 @@ /** * Obtains the current year from the system clock in the default time-zone. * <p> - * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default + * This will query the {@link Clock#systemDefaultZone() system clock} in the default * time-zone to obtain the current year. * <p> * Using this method will prevent the ability to use an alternate clock for testing @@ -179,7 +179,7 @@ /** * Obtains the current year from the system clock in the specified time-zone. * <p> - * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year. + * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year. * Specifying the time-zone avoids dependence on the default time-zone. * <p> * Using this method will prevent the ability to use an alternate clock for testing @@ -240,7 +240,7 @@ * chronology, or can be converted to a {@code LocalDate}. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code Year::from}. + * allowing it to be used as a query via method reference, {@code Year::from}. * * @param temporal the temporal object to convert, not null * @return the year, not null @@ -375,7 +375,7 @@ /** * Checks if the specified unit is supported. * <p> - * This checks if the specified unit can be added to, or subtracted from, this date-time. + * This checks if the specified unit can be added to, or subtracted from, this year. * If false, then calling the {@link #plus(long, TemporalUnit)} and * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. * <p> @@ -441,7 +441,7 @@ /** * Gets the value of the specified field from this year as an {@code int}. * <p> - * This queries this year for the value for the specified field. + * This queries this year for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -472,7 +472,7 @@ /** * Gets the value of the specified field from this year as a {@code long}. * <p> - * This queries this year for the value for the specified field. + * This queries this year for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> @@ -720,13 +720,13 @@ } /** - * Returns a copy of this year with the specified number of years added. + * Returns a copy of this {@code Year} with the specified number of years added. * <p> * This instance is immutable and unaffected by this method call. * * @param yearsToAdd the years to add, may be negative - * @return a {@code Year} based on this year with the period added, not null - * @throws DateTimeException if the result exceeds the supported year range + * @return a {@code Year} based on this year with the years added, not null + * @throws DateTimeException if the result exceeds the supported range */ public Year plusYears(long yearsToAdd) { if (yearsToAdd == 0) { @@ -786,13 +786,13 @@ } /** - * Returns a copy of this year with the specified number of years subtracted. + * Returns a copy of this {@code Year} with the specified number of years subtracted. * <p> * This instance is immutable and unaffected by this method call. * * @param yearsToSubtract the years to subtract, may be negative - * @return a {@code Year} based on this year with the period subtracted, not null - * @throws DateTimeException if the result exceeds the supported year range + * @return a {@code Year} based on this year with the year subtracted, not null + * @throws DateTimeException if the result exceeds the supported range */ public Year minusYears(long yearsToSubtract) { return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract)); @@ -871,12 +871,12 @@ * The result will be negative if the end is before the start. * The {@code Temporal} passed to this method is converted to a * {@code Year} using {@link #from(TemporalAccessor)}. - * For example, the period in decades between two year can be calculated + * For example, the amount in decades between two year can be calculated * using {@code startYear.until(endYear, DECADES)}. * <p> * The calculation returns a whole number, representing the number of * complete units between the two years. - * For example, the period in decades between 2012 and 2031 + * For example, the amount in decades between 2012 and 2031 * will only be one decade as it is one year short of two decades. * <p> * There are two equivalent ways of using this method. @@ -948,7 +948,7 @@ * <p> * The day-of-year value 366 is only valid in a leap year. * - * @param dayOfYear the day-of-year to use, not null + * @param dayOfYear the day-of-year to use, from 1 to 365-366 * @return the local date formed from this year and the specified date of year, not null * @throws DateTimeException if the day of year is zero or less, 366 or greater or equal * to 366 and this is not a leap year @@ -1025,7 +1025,7 @@ } /** - * Is this year after the specified year. + * Checks if this year is after the specified year. * * @param other the other year to compare to, not null * @return true if this is after the specified year @@ -1035,7 +1035,7 @@ } /** - * Is this year before the specified year. + * Checks if this year is before the specified year. * * @param other the other year to compare to, not null * @return true if this point is before the specified year
--- a/src/share/classes/java/time/YearMonth.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/YearMonth.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -157,9 +157,8 @@ /** * Obtains the current year-month from the system clock in the default time-zone. * <p> - * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default + * This will query the {@link Clock#systemDefaultZone() system clock} in the default * time-zone to obtain the current year-month. - * The zone and offset will be set based on the time-zone in the clock. * <p> * Using this method will prevent the ability to use an alternate clock for testing * because the clock is hard-coded. @@ -173,7 +172,7 @@ /** * Obtains the current year-month from the system clock in the specified time-zone. * <p> - * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year-month. + * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year-month. * Specifying the time-zone avoids dependence on the default time-zone. * <p> * Using this method will prevent the ability to use an alternate clock for testing @@ -243,7 +242,7 @@ * chronology, or can be converted to a {@code LocalDate}. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code YearMonth::from}. + * allowing it to be used as a query via method reference, {@code YearMonth::from}. * * @param temporal the temporal object to convert, not null * @return the year-month, not null @@ -363,7 +362,7 @@ /** * Checks if the specified unit is supported. * <p> - * This checks if the specified unit can be added to, or subtracted from, this date-time. + * This checks if the specified unit can be added to, or subtracted from, this year-month. * If false, then calling the {@link #plus(long, TemporalUnit)} and * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. * <p> @@ -430,7 +429,7 @@ /** * Gets the value of the specified field from this year-month as an {@code int}. * <p> - * This queries this year-month for the value for the specified field. + * This queries this year-month for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -462,7 +461,7 @@ /** * Gets the value of the specified field from this year-month as a {@code long}. * <p> - * This queries this year-month for the value for the specified field. + * This queries this year-month for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> @@ -819,7 +818,7 @@ } /** - * Returns a copy of this year-month with the specified period in years added. + * Returns a copy of this {@code YearMonth} with the specified number of years added. * <p> * This instance is immutable and unaffected by this method call. * @@ -836,7 +835,7 @@ } /** - * Returns a copy of this year-month with the specified period in months added. + * Returns a copy of this {@code YearMonth} with the specified number of months added. * <p> * This instance is immutable and unaffected by this method call. * @@ -906,7 +905,7 @@ } /** - * Returns a copy of this year-month with the specified period in years subtracted. + * Returns a copy of this {@code YearMonth} with the specified number of years subtracted. * <p> * This instance is immutable and unaffected by this method call. * @@ -919,7 +918,7 @@ } /** - * Returns a copy of this year-month with the specified period in months subtracted. + * Returns a copy of this {@code YearMonth} with the specified number of months subtracted. * <p> * This instance is immutable and unaffected by this method call. * @@ -1004,12 +1003,12 @@ * The result will be negative if the end is before the start. * The {@code Temporal} passed to this method is converted to a * {@code YearMonth} using {@link #from(TemporalAccessor)}. - * For example, the period in years between two year-months can be calculated + * For example, the amount in years between two year-months can be calculated * using {@code startYearMonth.until(endYearMonth, YEARS)}. * <p> * The calculation returns a whole number, representing the number of * complete units between the two year-months. - * For example, the period in decades between 2012-06 and 2032-05 + * For example, the amount in decades between 2012-06 and 2032-05 * will only be one decade as it is one month short of two decades. * <p> * There are two equivalent ways of using this method. @@ -1134,7 +1133,7 @@ } /** - * Is this year-month after the specified year-month. + * Checks if this year-month is after the specified year-month. * * @param other the other year-month to compare to, not null * @return true if this is after the specified year-month @@ -1144,7 +1143,7 @@ } /** - * Is this year-month before the specified year-month. + * Checks if this year-month is before the specified year-month. * * @param other the other year-month to compare to, not null * @return true if this point is before the specified year-month
--- a/src/share/classes/java/time/ZoneId.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/ZoneId.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -453,7 +453,7 @@ * zones over offset-based zones using {@link TemporalQueries#zone()}. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code ZoneId::from}. + * allowing it to be used as a query via method reference, {@code ZoneId::from}. * * @param temporal the temporal object to convert, not null * @return the zone ID, not null
--- a/src/share/classes/java/time/ZoneOffset.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/ZoneOffset.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -89,7 +89,7 @@ /** * A time-zone offset from Greenwich/UTC, such as {@code +02:00}. * <p> - * A time-zone offset is the period of time that a time-zone differs from Greenwich/UTC. + * A time-zone offset is the amount of time that a time-zone differs from Greenwich/UTC. * This is usually a fixed number of hours and minutes. * <p> * Different parts of the world have different time-zone offsets. @@ -334,7 +334,7 @@ * on extracting the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} field. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code ZoneOffset::from}. + * allowing it to be used as a query via method reference, {@code ZoneOffset::from}. * * @param temporal the temporal object to convert, not null * @return the zone-offset, not null @@ -564,7 +564,7 @@ /** * Gets the value of the specified field from this offset as an {@code int}. * <p> - * This queries this offset for the value for the specified field. + * This queries this offset for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -599,7 +599,7 @@ /** * Gets the value of the specified field from this offset as a {@code long}. * <p> - * This queries this offset for the value for the specified field. + * This queries this offset for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p>
--- a/src/share/classes/java/time/ZonedDateTime.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/ZonedDateTime.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -419,7 +419,7 @@ * <p> * Converting an instant to a zoned date-time is simple as there is only one valid * offset for each instant. If the valid offset is different to the offset specified, - * the the date-time and offset of the zoned date-time will differ from those specified. + * then the date-time and offset of the zoned date-time will differ from those specified. * <p> * If the {@code ZoneId} to be used is a {@code ZoneOffset}, this method is equivalent * to {@link #of(LocalDateTime, ZoneId)}. @@ -539,7 +539,7 @@ * those fields that are equivalent to the relevant objects. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code ZonedDateTime::from}. + * allowing it to be used as a query via method reference, {@code ZonedDateTime::from}. * * @param temporal the temporal object to convert, not null * @return the zoned date-time, not null @@ -783,7 +783,7 @@ /** * Gets the value of the specified field from this date-time as an {@code int}. * <p> - * This queries this date-time for the value for the specified field. + * This queries this date-time for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -825,7 +825,7 @@ /** * Gets the value of the specified field from this date-time as a {@code long}. * <p> - * This queries this date-time for the value for the specified field. + * This queries this date-time for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> @@ -1183,7 +1183,8 @@ * <p> * A simple adjuster might simply set the one of the fields, such as the year field. * A more complex adjuster might set the date to the last day of the month. - * A selection of common adjustments is provided in {@link TemporalAdjuster}. + * A selection of common adjustments is provided in + * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}. * These include finding the "last day of the month" and "next Wednesday". * Key date-time classes also implement the {@code TemporalAdjuster} interface, * such as {@link Month} and {@link java.time.MonthDay MonthDay}. @@ -1193,7 +1194,7 @@ * For example this code returns a date on the last day of July: * <pre> * import static java.time.Month.*; - * import static java.time.temporal.Adjusters.*; + * import static java.time.temporal.TemporalAdjusters.*; * * result = zonedDateTime.with(JULY).with(lastDayOfMonth()); * </pre> @@ -1314,7 +1315,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code ZonedDateTime} with the year value altered. + * Returns a copy of this {@code ZonedDateTime} with the year altered. * <p> * This operates on the local time-line, * {@link LocalDateTime#withYear(int) changing the year} of the local date-time. @@ -1336,7 +1337,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the month-of-year value altered. + * Returns a copy of this {@code ZonedDateTime} with the month-of-year altered. * <p> * This operates on the local time-line, * {@link LocalDateTime#withMonth(int) changing the month} of the local date-time. @@ -1358,7 +1359,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the day-of-month value altered. + * Returns a copy of this {@code ZonedDateTime} with the day-of-month altered. * <p> * This operates on the local time-line, * {@link LocalDateTime#withDayOfMonth(int) changing the day-of-month} of the local date-time. @@ -1405,7 +1406,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code ZonedDateTime} with the hour-of-day value altered. + * Returns a copy of this {@code ZonedDateTime} with the hour-of-day altered. * <p> * This operates on the local time-line, * {@linkplain LocalDateTime#withHour(int) changing the time} of the local date-time. @@ -1427,7 +1428,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the minute-of-hour value altered. + * Returns a copy of this {@code ZonedDateTime} with the minute-of-hour altered. * <p> * This operates on the local time-line, * {@linkplain LocalDateTime#withMinute(int) changing the time} of the local date-time. @@ -1449,7 +1450,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the second-of-minute value altered. + * Returns a copy of this {@code ZonedDateTime} with the second-of-minute altered. * <p> * This operates on the local time-line, * {@linkplain LocalDateTime#withSecond(int) changing the time} of the local date-time. @@ -1471,7 +1472,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the nano-of-second value altered. + * Returns a copy of this {@code ZonedDateTime} with the nano-of-second altered. * <p> * This operates on the local time-line, * {@linkplain LocalDateTime#withNano(int) changing the time} of the local date-time. @@ -1507,7 +1508,7 @@ * {@link ChronoUnit#DAYS DAYS}. Other units throw an exception. * <p> * This operates on the local time-line, - * {@link LocalDateTime#truncatedTo(java.time.temporal.TemporalUnit) truncating} + * {@link LocalDateTime#truncatedTo(TemporalUnit) truncating} * the underlying local date-time. This is then converted back to a * {@code ZonedDateTime}, using the zone ID to obtain the offset. * <p> @@ -1608,7 +1609,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in years added. + * Returns a copy of this {@code ZonedDateTime} with the specified number of years added. * <p> * This operates on the local time-line, * {@link LocalDateTime#plusYears(long) adding years} to the local date-time. @@ -1630,7 +1631,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in months added. + * Returns a copy of this {@code ZonedDateTime} with the specified number of months added. * <p> * This operates on the local time-line, * {@link LocalDateTime#plusMonths(long) adding months} to the local date-time. @@ -1652,7 +1653,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in weeks added. + * Returns a copy of this {@code ZonedDateTime} with the specified number of weeks added. * <p> * This operates on the local time-line, * {@link LocalDateTime#plusWeeks(long) adding weeks} to the local date-time. @@ -1674,7 +1675,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in days added. + * Returns a copy of this {@code ZonedDateTime} with the specified number of days added. * <p> * This operates on the local time-line, * {@link LocalDateTime#plusDays(long) adding days} to the local date-time. @@ -1697,7 +1698,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in hours added. + * Returns a copy of this {@code ZonedDateTime} with the specified number of hours added. * <p> * This operates on the instant time-line, such that adding one hour will * always be a duration of one hour later. @@ -1725,7 +1726,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in minutes added. + * Returns a copy of this {@code ZonedDateTime} with the specified number of minutes added. * <p> * This operates on the instant time-line, such that adding one minute will * always be a duration of one minute later. @@ -1743,7 +1744,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in seconds added. + * Returns a copy of this {@code ZonedDateTime} with the specified number of seconds added. * <p> * This operates on the instant time-line, such that adding one second will * always be a duration of one second later. @@ -1761,7 +1762,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in nanoseconds added. + * Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds added. * <p> * This operates on the instant time-line, such that adding one nano will * always be a duration of one nano later. @@ -1849,7 +1850,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in years subtracted. + * Returns a copy of this {@code ZonedDateTime} with the specified number of years subtracted. * <p> * This operates on the local time-line, * {@link LocalDateTime#minusYears(long) subtracting years} to the local date-time. @@ -1871,7 +1872,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in months subtracted. + * Returns a copy of this {@code ZonedDateTime} with the specified number of months subtracted. * <p> * This operates on the local time-line, * {@link LocalDateTime#minusMonths(long) subtracting months} to the local date-time. @@ -1893,7 +1894,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in weeks subtracted. + * Returns a copy of this {@code ZonedDateTime} with the specified number of weeks subtracted. * <p> * This operates on the local time-line, * {@link LocalDateTime#minusWeeks(long) subtracting weeks} to the local date-time. @@ -1915,7 +1916,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in days subtracted. + * Returns a copy of this {@code ZonedDateTime} with the specified number of days subtracted. * <p> * This operates on the local time-line, * {@link LocalDateTime#minusDays(long) subtracting days} to the local date-time. @@ -1938,7 +1939,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in hours subtracted. + * Returns a copy of this {@code ZonedDateTime} with the specified number of hours subtracted. * <p> * This operates on the instant time-line, such that subtracting one hour will * always be a duration of one hour earlier. @@ -1966,7 +1967,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in minutes subtracted. + * Returns a copy of this {@code ZonedDateTime} with the specified number of minutes subtracted. * <p> * This operates on the instant time-line, such that subtracting one minute will * always be a duration of one minute earlier. @@ -1984,7 +1985,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in seconds subtracted. + * Returns a copy of this {@code ZonedDateTime} with the specified number of seconds subtracted. * <p> * This operates on the instant time-line, such that subtracting one second will * always be a duration of one second earlier. @@ -2002,7 +2003,7 @@ } /** - * Returns a copy of this {@code ZonedDateTime} with the specified period in nanoseconds subtracted. + * Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds subtracted. * <p> * This operates on the instant time-line, such that subtracting one nano will * always be a duration of one nano earlier. @@ -2029,7 +2030,7 @@ * what the result of this method will be. * <p> * The result of this method is obtained by invoking the - * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the + * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the * specified query passing {@code this} as the argument. * * @param <R> the type of the result @@ -2054,7 +2055,7 @@ * objects in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified date-time. * The result will be negative if the end is before the start. - * For example, the period in days between two date-times can be calculated + * For example, the amount in days between two date-times can be calculated * using {@code startDateTime.until(endDateTime, DAYS)}. * <p> * The {@code Temporal} passed to this method is converted to a @@ -2064,7 +2065,7 @@ * <p> * The calculation returns a whole number, representing the number of * complete units between the two date-times. - * For example, the period in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z + * For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z * will only be one month as it is one minute short of two months. * <p> * There are two equivalent ways of using this method.
--- a/src/share/classes/java/time/chrono/ChronoLocalDate.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/ChronoLocalDate.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -249,8 +249,8 @@ * This allows dates in different calendar systems to be compared based * on the position of the date on the local time-line. * The underlying comparison is equivalent to comparing the epoch-day. + * * @return a comparator that compares in time-line order ignoring the chronology - * * @see #isAfter * @see #isBefore * @see #isEqual
--- a/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -227,7 +227,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this date with the specified period in years added. + * Returns a copy of this date with the specified number of years added. * <p> * This adds the specified period in years to the date. * In some cases, adding years can cause the resulting date to become invalid. @@ -243,7 +243,7 @@ abstract D plusYears(long yearsToAdd); /** - * Returns a copy of this date with the specified period in months added. + * Returns a copy of this date with the specified number of months added. * <p> * This adds the specified period in months to the date. * In some cases, adding months can cause the resulting date to become invalid. @@ -259,7 +259,7 @@ abstract D plusMonths(long monthsToAdd); /** - * Returns a copy of this date with the specified period in weeks added. + * Returns a copy of this date with the specified number of weeks added. * <p> * This adds the specified period in weeks to the date. * In some cases, adding weeks can cause the resulting date to become invalid. @@ -292,7 +292,7 @@ //----------------------------------------------------------------------- /** - * Returns a copy of this date with the specified period in years subtracted. + * Returns a copy of this date with the specified number of years subtracted. * <p> * This subtracts the specified period in years to the date. * In some cases, subtracting years can cause the resulting date to become invalid. @@ -313,7 +313,7 @@ } /** - * Returns a copy of this date with the specified period in months subtracted. + * Returns a copy of this date with the specified number of months subtracted. * <p> * This subtracts the specified period in months to the date. * In some cases, subtracting months can cause the resulting date to become invalid. @@ -334,7 +334,7 @@ } /** - * Returns a copy of this date with the specified period in weeks subtracted. + * Returns a copy of this date with the specified number of weeks subtracted. * <p> * This subtracts the specified period in weeks to the date. * In some cases, subtracting weeks can cause the resulting date to become invalid.
--- a/src/share/classes/java/time/chrono/ChronoLocalDateTime.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/ChronoLocalDateTime.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,7 +131,6 @@ * The underlying comparison is equivalent to comparing the epoch-day and nano-of-day. * * @return a comparator that compares in time-line order ignoring the chronology - * * @see #isAfter * @see #isBefore * @see #isEqual @@ -323,7 +322,7 @@ * what the result of this method will be. * <p> * The result of this method is obtained by invoking the - * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the + * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the * specified query passing {@code this} as the argument. * * @param <R> the type of the result
--- a/src/share/classes/java/time/chrono/ChronoZonedDateTime.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/ChronoZonedDateTime.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -132,7 +132,6 @@ * The underlying comparison is equivalent to comparing the epoch-second and nano-of-second. * * @return a comparator that compares in time-line order ignoring the chronology - * * @see #isAfter * @see #isBefore * @see #isEqual @@ -292,7 +291,7 @@ * <p> * This instance is immutable and unaffected by this method call. * - * @return a {@code ZoneChronoDateTime} based on this date-time with the earlier offset, not null + * @return a {@code ChronoZonedDateTime} based on this date-time with the earlier offset, not null * @throws DateTimeException if no rules can be found for the zone * @throws DateTimeException if no rules are valid for this date-time */ @@ -319,7 +318,7 @@ ChronoZonedDateTime<D> withLaterOffsetAtOverlap(); /** - * Returns a copy of this ZonedDateTime with a different time-zone, + * Returns a copy of this date-time with a different time-zone, * retaining the local date-time if possible. * <p> * This method changes the time-zone and retains the local date-time. @@ -470,7 +469,7 @@ * what the result of this method will be. * <p> * The result of this method is obtained by invoking the - * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the + * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the * specified query passing {@code this} as the argument. * * @param <R> the type of the result
--- a/src/share/classes/java/time/chrono/Chronology.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/Chronology.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -132,8 +132,9 @@ * The set of available chronologies can be extended by applications. * Adding a new calendar system requires the writing of an implementation of * {@code Chronology}, {@code ChronoLocalDate} and {@code Era}. - * The majority of the logic specific to the calendar system will be in - * {@code ChronoLocalDate}. The {@code Chronology} subclass acts as a factory. + * The majority of the logic specific to the calendar system will be in the + * {@code ChronoLocalDate} implementation. + * The {@code Chronology} implementation acts as a factory. * <p> * To permit the discovery of additional chronologies, the {@link java.util.ServiceLoader ServiceLoader} * is used. A file must be added to the {@code META-INF/services} directory with the @@ -167,7 +168,7 @@ * If the specified temporal object does not have a chronology, {@link IsoChronology} is returned. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} - * allowing it to be used in queries via method reference, {@code Chronology::from}. + * allowing it to be used as a query via method reference, {@code Chronology::from}. * * @param temporal the temporal to convert, not null * @return the chronology, not null @@ -413,7 +414,7 @@ * The alternate clock may be introduced using {@link Clock dependency injection}. * * @implSpec - * The default implementation invokes {@link #date(TemporalAccessor)} )}. + * The default implementation invokes {@link #date(TemporalAccessor)}. * * @param clock the clock to use, not null * @return the current local date, not null @@ -622,7 +623,7 @@ * The parameters control the style of the returned text and the locale. * * @implSpec - * The default implementation behaves as the the formatter was used to + * The default implementation behaves as though the formatter was used to * format the chronology textual name. * * @param style the style of the text required, not null
--- a/src/share/classes/java/time/chrono/Era.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/Era.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -182,7 +182,7 @@ /** * Gets the value of the specified field from this era as an {@code int}. * <p> - * This queries this era for the value for the specified field. + * This queries this era for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. @@ -215,7 +215,7 @@ /** * Gets the value of the specified field from this era as a {@code long}. * <p> - * This queries this era for the value for the specified field. + * This queries this era for the value of the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p>
--- a/src/share/classes/java/time/chrono/HijrahChronology.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/HijrahChronology.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -394,7 +394,7 @@ * Gets the ID of the chronology. * <p> * The ID uniquely identifies the {@code Chronology}. It can be used to - * lookup the {@code Chronology} using {@link #of(String)}. + * lookup the {@code Chronology} using {@link Chronology#of(String)}. * * @return the chronology ID, non-null * @see #getCalendarType() @@ -409,7 +409,7 @@ * <p> * The calendar type is an identifier defined by the * <em>Unicode Locale Data Markup Language (LDML)</em> specification. - * It can be used to lookup the {@code Chronology} using {@link #of(String)}. + * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}. * * @return the calendar system type; non-null if the calendar has * a standard type, otherwise null
--- a/src/share/classes/java/time/chrono/IsoChronology.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/IsoChronology.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,7 +143,7 @@ * Gets the ID of the chronology - 'ISO'. * <p> * The ID uniquely identifies the {@code Chronology}. - * It can be used to lookup the {@code Chronology} using {@link #of(String)}. + * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}. * * @return the chronology ID - 'ISO' * @see #getCalendarType() @@ -158,7 +158,7 @@ * <p> * The calendar type is an identifier defined by the * <em>Unicode Locale Data Markup Language (LDML)</em> specification. - * It can be used to lookup the {@code Chronology} using {@link #of(String)}. + * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}. * It can also be used as part of a locale, accessible via * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'. *
--- a/src/share/classes/java/time/chrono/JapaneseChronology.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/JapaneseChronology.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -150,7 +150,7 @@ * Gets the ID of the chronology - 'Japanese'. * <p> * The ID uniquely identifies the {@code Chronology}. - * It can be used to lookup the {@code Chronology} using {@link #of(String)}. + * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}. * * @return the chronology ID - 'Japanese' * @see #getCalendarType() @@ -165,7 +165,7 @@ * <p> * The calendar type is an identifier defined by the * <em>Unicode Locale Data Markup Language (LDML)</em> specification. - * It can be used to lookup the {@code Chronology} using {@link #of(String)}. + * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}. * It can also be used as part of a locale, accessible via * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'. *
--- a/src/share/classes/java/time/chrono/MinguoChronology.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/MinguoChronology.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -132,7 +132,7 @@ * Gets the ID of the chronology - 'Minguo'. * <p> * The ID uniquely identifies the {@code Chronology}. - * It can be used to lookup the {@code Chronology} using {@link #of(String)}. + * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}. * * @return the chronology ID - 'Minguo' * @see #getCalendarType() @@ -147,7 +147,7 @@ * <p> * The calendar type is an identifier defined by the * <em>Unicode Locale Data Markup Language (LDML)</em> specification. - * It can be used to lookup the {@code Chronology} using {@link #of(String)}. + * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}. * It can also be used as part of a locale, accessible via * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'. *
--- a/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -168,7 +168,7 @@ * Gets the ID of the chronology - 'ThaiBuddhist'. * <p> * The ID uniquely identifies the {@code Chronology}. - * It can be used to lookup the {@code Chronology} using {@link #of(String)}. + * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}. * * @return the chronology ID - 'ThaiBuddhist' * @see #getCalendarType() @@ -183,7 +183,7 @@ * <p> * The calendar type is an identifier defined by the * <em>Unicode Locale Data Markup Language (LDML)</em> specification. - * It can be used to lookup the {@code Chronology} using {@link #of(String)}. + * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}. * It can also be used as part of a locale, accessible via * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'. *
--- a/src/share/classes/java/time/format/DateTimeFormatter.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/format/DateTimeFormatter.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -117,8 +117,9 @@ * {@code parse(CharSequence text, DateTimeFormatter formatter)}. * <p>For example: * <blockquote><pre> - * String text = date.toString(formatter); - * LocalDate date = LocalDate.parse(text, formatter); + * LocalDate date = LocalDate.now(); + * String text = date.format(formatter); + * LocalDate parsedDate = LocalDate.parse(text, formatter); * </pre></blockquote> * <p> * In addition to the format, formatters can be created with desired Locale, @@ -265,9 +266,10 @@ * <p> * For example: * <blockquote><pre> + * LocalDate date = LocalDate.now(); * DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd"); - * String text = date.toString(formatter); - * LocalDate date = LocalDate.parse(text, formatter); + * String text = date.format(formatter); + * LocalDate parsedDate = LocalDate.parse(text, formatter); * </pre></blockquote> * <p> * All letters 'A' to 'Z' and 'a' to 'z' are reserved as pattern letters. The @@ -1331,8 +1333,8 @@ * If the time '23:59:60' is received, then a simple conversion is applied, * replacing the second-of-minute of 60 with 59. This query can be used * on the parse result to determine if the leap-second adjustment was made. - * The query will return one second of excess if it did adjust to remove - * the leap-second, and zero if not. Note that applying a leap-second + * The query will return {@code true} if it did adjust to remove the + * leap-second, and {@code false} if not. Note that applying a leap-second * smoothing mechanism, such as UTC-SLS, is the responsibility of the * application, as follows: * <pre> @@ -1976,7 +1978,7 @@ * Errors are returned using the error index field of the {@code ParsePosition} * instead of {@code DateTimeParseException}. * The returned error index will be set to an index indicative of the error. - * Callers must check for errors before using the context. + * Callers must check for errors before using the result. * <p> * If the formatter parses the same field more than once with different values, * the result will be an error.
--- a/src/share/classes/java/time/format/DateTimeFormatterBuilder.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/format/DateTimeFormatterBuilder.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ * * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos * - * All rights reserved. + * All rights hg qreserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -137,7 +137,6 @@ * <li>ChronologyText - the name of the chronology</li> * <li>Literal - a text literal</li> * <li>Nested and Optional - formats can be nested or made optional</li> - * <li>Other - the printer and parser interfaces can be used to add user supplied formatting</li> * </ul> * In addition, any of the elements may be decorated by padding, either with spaces or any other character. * <p> @@ -194,8 +193,8 @@ * The locale and chronology are used to lookup the locale specific format * for the requested dateStyle and/or timeStyle. * - * @param dateStyle the FormatStyle for the date - * @param timeStyle the FormatStyle for the time + * @param dateStyle the FormatStyle for the date, null for time-only pattern + * @param timeStyle the FormatStyle for the time, null for date-only pattern * @param chrono the Chronology, non-null * @param locale the locale, non-null * @return the locale and Chronology specific formatting pattern @@ -747,9 +746,9 @@ * defines the connection between each value and the text: * <pre> * Map<Long, String> map = new HashMap<>(); - * map.put(1, "JNY"); - * map.put(2, "FBY"); - * map.put(3, "MCH"); + * map.put(1L, "JNY"); + * map.put(2L, "FBY"); + * map.put(3L, "MCH"); * ... * builder.appendText(MONTH_OF_YEAR, map); * </pre> @@ -841,7 +840,7 @@ * <p> * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing. * The end-of-day time of '24:00' is handled as midnight at the start of the following day. - * The leap-second time of '23:59:59' is handled to some degree, see + * The leap-second time of '23:59:60' is handled to some degree, see * {@link DateTimeFormatter#parsedLeapSecond()} for full details. * <p> * An alternative to this method is to format/parse the instant as a single @@ -864,7 +863,7 @@ * Appends the zone offset, such as '+01:00', to the formatter. * <p> * This appends an instruction to format/parse the offset ID to the builder. - * This is equivalent to calling {@code appendOffset("HH:MM:ss", "Z")}. + * This is equivalent to calling {@code appendOffset("+HH:MM:ss", "Z")}. * * @return this, for chaining, not null */ @@ -1049,7 +1048,7 @@ * "GMT+01:30" -- ZoneOffset.of("+01:30") * </pre> * <p> - * Note that this method is is identical to {@code appendZoneId()} except + * Note that this method is identical to {@code appendZoneId()} except * in the mechanism used to obtain the zone. * Note also that parsing accepts offsets, whereas formatting will never * produce one. @@ -1107,7 +1106,7 @@ * "GMT+01:30" -- ZoneOffset.of("GMT+01:30") * </pre> * <p> - * Note that this method is is identical to {@code appendZoneId()} except + * Note that this method is identical to {@code appendZoneId()} except * in the mechanism used to obtain the zone. * * @return this, for chaining, not null @@ -1132,7 +1131,7 @@ * for the locale set in the {@link DateTimeFormatter}. * If the temporal object being printed represents an instant, then the text * will be the summer or winter time text as appropriate. - * If the lookup for text does not find any suitable reuslt, then the + * If the lookup for text does not find any suitable result, then the * {@link ZoneId#getId() ID} will be printed instead. * If the zone cannot be obtained then an exception is thrown unless the * section of the formatter is optional. @@ -1168,7 +1167,7 @@ * for the locale set in the {@link DateTimeFormatter}. * If the temporal object being printed represents an instant, then the text * will be the summer or winter time text as appropriate. - * If the lookup for text does not find any suitable reuslt, then the + * If the lookup for text does not find any suitable result, then the * {@link ZoneId#getId() ID} will be printed instead. * If the zone cannot be obtained then an exception is thrown unless the * section of the formatter is optional. @@ -1182,7 +1181,7 @@ * zone. This method also allows a set of preferred {@link ZoneId} to be * specified for parsing. The matched preferred zone id will be used if the * textural zone name being parsed is not unique. - * + * <p> * If the zone cannot be parsed then an exception is thrown unless the * section of the formatter is optional. * @@ -1227,7 +1226,6 @@ * <p> * The calendar system name will be output during a format. * If the chronology cannot be obtained then an exception will be thrown. - * The calendar system name is obtained from the Chronology. * * @param textStyle the text style to use, not null * @return this, for chaining, not null @@ -1453,7 +1451,7 @@ * LLLLL 5 appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW_STANDALONE) * * w 1 append special localized WeekFields element for numeric week-of-year - * ww 1 append special localized WeekFields element for numeric week-of-year, zero-padded + * ww 2 append special localized WeekFields element for numeric week-of-year, zero-padded * W 1 append special localized WeekFields element for numeric week-of-month * d 1 appendValue(ChronoField.DAY_OF_MONTH) * dd 2 appendValue(ChronoField.DAY_OF_MONTH, 2) @@ -1880,7 +1878,6 @@ * <p> * During parsing, the padding and decorated element are parsed. * If parsing is lenient, then the pad width is treated as a maximum. - * If parsing is case insensitive, then the pad character is matched ignoring case. * The padding is parsed greedily. Thus, if the decorated element starts with * the pad character, it will not be parsed. *
--- a/src/share/classes/java/time/format/DecimalStyle.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/format/DecimalStyle.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,6 @@ package java.time.format; import java.text.DecimalFormatSymbols; -import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Locale; @@ -138,7 +137,7 @@ * of(Locale.getDefault(Locale.Category.FORMAT))}. * * @see java.util.Locale.Category#FORMAT - * @return the info, not null + * @return the decimal style, not null */ public static DecimalStyle ofDefaultLocale() { return of(Locale.getDefault(Locale.Category.FORMAT)); @@ -150,7 +149,7 @@ * This method provides access to locale sensitive decimal style symbols. * * @param locale the locale, not null - * @return the info, not null + * @return the decimal style, not null */ public static DecimalStyle of(Locale locale) { Objects.requireNonNull(locale, "locale"); @@ -340,7 +339,7 @@ //----------------------------------------------------------------------- /** - * Checks if this DecimalStyle is equal another DecimalStyle. + * Checks if this DecimalStyle is equal to another DecimalStyle. * * @param obj the object to check, null returns false * @return true if this is equal to the other date
--- a/src/share/classes/java/time/package-info.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/package-info.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ * The main API for dates, times, instants, and durations. * </p> * <p> - * The classes defined here represent the principal date-time concepts, + * The classes defined here represent the principle date-time concepts, * including instants, durations, dates, times, time-zones and periods. * They are based on the ISO calendar system, which is the <i>de facto</i> world * calendar following the proleptic Gregorian rules. @@ -120,9 +120,10 @@ * * <h3>Duration and Period</h3> * <p> - * Beyond dates and times, the API also allows the storage of period and durations of time. + * Beyond dates and times, the API also allows the storage of periods and durations of time. * A {@link java.time.Duration} is a simple measure of time along the time-line in nanoseconds. - * A {@link java.time.Period} expresses an amount of time in units meaningful to humans, such as years or hours. + * A {@link java.time.Period} expresses an amount of time in units meaningful + * to humans, such as years or days. * </p> * * <h3>Additional value types</h3> @@ -247,8 +248,8 @@ * </ul> * <p> * Multiple calendar systems is an awkward addition to the design challenges. - * The first principal is that most users want the standard ISO calendar system. - * As such, the main classes are ISO-only. The second principal is that most of those that want a + * The first principle is that most users want the standard ISO calendar system. + * As such, the main classes are ISO-only. The second principle is that most of those that want a * non-ISO calendar system want it for user interaction, thus it is a UI localization issue. * As such, date and time objects should be held as ISO objects in the data model and persistent * storage, only being converted to and from a local calendar for display.
--- a/src/share/classes/java/time/temporal/IsoFields.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/temporal/IsoFields.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -638,7 +638,7 @@ //----------------------------------------------------------------------- /** - * Implementation of the period unit. + * Implementation of the unit. */ private static enum Unit implements TemporalUnit {
--- a/src/share/classes/java/time/temporal/Temporal.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/temporal/Temporal.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -157,7 +157,8 @@ * This adjusts this date-time according to the rules of the specified adjuster. * A simple adjuster might simply set the one of the fields, such as the year field. * A more complex adjuster might set the date to the last day of the month. - * A selection of common adjustments is provided in {@link TemporalAdjuster}. + * A selection of common adjustments is provided in + * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}. * These include finding the "last day of the month" and "next Wednesday". * The adjuster is responsible for handling special cases, such as the varying * lengths of month and leap years. @@ -287,7 +288,7 @@ * This provides equivalent, safe behavior for immutable and mutable implementations. * * @param amountToAdd the amount of the specified unit to add, may be negative - * @param unit the unit of the period to add, not null + * @param unit the unit of the amount to add, not null * @return an object of the same type with the specified period added, not null * @throws DateTimeException if the unit cannot be added * @throws UnsupportedTemporalTypeException if the unit is not supported @@ -359,7 +360,7 @@ * </pre> * * @param amountToSubtract the amount of the specified unit to subtract, may be negative - * @param unit the unit of the period to subtract, not null + * @param unit the unit of the amount to subtract, not null * @return an object of the same type with the specified period subtracted, not null * @throws DateTimeException if the unit cannot be subtracted * @throws UnsupportedTemporalTypeException if the unit is not supported @@ -378,12 +379,12 @@ * The start and end points are {@code this} and the specified temporal. * The end point is converted to be of the same type as the start point if different. * The result will be negative if the end is before the start. - * For example, the period in hours between two temporal objects can be + * For example, the amount in hours between two temporal objects can be * calculated using {@code startTime.until(endTime, HOURS)}. * <p> * The calculation returns a whole number, representing the number of * complete units between the two temporals. - * For example, the period in hours between the times 11:30 and 13:29 + * For example, the amount in hours between the times 11:30 and 13:29 * will only be one hour as it is one minute short of two hours. * <p> * There are two equivalent ways of using this method.
--- a/src/share/classes/java/time/temporal/TemporalAccessor.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/temporal/TemporalAccessor.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -180,7 +180,7 @@ /** * Gets the value of the specified field as an {@code int}. * <p> - * This queries the date-time for the value for the specified field. + * This queries the date-time for the value of the specified field. * The returned value will always be within the valid range of values for the field. * If the date-time cannot return the value, because the field is unsupported or for * some other reason, an exception will be thrown. @@ -229,7 +229,7 @@ /** * Gets the value of the specified field as a {@code long}. * <p> - * This queries the date-time for the value for the specified field. + * This queries the date-time for the value of the specified field. * The returned value may be outside the valid range of values for the field. * If the date-time cannot return the value, because the field is unsupported or for * some other reason, an exception will be thrown.
--- a/src/share/classes/java/time/temporal/TemporalField.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/temporal/TemporalField.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -116,7 +116,7 @@ * For example, in the field 'MonthOfYear', the unit is 'Months'. * See also {@link #getRangeUnit()}. * - * @return the period unit defining the base unit of the field, not null + * @return the unit defining the base unit of the field, not null */ TemporalUnit getBaseUnit(); @@ -130,7 +130,7 @@ * The range is never null. For example, the 'Year' field is shorthand for * 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'. * - * @return the period unit defining the range of the field, not null + * @return the unit defining the range of the field, not null */ TemporalUnit getRangeUnit(); @@ -179,7 +179,7 @@ * Checks if this field is supported by the temporal object. * <p> * This determines whether the temporal accessor supports this field. - * If this returns false, the the temporal cannot be queried for this field. + * If this returns false, then the temporal cannot be queried for this field. * <p> * There are two equivalent ways of using this method. * The first is to invoke this method directly.
--- a/src/share/classes/java/time/temporal/TemporalUnit.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/temporal/TemporalUnit.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -221,7 +221,7 @@ * @param temporal the temporal object to adjust, not null * @param amount the amount of this unit to add, positive or negative * @return the adjusted temporal object, not null - * @throws DateTimeException if the period cannot be added + * @throws DateTimeException if the amount cannot be added * @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal */ <R extends Temporal> R addTo(R temporal, long amount);
--- a/src/share/classes/java/time/zone/ZoneOffsetTransition.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/time/zone/ZoneOffsetTransition.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,7 +83,7 @@ * The discontinuity is normally a gap in spring and an overlap in autumn. * {@code ZoneOffsetTransition} models the transition between the two offsets. * <p> - * Gaps occur where there are local date-times that simply do not not exist. + * Gaps occur where there are local date-times that simply do not exist. * An example would be when the offset changes from {@code +03:00} to {@code +04:00}. * This might be described as 'the clocks will move forward one hour tonight at 1am'. * <p> @@ -334,7 +334,7 @@ /** * Does this transition represent a gap in the local time-line. * <p> - * Gaps occur where there are local date-times that simply do not not exist. + * Gaps occur where there are local date-times that simply do not exist. * An example would be when the offset changes from {@code +01:00} to {@code +02:00}. * This might be described as 'the clocks will move forward one hour tonight at 1am'. *
--- a/src/share/classes/java/util/concurrent/LinkedTransferQueue.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/java/util/concurrent/LinkedTransferQueue.java Thu Jun 25 16:49:08 2015 -0700 @@ -780,7 +780,9 @@ } /** - * Version of firstOfMode used by Spliterator + * Version of firstOfMode used by Spliterator. Callers must + * recheck if the returned node's item field is null or + * self-linked before using. */ final Node firstDataNode() { for (Node p = head; p != null;) { @@ -953,11 +955,12 @@ Object[] a = new Object[n]; int i = 0; do { - if ((a[i] = p.item) != null) + Object e = p.item; + if (e != p && (a[i] = e) != null) ++i; if (p == (p = p.next)) p = q.firstDataNode(); - } while (p != null && i < n); + } while (p != null && i < n && p.isData); if ((current = p) == null) exhausted = true; if (i > 0) { @@ -980,11 +983,11 @@ exhausted = true; do { Object e = p.item; + if (e != null && e != p) + action.accept((E)e); if (p == (p = p.next)) p = q.firstDataNode(); - if (e != null) - action.accept((E)e); - } while (p != null); + } while (p != null && p.isData); } } @@ -997,10 +1000,11 @@ ((p = current) != null || (p = q.firstDataNode()) != null)) { Object e; do { - e = p.item; + if ((e = p.item) == p) + e = null; if (p == (p = p.next)) p = q.firstDataNode(); - } while (e == null && p != null); + } while (e == null && p != null && p.isData); if ((current = p) == null) exhausted = true; if (e != null) {
--- a/src/share/classes/sun/awt/SunToolkit.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/sun/awt/SunToolkit.java Thu Jun 25 16:49:08 2015 -0700 @@ -715,16 +715,19 @@ } - static final SoftCache imgCache = new SoftCache(); + static final SoftCache fileImgCache = new SoftCache(); + + static final SoftCache urlImgCache = new SoftCache(); static Image getImageFromHash(Toolkit tk, URL url) { checkPermissions(url); - synchronized (imgCache) { - Image img = (Image)imgCache.get(url); + synchronized (urlImgCache) { + String key = url.toString(); + Image img = (Image)urlImgCache.get(key); if (img == null) { try { img = tk.createImage(new URLImageSource(url)); - imgCache.put(url, img); + urlImgCache.put(key, img); } catch (Exception e) { } } @@ -735,12 +738,12 @@ static Image getImageFromHash(Toolkit tk, String filename) { checkPermissions(filename); - synchronized (imgCache) { - Image img = (Image)imgCache.get(filename); + synchronized (fileImgCache) { + Image img = (Image)fileImgCache.get(filename); if (img == null) { try { img = tk.createImage(new FileImageSource(filename)); - imgCache.put(filename, img); + fileImgCache.put(filename, img); } catch (Exception e) { } } @@ -758,28 +761,29 @@ protected Image getImageWithResolutionVariant(String fileName, String resolutionVariantName) { - synchronized (imgCache) { + synchronized (fileImgCache) { Image image = getImageFromHash(this, fileName); if (image instanceof MultiResolutionImage) { return image; } Image resolutionVariant = getImageFromHash(this, resolutionVariantName); image = createImageWithResolutionVariant(image, resolutionVariant); - imgCache.put(fileName, image); + fileImgCache.put(fileName, image); return image; } } protected Image getImageWithResolutionVariant(URL url, URL resolutionVariantURL) { - synchronized (imgCache) { + synchronized (urlImgCache) { Image image = getImageFromHash(this, url); if (image instanceof MultiResolutionImage) { return image; } Image resolutionVariant = getImageFromHash(this, resolutionVariantURL); image = createImageWithResolutionVariant(image, resolutionVariant); - imgCache.put(url, image); + String key = url.toString(); + urlImgCache.put(key, image); return image; } } @@ -884,8 +888,13 @@ return null; } - protected static boolean imageCached(Object key) { - return imgCache.containsKey(key); + protected static boolean imageCached(String fileName) { + return fileImgCache.containsKey(fileName); + } + + protected static boolean imageCached(URL url) { + String key = url.toString(); + return urlImgCache.containsKey(key); } protected static boolean imageExists(String filename) {
--- a/src/share/classes/sun/security/ec/ECPrivateKeyImpl.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/sun/security/ec/ECPrivateKeyImpl.java Thu Jun 25 16:49:08 2015 -0700 @@ -69,7 +69,7 @@ /** * Construct a key from its encoding. Called by the ECKeyFactory. */ - ECPrivateKeyImpl(byte[] encoded) throws InvalidKeyException { + public ECPrivateKeyImpl(byte[] encoded) throws InvalidKeyException { decode(encoded); } @@ -77,7 +77,7 @@ * Construct a key from its components. Used by the * KeyFactory. */ - ECPrivateKeyImpl(BigInteger s, ECParameterSpec params) + public ECPrivateKeyImpl(BigInteger s, ECParameterSpec params) throws InvalidKeyException { this.s = s; this.params = params;
--- a/src/share/classes/sun/security/ec/ECPublicKeyImpl.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/sun/security/ec/ECPublicKeyImpl.java Thu Jun 25 16:49:08 2015 -0700 @@ -52,7 +52,7 @@ * ECKeyFactory. */ @SuppressWarnings("deprecation") - ECPublicKeyImpl(ECPoint w, ECParameterSpec params) + public ECPublicKeyImpl(ECPoint w, ECParameterSpec params) throws InvalidKeyException { this.w = w; this.params = params; @@ -65,7 +65,7 @@ /** * Construct a key from its encoding. */ - ECPublicKeyImpl(byte[] encoded) throws InvalidKeyException { + public ECPublicKeyImpl(byte[] encoded) throws InvalidKeyException { decode(encoded); }
--- a/src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java Thu Jun 25 16:49:08 2015 -0700 @@ -116,7 +116,7 @@ byte[] encoded = key.getEncoded(); try { - key = ECUtil.decodeX509ECPublicKey(encoded); + key = P11ECUtil.decodeX509ECPublicKey(encoded); } catch (InvalidKeySpecException ikse) { throw new InvalidKeyException(ikse); } @@ -145,7 +145,7 @@ byte[] encoded = key.getEncoded(); try { - key = ECUtil.decodePKCS8ECPrivateKey(encoded); + key = P11ECUtil.decodePKCS8ECPrivateKey(encoded); } catch (InvalidKeySpecException ikse) { throw new InvalidKeyException(ikse); } @@ -167,7 +167,7 @@ if (keySpec instanceof X509EncodedKeySpec) { try { byte[] encoded = ((X509EncodedKeySpec)keySpec).getEncoded(); - PublicKey key = ECUtil.decodeX509ECPublicKey(encoded); + PublicKey key = P11ECUtil.decodeX509ECPublicKey(encoded); return implTranslatePublicKey(key); } catch (InvalidKeyException e) { throw new InvalidKeySpecException @@ -197,7 +197,7 @@ if (keySpec instanceof PKCS8EncodedKeySpec) { try { byte[] encoded = ((PKCS8EncodedKeySpec)keySpec).getEncoded(); - PrivateKey key = ECUtil.decodePKCS8ECPrivateKey(encoded); + PrivateKey key = P11ECUtil.decodePKCS8ECPrivateKey(encoded); return implTranslatePrivateKey(key); } catch (GeneralSecurityException e) { throw new InvalidKeySpecException
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/sun/security/pkcs11/P11ECUtil.java Thu Jun 25 16:49:08 2015 -0700 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.pkcs11; + +import java.io.IOException; +import java.math.BigInteger; +import java.security.*; +import java.security.interfaces.*; +import java.security.spec.*; + +import sun.security.ec.ECPublicKeyImpl; +import sun.security.ec.ECPrivateKeyImpl; +import sun.security.x509.X509Key; + +final class P11ECUtil { + + static ECPublicKey decodeX509ECPublicKey(byte[] encoded) + throws InvalidKeySpecException { + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(encoded); + + return (ECPublicKey)ECGeneratePublic(keySpec); + } + + static byte[] x509EncodeECPublicKey(ECPoint w, + ECParameterSpec params) throws InvalidKeySpecException { + ECPublicKeySpec keySpec = new ECPublicKeySpec(w, params); + X509Key key = (X509Key)ECGeneratePublic(keySpec); + + return key.getEncoded(); + } + + static ECPrivateKey decodePKCS8ECPrivateKey(byte[] encoded) + throws InvalidKeySpecException { + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded); + + return (ECPrivateKey)ECGeneratePrivate(keySpec); + } + + static ECPrivateKey generateECPrivateKey(BigInteger s, + ECParameterSpec params) throws InvalidKeySpecException { + ECPrivateKeySpec keySpec = new ECPrivateKeySpec(s, params); + + return (ECPrivateKey)ECGeneratePrivate(keySpec); + } + + private static PublicKey ECGeneratePublic(KeySpec keySpec) + throws InvalidKeySpecException { + try { + if (keySpec instanceof X509EncodedKeySpec) { + X509EncodedKeySpec x509Spec = (X509EncodedKeySpec)keySpec; + return new ECPublicKeyImpl(x509Spec.getEncoded()); + } else if (keySpec instanceof ECPublicKeySpec) { + ECPublicKeySpec ecSpec = (ECPublicKeySpec)keySpec; + return new ECPublicKeyImpl( + ecSpec.getW(), + ecSpec.getParams() + ); + } else { + throw new InvalidKeySpecException("Only ECPublicKeySpec " + + "and X509EncodedKeySpec supported for EC public keys"); + } + } catch (InvalidKeySpecException e) { + throw e; + } catch (GeneralSecurityException e) { + throw new InvalidKeySpecException(e); + } + } + + private static PrivateKey ECGeneratePrivate(KeySpec keySpec) + throws InvalidKeySpecException { + try { + if (keySpec instanceof PKCS8EncodedKeySpec) { + PKCS8EncodedKeySpec pkcsSpec = (PKCS8EncodedKeySpec)keySpec; + return new ECPrivateKeyImpl(pkcsSpec.getEncoded()); + } else if (keySpec instanceof ECPrivateKeySpec) { + ECPrivateKeySpec ecSpec = (ECPrivateKeySpec)keySpec; + return new ECPrivateKeyImpl(ecSpec.getS(), ecSpec.getParams()); + } else { + throw new InvalidKeySpecException("Only ECPrivateKeySpec " + + "and PKCS8EncodedKeySpec supported for EC private keys"); + } + } catch (InvalidKeySpecException e) { + throw e; + } catch (GeneralSecurityException e) { + throw new InvalidKeySpecException(e); + } + } + + private P11ECUtil() {} + +}
--- a/src/share/classes/sun/security/pkcs11/P11Key.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/sun/security/pkcs11/P11Key.java Thu Jun 25 16:49:08 2015 -0700 @@ -47,7 +47,6 @@ import sun.security.util.DerValue; import sun.security.util.Length; -import sun.security.util.ECUtil; /** * Key implementation classes. @@ -993,7 +992,7 @@ if (encoded == null) { fetchValues(); try { - Key key = ECUtil.generateECPrivateKey(s, params); + Key key = P11ECUtil.generateECPrivateKey(s, params); encoded = key.getEncoded(); } catch (InvalidKeySpecException e) { throw new ProviderException(e); @@ -1067,7 +1066,7 @@ if (encoded == null) { fetchValues(); try { - return ECUtil.x509EncodeECPublicKey(w, params); + return P11ECUtil.x509EncodeECPublicKey(w, params); } catch (InvalidKeySpecException e) { throw new ProviderException(e); }
--- a/src/share/classes/sun/security/util/ECUtil.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/classes/sun/security/util/ECUtil.java Thu Jun 25 16:49:08 2015 -0700 @@ -89,47 +89,6 @@ return Arrays.copyOfRange(b, i, b.length); } - private static KeyFactory getKeyFactory() { - try { - return KeyFactory.getInstance("EC", "SunEC"); - } catch (NoSuchAlgorithmException | NoSuchProviderException e) { - throw new RuntimeException(e); - } - } - - public static ECPublicKey decodeX509ECPublicKey(byte[] encoded) - throws InvalidKeySpecException { - KeyFactory keyFactory = getKeyFactory(); - X509EncodedKeySpec keySpec = new X509EncodedKeySpec(encoded); - - return (ECPublicKey)keyFactory.generatePublic(keySpec); - } - - public static byte[] x509EncodeECPublicKey(ECPoint w, - ECParameterSpec params) throws InvalidKeySpecException { - KeyFactory keyFactory = getKeyFactory(); - ECPublicKeySpec keySpec = new ECPublicKeySpec(w, params); - X509Key key = (X509Key)keyFactory.generatePublic(keySpec); - - return key.getEncoded(); - } - - public static ECPrivateKey decodePKCS8ECPrivateKey(byte[] encoded) - throws InvalidKeySpecException { - KeyFactory keyFactory = getKeyFactory(); - PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded); - - return (ECPrivateKey)keyFactory.generatePrivate(keySpec); - } - - public static ECPrivateKey generateECPrivateKey(BigInteger s, - ECParameterSpec params) throws InvalidKeySpecException { - KeyFactory keyFactory = getKeyFactory(); - ECPrivateKeySpec keySpec = new ECPrivateKeySpec(s, params); - - return (ECPrivateKey)keyFactory.generatePrivate(keySpec); - } - private static AlgorithmParameters getECParameters(Provider p) { try { if (p != null) {
--- a/src/share/demo/jfc/Font2DTest/FontPanel.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/demo/jfc/Font2DTest/FontPanel.java Thu Jun 25 16:49:08 2015 -0700 @@ -515,7 +515,6 @@ /// Sets the font, hints, according to the set parameters private void setParams( Graphics2D g2 ) { -System.out.println("USING FONT " + testFont + " "+testFont.getPSName()); g2.setFont( testFont ); g2.setRenderingHint(KEY_TEXT_ANTIALIASING, antiAliasType); g2.setRenderingHint(KEY_FRACTIONALMETRICS, fractionalMetricsType);
--- a/src/share/native/sun/awt/splashscreen/splashscreen_gif.c Thu Jun 25 16:46:26 2015 -0700 +++ b/src/share/native/sun/awt/splashscreen/splashscreen_gif.c Thu Jun 25 16:49:08 2015 -0700 @@ -82,8 +82,8 @@ int i, j; int imageIndex; int cx, cy, cw, ch; /* clamped coordinates */ - int numLines; - int numPassLines; + const int interlacedOffset[] = { 0, 4, 2, 1, 0 }; /* The way Interlaced image should. */ + const int interlacedJumps[] = { 8, 8, 4, 2, 1 }; /* be read - offsets and jumps... */ if (DGifSlurp(gif) == GIF_ERROR) { return 0; @@ -213,6 +213,16 @@ byte_t *pSrc = image->RasterBits; ImageFormat srcFormat; ImageRect srcRect, dstRect; + int pass = 4, npass = 5; + +#if GIFLIB_MAJOR < 5 + /* Interlaced gif support is broken in giflib < 5 + so we need to work around this */ + if (desc->Interlace) { + pass = 0; + npass = 4; + } +#endif srcFormat.colorMap = colorMapBuf; srcFormat.depthBytes = 1; @@ -221,22 +231,26 @@ srcFormat.fixedBits = QUAD_ALPHA_MASK; // fixed 100% alpha srcFormat.premultiplied = 0; - /* Number of source lines for current pass */ - numPassLines = desc->Height; - /* Number of lines that fits to dest buffer */ - numLines = ch; - - initRect(&srcRect, 0, 0, desc->Width, numLines, 1, - desc->Width, pSrc, &srcFormat); + for (; pass < npass; ++pass) { + int jump = interlacedJumps[pass]; + int ofs = interlacedOffset[pass]; + /* Number of source lines for current pass */ + int numPassLines = (desc->Height + jump - ofs - 1) / jump; + /* Number of lines that fits to dest buffer */ + int numLines = (ch + jump - ofs - 1) / jump; - if (numLines > 0) { - initRect(&dstRect, cx, cy, cw, - numLines , 1, stride, pBitmapBits, &splash->imageFormat); + initRect(&srcRect, 0, 0, desc->Width, numLines, 1, + desc->Width, pSrc, &srcFormat); - pSrc += convertRect(&srcRect, &dstRect, CVT_ALPHATEST); + if (numLines > 0) { + initRect(&dstRect, cx, cy + ofs, cw, + numLines , jump, stride, pBitmapBits, &splash->imageFormat); + + pSrc += convertRect(&srcRect, &dstRect, CVT_ALPHATEST); + } + // skip extra source data + pSrc += (numPassLines - numLines) * srcRect.stride; } - // skip extra source data - pSrc += (numPassLines - numLines) * srcRect.stride; } // now dispose of the previous frame correctly @@ -296,7 +310,13 @@ free(pBitmapBits); free(pOldBitmapBits); - DGifCloseFile(gif, NULL); +#if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1) + if (DGifCloseFile(gif, NULL) == GIF_ERROR) { + return 0; + } +#else + DGifCloseFile(gif); +#endif return 1; } @@ -304,7 +324,11 @@ int SplashDecodeGifStream(Splash * splash, SplashStream * stream) { +#if GIFLIB_MAJOR >= 5 GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc, NULL); +#else + GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc); +#endif if (!gif) return 0;
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java Thu Jun 25 16:49:08 2015 -0700 @@ -679,28 +679,33 @@ GraphicsConfiguration newGC = null; Rectangle screenBounds; - for (int i = 0; i < gds.length; i++) { - screenBounds = gds[i].getDefaultConfiguration().getBounds(); - if (newBounds.intersects(screenBounds)) { - horizAmt = Math.min(newBounds.x + newBounds.width, - screenBounds.x + screenBounds.width) - - Math.max(newBounds.x, screenBounds.x); - vertAmt = Math.min(newBounds.y + newBounds.height, - screenBounds.y + screenBounds.height)- - Math.max(newBounds.y, screenBounds.y); - intAmt = horizAmt * vertAmt; - if (intAmt == area) { - // Completely on this screen - done! - newScreenNum = i; - newGC = gds[i].getDefaultConfiguration(); - break; - } - if (intAmt > largestAmt) { - largestAmt = intAmt; - newScreenNum = i; - newGC = gds[i].getDefaultConfiguration(); + XToolkit.awtUnlock(); + try { + for (int i = 0; i < gds.length; i++) { + screenBounds = gds[i].getDefaultConfiguration().getBounds(); + if (newBounds.intersects(screenBounds)) { + horizAmt = Math.min(newBounds.x + newBounds.width, + screenBounds.x + screenBounds.width) - + Math.max(newBounds.x, screenBounds.x); + vertAmt = Math.min(newBounds.y + newBounds.height, + screenBounds.y + screenBounds.height)- + Math.max(newBounds.y, screenBounds.y); + intAmt = horizAmt * vertAmt; + if (intAmt == area) { + // Completely on this screen - done! + newScreenNum = i; + newGC = gds[i].getDefaultConfiguration(); + break; + } + if (intAmt > largestAmt) { + largestAmt = intAmt; + newScreenNum = i; + newGC = gds[i].getDefaultConfiguration(); + } } } + } finally { + XToolkit.awtLock(); } if (newScreenNum != curScreenNum) { if (log.isLoggable(PlatformLogger.Level.FINEST)) {
--- a/src/solaris/classes/sun/awt/X11GraphicsDevice.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/solaris/classes/sun/awt/X11GraphicsDevice.java Thu Jun 25 16:49:08 2015 -0700 @@ -286,7 +286,6 @@ * Returns true only if: * - the Xrandr extension is present * - the necessary Xrandr functions were loaded successfully - * - XINERAMA is not enabled */ private static synchronized boolean isXrandrExtensionSupported() { if (xrandrExtSupported == null) { @@ -318,7 +317,9 @@ @Override public boolean isDisplayChangeSupported() { - return (isFullScreenSupported() && (getFullScreenWindow() != null)); + return (isFullScreenSupported() + && !((X11GraphicsEnvironment) GraphicsEnvironment + .getLocalGraphicsEnvironment()).runningXinerama()); } private static void enterFullScreenExclusive(Window w) { @@ -348,7 +349,9 @@ if (fsSupported && old != null) { // enter windowed mode (and restore original display mode) exitFullScreenExclusive(old); - setDisplayMode(origDisplayMode); + if (isDisplayChangeSupported()) { + setDisplayMode(origDisplayMode); + } } super.setFullScreenWindow(w); @@ -431,7 +434,9 @@ Window old = getFullScreenWindow(); if (old != null) { exitFullScreenExclusive(old); - setDisplayMode(origDisplayMode); + if (isDisplayChangeSupported()) { + setDisplayMode(origDisplayMode); + } } }; Thread t = new Thread(rootTG, r,"Display-Change-Shutdown-Thread-"+screen);
--- a/src/windows/classes/sun/security/mscapi/KeyStore.java Thu Jun 25 16:46:26 2015 -0700 +++ b/src/windows/classes/sun/security/mscapi/KeyStore.java Thu Jun 25 16:49:08 2015 -0700 @@ -41,12 +41,7 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.interfaces.RSAPrivateCrtKey; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.UUID; +import java.util.*; import sun.security.action.GetPropertyAction; @@ -142,7 +137,7 @@ key.getPrimeExponentQ().toByteArray(), key.getCrtCoefficient().toByteArray()); - privateKey = storePrivateKey(keyBlob, + privateKey = storePrivateKey(Objects.requireNonNull(keyBlob), "{" + UUID.randomUUID().toString() + "}", keyBitLength); }
--- a/src/windows/native/java/lang/java_props_md.c Thu Jun 25 16:46:26 2015 -0700 +++ b/src/windows/native/java/lang/java_props_md.c Thu Jun 25 16:49:08 2015 -0700 @@ -348,8 +348,8 @@ GetJavaProperties(JNIEnv* env) { static java_props_t sprops = {0}; - - OSVERSIONINFOEX ver; + int majorVersion; + int minorVersion; if (sprops.line_separator) { return &sprops; @@ -380,21 +380,67 @@ /* OS properties */ { char buf[100]; - SYSTEM_INFO si; - PGNSI pGNSI; + boolean is_workstation; + boolean is_64bit; + DWORD platformId; + { + OSVERSIONINFOEX ver; + ver.dwOSVersionInfoSize = sizeof(ver); + GetVersionEx((OSVERSIONINFO *) &ver); + majorVersion = ver.dwMajorVersion; + minorVersion = ver.dwMinorVersion; + is_workstation = (ver.wProductType == VER_NT_WORKSTATION); + platformId = ver.dwPlatformId; + sprops.patch_level = _strdup(ver.szCSDVersion); + } - ver.dwOSVersionInfoSize = sizeof(ver); - GetVersionEx((OSVERSIONINFO *) &ver); + { + SYSTEM_INFO si; + ZeroMemory(&si, sizeof(SYSTEM_INFO)); + GetNativeSystemInfo(&si); + + is_64bit = (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64); + } + do { + // Read the major and minor version number from kernel32.dll + VS_FIXEDFILEINFO *file_info; + WCHAR kernel32_path[MAX_PATH]; + DWORD version_size; + LPTSTR version_info; + UINT len, ret; - ZeroMemory(&si, sizeof(SYSTEM_INFO)); - // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. - pGNSI = (PGNSI) GetProcAddress( - GetModuleHandle(TEXT("kernel32.dll")), - "GetNativeSystemInfo"); - if(NULL != pGNSI) - pGNSI(&si); - else - GetSystemInfo(&si); + // Get the full path to \Windows\System32\kernel32.dll and use that for + // determining what version of Windows we're running on. + len = MAX_PATH - (UINT)strlen("\\kernel32.dll") - 1; + ret = GetSystemDirectoryW(kernel32_path, len); + if (ret == 0 || ret > len) { + break; + } + wcsncat(kernel32_path, L"\\kernel32.dll", MAX_PATH - ret); + + version_size = GetFileVersionInfoSizeW(kernel32_path, NULL); + if (version_size == 0) { + break; + } + + version_info = (LPTSTR)malloc(version_size); + if (version_info == NULL) { + break; + } + + if (!GetFileVersionInfoW(kernel32_path, 0, version_size, version_info)) { + free(version_info); + break; + } + + if (!VerQueryValueW(version_info, L"\\", (LPVOID*)&file_info, &len)) { + free(version_info); + break; + } + majorVersion = HIWORD(file_info->dwProductVersionMS); + minorVersion = LOWORD(file_info->dwProductVersionMS); + free(version_info); + } while (0); /* * From msdn page on OSVERSIONINFOEX, current as of this @@ -420,17 +466,15 @@ * Windows Server 2008 R2 6 1 (!VER_NT_WORKSTATION) * Windows 8 6 2 (VER_NT_WORKSTATION) * Windows Server 2012 6 2 (!VER_NT_WORKSTATION) + * Windows 10 10 0 (VER_NT_WORKSTATION) * * This mapping will presumably be augmented as new Windows * versions are released. */ - switch (ver.dwPlatformId) { - case VER_PLATFORM_WIN32s: - sprops.os_name = "Windows 3.1"; - break; + switch (platformId) { case VER_PLATFORM_WIN32_WINDOWS: - if (ver.dwMajorVersion == 4) { - switch (ver.dwMinorVersion) { + if (majorVersion == 4) { + switch (minorVersion) { case 0: sprops.os_name = "Windows 95"; break; case 10: sprops.os_name = "Windows 98"; break; case 90: sprops.os_name = "Windows Me"; break; @@ -441,10 +485,10 @@ } break; case VER_PLATFORM_WIN32_NT: - if (ver.dwMajorVersion <= 4) { + if (majorVersion <= 4) { sprops.os_name = "Windows NT"; - } else if (ver.dwMajorVersion == 5) { - switch (ver.dwMinorVersion) { + } else if (majorVersion == 5) { + switch (minorVersion) { case 0: sprops.os_name = "Windows 2000"; break; case 1: sprops.os_name = "Windows XP"; break; case 2: @@ -459,8 +503,7 @@ * If it is, the operating system is Windows XP 64 bit; * otherwise, it is Windows Server 2003." */ - if(ver.wProductType == VER_NT_WORKSTATION && - si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { + if (is_workstation && is_64bit) { sprops.os_name = "Windows XP"; /* 64 bit */ } else { sprops.os_name = "Windows 2003"; @@ -468,12 +511,12 @@ break; default: sprops.os_name = "Windows NT (unknown)"; break; } - } else if (ver.dwMajorVersion == 6) { + } else if (majorVersion == 6) { /* * See table in MSDN OSVERSIONINFOEX documentation. */ - if (ver.wProductType == VER_NT_WORKSTATION) { - switch (ver.dwMinorVersion) { + if (is_workstation) { + switch (minorVersion) { case 0: sprops.os_name = "Windows Vista"; break; case 1: sprops.os_name = "Windows 7"; break; case 2: sprops.os_name = "Windows 8"; break; @@ -481,7 +524,7 @@ default: sprops.os_name = "Windows NT (unknown)"; } } else { - switch (ver.dwMinorVersion) { + switch (minorVersion) { case 0: sprops.os_name = "Windows Server 2008"; break; case 1: sprops.os_name = "Windows Server 2008 R2"; break; case 2: sprops.os_name = "Windows Server 2012"; break; @@ -489,6 +532,17 @@ default: sprops.os_name = "Windows NT (unknown)"; } } + } else if (majorVersion == 10) { + if (is_workstation) { + switch (minorVersion) { + case 0: sprops.os_name = "Windows 10"; break; + default: sprops.os_name = "Windows NT (unknown)"; + } + } else { + switch (minorVersion) { + default: sprops.os_name = "Windows NT (unknown)"; + } + } } else { sprops.os_name = "Windows NT (unknown)"; } @@ -497,7 +551,7 @@ sprops.os_name = "Windows (unknown)"; break; } - sprintf(buf, "%d.%d", ver.dwMajorVersion, ver.dwMinorVersion); + sprintf(buf, "%d.%d", majorVersion, minorVersion); sprops.os_version = _strdup(buf); #if _M_IA64 sprops.os_arch = "ia64"; @@ -508,9 +562,6 @@ #else sprops.os_arch = "unknown"; #endif - - sprops.patch_level = _strdup(ver.szCSDVersion); - sprops.desktop = "windows"; } @@ -621,7 +672,7 @@ &display_encoding); sprops.sun_jnu_encoding = getEncodingInternal(systemDefaultLCID); - if (LANGIDFROMLCID(userDefaultLCID) == 0x0c04 && ver.dwMajorVersion == 6) { + if (LANGIDFROMLCID(userDefaultLCID) == 0x0c04 && majorVersion == 6) { // MS claims "Vista has built-in support for HKSCS-2004. // All of the HKSCS-2004 characters have Unicode 4.1. // PUA code point assignments". But what it really means
--- a/src/windows/native/sun/security/mscapi/security.cpp Thu Jun 25 16:46:26 2015 -0700 +++ b/src/windows/native/sun/security/mscapi/security.cpp Thu Jun 25 16:49:08 2015 -0700 @@ -1659,29 +1659,36 @@ int convertToLittleEndian(JNIEnv *env, jbyteArray source, jbyte* destination, int destinationLength) { - int count = 0; int sourceLength = env->GetArrayLength(source); - if (sourceLength < destinationLength) { - return -1; - } - jbyte* sourceBytes = env->GetByteArrayElements(source, 0); if (sourceBytes == NULL) { return -1; } + int copyLen = sourceLength; + if (sourceLength > destinationLength) { + // source might include an extra sign byte + if (sourceLength == destinationLength + 1 && sourceBytes[0] == 0) { + copyLen--; + } else { + return -1; + } + } + // Copy bytes from the end of the source array to the beginning of the // destination array (until the destination array is full). // This ensures that the sign byte from the source array will be excluded. - for (int i = 0; i < destinationLength; i++) { - destination[i] = sourceBytes[sourceLength - i - 1]; - count++; + for (int i = 0; i < copyLen; i++) { + destination[i] = sourceBytes[sourceLength - 1 - i]; } - if (sourceBytes) - env->ReleaseByteArrayElements(source, sourceBytes, JNI_ABORT); + if (copyLen < destinationLength) { + memset(destination + copyLen, 0, destinationLength - copyLen); + } - return count; + env->ReleaseByteArrayElements(source, sourceBytes, JNI_ABORT); + + return destinationLength; } /*
--- a/src/windows/resource/java.manifest Thu Jun 25 16:46:26 2015 -0700 +++ b/src/windows/resource/java.manifest Thu Jun 25 16:49:08 2015 -0700 @@ -52,6 +52,8 @@ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> <!-- Windows 8.1 --> <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> + <!-- Windows 10 --> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> </application> </compatibility>
--- a/test/TEST.groups Thu Jun 25 16:46:26 2015 -0700 +++ b/test/TEST.groups Thu Jun 25 16:49:08 2015 -0700 @@ -489,6 +489,7 @@ java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java \ java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java \ java/lang/System/MacEncoding/TestFileEncoding.java \ + java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java \ java/nio/channels/AsynchronousSocketChannel/Leaky.java \ java/security/PermissionCollection/Concurrent.java \ java/security/Principal/Implies.java \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/jndi/ldap/LdapURLOptionalFields.java Thu Jun 25 16:49:08 2015 -0700 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2015, Red Hat, Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8074761 + * @summary RFC-2255 allows attribute, scope and filter to be empty. + */ + +import com.sun.jndi.ldap.LdapURL; + +public class LdapURLOptionalFields { + + private static final String[] TEST_URLS = { + "ldap://localhost:10389/ou=RefPeople,dc=example,dc=com", + "ldap://localhost:10389/ou=RefPeople,dc=example,dc=com?", + "ldap://localhost:10389/ou=RefPeople,dc=example,dc=com??", + "ldap://localhost:10389/ou=RefPeople,dc=example,dc=com???", + "ldap://localhost:10389/ou=RefPeople,dc=example,dc=com????" + }; + + public static void main(String[] args) throws Exception { + for (int i = 0; i < TEST_URLS.length; i++) { + String url = TEST_URLS[i]; + checkEmptyAttributes(url); + } + } + + private static void checkEmptyAttributes(String urlString) throws Exception { + LdapURL url = new LdapURL(urlString); + if (url.getAttributes() != null) { + throw new Exception("Expected null attributes for url: '" + urlString + "'"); + } + if (url.getScope() != null) { + throw new Exception("Expected null scope for url: '" + urlString + "'"); + } + if (url.getFilter() != null) { + throw new Exception("Expected null filter for url: '" + urlString + "'"); + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/FullScreen/MultimonFullscreenTest/MultimonDeadlockTest.java Thu Jun 25 16:49:08 2015 -0700 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @bug 8129116 + @summary Deadlock with multimonitor fullscreen windows. + @run main/timeout=20 MultimonDeadlockTest + */ +import java.awt.*; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.lang.reflect.InvocationTargetException; + +public class MultimonDeadlockTest { + + public static void main(String argv[]) { + final GraphicsDevice[] devices = GraphicsEnvironment + .getLocalGraphicsEnvironment() + .getScreenDevices(); + if (devices.length < 2) { + System.out.println("It's a multiscreen test... skipping!"); + return; + } + + Frame frames[] = new Frame[devices.length]; + try { + EventQueue.invokeAndWait(() -> { + for (int i = 0; i < devices.length; i++) { + frames[i] = new Frame(); + frames[i].setSize(100, 100); + frames[i].setBackground(Color.BLUE); + devices[i].setFullScreenWindow(frames[i]); + } + }); + Thread.sleep(5000); + } catch (InterruptedException | InvocationTargetException ex) { + } finally { + for (int i = 0; i < devices.length; i++) { + devices[i].setFullScreenWindow(null); + frames[i].dispose(); + } + } + + } +}
--- a/test/java/lang/invoke/8022701/InvokeSeveralWays.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/java/lang/invoke/8022701/InvokeSeveralWays.java Thu Jun 25 16:49:08 2015 -0700 @@ -38,12 +38,19 @@ failures++; } catch (InvocationTargetException e) { Throwable c = e.getCause(); - if (expected.isInstance(c)) - System.out.println("EXPECTED: " + expected.getName() + ", "+ c); - else { - failures++; - System.out.println("FAIL: Unexpected wrapped exception " + c); - e.printStackTrace(System.out); + if (BootstrapMethodError.class.isInstance(c)) { + c = c.getCause(); + if (expected.isInstance(c)) + System.out.println("EXPECTED: " + expected.getName() + ", "+ c); + else { + failures++; + System.out.println("FAIL: Unexpected wrapped exception " + c); + e.printStackTrace(System.out); + } + } else { + failures++; + System.out.println("FAIL: Exception from MethodHandle invocation not wrapped in BootstrapMethodError " + c); + e.printStackTrace(System.out); } } catch (Throwable e) { failures++; @@ -74,14 +81,19 @@ Invoker.invoke(); System.out.println("FAIL: No exception throw, probably failed to load modified bytecodes for MethodSupplier"); failures++; - } catch (Throwable e) { - if (expected.isInstance(e)) - System.out.println("EXPECTED: " + expected.getName() + ", "+ e); + } catch (BootstrapMethodError e) { + Throwable c = e.getCause(); + if (expected.isInstance(c)) + System.out.println("EXPECTED: " + expected.getName() + ", "+ c); else { + failures++; + System.out.println("FAIL: Unexpected exception has been caught " + c); + e.printStackTrace(System.out); + } + } catch (Throwable e) { failures++; - System.out.println("FAIL: Unexpected exception has been caught " + e); + System.out.println("FAIL: Exception from MethodHandle invocation not wrapped in BootstrapMethodError " + e); e.printStackTrace(System.out); - } } System.out.println(); try {
--- a/test/java/lang/invoke/LFCaching/LFCachingTestCase.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/java/lang/invoke/LFCaching/LFCachingTestCase.java Thu Jun 25 16:49:08 2015 -0700 @@ -77,7 +77,7 @@ } } catch (IllegalAccessException | IllegalArgumentException | SecurityException | InvocationTargetException ex) { - throw new Error("Unexpected exception: ", ex); + throw new Error("Unexpected exception", ex); } } }
--- a/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java Thu Jun 25 16:49:08 2015 -0700 @@ -59,10 +59,10 @@ super(testMethod); } - PhantomReference ph; - ReferenceQueue rq = new ReferenceQueue(); - MethodType mtype; - Map<String, Object> data; + PhantomReference ph; + ReferenceQueue rq = new ReferenceQueue(); + MethodType mtype; + Map<String, Object> data; @Override public void doTest() { @@ -73,7 +73,7 @@ try { adapter = testCase.getTestCaseMH(data, TestMethods.Kind.ONE); } catch (NoSuchMethodException ex) { - throw new Error("Unexpected exception: ", ex); + throw new Error("Unexpected exception", ex); } mtype = adapter.type(); Object lambdaForm = INTERNAL_FORM.invoke(adapter); @@ -94,12 +94,12 @@ collectLambdaForm(); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { - throw new Error("Unexpected exception: ", ex); + throw new Error("Unexpected exception", ex); } } private void collectLambdaForm() throws IllegalAccessException { - // Usually, 2 System.GCs are necessary to enqueue a SoftReference. + // Usually, 2 System.GCs are necessary to enqueue a SoftReference. System.gc(); System.gc(); @@ -129,7 +129,7 @@ }; } - private void dumpTestData() { + private void dumpTestData() { System.err.println("Test case: " + getTestMethod()); for (String s : data.keySet()) { System.err.printf("\t%20s => %s\n", s, data.get(s));
--- a/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,18 +35,23 @@ */ import java.lang.invoke.MethodHandle; +import java.util.Collections; import java.util.EnumSet; +import java.util.HashMap; import java.util.Map; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.CyclicBarrier; +import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor; /** * Multiple threaded lambda forms caching test class. */ public final class LFMultiThreadCachingTest extends LFCachingTestCase { + private static final TestMethods.Kind[] KINDS; + static { EnumSet<TestMethods.Kind> set = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT)); KINDS = set.toArray(new TestMethods.Kind[set.size()]); @@ -72,21 +77,50 @@ ConcurrentLinkedQueue<MethodHandle> adapters = new ConcurrentLinkedQueue<>(); CyclicBarrier begin = new CyclicBarrier(CORES); CountDownLatch end = new CountDownLatch(CORES); + final Map<Thread, Throwable> threadUncaughtExceptions + = Collections.synchronizedMap(new HashMap<Thread, Throwable>(CORES)); for (int i = 0; i < CORES; ++i) { TestMethods.Kind kind = KINDS[i % KINDS.length]; - new Thread(() -> { + Thread t = new Thread(() -> { try { begin.await(); adapters.add(getTestMethod().getTestCaseMH(data, kind)); - } catch (InterruptedException | BrokenBarrierException | IllegalAccessException | NoSuchMethodException ex) { - throw new Error("Unexpected exception: ", ex); + } catch (Throwable ex) { + threadUncaughtExceptions.put(Thread.currentThread(), ex); } finally { end.countDown(); } - }).start(); + }); + t.start(); } try { end.await(); + boolean vmeThrown = false; + boolean nonVmeThrown = false; + Throwable vme = null; + for (Map.Entry<Thread, + Throwable> entry : threadUncaughtExceptions.entrySet()) { + Thread t = entry.getKey(); + Throwable e = entry.getValue(); + System.err.printf("%nA thread with name \"%s\" of %d threads" + + " has thrown exception:%n", t.getName(), CORES); + e.printStackTrace(); + if (CodeCacheOverflowProcessor.isThrowableCausedByVME(e)) { + vmeThrown = true; + vme = e; + } else { + nonVmeThrown = true; + } + if (nonVmeThrown) { + throw new Error("One ore more threads have" + + " thrown unexpected exceptions. See log."); + } + if (vmeThrown) { + throw new Error("One ore more threads have" + + " thrown VirtualMachineError caused by" + + " code cache overflow. See log.", vme); + } + } } catch (InterruptedException ex) { throw new Error("Unexpected exception: ", ex); }
--- a/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,7 @@ adapter1 = getTestMethod().getTestCaseMH(data, TestMethods.Kind.ONE); adapter2 = getTestMethod().getTestCaseMH(data, TestMethods.Kind.TWO); } catch (NoSuchMethodException | IllegalAccessException ex) { - throw new Error("Unexpected exception: ", ex); + throw new Error("Unexpected exception", ex); } checkLFCaching(adapter1, adapter2); }
--- a/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,8 +22,7 @@ */ import com.oracle.testlibrary.jsr292.Helper; -import com.sun.management.HotSpotDiagnosticMXBean; - +import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor; import java.lang.invoke.MethodHandle; import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementFactory; @@ -45,8 +44,6 @@ */ public abstract class LambdaFormTestCase { - private static final double ITERATIONS_TO_CODE_CACHE_SIZE_RATIO - = 45 / (128.0 * 1024 * 1024); private static final long TIMEOUT = Helper.IS_THOROUGH ? 0L : (long) (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) * 0.9); /** @@ -73,23 +70,89 @@ REF_FIELD = Reference.class.getDeclaredField("referent"); REF_FIELD.setAccessible(true); } catch (Exception ex) { - throw new Error("Unexpected exception: ", ex); + throw new Error("Unexpected exception", ex); } gcInfo = ManagementFactory.getGarbageCollectorMXBeans(); - if (gcInfo.size() == 0) { + if (gcInfo.size() == 0) { throw new Error("No GarbageCollectorMXBeans found."); } } private final TestMethods testMethod; - private static long totalIterations = 0L; - private static long doneIterations = 0L; - private static boolean passed = true; - private static int testCounter = 0; - private static int failCounter = 0; private long gcCountAtStart; + private static class TestRun { + + final Function<TestMethods, LambdaFormTestCase> ctor; + final Collection<TestMethods> testMethods; + final long totalIterations; + long doneIterations; + long testCounter; + long failCounter; + boolean passed; + + TestRun(Function<TestMethods, LambdaFormTestCase> ctor, Collection<TestMethods> testMethods) { + this.ctor = ctor; + this.testMethods = testMethods; + long testCaseNum = testMethods.size(); + long iterations = Math.max(1, Helper.TEST_LIMIT / testCaseNum); + System.out.printf("Number of iterations according to -DtestLimit is %d (%d cases)%n", + iterations, iterations * testCaseNum); + System.out.printf("Number of iterations is set to %d (%d cases)%n", + iterations, iterations * testCaseNum); + System.out.flush(); + totalIterations = iterations; + doneIterations = 0L; + testCounter = 0L; + failCounter = 0L; + passed = true; + } + + Boolean doIteration() { + if (doneIterations >= totalIterations) { + return false; + } + System.err.println(String.format("Iteration %d:", doneIterations)); + for (TestMethods testMethod : testMethods) { + LambdaFormTestCase testCase = ctor.apply(testMethod); + try { + System.err.printf("Tested LF caching feature" + + " with MethodHandles.%s method.%n", + testCase.getTestMethod().name); + Throwable t = CodeCacheOverflowProcessor + .runMHTest(testCase::doTest); + if (t != null) { + return false; + } + System.err.println("PASSED"); + } catch (OutOfMemoryError oome) { + // Don't swallow OOME so a heap dump can be created. + System.err.println("FAILED"); + throw oome; + } catch (Throwable t) { + t.printStackTrace(); + System.err.printf("FAILED. Caused by %s%n", t.getMessage()); + passed = false; + failCounter++; + } + testCounter++; + } + doneIterations++; + return true; + } + + void checkPassed() { + if (!passed) { + throw new Error(String.format("%d of %d test cases FAILED! %n" + + "Rerun the test with the same \"-Dseed=\" option as in the log file!", + failCounter, testCounter)); + } else { + System.err.printf("All %d test cases PASSED!%n", testCounter); + } + } + } + /** * Test case constructor. Generates test cases with random method types for * given methods form {@code j.l.i.MethodHandles} class. @@ -123,65 +186,15 @@ * @param testMethods list of test methods */ public static void runTests(Function<TestMethods, LambdaFormTestCase> ctor, Collection<TestMethods> testMethods) { - long testCaseNum = testMethods.size(); - totalIterations = Math.max(1, Helper.TEST_LIMIT / testCaseNum); - System.out.printf("Number of iterations according to -DtestLimit is %d (%d cases)%n", - totalIterations, totalIterations * testCaseNum); - HotSpotDiagnosticMXBean hsDiagBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class); - long codeCacheSize = Long.parseLong( - hsDiagBean.getVMOption("ReservedCodeCacheSize").getValue()); - System.out.printf("Code Cache Size is %d bytes%n", codeCacheSize); - long iterationsByCodeCacheSize = (long) (codeCacheSize - * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO); - System.out.printf("Number of iterations limited by code cache size is %d (%d cases)%n", - iterationsByCodeCacheSize, iterationsByCodeCacheSize * testCaseNum); - if (totalIterations > iterationsByCodeCacheSize) { - totalIterations = iterationsByCodeCacheSize; - } - System.out.printf("Number of iterations is set to %d (%d cases)%n", - totalIterations, totalIterations * testCaseNum); - System.out.flush(); - TimeLimitedRunner runner = new TimeLimitedRunner(TIMEOUT, 4.0d, - () -> { - if (doneIterations >= totalIterations) { - return false; - } - System.err.println(String.format("Iteration %d:", doneIterations)); - for (TestMethods testMethod : testMethods) { - LambdaFormTestCase testCase = ctor.apply(testMethod); - try { - System.err.printf("Tested LF caching feature with MethodHandles.%s method.%n", - testCase.getTestMethod().name); - testCase.doTest(); - System.err.println("PASSED"); - } catch (OutOfMemoryError e) { - // Don't swallow OOME so a heap dump can be created. - System.err.println("FAILED"); - throw e; - } catch (Throwable t) { - t.printStackTrace(); - System.err.println("FAILED"); - passed = false; - failCounter++; - } - testCounter++; - } - doneIterations++; - return true; - }); + LambdaFormTestCase.TestRun run + = new LambdaFormTestCase.TestRun(ctor, testMethods); + TimeLimitedRunner runner = new TimeLimitedRunner(TIMEOUT, 4.0d, run::doIteration); try { runner.call(); - } catch (Throwable t) { - t.printStackTrace(); + } catch (Exception ex) { System.err.println("FAILED"); - throw new Error("Unexpected error!"); + throw new Error("Unexpected error!", ex); } - if (!passed) { - throw new Error(String.format("%d of %d test cases FAILED! %n" - + "Rerun the test with the same \"-Dseed=\" option as in the log file!", - failCounter, testCounter)); - } else { - System.err.println(String.format("All %d test cases PASSED!", testCounter)); - } + run.checkPassed(); } }
--- a/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,10 @@ package test.java.lang.invoke.MethodHandles; import com.oracle.testlibrary.jsr292.Helper; +import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor; import jdk.testlibrary.Asserts; +import jdk.testlibrary.TimeLimitedRunner; +import jdk.testlibrary.Utils; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; @@ -37,10 +40,10 @@ /* @test * @library /lib/testlibrary/jsr292 /lib/testlibrary/ * @compile CatchExceptionTest.java - * @build jdk.testlibrary.* * @run main/othervm -esa test.java.lang.invoke.MethodHandles.CatchExceptionTest */ public class CatchExceptionTest { + private static final List<Class<?>> ARGS_CLASSES; protected static final int MAX_ARITY = Helper.MAX_ARITY - 1; @@ -69,12 +72,6 @@ final int catchDrops) { this.testCase = testCase; this.dropped = catchDrops; - if (Helper.IS_VERBOSE) { - System.out.printf("CatchException::CatchException(%s, isVararg=%b " + - "argsCount=%d catchDrops=%d)%n", - testCase, isVararg, argsCount, catchDrops - ); - } MethodHandle thrower = testCase.thrower; int throwerLen = thrower.type().parameterCount(); List<Class<?>> classes; @@ -94,21 +91,34 @@ } public static void main(String[] args) throws Throwable { + CodeCacheOverflowProcessor.runMHTest(CatchExceptionTest::test); + } + + public static void test() throws Throwable { + System.out.println("classes = " + ARGS_CLASSES); + TestFactory factory = new TestFactory(); + long timeout = Helper.IS_THOROUGH ? 0L : Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT); + // subtract vm init time and reserve time for vm exit + timeout *= 0.9; + TimeLimitedRunner runner = new TimeLimitedRunner(timeout, 2.0d, + () -> { + CatchExceptionTest test = factory.nextTest(); + if (test != null) { + test.runTest(); + return true; + } + return false; + }); for (CatchExceptionTest test : TestFactory.MANDATORY_TEST_CASES) { test.runTest(); } - TestFactory factory = new TestFactory(); - CatchExceptionTest test; - while ((test = factory.nextTest()) != null ) { - test.runTest(); - } + runner.call(); } private List<Class<?>> getThrowerParams(boolean isVararg, int argsCount) { return Helper.getParams(ARGS_CLASSES, isVararg, argsCount); } - private List<Class<?>> getCatcherParams() { int catchArgc = 1 + this.argsCount - dropped; List<Class<?>> result = new ArrayList<>( @@ -119,6 +129,13 @@ } private void runTest() { + if (Helper.IS_VERBOSE) { + System.out.printf("CatchException(%s, isVararg=%b argsCount=%d " + + "dropped=%d)%n", + testCase, thrower.isVarargsCollector(), + argsCount, dropped); + } + Helper.clear(); Object[] args = Helper.randomArgs( @@ -172,7 +189,7 @@ {CatchExceptionTest.MAX_ARITY, 0}, {CatchExceptionTest.MAX_ARITY, CatchExceptionTest.MAX_ARITY}, }) { - MANDATORY_TEST_CASES.addAll(createTests(args[0], args[1])); + MANDATORY_TEST_CASES.addAll(createTests(args[0], args[1])); } } @@ -200,10 +217,7 @@ args = 1; } - if (Helper.IS_VERBOSE) { - System.out.printf("maxArgs = %d%nmaxDrops = %d%n", - maxArgs, maxDrops); - } + System.out.printf("maxArgs = %d%nmaxDrops = %d%n", maxArgs, maxDrops); constructorSize = TestCase.CONSTRUCTORS.size(); } @@ -230,8 +244,9 @@ } /** - * @return next test from test matrix: - * {varArgs, noVarArgs} x TestCase.rtypes x TestCase.THROWABLES x {1, .., maxArgs } x {1, .., maxDrops} + * @return next test from test matrix: {varArgs, noVarArgs} x + * TestCase.rtypes x TestCase.THROWABLES x {1, .., maxArgs } x + * {0, .., maxDrops} */ public CatchExceptionTest nextTest() { if (constructor < constructorSize) { @@ -244,7 +259,7 @@ return null; } if (dropArgs <= currentMaxDrops) { - if (dropArgs == 1) { + if (dropArgs == 0) { if (Helper.IS_THOROUGH || Helper.RNG.nextBoolean()) { ++dropArgs; return createTest(); @@ -259,8 +274,8 @@ } } - if (args <= maxArgs) { - dropArgs = 1; + if (args < maxArgs) { + dropArgs = 0; currentMaxDrops = Math.min(args, maxDrops); ++args; return createTest(); @@ -274,17 +289,17 @@ TestCase.CONSTRUCTORS.get(constructor++).get(), Helper.RNG.nextBoolean(), args, dropArgs); } else { - if (isVararg) { - isVararg = false; - return new CatchExceptionTest( - TestCase.CONSTRUCTORS.get(constructor++).get(), - isVararg, args, dropArgs); - } else { - isVararg = true; - return new CatchExceptionTest( - TestCase.CONSTRUCTORS.get(constructor).get(), - isVararg, args, dropArgs); - } + if (isVararg) { + isVararg = false; + return new CatchExceptionTest( + TestCase.CONSTRUCTORS.get(constructor++).get(), + isVararg, args, dropArgs); + } else { + isVararg = true; + return new CatchExceptionTest( + TestCase.CONSTRUCTORS.get(constructor).get(), + isVararg, args, dropArgs); + } } } } @@ -412,7 +427,7 @@ } private static <T extends Throwable> - Object throwOrReturn(Object normal, T exception) throws T { + Object throwOrReturn(Object normal, T exception) throws T { if (exception != null) { Helper.called("throwOrReturn/throw", normal, exception); throw exception; @@ -421,8 +436,7 @@ return normal; } - private static <T extends Throwable> - Object catcher(Object o) { + private static <T extends Throwable> Object catcher(Object o) { Helper.called("catcher", o); return o; } @@ -433,7 +447,7 @@ public MethodHandle getCatcher(List<Class<?>> classes) { return MethodHandles.filterReturnValue(Helper.AS_LIST.asType( - MethodType.methodType(Object.class, classes)), + MethodType.methodType(Object.class, classes)), CATCHER ); }
--- a/test/java/lang/invoke/MethodHandlesTest.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/java/lang/invoke/MethodHandlesTest.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandles + * @library /lib/testlibrary /lib/testlibrary/jsr292 * @compile MethodHandlesTest.java remote/RemoteExample.java * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -esa test.java.lang.invoke.MethodHandlesTest */ @@ -36,6 +37,7 @@ import java.util.*; import org.junit.*; import static org.junit.Assert.*; +import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor; /** @@ -499,6 +501,10 @@ @Test public void testFindStatic() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindStatic0); + } + + public void testFindStatic0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("findStatic"); testFindStatic(PubExample.class, void.class, "s0"); @@ -586,6 +592,10 @@ @Test public void testFindVirtual() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindVirtual0); + } + + public void testFindVirtual0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("findVirtual"); testFindVirtual(Example.class, void.class, "v0"); @@ -616,6 +626,10 @@ @Test public void testFindVirtualClone() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindVirtualClone0); + } + + public void testFindVirtualClone0() throws Throwable { // test some ad hoc system methods testFindVirtual(false, PUBLIC, Object.class, Object.class, "clone"); testFindVirtual(true, PUBLIC, Object[].class, Object.class, "clone"); @@ -699,6 +713,10 @@ @Test public void testFindSpecial() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindSpecial0); + } + + public void testFindSpecial0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("findSpecial"); testFindSpecial(SubExample.class, Example.class, void.class, "v0"); @@ -775,6 +793,10 @@ @Test public void testFindConstructor() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindConstructor0); + } + + public void testFindConstructor0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("findConstructor"); testFindConstructor(true, EXAMPLE, Example.class); @@ -818,6 +840,10 @@ @Test public void testBind() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testBind0); + } + + public void testBind0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("bind"); testBind(Example.class, void.class, "v0"); @@ -879,6 +905,10 @@ @Test public void testUnreflect() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testUnreflect0); + } + + public void testUnreflect0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("unreflect"); testUnreflect(Example.class, true, void.class, "s0"); @@ -985,6 +1015,10 @@ @Test public void testUnreflectSpecial() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testUnreflectSpecial0); + } + + public void testUnreflectSpecial0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("unreflectSpecial"); testUnreflectSpecial(Example.class, Example.class, void.class, "v0"); @@ -1077,23 +1111,38 @@ @Test public void testUnreflectGetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testUnreflectGetter0); + } + + public void testUnreflectGetter0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("unreflectGetter"); testGetter(TEST_UNREFLECT); } + @Test public void testFindGetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindGetter0); + } + + public void testFindGetter0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("findGetter"); testGetter(TEST_FIND_FIELD); testGetter(TEST_FIND_FIELD | TEST_BOUND); } + @Test public void testFindStaticGetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindStaticGetter0); + } + + public void testFindStaticGetter0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("findStaticGetter"); testGetter(TEST_FIND_STATIC); } + public void testGetter(int testMode) throws Throwable { Lookup lookup = PRIVATE; // FIXME: test more lookups than this one for (Object[] c : HasFields.CASES) { @@ -1287,26 +1336,40 @@ } } - @Test public void testUnreflectSetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testUnreflectSetter0); + } + + public void testUnreflectSetter0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("unreflectSetter"); testSetter(TEST_UNREFLECT); } + @Test public void testFindSetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindSetter0); + } + + public void testFindSetter0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("findSetter"); testSetter(TEST_FIND_FIELD); testSetter(TEST_FIND_FIELD | TEST_BOUND); } + @Test public void testFindStaticSetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFindStaticSetter0); + } + + public void testFindStaticSetter0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("findStaticSetter"); testSetter(TEST_FIND_STATIC); } + public void testSetter(int testMode) throws Throwable { Lookup lookup = PRIVATE; // FIXME: test more lookups than this one startTest("unreflectSetter"); @@ -1329,6 +1392,10 @@ @Test public void testArrayElementGetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testArrayElementGetter0); + } + + public void testArrayElementGetter0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("arrayElementGetter"); testArrayElementGetterSetter(false); @@ -1336,6 +1403,10 @@ @Test public void testArrayElementSetter() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testArrayElementSetter0); + } + + public void testArrayElementSetter0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("arrayElementSetter"); testArrayElementGetterSetter(true); @@ -1349,6 +1420,10 @@ @Test public void testArrayElementErrors() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testArrayElementErrors0); + } + + public void testArrayElementErrors0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("arrayElementErrors"); testArrayElementGetterSetter(false, TEST_ARRAY_NPE); @@ -1528,6 +1603,10 @@ @Test public void testConvertArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testConvertArguments0); + } + + public void testConvertArguments0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("convertArguments"); testConvert(Callee.ofType(1), null, "id", int.class); @@ -1591,6 +1670,10 @@ @Test public void testVarargsCollector() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testVarargsCollector0); + } + + public void testVarargsCollector0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("varargsCollector"); MethodHandle vac0 = PRIVATE.findStatic(MethodHandlesTest.class, "called", @@ -1605,8 +1688,12 @@ } } - @Test // SLOW + @Test // SLOW public void testPermuteArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testPermuteArguments0); + } + + public void testPermuteArguments0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("permuteArguments"); testPermuteArguments(4, Integer.class, 2, long.class, 6); @@ -1744,8 +1831,12 @@ } - @Test // SLOW + @Test // SLOW public void testSpreadArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testSpreadArguments0); + } + + public void testSpreadArguments0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("spreadArguments"); for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { @@ -1838,8 +1929,12 @@ } } - @Test // SLOW + @Test // SLOW public void testAsCollector() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testAsCollector0); + } + + public void testAsCollector0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("asCollector"); for (Class<?> argType : new Class<?>[]{Object.class, Integer.class, int.class}) { @@ -1880,8 +1975,12 @@ assertArrayEquals(collectedArgs, returnValue); } - @Test // SLOW + @Test // SLOW public void testInsertArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testInsertArguments0); + } + + public void testInsertArguments0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("insertArguments"); for (int nargs = 0; nargs < 50; nargs++) { @@ -1923,6 +2022,10 @@ @Test public void testFilterReturnValue() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFilterReturnValue0); + } + + public void testFilterReturnValue0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("filterReturnValue"); Class<?> classOfVCList = varargsList(1).invokeWithArguments(0).getClass(); @@ -1972,6 +2075,10 @@ @Test public void testFilterArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFilterArguments0); + } + + public void testFilterArguments0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("filterArguments"); for (int nargs = 1; nargs <= 6; nargs++) { @@ -2004,6 +2111,10 @@ @Test public void testCollectArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testCollectArguments0); + } + + public void testCollectArguments0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("collectArguments"); testFoldOrCollectArguments(true); @@ -2011,6 +2122,10 @@ @Test public void testFoldArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testFoldArguments0); + } + + public void testFoldArguments0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("foldArguments"); testFoldOrCollectArguments(false); @@ -2112,6 +2227,10 @@ @Test public void testDropArguments() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testDropArguments0); + } + + public void testDropArguments0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("dropArguments"); for (int nargs = 0; nargs <= 4; nargs++) { @@ -2143,6 +2262,10 @@ @Test // SLOW public void testInvokers() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testInvokers0); + } + + public void testInvokers0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("exactInvoker, genericInvoker, varargsInvoker, dynamicInvoker"); // exactInvoker, genericInvoker, varargsInvoker[0..N], dynamicInvoker @@ -2344,6 +2467,10 @@ @Test public void testGuardWithTest() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testGuardWithTest0); + } + + public void testGuardWithTest0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("guardWithTest"); for (int nargs = 0; nargs <= 50; nargs++) { @@ -2415,6 +2542,10 @@ @Test public void testThrowException() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testThrowException0); + } + + public void testThrowException0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("throwException"); testThrowException(int.class, new ClassCastException("testing")); @@ -2446,6 +2577,10 @@ @Test public void testInterfaceCast() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testInterfaceCast0); + } + + public void testInterfaceCast0() throws Throwable { //if (CAN_SKIP_WORKING) return; startTest("interfaceCast"); assert( (((Object)"foo") instanceof CharSequence)); @@ -2543,6 +2678,10 @@ @Test // SLOW public void testCastFailure() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testCastFailure0); + } + + public void testCastFailure0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("testCastFailure"); testCastFailure("cast/argument", 11000); @@ -2655,6 +2794,10 @@ @Test public void testUserClassInSignature() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testUserClassInSignature0); + } + + public void testUserClassInSignature0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("testUserClassInSignature"); Lookup lookup = MethodHandles.lookup(); @@ -2706,6 +2849,10 @@ @Test public void testAsInterfaceInstance() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testAsInterfaceInstance0); + } + + public void testAsInterfaceInstance0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("asInterfaceInstance"); Lookup lookup = MethodHandles.lookup(); @@ -2869,6 +3016,10 @@ @Test public void testRunnableProxy() throws Throwable { + CodeCacheOverflowProcessor.runMHTest(this::testRunnableProxy0); + } + + public void testRunnableProxy0() throws Throwable { if (CAN_SKIP_WORKING) return; startTest("testRunnableProxy"); MethodHandles.Lookup lookup = MethodHandles.lookup();
--- a/test/java/lang/invoke/TestCatchExceptionWithVarargs.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/java/lang/invoke/TestCatchExceptionWithVarargs.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,12 @@ /* * @test * @bug 8019184 + * @library /lib/testlibrary /lib/testlibrary/jsr292 * @summary MethodHandles.catchException() fails when methods have 8 args + varargs + * @run main TestCatchExceptionWithVarargs */ +import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor; import java.util.*; import java.lang.invoke.*; @@ -68,6 +71,11 @@ } public static void main(String[] args) throws Throwable { + CodeCacheOverflowProcessor + .runMHTest(TestCatchExceptionWithVarargs::test); + } + + public static void test() throws Throwable { List<Class<?>> ptypes = new LinkedList<>(); ptypes.add(Object[].class);
--- a/test/java/lang/invoke/VarargsArrayTest.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/java/lang/invoke/VarargsArrayTest.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ package java.lang.invoke; import sun.invoke.util.Wrapper; - import java.util.Arrays; import java.util.Collections; +import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor; /* @test * @summary unit tests for varargs array methods: MethodHandleInfo.varargsArray(int), * MethodHandleInfo.varargsArray(Class,int) & MethodHandleInfo.varargsList(int) - * + * @library /lib/testlibrary /lib/testlibrary/jsr292 * @run main/bootclasspath java.lang.invoke.VarargsArrayTest * @run main/bootclasspath -DVarargsArrayTest.MAX_ARITY=255 -DVarargsArrayTest.START_ARITY=250 * java.lang.invoke.VarargsArrayTest @@ -47,6 +47,10 @@ private static final boolean EXHAUSTIVE = Boolean.getBoolean(CLASS.getSimpleName()+".EXHAUSTIVE"); public static void main(String[] args) throws Throwable { + CodeCacheOverflowProcessor.runMHTest(VarargsArrayTest::test); + } + + public static void test() throws Throwable { testVarargsArray(); testVarargsReferenceArray(); testVarargsPrimitiveArray();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/concurrent/LinkedTransferQueue/SpliteratorTraverseAddRemoveTest.java Thu Jun 25 16:49:08 2015 -0700 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @run testng SpliteratorTraverseAddRemoveTest + * @bug 8085978 + * @summary repeatedly traverse the queue using the spliterator while + * concurrently adding and removing an element to test that self-linked + * nodes are never erroneously reported on traversal + */ + +import org.testng.Assert; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.Queue; +import java.util.Spliterator; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.LinkedTransferQueue; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Consumer; + +@Test +public class SpliteratorTraverseAddRemoveTest { + + static Object[] of(String desc, Consumer<Queue<?>> c) { + return new Object[]{desc, c}; + } + + static void assertIsString(Object e) { + Assert.assertTrue(e instanceof String, + String.format("Object instanceof %s (actual: instanceof %s)", + String.class.getName(), + e.getClass().getName())); + } + + @DataProvider() + public static Object[][] spliteratorTraversers() { + return new Object[][]{ + of("forEachRemaining", q -> { + q.spliterator().forEachRemaining(SpliteratorTraverseAddRemoveTest::assertIsString); + }), + of("tryAdvance", q -> { + Spliterator<?> s = q.spliterator(); + while (s.tryAdvance(SpliteratorTraverseAddRemoveTest::assertIsString)) + ; + }), + of("trySplit then forEachRemaining", q -> { + Spliterator<?> r = q.spliterator(); + + List<Spliterator<?>> ss = new ArrayList<>(); + Spliterator<?> l; + while ((l = r.trySplit()) != null) { + ss.add(l); + } + ss.add(r); + + ss.forEach(s -> s.forEachRemaining(SpliteratorTraverseAddRemoveTest::assertIsString)); + }), + }; + } + + @Test(dataProvider = "spliteratorTraversers") + public void testQueue(String desc, Consumer<Queue<String>> c) + throws InterruptedException { + AtomicBoolean done = new AtomicBoolean(false); + Queue<String> msgs = new LinkedTransferQueue<>(); + + CompletableFuture<Void> traversalTask = CompletableFuture.runAsync(() -> { + while (!done.get()) { + // Traversal will fail if self-linked nodes of + // LinkedTransferQueue are erroneously reported + c.accept(msgs); + } + }); + CompletableFuture<Void> addAndRemoveTask = CompletableFuture.runAsync(() -> { + while (!traversalTask.isDone()) { + msgs.add("msg"); + msgs.remove("msg"); + } + }); + + Thread.sleep(TimeUnit.SECONDS.toMillis(1)); + done.set(true); + + addAndRemoveTask.join(); + Assert.assertTrue(traversalTask.isDone()); + traversalTask.join(); + } +}
--- a/test/javax/net/ssl/ciphersuites/DisabledAlgorithms.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/javax/net/ssl/ciphersuites/DisabledAlgorithms.java Thu Jun 25 16:49:08 2015 -0700 @@ -104,6 +104,8 @@ default: throw new RuntimeException("Wrong parameter: " + args[0]); } + + System.out.println("Test passed"); } /* @@ -128,7 +130,6 @@ } } - server.stop(); while (server.isRunning()) { sleep(); } @@ -224,11 +225,19 @@ } catch (SSLHandshakeException e) { System.out.println("Server: run: " + e); sslError = true; + stopped = true; } catch (IOException e) { if (!stopped) { - System.out.println("Server: run: " + e); + System.out.println("Server: run: unexpected exception: " + + e); e.printStackTrace(); otherError = true; + stopped = true; + } else { + System.out.println("Server: run: " + e); + System.out.println("The exception above occurred " + + "because socket was closed, " + + "please ignore it"); } } } @@ -261,6 +270,7 @@ stopped = true; if (!ssocket.isClosed()) { try { + System.out.println("Server: close socket"); ssocket.close(); } catch (IOException e) { System.out.println("Server: close: " + e);
--- a/test/lib/testlibrary/jdk/testlibrary/Utils.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/lib/testlibrary/jdk/testlibrary/Utils.java Thu Jun 25 16:49:08 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,7 @@ import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.concurrent.TimeUnit; +import java.util.function.Function; /** * Common library for various test helper functions. @@ -276,4 +277,38 @@ public static long adjustTimeout(long tOut) { return Math.round(tOut * Utils.TIMEOUT_FACTOR); } + + /** + * Interface same as java.lang.Runnable but with + * method {@code run()} able to throw any Throwable. + */ + public static interface ThrowingRunnable { + void run() throws Throwable; + } + + /** + * Filters out an exception that may be thrown by the given + * test according to the given filter. + * + * @param test - method that is invoked and checked for exception. + * @param filter - function that checks if the thrown exception matches + * criteria given in the filter's implementation. + * @return - exception that matches the filter if it has been thrown or + * {@code null} otherwise. + * @throws Throwable - if test has thrown an exception that does not + * match the filter. + */ + public static Throwable filterException(ThrowingRunnable test, + Function<Throwable, Boolean> filter) throws Throwable { + try { + test.run(); + } catch (Throwable t) { + if (filter.apply(t)) { + return t; + } else { + throw t; + } + } + return null; + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/lib/testlibrary/jsr292/com/oracle/testlibrary/jsr292/CodeCacheOverflowProcessor.java Thu Jun 25 16:49:08 2015 -0700 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.testlibrary.jsr292; + +import jdk.testlibrary.Utils; + +/** + * Helper class used to catch and process VirtualMachineError with message "Out + * of space in CodeCache". Some JSR292 tests run out of code cache size, so code + * cache overflows and VME is thrown. This VME is considered as non-critical in + * some JSR292 tests, so it should be processed to prevent test failure. + */ +public class CodeCacheOverflowProcessor { + + /** + * Checks if an instance of Throwable is caused by VirtualMachineError with + * message "Out of space in CodeCache". May be used as filter in method + * {@code jdk.testlibrary.Utils.filterException}. + * + * @param t - Throwable to check. + * @return true if Throwable is caused by VME, false otherwise. + */ + public static Boolean isThrowableCausedByVME(Throwable t) { + Throwable causeOfT = t; + do { + if (causeOfT instanceof VirtualMachineError + && causeOfT.getMessage().matches(".*[Oo]ut of space" + + " in CodeCache.*")) { + return true; + } + causeOfT = causeOfT != null ? causeOfT.getCause() : null; + } while (causeOfT != null && causeOfT != t); + return false; + } + + /** + * Checks if the given test throws an exception caused by + * VirtualMachineError with message "Out of space in CodeCache", and, if VME + * takes place, processes it so that no exception is thrown, and prints its + * stack trace. If test throws exception not caused by VME, this method just + * re-throws this exception. + * + * @param test - test to check for and process VirtualMachineError. + * @return - an exception caused by VME or null + * if test has thrown no exception. + * @throws Throwable - if test has thrown an exception + * that is not caused by VME. + */ + public static Throwable runMHTest(Utils.ThrowingRunnable test) throws Throwable { + Throwable t = Utils.filterException(test::run, + CodeCacheOverflowProcessor::isThrowableCausedByVME); + if (t != null) { + System.err.printf("%nNon-critical exception caught becuse of" + + " code cache size is not enough to run all test cases.%n%n"); + t.printStackTrace(); + } + return t; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/mscapi/SmallPrimeExponentP.java Thu Jun 25 16:49:08 2015 -0700 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import sun.security.tools.keytool.CertAndKeyGen; +import sun.security.x509.X500Name; + +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.security.interfaces.RSAPrivateCrtKey; +import java.util.HashSet; +import java.util.Set; + +/* + * @test + * @bug 8023546 + * @summary sun/security/mscapi/ShortRSAKey1024.sh fails intermittently + */ +public class SmallPrimeExponentP { + + public static void main(String argv[]) throws Exception { + + String osName = System.getProperty("os.name"); + if (!osName.startsWith("Windows")) { + System.out.println("Not windows"); + return; + } + KeyStore ks = KeyStore.getInstance("Windows-MY"); + ks.load(null, null); + CertAndKeyGen ckg = new CertAndKeyGen("RSA", "SHA1withRSA"); + ckg.setRandom(new SecureRandom()); + boolean see63 = false, see65 = false; + while (!see63 || !see65) { + ckg.generate(1024); + RSAPrivateCrtKey k = (RSAPrivateCrtKey) ckg.getPrivateKey(); + int len = k.getPrimeExponentP().toByteArray().length; + if (len == 63 || len == 65) { + if (len == 63) { + if (see63) continue; + else see63 = true; + } + if (len == 65) { + if (see65) continue; + else see65 = true; + } + System.err.print(len); + ks.setKeyEntry("anything", k, null, new X509Certificate[]{ + ckg.getSelfCertificate(new X500Name("CN=Me"), 1000) + }); + } + System.err.print('.'); + } + ks.store(null, null); + } +}
--- a/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java Thu Jun 25 16:46:26 2015 -0700 +++ b/test/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java Thu Jun 25 16:49:08 2015 -0700 @@ -28,7 +28,7 @@ /* * @test - * @bug 6405536 + * @bug 6405536 8080102 * @summary Verify that all ciphersuites work (incl. ECC using NSS crypto) * @author Andreas Sterbenz * @library .. @@ -49,13 +49,29 @@ cmdArgs = args; main(new ClientJSSEServerJSSE()); + // now test without SunEC Provider + System.setProperty("testWithoutSunEC", "true"); + main(new ClientJSSEServerJSSE()); + } public void main(Provider p) throws Exception { + String testWithoutSunEC = System.getProperty("testWithoutSunEC"); if (p.getService("KeyFactory", "EC") == null) { System.out.println("Provider does not support EC, skipping"); return; } + + + if (testWithoutSunEC != null) { + Provider sunec = Security.getProvider("SunEC"); + if (sunec == null) { + System.out.println("SunEC provider not present. Skipping test"); + return; + } + Security.removeProvider(sunec.getName()); + } + Providers.setAt(p, 1); CipherTest.main(new JSSEFactory(), cmdArgs); Security.removeProvider(p.getName());