--- a/.hgtags Tue May 13 10:29:12 2014 -0700
+++ b/.hgtags Fri May 23 09:05:24 2014 -0700
@@ -255,3 +255,4 @@
8c0bdeecd7c0f9ce3f3762a51991f755cb3a972c jdk9-b10
0809c9a4d36e6291f1c4384604c4bbf29e975722 jdk9-b11
0d1f816217dce5e72187f167cc1816080cbeb453 jdk9-b12
+1a30593dcb9802faec3b6edb24d86ca088594e4e jdk9-b13
--- a/.hgtags-top-repo Tue May 13 10:29:12 2014 -0700
+++ b/.hgtags-top-repo Fri May 23 09:05:24 2014 -0700
@@ -255,3 +255,4 @@
fa13f2b926f8426876ec03e7903f3ee0ee150f2e jdk9-b10
ab55a18a95e1990a588929d5d29db3eb9985fea0 jdk9-b11
59f6350295f9681fe5956d8bc889bf341914c6cb jdk9-b12
+5800456add07e1a68170a229fb5e27376f8875e5 jdk9-b13
--- a/common/autoconf/boot-jdk.m4 Tue May 13 10:29:12 2014 -0700
+++ b/common/autoconf/boot-jdk.m4 Fri May 23 09:05:24 2014 -0700
@@ -331,8 +331,8 @@
# Finally, set some other options...
- # When compiling code to be executed by the Boot JDK, force jdk7 compatibility.
- BOOT_JDK_SOURCETARGET="-source 7 -target 7"
+ # When compiling code to be executed by the Boot JDK, force jdk8 compatibility.
+ BOOT_JDK_SOURCETARGET="-source 8 -target 8"
AC_SUBST(BOOT_JDK_SOURCETARGET)
AC_SUBST(JAVAC_FLAGS)
])
--- a/common/autoconf/generated-configure.sh Tue May 13 10:29:12 2014 -0700
+++ b/common/autoconf/generated-configure.sh Fri May 23 09:05:24 2014 -0700
@@ -4243,7 +4243,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1398861894
+DATE_WHEN_GENERATED=1399969244
###############################################################################
#
@@ -26004,8 +26004,8 @@
# Finally, set some other options...
- # When compiling code to be executed by the Boot JDK, force jdk7 compatibility.
- BOOT_JDK_SOURCETARGET="-source 7 -target 7"
+ # When compiling code to be executed by the Boot JDK, force jdk8 compatibility.
+ BOOT_JDK_SOURCETARGET="-source 8 -target 8"
--- a/common/bin/hgforest.sh Tue May 13 10:29:12 2014 -0700
+++ b/common/bin/hgforest.sh Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,4 @@
#!/bin/sh
-
#
# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -23,25 +22,40 @@
# questions.
#
-# Shell script for a fast parallel forest command
+# Shell script for a fast parallel forest/trees command
-global_opts=""
-status_output="/dev/stdout"
-qflag="false"
-vflag="false"
-sflag="false"
+usage() {
+ echo "usage: $0 [-h|--help] [-q|--quiet] [-v|--verbose] [-s|--sequential] [--] <command> [commands...]" > ${status_output}
+ echo "Environment variables which modify behaviour:"
+ echo " HGFOREST_QUIET : (boolean) If 'true' then standard output is redirected to /dev/null"
+ echo " HGFOREST_VERBOSE : (boolean) If 'true' then Mercurial asked to produce verbose output"
+ echo " HGFOREST_SEQUENTIAL : (boolean) If 'true' then repos are processed sequentially. Disables concurrency"
+ echo " HGFOREST_GLOBALOPTS : (string, must begin with space) Additional Mercurial global options"
+ echo " HGFOREST_REDIRECT : (file path) Redirect standard output to specified file"
+ echo " HGFOREST_FIFOS : (boolean) Default behaviour for FIFO detection. Does not override FIFOs disabled"
+ echo " HGFOREST_CONCURRENCY: (positive integer) Number of repos to process concurrently"
+ echo " HGFOREST_DEBUG : (boolean) If 'true' then temp files are retained"
+ exit 1
+}
+
+global_opts="${HGFOREST_GLOBALOPTS:-}"
+status_output="${HGFOREST_REDIRECT:-/dev/stdout}"
+qflag="${HGFOREST_QUIET:-false}"
+vflag="${HGFOREST_VERBOSE:-false}"
+sflag="${HGFOREST_SEQUENTIAL:-false}"
while [ $# -gt 0 ]
do
case $1 in
+ -h | --help )
+ usage
+ ;;
+
-q | --quiet )
qflag="true"
- global_opts="${global_opts} -q"
- status_output="/dev/null"
;;
-v | --verbose )
vflag="true"
- global_opts="${global_opts} -v"
;;
-s | --sequential )
@@ -63,39 +77,60 @@
shift
done
-
-command="$1"; shift
-command_args="$@"
+# silence standard output?
+if [ ${qflag} = "true" ] ; then
+ global_opts="${global_opts} -q"
+ status_output="/dev/null"
+fi
-usage() {
- echo "usage: $0 [-q|--quiet] [-v|--verbose] [-s|--sequential] [--] <command> [commands...]" > ${status_output}
- exit 1
-}
+# verbose output?
+if [ ${vflag} = "true" ] ; then
+ global_opts="${global_opts} -v"
+fi
-if [ "x" = "x$command" ] ; then
+# Make sure we have a command.
+if [ $# -lt 1 -o -z "${1:-}" ] ; then
echo "ERROR: No command to hg supplied!"
usage
fi
-# Check if we can use fifos for monitoring sub-process completion.
-on_windows=`uname -s | egrep -ic -e 'cygwin|msys'`
-if [ ${on_windows} = "1" ]; then
- # cygwin has (2014-04-18) broken (single writer only) FIFOs
- # msys has (2014-04-18) no FIFOs.
- have_fifos="false"
-else
- have_fifos="true"
-fi
+command="$1"; shift
+command_args="${@:-}"
# Clean out the temporary directory that stores the pid files.
tmp=/tmp/forest.$$
rm -f -r ${tmp}
mkdir -p ${tmp}
+
+if [ "${HGFOREST_DEBUG:-false}" = "true" ] ; then
+ echo "DEBUG: temp files are in: ${tmp}"
+fi
+
+# Check if we can use fifos for monitoring sub-process completion.
+echo "1" > ${tmp}/read
+while_subshell=1
+while read line; do
+ while_subshell=0
+ break;
+done < ${tmp}/read
+rm ${tmp}/read
+
+on_windows=`uname -s | egrep -ic -e 'cygwin|msys'`
+
+if [ ${while_subshell} = "1" -o ${on_windows} = "1" ]; then
+ # cygwin has (2014-04-18) broken (single writer only) FIFOs
+ # msys has (2014-04-18) no FIFOs.
+ # older shells create a sub-shell for redirect to while
+ have_fifos="false"
+else
+ have_fifos="${HGFOREST_FIFOS:-true}"
+fi
+
safe_interrupt () {
if [ -d ${tmp} ]; then
if [ "`ls ${tmp}/*.pid`" != "" ]; then
- echo "Waiting for processes ( `cat ${tmp}/*.pid | tr '\n' ' '`) to terminate nicely!" > ${status_output}
+ echo "Waiting for processes ( `cat ${tmp}/.*.pid ${tmp}/*.pid 2> /dev/null | tr '\n' ' '`) to terminate nicely!" > ${status_output}
sleep 1
# Pipe stderr to dev/null to silence kill, that complains when trying to kill
# a subprocess that has already exited.
@@ -110,10 +145,12 @@
nice_exit () {
if [ -d ${tmp} ]; then
- if [ "`ls ${tmp}`" != "" ]; then
+ if [ "`ls -A ${tmp} 2> /dev/null`" != "" ]; then
wait
fi
- rm -f -r ${tmp}
+ if [ "${HGFOREST_DEBUG:-false}" != "true" ] ; then
+ rm -f -r ${tmp}
+ fi
fi
}
@@ -128,17 +165,20 @@
repos=""
repos_extra=""
if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone" ] ; then
+ # we must be a clone
if [ ! -f .hg/hgrc ] ; then
echo "ERROR: Need initial repository to use this script" > ${status_output}
exit 1
fi
+ # the clone must know where it came from (have a default pull path).
pull_default=`hg paths default`
if [ "${pull_default}" = "" ] ; then
echo "ERROR: Need initial clone with 'hg paths default' defined" > ${status_output}
exit 1
fi
+ # determine which sub repos need to be cloned.
for i in ${subrepos} ; do
if [ ! -f ${i}/.hg/hgrc ] ; then
repos="${repos} ${i}"
@@ -147,12 +187,15 @@
pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
- if [ "${command_args}" != "" ] ; then
+ if [ -n "${command_args}" ] ; then
+ # if there is an "extra sources" path then reparent "extra" repos to that path
if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then
echo "ERROR: Need initial clone from non-local source" > ${status_output}
exit 1
fi
pull_extra="${command_args}/${pull_default_tail}"
+
+ # determine which extra subrepos need to be cloned.
for i in ${subrepos_extra} ; do
if [ ! -f ${i}/.hg/hgrc ] ; then
repos_extra="${repos_extra} ${i}"
@@ -160,7 +203,7 @@
done
else
if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then
- # local source repo. Copy the extras ones that exist there.
+ # local source repo. Clone the "extra" subrepos that exist there.
for i in ${subrepos_extra} ; do
if [ -f ${pull_default}/${i}/.hg/hgrc -a ! -f ${i}/.hg/hgrc ] ; then
# sub-repo there in source but not here
@@ -169,13 +212,17 @@
done
fi
fi
- at_a_time=2
+
# Any repos to deal with?
if [ "${repos}" = "" -a "${repos_extra}" = "" ] ; then
echo "No repositories to process." > ${status_output}
exit
fi
+
+ # Repos to process concurrently. Clone does better with low concurrency.
+ at_a_time="${HGFOREST_CONCURRENCY:-2}"
else
+ # Process command for all of the present repos
for i in . ${subrepos} ${subrepos_extra} ; do
if [ -d ${i}/.hg ] ; then
repos="${repos} ${i}"
@@ -189,6 +236,7 @@
fi
# any of the repos locked?
+ locked=""
for i in ${repos} ; do
if [ -h ${i}/.hg/store/lock -o -f ${i}/.hg/store/lock ] ; then
locked="${i} ${locked}"
@@ -198,34 +246,39 @@
echo "ERROR: These repositories are locked: ${locked}" > ${status_output}
exit 1
fi
- at_a_time=8
+
+ # Repos to process concurrently.
+ at_a_time="${HGFOREST_CONCURRENCY:-8}"
fi
# Echo out what repositories we do a command on.
echo "# Repositories: ${repos} ${repos_extra}" > ${status_output}
if [ "${command}" = "serve" ] ; then
- # "serve" is run for all the repos.
+ # "serve" is run for all the repos as one command.
(
(
+ cwd=`pwd`
+ serving=`basename ${cwd}`
(
echo "[web]"
- echo "description = $(basename $(pwd))"
+ echo "description = ${serving}"
echo "allow_push = *"
echo "push_ssl = False"
echo "[paths]"
- for i in ${repos} ${repos_extra} ; do
+ for i in ${repos} ; do
if [ "${i}" != "." ] ; then
- echo "/$(basename $(pwd))/${i} = ${i}"
+ echo "/${serving}/${i} = ${i}"
else
- echo "/$(basename $(pwd)) = $(pwd)"
+ echo "/${serving} = ${cwd}"
fi
done
) > ${tmp}/serve.web-conf
- echo "serving root repo $(basename $(pwd))"
+ echo "serving root repo ${serving}" > ${status_output}
+ echo "hg${global_opts} serve" > ${status_output}
(PYTHONUNBUFFERED=true hg${global_opts} serve -A ${status_output} -E ${status_output} --pid-file ${tmp}/serve.pid --web-conf ${tmp}/serve.web-conf; echo "$?" > ${tmp}/serve.pid.rc ) 2>&1 &
) 2>&1 | sed -e "s@^@serve: @" > ${status_output}
) &
@@ -234,81 +287,93 @@
# n is the number of subprocess started or which might still be running.
n=0
- if [ $have_fifos = "true" ]; then
+ if [ ${have_fifos} = "true" ]; then
# if we have fifos use them to detect command completion.
mkfifo ${tmp}/fifo
exec 3<>${tmp}/fifo
- if [ "${sflag}" = "true" ] ; then
- # force sequential
- at_a_time=1
- fi
fi
+ # iterate over all of the subrepos.
for i in ${repos} ${repos_extra} ; do
n=`expr ${n} '+' 1`
repopidfile=`echo ${i} | sed -e 's@./@@' -e 's@/@_@g'`
reponame=`echo ${i} | sed -e :a -e 's/^.\{1,20\}$/ &/;ta'`
pull_base="${pull_default}"
- for j in $repos_extra ; do
- if [ "$i" = "$j" ] ; then
- pull_base="${pull_extra}"
+
+ # regular repo or "extra" repo?
+ for j in ${repos_extra} ; do
+ if [ "${i}" = "${j}" ] ; then
+ # it's an "extra"
+ pull_base="${pull_extra}"
fi
done
+
+ # remove trailing slash
pull_base="`echo ${pull_base} | sed -e 's@[/]*$@@'`"
+
+ # execute the command on the subrepo
(
(
if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone" ] ; then
- pull_newrepo="${pull_base}/${i}"
- path="`dirname ${i}`"
- if [ "${path}" != "." ] ; then
+ # some form of clone
+ clone_newrepo="${pull_base}/${i}"
+ parent_path="`dirname ${i}`"
+ if [ "${parent_path}" != "." ] ; then
times=0
- while [ ! -d "${path}" ] ## nested repo, ensure containing dir exists
- do
+ while [ ! -d "${parent_path}" ] ; do ## nested repo, ensure containing dir exists
+ if [ "${sflag}" = "true" ] ; then
+ # Missing parent is fatal during sequential operation.
+ echo "ERROR: Missing parent path: ${parent_path}" > ${status_output}
+ exit 1
+ fi
times=`expr ${times} '+' 1`
if [ `expr ${times} '%' 10` -eq 0 ] ; then
- echo "${path} still not created, waiting..." > ${status_output}
+ echo "${parent_path} still not created, waiting..." > ${status_output}
fi
sleep 5
done
fi
- echo "hg${global_opts} clone ${pull_newrepo} ${i}" > ${status_output}
- (PYTHONUNBUFFERED=true hg${global_opts} clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 &
+ # run the clone command.
+ echo "hg${global_opts} clone ${clone_newrepo} ${i}" > ${status_output}
+ (PYTHONUNBUFFERED=true hg${global_opts} clone ${clone_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 &
else
+ # run the command.
echo "cd ${i} && hg${global_opts} ${command} ${command_args}" > ${status_output}
cd ${i} && (PYTHONUNBUFFERED=true hg${global_opts} ${command} ${command_args}; echo "$?" > ${tmp}/${repopidfile}.pid.rc ) 2>&1 &
fi
echo $! > ${tmp}/${repopidfile}.pid
) 2>&1 | sed -e "s@^@${reponame}: @" > ${status_output}
- if [ $have_fifos = "true" ]; then
- echo "${reponame}" >&3
+ # tell the fifo waiter that this subprocess is done.
+ if [ ${have_fifos} = "true" ]; then
+ echo "${i}" >&3
fi
) &
- if [ $have_fifos = "true" ]; then
- # check on count of running subprocesses and possibly wait for completion
- if [ ${at_a_time} -lt ${n} ] ; then
- # read will block until there are completed subprocesses
- while read repo_done; do
- n=`expr ${n} '-' 1`
- if [ ${n} -lt ${at_a_time} ] ; then
- # we should start more subprocesses
- break;
- fi
- done <&3
- fi
+ if [ "${sflag}" = "true" ] ; then
+ # complete this task before starting another.
+ wait
else
- if [ "${sflag}" = "false" ] ; then
+ if [ "${have_fifos}" = "true" ]; then
+ # check on count of running subprocesses and possibly wait for completion
+ if [ ${n} -ge ${at_a_time} ] ; then
+ # read will block until there are completed subprocesses
+ while read repo_done; do
+ n=`expr ${n} '-' 1`
+ if [ ${n} -lt ${at_a_time} ] ; then
+ # we should start more subprocesses
+ break;
+ fi
+ done <&3
+ fi
+ else
# Compare completions to starts
- completed="`(ls -1 ${tmp}/*.pid.rc 2> /dev/null | wc -l) || echo 0`"
- while [ ${at_a_time} -lt `expr ${n} '-' ${completed}` ] ; do
+ completed="`(ls -a1 ${tmp}/*.pid.rc 2> /dev/null | wc -l) || echo 0`"
+ while [ `expr ${n} '-' ${completed}` -ge ${at_a_time} ] ; do
# sleep a short time to give time for something to complete
sleep 1
- completed="`(ls -1 ${tmp}/*.pid.rc 2> /dev/null | wc -l) || echo 0`"
+ completed="`(ls -a1 ${tmp}/*.pid.rc 2> /dev/null | wc -l) || echo 0`"
done
- else
- # complete this task before starting another.
- wait
fi
fi
done
@@ -320,11 +385,12 @@
# Terminate with exit 0 only if all subprocesses were successful
ec=0
if [ -d ${tmp} ]; then
- for rc in ${tmp}/*.pid.rc ; do
+ rcfiles="`(ls -a ${tmp}/*.pid.rc 2> /dev/null) || echo ''`"
+ for rc in ${rcfiles} ; do
exit_code=`cat ${rc} | tr -d ' \n\r'`
if [ "${exit_code}" != "0" ] ; then
- repo="`echo ${rc} | sed -e s@^${tmp}@@ -e 's@/*\([^/]*\)\.pid\.rc$@\1@' -e 's@_@/@g'`"
- echo "WARNING: ${repo} exited abnormally ($exit_code)" > ${status_output}
+ repo="`echo ${rc} | sed -e 's@^'${tmp}'@@' -e 's@/*\([^/]*\)\.pid\.rc$@\1@' -e 's@_@/@g'`"
+ echo "WARNING: ${repo} exited abnormally (${exit_code})" > ${status_output}
ec=1
fi
done
--- a/corba/.hgtags Tue May 13 10:29:12 2014 -0700
+++ b/corba/.hgtags Fri May 23 09:05:24 2014 -0700
@@ -255,3 +255,4 @@
3bd4039dfc632fd7fc8418a25a3dcc34d1cd4019 jdk9-b10
77ea0a2503582a28e4e66be7239a49a0d1dd313f jdk9-b11
e212cdcc8c11f0ba5acf6f5ddb596c4c545a93f9 jdk9-b12
+088eec4c36f4d7f250fcd19c4969bf698e3d2cdc jdk9-b13
--- a/corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Tue May 13 10:29:12 2014 -0700
+++ b/corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java Fri May 23 09:05:24 2014 -0700
@@ -25,8 +25,6 @@
package com.sun.corba.se.spi.orb;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.Map ;
import java.util.HashMap ;
import java.util.Properties ;
@@ -44,16 +42,13 @@
import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
import com.sun.corba.se.spi.protocol.ClientDelegateFactory ;
import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator ;
import com.sun.corba.se.spi.protocol.PIHandler ;
import com.sun.corba.se.spi.resolver.LocalResolver ;
import com.sun.corba.se.spi.resolver.Resolver ;
import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
import com.sun.corba.se.spi.monitoring.MonitoringConstants;
import com.sun.corba.se.spi.monitoring.MonitoringManager;
-import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;
import com.sun.corba.se.spi.monitoring.MonitoringFactories;
import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
@@ -62,11 +57,6 @@
import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
import com.sun.corba.se.spi.ior.IOR ;
-import com.sun.corba.se.spi.orbutil.closure.Closure ;
-
-import com.sun.corba.se.spi.orb.Operation ;
-import com.sun.corba.se.spi.orb.ORBData ;
-import com.sun.corba.se.spi.orb.ORBVersion ;
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;
import com.sun.corba.se.spi.oa.OAInvocationInfo ;
@@ -99,8 +89,6 @@
import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;
-import sun.misc.JavaAWTAccess;
-
public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
implements Broker, TypeCodeFactory
{
@@ -146,9 +134,9 @@
// This map is needed for resolving recursive type code placeholders
// based on the unique repository id.
// XXX Should this be a WeakHashMap for GC?
- private Map typeCodeMap ;
+ private Map<String, TypeCodeImpl> typeCodeMap;
- private TypeCodeImpl[] primitiveTypeCodeConstants ;
+ private TypeCodeImpl[] primitiveTypeCodeConstants;
// ByteBufferPool - needed by both ORBImpl and ORBSingleton
ByteBufferPool byteBufferPool;
@@ -169,16 +157,18 @@
// wrapperMap maintains a table of LogWrapper instances used by
// different classes to log exceptions. The key is a StringPair
// representing LogDomain and ExceptionGroup.
- private Map wrapperMap ;
+ private Map<StringPair, LogWrapperBase> wrapperMap;
static class Holder {
static final PresentationManager defaultPresentationManager =
setupPresentationManager();
}
- private static final Map<Object, PresentationManager> pmContexts = new HashMap<>();
+ private static final Map<Object, PresentationManager> pmContexts =
+ new ConcurrentHashMap<>();
- private static Map staticWrapperMap = new ConcurrentHashMap();
+ private static Map<StringPair, LogWrapperBase> staticWrapperMap =
+ new ConcurrentHashMap<>();
protected MonitoringManager monitoringManager;
@@ -245,28 +235,12 @@
public static PresentationManager getPresentationManager()
{
SecurityManager sm = System.getSecurityManager();
- JavaAWTAccess javaAwtAccess = sun.misc.SharedSecrets.getJavaAWTAccess();
+ sun.misc.JavaAWTAccess javaAwtAccess = sun.misc.SharedSecrets.getJavaAWTAccess();
if (sm != null && javaAwtAccess != null) {
- Object appletContext;
- try {
- Class<?> clazz = JavaAWTAccess.class;
- Method method = clazz.getMethod("getAppletContext");
- appletContext = method.invoke(javaAwtAccess);
- } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
- InternalError err = new InternalError();
- err.initCause(e);
- throw err;
- }
-
+ final Object appletContext = javaAwtAccess.getAppletContext();
if (appletContext != null) {
- synchronized (pmContexts) {
- PresentationManager pm = pmContexts.get(appletContext);
- if (pm == null) {
- pm = setupPresentationManager();
- pmContexts.put(appletContext, pm);
- }
- return pm;
- }
+ return pmContexts.computeIfAbsent(appletContext,
+ x -> setupPresentationManager());
}
}
@@ -290,13 +264,13 @@
{
// Initialize logging first, since it is needed nearly
// everywhere (for example, in TypeCodeImpl).
- wrapperMap = new ConcurrentHashMap();
+ wrapperMap = new ConcurrentHashMap<>();
wrapper = ORBUtilSystemException.get( this,
CORBALogDomains.RPC_PRESENTATION ) ;
omgWrapper = OMGSystemException.get( this,
CORBALogDomains.RPC_PRESENTATION ) ;
- typeCodeMap = new HashMap();
+ typeCodeMap = new HashMap<>();
primitiveTypeCodeConstants = new TypeCodeImpl[] {
new TypeCodeImpl(this, TCKind._tk_null),
@@ -363,7 +337,7 @@
public synchronized TypeCodeImpl getTypeCode(String id)
{
checkShutdownState();
- return (TypeCodeImpl)typeCodeMap.get(id);
+ return typeCodeMap.get(id);
}
public MonitoringManager getMonitoringManager( ) {
@@ -526,35 +500,23 @@
/** get the log wrapper class (its type is dependent on the exceptionGroup) for the
* given log domain and exception group in this ORB instance.
*/
- public LogWrapperBase getLogWrapper( String logDomain,
- String exceptionGroup, LogWrapperFactory factory )
+ public LogWrapperBase getLogWrapper(String logDomain,
+ String exceptionGroup, LogWrapperFactory factory)
{
- StringPair key = new StringPair( logDomain, exceptionGroup ) ;
-
- LogWrapperBase logWrapper = (LogWrapperBase)wrapperMap.get( key );
- if (logWrapper == null) {
- logWrapper = factory.create( getLogger( logDomain ) );
- wrapperMap.put( key, logWrapper );
- }
-
- return logWrapper;
+ return wrapperMap.computeIfAbsent(
+ new StringPair(logDomain, exceptionGroup),
+ x -> factory.create(getLogger(logDomain)));
}
/** get the log wrapper class (its type is dependent on the exceptionGroup) for the
* given log domain and exception group in this ORB instance.
*/
- public static LogWrapperBase staticGetLogWrapper( String logDomain,
- String exceptionGroup, LogWrapperFactory factory )
+ public static LogWrapperBase staticGetLogWrapper(String logDomain,
+ String exceptionGroup, LogWrapperFactory factory)
{
- StringPair key = new StringPair( logDomain, exceptionGroup ) ;
-
- LogWrapperBase logWrapper = (LogWrapperBase)staticWrapperMap.get( key );
- if (logWrapper == null) {
- logWrapper = factory.create( staticGetLogger( logDomain ) );
- staticWrapperMap.put( key, logWrapper );
- }
-
- return logWrapper;
+ return staticWrapperMap.computeIfAbsent(
+ new StringPair(logDomain, exceptionGroup),
+ x -> factory.create(staticGetLogger(logDomain)));
}
// get a reference to a ByteBufferPool, a pool of NIO ByteBuffers
--- a/hotspot/.hgtags Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/.hgtags Fri May 23 09:05:24 2014 -0700
@@ -415,3 +415,4 @@
ebc44d040cd149d2120d69fe183a3dae7840f4b4 jdk9-b10
783309c3a1a629a452673399dcfa83ef7eca94d8 jdk9-b11
1c383bb39e2849ca62cb763f4e182a29b421d60a jdk9-b12
+456ad9c99133803d4e1433124c85a6fd141b9ac9 jdk9-b13
--- a/hotspot/agent/src/os/linux/libproc.h Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/agent/src/os/linux/libproc.h Fri May 23 09:05:24 2014 -0700
@@ -34,19 +34,7 @@
#include "libproc_md.h"
#endif
-#if defined(sparc) || defined(sparcv9)
-/*
- If _LP64 is defined ptrace.h should be taken from /usr/include/asm-sparc64
- otherwise it should be from /usr/include/asm-sparc
- These two files define pt_regs structure differently
-*/
-#ifdef _LP64
-#include "asm-sparc64/ptrace.h"
-#else
-#include "asm-sparc/ptrace.h"
-#endif
-
-#endif //sparc or sparcv9
+#include <linux/ptrace.h>
/************************************************************************************
--- a/hotspot/src/cpu/ppc/vm/cppInterpreter_ppc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/cppInterpreter_ppc.cpp Fri May 23 09:05:24 2014 -0700
@@ -1,3 +1,4 @@
+
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2014 SAP AG. All rights reserved.
@@ -403,7 +404,7 @@
BLOCK_COMMENT("compute_interpreter_state {");
// access_flags = method->access_flags();
- // TODO: PPC port: assert(4 == methodOopDesc::sz_access_flags(), "unexpected field size");
+ // TODO: PPC port: assert(4 == sizeof(AccessFlags), "unexpected field size");
__ lwa(access_flags, method_(access_flags));
// parameter_count = method->constMethod->size_of_parameters();
@@ -419,10 +420,8 @@
// TODO: PPC port: assert(2 == ConstMethod::sz_max_stack(), "unexpected field size");
__ lhz(max_stack, in_bytes(ConstMethod::max_stack_offset()), max_stack);
- if (EnableInvokeDynamic) {
- // Take into account 'extra_stack_entries' needed by method handles (see method.hpp).
+ // Take into account 'extra_stack_entries' needed by method handles (see method.hpp).
__ addi(max_stack, max_stack, Method::extra_stack_entries());
- }
// mem_stack_limit = thread->stack_limit();
__ ld(mem_stack_limit, thread_(stack_overflow_limit));
@@ -1055,7 +1054,7 @@
assert(access_flags->is_nonvolatile(),
"access_flags must be in a non-volatile register");
// Type check.
- // TODO: PPC port: assert(4 == methodOopDesc::sz_access_flags(), "unexpected field size");
+ // TODO: PPC port: assert(4 == sizeof(AccessFlags), "unexpected field size");
__ lwz(access_flags, method_(access_flags));
// We don't want to reload R19_method and access_flags after calls
@@ -1838,7 +1837,7 @@
// Interpreter state fields.
const Register msg = R24_tmp4;
- // MethodOop fields.
+ // Method fields.
const Register parameter_count = R25_tmp5;
const Register result_index = R26_tmp6;
@@ -2023,7 +2022,7 @@
__ add(R17_tos, R17_tos, parameter_count);
// Result stub address array index
- // TODO: PPC port: assert(4 == methodOopDesc::sz_result_index(), "unexpected field size");
+ // TODO: PPC port: assert(4 == sizeof(AccessFlags), "unexpected field size");
__ lwa(result_index, method_(result_index));
__ li(msg, BytecodeInterpreter::method_resume);
@@ -2709,7 +2708,7 @@
__ ld(R3_ARG1, state_(_result._osr._osr_buf));
__ mtctr(R12_scratch2);
- // Load method oop, gc may move it during execution of osr'd method.
+ // Load method, gc may move it during execution of osr'd method.
__ ld(R22_tmp2, state_(_method));
// Load message 'call_method'.
__ li(R23_tmp3, BytecodeInterpreter::call_method);
--- a/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,6 +26,8 @@
#ifndef CPU_PPC_VM_FRAME_PPC_INLINE_HPP
#define CPU_PPC_VM_FRAME_PPC_INLINE_HPP
+#include "code/codeCache.hpp"
+
// Inline functions for ppc64 frames:
// Find codeblob and set deopt_state.
--- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp Fri May 23 09:05:24 2014 -0700
@@ -380,7 +380,6 @@
if (index_size == sizeof(u2)) {
get_2_byte_integer_at_bcp(bcp_offset, Rdst, Unsigned);
} else if (index_size == sizeof(u4)) {
- assert(EnableInvokeDynamic, "giant index used only for JSR 292");
get_4_byte_integer_at_bcp(bcp_offset, Rdst, Signed);
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
nand(Rdst, Rdst, Rdst); // convert to plain index
--- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,7 +26,7 @@
#ifndef CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
#define CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
-#include "assembler_ppc.inline.hpp"
+#include "asm/macroAssembler.hpp"
#include "interpreter/invocationCounter.hpp"
// This file specializes the assembler with interpreter-specific macros.
--- a/hotspot/src/cpu/ppc/vm/interpreterRT_ppc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/interpreterRT_ppc.cpp Fri May 23 09:05:24 2014 -0700
@@ -24,6 +24,7 @@
*/
#include "precompiled.hpp"
+#include "asm/assembler.inline.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
#include "memory/allocation.inline.hpp"
--- a/hotspot/src/cpu/ppc/vm/interpreter_ppc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/interpreter_ppc.cpp Fri May 23 09:05:24 2014 -0700
@@ -139,32 +139,16 @@
// Signature is in R3_RET. Signature is callee saved.
__ mr(signature, R3_RET);
- // Reload method, it may have moved.
-#ifdef CC_INTERP
- __ ld(R19_method, state_(_method));
-#else
- __ ld(R19_method, 0, target_sp);
- __ ld(R19_method, _ijava_state_neg(method), R19_method);
-#endif
-
// Get the result handler.
__ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::get_result_handler), R16_thread, R19_method);
- // Reload method, it may have moved.
-#ifdef CC_INTERP
- __ ld(R19_method, state_(_method));
-#else
- __ ld(R19_method, 0, target_sp);
- __ ld(R19_method, _ijava_state_neg(method), R19_method);
-#endif
-
{
Label L;
// test if static
// _access_flags._flags must be at offset 0.
// TODO PPC port: requires change in shared code.
//assert(in_bytes(AccessFlags::flags_offset()) == 0,
- // "MethodOopDesc._access_flags == MethodOopDesc._access_flags._flags");
+ // "MethodDesc._access_flags == MethodDesc._access_flags._flags");
// _access_flags must be a 32 bit value.
assert(sizeof(AccessFlags) == 4, "wrong size");
__ lwa(R11_scratch1/*access_flags*/, method_(access_flags));
--- a/hotspot/src/cpu/ppc/vm/jniFastGetField_ppc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/jniFastGetField_ppc.cpp Fri May 23 09:05:24 2014 -0700
@@ -32,7 +32,7 @@
address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
- // we don't have fast jni accessors.
+ // We don't have fast jni accessors.
return (address) -1;
}
@@ -57,12 +57,12 @@
}
address JNI_FastGetField::generate_fast_get_long_field() {
- // we don't have fast jni accessors.
+ // We don't have fast jni accessors.
return (address) -1;
}
address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
- // e don't have fast jni accessors.
+ // We don't have fast jni accessors.
return (address) -1;
}
--- a/hotspot/src/cpu/ppc/vm/ppc.ad Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/ppc.ad Fri May 23 09:05:24 2014 -0700
@@ -898,7 +898,7 @@
// To keep related declarations/definitions/uses close together,
// we switch between source %{ }% and source_hpp %{ }% freely as needed.
- // Returns true if Node n is followed by a MemBar node that
+ // Returns true if Node n is followed by a MemBar node that
// will do an acquire. If so, this node must not do the acquire
// operation.
bool followed_by_acquire(const Node *n);
@@ -908,7 +908,7 @@
// Optimize load-acquire.
//
-// Check if acquire is unnecessary due to following operation that does
+// Check if acquire is unnecessary due to following operation that does
// acquire anyways.
// Walk the pattern:
//
@@ -919,12 +919,12 @@
// Proj(ctrl) Proj(mem)
// | |
// MemBarRelease/Volatile
-//
+//
bool followed_by_acquire(const Node *load) {
assert(load->is_Load(), "So far implemented only for loads.");
// Find MemBarAcquire.
- const Node *mba = NULL;
+ const Node *mba = NULL;
for (DUIterator_Fast imax, i = load->fast_outs(imax); i < imax; i++) {
const Node *out = load->fast_out(i);
if (out->Opcode() == Op_MemBarAcquire) {
@@ -937,7 +937,7 @@
// Find following MemBar node.
//
- // The following node must be reachable by control AND memory
+ // The following node must be reachable by control AND memory
// edge to assure no other operations are in between the two nodes.
//
// So first get the Proj node, mem_proj, to use it to iterate forward.
@@ -1135,6 +1135,7 @@
public:
+ // Emit call stub, compiled java to interpreter.
static void emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset);
// Size of call trampoline stub.
@@ -2755,7 +2756,7 @@
// inputs for new nodes
m1->add_req(NULL, n_toc);
m2->add_req(NULL, m1);
-
+
// operands for new nodes
m1->_opnds[0] = new (C) iRegPdstOper(); // dst
m1->_opnds[1] = op_src; // src
@@ -2763,29 +2764,29 @@
m2->_opnds[0] = new (C) iRegPdstOper(); // dst
m2->_opnds[1] = op_src; // src
m2->_opnds[2] = new (C) iRegLdstOper(); // base
-
+
// Initialize ins_attrib TOC fields.
m1->_const_toc_offset = -1;
m2->_const_toc_offset_hi_node = m1;
-
+
// Register allocation for new nodes.
ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
-
+
nodes->push(m1);
nodes->push(m2);
assert(m2->bottom_type()->isa_ptr(), "must be ptr");
} else {
loadConPNode *m2 = new (C) loadConPNode();
-
+
// inputs for new nodes
m2->add_req(NULL, n_toc);
-
+
// operands for new nodes
m2->_opnds[0] = new (C) iRegPdstOper(); // dst
m2->_opnds[1] = op_src; // src
m2->_opnds[2] = new (C) iRegPdstOper(); // toc
-
+
// Register allocation for new nodes.
ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
@@ -2977,17 +2978,17 @@
n_sub_base->_opnds[1] = op_crx;
n_sub_base->_opnds[2] = op_src;
n_sub_base->_bottom_type = _bottom_type;
-
+
n_shift->add_req(n_region, n_sub_base);
n_shift->_opnds[0] = op_dst;
n_shift->_opnds[1] = op_dst;
n_shift->_bottom_type = _bottom_type;
-
+
ra_->set_pair(n_shift->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
ra_->set_pair(n_compare->_idx, ra_->get_reg_second(n_crx), ra_->get_reg_first(n_crx));
ra_->set_pair(n_sub_base->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
ra_->set_pair(n_move->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
-
+
nodes->push(n_move);
nodes->push(n_compare);
nodes->push(n_sub_base);
@@ -3064,20 +3065,20 @@
} else {
// before Power 7
cond_add_baseNode *n_add_base = new (C) cond_add_baseNode();
-
+
n_add_base->add_req(n_region, n_compare, n_shift);
n_add_base->_opnds[0] = op_dst;
n_add_base->_opnds[1] = op_crx;
n_add_base->_opnds[2] = op_dst;
n_add_base->_bottom_type = _bottom_type;
-
+
assert(ra_->is_oop(this) == true, "A decodeN node must produce an oop!");
ra_->set_oop(n_add_base, true);
-
+
ra_->set_pair(n_shift->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
ra_->set_pair(n_compare->_idx, ra_->get_reg_second(n_crx), ra_->get_reg_first(n_crx));
ra_->set_pair(n_add_base->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
-
+
nodes->push(n_compare);
nodes->push(n_shift);
nodes->push(n_add_base);
@@ -3634,11 +3635,11 @@
// Req...
for (uint i = 0; i < req(); ++i) {
// The expanded node does not need toc any more.
- // Add the inline cache constant here instead. This expresses the
+ // Add the inline cache constant here instead. This expresses the
// register of the inline cache must be live at the call.
// Else we would have to adapt JVMState by -1.
if (i == mach_constant_base_node_input()) {
- call->add_req(loadConLNodes_IC._last);
+ call->add_req(loadConLNodes_IC._last);
} else {
call->add_req(in(i));
}
@@ -3666,6 +3667,8 @@
%}
// Compound version of call dynamic
+ // Toc is only passed so that it can be used in ins_encode statement.
+ // In the code we have to use $constanttablebase.
enc_class enc_java_dynamic_call(method meth, iRegLdst toc) %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
MacroAssembler _masm(&cbuf);
@@ -3673,14 +3676,17 @@
Register Rtoc = (ra_) ? $constanttablebase : R2_TOC;
#if 0
+ int vtable_index = this->_vtable_index;
if (_vtable_index < 0) {
// Must be invalid_vtable_index, not nonvirtual_vtable_index.
assert(_vtable_index == Method::invalid_vtable_index, "correct sentinel value");
Register ic_reg = as_Register(Matcher::inline_cache_reg_encode());
- AddressLiteral meta = __ allocate_metadata_address((Metadata *)Universe::non_oop_word());
-
+
+ // Virtual call relocation will point to ic load.
address virtual_call_meta_addr = __ pc();
- __ load_const_from_method_toc(ic_reg, meta, Rtoc);
+ // Load a clear inline cache.
+ AddressLiteral empty_ic((address) Universe::non_oop_word());
+ __ load_const_from_method_toc(ic_reg, empty_ic, Rtoc);
// CALL to fixup routine. Fixup routine uses ScopeDesc info
// to determine who we intended to call.
__ relocate(virtual_call_Relocation::spec(virtual_call_meta_addr));
@@ -3713,7 +3719,6 @@
"Fix constant in ret_addr_offset()");
}
#endif
- guarantee(0, "Fix handling of toc edge: messes up derived/base pairs.");
Unimplemented(); // ret_addr_offset not yet fixed. Depends on compressed oops (load klass!).
%}
@@ -5439,7 +5444,7 @@
ins_pipe(pipe_class_memory);
%}
-// Match loading integer and casting it to unsigned int in
+// Match loading integer and casting it to unsigned int in
// long register.
// LoadI + ConvI2L + AndL 0xffffffff.
instruct loadUI2L(iRegLdst dst, memory mem, immL_32bits mask) %{
@@ -6081,7 +6086,7 @@
ins_pipe(pipe_class_default);
%}
-// This needs a match rule so that build_oop_map knows this is
+// This needs a match rule so that build_oop_map knows this is
// not a narrow oop.
instruct loadConNKlass_lo(iRegNdst dst, immNKlass_NM src1, iRegNsrc src2) %{
match(Set dst src1);
@@ -6705,7 +6710,7 @@
size(4);
ins_encode %{
// This is a Power7 instruction for which no machine description exists.
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
__ isel_0($dst$$Register, $crx$$CondRegister, Assembler::equal, $src1$$Register);
%}
ins_pipe(pipe_class_default);
@@ -6850,7 +6855,7 @@
size(4);
ins_encode %{
// This is a Power7 instruction for which no machine description exists.
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
__ isel_0($dst$$Register, $crx$$CondRegister, Assembler::equal, $src1$$Register);
%}
ins_pipe(pipe_class_default);
@@ -7067,7 +7072,7 @@
n1->_bottom_type = _bottom_type;
decodeNKlass_shiftNode *n2 = new (C) decodeNKlass_shiftNode();
- n2->add_req(n_region, n2);
+ n2->add_req(n_region, n1);
n2->_opnds[0] = op_dst;
n2->_opnds[1] = op_dst;
n2->_bottom_type = _bottom_type;
@@ -7202,7 +7207,7 @@
// inline_unsafe_load_store).
//
// Add this node again if we found a good solution for inline_unsafe_load_store().
-// Don't forget to look at the implementation of post_store_load_barrier again,
+// Don't forget to look at the implementation of post_store_load_barrier again,
// we did other fixes in that method.
//instruct unnecessary_membar_volatile() %{
// match(MemBarVolatile);
@@ -7240,7 +7245,7 @@
// exists. Anyways, the scheduler should be off on Power7.
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
int cc = $cmp$$cmpcode;
- __ isel($dst$$Register, $crx$$CondRegister,
+ __ isel($dst$$Register, $crx$$CondRegister,
(Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
%}
ins_pipe(pipe_class_default);
@@ -7286,7 +7291,7 @@
// exists. Anyways, the scheduler should be off on Power7.
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
int cc = $cmp$$cmpcode;
- __ isel($dst$$Register, $crx$$CondRegister,
+ __ isel($dst$$Register, $crx$$CondRegister,
(Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
%}
ins_pipe(pipe_class_default);
@@ -7332,7 +7337,7 @@
// exists. Anyways, the scheduler should be off on Power7.
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
int cc = $cmp$$cmpcode;
- __ isel($dst$$Register, $crx$$CondRegister,
+ __ isel($dst$$Register, $crx$$CondRegister,
(Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
%}
ins_pipe(pipe_class_default);
@@ -7379,7 +7384,7 @@
// exists. Anyways, the scheduler should be off on Power7.
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
int cc = $cmp$$cmpcode;
- __ isel($dst$$Register, $crx$$CondRegister,
+ __ isel($dst$$Register, $crx$$CondRegister,
(Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
%}
ins_pipe(pipe_class_default);
@@ -7525,8 +7530,8 @@
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
- __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
- MacroAssembler::MemBarFenceAfter, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+ MacroAssembler::MemBarFenceAfter, MacroAssembler::cmpxchgx_hint_atomic_update(),
$res$$Register, true);
%}
ins_pipe(pipe_class_default);
@@ -7932,7 +7937,23 @@
// Turn the sign-bit of a long into a 64-bit mask, 0x0...0 for
// positive longs and 0xF...F for negative ones.
-instruct signmask64I_regI(iRegIdst dst, iRegIsrc src) %{
+instruct signmask64I_regL(iRegIdst dst, iRegLsrc src) %{
+ // no match-rule, false predicate
+ effect(DEF dst, USE src);
+ predicate(false);
+
+ format %{ "SRADI $dst, $src, #63" %}
+ size(4);
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
+ __ sradi($dst$$Register, $src$$Register, 0x3f);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+// Turn the sign-bit of a long into a 64-bit mask, 0x0...0 for
+// positive longs and 0xF...F for negative ones.
+instruct signmask64L_regL(iRegLdst dst, iRegLsrc src) %{
// no match-rule, false predicate
effect(DEF dst, USE src);
predicate(false);
@@ -8896,7 +8917,7 @@
size(4);
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
- __ rlwinm($dst$$Register, $src1$$Register, 0,
+ __ rlwinm($dst$$Register, $src1$$Register, 0,
(31-log2_long((jlong) $src2$$constant)) & 0x1f, (31-log2_long((jlong) $src2$$constant)) & 0x1f);
%}
ins_pipe(pipe_class_default);
@@ -9622,14 +9643,14 @@
ins_cost(DEFAULT_COST*4);
expand %{
- iRegIdst src1s;
- iRegIdst src2s;
- iRegIdst diff;
- sxtI_reg(src1s, src1); // ensure proper sign extention
- sxtI_reg(src2s, src2); // ensure proper sign extention
- subI_reg_reg(diff, src1s, src2s);
+ iRegLdst src1s;
+ iRegLdst src2s;
+ iRegLdst diff;
+ convI2L_reg(src1s, src1); // Ensure proper sign extension.
+ convI2L_reg(src2s, src2); // Ensure proper sign extension.
+ subL_reg_reg(diff, src1s, src2s);
// Need to consider >=33 bit result, therefore we need signmaskL.
- signmask64I_regI(dst, diff);
+ signmask64I_regL(dst, diff);
%}
%}
@@ -10866,7 +10887,7 @@
format %{ "PartialSubtypeCheck $result = ($subklass instanceOf $superklass) tmp: $tmp_klass, $tmp_arrayptr" %}
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
- __ check_klass_subtype_slow_path($subklass$$Register, $superklass$$Register, $tmp_arrayptr$$Register,
+ __ check_klass_subtype_slow_path($subklass$$Register, $superklass$$Register, $tmp_arrayptr$$Register,
$tmp_klass$$Register, NULL, $result$$Register);
%}
ins_pipe(pipe_class_default);
@@ -11181,18 +11202,18 @@
ins_cost(DEFAULT_COST*6);
expand %{
- iRegIdst src1s;
- iRegIdst src2s;
- iRegIdst diff;
- iRegIdst sm;
- iRegIdst doz; // difference or zero
- sxtI_reg(src1s, src1); // Ensure proper sign extention.
- sxtI_reg(src2s, src2); // Ensure proper sign extention.
- subI_reg_reg(diff, src2s, src1s);
+ iRegLdst src1s;
+ iRegLdst src2s;
+ iRegLdst diff;
+ iRegLdst sm;
+ iRegLdst doz; // difference or zero
+ convI2L_reg(src1s, src1); // Ensure proper sign extension.
+ convI2L_reg(src2s, src2); // Ensure proper sign extension.
+ subL_reg_reg(diff, src2s, src1s);
// Need to consider >=33 bit result, therefore we need signmaskL.
- signmask64I_regI(sm, diff);
- andI_reg_reg(doz, diff, sm); // <=0
- addI_reg_reg(dst, doz, src1s);
+ signmask64L_regL(sm, diff);
+ andL_reg_reg(doz, diff, sm); // <=0
+ addI_regL_regL(dst, doz, src1s);
%}
%}
@@ -11201,19 +11222,18 @@
ins_cost(DEFAULT_COST*6);
expand %{
- immI_minus1 m1 %{ -1 %}
- iRegIdst src1s;
- iRegIdst src2s;
- iRegIdst diff;
- iRegIdst sm;
- iRegIdst doz; // difference or zero
- sxtI_reg(src1s, src1); // Ensure proper sign extention.
- sxtI_reg(src2s, src2); // Ensure proper sign extention.
- subI_reg_reg(diff, src2s, src1s);
+ iRegLdst src1s;
+ iRegLdst src2s;
+ iRegLdst diff;
+ iRegLdst sm;
+ iRegLdst doz; // difference or zero
+ convI2L_reg(src1s, src1); // Ensure proper sign extension.
+ convI2L_reg(src2s, src2); // Ensure proper sign extension.
+ subL_reg_reg(diff, src2s, src1s);
// Need to consider >=33 bit result, therefore we need signmaskL.
- signmask64I_regI(sm, diff);
- andcI_reg_reg(doz, sm, m1, diff); // >=0
- addI_reg_reg(dst, doz, src1s);
+ signmask64L_regL(sm, diff);
+ andcL_reg_reg(doz, diff, sm); // >=0
+ addI_regL_regL(dst, doz, src1s);
%}
%}
--- a/hotspot/src/cpu/ppc/vm/templateInterpreter_ppc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/templateInterpreter_ppc.cpp Fri May 23 09:05:24 2014 -0700
@@ -81,24 +81,18 @@
#if 0
// Call special ClassCastException constructor taking object to cast
// and target class as arguments.
-address TemplateInterpreterGenerator::generate_ClassCastException_verbose_handler(const char* name) {
+address TemplateInterpreterGenerator::generate_ClassCastException_verbose_handler() {
address entry = __ pc();
- // Target class oop is in register R6_ARG4 by convention!
-
// Expression stack must be empty before entering the VM if an
// exception happened.
__ empty_expression_stack();
- // Setup parameters.
+
// Thread will be loaded to R3_ARG1.
- __ load_const_optimized(R4_ARG2, (address) name);
- __ mr(R5_ARG3, R17_tos);
- // R6_ARG4 contains specified class.
- __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ClassCastException_verbose));
-#ifdef ASSERT
+ // Target class oop is in register R5_ARG3 by convention!
+ __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ClassCastException_verbose, R17_tos, R5_ARG3));
// Above call must not return here since exception pending.
- __ should_not_reach_here();
-#endif
+ DEBUG_ONLY(__ should_not_reach_here();)
return entry;
}
#endif
@@ -1538,14 +1532,32 @@
__ stw(R0, in_bytes(JavaThread::popframe_condition_offset()), R16_thread);
// Get out of the current method and re-execute the call that called us.
- __ merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ return_pc, R11_scratch1, R12_scratch2);
+ __ merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ noreg, R11_scratch1, R12_scratch2);
__ restore_interpreter_state(R11_scratch1);
__ ld(R12_scratch2, _ijava_state_neg(top_frame_sp), R11_scratch1);
__ resize_frame_absolute(R12_scratch2, R11_scratch1, R0);
- __ mtlr(return_pc);
if (ProfileInterpreter) {
__ set_method_data_pointer_for_bcp();
}
+#if INCLUDE_JVMTI
+ Label L_done;
+
+ __ lbz(R11_scratch1, 0, R14_bcp);
+ __ cmpwi(CCR0, R11_scratch1, Bytecodes::_invokestatic);
+ __ bne(CCR0, L_done);
+
+ // The member name argument must be restored if _invokestatic is re-executed after a PopFrame call.
+ // Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL.
+ __ ld(R4_ARG2, 0, R18_locals);
+ __ call_VM(R11_scratch1, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null),
+ R4_ARG2, R19_method, R14_bcp);
+
+ __ cmpdi(CCR0, R11_scratch1, 0);
+ __ beq(CCR0, L_done);
+
+ __ std(R11_scratch1, wordSize, R15_esp);
+ __ bind(L_done);
+#endif // INCLUDE_JVMTI
__ dispatch_next(vtos);
}
// end of JVMTI PopFrame support
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Fri May 23 09:05:24 2014 -0700
@@ -64,7 +64,7 @@
assert_different_registers(Rtmp1, Rtmp2, Rtmp3, Rval, Rbase);
switch (barrier) {
-#ifndef SERIALGC
+#if INCLUDE_ALL_GCS
case BarrierSet::G1SATBCT:
case BarrierSet::G1SATBCTLogging:
{
@@ -104,7 +104,7 @@
__ bind(Ldone);
}
break;
-#endif // SERIALGC
+#endif // INCLUDE_ALL_GCS
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
{
@@ -259,17 +259,17 @@
switch (value) {
default: ShouldNotReachHere();
case 0: {
- int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&zero, R0);
+ int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&zero, R0, true);
__ lfs(F15_ftos, simm16_offset, R11_scratch1);
break;
}
case 1: {
- int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&one, R0);
+ int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&one, R0, true);
__ lfs(F15_ftos, simm16_offset, R11_scratch1);
break;
}
case 2: {
- int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&two, R0);
+ int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&two, R0, true);
__ lfs(F15_ftos, simm16_offset, R11_scratch1);
break;
}
@@ -282,12 +282,12 @@
static double one = 1.0;
switch (value) {
case 0: {
- int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&zero, R0);
+ int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&zero, R0, true);
__ lfd(F15_ftos, simm16_offset, R11_scratch1);
break;
}
case 1: {
- int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&one, R0);
+ int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&one, R0, true);
__ lfd(F15_ftos, simm16_offset, R11_scratch1);
break;
}
@@ -3453,16 +3453,6 @@
Rscratch1 = R11_scratch1,
Rscratch2 = R12_scratch2;
- if (!EnableInvokeDynamic) {
- // We should not encounter this bytecode if !EnableInvokeDynamic.
- // The verifier will stop it. However, if we get past the verifier,
- // this will stop the thread in a reasonable way, without crashing the JVM.
- __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeError));
- // The call_VM checks for exception, so we should never return here.
- __ should_not_reach_here();
- return;
- }
-
prepare_invoke(byte_no, Rmethod, Rret_addr, Rscratch1, noreg, Rflags, Rscratch2);
// Profile this call.
@@ -3486,12 +3476,6 @@
Rscratch1 = R11_scratch1,
Rscratch2 = R12_scratch2;
- if (!EnableInvokeDynamic) {
- // Rewriter does not generate this bytecode.
- __ should_not_reach_here();
- return;
- }
-
prepare_invoke(byte_no, Rmethod, Rret_addr, Rscratch1, Rrecv, Rflags, Rscratch2);
__ verify_method_ptr(Rmethod);
__ null_check_throw(Rrecv, -1, Rscratch2);
@@ -3728,9 +3712,9 @@
transition(atos, atos);
Label Ldone, Lis_null, Lquicked, Lresolved;
- Register Roffset = R5_ARG3,
+ Register Roffset = R6_ARG4,
RobjKlass = R4_ARG2,
- RspecifiedKlass = R6_ARG4, // Generate_ClassCastException_verbose_handler will expect this register.
+ RspecifiedKlass = R5_ARG3, // Generate_ClassCastException_verbose_handler will read value from this register.
Rcpool = R11_scratch1,
Rtags = R12_scratch2;
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -123,8 +123,13 @@
fpop2_op3 = 0x35,
impdep1_op3 = 0x36,
aes3_op3 = 0x36,
+ alignaddr_op3 = 0x36,
+ faligndata_op3 = 0x36,
flog3_op3 = 0x36,
+ edge_op3 = 0x36,
+ fsrc_op3 = 0x36,
impdep2_op3 = 0x37,
+ stpartialf_op3 = 0x37,
jmpl_op3 = 0x38,
rett_op3 = 0x39,
trap_op3 = 0x3a,
@@ -175,17 +180,23 @@
enum opfs {
// selected opfs
+ edge8n_opf = 0x01,
+
fmovs_opf = 0x01,
fmovd_opf = 0x02,
fnegs_opf = 0x05,
fnegd_opf = 0x06,
+ alignaddr_opf = 0x18,
+
fadds_opf = 0x41,
faddd_opf = 0x42,
fsubs_opf = 0x45,
fsubd_opf = 0x46,
+ faligndata_opf = 0x48,
+
fmuls_opf = 0x49,
fmuld_opf = 0x4a,
fdivs_opf = 0x4d,
@@ -348,6 +359,8 @@
ASI_PRIMARY = 0x80,
ASI_PRIMARY_NOFAULT = 0x82,
ASI_PRIMARY_LITTLE = 0x88,
+ // 8x8-bit partial store
+ ASI_PST8_PRIMARY = 0xC0,
// Block initializing store
ASI_ST_BLKINIT_PRIMARY = 0xE2,
// Most-Recently-Used (MRU) BIS variant
@@ -585,6 +598,9 @@
// instruction only in VIS1
static void vis1_only() { assert( VM_Version::has_vis1(), "This instruction only works on SPARC with VIS1"); }
+ // instruction only in VIS2
+ static void vis2_only() { assert( VM_Version::has_vis2(), "This instruction only works on SPARC with VIS2"); }
+
// instruction only in VIS3
static void vis3_only() { assert( VM_Version::has_vis3(), "This instruction only works on SPARC with VIS3"); }
@@ -1164,6 +1180,20 @@
inline void wrfprs( Register d) { v9_only(); emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(6, 29, 25)); }
+ // VIS1 instructions
+
+ void alignaddr( Register s1, Register s2, Register d ) { vis1_only(); emit_int32( op(arith_op) | rd(d) | op3(alignaddr_op3) | rs1(s1) | opf(alignaddr_opf) | rs2(s2)); }
+
+ void faligndata( FloatRegister s1, FloatRegister s2, FloatRegister d ) { vis1_only(); emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(faligndata_op3) | fs1(s1, FloatRegisterImpl::D) | opf(faligndata_opf) | fs2(s2, FloatRegisterImpl::D)); }
+
+ void fsrc2( FloatRegisterImpl::Width w, FloatRegister s2, FloatRegister d ) { vis1_only(); emit_int32( op(arith_op) | fd(d, w) | op3(fsrc_op3) | opf(0x7A - w) | fs2(s2, w)); }
+
+ void stpartialf( Register s1, Register s2, FloatRegister d, int ia = -1 ) { vis1_only(); emit_int32( op(ldst_op) | fd(d, FloatRegisterImpl::D) | op3(stpartialf_op3) | rs1(s1) | imm_asi(ia) | rs2(s2)); }
+
+ // VIS2 instructions
+
+ void edge8n( Register s1, Register s2, Register d ) { vis2_only(); emit_int32( op(arith_op) | rd(d) | op3(edge_op3) | rs1(s1) | opf(edge8n_opf) | rs2(s2)); }
+
// VIS3 instructions
void movstosw( FloatRegister s, Register d ) { vis3_only(); emit_int32( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mstosw_opf) | fs2(s, FloatRegisterImpl::S)); }
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.hpp Fri May 23 09:05:24 2014 -0700
@@ -259,8 +259,8 @@
// next two fns read and write Lmonitors value,
private:
- BasicObjectLock* interpreter_frame_monitors() const { return *interpreter_frame_monitors_addr(); }
- void interpreter_frame_set_monitors(BasicObjectLock* monitors) { *interpreter_frame_monitors_addr() = monitors; }
+ BasicObjectLock* interpreter_frame_monitors() const;
+ void interpreter_frame_set_monitors(BasicObjectLock* monitors);
#else
public:
inline interpreterState get_interpreterState() const {
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -226,6 +226,13 @@
return (Method**)sp_addr_at( Lmethod->sp_offset_in_saved_window());
}
+inline BasicObjectLock* frame::interpreter_frame_monitors() const {
+ return *interpreter_frame_monitors_addr();
+}
+
+inline void frame::interpreter_frame_set_monitors(BasicObjectLock* monitors) {
+ *interpreter_frame_monitors_addr() = monitors;
+}
// Constant pool cache
--- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp Fri May 23 09:05:24 2014 -0700
@@ -727,7 +727,6 @@
if (index_size == sizeof(u2)) {
get_2_byte_integer_at_bcp(bcp_offset, temp, index, Unsigned);
} else if (index_size == sizeof(u4)) {
- assert(EnableInvokeDynamic, "giant index used only for JSR 292");
get_4_byte_integer_at_bcp(bcp_offset, temp, index);
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
xor3(index, -1, index); // convert to plain index
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@
private:
#ifdef PRODUCT
-#define inc_counter_np(a,b,c) (0)
+#define inc_counter_np(a,b,c)
#else
#define inc_counter_np(counter, t1, t2) \
BLOCK_COMMENT("inc_counter " #counter); \
@@ -1055,7 +1055,7 @@
Label& L_loop, bool use_prefetch, bool use_bis);
void disjoint_copy_core(Register from, Register to, Register count, int log2_elem_size,
- int iter_size, CopyLoopFunc copy_loop_func) {
+ int iter_size, StubGenerator::CopyLoopFunc copy_loop_func) {
Label L_copy;
assert(log2_elem_size <= 3, "the following code should be changed");
@@ -1206,7 +1206,7 @@
__ inc(from, 8);
__ sllx(O3, left_shift, O3);
- disjoint_copy_core(from, to, count, log2_elem_size, 16, copy_16_bytes_shift_loop);
+ disjoint_copy_core(from, to, count, log2_elem_size, 16, &StubGenerator::copy_16_bytes_shift_loop);
__ inccc(count, count_dec>>1 ); // + 8 bytes
__ brx(Assembler::negative, true, Assembler::pn, L_copy_last_bytes);
@@ -2085,7 +2085,7 @@
__ dec(count, 4); // The cmp at the beginning guaranty count >= 4
__ sllx(O3, 32, O3);
- disjoint_copy_core(from, to, count, 2, 16, copy_16_bytes_loop);
+ disjoint_copy_core(from, to, count, 2, 16, &StubGenerator::copy_16_bytes_loop);
__ br(Assembler::always, false, Assembler::pt, L_copy_4_bytes);
__ delayed()->inc(count, 4); // restore 'count'
@@ -2366,7 +2366,7 @@
// count >= 0 (original count - 8)
__ mov(from, from64);
- disjoint_copy_core(from64, to64, count, 3, 64, copy_64_bytes_loop);
+ disjoint_copy_core(from64, to64, count, 3, 64, &StubGenerator::copy_64_bytes_loop);
// Restore O4(offset0), O5(offset8)
__ sub(from64, from, offset0);
@@ -3305,9 +3305,12 @@
}
address generate_aescrypt_encryptBlock() {
+ // required since we read expanded key 'int' array starting first element without alignment considerations
+ assert((arrayOopDesc::base_offset_in_bytes(T_INT) & 7) == 0,
+ "the following code assumes that first element of an int array is aligned to 8 bytes");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aesencryptBlock");
- Label L_doLast128bit, L_storeOutput;
+ StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
+ Label L_load_misaligned_input, L_load_expanded_key, L_doLast128bit, L_storeOutput, L_store_misaligned_output;
address start = __ pc();
Register from = O0; // source byte array
Register to = O1; // destination byte array
@@ -3317,15 +3320,33 @@
// read expanded key length
__ ldsw(Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)), keylen, 0);
- // load input into F54-F56; F30-F31 used as temp
- __ ldf(FloatRegisterImpl::S, from, 0, F30);
- __ ldf(FloatRegisterImpl::S, from, 4, F31);
- __ fmov(FloatRegisterImpl::D, F30, F54);
- __ ldf(FloatRegisterImpl::S, from, 8, F30);
- __ ldf(FloatRegisterImpl::S, from, 12, F31);
- __ fmov(FloatRegisterImpl::D, F30, F56);
-
- // load expanded key
+ // Method to address arbitrary alignment for load instructions:
+ // Check last 3 bits of 'from' address to see if it is aligned to 8-byte boundary
+ // If zero/aligned then continue with double FP load instructions
+ // If not zero/mis-aligned then alignaddr will set GSR.align with number of bytes to skip during faligndata
+ // alignaddr will also convert arbitrary aligned 'from' address to nearest 8-byte aligned address
+ // load 3 * 8-byte components (to read 16 bytes input) in 3 different FP regs starting at this aligned address
+ // faligndata will then extract (based on GSR.align value) the appropriate 8 bytes from the 2 source regs
+
+ // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(from, 7, G0);
+ __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input);
+ __ delayed()->alignaddr(from, G0, from);
+
+ // aligned case: load input into F54-F56
+ __ ldf(FloatRegisterImpl::D, from, 0, F54);
+ __ ldf(FloatRegisterImpl::D, from, 8, F56);
+ __ ba_short(L_load_expanded_key);
+
+ __ BIND(L_load_misaligned_input);
+ __ ldf(FloatRegisterImpl::D, from, 0, F54);
+ __ ldf(FloatRegisterImpl::D, from, 8, F56);
+ __ ldf(FloatRegisterImpl::D, from, 16, F58);
+ __ faligndata(F54, F56, F54);
+ __ faligndata(F56, F58, F56);
+
+ __ BIND(L_load_expanded_key);
+ // Since we load expanded key buffers starting first element, 8-byte alignment is guaranteed
for ( int i = 0; i <= 38; i += 2 ) {
__ ldf(FloatRegisterImpl::D, key, i*4, as_FloatRegister(i));
}
@@ -3365,8 +3386,7 @@
__ ldf(FloatRegisterImpl::D, key, 232, F50);
__ aes_eround01(F52, F54, F56, F58); //round 13
__ aes_eround23(F46, F54, F56, F60);
- __ br(Assembler::always, false, Assembler::pt, L_storeOutput);
- __ delayed()->nop();
+ __ ba_short(L_storeOutput);
__ BIND(L_doLast128bit);
__ ldf(FloatRegisterImpl::D, key, 160, F48);
@@ -3377,23 +3397,62 @@
__ aes_eround01_l(F48, F58, F60, F54); //last round
__ aes_eround23_l(F50, F58, F60, F56);
- // store output into the destination array, F0-F1 used as temp
- __ fmov(FloatRegisterImpl::D, F54, F0);
- __ stf(FloatRegisterImpl::S, F0, to, 0);
- __ stf(FloatRegisterImpl::S, F1, to, 4);
- __ fmov(FloatRegisterImpl::D, F56, F0);
- __ stf(FloatRegisterImpl::S, F0, to, 8);
+ // Method to address arbitrary alignment for store instructions:
+ // Check last 3 bits of 'dest' address to see if it is aligned to 8-byte boundary
+ // If zero/aligned then continue with double FP store instructions
+ // If not zero/mis-aligned then edge8n will generate edge mask in result reg (O3 in below case)
+ // Example: If dest address is 0x07 and nearest 8-byte aligned address is 0x00 then edge mask will be 00000001
+ // Compute (8-n) where n is # of bytes skipped by partial store(stpartialf) inst from edge mask, n=7 in this case
+ // We get the value of n from the andcc that checks 'dest' alignment. n is available in O5 in below case.
+ // Set GSR.align to (8-n) using alignaddr
+ // Circular byte shift store values by n places so that the original bytes are at correct position for stpartialf
+ // Set the arbitrarily aligned 'dest' address to nearest 8-byte aligned address
+ // Store (partial) the original first (8-n) bytes starting at the original 'dest' address
+ // Negate the edge mask so that the subsequent stpartialf can store the original (8-n-1)th through 8th bytes at appropriate address
+ // We need to execute this process for both the 8-byte result values
+
+ // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(to, 7, O5);
+ __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output);
+ __ delayed()->edge8n(to, G0, O3);
+
+ // aligned case: store output into the destination array
+ __ stf(FloatRegisterImpl::D, F54, to, 0);
__ retl();
- __ delayed()->stf(FloatRegisterImpl::S, F1, to, 12);
+ __ delayed()->stf(FloatRegisterImpl::D, F56, to, 8);
+
+ __ BIND(L_store_misaligned_output);
+ __ add(to, 8, O4);
+ __ mov(8, O2);
+ __ sub(O2, O5, O2);
+ __ alignaddr(O2, G0, O2);
+ __ faligndata(F54, F54, F54);
+ __ faligndata(F56, F56, F56);
+ __ and3(to, -8, to);
+ __ and3(O4, -8, O4);
+ __ stpartialf(to, O3, F54, Assembler::ASI_PST8_PRIMARY);
+ __ stpartialf(O4, O3, F56, Assembler::ASI_PST8_PRIMARY);
+ __ add(to, 8, to);
+ __ add(O4, 8, O4);
+ __ orn(G0, O3, O3);
+ __ stpartialf(to, O3, F54, Assembler::ASI_PST8_PRIMARY);
+ __ retl();
+ __ delayed()->stpartialf(O4, O3, F56, Assembler::ASI_PST8_PRIMARY);
return start;
}
address generate_aescrypt_decryptBlock() {
+ assert((arrayOopDesc::base_offset_in_bytes(T_INT) & 7) == 0,
+ "the following code assumes that first element of an int array is aligned to 8 bytes");
+ // required since we read original key 'byte' array as well in the decryption stubs
+ assert((arrayOopDesc::base_offset_in_bytes(T_BYTE) & 7) == 0,
+ "the following code assumes that first element of a byte array is aligned to 8 bytes");
__ align(CodeEntryAlignment);
- StubCodeMark mark(this, "StubRoutines", "aesdecryptBlock");
+ StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
address start = __ pc();
- Label L_expand192bit, L_expand256bit, L_common_transform;
+ Label L_load_misaligned_input, L_load_original_key, L_expand192bit, L_expand256bit, L_reload_misaligned_input;
+ Label L_256bit_transform, L_common_transform, L_store_misaligned_output;
Register from = O0; // source byte array
Register to = O1; // destination byte array
Register key = O2; // expanded key array
@@ -3403,15 +3462,29 @@
// read expanded key array length
__ ldsw(Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)), keylen, 0);
- // load input into F52-F54; F30,F31 used as temp
- __ ldf(FloatRegisterImpl::S, from, 0, F30);
- __ ldf(FloatRegisterImpl::S, from, 4, F31);
- __ fmov(FloatRegisterImpl::D, F30, F52);
- __ ldf(FloatRegisterImpl::S, from, 8, F30);
- __ ldf(FloatRegisterImpl::S, from, 12, F31);
- __ fmov(FloatRegisterImpl::D, F30, F54);
-
+ // save 'from' since we may need to recheck alignment in case of 256-bit decryption
+ __ mov(from, G1);
+
+ // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(from, 7, G0);
+ __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input);
+ __ delayed()->alignaddr(from, G0, from);
+
+ // aligned case: load input into F52-F54
+ __ ldf(FloatRegisterImpl::D, from, 0, F52);
+ __ ldf(FloatRegisterImpl::D, from, 8, F54);
+ __ ba_short(L_load_original_key);
+
+ __ BIND(L_load_misaligned_input);
+ __ ldf(FloatRegisterImpl::D, from, 0, F52);
+ __ ldf(FloatRegisterImpl::D, from, 8, F54);
+ __ ldf(FloatRegisterImpl::D, from, 16, F56);
+ __ faligndata(F52, F54, F52);
+ __ faligndata(F54, F56, F54);
+
+ __ BIND(L_load_original_key);
// load original key from SunJCE expanded decryption key
+ // Since we load original key buffer starting first element, 8-byte alignment is guaranteed
for ( int i = 0; i <= 3; i++ ) {
__ ldf(FloatRegisterImpl::S, original_key, i*4, as_FloatRegister(i));
}
@@ -3432,8 +3505,7 @@
// perform 128-bit key specific inverse cipher transformation
__ fxor(FloatRegisterImpl::D, F42, F54, F54);
__ fxor(FloatRegisterImpl::D, F40, F52, F52);
- __ br(Assembler::always, false, Assembler::pt, L_common_transform);
- __ delayed()->nop();
+ __ ba_short(L_common_transform);
__ BIND(L_expand192bit);
@@ -3457,8 +3529,7 @@
__ aes_dround01(F44, F52, F54, F56);
__ aes_dround23(F42, F56, F58, F54);
__ aes_dround01(F40, F56, F58, F52);
- __ br(Assembler::always, false, Assembler::pt, L_common_transform);
- __ delayed()->nop();
+ __ ba_short(L_common_transform);
__ BIND(L_expand256bit);
@@ -3478,14 +3549,31 @@
__ aes_kexpand2(F50, F56, F58);
for ( int i = 0; i <= 6; i += 2 ) {
- __ fmov(FloatRegisterImpl::D, as_FloatRegister(58-i), as_FloatRegister(i));
+ __ fsrc2(FloatRegisterImpl::D, as_FloatRegister(58-i), as_FloatRegister(i));
}
- // load input into F52-F54
+ // reload original 'from' address
+ __ mov(G1, from);
+
+ // re-check 8-byte alignment
+ __ andcc(from, 7, G0);
+ __ br(Assembler::notZero, true, Assembler::pn, L_reload_misaligned_input);
+ __ delayed()->alignaddr(from, G0, from);
+
+ // aligned case: load input into F52-F54
__ ldf(FloatRegisterImpl::D, from, 0, F52);
__ ldf(FloatRegisterImpl::D, from, 8, F54);
+ __ ba_short(L_256bit_transform);
+
+ __ BIND(L_reload_misaligned_input);
+ __ ldf(FloatRegisterImpl::D, from, 0, F52);
+ __ ldf(FloatRegisterImpl::D, from, 8, F54);
+ __ ldf(FloatRegisterImpl::D, from, 16, F56);
+ __ faligndata(F52, F54, F52);
+ __ faligndata(F54, F56, F54);
// perform 256-bit key specific inverse cipher transformation
+ __ BIND(L_256bit_transform);
__ fxor(FloatRegisterImpl::D, F0, F54, F54);
__ fxor(FloatRegisterImpl::D, F2, F52, F52);
__ aes_dround23(F4, F52, F54, F58);
@@ -3515,43 +3603,71 @@
}
}
- // store output to destination array, F0-F1 used as temp
- __ fmov(FloatRegisterImpl::D, F52, F0);
- __ stf(FloatRegisterImpl::S, F0, to, 0);
- __ stf(FloatRegisterImpl::S, F1, to, 4);
- __ fmov(FloatRegisterImpl::D, F54, F0);
- __ stf(FloatRegisterImpl::S, F0, to, 8);
+ // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(to, 7, O5);
+ __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output);
+ __ delayed()->edge8n(to, G0, O3);
+
+ // aligned case: store output into the destination array
+ __ stf(FloatRegisterImpl::D, F52, to, 0);
__ retl();
- __ delayed()->stf(FloatRegisterImpl::S, F1, to, 12);
+ __ delayed()->stf(FloatRegisterImpl::D, F54, to, 8);
+
+ __ BIND(L_store_misaligned_output);
+ __ add(to, 8, O4);
+ __ mov(8, O2);
+ __ sub(O2, O5, O2);
+ __ alignaddr(O2, G0, O2);
+ __ faligndata(F52, F52, F52);
+ __ faligndata(F54, F54, F54);
+ __ and3(to, -8, to);
+ __ and3(O4, -8, O4);
+ __ stpartialf(to, O3, F52, Assembler::ASI_PST8_PRIMARY);
+ __ stpartialf(O4, O3, F54, Assembler::ASI_PST8_PRIMARY);
+ __ add(to, 8, to);
+ __ add(O4, 8, O4);
+ __ orn(G0, O3, O3);
+ __ stpartialf(to, O3, F52, Assembler::ASI_PST8_PRIMARY);
+ __ retl();
+ __ delayed()->stpartialf(O4, O3, F54, Assembler::ASI_PST8_PRIMARY);
return start;
}
address generate_cipherBlockChaining_encryptAESCrypt() {
+ assert((arrayOopDesc::base_offset_in_bytes(T_INT) & 7) == 0,
+ "the following code assumes that first element of an int array is aligned to 8 bytes");
+ assert((arrayOopDesc::base_offset_in_bytes(T_BYTE) & 7) == 0,
+ "the following code assumes that first element of a byte array is aligned to 8 bytes");
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
- Label L_cbcenc128, L_cbcenc192, L_cbcenc256;
+ Label L_cbcenc128, L_load_misaligned_input_128bit, L_128bit_transform, L_store_misaligned_output_128bit;
+ Label L_check_loop_end_128bit, L_cbcenc192, L_load_misaligned_input_192bit, L_192bit_transform;
+ Label L_store_misaligned_output_192bit, L_check_loop_end_192bit, L_cbcenc256, L_load_misaligned_input_256bit;
+ Label L_256bit_transform, L_store_misaligned_output_256bit, L_check_loop_end_256bit;
address start = __ pc();
- Register from = O0; // source byte array
- Register to = O1; // destination byte array
- Register key = O2; // expanded key array
- Register rvec = O3; // init vector
- const Register len_reg = O4; // cipher length
- const Register keylen = O5; // reg for storing expanded key array length
-
- // save cipher len to return in the end
- __ mov(len_reg, L1);
+ Register from = I0; // source byte array
+ Register to = I1; // destination byte array
+ Register key = I2; // expanded key array
+ Register rvec = I3; // init vector
+ const Register len_reg = I4; // cipher length
+ const Register keylen = I5; // reg for storing expanded key array length
+
+ // save cipher len before save_frame, to return in the end
+ __ mov(O4, L0);
+ __ save_frame(0);
// read expanded key length
__ ldsw(Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)), keylen, 0);
- // load init vector
+ // load initial vector, 8-byte alignment is guranteed
__ ldf(FloatRegisterImpl::D, rvec, 0, F60);
__ ldf(FloatRegisterImpl::D, rvec, 8, F62);
+ // load key, 8-byte alignment is guranteed
__ ldx(key,0,G1);
- __ ldx(key,8,G2);
-
- // start loading expanded key
+ __ ldx(key,8,G5);
+
+ // start loading expanded key, 8-byte alignment is guranteed
for ( int i = 0, j = 16; i <= 38; i += 2, j += 8 ) {
__ ldf(FloatRegisterImpl::D, key, j, as_FloatRegister(i));
}
@@ -3571,15 +3687,35 @@
}
// 256-bit original key size
- __ br(Assembler::always, false, Assembler::pt, L_cbcenc256);
- __ delayed()->nop();
+ __ ba_short(L_cbcenc256);
__ align(OptoLoopAlignment);
__ BIND(L_cbcenc128);
+ // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(from, 7, G0);
+ __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input_128bit);
+ __ delayed()->mov(from, L1); // save original 'from' address before alignaddr
+
+ // aligned case: load input into G3 and G4
__ ldx(from,0,G3);
__ ldx(from,8,G4);
+ __ ba_short(L_128bit_transform);
+
+ __ BIND(L_load_misaligned_input_128bit);
+ // can clobber F48, F50 and F52 as they are not used in 128 and 192-bit key encryption
+ __ alignaddr(from, G0, from);
+ __ ldf(FloatRegisterImpl::D, from, 0, F48);
+ __ ldf(FloatRegisterImpl::D, from, 8, F50);
+ __ ldf(FloatRegisterImpl::D, from, 16, F52);
+ __ faligndata(F48, F50, F48);
+ __ faligndata(F50, F52, F50);
+ __ movdtox(F48, G3);
+ __ movdtox(F50, G4);
+ __ mov(L1, from);
+
+ __ BIND(L_128bit_transform);
__ xor3(G1,G3,G3);
- __ xor3(G2,G4,G4);
+ __ xor3(G5,G4,G4);
__ movxtod(G3,F56);
__ movxtod(G4,F58);
__ fxor(FloatRegisterImpl::D, F60, F56, F60);
@@ -3598,24 +3734,81 @@
}
}
+ // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(to, 7, L1);
+ __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_128bit);
+ __ delayed()->edge8n(to, G0, L2);
+
+ // aligned case: store output into the destination array
__ stf(FloatRegisterImpl::D, F60, to, 0);
__ stf(FloatRegisterImpl::D, F62, to, 8);
+ __ ba_short(L_check_loop_end_128bit);
+
+ __ BIND(L_store_misaligned_output_128bit);
+ __ add(to, 8, L3);
+ __ mov(8, L4);
+ __ sub(L4, L1, L4);
+ __ alignaddr(L4, G0, L4);
+ // save cipher text before circular right shift
+ // as it needs to be stored as iv for next block (see code before next retl)
+ __ movdtox(F60, L6);
+ __ movdtox(F62, L7);
+ __ faligndata(F60, F60, F60);
+ __ faligndata(F62, F62, F62);
+ __ mov(to, L5);
+ __ and3(to, -8, to);
+ __ and3(L3, -8, L3);
+ __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+ __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+ __ add(to, 8, to);
+ __ add(L3, 8, L3);
+ __ orn(G0, L2, L2);
+ __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+ __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+ __ mov(L5, to);
+ __ movxtod(L6, F60);
+ __ movxtod(L7, F62);
+
+ __ BIND(L_check_loop_end_128bit);
__ add(from, 16, from);
__ add(to, 16, to);
__ subcc(len_reg, 16, len_reg);
__ br(Assembler::notEqual, false, Assembler::pt, L_cbcenc128);
__ delayed()->nop();
+ // re-init intial vector for next block, 8-byte alignment is guaranteed
__ stf(FloatRegisterImpl::D, F60, rvec, 0);
__ stf(FloatRegisterImpl::D, F62, rvec, 8);
+ __ restore();
__ retl();
- __ delayed()->mov(L1, O0);
+ __ delayed()->mov(L0, O0);
__ align(OptoLoopAlignment);
__ BIND(L_cbcenc192);
+ // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(from, 7, G0);
+ __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input_192bit);
+ __ delayed()->mov(from, L1); // save original 'from' address before alignaddr
+
+ // aligned case: load input into G3 and G4
__ ldx(from,0,G3);
__ ldx(from,8,G4);
+ __ ba_short(L_192bit_transform);
+
+ __ BIND(L_load_misaligned_input_192bit);
+ // can clobber F48, F50 and F52 as they are not used in 128 and 192-bit key encryption
+ __ alignaddr(from, G0, from);
+ __ ldf(FloatRegisterImpl::D, from, 0, F48);
+ __ ldf(FloatRegisterImpl::D, from, 8, F50);
+ __ ldf(FloatRegisterImpl::D, from, 16, F52);
+ __ faligndata(F48, F50, F48);
+ __ faligndata(F50, F52, F50);
+ __ movdtox(F48, G3);
+ __ movdtox(F50, G4);
+ __ mov(L1, from);
+
+ __ BIND(L_192bit_transform);
__ xor3(G1,G3,G3);
- __ xor3(G2,G4,G4);
+ __ xor3(G5,G4,G4);
__ movxtod(G3,F56);
__ movxtod(G4,F58);
__ fxor(FloatRegisterImpl::D, F60, F56, F60);
@@ -3634,24 +3827,81 @@
}
}
+ // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(to, 7, L1);
+ __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_192bit);
+ __ delayed()->edge8n(to, G0, L2);
+
+ // aligned case: store output into the destination array
__ stf(FloatRegisterImpl::D, F60, to, 0);
__ stf(FloatRegisterImpl::D, F62, to, 8);
+ __ ba_short(L_check_loop_end_192bit);
+
+ __ BIND(L_store_misaligned_output_192bit);
+ __ add(to, 8, L3);
+ __ mov(8, L4);
+ __ sub(L4, L1, L4);
+ __ alignaddr(L4, G0, L4);
+ __ movdtox(F60, L6);
+ __ movdtox(F62, L7);
+ __ faligndata(F60, F60, F60);
+ __ faligndata(F62, F62, F62);
+ __ mov(to, L5);
+ __ and3(to, -8, to);
+ __ and3(L3, -8, L3);
+ __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+ __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+ __ add(to, 8, to);
+ __ add(L3, 8, L3);
+ __ orn(G0, L2, L2);
+ __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+ __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+ __ mov(L5, to);
+ __ movxtod(L6, F60);
+ __ movxtod(L7, F62);
+
+ __ BIND(L_check_loop_end_192bit);
__ add(from, 16, from);
__ subcc(len_reg, 16, len_reg);
__ add(to, 16, to);
__ br(Assembler::notEqual, false, Assembler::pt, L_cbcenc192);
__ delayed()->nop();
+ // re-init intial vector for next block, 8-byte alignment is guaranteed
__ stf(FloatRegisterImpl::D, F60, rvec, 0);
__ stf(FloatRegisterImpl::D, F62, rvec, 8);
+ __ restore();
__ retl();
- __ delayed()->mov(L1, O0);
+ __ delayed()->mov(L0, O0);
__ align(OptoLoopAlignment);
__ BIND(L_cbcenc256);
+ // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(from, 7, G0);
+ __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input_256bit);
+ __ delayed()->mov(from, L1); // save original 'from' address before alignaddr
+
+ // aligned case: load input into G3 and G4
__ ldx(from,0,G3);
__ ldx(from,8,G4);
+ __ ba_short(L_256bit_transform);
+
+ __ BIND(L_load_misaligned_input_256bit);
+ // cannot clobber F48, F50 and F52. F56, F58 can be used though
+ __ alignaddr(from, G0, from);
+ __ movdtox(F60, L2); // save F60 before overwriting
+ __ ldf(FloatRegisterImpl::D, from, 0, F56);
+ __ ldf(FloatRegisterImpl::D, from, 8, F58);
+ __ ldf(FloatRegisterImpl::D, from, 16, F60);
+ __ faligndata(F56, F58, F56);
+ __ faligndata(F58, F60, F58);
+ __ movdtox(F56, G3);
+ __ movdtox(F58, G4);
+ __ mov(L1, from);
+ __ movxtod(L2, F60);
+
+ __ BIND(L_256bit_transform);
__ xor3(G1,G3,G3);
- __ xor3(G2,G4,G4);
+ __ xor3(G5,G4,G4);
__ movxtod(G3,F56);
__ movxtod(G4,F58);
__ fxor(FloatRegisterImpl::D, F60, F56, F60);
@@ -3670,26 +3920,69 @@
}
}
+ // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(to, 7, L1);
+ __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_256bit);
+ __ delayed()->edge8n(to, G0, L2);
+
+ // aligned case: store output into the destination array
__ stf(FloatRegisterImpl::D, F60, to, 0);
__ stf(FloatRegisterImpl::D, F62, to, 8);
+ __ ba_short(L_check_loop_end_256bit);
+
+ __ BIND(L_store_misaligned_output_256bit);
+ __ add(to, 8, L3);
+ __ mov(8, L4);
+ __ sub(L4, L1, L4);
+ __ alignaddr(L4, G0, L4);
+ __ movdtox(F60, L6);
+ __ movdtox(F62, L7);
+ __ faligndata(F60, F60, F60);
+ __ faligndata(F62, F62, F62);
+ __ mov(to, L5);
+ __ and3(to, -8, to);
+ __ and3(L3, -8, L3);
+ __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+ __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+ __ add(to, 8, to);
+ __ add(L3, 8, L3);
+ __ orn(G0, L2, L2);
+ __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+ __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+ __ mov(L5, to);
+ __ movxtod(L6, F60);
+ __ movxtod(L7, F62);
+
+ __ BIND(L_check_loop_end_256bit);
__ add(from, 16, from);
__ subcc(len_reg, 16, len_reg);
__ add(to, 16, to);
__ br(Assembler::notEqual, false, Assembler::pt, L_cbcenc256);
__ delayed()->nop();
+ // re-init intial vector for next block, 8-byte alignment is guaranteed
__ stf(FloatRegisterImpl::D, F60, rvec, 0);
__ stf(FloatRegisterImpl::D, F62, rvec, 8);
+ __ restore();
__ retl();
- __ delayed()->mov(L1, O0);
+ __ delayed()->mov(L0, O0);
return start;
}
address generate_cipherBlockChaining_decryptAESCrypt_Parallel() {
+ assert((arrayOopDesc::base_offset_in_bytes(T_INT) & 7) == 0,
+ "the following code assumes that first element of an int array is aligned to 8 bytes");
+ assert((arrayOopDesc::base_offset_in_bytes(T_BYTE) & 7) == 0,
+ "the following code assumes that first element of a byte array is aligned to 8 bytes");
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
Label L_cbcdec_end, L_expand192bit, L_expand256bit, L_dec_first_block_start;
Label L_dec_first_block128, L_dec_first_block192, L_dec_next2_blocks128, L_dec_next2_blocks192, L_dec_next2_blocks256;
+ Label L_load_misaligned_input_first_block, L_transform_first_block, L_load_misaligned_next2_blocks128, L_transform_next2_blocks128;
+ Label L_load_misaligned_next2_blocks192, L_transform_next2_blocks192, L_load_misaligned_next2_blocks256, L_transform_next2_blocks256;
+ Label L_store_misaligned_output_first_block, L_check_decrypt_end, L_store_misaligned_output_next2_blocks128;
+ Label L_check_decrypt_loop_end128, L_store_misaligned_output_next2_blocks192, L_check_decrypt_loop_end192;
+ Label L_store_misaligned_output_next2_blocks256, L_check_decrypt_loop_end256;
address start = __ pc();
Register from = I0; // source byte array
Register to = I1; // destination byte array
@@ -3704,11 +3997,12 @@
__ save_frame(0); //args are read from I* registers since we save the frame in the beginning
// load original key from SunJCE expanded decryption key
+ // Since we load original key buffer starting first element, 8-byte alignment is guaranteed
for ( int i = 0; i <= 3; i++ ) {
__ ldf(FloatRegisterImpl::S, original_key, i*4, as_FloatRegister(i));
}
- // load initial vector
+ // load initial vector, 8-byte alignment is guaranteed
__ ldx(rvec,0,L0);
__ ldx(rvec,8,L1);
@@ -3733,11 +4027,10 @@
__ movdtox(F42,L3);
__ and3(len_reg, 16, L4);
- __ br_null(L4, false, Assembler::pt, L_dec_next2_blocks128);
- __ delayed()->nop();
-
- __ br(Assembler::always, false, Assembler::pt, L_dec_first_block_start);
- __ delayed()->nop();
+ __ br_null_short(L4, Assembler::pt, L_dec_next2_blocks128);
+ __ nop();
+
+ __ ba_short(L_dec_first_block_start);
__ BIND(L_expand192bit);
// load rest of the 192-bit key
@@ -3758,11 +4051,10 @@
__ movdtox(F50,L3);
__ and3(len_reg, 16, L4);
- __ br_null(L4, false, Assembler::pt, L_dec_next2_blocks192);
- __ delayed()->nop();
-
- __ br(Assembler::always, false, Assembler::pt, L_dec_first_block_start);
- __ delayed()->nop();
+ __ br_null_short(L4, Assembler::pt, L_dec_next2_blocks192);
+ __ nop();
+
+ __ ba_short(L_dec_first_block_start);
__ BIND(L_expand256bit);
// load rest of the 256-bit key
@@ -3785,12 +4077,32 @@
__ movdtox(F58,L3);
__ and3(len_reg, 16, L4);
- __ br_null(L4, false, Assembler::pt, L_dec_next2_blocks256);
- __ delayed()->nop();
+ __ br_null_short(L4, Assembler::pt, L_dec_next2_blocks256);
__ BIND(L_dec_first_block_start);
+ // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(from, 7, G0);
+ __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input_first_block);
+ __ delayed()->mov(from, G1); // save original 'from' address before alignaddr
+
+ // aligned case: load input into L4 and L5
__ ldx(from,0,L4);
__ ldx(from,8,L5);
+ __ ba_short(L_transform_first_block);
+
+ __ BIND(L_load_misaligned_input_first_block);
+ __ alignaddr(from, G0, from);
+ // F58, F60, F62 can be clobbered
+ __ ldf(FloatRegisterImpl::D, from, 0, F58);
+ __ ldf(FloatRegisterImpl::D, from, 8, F60);
+ __ ldf(FloatRegisterImpl::D, from, 16, F62);
+ __ faligndata(F58, F60, F58);
+ __ faligndata(F60, F62, F60);
+ __ movdtox(F58, L4);
+ __ movdtox(F60, L5);
+ __ mov(G1, from);
+
+ __ BIND(L_transform_first_block);
__ xor3(L2,L4,G1);
__ movxtod(G1,F60);
__ xor3(L3,L5,G1);
@@ -3833,9 +4145,36 @@
__ fxor(FloatRegisterImpl::D, F56, F60, F60);
__ fxor(FloatRegisterImpl::D, F58, F62, F62);
+ // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(to, 7, G1);
+ __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_first_block);
+ __ delayed()->edge8n(to, G0, G2);
+
+ // aligned case: store output into the destination array
__ stf(FloatRegisterImpl::D, F60, to, 0);
__ stf(FloatRegisterImpl::D, F62, to, 8);
-
+ __ ba_short(L_check_decrypt_end);
+
+ __ BIND(L_store_misaligned_output_first_block);
+ __ add(to, 8, G3);
+ __ mov(8, G4);
+ __ sub(G4, G1, G4);
+ __ alignaddr(G4, G0, G4);
+ __ faligndata(F60, F60, F60);
+ __ faligndata(F62, F62, F62);
+ __ mov(to, G1);
+ __ and3(to, -8, to);
+ __ and3(G3, -8, G3);
+ __ stpartialf(to, G2, F60, Assembler::ASI_PST8_PRIMARY);
+ __ stpartialf(G3, G2, F62, Assembler::ASI_PST8_PRIMARY);
+ __ add(to, 8, to);
+ __ add(G3, 8, G3);
+ __ orn(G0, G2, G2);
+ __ stpartialf(to, G2, F60, Assembler::ASI_PST8_PRIMARY);
+ __ stpartialf(G3, G2, F62, Assembler::ASI_PST8_PRIMARY);
+ __ mov(G1, to);
+
+ __ BIND(L_check_decrypt_end);
__ add(from, 16, from);
__ add(to, 16, to);
__ subcc(len_reg, 16, len_reg);
@@ -3852,17 +4191,44 @@
__ BIND(L_dec_next2_blocks128);
__ nop();
- // F40:F42 used for first 16-bytes
+ // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(from, 7, G0);
+ __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_next2_blocks128);
+ __ delayed()->mov(from, G1); // save original 'from' address before alignaddr
+
+ // aligned case: load input into G4, G5, L4 and L5
__ ldx(from,0,G4);
__ ldx(from,8,G5);
+ __ ldx(from,16,L4);
+ __ ldx(from,24,L5);
+ __ ba_short(L_transform_next2_blocks128);
+
+ __ BIND(L_load_misaligned_next2_blocks128);
+ __ alignaddr(from, G0, from);
+ // F40, F42, F58, F60, F62 can be clobbered
+ __ ldf(FloatRegisterImpl::D, from, 0, F40);
+ __ ldf(FloatRegisterImpl::D, from, 8, F42);
+ __ ldf(FloatRegisterImpl::D, from, 16, F60);
+ __ ldf(FloatRegisterImpl::D, from, 24, F62);
+ __ ldf(FloatRegisterImpl::D, from, 32, F58);
+ __ faligndata(F40, F42, F40);
+ __ faligndata(F42, F60, F42);
+ __ faligndata(F60, F62, F60);
+ __ faligndata(F62, F58, F62);
+ __ movdtox(F40, G4);
+ __ movdtox(F42, G5);
+ __ movdtox(F60, L4);
+ __ movdtox(F62, L5);
+ __ mov(G1, from);
+
+ __ BIND(L_transform_next2_blocks128);
+ // F40:F42 used for first 16-bytes
__ xor3(L2,G4,G1);
__ movxtod(G1,F40);
__ xor3(L3,G5,G1);
__ movxtod(G1,F42);
// F60:F62 used for next 16-bytes
- __ ldx(from,16,L4);
- __ ldx(from,24,L5);
__ xor3(L2,L4,G1);
__ movxtod(G1,F60);
__ xor3(L3,L5,G1);
@@ -3891,9 +4257,6 @@
__ fxor(FloatRegisterImpl::D, F46, F40, F40);
__ fxor(FloatRegisterImpl::D, F44, F42, F42);
- __ stf(FloatRegisterImpl::D, F40, to, 0);
- __ stf(FloatRegisterImpl::D, F42, to, 8);
-
__ movxtod(G4,F56);
__ movxtod(G5,F58);
__ mov(L4,L0);
@@ -3901,32 +4264,93 @@
__ fxor(FloatRegisterImpl::D, F56, F60, F60);
__ fxor(FloatRegisterImpl::D, F58, F62, F62);
+ // For mis-aligned store of 32 bytes of result we can do:
+ // Circular right-shift all 4 FP registers so that 'head' and 'tail'
+ // parts that need to be stored starting at mis-aligned address are in a FP reg
+ // the other 3 FP regs can thus be stored using regular store
+ // we then use the edge + partial-store mechanism to store the 'head' and 'tail' parts
+
+ // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(to, 7, G1);
+ __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_next2_blocks128);
+ __ delayed()->edge8n(to, G0, G2);
+
+ // aligned case: store output into the destination array
+ __ stf(FloatRegisterImpl::D, F40, to, 0);
+ __ stf(FloatRegisterImpl::D, F42, to, 8);
__ stf(FloatRegisterImpl::D, F60, to, 16);
__ stf(FloatRegisterImpl::D, F62, to, 24);
-
+ __ ba_short(L_check_decrypt_loop_end128);
+
+ __ BIND(L_store_misaligned_output_next2_blocks128);
+ __ mov(8, G4);
+ __ sub(G4, G1, G4);
+ __ alignaddr(G4, G0, G4);
+ __ faligndata(F40, F42, F56); // F56 can be clobbered
+ __ faligndata(F42, F60, F42);
+ __ faligndata(F60, F62, F60);
+ __ faligndata(F62, F40, F40);
+ __ mov(to, G1);
+ __ and3(to, -8, to);
+ __ stpartialf(to, G2, F40, Assembler::ASI_PST8_PRIMARY);
+ __ stf(FloatRegisterImpl::D, F56, to, 8);
+ __ stf(FloatRegisterImpl::D, F42, to, 16);
+ __ stf(FloatRegisterImpl::D, F60, to, 24);
+ __ add(to, 32, to);
+ __ orn(G0, G2, G2);
+ __ stpartialf(to, G2, F40, Assembler::ASI_PST8_PRIMARY);
+ __ mov(G1, to);
+
+ __ BIND(L_check_decrypt_loop_end128);
__ add(from, 32, from);
__ add(to, 32, to);
__ subcc(len_reg, 32, len_reg);
__ br(Assembler::notEqual, false, Assembler::pt, L_dec_next2_blocks128);
__ delayed()->nop();
- __ br(Assembler::always, false, Assembler::pt, L_cbcdec_end);
- __ delayed()->nop();
+ __ ba_short(L_cbcdec_end);
__ align(OptoLoopAlignment);
__ BIND(L_dec_next2_blocks192);
__ nop();
- // F48:F50 used for first 16-bytes
+ // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(from, 7, G0);
+ __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_next2_blocks192);
+ __ delayed()->mov(from, G1); // save original 'from' address before alignaddr
+
+ // aligned case: load input into G4, G5, L4 and L5
__ ldx(from,0,G4);
__ ldx(from,8,G5);
+ __ ldx(from,16,L4);
+ __ ldx(from,24,L5);
+ __ ba_short(L_transform_next2_blocks192);
+
+ __ BIND(L_load_misaligned_next2_blocks192);
+ __ alignaddr(from, G0, from);
+ // F48, F50, F52, F60, F62 can be clobbered
+ __ ldf(FloatRegisterImpl::D, from, 0, F48);
+ __ ldf(FloatRegisterImpl::D, from, 8, F50);
+ __ ldf(FloatRegisterImpl::D, from, 16, F60);
+ __ ldf(FloatRegisterImpl::D, from, 24, F62);
+ __ ldf(FloatRegisterImpl::D, from, 32, F52);
+ __ faligndata(F48, F50, F48);
+ __ faligndata(F50, F60, F50);
+ __ faligndata(F60, F62, F60);
+ __ faligndata(F62, F52, F62);
+ __ movdtox(F48, G4);
+ __ movdtox(F50, G5);
+ __ movdtox(F60, L4);
+ __ movdtox(F62, L5);
+ __ mov(G1, from);
+
+ __ BIND(L_transform_next2_blocks192);
+ // F48:F50 used for first 16-bytes
__ xor3(L2,G4,G1);
__ movxtod(G1,F48);
__ xor3(L3,G5,G1);
__ movxtod(G1,F50);
// F60:F62 used for next 16-bytes
- __ ldx(from,16,L4);
- __ ldx(from,24,L5);
__ xor3(L2,L4,G1);
__ movxtod(G1,F60);
__ xor3(L3,L5,G1);
@@ -3955,9 +4379,6 @@
__ fxor(FloatRegisterImpl::D, F54, F48, F48);
__ fxor(FloatRegisterImpl::D, F52, F50, F50);
- __ stf(FloatRegisterImpl::D, F48, to, 0);
- __ stf(FloatRegisterImpl::D, F50, to, 8);
-
__ movxtod(G4,F56);
__ movxtod(G5,F58);
__ mov(L4,L0);
@@ -3965,32 +4386,87 @@
__ fxor(FloatRegisterImpl::D, F56, F60, F60);
__ fxor(FloatRegisterImpl::D, F58, F62, F62);
+ // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(to, 7, G1);
+ __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_next2_blocks192);
+ __ delayed()->edge8n(to, G0, G2);
+
+ // aligned case: store output into the destination array
+ __ stf(FloatRegisterImpl::D, F48, to, 0);
+ __ stf(FloatRegisterImpl::D, F50, to, 8);
__ stf(FloatRegisterImpl::D, F60, to, 16);
__ stf(FloatRegisterImpl::D, F62, to, 24);
-
+ __ ba_short(L_check_decrypt_loop_end192);
+
+ __ BIND(L_store_misaligned_output_next2_blocks192);
+ __ mov(8, G4);
+ __ sub(G4, G1, G4);
+ __ alignaddr(G4, G0, G4);
+ __ faligndata(F48, F50, F56); // F56 can be clobbered
+ __ faligndata(F50, F60, F50);
+ __ faligndata(F60, F62, F60);
+ __ faligndata(F62, F48, F48);
+ __ mov(to, G1);
+ __ and3(to, -8, to);
+ __ stpartialf(to, G2, F48, Assembler::ASI_PST8_PRIMARY);
+ __ stf(FloatRegisterImpl::D, F56, to, 8);
+ __ stf(FloatRegisterImpl::D, F50, to, 16);
+ __ stf(FloatRegisterImpl::D, F60, to, 24);
+ __ add(to, 32, to);
+ __ orn(G0, G2, G2);
+ __ stpartialf(to, G2, F48, Assembler::ASI_PST8_PRIMARY);
+ __ mov(G1, to);
+
+ __ BIND(L_check_decrypt_loop_end192);
__ add(from, 32, from);
__ add(to, 32, to);
__ subcc(len_reg, 32, len_reg);
__ br(Assembler::notEqual, false, Assembler::pt, L_dec_next2_blocks192);
__ delayed()->nop();
- __ br(Assembler::always, false, Assembler::pt, L_cbcdec_end);
- __ delayed()->nop();
+ __ ba_short(L_cbcdec_end);
__ align(OptoLoopAlignment);
__ BIND(L_dec_next2_blocks256);
__ nop();
- // F0:F2 used for first 16-bytes
+ // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(from, 7, G0);
+ __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_next2_blocks256);
+ __ delayed()->mov(from, G1); // save original 'from' address before alignaddr
+
+ // aligned case: load input into G4, G5, L4 and L5
__ ldx(from,0,G4);
__ ldx(from,8,G5);
+ __ ldx(from,16,L4);
+ __ ldx(from,24,L5);
+ __ ba_short(L_transform_next2_blocks256);
+
+ __ BIND(L_load_misaligned_next2_blocks256);
+ __ alignaddr(from, G0, from);
+ // F0, F2, F4, F60, F62 can be clobbered
+ __ ldf(FloatRegisterImpl::D, from, 0, F0);
+ __ ldf(FloatRegisterImpl::D, from, 8, F2);
+ __ ldf(FloatRegisterImpl::D, from, 16, F60);
+ __ ldf(FloatRegisterImpl::D, from, 24, F62);
+ __ ldf(FloatRegisterImpl::D, from, 32, F4);
+ __ faligndata(F0, F2, F0);
+ __ faligndata(F2, F60, F2);
+ __ faligndata(F60, F62, F60);
+ __ faligndata(F62, F4, F62);
+ __ movdtox(F0, G4);
+ __ movdtox(F2, G5);
+ __ movdtox(F60, L4);
+ __ movdtox(F62, L5);
+ __ mov(G1, from);
+
+ __ BIND(L_transform_next2_blocks256);
+ // F0:F2 used for first 16-bytes
__ xor3(L2,G4,G1);
__ movxtod(G1,F0);
__ xor3(L3,G5,G1);
__ movxtod(G1,F2);
// F60:F62 used for next 16-bytes
- __ ldx(from,16,L4);
- __ ldx(from,24,L5);
__ xor3(L2,L4,G1);
__ movxtod(G1,F60);
__ xor3(L3,L5,G1);
@@ -4043,9 +4519,6 @@
__ fxor(FloatRegisterImpl::D, F6, F0, F0);
__ fxor(FloatRegisterImpl::D, F4, F2, F2);
- __ stf(FloatRegisterImpl::D, F0, to, 0);
- __ stf(FloatRegisterImpl::D, F2, to, 8);
-
__ movxtod(G4,F56);
__ movxtod(G5,F58);
__ mov(L4,L0);
@@ -4053,9 +4526,38 @@
__ fxor(FloatRegisterImpl::D, F56, F60, F60);
__ fxor(FloatRegisterImpl::D, F58, F62, F62);
+ // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+ __ andcc(to, 7, G1);
+ __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_next2_blocks256);
+ __ delayed()->edge8n(to, G0, G2);
+
+ // aligned case: store output into the destination array
+ __ stf(FloatRegisterImpl::D, F0, to, 0);
+ __ stf(FloatRegisterImpl::D, F2, to, 8);
__ stf(FloatRegisterImpl::D, F60, to, 16);
__ stf(FloatRegisterImpl::D, F62, to, 24);
-
+ __ ba_short(L_check_decrypt_loop_end256);
+
+ __ BIND(L_store_misaligned_output_next2_blocks256);
+ __ mov(8, G4);
+ __ sub(G4, G1, G4);
+ __ alignaddr(G4, G0, G4);
+ __ faligndata(F0, F2, F56); // F56 can be clobbered
+ __ faligndata(F2, F60, F2);
+ __ faligndata(F60, F62, F60);
+ __ faligndata(F62, F0, F0);
+ __ mov(to, G1);
+ __ and3(to, -8, to);
+ __ stpartialf(to, G2, F0, Assembler::ASI_PST8_PRIMARY);
+ __ stf(FloatRegisterImpl::D, F56, to, 8);
+ __ stf(FloatRegisterImpl::D, F2, to, 16);
+ __ stf(FloatRegisterImpl::D, F60, to, 24);
+ __ add(to, 32, to);
+ __ orn(G0, G2, G2);
+ __ stpartialf(to, G2, F0, Assembler::ASI_PST8_PRIMARY);
+ __ mov(G1, to);
+
+ __ BIND(L_check_decrypt_loop_end256);
__ add(from, 32, from);
__ add(to, 32, to);
__ subcc(len_reg, 32, len_reg);
@@ -4063,6 +4565,7 @@
__ delayed()->nop();
__ BIND(L_cbcdec_end);
+ // re-init intial vector for next block, 8-byte alignment is guaranteed
__ stx(L0, rvec, 0);
__ stx(L1, rvec, 8);
__ restore();
--- a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp Fri May 23 09:05:24 2014 -0700
@@ -41,7 +41,7 @@
enum /* platform_dependent_constants */ {
// %%%%%%%% May be able to shrink this a lot
code_size1 = 20000, // simply increase if too small (assembler will crash if too small)
- code_size2 = 20000 // simply increase if too small (assembler will crash if too small)
+ code_size2 = 22000 // simply increase if too small (assembler will crash if too small)
};
class Sparc {
--- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Fri May 23 09:05:24 2014 -0700
@@ -1888,7 +1888,7 @@
}
#if INCLUDE_JVMTI
- if (EnableInvokeDynamic) {
+ {
Label L_done;
__ ldub(Address(Lbcp, 0), G1_scratch); // Load current bytecode
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Fri May 23 09:05:24 2014 -0700
@@ -3209,12 +3209,6 @@
transition(vtos, vtos);
assert(byte_no == f1_byte, "use this argument");
- if (!EnableInvokeDynamic) {
- // rewriter does not generate this bytecode
- __ should_not_reach_here();
- return;
- }
-
const Register Rret = Lscratch;
const Register G4_mtype = G4_scratch;
const Register O0_recv = O0;
@@ -3240,17 +3234,6 @@
transition(vtos, vtos);
assert(byte_no == f1_byte, "use this argument");
- if (!EnableInvokeDynamic) {
- // We should not encounter this bytecode if !EnableInvokeDynamic.
- // The verifier will stop it. However, if we get past the verifier,
- // this will stop the thread in a reasonable way, without crashing the JVM.
- __ call_VM(noreg, CAST_FROM_FN_PTR(address,
- InterpreterRuntime::throw_IncompatibleClassChangeError));
- // the call_VM checks for exception, so we should never return here.
- __ should_not_reach_here();
- return;
- }
-
const Register Rret = Lscratch;
const Register G4_callsite = G4_scratch;
const Register Rscratch = G3_scratch;
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -266,9 +266,9 @@
if (!has_vis1()) // Drop to 0 if no VIS1 support
UseVIS = 0;
- // T2 and above should have support for AES instructions
+ // SPARC T4 and above should have support for AES instructions
if (has_aes()) {
- if (UseVIS > 0) { // AES intrinsics use FXOR instruction which is VIS1
+ if (UseVIS > 2) { // AES intrinsics use MOVxTOd/MOVdTOx which are VIS3
if (FLAG_IS_DEFAULT(UseAES)) {
FLAG_SET_DEFAULT(UseAES, true);
}
@@ -282,7 +282,7 @@
}
} else {
if (UseAES || UseAESIntrinsics) {
- warning("SPARC AES intrinsics require VIS1 instruction support. Intrinsics will be disabled.");
+ warning("SPARC AES intrinsics require VIS3 instruction support. Intrinsics will be disabled.");
if (UseAES) {
FLAG_SET_DEFAULT(UseAES, false);
}
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Fri May 23 09:05:24 2014 -0700
@@ -1766,7 +1766,7 @@
// Move Unaligned 256bit Vector
void Assembler::vmovdqu(XMMRegister dst, XMMRegister src) {
- assert(UseAVX, "");
+ assert(UseAVX > 0, "");
bool vector256 = true;
int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, vector256);
emit_int8(0x6F);
@@ -1774,7 +1774,7 @@
}
void Assembler::vmovdqu(XMMRegister dst, Address src) {
- assert(UseAVX, "");
+ assert(UseAVX > 0, "");
InstructionMark im(this);
bool vector256 = true;
vex_prefix(dst, xnoreg, src, VEX_SIMD_F3, vector256);
@@ -1783,7 +1783,7 @@
}
void Assembler::vmovdqu(Address dst, XMMRegister src) {
- assert(UseAVX, "");
+ assert(UseAVX > 0, "");
InstructionMark im(this);
bool vector256 = true;
// swap src<->dst for encoding
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Fri May 23 09:05:24 2014 -0700
@@ -207,7 +207,6 @@
if (index_size == sizeof(u2)) {
load_unsigned_short(reg, Address(rsi, bcp_offset));
} else if (index_size == sizeof(u4)) {
- assert(EnableInvokeDynamic, "giant index used only for JSR 292");
movl(reg, Address(rsi, bcp_offset));
// Check if the secondary index definition is still ~x, otherwise
// we have to change the following assembler code to calculate the
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp Fri May 23 09:05:24 2014 -0700
@@ -205,7 +205,6 @@
if (index_size == sizeof(u2)) {
load_unsigned_short(index, Address(r13, bcp_offset));
} else if (index_size == sizeof(u4)) {
- assert(EnableInvokeDynamic, "giant index used only for JSR 292");
movl(index, Address(r13, bcp_offset));
// Check if the secondary index definition is still ~x, otherwise
// we have to change the following assembler code to calculate the
--- a/hotspot/src/cpu/x86/vm/jni_x86.h Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/jni_x86.h Fri May 23 09:05:24 2014 -0700
@@ -26,8 +26,14 @@
#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_
-#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE)
+#if defined(_WIN32)
+ #define JNIEXPORT __declspec(dllexport)
+ #define JNIIMPORT __declspec(dllimport)
+ #define JNICALL __stdcall
+ typedef int jint;
+ typedef __int64 jlong;
+#else
// Note: please do not change these without also changing jni_md.h in the JDK
// repository
@@ -50,13 +56,6 @@
typedef long long jlong;
#endif
-#else
- #define JNIEXPORT __declspec(dllexport)
- #define JNIIMPORT __declspec(dllimport)
- #define JNICALL __stdcall
-
- typedef int jint;
- typedef __int64 jlong;
#endif
typedef signed char jbyte;
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Fri May 23 09:05:24 2014 -0700
@@ -3152,10 +3152,12 @@
// if fast computation is not possible, result is NaN. Requires
// fallback from user of this macro.
// increase precision for intermediate steps of the computation
+ BLOCK_COMMENT("fast_pow {");
increase_precision();
fyl2x(); // Stack: (Y*log2(X)) ...
pow_exp_core_encoding(); // Stack: exp(X) ...
restore_precision();
+ BLOCK_COMMENT("} fast_pow");
}
void MacroAssembler::fast_exp() {
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86.cpp Fri May 23 09:05:24 2014 -0700
@@ -76,12 +76,7 @@
Interpreter::stackElementWords;
#ifdef ASSERT
- if (!EnableInvokeDynamic) {
- // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
- // Probably, since deoptimization doesn't work yet.
- assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable");
- }
- assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable(2)");
+ assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable");
#endif
interpreter_frame->interpreter_frame_set_method(method);
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Fri May 23 09:05:24 2014 -0700
@@ -1831,7 +1831,7 @@
__ movl(Address(thread, JavaThread::popframe_condition_offset()), JavaThread::popframe_inactive);
#if INCLUDE_JVMTI
- if (EnableInvokeDynamic) {
+ {
Label L_done;
const Register local0 = rdi;
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Fri May 23 09:05:24 2014 -0700
@@ -1848,7 +1848,7 @@
JavaThread::popframe_inactive);
#if INCLUDE_JVMTI
- if (EnableInvokeDynamic) {
+ {
Label L_done;
const Register local0 = r14;
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Fri May 23 09:05:24 2014 -0700
@@ -3128,12 +3128,6 @@
const Register rcx_recv = rcx;
const Register rdx_flags = rdx;
- if (!EnableInvokeDynamic) {
- // rewriter does not generate this bytecode
- __ should_not_reach_here();
- return;
- }
-
prepare_invoke(byte_no, rbx_method, rax_mtype, rcx_recv);
__ verify_method_ptr(rbx_method);
__ verify_oop(rcx_recv);
@@ -3156,17 +3150,6 @@
transition(vtos, vtos);
assert(byte_no == f1_byte, "use this argument");
- if (!EnableInvokeDynamic) {
- // We should not encounter this bytecode if !EnableInvokeDynamic.
- // The verifier will stop it. However, if we get past the verifier,
- // this will stop the thread in a reasonable way, without crashing the JVM.
- __ call_VM(noreg, CAST_FROM_FN_PTR(address,
- InterpreterRuntime::throw_IncompatibleClassChangeError));
- // the call_VM checks for exception, so we should never return here.
- __ should_not_reach_here();
- return;
- }
-
const Register rbx_method = rbx;
const Register rax_callsite = rax;
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Fri May 23 09:05:24 2014 -0700
@@ -3179,12 +3179,6 @@
const Register rcx_recv = rcx;
const Register rdx_flags = rdx;
- if (!EnableInvokeDynamic) {
- // rewriter does not generate this bytecode
- __ should_not_reach_here();
- return;
- }
-
prepare_invoke(byte_no, rbx_method, rax_mtype, rcx_recv);
__ verify_method_ptr(rbx_method);
__ verify_oop(rcx_recv);
@@ -3207,17 +3201,6 @@
transition(vtos, vtos);
assert(byte_no == f1_byte, "use this argument");
- if (!EnableInvokeDynamic) {
- // We should not encounter this bytecode if !EnableInvokeDynamic.
- // The verifier will stop it. However, if we get past the verifier,
- // this will stop the thread in a reasonable way, without crashing the JVM.
- __ call_VM(noreg, CAST_FROM_FN_PTR(address,
- InterpreterRuntime::throw_IncompatibleClassChangeError));
- // the call_VM checks for exception, so we should never return here.
- __ should_not_reach_here();
- return;
- }
-
const Register rbx_method = rbx;
const Register rax_callsite = rax;
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Fri May 23 09:05:24 2014 -0700
@@ -263,6 +263,10 @@
// and check upper YMM bits after it.
//
VM_Version::set_avx_cpuFeatures(); // Enable temporary to pass asserts
+ intx saved_useavx = UseAVX;
+ intx saved_usesse = UseSSE;
+ UseAVX = 1;
+ UseSSE = 2;
// load value into all 32 bytes of ymm7 register
__ movl(rcx, VM_Version::ymm_test_value());
@@ -292,6 +296,8 @@
#endif
VM_Version::clean_cpuFeatures();
+ UseAVX = saved_useavx;
+ UseSSE = saved_usesse;
//
// cpuid(0x7) Structured Extended Features
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Fri May 23 09:05:24 2014 -0700
@@ -40,6 +40,7 @@
#include "runtime/deoptimization.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/synchronizer.hpp"
--- a/hotspot/src/os/aix/vm/os_aix.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/aix/vm/os_aix.cpp Fri May 23 09:05:24 2014 -0700
@@ -55,6 +55,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/perfMemory.hpp"
#include "runtime/sharedRuntime.hpp"
--- a/hotspot/src/os/aix/vm/os_aix.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/aix/vm/os_aix.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,12 +26,9 @@
#ifndef OS_AIX_VM_OS_AIX_INLINE_HPP
#define OS_AIX_VM_OS_AIX_INLINE_HPP
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "atomic_aix_ppc.inline.hpp"
-# include "orderAccess_aix_ppc.inline.hpp"
-#endif
// System includes
--- a/hotspot/src/os/aix/vm/thread_aix.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/aix/vm/thread_aix.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,13 +26,10 @@
#ifndef OS_AIX_VM_THREAD_AIX_INLINE_HPP
#define OS_AIX_VM_THREAD_AIX_INLINE_HPP
-#include "runtime/atomic.hpp"
#include "runtime/prefetch.hpp"
#include "runtime/thread.hpp"
#include "runtime/threadLocalStorage.hpp"
-#include "atomic_aix_ppc.inline.hpp"
-#include "orderAccess_aix_ppc.inline.hpp"
#include "prefetch_aix_ppc.inline.hpp"
// Contains inlined functions for class Thread and ThreadLocalStorage
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Fri May 23 09:05:24 2014 -0700
@@ -48,6 +48,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/perfMemory.hpp"
#include "runtime/sharedRuntime.hpp"
--- a/hotspot/src/os/bsd/vm/os_bsd.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,15 +26,9 @@
#define OS_BSD_VM_OS_BSD_INLINE_HPP
#include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "orderAccess_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "orderAccess_bsd_zero.inline.hpp"
-#endif
-
// System includes
#include <unistd.h>
--- a/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -29,18 +29,12 @@
#error "This file should only be included from thread.inline.hpp"
#endif
-#include "runtime/atomic.hpp"
-#include "runtime/prefetch.hpp"
#include "runtime/thread.hpp"
#include "runtime/threadLocalStorage.hpp"
#ifdef TARGET_OS_ARCH_bsd_x86
-# include "atomic_bsd_x86.inline.hpp"
-# include "orderAccess_bsd_x86.inline.hpp"
# include "prefetch_bsd_x86.inline.hpp"
#endif
#ifdef TARGET_OS_ARCH_bsd_zero
-# include "atomic_bsd_zero.inline.hpp"
-# include "orderAccess_bsd_zero.inline.hpp"
# include "prefetch_bsd_zero.inline.hpp"
#endif
--- a/hotspot/src/os/linux/vm/os_linux.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Fri May 23 09:05:24 2014 -0700
@@ -49,6 +49,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/perfMemory.hpp"
#include "runtime/sharedRuntime.hpp"
@@ -5271,7 +5272,6 @@
//
static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
- static bool proc_task_unchecked = true;
pid_t tid = thread->osthread()->thread_id();
char *s;
char stat[2048];
@@ -5284,24 +5284,7 @@
long ldummy;
FILE *fp;
- snprintf(proc_name, 64, "/proc/%d/stat", tid);
-
- // The /proc/<tid>/stat aggregates per-process usage on
- // new Linux kernels 2.6+ where NPTL is supported.
- // The /proc/self/task/<tid>/stat still has the per-thread usage.
- // See bug 6328462.
- // There possibly can be cases where there is no directory
- // /proc/self/task, so we check its availability.
- if (proc_task_unchecked && os::Linux::is_NPTL()) {
- // This is executed only once
- proc_task_unchecked = false;
- fp = fopen("/proc/self/task", "r");
- if (fp != NULL) {
- snprintf(proc_name, 64, "/proc/self/task/%d/stat", tid);
- fclose(fp);
- }
- }
-
+ snprintf(proc_name, 64, "/proc/self/task/%d/stat", tid);
fp = fopen(proc_name, "r");
if ( fp == NULL ) return -1;
statlen = fread(stat, 1, 2047, fp);
--- a/hotspot/src/os/linux/vm/os_linux.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,24 +26,9 @@
#define OS_LINUX_VM_OS_LINUX_INLINE_HPP
#include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "orderAccess_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "orderAccess_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "orderAccess_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "orderAccess_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "orderAccess_linux_ppc.inline.hpp"
-#endif
-
// System includes
#include <unistd.h>
--- a/hotspot/src/os/linux/vm/thread_linux.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/linux/vm/thread_linux.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -29,33 +29,22 @@
#error "This file should only be included from thread.inline.hpp"
#endif
-#include "runtime/atomic.hpp"
#include "runtime/prefetch.hpp"
#include "runtime/thread.hpp"
#include "runtime/threadLocalStorage.hpp"
#ifdef TARGET_OS_ARCH_linux_x86
-# include "atomic_linux_x86.inline.hpp"
-# include "orderAccess_linux_x86.inline.hpp"
# include "prefetch_linux_x86.inline.hpp"
#endif
#ifdef TARGET_OS_ARCH_linux_sparc
-# include "atomic_linux_sparc.inline.hpp"
-# include "orderAccess_linux_sparc.inline.hpp"
# include "prefetch_linux_sparc.inline.hpp"
#endif
#ifdef TARGET_OS_ARCH_linux_zero
-# include "atomic_linux_zero.inline.hpp"
-# include "orderAccess_linux_zero.inline.hpp"
# include "prefetch_linux_zero.inline.hpp"
#endif
#ifdef TARGET_OS_ARCH_linux_arm
-# include "atomic_linux_arm.inline.hpp"
-# include "orderAccess_linux_arm.inline.hpp"
# include "prefetch_linux_arm.inline.hpp"
#endif
#ifdef TARGET_OS_ARCH_linux_ppc
-# include "atomic_linux_ppc.inline.hpp"
-# include "orderAccess_linux_ppc.inline.hpp"
# include "prefetch_linux_ppc.inline.hpp"
#endif
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Fri May 23 09:05:24 2014 -0700
@@ -48,6 +48,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/perfMemory.hpp"
#include "runtime/sharedRuntime.hpp"
--- a/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,15 +26,9 @@
#define OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP
#include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "orderAccess_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "orderAccess_solaris_sparc.inline.hpp"
-#endif
-
// System includes
#include <sys/param.h>
#include <dlfcn.h>
--- a/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -29,18 +29,14 @@
#error "This file should only be included from thread.inline.hpp"
#endif
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
#include "runtime/prefetch.hpp"
#include "runtime/thread.hpp"
#include "runtime/threadLocalStorage.hpp"
#ifdef TARGET_OS_ARCH_solaris_x86
-# include "atomic_solaris_x86.inline.hpp"
-# include "orderAccess_solaris_x86.inline.hpp"
# include "prefetch_solaris_x86.inline.hpp"
#endif
#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "atomic_solaris_sparc.inline.hpp"
-# include "orderAccess_solaris_sparc.inline.hpp"
# include "prefetch_solaris_sparc.inline.hpp"
#endif
--- a/hotspot/src/os/windows/vm/os_windows.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Fri May 23 09:05:24 2014 -0700
@@ -51,6 +51,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/perfMemory.hpp"
#include "runtime/sharedRuntime.hpp"
--- a/hotspot/src/os/windows/vm/os_windows.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,12 +26,9 @@
#define OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
#include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "orderAccess_windows_x86.inline.hpp"
-#endif
-
inline const char* os::file_separator() { return "\\"; }
inline const char* os::line_separator() { return "\r\n"; }
inline const char* os::path_separator() { return ";"; }
--- a/hotspot/src/os/windows/vm/thread_windows.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os/windows/vm/thread_windows.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -29,13 +29,10 @@
#error "This file should only be included from thread.inline.hpp"
#endif
-#include "runtime/atomic.hpp"
#include "runtime/prefetch.hpp"
#include "runtime/thread.hpp"
#include "runtime/threadLocalStorage.hpp"
#ifdef TARGET_OS_ARCH_windows_x86
-# include "atomic_windows_x86.inline.hpp"
-# include "orderAccess_windows_x86.inline.hpp"
# include "prefetch_windows_x86.inline.hpp"
#endif
--- a/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,7 +26,6 @@
#ifndef OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_INLINE_HPP
#define OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_INLINE_HPP
-#include "orderAccess_aix_ppc.inline.hpp"
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
#include "vm_version_ppc.hpp"
--- a/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,7 +26,6 @@
#ifndef OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_INLINE_HPP
#define OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_INLINE_HPP
-#include "orderAccess_linux_ppc.inline.hpp"
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"
#include "vm_version_ppc.hpp"
@@ -53,41 +52,41 @@
inline jlong Atomic::load(volatile jlong* src) { return *src; }
-/*
- machine barrier instructions:
-
- - sync two-way memory barrier, aka fence
- - lwsync orders Store|Store,
- Load|Store,
- Load|Load,
- but not Store|Load
- - eieio orders memory accesses for device memory (only)
- - isync invalidates speculatively executed instructions
- From the POWER ISA 2.06 documentation:
- "[...] an isync instruction prevents the execution of
- instructions following the isync until instructions
- preceding the isync have completed, [...]"
- From IBM's AIX assembler reference:
- "The isync [...] instructions causes the processor to
- refetch any instructions that might have been fetched
- prior to the isync instruction. The instruction isync
- causes the processor to wait for all previous instructions
- to complete. Then any instructions already fetched are
- discarded and instruction processing continues in the
- environment established by the previous instructions."
-
- semantic barrier instructions:
- (as defined in orderAccess.hpp)
-
- - release orders Store|Store, (maps to lwsync)
- Load|Store
- - acquire orders Load|Store, (maps to lwsync)
- Load|Load
- - fence orders Store|Store, (maps to sync)
- Load|Store,
- Load|Load,
- Store|Load
-*/
+//
+// machine barrier instructions:
+//
+// - sync two-way memory barrier, aka fence
+// - lwsync orders Store|Store,
+// Load|Store,
+// Load|Load,
+// but not Store|Load
+// - eieio orders memory accesses for device memory (only)
+// - isync invalidates speculatively executed instructions
+// From the POWER ISA 2.06 documentation:
+// "[...] an isync instruction prevents the execution of
+// instructions following the isync until instructions
+// preceding the isync have completed, [...]"
+// From IBM's AIX assembler reference:
+// "The isync [...] instructions causes the processor to
+// refetch any instructions that might have been fetched
+// prior to the isync instruction. The instruction isync
+// causes the processor to wait for all previous instructions
+// to complete. Then any instructions already fetched are
+// discarded and instruction processing continues in the
+// environment established by the previous instructions."
+//
+// semantic barrier instructions:
+// (as defined in orderAccess.hpp)
+//
+// - release orders Store|Store, (maps to lwsync)
+// Load|Store
+// - acquire orders Load|Store, (maps to lwsync)
+// Load|Load
+// - fence orders Store|Store, (maps to sync)
+// Load|Store,
+// Load|Load,
+// Store|Load
+//
#define strasm_sync "\n sync \n"
#define strasm_lwsync "\n lwsync \n"
--- a/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -78,12 +78,12 @@
__asm__ volatile(
"1: \n\t"
" ldx [%2], %%o2\n\t"
- " add %0, %%o2, %%o3\n\t"
+ " add %1, %%o2, %%o3\n\t"
" casx [%2], %%o2, %%o3\n\t"
" cmp %%o2, %%o3\n\t"
" bne %%xcc, 1b\n\t"
" nop\n\t"
- " add %0, %%o2, %0\n\t"
+ " add %1, %%o2, %0\n\t"
: "=r" (rv)
: "r" (add_value), "r" (dest)
: "memory", "o2", "o3");
--- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Fri May 23 09:05:24 2014 -0700
@@ -302,29 +302,30 @@
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
+ sigcontext* sc = (sigcontext*)context;
intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
st->print_cr("Register to memory mapping:");
st->cr();
// this is only for the "general purpose" registers
- st->print("G1="); print_location(st, SIG_REGS(sc).u_regs[CON__G1]);
- st->print("G2="); print_location(st, SIG_REGS(sc).u_regs[CON__G2]);
- st->print("G3="); print_location(st, SIG_REGS(sc).u_regs[CON__G3]);
- st->print("G4="); print_location(st, SIG_REGS(sc).u_regs[CON__G4]);
- st->print("G5="); print_location(st, SIG_REGS(sc).u_regs[CON__G5]);
- st->print("G6="); print_location(st, SIG_REGS(sc).u_regs[CON__G6]);
- st->print("G7="); print_location(st, SIG_REGS(sc).u_regs[CON__G7]);
+ st->print("G1="); print_location(st, SIG_REGS(sc).u_regs[CON_G1]);
+ st->print("G2="); print_location(st, SIG_REGS(sc).u_regs[CON_G2]);
+ st->print("G3="); print_location(st, SIG_REGS(sc).u_regs[CON_G3]);
+ st->print("G4="); print_location(st, SIG_REGS(sc).u_regs[CON_G4]);
+ st->print("G5="); print_location(st, SIG_REGS(sc).u_regs[CON_G5]);
+ st->print("G6="); print_location(st, SIG_REGS(sc).u_regs[CON_G6]);
+ st->print("G7="); print_location(st, SIG_REGS(sc).u_regs[CON_G7]);
st->cr();
- st->print("O0="); print_location(st, SIG_REGS(sc).u_regs[CON__O0]);
- st->print("O1="); print_location(st, SIG_REGS(sc).u_regs[CON__O1]);
- st->print("O2="); print_location(st, SIG_REGS(sc).u_regs[CON__O2]);
- st->print("O3="); print_location(st, SIG_REGS(sc).u_regs[CON__O3]);
- st->print("O4="); print_location(st, SIG_REGS(sc).u_regs[CON__O4]);
- st->print("O5="); print_location(st, SIG_REGS(sc).u_regs[CON__O5]);
- st->print("O6="); print_location(st, SIG_REGS(sc).u_regs[CON__O6]);
- st->print("O7="); print_location(st, SIG_REGS(sc).u_regs[CON__O7]);
+ st->print("O0="); print_location(st, SIG_REGS(sc).u_regs[CON_O0]);
+ st->print("O1="); print_location(st, SIG_REGS(sc).u_regs[CON_O1]);
+ st->print("O2="); print_location(st, SIG_REGS(sc).u_regs[CON_O2]);
+ st->print("O3="); print_location(st, SIG_REGS(sc).u_regs[CON_O3]);
+ st->print("O4="); print_location(st, SIG_REGS(sc).u_regs[CON_O4]);
+ st->print("O5="); print_location(st, SIG_REGS(sc).u_regs[CON_O5]);
+ st->print("O6="); print_location(st, SIG_REGS(sc).u_regs[CON_O6]);
+ st->print("O7="); print_location(st, SIG_REGS(sc).u_regs[CON_O7]);
st->cr();
st->print("L0="); print_location(st, sp[L0->sp_offset_in_saved_window()]);
@@ -516,7 +517,7 @@
if (nativeInstruction_at(*pc)->is_ic_miss_trap()) {
#ifdef ASSERT
#ifdef TIERED
- CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
+ CodeBlob* cb = CodeCache::find_blob_unsafe(*pc);
assert(cb->is_compiled_by_c2(), "Wrong compiler");
#endif // TIERED
#endif // ASSERT
--- a/hotspot/src/share/vm/adlc/filebuff.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/adlc/filebuff.cpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -89,200 +89,6 @@
return retval;
}
-//------------------------------FileBuffRegion---------------------------------
-// Create a new region in a FileBuff.
-FileBuffRegion::FileBuffRegion( FileBuff* bufr, int soln, int ln,
- int off, int len)
-: _bfr(bufr), _sol(soln), _line(ln), _offset(off), _length(len) {
- _next = NULL; // No chained regions
-}
-
-//------------------------------~FileBuffRegion--------------------------------
-// Delete the entire linked list of buffer regions.
-FileBuffRegion::~FileBuffRegion() {
- if( _next ) delete _next;
-}
-
-//------------------------------copy-------------------------------------------
-// Deep copy a FileBuffRegion
-FileBuffRegion *FileBuffRegion::copy() {
- if( !this ) return NULL; // The empty buffer region
- FileBuffRegion *br = new FileBuffRegion(_bfr,_sol,_line,_offset,_length);
- if( _next ) br->_next = _next->copy();
- return br;
-}
-
-//------------------------------merge------------------------------------------
-// Merge another buffer region into this buffer region. Make overlapping areas
-// become a single region. Remove (delete) the input FileBuffRegion.
-// Since the buffer regions are sorted by file offset, this is a varient of a
-// "sorted-merge" running in linear time.
-FileBuffRegion *FileBuffRegion::merge( FileBuffRegion *br ) {
- if( !br ) return this; // Merging nothing
- if( !this ) return br; // Merging into nothing
-
- assert( _bfr == br->_bfr, "" ); // Check for pointer-equivalent buffers
-
- if( _offset < br->_offset ) { // "this" starts before "br"
- if( _offset+_length < br->_offset ) { // "this" ends before "br"
- if( _next ) _next->merge( br ); // Merge with remainder of list
- else _next = br; // No more in this list; just append.
- } else { // Regions overlap.
- int l = br->_offset + br->_length - _offset;
- if( l > _length ) _length = l; // Pick larger region
- FileBuffRegion *nr = br->_next; // Get rest of region
- br->_next = NULL; // Remove indication of rest of region
- delete br; // Delete this region (it's been subsumed).
- if( nr ) merge( nr ); // Merge with rest of region
- } // End of if regions overlap or not.
- } else { // "this" starts after "br"
- if( br->_offset+br->_length < _offset ) { // "br" ends before "this"
- FileBuffRegion *nr = new FileBuffRegion(_bfr,_sol,_line,_offset,_length);
- nr->_next = _next; // Structure copy "this" guy to "nr"
- *this = *br; // Structure copy "br" over "this".
- br->_next = NULL; // Remove indication of rest of region
- delete br; // Delete this region (it's been copied)
- merge( nr ); // Finish merging
- } else { // Regions overlap.
- int l = _offset + _length - br->_offset;
- if( l > _length ) _length = l; // Pick larger region
- _offset = br->_offset; // Start with earlier region
- _sol = br->_sol; // Also use earlier line start
- _line = br->_line; // Also use earlier line
- FileBuffRegion *nr = br->_next; // Get rest of region
- br->_next = NULL; // Remove indication of rest of region
- delete br; // Delete this region (it's been subsumed).
- if( nr ) merge( nr ); // Merge with rest of region
- } // End of if regions overlap or not.
- }
- return this;
-}
-
-//------------------------------expandtab--------------------------------------
-static int expandtab( ostream &os, int off, char c, char fill1, char fill2 ) {
- if( c == '\t' ) { // Tab?
- do os << fill1; // Expand the tab; Output space
- while( (++off) & 7 ); // Expand to tab stop
- } else { // Normal character
- os << fill2; // Display normal character
- off++; // Increment "cursor" offset
- }
- return off;
-}
-
-//------------------------------printline--------------------------------------
-// Print and highlite a region of a line. Return the amount of highliting left
-// to do (i.e. highlite length minus length of line).
-static int printline( ostream& os, const char *fname, int line,
- const char *_sol, int skip, int len ) {
-
- // Display the entire tab-expanded line
- os << fname << ":" << line << ": ";
- const char *t = strchr(_sol,'\n')+1; // End of line
- int off = 0; // Cursor offset for tab expansion
- const char *s = _sol; // Nice string pointer
- while( t-s ) { // Display whole line
- char c = *s++; // Get next character to display
- off = expandtab(os,off,c,' ',c);
- }
-
- // Display the tab-expanded skippings before underlining.
- os << fname << ":" << line << ": ";
- off = 0; // Cursor offset for tab expansion
- s = _sol; // Restart string pointer
-
- // Start underlining.
- if( skip != -1 ) { // The no-start-indicating flag
- const char *u = _sol+skip; // Amount to skip
- while( u-s ) // Display skipped part
- off = expandtab(os,off,*s++,' ',' ');
- os << '^'; // Start region
- off++; // Moved cursor
- len--; // 1 less char to do
- if( *s++ == '\t' ) // Starting character is a tab?
- off = expandtab(os,off,'\t','-','^');
- }
-
- // Long region doesn't end on this line
- int llen = (int)(t-s); // Length of line, minus what's already done
- if( len > llen ) { // Doing entire rest of line?
- while( t-s ) // Display rest of line
- off = expandtab(os,off,*s++,'-','-');
- os << '\n'; // EOL
- return len-llen; // Return what's not yet done.
- }
-
- // Region does end on this line. This code fails subtly if the region ends
- // in a tab character.
- int i;
- for( i=1; i<len; i++ ) // Underline just what's needed
- off = expandtab(os,off,*s++,'-','-');
- if( i == len ) os << '^'; // Mark end of region
- os << '\n'; // End of marked line
- return 0; // All done
-}
-
-//------------------------------print------------------------------------------
-//std::ostream& operator<< ( std::ostream& os, FileBuffRegion &br ) {
-ostream& operator<< ( ostream& os, FileBuffRegion &br ) {
- if( &br == NULL ) return os; // The empty buffer region
- FileBuffRegion *brp = &br; // Pointer to region
- while( brp ) { // While have chained regions
- brp->print(os); // Print region
- brp = brp->_next; // Chain to next
- }
- return os; // Return final stream
-}
-
-//------------------------------print------------------------------------------
-// Print the FileBuffRegion to a stream. FileBuffRegions are printed with the
-// filename and line number to the left, and complete text lines to the right.
-// Selected portions (portions of a line actually in the FileBuffRegion are
-// underlined. Ellipses are used for long multi-line regions.
-//void FileBuffRegion::print( std::ostream& os ) {
-void FileBuffRegion::print( ostream& os ) {
- if( !this ) return; // Nothing to print
- char *s = _bfr->get_line();
- int skip = (int)(_offset - _sol); // Amount to skip to start of data
- int len = printline( os, _bfr->_fp->_name, _line, s, skip, _length );
-
- if( !len ) return; // All done; exit
-
- // Here we require at least 2 lines
- int off1 = _length - len + skip; // Length of line 1
- int off2 = off1 + _sol; // Offset to start of line 2
- char *s2 = _bfr->get_line(); // Start of line 2
- char *s3 = strchr( s2, '\n' )+1; // Start of line 3 (unread)
- if( len <= (s3-s2) ) { // It all fits on the next line
- printline( os, _bfr->_fp->_name, _line+1, s2, -1, len ); // Print&underline
- return;
- }
-
- // Here we require at least 3 lines
- int off3 = off2 + (int)(s3-s2); // Offset to start of line 3
- s3 = _bfr->get_line(); // Start of line 3 (read)
- const char *s4 = strchr( s3, '\n' )+1;// Start of line 4 (unread)
- if( len < (s4-s3) ) { // It all fits on the next 2 lines
- s2 = _bfr->get_line();
- len = printline( os, _bfr->_fp->_name, _line+1, s2, -1, len ); // Line 2
- s3 = _bfr->get_line();
- printline( os, _bfr->_fp->_name, _line+2, s3, -1, len ); // Line 3
- return;
- }
-
- // Here we require at least 4 lines.
- // Print only the 1st and last line, with ellipses in middle.
- os << "...\n"; // The ellipses
- int cline = _line+1; // Skipped 2 lines
- do { // Do until find last line
- len -= (int)(s3-s2); // Remove length of line
- cline++; // Next line
- s2 = _bfr->get_line(); // Get next line from end of this line
- s3 = strchr( s2, '\n' ) + 1;// Get end of next line
- } while( len > (s3-s2) ); // Repeat until last line
- printline( os, _bfr->_fp->_name, cline, s2, -1, len ); // Print & underline
-}
-
//------------------------------file_error-------------------------------------
void FileBuff::file_error(int flag, int linenum, const char *fmt, ...)
{
--- a/hotspot/src/share/vm/adlc/filebuff.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/adlc/filebuff.hpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,6 @@
// This class defines a nicely behaved buffer of text. Entire file of text
// is read into buffer at creation, with sentinels at start and end.
class FileBuff {
- friend class FileBuffRegion;
private:
long _bufferSize; // Size of text holding buffer.
long _offset; // Expected filepointer offset.
@@ -82,29 +81,4 @@
// when the pointer is valid (i.e. just obtained from getline()).
long getoff(const char* s) { return _bufoff + (long)(s - _buf); }
};
-
-//------------------------------FileBuffRegion---------------------------------
-// A buffer region is really a region of some file, specified as a linked list
-// of offsets and lengths. These regions can be merged; overlapping regions
-// will coalesce.
-class FileBuffRegion {
- public: // Workaround dev-studio friend/private bug
- FileBuffRegion *_next; // Linked list of regions sorted by offset.
- private:
- FileBuff *_bfr; // The Buffer of the file
- int _offset, _length; // The file area
- int _sol; // Start of line where the file area starts
- int _line; // First line of region
-
- public:
- FileBuffRegion(FileBuff*, int sol, int line, int offset, int len);
- ~FileBuffRegion();
-
- FileBuffRegion *copy(); // Deep copy
- FileBuffRegion *merge(FileBuffRegion*); // Merge 2 regions; delete input
-
- void print(ostream&);
- friend ostream& operator<< (ostream&, FileBuffRegion&);
-};
-
#endif // SHARE_VM_ADLC_FILEBUFF_HPP
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Fri May 23 09:05:24 2014 -0700
@@ -1701,6 +1701,15 @@
return NULL;
}
+void GraphBuilder::check_args_for_profiling(Values* obj_args, int expected) {
+#ifdef ASSERT
+ bool ignored_will_link;
+ ciSignature* declared_signature = NULL;
+ ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
+ assert(expected == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?");
+#endif
+}
+
// Collect arguments that we want to profile in a list
Values* GraphBuilder::collect_args_for_profiling(Values* args, ciMethod* target, bool may_have_receiver) {
int start = 0;
@@ -1709,13 +1718,14 @@
return NULL;
}
int s = obj_args->size();
- for (int i = start, j = 0; j < s; i++) {
+ // if called through method handle invoke, some arguments may have been popped
+ for (int i = start, j = 0; j < s && i < args->length(); i++) {
if (args->at(i)->type()->is_object_kind()) {
obj_args->push(args->at(i));
j++;
}
}
- assert(s == obj_args->length(), "missed on arg?");
+ check_args_for_profiling(obj_args, s);
return obj_args;
}
@@ -3847,14 +3857,7 @@
j++;
}
}
-#ifdef ASSERT
- {
- bool ignored_will_link;
- ciSignature* declared_signature = NULL;
- ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
- assert(s == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?");
- }
-#endif
+ check_args_for_profiling(obj_args, s);
}
profile_call(callee, recv, holder_known ? callee->holder() : NULL, obj_args, true);
}
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp Fri May 23 09:05:24 2014 -0700
@@ -392,6 +392,7 @@
Values* args_list_for_profiling(ciMethod* target, int& start, bool may_have_receiver);
Values* collect_args_for_profiling(Values* args, ciMethod* target, bool may_have_receiver);
+ void check_args_for_profiling(Values* obj_args, int expected);
public:
NOT_PRODUCT(void print_stats();)
--- a/hotspot/src/share/vm/c1/c1_IR.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_IR.cpp Fri May 23 09:05:24 2014 -0700
@@ -263,8 +263,7 @@
// Implementation of IR
IR::IR(Compilation* compilation, ciMethod* method, int osr_bci) :
- _locals_size(in_WordSize(-1))
- , _num_loops(0) {
+ _num_loops(0) {
// setup IR fields
_compilation = compilation;
_top_scope = new IRScope(compilation, NULL, -1, method, osr_bci, true);
--- a/hotspot/src/share/vm/c1/c1_IR.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_IR.hpp Fri May 23 09:05:24 2014 -0700
@@ -293,7 +293,6 @@
private:
Compilation* _compilation; // the current compilation
IRScope* _top_scope; // the root of the scope hierarchy
- WordSize _locals_size; // the space required for all locals
int _num_loops; // Total number of loops
BlockList* _code; // the blocks in code generation order w/ use counts
@@ -310,8 +309,6 @@
BlockBegin* start() const { return top_scope()->start(); }
BlockBegin* std_entry() const { return start()->end()->as_Base()->std_entry(); }
BlockBegin* osr_entry() const { return start()->end()->as_Base()->osr_entry(); }
- WordSize locals_size() const { return _locals_size; }
- int locals_size_in_words() const { return in_words(_locals_size); }
BlockList* code() const { return _code; }
int num_loops() const { return _num_loops; }
int max_stack() const { return top_scope()->max_stack(); } // expensive
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Fri May 23 09:05:24 2014 -0700
@@ -2636,8 +2636,10 @@
// LIR_Assembler::emit_profile_type() from emitting useless code
profiled_k = ciTypeEntries::with_status(result, profiled_k);
}
- if (exact_signature_k != NULL && exact_klass != exact_signature_k) {
- assert(exact_klass == NULL, "obj and signature disagree?");
+ // exact_klass and exact_signature_k can be both non NULL but
+ // different if exact_klass is loaded after the ciObject for
+ // exact_signature_k is created.
+ if (exact_klass == NULL && exact_signature_k != NULL && exact_klass != exact_signature_k) {
// sometimes the type of the signature is better than the best type
// the compiler has
exact_klass = exact_signature_k;
@@ -2648,8 +2650,7 @@
if (improved_klass == NULL) {
improved_klass = comp->cha_exact_type(callee_signature_k);
}
- if (improved_klass != NULL && exact_klass != improved_klass) {
- assert(exact_klass == NULL, "obj and signature disagree?");
+ if (exact_klass == NULL && improved_klass != NULL && exact_klass != improved_klass) {
exact_klass = exact_signature_k;
}
}
--- a/hotspot/src/share/vm/ci/ciEnv.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp Fri May 23 09:05:24 2014 -0700
@@ -51,6 +51,7 @@
#include "runtime/init.hpp"
#include "runtime/reflection.hpp"
#include "runtime/sharedRuntime.hpp"
+#include "runtime/thread.inline.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/macros.hpp"
#ifdef COMPILER1
--- a/hotspot/src/share/vm/ci/ciObject.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciObject.cpp Fri May 23 09:05:24 2014 -0700
@@ -181,9 +181,8 @@
if (klass() == env->String_klass() || klass() == env->Class_klass()) {
return true;
}
- if (EnableInvokeDynamic &&
- (klass()->is_subclass_of(env->MethodHandle_klass()) ||
- klass()->is_subclass_of(env->CallSite_klass()))) {
+ if (klass()->is_subclass_of(env->MethodHandle_klass()) ||
+ klass()->is_subclass_of(env->CallSite_klass())) {
assert(ScavengeRootsInCode >= 1, "must be");
// We want to treat these aggressively.
return true;
--- a/hotspot/src/share/vm/ci/ciReplay.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp Fri May 23 09:05:24 2014 -0700
@@ -376,11 +376,15 @@
int c = getc(_stream);
while(c != EOF) {
c = get_line(c);
- process_command(CHECK);
+ process_command(THREAD);
if (had_error()) {
tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message);
- tty->print_cr("%s", _buffer);
- return;
+ if (ReplayIgnoreInitErrors) {
+ CLEAR_PENDING_EXCEPTION;
+ _error_message = NULL;
+ } else {
+ return;
+ }
}
line_no++;
}
@@ -565,10 +569,14 @@
void process_ciMethodData(TRAPS) {
Method* method = parse_method(CHECK);
if (had_error()) return;
- /* jsut copied from Method, to build interpret data*/
+ /* just copied from Method, to build interpret data*/
if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) {
return;
}
+ // To be properly initialized, some profiling in the MDO needs the
+ // method to be rewritten (number of arguments at a call for
+ // instance)
+ method->method_holder()->link_class(CHECK);
// methodOopDesc::build_interpreter_method_data(method, CHECK);
{
// Grab a lock here to prevent multiple
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp Fri May 23 09:05:24 2014 -0700
@@ -164,11 +164,6 @@
"Class file version does not support constant tag %u in class file %s",
tag, CHECK);
}
- if (!EnableInvokeDynamic) {
- classfile_parse_error(
- "This JVM does not support constant tag %u in class file %s",
- tag, CHECK);
- }
if (tag == JVM_CONSTANT_MethodHandle) {
cfs->guarantee_more(4, CHECK); // ref_kind, method_index, tag/access_flags
u1 ref_kind = cfs->get_u1_fast();
@@ -189,11 +184,6 @@
"Class file version does not support constant tag %u in class file %s",
tag, CHECK);
}
- if (!EnableInvokeDynamic) {
- classfile_parse_error(
- "This JVM does not support constant tag %u in class file %s",
- tag, CHECK);
- }
cfs->guarantee_more(5, CHECK); // bsm_index, nt, tag/access_flags
u2 bootstrap_specifier_index = cfs->get_u2_fast();
u2 name_and_type_index = cfs->get_u2_fast();
@@ -263,7 +253,7 @@
verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK);
}
- if (EnableInvokeDynamic && has_cp_patch_at(index)) {
+ if (has_cp_patch_at(index)) {
Handle patch = clear_cp_patch_at(index);
guarantee_property(java_lang_String::is_instance(patch()),
"Illegal utf8 patch at %d in class file %s",
@@ -419,8 +409,7 @@
{
int ref_index = cp->method_handle_index_at(index);
check_property(
- valid_cp_range(ref_index, length) &&
- EnableInvokeDynamic,
+ valid_cp_range(ref_index, length),
"Invalid constant pool index %u in class file %s",
ref_index, CHECK_(nullHandle));
constantTag tag = cp->tag_at(ref_index);
@@ -466,7 +455,7 @@
case JVM_CONSTANT_MethodType :
{
int ref_index = cp->method_type_index_at(index);
- check_property(valid_symbol_at(ref_index) && EnableInvokeDynamic,
+ check_property(valid_symbol_at(ref_index),
"Invalid constant pool index %u in class file %s",
ref_index, CHECK_(nullHandle));
}
@@ -492,7 +481,6 @@
if (_cp_patches != NULL) {
// need to treat this_class specially...
- assert(EnableInvokeDynamic, "");
int this_class_index;
{
cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len
@@ -640,7 +628,6 @@
void ClassFileParser::patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS) {
- assert(EnableInvokeDynamic, "");
BasicType patch_type = T_VOID;
switch (cp->tag_at(index).value()) {
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp Fri May 23 09:05:24 2014 -0700
@@ -377,11 +377,9 @@
char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS);
bool is_anonymous() {
- assert(EnableInvokeDynamic || _host_klass.is_null(), "");
return _host_klass.not_null();
}
bool has_cp_patch_at(int index) {
- assert(EnableInvokeDynamic, "");
assert(index >= 0, "oob");
return (_cp_patches != NULL
&& index < _cp_patches->length()
@@ -404,10 +402,7 @@
// constant pool construction, but in later versions they can.
// %%% Let's phase out the old is_klass_reference.
bool valid_klass_reference_at(int index) {
- return _cp->is_within_bounds(index) &&
- (EnableInvokeDynamic
- ? _cp->tag_at(index).is_klass_or_reference()
- : _cp->tag_at(index).is_klass_reference());
+ return _cp->is_within_bounds(index) && _cp->tag_at(index).is_klass_or_reference();
}
// Checks that the cpool index is in range and is a utf8
--- a/hotspot/src/share/vm/classfile/dictionary.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp Fri May 23 09:05:24 2014 -0700
@@ -28,6 +28,7 @@
#include "memory/iterator.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiRedefineClassesTrace.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "utilities/hashtable.inline.hpp"
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Fri May 23 09:05:24 2014 -0700
@@ -2646,7 +2646,7 @@
void java_lang_invoke_DirectMethodHandle::compute_offsets() {
Klass* klass_oop = SystemDictionary::DirectMethodHandle_klass();
- if (klass_oop != NULL && EnableInvokeDynamic) {
+ if (klass_oop != NULL) {
compute_offset(_member_offset, klass_oop, vmSymbols::member_name(), vmSymbols::java_lang_invoke_MemberName_signature());
}
}
@@ -2668,18 +2668,15 @@
void java_lang_invoke_MethodHandle::compute_offsets() {
Klass* klass_oop = SystemDictionary::MethodHandle_klass();
- if (klass_oop != NULL && EnableInvokeDynamic) {
+ if (klass_oop != NULL) {
compute_offset(_type_offset, klass_oop, vmSymbols::type_name(), vmSymbols::java_lang_invoke_MethodType_signature());
- compute_optional_offset(_form_offset, klass_oop, vmSymbols::form_name(), vmSymbols::java_lang_invoke_LambdaForm_signature());
- if (_form_offset == 0) {
- EnableInvokeDynamic = false;
- }
+ compute_offset(_form_offset, klass_oop, vmSymbols::form_name(), vmSymbols::java_lang_invoke_LambdaForm_signature());
}
}
void java_lang_invoke_MemberName::compute_offsets() {
Klass* klass_oop = SystemDictionary::MemberName_klass();
- if (klass_oop != NULL && EnableInvokeDynamic) {
+ if (klass_oop != NULL) {
compute_offset(_clazz_offset, klass_oop, vmSymbols::clazz_name(), vmSymbols::class_signature());
compute_offset(_name_offset, klass_oop, vmSymbols::name_name(), vmSymbols::string_signature());
compute_offset(_type_offset, klass_oop, vmSymbols::type_name(), vmSymbols::object_signature());
@@ -2690,7 +2687,7 @@
void java_lang_invoke_LambdaForm::compute_offsets() {
Klass* klass_oop = SystemDictionary::LambdaForm_klass();
- if (klass_oop != NULL && EnableInvokeDynamic) {
+ if (klass_oop != NULL) {
compute_offset(_vmentry_offset, klass_oop, vmSymbols::vmentry_name(), vmSymbols::java_lang_invoke_MemberName_signature());
}
}
@@ -2905,7 +2902,6 @@
int java_lang_invoke_CallSite::_target_offset;
void java_lang_invoke_CallSite::compute_offsets() {
- if (!EnableInvokeDynamic) return;
Klass* k = SystemDictionary::CallSite_klass();
if (k != NULL) {
compute_offset(_target_offset, k, vmSymbols::target_name(), vmSymbols::java_lang_invoke_MethodHandle_signature());
@@ -3296,14 +3292,12 @@
java_lang_ClassLoader::compute_offsets();
java_lang_Thread::compute_offsets();
java_lang_ThreadGroup::compute_offsets();
- if (EnableInvokeDynamic) {
- java_lang_invoke_MethodHandle::compute_offsets();
- java_lang_invoke_DirectMethodHandle::compute_offsets();
- java_lang_invoke_MemberName::compute_offsets();
- java_lang_invoke_LambdaForm::compute_offsets();
- java_lang_invoke_MethodType::compute_offsets();
- java_lang_invoke_CallSite::compute_offsets();
- }
+ java_lang_invoke_MethodHandle::compute_offsets();
+ java_lang_invoke_DirectMethodHandle::compute_offsets();
+ java_lang_invoke_MemberName::compute_offsets();
+ java_lang_invoke_LambdaForm::compute_offsets();
+ java_lang_invoke_MethodType::compute_offsets();
+ java_lang_invoke_CallSite::compute_offsets();
java_security_AccessControlContext::compute_offsets();
// Initialize reflection classes. The layouts of these classes
// changed with the new reflection implementation in JDK 1.4, and
--- a/hotspot/src/share/vm/classfile/resolutionErrors.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/classfile/resolutionErrors.cpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,12 +32,13 @@
// add new entry to the table
void ResolutionErrorTable::add_entry(int index, unsigned int hash,
- constantPoolHandle pool, int cp_index, Symbol* error)
+ constantPoolHandle pool, int cp_index,
+ Symbol* error, Symbol* message)
{
assert_locked_or_safepoint(SystemDictionary_lock);
assert(!pool.is_null() && error != NULL, "adding NULL obj");
- ResolutionErrorEntry* entry = new_entry(hash, pool(), cp_index, error);
+ ResolutionErrorEntry* entry = new_entry(hash, pool(), cp_index, error, message);
add_entry(index, entry);
}
@@ -58,19 +59,26 @@
}
void ResolutionErrorEntry::set_error(Symbol* e) {
- assert(e == NULL || _error == NULL, "cannot reset error");
+ assert(e != NULL, "must set a value");
_error = e;
- if (_error != NULL) _error->increment_refcount();
+ _error->increment_refcount();
+}
+
+void ResolutionErrorEntry::set_message(Symbol* c) {
+ assert(c != NULL, "must set a value");
+ _message = c;
+ _message->increment_refcount();
}
// create new error entry
ResolutionErrorEntry* ResolutionErrorTable::new_entry(int hash, ConstantPool* pool,
- int cp_index, Symbol* error)
+ int cp_index, Symbol* error,
+ Symbol* message)
{
ResolutionErrorEntry* entry = (ResolutionErrorEntry*)Hashtable<ConstantPool*, mtClass>::new_entry(hash, pool);
entry->set_cp_index(cp_index);
- NOT_PRODUCT(entry->set_error(NULL);)
entry->set_error(error);
+ entry->set_message(message);
return entry;
}
@@ -79,6 +87,7 @@
// decrement error refcount
assert(entry->error() != NULL, "error should be set");
entry->error()->decrement_refcount();
+ entry->message()->decrement_refcount();
Hashtable<ConstantPool*, mtClass>::free_entry(entry);
}
--- a/hotspot/src/share/vm/classfile/resolutionErrors.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/classfile/resolutionErrors.hpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,8 @@
public:
ResolutionErrorTable(int table_size);
- ResolutionErrorEntry* new_entry(int hash, ConstantPool* pool, int cp_index, Symbol* error);
+ ResolutionErrorEntry* new_entry(int hash, ConstantPool* pool, int cp_index,
+ Symbol* error, Symbol* message);
void free_entry(ResolutionErrorEntry *entry);
ResolutionErrorEntry* bucket(int i) {
@@ -55,7 +56,7 @@
}
void add_entry(int index, unsigned int hash,
- constantPoolHandle pool, int which, Symbol* error);
+ constantPoolHandle pool, int which, Symbol* error, Symbol* message);
// find error given the constant pool and constant pool index
@@ -79,10 +80,10 @@
private:
int _cp_index;
Symbol* _error;
+ Symbol* _message;
public:
- ConstantPool* pool() const { return (ConstantPool*)literal(); }
- ConstantPool** pool_addr() { return (ConstantPool**)literal_addr(); }
+ ConstantPool* pool() const { return literal(); }
int cp_index() const { return _cp_index; }
void set_cp_index(int cp_index) { _cp_index = cp_index; }
@@ -90,6 +91,9 @@
Symbol* error() const { return _error; }
void set_error(Symbol* e);
+ Symbol* message() const { return _message; }
+ void set_message(Symbol* c);
+
ResolutionErrorEntry* next() const {
return (ResolutionErrorEntry*)HashtableEntry<ConstantPool*, mtClass>::next();
}
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Fri May 23 09:05:24 2014 -0700
@@ -52,6 +52,7 @@
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/signature.hpp"
#include "services/classLoadingService.hpp"
#include "services/threadService.hpp"
@@ -172,12 +173,14 @@
if (HAS_PENDING_EXCEPTION || klass == NULL) {
KlassHandle k_h(THREAD, klass);
// can return a null klass
- klass = handle_resolution_exception(class_name, class_loader, protection_domain, throw_error, k_h, THREAD);
+ klass = handle_resolution_exception(class_name, throw_error, k_h, THREAD);
}
return klass;
}
-Klass* SystemDictionary::handle_resolution_exception(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS) {
+Klass* SystemDictionary::handle_resolution_exception(Symbol* class_name,
+ bool throw_error,
+ KlassHandle klass_h, TRAPS) {
if (HAS_PENDING_EXCEPTION) {
// If we have a pending exception we forward it to the caller, unless throw_error is true,
// in which case we have to check whether the pending exception is a ClassNotFoundException,
@@ -385,7 +388,7 @@
}
if (HAS_PENDING_EXCEPTION || superk_h() == NULL) {
// can null superk
- superk_h = KlassHandle(THREAD, handle_resolution_exception(class_name, class_loader, protection_domain, true, superk_h, THREAD));
+ superk_h = KlassHandle(THREAD, handle_resolution_exception(class_name, true, superk_h, THREAD));
}
return superk_h();
@@ -971,7 +974,6 @@
if (host_klass.not_null()) {
// Create a new CLD for anonymous class, that uses the same class loader
// as the host_klass
- assert(EnableInvokeDynamic, "");
guarantee(host_klass->class_loader() == class_loader(), "should be the same");
loader_data = ClassLoaderData::anonymous_class_loader_data(class_loader(), CHECK_NULL);
loader_data->record_dependency(host_klass(), CHECK_NULL);
@@ -996,7 +998,6 @@
if (host_klass.not_null() && k.not_null()) {
- assert(EnableInvokeDynamic, "");
k->set_host_klass(host_klass());
// If it's anonymous, initialize it now, since nobody else will.
@@ -1877,13 +1878,7 @@
WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);
WKID jsr292_group_end = WK_KLASS_ENUM_NAME(VolatileCallSite_klass);
initialize_wk_klasses_until(jsr292_group_start, scan, CHECK);
- if (EnableInvokeDynamic) {
- initialize_wk_klasses_through(jsr292_group_end, scan, CHECK);
- } else {
- // Skip the JSR 292 classes, if not enabled.
- scan = WKID(jsr292_group_end + 1);
- }
-
+ initialize_wk_klasses_through(jsr292_group_end, scan, CHECK);
initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK);
_box_klasses[T_BOOLEAN] = WK_KLASS(Boolean_klass);
@@ -2119,12 +2114,13 @@
// Add entry to resolution error table to record the error when the first
// attempt to resolve a reference to a class has failed.
-void SystemDictionary::add_resolution_error(constantPoolHandle pool, int which, Symbol* error) {
+void SystemDictionary::add_resolution_error(constantPoolHandle pool, int which,
+ Symbol* error, Symbol* message) {
unsigned int hash = resolution_errors()->compute_hash(pool, which);
int index = resolution_errors()->hash_to_index(hash);
{
MutexLocker ml(SystemDictionary_lock, Thread::current());
- resolution_errors()->add_entry(index, hash, pool, which, error);
+ resolution_errors()->add_entry(index, hash, pool, which, error, message);
}
}
@@ -2134,13 +2130,19 @@
}
// Lookup resolution error table. Returns error if found, otherwise NULL.
-Symbol* SystemDictionary::find_resolution_error(constantPoolHandle pool, int which) {
+Symbol* SystemDictionary::find_resolution_error(constantPoolHandle pool, int which,
+ Symbol** message) {
unsigned int hash = resolution_errors()->compute_hash(pool, which);
int index = resolution_errors()->hash_to_index(hash);
{
MutexLocker ml(SystemDictionary_lock, Thread::current());
ResolutionErrorEntry* entry = resolution_errors()->find_entry(index, hash, pool, which);
- return (entry != NULL) ? entry->error() : (Symbol*)NULL;
+ if (entry != NULL) {
+ *message = entry->message();
+ return entry->error();
+ } else {
+ return NULL;
+ }
}
}
@@ -2221,7 +2223,6 @@
Symbol* signature,
TRAPS) {
methodHandle empty;
- assert(EnableInvokeDynamic, "");
assert(MethodHandles::is_signature_polymorphic(iid) &&
MethodHandles::is_signature_polymorphic_intrinsic(iid) &&
iid != vmIntrinsics::_invokeGeneric,
@@ -2295,7 +2296,6 @@
Handle *method_type_result,
TRAPS) {
methodHandle empty;
- assert(EnableInvokeDynamic, "");
assert(!THREAD->is_Compiler_thread(), "");
Handle method_type =
SystemDictionary::find_method_handle_type(signature, accessing_klass, CHECK_(empty));
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp Fri May 23 09:05:24 2014 -0700
@@ -151,16 +151,16 @@
\
/* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Opt ) \
- do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre_JSR292 ) \
- do_klass(MemberName_klass, java_lang_invoke_MemberName, Pre_JSR292 ) \
- do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre_JSR292 ) \
+ do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre ) \
+ do_klass(MemberName_klass, java_lang_invoke_MemberName, Pre ) \
+ do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre ) \
do_klass(LambdaForm_klass, java_lang_invoke_LambdaForm, Opt ) \
- do_klass(MethodType_klass, java_lang_invoke_MethodType, Pre_JSR292 ) \
- do_klass(BootstrapMethodError_klass, java_lang_BootstrapMethodError, Pre_JSR292 ) \
- do_klass(CallSite_klass, java_lang_invoke_CallSite, Pre_JSR292 ) \
- do_klass(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite, Pre_JSR292 ) \
- do_klass(MutableCallSite_klass, java_lang_invoke_MutableCallSite, Pre_JSR292 ) \
- do_klass(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite, Pre_JSR292 ) \
+ do_klass(MethodType_klass, java_lang_invoke_MethodType, Pre ) \
+ do_klass(BootstrapMethodError_klass, java_lang_BootstrapMethodError, Pre ) \
+ do_klass(CallSite_klass, java_lang_invoke_CallSite, Pre ) \
+ do_klass(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite, Pre ) \
+ do_klass(MutableCallSite_klass, java_lang_invoke_MutableCallSite, Pre ) \
+ do_klass(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite, Pre ) \
/* Note: MethodHandle must be first, and VolatileCallSite last in group */ \
\
do_klass(StringBuffer_klass, java_lang_StringBuffer, Pre ) \
@@ -204,7 +204,6 @@
enum InitOption {
Pre, // preloaded; error if not present
- Pre_JSR292, // preloaded if EnableInvokeDynamic
// Order is significant. Options before this point require resolve_or_fail.
// Options after this point will use resolve_or_null instead.
@@ -228,7 +227,7 @@
static Klass* resolve_or_fail(Symbol* class_name, bool throw_error, TRAPS);
private:
// handle error translation for resolve_or_null results
- static Klass* handle_resolution_exception(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS);
+ static Klass* handle_resolution_exception(Symbol* class_name, bool throw_error, KlassHandle klass_h, TRAPS);
public:
@@ -385,7 +384,6 @@
}
static Klass* check_klass_Pre( Klass* k) { return check_klass(k); }
- static Klass* check_klass_Pre_JSR292(Klass* k) { return EnableInvokeDynamic ? check_klass(k) : k; }
static Klass* check_klass_Opt( Klass* k) { return k; }
static Klass* check_klass_Opt_Only_JDK15(Klass* k) {
assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only");
@@ -531,9 +529,11 @@
// Record the error when the first attempt to resolve a reference from a constant
// pool entry to a class fails.
- static void add_resolution_error(constantPoolHandle pool, int which, Symbol* error);
+ static void add_resolution_error(constantPoolHandle pool, int which, Symbol* error,
+ Symbol* message);
static void delete_resolution_error(ConstantPool* pool);
- static Symbol* find_resolution_error(constantPoolHandle pool, int which);
+ static Symbol* find_resolution_error(constantPoolHandle pool, int which,
+ Symbol** message);
private:
--- a/hotspot/src/share/vm/classfile/verifier.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.cpp Fri May 23 09:05:24 2014 -0700
@@ -43,7 +43,7 @@
#include "runtime/handles.inline.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/javaCalls.hpp"
-#include "runtime/orderAccess.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
#ifdef TARGET_ARCH_x86
# include "bytes_x86.hpp"
@@ -2361,12 +2361,9 @@
// Get referenced class type
VerificationType ref_class_type;
if (opcode == Bytecodes::_invokedynamic) {
- if (!EnableInvokeDynamic ||
- _klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
+ if (_klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
class_format_error(
- (!EnableInvokeDynamic ?
- "invokedynamic instructions not enabled in this JVM" :
- "invokedynamic instructions not supported by this class file version"),
+ "invokedynamic instructions not supported by this class file version",
_klass->external_name());
return;
}
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Fri May 23 09:05:24 2014 -0700
@@ -775,7 +775,7 @@
/* java/lang/ref/Reference */ \
do_intrinsic(_Reference_get, java_lang_ref_Reference, get_name, void_object_signature, F_R) \
\
- /* support for com.sum.crypto.provider.AESCrypt and some of its callers */ \
+ /* support for com.sun.crypto.provider.AESCrypt and some of its callers */ \
do_class(com_sun_crypto_provider_aescrypt, "com/sun/crypto/provider/AESCrypt") \
do_intrinsic(_aescrypt_encryptBlock, com_sun_crypto_provider_aescrypt, encryptBlock_name, byteArray_int_byteArray_int_signature, F_R) \
do_intrinsic(_aescrypt_decryptBlock, com_sun_crypto_provider_aescrypt, decryptBlock_name, byteArray_int_byteArray_int_signature, F_R) \
--- a/hotspot/src/share/vm/code/dependencies.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/code/dependencies.cpp Fri May 23 09:05:24 2014 -0700
@@ -32,6 +32,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/handles.hpp"
#include "runtime/handles.inline.hpp"
+#include "runtime/thread.inline.hpp"
#include "utilities/copy.hpp"
--- a/hotspot/src/share/vm/code/nmethod.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/code/nmethod.cpp Fri May 23 09:05:24 2014 -0700
@@ -37,6 +37,7 @@
#include "oops/methodData.hpp"
#include "prims/jvmtiRedefineClassesTrace.hpp"
#include "prims/jvmtiImpl.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/sweeper.hpp"
#include "utilities/resourceHash.hpp"
@@ -750,7 +751,11 @@
_hotness_counter = NMethodSweeper::hotness_counter_reset_val();
code_buffer->copy_values_to(this);
- debug_only(verify_scavenge_root_oops());
+ if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
+ CodeCache::add_scavenge_root_nmethod(this);
+ Universe::heap()->register_nmethod(this);
+ }
+ DEBUG_ONLY(verify_scavenge_root_oops();)
CodeCache::commit(this);
}
@@ -2284,13 +2289,13 @@
void nmethodLocker::lock_nmethod(nmethod* nm, bool zombie_ok) {
if (nm == NULL) return;
Atomic::inc(&nm->_lock_count);
- guarantee(zombie_ok || !nm->is_zombie(), "cannot lock a zombie method");
+ assert(zombie_ok || !nm->is_zombie(), "cannot lock a zombie method");
}
void nmethodLocker::unlock_nmethod(nmethod* nm) {
if (nm == NULL) return;
Atomic::dec(&nm->_lock_count);
- guarantee(nm->_lock_count >= 0, "unmatched nmethod lock/unlock");
+ assert(nm->_lock_count >= 0, "unmatched nmethod lock/unlock");
}
--- a/hotspot/src/share/vm/code/nmethod.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/code/nmethod.hpp Fri May 23 09:05:24 2014 -0700
@@ -203,7 +203,7 @@
// and is not made into a zombie. However, once the nmethod is made into
// a zombie, it will be locked one final time if CompiledMethodUnload
// event processing needs to be done.
- jint _lock_count;
+ volatile jint _lock_count;
// not_entrant method removal. Each mark_sweep pass will update
// this mark to current sweep invocation count if it is seen on the
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Fri May 23 09:05:24 2014 -0700
@@ -150,9 +150,8 @@
long CompileBroker::_peak_compilation_time = 0;
-CompileQueue* CompileBroker::_c2_method_queue = NULL;
-CompileQueue* CompileBroker::_c1_method_queue = NULL;
-CompileTask* CompileBroker::_task_free_list = NULL;
+CompileQueue* CompileBroker::_c2_compile_queue = NULL;
+CompileQueue* CompileBroker::_c1_compile_queue = NULL;
GrowableArray<CompilerThread*>* CompileBroker::_compiler_threads = NULL;
@@ -220,13 +219,56 @@
// By convention, the compiling thread is responsible for
// recycling a non-blocking CompileTask.
- CompileBroker::free_task(task);
+ CompileTask::free(task);
}
}
-// ------------------------------------------------------------------
-// CompileTask::initialize
+CompileTask* CompileTask::_task_free_list = NULL;
+#ifdef ASSERT
+int CompileTask::_num_allocated_tasks = 0;
+#endif
+/**
+ * Allocate a CompileTask, from the free list if possible.
+ */
+CompileTask* CompileTask::allocate() {
+ MutexLocker locker(CompileTaskAlloc_lock);
+ CompileTask* task = NULL;
+
+ if (_task_free_list != NULL) {
+ task = _task_free_list;
+ _task_free_list = task->next();
+ task->set_next(NULL);
+ } else {
+ task = new CompileTask();
+ DEBUG_ONLY(_num_allocated_tasks++;)
+ assert (_num_allocated_tasks < 10000, "Leaking compilation tasks?");
+ task->set_next(NULL);
+ task->set_is_free(true);
+ }
+ assert(task->is_free(), "Task must be free.");
+ task->set_is_free(false);
+ return task;
+}
+
+
+/**
+ * Add a task to the free list.
+ */
+void CompileTask::free(CompileTask* task) {
+ MutexLocker locker(CompileTaskAlloc_lock);
+ if (!task->is_free()) {
+ task->set_code(NULL);
+ assert(!task->lock()->is_locked(), "Should not be locked when freed");
+ JNIHandles::destroy_global(task->_method_holder);
+ JNIHandles::destroy_global(task->_hot_method_holder);
+
+ task->set_is_free(true);
+ task->set_next(_task_free_list);
+ _task_free_list = task;
+ }
+}
+
void CompileTask::initialize(int compile_id,
methodHandle method,
int osr_bci,
@@ -284,15 +326,6 @@
if (nm == NULL) _code_handle = NULL; // drop the handle also
}
-// ------------------------------------------------------------------
-// CompileTask::free
-void CompileTask::free() {
- set_code(NULL);
- assert(!_lock->is_locked(), "Should not be locked when freed");
- JNIHandles::destroy_global(_method_holder);
- JNIHandles::destroy_global(_hot_method_holder);
-}
-
void CompileTask::mark_on_stack() {
// Mark these methods as something redefine classes cannot remove.
@@ -555,9 +588,12 @@
-// Add a CompileTask to a CompileQueue
+/**
+ * Add a CompileTask to a CompileQueue
+ */
void CompileQueue::add(CompileTask* task) {
assert(lock()->owned_by_self(), "must own lock");
+ assert(!CompileBroker::is_compilation_disabled_forever(), "Do not add task if compilation is turned off forever");
task->set_next(NULL);
task->set_prev(NULL);
@@ -579,9 +615,7 @@
// Mark the method as being in the compile queue.
task->method()->set_queued_for_compilation();
- if (CIPrintCompileQueue) {
- print();
- }
+ NOT_PRODUCT(print();)
if (LogCompilation && xtty != NULL) {
task->log_task_queued();
@@ -591,14 +625,29 @@
lock()->notify_all();
}
-void CompileQueue::delete_all() {
- assert(lock()->owned_by_self(), "must own lock");
- if (_first != NULL) {
- for (CompileTask* task = _first; task != NULL; task = task->next()) {
- delete task;
- }
- _first = NULL;
+/**
+ * Empties compilation queue by putting all compilation tasks onto
+ * a freelist. Furthermore, the method wakes up all threads that are
+ * waiting on a compilation task to finish. This can happen if background
+ * compilation is disabled.
+ */
+void CompileQueue::free_all() {
+ MutexLocker mu(lock());
+ CompileTask* next = _first;
+
+ // Iterate over all tasks in the compile queue
+ while (next != NULL) {
+ CompileTask* current = next;
+ next = current->next();
+ // Wake up thread that blocks on the compile task.
+ current->lock()->notify();
+ // Put the task back on the freelist.
+ CompileTask::free(current);
}
+ _first = NULL;
+
+ // Wake up all threads that block on the queue.
+ lock()->notify_all();
}
// ------------------------------------------------------------------
@@ -691,18 +740,24 @@
}
}
-// ------------------------------------------------------------------
-// CompileQueue::print
+#ifndef PRODUCT
+/**
+ * Print entire compilation queue.
+ */
void CompileQueue::print() {
- tty->print_cr("Contents of %s", name());
- tty->print_cr("----------------------");
- CompileTask* task = _first;
- while (task != NULL) {
- task->print_line();
- task = task->next();
+ if (CIPrintCompileQueue) {
+ ttyLocker ttyl;
+ tty->print_cr("Contents of %s", name());
+ tty->print_cr("----------------------");
+ CompileTask* task = _first;
+ while (task != NULL) {
+ task->print_line();
+ task = task->next();
+ }
+ tty->print_cr("----------------------");
}
- tty->print_cr("----------------------");
}
+#endif // PRODUCT
CompilerCounters::CompilerCounters(const char* thread_name, int instance, TRAPS) {
@@ -775,9 +830,6 @@
_compilers[1] = new SharkCompiler();
#endif // SHARK
- // Initialize the CompileTask free list
- _task_free_list = NULL;
-
// Start the CompilerThreads
init_compiler_threads(c1_count, c2_count);
// totalTime performance counter is always created as it is required
@@ -970,11 +1022,11 @@
#endif // !ZERO && !SHARK
// Initialize the compilation queue
if (c2_compiler_count > 0) {
- _c2_method_queue = new CompileQueue("C2MethodQueue", MethodCompileQueue_lock);
+ _c2_compile_queue = new CompileQueue("C2 CompileQueue", MethodCompileQueue_lock);
_compilers[1]->set_num_compiler_threads(c2_compiler_count);
}
if (c1_compiler_count > 0) {
- _c1_method_queue = new CompileQueue("C1MethodQueue", MethodCompileQueue_lock);
+ _c1_compile_queue = new CompileQueue("C1 CompileQueue", MethodCompileQueue_lock);
_compilers[0]->set_num_compiler_threads(c1_compiler_count);
}
@@ -989,7 +1041,7 @@
sprintf(name_buffer, "C2 CompilerThread%d", i);
CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK);
// Shark and C2
- CompilerThread* new_thread = make_compiler_thread(name_buffer, _c2_method_queue, counters, _compilers[1], CHECK);
+ CompilerThread* new_thread = make_compiler_thread(name_buffer, _c2_compile_queue, counters, _compilers[1], CHECK);
_compiler_threads->append(new_thread);
}
@@ -998,7 +1050,7 @@
sprintf(name_buffer, "C1 CompilerThread%d", i);
CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK);
// C1
- CompilerThread* new_thread = make_compiler_thread(name_buffer, _c1_method_queue, counters, _compilers[0], CHECK);
+ CompilerThread* new_thread = make_compiler_thread(name_buffer, _c1_compile_queue, counters, _compilers[0], CHECK);
_compiler_threads->append(new_thread);
}
@@ -1008,14 +1060,19 @@
}
-// Set the methods on the stack as on_stack so that redefine classes doesn't
-// reclaim them
+/**
+ * Set the methods on the stack as on_stack so that redefine classes doesn't
+ * reclaim them. This method is executed at a safepoint.
+ */
void CompileBroker::mark_on_stack() {
- if (_c2_method_queue != NULL) {
- _c2_method_queue->mark_on_stack();
+ assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
+ // Since we are at a safepoint, we do not need a lock to access
+ // the compile queues.
+ if (_c2_compile_queue != NULL) {
+ _c2_compile_queue->mark_on_stack();
}
- if (_c1_method_queue != NULL) {
- _c1_method_queue->mark_on_stack();
+ if (_c1_compile_queue != NULL) {
+ _c1_compile_queue->mark_on_stack();
}
}
@@ -1031,7 +1088,7 @@
const char* comment,
Thread* thread) {
// do nothing if compiler thread(s) is not available
- if (!_initialized ) {
+ if (!_initialized) {
return;
}
@@ -1078,7 +1135,7 @@
// If this method is already in the compile queue, then
// we do not block the current thread.
- if (compilation_is_in_queue(method, osr_bci)) {
+ if (compilation_is_in_queue(method)) {
// We may want to decay our counter a bit here to prevent
// multiple denied requests for compilation. This is an
// open compilation policy issue. Note: The other possibility,
@@ -1111,7 +1168,7 @@
// Make sure the method has not slipped into the queues since
// last we checked; note that those checks were "fast bail-outs".
// Here we need to be more careful, see 14012000 below.
- if (compilation_is_in_queue(method, osr_bci)) {
+ if (compilation_is_in_queue(method)) {
return;
}
@@ -1132,7 +1189,7 @@
}
// Should this thread wait for completion of the compile?
- blocking = is_compile_blocking(method, osr_bci);
+ blocking = is_compile_blocking();
// We will enter the compilation in the queue.
// 14012000: Note that this sets the queued_for_compile bits in
@@ -1324,19 +1381,17 @@
}
-// ------------------------------------------------------------------
-// CompileBroker::compilation_is_in_queue
-//
-// See if this compilation is already requested.
-//
-// Implementation note: there is only a single "is in queue" bit
-// for each method. This means that the check below is overly
-// conservative in the sense that an osr compilation in the queue
-// will block a normal compilation from entering the queue (and vice
-// versa). This can be remedied by a full queue search to disambiguate
-// cases. If it is deemed profitible, this may be done.
-bool CompileBroker::compilation_is_in_queue(methodHandle method,
- int osr_bci) {
+/**
+ * See if this compilation is already requested.
+ *
+ * Implementation note: there is only a single "is in queue" bit
+ * for each method. This means that the check below is overly
+ * conservative in the sense that an osr compilation in the queue
+ * will block a normal compilation from entering the queue (and vice
+ * versa). This can be remedied by a full queue search to disambiguate
+ * cases. If it is deemed profitable, this may be done.
+ */
+bool CompileBroker::compilation_is_in_queue(methodHandle method) {
return method->queued_for_compilation();
}
@@ -1416,13 +1471,11 @@
#endif
}
-
-// ------------------------------------------------------------------
-// CompileBroker::is_compile_blocking
-//
-// Should the current thread be blocked until this compilation request
-// has been fulfilled?
-bool CompileBroker::is_compile_blocking(methodHandle method, int osr_bci) {
+/**
+ * Should the current thread block until this compilation request
+ * has been fulfilled?
+ */
+bool CompileBroker::is_compile_blocking() {
assert(!InstanceRefKlass::owns_pending_list_lock(JavaThread::current()), "possible deadlock");
return !BackgroundCompilation;
}
@@ -1450,7 +1503,7 @@
int hot_count,
const char* comment,
bool blocking) {
- CompileTask* new_task = allocate_task();
+ CompileTask* new_task = CompileTask::allocate();
new_task->initialize(compile_id, method, osr_bci, comp_level,
hot_method, hot_count, comment,
blocking);
@@ -1459,75 +1512,52 @@
}
-// ------------------------------------------------------------------
-// CompileBroker::allocate_task
-//
-// Allocate a CompileTask, from the free list if possible.
-CompileTask* CompileBroker::allocate_task() {
- MutexLocker locker(CompileTaskAlloc_lock);
- CompileTask* task = NULL;
- if (_task_free_list != NULL) {
- task = _task_free_list;
- _task_free_list = task->next();
- task->set_next(NULL);
- } else {
- task = new CompileTask();
- task->set_next(NULL);
- }
- return task;
-}
-
-
-// ------------------------------------------------------------------
-// CompileBroker::free_task
-//
-// Add a task to the free list.
-void CompileBroker::free_task(CompileTask* task) {
- MutexLocker locker(CompileTaskAlloc_lock);
- task->free();
- task->set_next(_task_free_list);
- _task_free_list = task;
-}
-
-
-// ------------------------------------------------------------------
-// CompileBroker::wait_for_completion
-//
-// Wait for the given method CompileTask to complete.
+/**
+ * Wait for the compilation task to complete.
+ */
void CompileBroker::wait_for_completion(CompileTask* task) {
if (CIPrintCompileQueue) {
+ ttyLocker ttyl;
tty->print_cr("BLOCKING FOR COMPILE");
}
assert(task->is_blocking(), "can only wait on blocking task");
- JavaThread *thread = JavaThread::current();
+ JavaThread* thread = JavaThread::current();
thread->set_blocked_on_compilation(true);
methodHandle method(thread, task->method());
{
MutexLocker waiter(task->lock(), thread);
- while (!task->is_complete())
+ while (!task->is_complete() && !is_compilation_disabled_forever()) {
task->lock()->wait();
+ }
}
+
+ thread->set_blocked_on_compilation(false);
+ if (is_compilation_disabled_forever()) {
+ CompileTask::free(task);
+ return;
+ }
+
// It is harmless to check this status without the lock, because
// completion is a stable property (until the task object is recycled).
assert(task->is_complete(), "Compilation should have completed");
assert(task->code_handle() == NULL, "must be reset");
- thread->set_blocked_on_compilation(false);
-
// By convention, the waiter is responsible for recycling a
// blocking CompileTask. Since there is only one waiter ever
// waiting on a CompileTask, we know that no one else will
// be using this CompileTask; we can free it.
- free_task(task);
+ CompileTask::free(task);
}
-// Initialize compiler thread(s) + compiler object(s). The postcondition
-// of this function is that the compiler runtimes are initialized and that
-//compiler threads can start compiling.
+/**
+ * Initialize compiler thread(s) + compiler object(s). The postcondition
+ * of this function is that the compiler runtimes are initialized and that
+ * compiler threads can start compiling.
+ */
bool CompileBroker::init_compiler_runtime() {
CompilerThread* thread = CompilerThread::current();
AbstractCompiler* comp = thread->compiler();
@@ -1564,7 +1594,6 @@
disable_compilation_forever();
// If compiler initialization failed, no compiler thread that is specific to a
// particular compiler runtime will ever start to compile methods.
-
shutdown_compiler_runtime(comp, thread);
return false;
}
@@ -1578,9 +1607,11 @@
return true;
}
-// If C1 and/or C2 initialization failed, we shut down all compilation.
-// We do this to keep things simple. This can be changed if it ever turns out to be
-// a problem.
+/**
+ * If C1 and/or C2 initialization failed, we shut down all compilation.
+ * We do this to keep things simple. This can be changed if it ever turns
+ * out to be a problem.
+ */
void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) {
// Free buffer blob, if allocated
if (thread->get_buffer_blob() != NULL) {
@@ -1592,28 +1623,25 @@
// There are two reasons for shutting down the compiler
// 1) compiler runtime initialization failed
// 2) The code cache is full and the following flag is set: -XX:-UseCodeCacheFlushing
- warning("Shutting down compiler %s (no space to run compilers)", comp->name());
+ warning("%s initialization failed. Shutting down all compilers", comp->name());
// Only one thread per compiler runtime object enters here
// Set state to shut down
comp->set_shut_down();
- MutexLocker mu(MethodCompileQueue_lock, thread);
- CompileQueue* queue;
- if (_c1_method_queue != NULL) {
- _c1_method_queue->delete_all();
- queue = _c1_method_queue;
- _c1_method_queue = NULL;
- delete _c1_method_queue;
+ // Delete all queued compilation tasks to make compiler threads exit faster.
+ if (_c1_compile_queue != NULL) {
+ _c1_compile_queue->free_all();
}
- if (_c2_method_queue != NULL) {
- _c2_method_queue->delete_all();
- queue = _c2_method_queue;
- _c2_method_queue = NULL;
- delete _c2_method_queue;
+ if (_c2_compile_queue != NULL) {
+ _c2_compile_queue->free_all();
}
+ // Set flags so that we continue execution with using interpreter only.
+ UseCompiler = false;
+ UseInterpreter = true;
+
// We could delete compiler runtimes also. However, there are references to
// the compiler runtime(s) (e.g., nmethod::is_compiled_by_c1()) which then
// fail. This can be done later if necessary.
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp Fri May 23 09:05:24 2014 -0700
@@ -40,6 +40,11 @@
friend class VMStructs;
private:
+ static CompileTask* _task_free_list;
+#ifdef ASSERT
+ static int _num_allocated_tasks;
+#endif
+
Monitor* _lock;
uint _compile_id;
Method* _method;
@@ -52,7 +57,7 @@
int _num_inlined_bytecodes;
nmethodLocker* _code_handle; // holder of eventual result
CompileTask* _next, *_prev;
-
+ bool _is_free;
// Fields used for logging why the compilation was initiated:
jlong _time_queued; // in units of os::elapsed_counter()
Method* _hot_method; // which method actually triggered this task
@@ -69,7 +74,8 @@
methodHandle hot_method, int hot_count, const char* comment,
bool is_blocking);
- void free();
+ static CompileTask* allocate();
+ static void free(CompileTask* task);
int compile_id() const { return _compile_id; }
Method* method() const { return _method; }
@@ -98,6 +104,8 @@
void set_next(CompileTask* next) { _next = next; }
CompileTask* prev() const { return _prev; }
void set_prev(CompileTask* prev) { _prev = prev; }
+ bool is_free() const { return _is_free; }
+ void set_is_free(bool val) { _is_free = val; }
private:
static void print_compilation_impl(outputStream* st, Method* method, int compile_id, int comp_level,
@@ -213,8 +221,8 @@
// Redefine Classes support
void mark_on_stack();
- void delete_all();
- void print();
+ void free_all();
+ NOT_PRODUCT (void print();)
~CompileQueue() {
assert (is_empty(), " Compile Queue must be empty");
@@ -267,9 +275,8 @@
static int _last_compile_level;
static char _last_method_compiled[name_buffer_length];
- static CompileQueue* _c2_method_queue;
- static CompileQueue* _c1_method_queue;
- static CompileTask* _task_free_list;
+ static CompileQueue* _c2_compile_queue;
+ static CompileQueue* _c1_compile_queue;
static GrowableArray<CompilerThread*>* _compiler_threads;
@@ -322,7 +329,7 @@
static void init_compiler_threads(int c1_compiler_count, int c2_compiler_count);
static bool compilation_is_complete (methodHandle method, int osr_bci, int comp_level);
static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level);
- static bool is_compile_blocking (methodHandle method, int osr_bci);
+ static bool is_compile_blocking ();
static void preload_classes (methodHandle method, TRAPS);
static CompileTask* create_compile_task(CompileQueue* queue,
@@ -334,8 +341,6 @@
int hot_count,
const char* comment,
bool blocking);
- static CompileTask* allocate_task();
- static void free_task(CompileTask* task);
static void wait_for_completion(CompileTask* task);
static void invoke_compiler_on_method(CompileTask* task);
@@ -353,8 +358,8 @@
const char* comment,
Thread* thread);
static CompileQueue* compile_queue(int comp_level) {
- if (is_c2_compile(comp_level)) return _c2_method_queue;
- if (is_c1_compile(comp_level)) return _c1_method_queue;
+ if (is_c2_compile(comp_level)) return _c2_compile_queue;
+ if (is_c1_compile(comp_level)) return _c1_compile_queue;
return NULL;
}
static bool init_compiler_runtime();
@@ -372,7 +377,7 @@
return NULL;
}
- static bool compilation_is_in_queue(methodHandle method, int osr_bci);
+ static bool compilation_is_in_queue(methodHandle method);
static int queue_size(int comp_level) {
CompileQueue *q = compile_queue(comp_level);
return q != NULL ? q->size() : 0;
--- a/hotspot/src/share/vm/compiler/oopMap.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/compiler/oopMap.cpp Fri May 23 09:05:24 2014 -0700
@@ -467,7 +467,6 @@
assert(cb != NULL, "no codeblob");
// Any reg might be saved by a safepoint handler (see generate_handler_blob).
- const int max_saved_on_entry_reg_count = ConcreteRegisterImpl::number_of_registers;
assert( reg_map->_update_for_id == NULL || fr->is_older(reg_map->_update_for_id),
"already updated this map; do not 'update' it twice!" );
debug_only(reg_map->_update_for_id = fr->id());
@@ -477,27 +476,20 @@
!cb->caller_must_gc_arguments(reg_map->thread())),
"include_argument_oops should already be set");
- int nof_callee = 0;
- oop* locs[2*max_saved_on_entry_reg_count+1];
- VMReg regs[2*max_saved_on_entry_reg_count+1];
- // ("+1" because max_saved_on_entry_reg_count might be zero)
-
// Scan through oopmap and find location of all callee-saved registers
// (we do not do update in place, since info could be overwritten)
address pc = fr->pc();
-
OopMap* map = cb->oop_map_for_return_address(pc);
-
- assert(map != NULL, " no ptr map found");
+ assert(map != NULL, "no ptr map found");
+ DEBUG_ONLY(int nof_callee = 0;)
- OopMapValue omv;
- for(OopMapStream oms(map,OopMapValue::callee_saved_value); !oms.is_done(); oms.next()) {
- omv = oms.current();
- assert(nof_callee < 2*max_saved_on_entry_reg_count, "overflow");
- regs[nof_callee] = omv.content_reg();
- locs[nof_callee] = fr->oopmapreg_to_location(omv.reg(),reg_map);
- nof_callee++;
+ for (OopMapStream oms(map, OopMapValue::callee_saved_value); !oms.is_done(); oms.next()) {
+ OopMapValue omv = oms.current();
+ VMReg reg = omv.content_reg();
+ oop* loc = fr->oopmapreg_to_location(omv.reg(), reg_map);
+ reg_map->set_location(reg, (address) loc);
+ DEBUG_ONLY(nof_callee++;)
}
// Check that runtime stubs save all callee-saved registers
@@ -506,11 +498,6 @@
(nof_callee >= SAVED_ON_ENTRY_REG_COUNT || nof_callee >= C_SAVED_ON_ENTRY_REG_COUNT),
"must save all");
#endif // COMPILER2
-
- // Copy found callee-saved register to reg_map
- for(int i = 0; i < nof_callee; i++) {
- reg_map->set_location(regs[i], (address)locs[i]);
- }
}
//=============================================================================
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp Fri May 23 09:05:24 2014 -0700
@@ -158,7 +158,7 @@
" coal_deaths(" SIZE_FORMAT ")"
" + count(" SSIZE_FORMAT ")",
this, size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(),
- _allocation_stats.split_births(), _allocation_stats.split_deaths(),
+ _allocation_stats.coal_births(), _allocation_stats.split_deaths(),
_allocation_stats.coal_deaths(), count()));
}
#endif
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp Fri May 23 09:05:24 2014 -0700
@@ -27,7 +27,7 @@
#include "memory/collectorPolicy.hpp"
-class ConcurrentMarkSweepPolicy : public TwoGenerationCollectorPolicy {
+class ConcurrentMarkSweepPolicy : public GenCollectorPolicy {
protected:
void initialize_alignments();
void initialize_generations();
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Fri May 23 09:05:24 2014 -0700
@@ -39,6 +39,7 @@
#include "runtime/handles.inline.hpp"
#include "runtime/init.hpp"
#include "runtime/java.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/copy.hpp"
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri May 23 09:05:24 2014 -0700
@@ -59,6 +59,7 @@
#include "runtime/globals_extension.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/java.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/vmThread.hpp"
#include "services/memoryService.hpp"
#include "services/runtimeService.hpp"
@@ -1560,7 +1561,7 @@
// this is not likely to be productive in practice because it's probably too
// late anyway.
GenCollectedHeap* gch = GenCollectedHeap::heap();
- assert(gch->collector_policy()->is_two_generation_policy(),
+ assert(gch->collector_policy()->is_generation_policy(),
"You may want to check the correctness of the following");
if (gch->incremental_collection_will_fail(true /* consult_young */)) {
if (Verbose && PrintGCDetails) {
@@ -1964,7 +1965,7 @@
// has exceeded the threshold set by CMSFullGCsBeforeCompaction,
// or if an incremental collection has failed
GenCollectedHeap* gch = GenCollectedHeap::heap();
- assert(gch->collector_policy()->is_two_generation_policy(),
+ assert(gch->collector_policy()->is_generation_policy(),
"You may want to check the correctness of the following");
// Inform cms gen if this was due to partial collection failing.
// The CMS gen may use this fact to determine its expansion policy.
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp Fri May 23 09:05:24 2014 -0700
@@ -223,12 +223,6 @@
}
}
-void ConcurrentMarkSweepThread::print_on(outputStream* st) const {
- st->print("\"%s\" ", name());
- Thread::print_on(st);
- st->cr();
-}
-
void ConcurrentMarkSweepThread::print_all_on(outputStream* st) {
if (_cmst != NULL) {
_cmst->print_on(st);
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp Fri May 23 09:05:24 2014 -0700
@@ -94,8 +94,6 @@
static void threads_do(ThreadClosure* tc);
// Printing
- void print_on(outputStream* st) const;
- void print() const { print_on(tty); }
static void print_all_on(outputStream* st);
static void print_all() { print_all_on(tty); }
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp Fri May 23 09:05:24 2014 -0700
@@ -58,6 +58,9 @@
}
initialize();
create_and_start();
+
+ // set name
+ set_name("G1 Concurrent Refinement Thread#%d", worker_id);
}
void ConcurrentG1RefineThread::initialize() {
@@ -247,12 +250,3 @@
}
}
-void ConcurrentG1RefineThread::print() const {
- print_on(tty);
-}
-
-void ConcurrentG1RefineThread::print_on(outputStream* st) const {
- st->print("\"G1 Concurrent Refinement Thread#%d\" ", _worker_id);
- Thread::print_on(st);
- st->cr();
-}
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp Fri May 23 09:05:24 2014 -0700
@@ -77,10 +77,6 @@
void initialize();
- // Printing
- void print() const;
- void print_on(outputStream* st) const;
-
// Total virtual time so far.
double vtime_accum() { return _vtime_accum; }
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp Fri May 23 09:05:24 2014 -0700
@@ -46,6 +46,8 @@
_in_progress(false),
_vtime_accum(0.0),
_vtime_mark_accum(0.0) {
+
+ set_name("G1 Main Concurrent Mark GC Thread");
create_and_start();
}
@@ -322,16 +324,6 @@
}
}
-void ConcurrentMarkThread::print() const {
- print_on(tty);
-}
-
-void ConcurrentMarkThread::print_on(outputStream* st) const {
- st->print("\"G1 Main Concurrent Mark GC Thread\" ");
- Thread::print_on(st);
- st->cr();
-}
-
void ConcurrentMarkThread::sleepBeforeNextCycle() {
// We join here because we don't want to do the "shouldConcurrentMark()"
// below while the world is otherwise stopped.
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp Fri May 23 09:05:24 2014 -0700
@@ -60,10 +60,6 @@
static void makeSurrogateLockerThread(TRAPS);
static SurrogateLockerThread* slt() { return _slt; }
- // Printing
- void print_on(outputStream* st) const;
- void print() const;
-
// Total virtual time so far.
double vtime_accum();
// Marking virtual time so far
--- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp Fri May 23 09:05:24 2014 -0700
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "gc_implementation/g1/g1AllocRegion.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
G1CollectedHeap* G1AllocRegion::_g1h = NULL;
HeapRegion* G1AllocRegion::_dummy_region = NULL;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri May 23 09:05:24 2014 -0700
@@ -56,6 +56,7 @@
#include "memory/referenceProcessor.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oop.pcgc.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/ticks.hpp"
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri May 23 09:05:24 2014 -0700
@@ -1107,20 +1107,11 @@
return _gc_time_stamp;
}
- void reset_gc_time_stamp() {
- _gc_time_stamp = 0;
- OrderAccess::fence();
- // Clear the cached CSet starting regions and time stamps.
- // Their validity is dependent on the GC timestamp.
- clear_cset_start_regions();
- }
+ inline void reset_gc_time_stamp();
void check_gc_time_stamps() PRODUCT_RETURN;
- void increment_gc_time_stamp() {
- ++_gc_time_stamp;
- OrderAccess::fence();
- }
+ inline void increment_gc_time_stamp();
// Reset the given region's GC timestamp. If it's starts humongous,
// also reset the GC timestamp of its corresponding
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -33,6 +33,7 @@
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#include "gc_implementation/g1/heapRegionSet.inline.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "utilities/taskqueue.hpp"
// Inline functions for G1CollectedHeap
@@ -60,6 +61,19 @@
return hr;
}
+inline void G1CollectedHeap::reset_gc_time_stamp() {
+ _gc_time_stamp = 0;
+ OrderAccess::fence();
+ // Clear the cached CSet starting regions and time stamps.
+ // Their validity is dependent on the GC timestamp.
+ clear_cset_start_regions();
+}
+
+inline void G1CollectedHeap::increment_gc_time_stamp() {
+ ++_gc_time_stamp;
+ OrderAccess::fence();
+}
+
inline void G1CollectedHeap::old_set_remove(HeapRegion* hr) {
_old_set.remove(hr);
}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Fri May 23 09:05:24 2014 -0700
@@ -27,6 +27,7 @@
#include "gc_implementation/g1/heapRegion.hpp"
#include "gc_implementation/g1/satbQueue.hpp"
#include "runtime/mutexLocker.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/thread.inline.hpp"
G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap,
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.cpp Fri May 23 09:05:24 2014 -0700
@@ -53,12 +53,6 @@
return _thread;
}
-void G1StringDedupThread::print_on(outputStream* st) const {
- st->print("\"%s\" ", name());
- Thread::print_on(st);
- st->cr();
-}
-
void G1StringDedupThread::run() {
G1StringDedupStat total_stat;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.hpp Fri May 23 09:05:24 2014 -0700
@@ -52,7 +52,6 @@
static G1StringDedupThread* thread();
virtual void run();
- virtual void print_on(outputStream* st) const;
};
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1STRINGDEDUPTHREAD_HPP
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp Fri May 23 09:05:24 2014 -0700
@@ -33,6 +33,7 @@
#include "memory/genOopClosures.inline.hpp"
#include "memory/iterator.hpp"
#include "oops/oop.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
int HeapRegion::LogOfHRGrainBytes = 0;
int HeapRegion::LogOfHRGrainWords = 0;
--- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp Fri May 23 09:05:24 2014 -0700
@@ -32,6 +32,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/java.hpp"
#include "runtime/mutexLocker.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/virtualspace.hpp"
#include "runtime/vmThread.hpp"
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp Fri May 23 09:05:24 2014 -0700
@@ -50,7 +50,7 @@
#include "runtime/handles.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/java.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/thread.inline.hpp"
#include "utilities/copy.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/workgroup.hpp"
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp Fri May 23 09:05:24 2014 -0700
@@ -30,6 +30,7 @@
#include "memory/allocation.inline.hpp"
#include "runtime/mutex.hpp"
#include "runtime/mutexLocker.hpp"
+#include "runtime/orderAccess.inline.hpp"
//
// GCTask
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp Fri May 23 09:05:24 2014 -0700
@@ -87,12 +87,6 @@
_time_stamp_index = 0;
}
-void GCTaskThread::print_on(outputStream* st) const {
- st->print("\"%s\" ", name());
- Thread::print_on(st);
- st->cr();
-}
-
// GC workers get tasks from the GCTaskManager and execute
// them in this method. If there are no tasks to execute,
// the GC workers wait in the GCTaskManager's get_task()
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.hpp Fri May 23 09:05:24 2014 -0700
@@ -69,8 +69,6 @@
void start();
void print_task_time_stamps();
- void print_on(outputStream* st) const;
- void print() const { print_on(tty); }
protected:
// Constructor. Clients use factory, but there could be subclasses.
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp Fri May 23 09:05:24 2014 -0700
@@ -45,7 +45,7 @@
void GenerationSizer::initialize_flags() {
// Do basic sizing work
- TwoGenerationCollectorPolicy::initialize_flags();
+ GenCollectorPolicy::initialize_flags();
assert(UseSerialGC ||
!FLAG_IS_DEFAULT(ParallelGCThreads) ||
@@ -79,7 +79,7 @@
// Redo everything from the start
initialize_flags();
}
- TwoGenerationCollectorPolicy::initialize_size_info();
+ GenCollectorPolicy::initialize_size_info();
trace_gen_sizes("ps heap rnd");
}
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.hpp Fri May 23 09:05:24 2014 -0700
@@ -28,9 +28,9 @@
#include "memory/collectorPolicy.hpp"
// There is a nice batch of tested generation sizing code in
-// TwoGenerationCollectorPolicy. Lets reuse it!
+// GenCollectorPolicy. Lets reuse it!
-class GenerationSizer : public TwoGenerationCollectorPolicy {
+class GenerationSizer : public GenCollectorPolicy {
private:
void trace_gen_sizes(const char* const str);
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp Fri May 23 09:05:24 2014 -0700
@@ -41,43 +41,10 @@
#include "runtime/frame.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/interfaceSupport.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/threadCritical.hpp"
#include "utilities/exceptions.hpp"
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "orderAccess_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "orderAccess_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "orderAccess_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "orderAccess_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "orderAccess_solaris_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "orderAccess_windows_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "orderAccess_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "orderAccess_linux_ppc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "orderAccess_aix_ppc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "orderAccess_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "orderAccess_bsd_zero.inline.hpp"
-#endif
-
// no precompiled headers
#ifdef CC_INTERP
@@ -507,25 +474,7 @@
#ifdef ASSERT
if (istate->_msg != initialize) {
- // We have a problem here if we are running with a pre-hsx24 JDK (for example during bootstrap)
- // because in that case, EnableInvokeDynamic is true by default but will be later switched off
- // if java_lang_invoke_MethodHandle::compute_offsets() detects that the JDK only has the classes
- // for the old JSR292 implementation.
- // This leads to a situation where 'istate->_stack_limit' always accounts for
- // methodOopDesc::extra_stack_entries() because it is computed in
- // CppInterpreterGenerator::generate_compute_interpreter_state() which was generated while
- // EnableInvokeDynamic was still true. On the other hand, istate->_method->max_stack() doesn't
- // account for extra_stack_entries() anymore because at the time when it is called
- // EnableInvokeDynamic was already set to false.
- // So we have a second version of the assertion which handles the case where EnableInvokeDynamic was
- // switched off because of the wrong classes.
- if (EnableInvokeDynamic || FLAG_IS_CMDLINE(EnableInvokeDynamic)) {
- assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit");
- } else {
- const int extra_stack_entries = Method::extra_stack_entries_for_jsr292;
- assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + extra_stack_entries
- + 1), "bad stack limit");
- }
+ assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit");
#ifndef SHARK
IA32_ONLY(assert(istate->_stack_limit == istate->_thread->last_Java_sp() + 1, "wrong"));
#endif // !SHARK
@@ -2458,15 +2407,6 @@
CASE(_invokedynamic): {
- if (!EnableInvokeDynamic) {
- // We should not encounter this bytecode if !EnableInvokeDynamic.
- // The verifier will stop it. However, if we get past the verifier,
- // this will stop the thread in a reasonable way, without crashing the JVM.
- CALL_VM(InterpreterRuntime::throw_IncompatibleClassChangeError(THREAD),
- handle_exception);
- ShouldNotReachHere();
- }
-
u4 index = Bytes::get_native_u4(pc+1);
ConstantPoolCacheEntry* cache = cp->constant_pool()->invokedynamic_cp_cache_entry_at(index);
@@ -2501,10 +2441,6 @@
CASE(_invokehandle): {
- if (!EnableInvokeDynamic) {
- ShouldNotReachHere();
- }
-
u2 index = Bytes::get_native_u2(pc+1);
ConstantPoolCacheEntry* cache = cp->entry_at(index);
--- a/hotspot/src/share/vm/interpreter/bytecodes.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/bytecodes.hpp Fri May 23 09:05:24 2014 -0700
@@ -224,7 +224,7 @@
_invokespecial = 183, // 0xb7
_invokestatic = 184, // 0xb8
_invokeinterface = 185, // 0xb9
- _invokedynamic = 186, // 0xba // if EnableInvokeDynamic
+ _invokedynamic = 186, // 0xba
_new = 187, // 0xbb
_newarray = 188, // 0xbc
_anewarray = 189, // 0xbd
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Fri May 23 09:05:24 2014 -0700
@@ -769,7 +769,6 @@
// First time execution: Resolve symbols, create a permanent MethodType object.
IRT_ENTRY(void, InterpreterRuntime::resolve_invokehandle(JavaThread* thread)) {
- assert(EnableInvokeDynamic, "");
const Bytecodes::Code bytecode = Bytecodes::_invokehandle;
// resolve method
@@ -789,7 +788,6 @@
// First time execution: Resolve symbols, create a permanent CallSite object.
IRT_ENTRY(void, InterpreterRuntime::resolve_invokedynamic(JavaThread* thread)) {
- assert(EnableInvokeDynamic, "");
const Bytecodes::Code bytecode = Bytecodes::_invokedynamic;
//TO DO: consider passing BCI to Java.
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp Fri May 23 09:05:24 2014 -0700
@@ -270,7 +270,7 @@
}
}
- if (checkpolymorphism && EnableInvokeDynamic && result_oop != NULL) {
+ if (checkpolymorphism && result_oop != NULL) {
vmIntrinsics::ID iid = result_oop->intrinsic_id();
if (MethodHandles::is_signature_polymorphic(iid)) {
// Do not link directly to these. The VM must produce a synthetic one using lookup_polymorphic_method.
@@ -345,8 +345,7 @@
vmIntrinsics::name_at(iid), klass->external_name(),
name->as_C_string(), full_signature->as_C_string());
}
- if (EnableInvokeDynamic &&
- klass() == SystemDictionary::MethodHandle_klass() &&
+ if (klass() == SystemDictionary::MethodHandle_klass() &&
iid != vmIntrinsics::_none) {
if (MethodHandles::is_signature_polymorphic_intrinsic(iid)) {
// Most of these do not need an up-call to Java to resolve, so can be done anywhere.
@@ -1543,7 +1542,6 @@
void LinkResolver::resolve_invokehandle(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
- assert(EnableInvokeDynamic, "");
// This guy is reached from InterpreterRuntime::resolve_invokehandle.
KlassHandle resolved_klass;
Symbol* method_name = NULL;
@@ -1575,8 +1573,6 @@
void LinkResolver::resolve_invokedynamic(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
- assert(EnableInvokeDynamic, "");
-
//resolve_pool(<resolved_klass>, method_name, method_signature, current_klass, pool, index, CHECK);
Symbol* method_name = pool->name_ref_at(index);
Symbol* method_signature = pool->signature_ref_at(index);
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@
// chunk.
TreeList<FreeChunk, ::AdaptiveFreeList<FreeChunk> >* curTL = this;
- if (surplus() <= 0) {
+ if (curTL->surplus() <= 0) {
/* Use the hint to find a size with a surplus, and reset the hint. */
TreeList<FreeChunk, ::AdaptiveFreeList<FreeChunk> >* hintTL = this;
while (hintTL->hint() != 0) {
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp Fri May 23 09:05:24 2014 -0700
@@ -200,6 +200,9 @@
_initial_gen0_size(0),
_max_gen0_size(0),
_gen_alignment(0),
+ _min_gen1_size(0),
+ _initial_gen1_size(0),
+ _max_gen1_size(0),
_generations(NULL)
{}
@@ -238,10 +241,6 @@
assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young gen and heap sizes");
assert(NewSize % _gen_alignment == 0, "NewSize alignment");
assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize % _gen_alignment == 0, "MaxNewSize alignment");
-}
-
-void TwoGenerationCollectorPolicy::assert_flags() {
- GenCollectorPolicy::assert_flags();
assert(OldSize + NewSize <= MaxHeapSize, "Ergonomics decided on incompatible generation and heap sizes");
assert(OldSize % _gen_alignment == 0, "OldSize alignment");
}
@@ -252,6 +251,7 @@
assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes");
assert(NewSize == _initial_gen0_size, "Discrepancy between NewSize flag and local storage");
assert(MaxNewSize == _max_gen0_size, "Discrepancy between MaxNewSize flag and local storage");
+ assert(OldSize == _initial_gen1_size, "Discrepancy between OldSize flag and local storage");
assert(_min_gen0_size <= _initial_gen0_size, "Ergonomics decided on incompatible minimum and initial young gen sizes");
assert(_initial_gen0_size <= _max_gen0_size, "Ergonomics decided on incompatible initial and maximum young gen sizes");
assert(_min_gen0_size % _gen_alignment == 0, "_min_gen0_size alignment");
@@ -263,11 +263,6 @@
"Ergonomics made initial young generation larger than initial heap");
assert(_max_gen0_size <= bound_minus_alignment(_max_gen0_size, _max_heap_byte_size),
"Ergonomics made maximum young generation lager than maximum heap");
-}
-
-void TwoGenerationCollectorPolicy::assert_size_info() {
- GenCollectorPolicy::assert_size_info();
- assert(OldSize == _initial_gen1_size, "Discrepancy between OldSize flag and local storage");
assert(_min_gen1_size <= _initial_gen1_size, "Ergonomics decided on incompatible minimum and initial old gen sizes");
assert(_initial_gen1_size <= _max_gen1_size, "Ergonomics decided on incompatible initial and maximum old gen sizes");
assert(_max_gen1_size % _gen_alignment == 0, "_max_gen1_size alignment");
@@ -369,12 +364,6 @@
vm_exit_during_initialization("Invalid young gen ratio specified");
}
- DEBUG_ONLY(GenCollectorPolicy::assert_flags();)
-}
-
-void TwoGenerationCollectorPolicy::initialize_flags() {
- GenCollectorPolicy::initialize_flags();
-
if (!is_size_aligned(OldSize, _gen_alignment)) {
// Setting OldSize directly to preserve information about the possible
// setting of OldSize on the command line.
@@ -433,7 +422,7 @@
always_do_update_barrier = UseConcMarkSweepGC;
- DEBUG_ONLY(TwoGenerationCollectorPolicy::assert_flags();)
+ DEBUG_ONLY(GenCollectorPolicy::assert_flags();)
}
// Values set on the command line win over any ergonomically
@@ -445,6 +434,13 @@
// themselves and with overall heap sizings.
// In the absence of explicitly set command line flags, policies
// such as the use of NewRatio are used to size the generation.
+
+// Minimum sizes of the generations may be different than
+// the initial sizes. An inconsistency is permitted here
+// in the total size that can be specified explicitly by
+// command line specification of OldSize and NewSize and
+// also a command line specification of -Xms. Issue a warning
+// but allow the values to pass.
void GenCollectorPolicy::initialize_size_info() {
CollectorPolicy::initialize_size_info();
@@ -520,19 +516,6 @@
_min_gen0_size, _initial_gen0_size, _max_gen0_size);
}
- DEBUG_ONLY(GenCollectorPolicy::assert_size_info();)
-}
-
-// Minimum sizes of the generations may be different than
-// the initial sizes. An inconsistency is permitted here
-// in the total size that can be specified explicitly by
-// command line specification of OldSize and NewSize and
-// also a command line specification of -Xms. Issue a warning
-// but allow the values to pass.
-
-void TwoGenerationCollectorPolicy::initialize_size_info() {
- GenCollectorPolicy::initialize_size_info();
-
// At this point the minimum, initial and maximum sizes
// of the overall heap and of gen0 have been determined.
// The maximum gen1 size can be determined from the maximum gen0
@@ -625,7 +608,7 @@
_min_gen1_size, _initial_gen1_size, _max_gen1_size);
}
- DEBUG_ONLY(TwoGenerationCollectorPolicy::assert_size_info();)
+ DEBUG_ONLY(GenCollectorPolicy::assert_size_info();)
}
HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size,
--- a/hotspot/src/share/vm/memory/collectorPolicy.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp Fri May 23 09:05:24 2014 -0700
@@ -47,7 +47,6 @@
// Forward declarations.
class GenCollectorPolicy;
-class TwoGenerationCollectorPolicy;
class AdaptiveSizePolicy;
#if INCLUDE_ALL_GCS
class ConcurrentMarkSweepPolicy;
@@ -114,7 +113,7 @@
enum Name {
CollectorPolicyKind,
- TwoGenerationCollectorPolicyKind,
+ GenCollectorPolicyKind,
ConcurrentMarkSweepPolicyKind,
ASConcurrentMarkSweepPolicyKind,
G1CollectorPolicyKind
@@ -135,7 +134,6 @@
// Identification methods.
virtual GenCollectorPolicy* as_generation_policy() { return NULL; }
- virtual TwoGenerationCollectorPolicy* as_two_generation_policy() { return NULL; }
virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; }
#if INCLUDE_ALL_GCS
virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; }
@@ -143,7 +141,6 @@
#endif // INCLUDE_ALL_GCS
// Note that these are not virtual.
bool is_generation_policy() { return as_generation_policy() != NULL; }
- bool is_two_generation_policy() { return as_two_generation_policy() != NULL; }
bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; }
#if INCLUDE_ALL_GCS
bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
@@ -225,6 +222,9 @@
size_t _min_gen0_size;
size_t _initial_gen0_size;
size_t _max_gen0_size;
+ size_t _min_gen1_size;
+ size_t _initial_gen1_size;
+ size_t _max_gen1_size;
// _gen_alignment and _space_alignment will have the same value most of the
// time. When using large pages they can differ.
@@ -264,8 +264,11 @@
size_t initial_gen0_size() { return _initial_gen0_size; }
size_t max_gen0_size() { return _max_gen0_size; }
size_t gen_alignment() { return _gen_alignment; }
+ size_t min_gen1_size() { return _min_gen1_size; }
+ size_t initial_gen1_size() { return _initial_gen1_size; }
+ size_t max_gen1_size() { return _max_gen1_size; }
- virtual int number_of_generations() = 0;
+ int number_of_generations() { return 2; }
virtual GenerationSpec **generations() {
assert(_generations != NULL, "Sanity check");
@@ -297,47 +300,15 @@
virtual void post_heap_initialize() {
assert(_max_gen0_size == MaxNewSize, "Should be taken care of by initialize_size_info");
}
-};
-// All of hotspot's current collectors are subtypes of this
-// class. Currently, these collectors all use the same gen[0],
-// but have different gen[1] types. If we add another subtype
-// of CollectorPolicy, this class should be broken out into
-// its own file.
-
-class TwoGenerationCollectorPolicy : public GenCollectorPolicy {
- protected:
- size_t _min_gen1_size;
- size_t _initial_gen1_size;
- size_t _max_gen1_size;
-
- void initialize_flags();
- void initialize_size_info();
-
- DEBUG_ONLY(void assert_flags();)
- DEBUG_ONLY(void assert_size_info();)
-
- public:
- TwoGenerationCollectorPolicy() : GenCollectorPolicy(), _min_gen1_size(0),
- _initial_gen1_size(0), _max_gen1_size(0) {}
-
- // Accessors
- size_t min_gen1_size() { return _min_gen1_size; }
- size_t initial_gen1_size() { return _initial_gen1_size; }
- size_t max_gen1_size() { return _max_gen1_size; }
-
- // Inherited methods
- TwoGenerationCollectorPolicy* as_two_generation_policy() { return this; }
-
- int number_of_generations() { return 2; }
BarrierSet::Name barrier_set_name() { return BarrierSet::CardTableModRef; }
virtual CollectorPolicy::Name kind() {
- return CollectorPolicy::TwoGenerationCollectorPolicyKind;
+ return CollectorPolicy::GenCollectorPolicyKind;
}
};
-class MarkSweepPolicy : public TwoGenerationCollectorPolicy {
+class MarkSweepPolicy : public GenCollectorPolicy {
protected:
void initialize_alignments();
void initialize_generations();
--- a/hotspot/src/share/vm/memory/gcLocker.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/memory/gcLocker.cpp Fri May 23 09:05:24 2014 -0700
@@ -26,6 +26,7 @@
#include "memory/gcLocker.inline.hpp"
#include "memory/resourceArea.hpp"
#include "memory/sharedHeap.hpp"
+#include "runtime/thread.inline.hpp"
volatile jint GC_locker::_jni_lock_count = 0;
volatile bool GC_locker::_needs_gc = false;
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp Fri May 23 09:05:24 2014 -0700
@@ -197,9 +197,8 @@
void GenCollectedHeap::post_initialize() {
SharedHeap::post_initialize();
- TwoGenerationCollectorPolicy *policy =
- (TwoGenerationCollectorPolicy *)collector_policy();
- guarantee(policy->is_two_generation_policy(), "Illegal policy type");
+ GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
+ guarantee(policy->is_generation_policy(), "Illegal policy type");
DefNewGeneration* def_new_gen = (DefNewGeneration*) get_gen(0);
assert(def_new_gen->kind() == Generation::DefNew ||
def_new_gen->kind() == Generation::ParNew ||
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp Fri May 23 09:05:24 2014 -0700
@@ -453,7 +453,7 @@
// Assumes a 2-generation system; the first disjunct remembers if an
// incremental collection failed, even when we thought (second disjunct)
// that it would not.
- assert(heap()->collector_policy()->is_two_generation_policy(),
+ assert(heap()->collector_policy()->is_generation_policy(),
"the following definition may not be suitable for an n(>2)-generation system");
return incremental_collection_failed() ||
(consult_young && !get_gen(0)->collection_attempt_is_safe());
--- a/hotspot/src/share/vm/memory/metaspace.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.cpp Fri May 23 09:05:24 2014 -0700
@@ -42,7 +42,7 @@
#include "runtime/init.hpp"
#include "runtime/java.hpp"
#include "runtime/mutex.hpp"
-#include "runtime/orderAccess.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "services/memTracker.hpp"
#include "services/memoryService.hpp"
#include "utilities/copy.hpp"
--- a/hotspot/src/share/vm/memory/space.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/memory/space.cpp Fri May 23 09:05:24 2014 -0700
@@ -37,6 +37,7 @@
#include "oops/oop.inline.hpp"
#include "oops/oop.inline2.hpp"
#include "runtime/java.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/safepoint.hpp"
#include "utilities/copy.hpp"
#include "utilities/globalDefinitions.hpp"
--- a/hotspot/src/share/vm/oops/constantPool.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/constantPool.cpp Fri May 23 09:05:24 2014 -0700
@@ -223,14 +223,14 @@
// The original attempt to resolve this constant pool entry failed so find the
- // original error and throw it again (JVMS 5.4.3).
+ // class of the original error and throw another error of the same class (JVMS 5.4.3).
+ // If there is a detail message, pass that detail message to the error constructor.
+ // The JVMS does not strictly require us to duplicate the same detail message,
+ // or any internal exception fields such as cause or stacktrace. But since the
+ // detail message is often a class name or other literal string, we will repeat it if
+ // we can find it in the symbol table.
if (in_error) {
- Symbol* error = SystemDictionary::find_resolution_error(this_cp, which);
- guarantee(error != (Symbol*)NULL, "tag mismatch with resolution error table");
- ResourceMark rm;
- // exception text will be the class name
- const char* className = this_cp->unresolved_klass_at(which)->as_C_string();
- THROW_MSG_0(error, className);
+ throw_resolution_error(this_cp, which, CHECK_0);
}
if (do_resolve) {
@@ -250,11 +250,6 @@
// Failed to resolve class. We must record the errors so that subsequent attempts
// to resolve this constant pool entry fail with the same error (JVMS 5.4.3).
if (HAS_PENDING_EXCEPTION) {
- ResourceMark rm;
- Symbol* error = PENDING_EXCEPTION->klass()->name();
-
- bool throw_orig_error = false;
- {
MonitorLockerEx ml(this_cp->lock());
// some other thread has beaten us and has resolved the class.
@@ -264,32 +259,9 @@
return entry.get_klass();
}
- if (!PENDING_EXCEPTION->
- is_a(SystemDictionary::LinkageError_klass())) {
- // Just throw the exception and don't prevent these classes from
- // being loaded due to virtual machine errors like StackOverflow
- // and OutOfMemoryError, etc, or if the thread was hit by stop()
- // Needs clarification to section 5.4.3 of the VM spec (see 6308271)
- }
- else if (!this_cp->tag_at(which).is_unresolved_klass_in_error()) {
- SystemDictionary::add_resolution_error(this_cp, which, error);
- this_cp->tag_at_put(which, JVM_CONSTANT_UnresolvedClassInError);
- } else {
- // some other thread has put the class in error state.
- error = SystemDictionary::find_resolution_error(this_cp, which);
- assert(error != NULL, "checking");
- throw_orig_error = true;
- }
- } // unlocked
-
- if (throw_orig_error) {
- CLEAR_PENDING_EXCEPTION;
- ResourceMark rm;
- const char* className = this_cp->unresolved_klass_at(which)->as_C_string();
- THROW_MSG_0(error, className);
- }
-
- return 0;
+ // The tag could have changed to in-error before the lock but we have to
+ // handle that here for the class case.
+ save_and_throw_exception(this_cp, which, constantTag(JVM_CONSTANT_UnresolvedClass), CHECK_0);
}
if (TraceClassResolution && !k()->oop_is_array()) {
@@ -587,16 +559,55 @@
return true;
}
-// If resolution for MethodHandle or MethodType fails, save the exception
+Symbol* ConstantPool::exception_message(constantPoolHandle this_cp, int which, constantTag tag, oop pending_exception) {
+ // Dig out the detailed message to reuse if possible
+ Symbol* message = NULL;
+ oop detailed_message = java_lang_Throwable::message(pending_exception);
+ if (detailed_message != NULL) {
+ message = java_lang_String::as_symbol_or_null(detailed_message);
+ if (message != NULL) {
+ return message;
+ }
+ }
+
+ // Return specific message for the tag
+ switch (tag.value()) {
+ case JVM_CONSTANT_UnresolvedClass:
+ // return the class name in the error message
+ message = this_cp->unresolved_klass_at(which);
+ break;
+ case JVM_CONSTANT_MethodHandle:
+ // return the method handle name in the error message
+ message = this_cp->method_handle_name_ref_at(which);
+ break;
+ case JVM_CONSTANT_MethodType:
+ // return the method type signature in the error message
+ message = this_cp->method_type_signature_at(which);
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+
+ return message;
+}
+
+void ConstantPool::throw_resolution_error(constantPoolHandle this_cp, int which, TRAPS) {
+ Symbol* message = NULL;
+ Symbol* error = SystemDictionary::find_resolution_error(this_cp, which, &message);
+ assert(error != NULL && message != NULL, "checking");
+ CLEAR_PENDING_EXCEPTION;
+ ResourceMark rm;
+ THROW_MSG(error, message->as_C_string());
+}
+
+// If resolution for Class, MethodHandle or MethodType fails, save the exception
// in the resolution error table, so that the same exception is thrown again.
void ConstantPool::save_and_throw_exception(constantPoolHandle this_cp, int which,
- int tag, TRAPS) {
- ResourceMark rm;
+ constantTag tag, TRAPS) {
+ assert(this_cp->lock()->is_locked(), "constant pool lock should be held");
Symbol* error = PENDING_EXCEPTION->klass()->name();
- MonitorLockerEx ml(this_cp->lock()); // lock cpool to change tag.
- int error_tag = (tag == JVM_CONSTANT_MethodHandle) ?
- JVM_CONSTANT_MethodHandleInError : JVM_CONSTANT_MethodTypeInError;
+ int error_tag = tag.error_value();
if (!PENDING_EXCEPTION->
is_a(SystemDictionary::LinkageError_klass())) {
@@ -604,20 +615,21 @@
// being loaded due to virtual machine errors like StackOverflow
// and OutOfMemoryError, etc, or if the thread was hit by stop()
// Needs clarification to section 5.4.3 of the VM spec (see 6308271)
-
} else if (this_cp->tag_at(which).value() != error_tag) {
- SystemDictionary::add_resolution_error(this_cp, which, error);
+ Symbol* message = exception_message(this_cp, which, tag, PENDING_EXCEPTION);
+ SystemDictionary::add_resolution_error(this_cp, which, error, message);
this_cp->tag_at_put(which, error_tag);
} else {
- // some other thread has put the class in error state.
- error = SystemDictionary::find_resolution_error(this_cp, which);
- assert(error != NULL, "checking");
- CLEAR_PENDING_EXCEPTION;
- THROW_MSG(error, "");
+ // some other thread put this in error state
+ throw_resolution_error(this_cp, which, CHECK);
}
+
+ // This exits with some pending exception
+ assert(HAS_PENDING_EXCEPTION, "should not be cleared");
}
+
// Called to resolve constants in the constant pool and return an oop.
// Some constant pool entries cache their resolved oop. This is also
// called to create oops from constants to use in arguments for invokedynamic
@@ -645,9 +657,9 @@
jvalue prim_value; // temp used only in a few cases below
- int tag_value = this_cp->tag_at(index).value();
+ constantTag tag = this_cp->tag_at(index);
- switch (tag_value) {
+ switch (tag.value()) {
case JVM_CONSTANT_UnresolvedClass:
case JVM_CONSTANT_UnresolvedClassInError:
@@ -672,10 +684,7 @@
case JVM_CONSTANT_MethodHandleInError:
case JVM_CONSTANT_MethodTypeInError:
{
- Symbol* error = SystemDictionary::find_resolution_error(this_cp, index);
- guarantee(error != (Symbol*)NULL, "tag mismatch with resolution error table");
- ResourceMark rm;
- THROW_MSG_0(error, "");
+ throw_resolution_error(this_cp, index, CHECK_NULL);
break;
}
@@ -699,7 +708,8 @@
THREAD);
result_oop = value();
if (HAS_PENDING_EXCEPTION) {
- save_and_throw_exception(this_cp, index, tag_value, CHECK_NULL);
+ MonitorLockerEx ml(this_cp->lock()); // lock cpool to change tag.
+ save_and_throw_exception(this_cp, index, tag, CHECK_NULL);
}
break;
}
@@ -715,7 +725,8 @@
Handle value = SystemDictionary::find_method_handle_type(signature, klass, THREAD);
result_oop = value();
if (HAS_PENDING_EXCEPTION) {
- save_and_throw_exception(this_cp, index, tag_value, CHECK_NULL);
+ MonitorLockerEx ml(this_cp->lock()); // lock cpool to change tag.
+ save_and_throw_exception(this_cp, index, tag, CHECK_NULL);
}
break;
}
@@ -746,7 +757,7 @@
default:
DEBUG_ONLY( tty->print_cr("*** %p: tag at CP[%d/%d] = %d",
- this_cp(), index, cache_index, tag_value) );
+ this_cp(), index, cache_index, tag.value()));
assert(false, "unexpected constant tag");
break;
}
@@ -1827,9 +1838,7 @@
// We can't do this during classfile parsing, which is how the other indexes are
// patched. The other patches are applied early for some error checking
// so only defer the pseudo_strings.
-void ConstantPool::patch_resolved_references(
- GrowableArray<Handle>* cp_patches) {
- assert(EnableInvokeDynamic, "");
+void ConstantPool::patch_resolved_references(GrowableArray<Handle>* cp_patches) {
for (int index = 1; index < cp_patches->length(); index++) { // Index 0 is unused
Handle patch = cp_patches->at(index);
if (patch.not_null()) {
--- a/hotspot/src/share/vm/oops/constantPool.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/constantPool.hpp Fri May 23 09:05:24 2014 -0700
@@ -413,9 +413,9 @@
// Version that can be used before string oop array is created.
oop uncached_string_at(int which, TRAPS);
- // A "pseudo-string" is an non-string oop that has found is way into
+ // A "pseudo-string" is an non-string oop that has found its way into
// a String entry.
- // Under EnableInvokeDynamic this can happen if the user patches a live
+ // This can happen if the user patches a live
// object into a CONSTANT_String entry of an anonymous class.
// Method oops internally created for method handles may also
// use pseudo-strings to link themselves to related metaobjects.
@@ -441,7 +441,6 @@
}
void pseudo_string_at_put(int which, int obj_index, oop x) {
- assert(EnableInvokeDynamic, "");
assert(tag_at(which).is_string(), "Corrupted constant pool");
unresolved_string_at_put(which, NULL); // indicates patched string
string_at_put(which, obj_index, x); // this works just fine
@@ -823,9 +822,13 @@
static void resolve_string_constants_impl(constantPoolHandle this_cp, TRAPS);
static oop resolve_constant_at_impl(constantPoolHandle this_cp, int index, int cache_index, TRAPS);
- static void save_and_throw_exception(constantPoolHandle this_cp, int which, int tag_value, TRAPS);
static oop resolve_bootstrap_specifier_at_impl(constantPoolHandle this_cp, int index, TRAPS);
+ // Exception handling
+ static void throw_resolution_error(constantPoolHandle this_cp, int which, TRAPS);
+ static Symbol* exception_message(constantPoolHandle this_cp, int which, constantTag tag, oop pending_exception);
+ static void save_and_throw_exception(constantPoolHandle this_cp, int which, constantTag tag, TRAPS);
+
public:
// Merging ConstantPool* support:
bool compare_entry_to(int index1, constantPoolHandle cp2, int index2, TRAPS);
--- a/hotspot/src/share/vm/oops/cpCache.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/cpCache.cpp Fri May 23 09:05:24 2014 -0700
@@ -33,6 +33,7 @@
#include "prims/jvmtiRedefineClassesTrace.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/handles.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
# include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
--- a/hotspot/src/share/vm/oops/cpCache.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/cpCache.hpp Fri May 23 09:05:24 2014 -0700
@@ -27,6 +27,7 @@
#include "interpreter/bytecodes.hpp"
#include "memory/allocation.hpp"
+#include "runtime/orderAccess.hpp"
#include "utilities/array.hpp"
class PSPromotionManager;
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Fri May 23 09:05:24 2014 -0700
@@ -55,6 +55,7 @@
#include "runtime/handles.inline.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/thread.inline.hpp"
#include "services/classLoadingService.hpp"
#include "services/threadService.hpp"
@@ -2398,7 +2399,6 @@
// If this is an anonymous class, append a hash to make the name unique
if (is_anonymous()) {
- assert(EnableInvokeDynamic, "EnableInvokeDynamic was not set.");
intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash);
hash_len = (int)strlen(hash_buf);
--- a/hotspot/src/share/vm/oops/klass.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/klass.cpp Fri May 23 09:05:24 2014 -0700
@@ -36,7 +36,8 @@
#include "oops/instanceKlass.hpp"
#include "oops/klass.inline.hpp"
#include "oops/oop.inline2.hpp"
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "trace/traceMacros.hpp"
#include "utilities/stack.hpp"
#include "utilities/macros.hpp"
@@ -544,7 +545,6 @@
if (oop_is_instance()) {
InstanceKlass* ik = (InstanceKlass*) this;
if (ik->is_anonymous()) {
- assert(EnableInvokeDynamic, "");
intptr_t hash = 0;
if (ik->java_mirror() != NULL) {
// java_mirror might not be created yet, return 0 as hash.
--- a/hotspot/src/share/vm/oops/klass.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/klass.hpp Fri May 23 09:05:24 2014 -0700
@@ -32,7 +32,6 @@
#include "oops/klassPS.hpp"
#include "oops/metadata.hpp"
#include "oops/oop.hpp"
-#include "runtime/orderAccess.hpp"
#include "trace/traceMacros.hpp"
#include "utilities/accessFlags.hpp"
#include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/oops/method.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/method.cpp Fri May 23 09:05:24 2014 -0700
@@ -49,6 +49,7 @@
#include "runtime/compilationPolicy.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/handles.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/relocator.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/signature.hpp"
--- a/hotspot/src/share/vm/oops/method.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/method.hpp Fri May 23 09:05:24 2014 -0700
@@ -661,7 +661,7 @@
// this operates only on invoke methods:
// presize interpreter frames for extra interpreter stack entries, if needed
// Account for the extra appendix argument for invokehandle/invokedynamic
- static int extra_stack_entries() { return EnableInvokeDynamic ? extra_stack_entries_for_jsr292 : 0; }
+ static int extra_stack_entries() { return extra_stack_entries_for_jsr292; }
static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize
// RedefineClasses() support:
--- a/hotspot/src/share/vm/oops/methodData.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodData.cpp Fri May 23 09:05:24 2014 -0700
@@ -34,6 +34,7 @@
#include "runtime/compilationPolicy.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/handles.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
// ==================================================================
// DataLayout
--- a/hotspot/src/share/vm/oops/objArrayKlass.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp Fri May 23 09:05:24 2014 -0700
@@ -42,6 +42,7 @@
#include "oops/symbol.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/mutexLocker.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "utilities/copy.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
--- a/hotspot/src/share/vm/oops/oop.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -38,7 +38,8 @@
#include "oops/klass.inline.hpp"
#include "oops/markOop.inline.hpp"
#include "oops/oop.hpp"
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
#include "utilities/macros.hpp"
#ifdef TARGET_ARCH_x86
--- a/hotspot/src/share/vm/oops/typeArrayKlass.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/typeArrayKlass.cpp Fri May 23 09:05:24 2014 -0700
@@ -39,6 +39,7 @@
#include "oops/typeArrayKlass.hpp"
#include "oops/typeArrayOop.hpp"
#include "runtime/handles.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "utilities/macros.hpp"
bool TypeArrayKlass::compute_is_subtype_of(Klass* k) {
--- a/hotspot/src/share/vm/oops/typeArrayOop.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/oops/typeArrayOop.hpp Fri May 23 09:05:24 2014 -0700
@@ -27,39 +27,7 @@
#include "oops/arrayOop.hpp"
#include "oops/typeArrayKlass.hpp"
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "orderAccess_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "orderAccess_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "orderAccess_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "orderAccess_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "orderAccess_solaris_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "orderAccess_windows_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "orderAccess_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "orderAccess_linux_ppc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "orderAccess_aix_ppc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "orderAccess_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "orderAccess_bsd_zero.inline.hpp"
-#endif
+#include "runtime/orderAccess.inline.hpp"
// A typeArrayOop is an array containing basic types (non oop elements).
// It is used for arrays of {characters, singles, doubles, bytes, shorts, integers, longs}
--- a/hotspot/src/share/vm/opto/compile.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/opto/compile.cpp Fri May 23 09:05:24 2014 -0700
@@ -704,6 +704,7 @@
#endif
set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining));
set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics"));
+ set_has_irreducible_loop(true); // conservative until build_loop_tree() reset it
if (ProfileTraps RTM_OPT_ONLY( || UseRTMLocking )) {
// Make sure the method being compiled gets its own MDO,
@@ -988,6 +989,8 @@
set_print_assembly(PrintFrameConverterAssembly);
set_parsed_irreducible_loop(false);
#endif
+ set_has_irreducible_loop(false); // no loops
+
CompileWrapper cw(this);
Init(/*AliasLevel=*/ 0);
init_tf((*generator)());
@@ -1158,7 +1161,7 @@
if( start->is_Start() )
return start->as_Start();
}
- ShouldNotReachHere();
+ fatal("Did not find Start node!");
return NULL;
}
--- a/hotspot/src/share/vm/opto/compile.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/opto/compile.hpp Fri May 23 09:05:24 2014 -0700
@@ -319,6 +319,7 @@
bool _trace_opto_output;
bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
#endif
+ bool _has_irreducible_loop; // Found irreducible loops
// JSR 292
bool _has_method_handle_invokes; // True if this method has MethodHandle invokes.
RTMState _rtm_state; // State of Restricted Transactional Memory usage
@@ -604,6 +605,8 @@
void set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; }
int _in_dump_cnt; // Required for dumping ir nodes.
#endif
+ bool has_irreducible_loop() const { return _has_irreducible_loop; }
+ void set_has_irreducible_loop(bool z) { _has_irreducible_loop = z; }
// JSR 292
bool has_method_handle_invokes() const { return _has_method_handle_invokes; }
--- a/hotspot/src/share/vm/opto/graphKit.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp Fri May 23 09:05:24 2014 -0700
@@ -1509,6 +1509,8 @@
Node* ld;
if (require_atomic_access && bt == T_LONG) {
ld = LoadLNode::make_atomic(C, ctl, mem, adr, adr_type, t, mo);
+ } else if (require_atomic_access && bt == T_DOUBLE) {
+ ld = LoadDNode::make_atomic(C, ctl, mem, adr, adr_type, t, mo);
} else {
ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt, mo);
}
@@ -1531,6 +1533,8 @@
Node* st;
if (require_atomic_access && bt == T_LONG) {
st = StoreLNode::make_atomic(C, ctl, mem, adr, adr_type, val, mo);
+ } else if (require_atomic_access && bt == T_DOUBLE) {
+ st = StoreDNode::make_atomic(C, ctl, mem, adr, adr_type, val, mo);
} else {
st = StoreNode::make(_gvn, ctl, mem, adr, adr_type, val, bt, mo);
}
--- a/hotspot/src/share/vm/opto/library_call.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp Fri May 23 09:05:24 2014 -0700
@@ -222,7 +222,7 @@
bool inline_math_subtractExactL(bool is_decrement);
bool inline_exp();
bool inline_pow();
- void finish_pow_exp(Node* result, Node* x, Node* y, const TypeFunc* call_type, address funcAddr, const char* funcName);
+ Node* finish_pow_exp(Node* result, Node* x, Node* y, const TypeFunc* call_type, address funcAddr, const char* funcName);
bool inline_min_max(vmIntrinsics::ID id);
Node* generate_min_max(vmIntrinsics::ID id, Node* x, Node* y);
// This returns Type::AnyPtr, RawPtr, or OopPtr.
@@ -1686,7 +1686,7 @@
return true;
}
-void LibraryCallKit::finish_pow_exp(Node* result, Node* x, Node* y, const TypeFunc* call_type, address funcAddr, const char* funcName) {
+Node* LibraryCallKit::finish_pow_exp(Node* result, Node* x, Node* y, const TypeFunc* call_type, address funcAddr, const char* funcName) {
//-------------------
//result=(result.isNaN())? funcAddr():result;
// Check: If isNaN() by checking result!=result? then either trap
@@ -1702,7 +1702,7 @@
uncommon_trap(Deoptimization::Reason_intrinsic,
Deoptimization::Action_make_not_entrant);
}
- set_result(result);
+ return result;
} else {
// If this inlining ever returned NaN in the past, we compile a call
// to the runtime to properly handle corner cases
@@ -1732,9 +1732,10 @@
result_region->init_req(2, control());
result_val->init_req(2, value);
- set_result(result_region, result_val);
+ set_control(_gvn.transform(result_region));
+ return _gvn.transform(result_val);
} else {
- set_result(result);
+ return result;
}
}
}
@@ -1746,7 +1747,8 @@
Node* arg = round_double_node(argument(0));
Node* n = _gvn.transform(new (C) ExpDNode(C, control(), arg));
- finish_pow_exp(n, arg, NULL, OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP");
+ n = finish_pow_exp(n, arg, NULL, OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP");
+ set_result(n);
C->set_has_split_ifs(true); // Has chance for split-if optimization
return true;
@@ -1756,27 +1758,48 @@
// Inline power instructions, if possible.
bool LibraryCallKit::inline_pow() {
// Pseudocode for pow
- // if (x <= 0.0) {
- // long longy = (long)y;
- // if ((double)longy == y) { // if y is long
- // if (y + 1 == y) longy = 0; // huge number: even
- // result = ((1&longy) == 0)?-DPow(abs(x), y):DPow(abs(x), y);
+ // if (y == 2) {
+ // return x * x;
+ // } else {
+ // if (x <= 0.0) {
+ // long longy = (long)y;
+ // if ((double)longy == y) { // if y is long
+ // if (y + 1 == y) longy = 0; // huge number: even
+ // result = ((1&longy) == 0)?-DPow(abs(x), y):DPow(abs(x), y);
+ // } else {
+ // result = NaN;
+ // }
// } else {
- // result = NaN;
+ // result = DPow(x,y);
// }
- // } else {
- // result = DPow(x,y);
+ // if (result != result)? {
+ // result = uncommon_trap() or runtime_call();
+ // }
+ // return result;
// }
- // if (result != result)? {
- // result = uncommon_trap() or runtime_call();
- // }
- // return result;
Node* x = round_double_node(argument(0));
Node* y = round_double_node(argument(2));
Node* result = NULL;
+ Node* const_two_node = makecon(TypeD::make(2.0));
+ Node* cmp_node = _gvn.transform(new (C) CmpDNode(y, const_two_node));
+ Node* bool_node = _gvn.transform(new (C) BoolNode(cmp_node, BoolTest::eq));
+ IfNode* if_node = create_and_xform_if(control(), bool_node, PROB_STATIC_INFREQUENT, COUNT_UNKNOWN);
+ Node* if_true = _gvn.transform(new (C) IfTrueNode(if_node));
+ Node* if_false = _gvn.transform(new (C) IfFalseNode(if_node));
+
+ RegionNode* region_node = new (C) RegionNode(3);
+ region_node->init_req(1, if_true);
+
+ Node* phi_node = new (C) PhiNode(region_node, Type::DOUBLE);
+ // special case for x^y where y == 2, we can convert it to x * x
+ phi_node->init_req(1, _gvn.transform(new (C) MulDNode(x, x)));
+
+ // set control to if_false since we will now process the false branch
+ set_control(if_false);
+
if (!too_many_traps(Deoptimization::Reason_intrinsic)) {
// Short form: skip the fancy tests and just check for NaN result.
result = _gvn.transform(new (C) PowDNode(C, control(), x, y));
@@ -1900,7 +1923,15 @@
result = _gvn.transform(phi);
}
- finish_pow_exp(result, x, y, OptoRuntime::Math_DD_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dpow), "POW");
+ result = finish_pow_exp(result, x, y, OptoRuntime::Math_DD_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dpow), "POW");
+
+ // control from finish_pow_exp is now input to the region node
+ region_node->set_req(2, control());
+ // the result from finish_pow_exp is now input to the phi node
+ phi_node->init_req(2, result);
+ set_control(_gvn.transform(region_node));
+ record_for_igvn(region_node);
+ set_result(_gvn.transform(phi_node));
C->set_has_split_ifs(true); // Has chance for split-if optimization
return true;
--- a/hotspot/src/share/vm/opto/loopnode.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/opto/loopnode.cpp Fri May 23 09:05:24 2014 -0700
@@ -267,9 +267,9 @@
// Counted loop head must be a good RegionNode with only 3 not NULL
// control input edges: Self, Entry, LoopBack.
- if (x->in(LoopNode::Self) == NULL || x->req() != 3)
+ if (x->in(LoopNode::Self) == NULL || x->req() != 3 || loop->_irreducible) {
return false;
-
+ }
Node *init_control = x->in(LoopNode::EntryControl);
Node *back_control = x->in(LoopNode::LoopBackControl);
if (init_control == NULL || back_control == NULL) // Partially dead
@@ -1523,11 +1523,11 @@
// If I have one hot backedge, peel off myself loop.
// I better be the outermost loop.
- if( _head->req() > 3 ) {
+ if (_head->req() > 3 && !_irreducible) {
split_outer_loop( phase );
result = true;
- } else if( !_head->is_Loop() && !_irreducible ) {
+ } else if (!_head->is_Loop() && !_irreducible) {
// Make a new LoopNode to replace the old loop head
Node *l = new (phase->C) LoopNode( _head->in(1), _head->in(2) );
l = igvn.register_new_node_with_optimizer(l, _head);
@@ -2939,6 +2939,7 @@
return pre_order;
}
}
+ C->set_has_irreducible_loop(_has_irreducible_loops);
}
// This Node might be a decision point for loops. It is only if
--- a/hotspot/src/share/vm/opto/memnode.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/opto/memnode.cpp Fri May 23 09:05:24 2014 -0700
@@ -308,33 +308,16 @@
int alias_idx = phase->C->get_alias_index(t_adr->is_ptr());
}
-#ifdef ASSERT
Node* base = NULL;
- if (address->is_AddP())
+ if (address->is_AddP()) {
base = address->in(AddPNode::Base);
+ }
if (base != NULL && phase->type(base)->higher_equal(TypePtr::NULL_PTR) &&
!t_adr->isa_rawptr()) {
// Note: raw address has TOP base and top->higher_equal(TypePtr::NULL_PTR) is true.
- Compile* C = phase->C;
- tty->cr();
- tty->print_cr("===== NULL+offs not RAW address =====");
- if (C->is_dead_node(this->_idx)) tty->print_cr("'this' is dead");
- if ((ctl != NULL) && C->is_dead_node(ctl->_idx)) tty->print_cr("'ctl' is dead");
- if (C->is_dead_node(mem->_idx)) tty->print_cr("'mem' is dead");
- if (C->is_dead_node(address->_idx)) tty->print_cr("'address' is dead");
- if (C->is_dead_node(base->_idx)) tty->print_cr("'base' is dead");
- tty->cr();
- base->dump(1);
- tty->cr();
- this->dump(2);
- tty->print("this->adr_type(): "); adr_type()->dump(); tty->cr();
- tty->print("phase->type(address): "); t_adr->dump(); tty->cr();
- tty->print("phase->type(base): "); phase->type(address)->dump(); tty->cr();
- tty->cr();
+ // Skip this node optimization if its address has TOP base.
+ return NodeSentinel; // caller will return NULL
}
- assert(base == NULL || t_adr->isa_rawptr() ||
- !phase->type(base)->higher_equal(TypePtr::NULL_PTR), "NULL+offs not RAW address?");
-#endif
// Avoid independent memory operations
Node* old_mem = mem;
@@ -955,6 +938,10 @@
return new (C) LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), mo, require_atomic);
}
+LoadDNode* LoadDNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt, MemOrd mo) {
+ bool require_atomic = true;
+ return new (C) LoadDNode(ctl, mem, adr, adr_type, rt, mo, require_atomic);
+}
@@ -2397,6 +2384,11 @@
return new (C) StoreLNode(ctl, mem, adr, adr_type, val, mo, require_atomic);
}
+StoreDNode* StoreDNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo) {
+ bool require_atomic = true;
+ return new (C) StoreDNode(ctl, mem, adr, adr_type, val, mo, require_atomic);
+}
+
//--------------------------bottom_type----------------------------------------
const Type *StoreNode::bottom_type() const {
--- a/hotspot/src/share/vm/opto/memnode.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/opto/memnode.hpp Fri May 23 09:05:24 2014 -0700
@@ -332,7 +332,7 @@
virtual uint ideal_reg() const { return Op_RegL; }
virtual int store_Opcode() const { return Op_StoreL; }
virtual BasicType memory_type() const { return T_LONG; }
- bool require_atomic_access() { return _require_atomic_access; }
+ bool require_atomic_access() const { return _require_atomic_access; }
static LoadLNode* make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type,
const Type* rt, MemOrd mo);
#ifndef PRODUCT
@@ -367,13 +367,31 @@
//------------------------------LoadDNode--------------------------------------
// Load a double (64 bits) from memory
class LoadDNode : public LoadNode {
+ virtual uint hash() const { return LoadNode::hash() + _require_atomic_access; }
+ virtual uint cmp( const Node &n ) const {
+ return _require_atomic_access == ((LoadDNode&)n)._require_atomic_access
+ && LoadNode::cmp(n);
+ }
+ virtual uint size_of() const { return sizeof(*this); }
+ const bool _require_atomic_access; // is piecewise load forbidden?
+
public:
- LoadDNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const Type *t, MemOrd mo)
- : LoadNode(c, mem, adr, at, t, mo) {}
+ LoadDNode(Node *c, Node *mem, Node *adr, const TypePtr* at, const Type *t,
+ MemOrd mo, bool require_atomic_access = false)
+ : LoadNode(c, mem, adr, at, t, mo), _require_atomic_access(require_atomic_access) {}
virtual int Opcode() const;
virtual uint ideal_reg() const { return Op_RegD; }
virtual int store_Opcode() const { return Op_StoreD; }
virtual BasicType memory_type() const { return T_DOUBLE; }
+ bool require_atomic_access() const { return _require_atomic_access; }
+ static LoadDNode* make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type,
+ const Type* rt, MemOrd mo);
+#ifndef PRODUCT
+ virtual void dump_spec(outputStream *st) const {
+ LoadNode::dump_spec(st);
+ if (_require_atomic_access) st->print(" Atomic!");
+ }
+#endif
};
//------------------------------LoadD_unalignedNode----------------------------
@@ -574,7 +592,7 @@
: StoreNode(c, mem, adr, at, val, mo), _require_atomic_access(require_atomic_access) {}
virtual int Opcode() const;
virtual BasicType memory_type() const { return T_LONG; }
- bool require_atomic_access() { return _require_atomic_access; }
+ bool require_atomic_access() const { return _require_atomic_access; }
static StoreLNode* make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo);
#ifndef PRODUCT
virtual void dump_spec(outputStream *st) const {
@@ -597,11 +615,28 @@
//------------------------------StoreDNode-------------------------------------
// Store double to memory
class StoreDNode : public StoreNode {
+ virtual uint hash() const { return StoreNode::hash() + _require_atomic_access; }
+ virtual uint cmp( const Node &n ) const {
+ return _require_atomic_access == ((StoreDNode&)n)._require_atomic_access
+ && StoreNode::cmp(n);
+ }
+ virtual uint size_of() const { return sizeof(*this); }
+ const bool _require_atomic_access; // is piecewise store forbidden?
public:
- StoreDNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val, MemOrd mo)
- : StoreNode(c, mem, adr, at, val, mo) {}
+ StoreDNode(Node *c, Node *mem, Node *adr, const TypePtr* at, Node *val,
+ MemOrd mo, bool require_atomic_access = false)
+ : StoreNode(c, mem, adr, at, val, mo), _require_atomic_access(require_atomic_access) {}
virtual int Opcode() const;
virtual BasicType memory_type() const { return T_DOUBLE; }
+ bool require_atomic_access() const { return _require_atomic_access; }
+ static StoreDNode* make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo);
+#ifndef PRODUCT
+ virtual void dump_spec(outputStream *st) const {
+ StoreNode::dump_spec(st);
+ if (_require_atomic_access) st->print(" Atomic!");
+ }
+#endif
+
};
//------------------------------StorePNode-------------------------------------
--- a/hotspot/src/share/vm/opto/node.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/opto/node.cpp Fri May 23 09:05:24 2014 -0700
@@ -27,6 +27,7 @@
#include "memory/allocation.inline.hpp"
#include "opto/cfgnode.hpp"
#include "opto/connode.hpp"
+#include "opto/loopnode.hpp"
#include "opto/machnode.hpp"
#include "opto/matcher.hpp"
#include "opto/node.hpp"
@@ -1263,6 +1264,7 @@
Node *top = igvn->C->top();
nstack.push(dead);
+ bool has_irreducible_loop = igvn->C->has_irreducible_loop();
while (nstack.size() > 0) {
dead = nstack.pop();
@@ -1277,13 +1279,31 @@
assert (!use->is_Con(), "Control for Con node should be Root node.");
use->set_req(0, top); // Cut dead edge to prevent processing
nstack.push(use); // the dead node again.
+ } else if (!has_irreducible_loop && // Backedge could be alive in irreducible loop
+ use->is_Loop() && !use->is_Root() && // Don't kill Root (RootNode extends LoopNode)
+ use->in(LoopNode::EntryControl) == dead) { // Dead loop if its entry is dead
+ use->set_req(LoopNode::EntryControl, top); // Cut dead edge to prevent processing
+ use->set_req(0, top); // Cut self edge
+ nstack.push(use);
} else { // Else found a not-dead user
+ // Dead if all inputs are top or null
+ bool dead_use = !use->is_Root(); // Keep empty graph alive
for (uint j = 1; j < use->req(); j++) {
- if (use->in(j) == dead) { // Turn all dead inputs into TOP
+ Node* in = use->in(j);
+ if (in == dead) { // Turn all dead inputs into TOP
use->set_req(j, top);
+ } else if (in != NULL && !in->is_top()) {
+ dead_use = false;
}
}
- igvn->_worklist.push(use);
+ if (dead_use) {
+ if (use->is_Region()) {
+ use->set_req(0, top); // Cut self edge
+ }
+ nstack.push(use);
+ } else {
+ igvn->_worklist.push(use);
+ }
}
// Refresh the iterator, since any number of kills might have happened.
k = dead->last_outs(kmin);
--- a/hotspot/src/share/vm/opto/runtime.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/opto/runtime.cpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -868,7 +868,7 @@
return TypeFunc::make(domain, range);
}
-// for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning void
+// for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning int
const TypeFunc* OptoRuntime::cipherBlockChaining_aescrypt_Type() {
// create input type (domain)
int num_args = 5;
--- a/hotspot/src/share/vm/precompiled/precompiled.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/precompiled/precompiled.hpp Fri May 23 09:05:24 2014 -0700
@@ -193,6 +193,7 @@
# include "runtime/mutexLocker.hpp"
# include "runtime/objectMonitor.hpp"
# include "runtime/orderAccess.hpp"
+# include "runtime/orderAccess.inline.hpp"
# include "runtime/os.hpp"
# include "runtime/osThread.hpp"
# include "runtime/perfData.hpp"
--- a/hotspot/src/share/vm/prims/forte.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/forte.cpp Fri May 23 09:05:24 2014 -0700
@@ -32,7 +32,7 @@
#include "oops/oop.inline2.hpp"
#include "prims/forte.hpp"
#include "runtime/javaCalls.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/thread.inline.hpp"
#include "runtime/vframe.hpp"
#include "runtime/vframeArray.hpp"
--- a/hotspot/src/share/vm/prims/jni.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/jni.cpp Fri May 23 09:05:24 2014 -0700
@@ -67,6 +67,7 @@
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jfieldIDWorkaround.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/reflection.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/signature.hpp"
--- a/hotspot/src/share/vm/prims/jniCheck.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp Fri May 23 09:05:24 2014 -0700
@@ -35,7 +35,7 @@
#include "runtime/handles.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/jfieldIDWorkaround.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/thread.inline.hpp"
#ifdef TARGET_ARCH_x86
# include "jniTypes_x86.hpp"
#endif
--- a/hotspot/src/share/vm/prims/jvm.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvm.cpp Fri May 23 09:05:24 2014 -0700
@@ -51,6 +51,7 @@
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jfieldIDWorkaround.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/perfData.hpp"
#include "runtime/reflection.hpp"
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Fri May 23 09:05:24 2014 -0700
@@ -851,7 +851,7 @@
"sanity check");
int cpci = Bytes::get_native_u2(bcp+1);
- bool is_invokedynamic = (EnableInvokeDynamic && code == Bytecodes::_invokedynamic);
+ bool is_invokedynamic = (code == Bytecodes::_invokedynamic);
ConstantPoolCacheEntry* entry;
if (is_invokedynamic) {
cpci = Bytes::get_native_u4(bcp+1);
--- a/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp Fri May 23 09:05:24 2014 -0700
@@ -41,6 +41,7 @@
#include "runtime/objectMonitor.hpp"
#include "runtime/objectMonitor.inline.hpp"
#include "runtime/signature.hpp"
+#include "runtime/thread.inline.hpp"
#include "runtime/vframe.hpp"
#include "runtime/vframe_hp.hpp"
#include "runtime/vmThread.hpp"
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp Fri May 23 09:05:24 2014 -0700
@@ -47,7 +47,7 @@
#include "runtime/interfaceSupport.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/objectMonitor.inline.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/thread.inline.hpp"
#include "runtime/vframe.hpp"
#include "services/attachListener.hpp"
#include "services/serviceUtil.hpp"
--- a/hotspot/src/share/vm/prims/jvmtiRawMonitor.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiRawMonitor.cpp Fri May 23 09:05:24 2014 -0700
@@ -25,7 +25,8 @@
#include "precompiled.hpp"
#include "prims/jvmtiRawMonitor.hpp"
#include "runtime/interfaceSupport.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/orderAccess.inline.hpp"
+#include "runtime/thread.inline.hpp"
GrowableArray<JvmtiRawMonitor*> *JvmtiPendingMonitors::_monitors = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JvmtiRawMonitor*>(1,true);
--- a/hotspot/src/share/vm/prims/jvmtiThreadState.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiThreadState.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -27,6 +27,7 @@
#include "prims/jvmtiEnvThreadState.hpp"
#include "prims/jvmtiThreadState.hpp"
+#include "runtime/thread.inline.hpp"
// JvmtiEnvThreadStateIterator implementation
--- a/hotspot/src/share/vm/prims/methodHandles.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp Fri May 23 09:05:24 2014 -0700
@@ -59,7 +59,7 @@
// MethodHandles::generate_adapters
//
void MethodHandles::generate_adapters() {
- if (!EnableInvokeDynamic || SystemDictionary::MethodHandle_klass() == NULL) return;
+ if (SystemDictionary::MethodHandle_klass() == NULL) return;
assert(_adapter_code == NULL, "generate only once");
@@ -98,7 +98,7 @@
void MethodHandles::set_enabled(bool z) {
if (_enabled != z) {
- guarantee(z && EnableInvokeDynamic, "can only enable once, and only if -XX:+EnableInvokeDynamic");
+ guarantee(z, "can only enable once");
_enabled = z;
}
}
@@ -1374,11 +1374,6 @@
* This one function is exported, used by NativeLookup.
*/
JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) {
- if (!EnableInvokeDynamic) {
- warning("JSR 292 is disabled in this JVM. Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable.");
- return; // bind nothing
- }
-
assert(!MethodHandles::enabled(), "must not be enabled");
bool enable_MH = true;
--- a/hotspot/src/share/vm/prims/unsafe.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/prims/unsafe.cpp Fri May 23 09:05:24 2014 -0700
@@ -33,6 +33,7 @@
#include "prims/jvm.h"
#include "runtime/globals.hpp"
#include "runtime/interfaceSupport.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/reflection.hpp"
#include "runtime/synchronizer.hpp"
#include "services/threadService.hpp"
@@ -1727,14 +1728,10 @@
}
// Unsafe.defineAnonymousClass
- if (EnableInvokeDynamic) {
- register_natives("1.7 define anonymous class method", env, unsafecls, anonk_methods, sizeof(anonk_methods)/sizeof(JNINativeMethod));
- }
+ register_natives("1.7 define anonymous class method", env, unsafecls, anonk_methods, sizeof(anonk_methods)/sizeof(JNINativeMethod));
// Unsafe.shouldBeInitialized
- if (EnableInvokeDynamic) {
- register_natives("1.7 LambdaForm support", env, unsafecls, lform_methods, sizeof(lform_methods)/sizeof(JNINativeMethod));
- }
+ register_natives("1.7 LambdaForm support", env, unsafecls, lform_methods, sizeof(lform_methods)/sizeof(JNINativeMethod));
// Fence methods
register_natives("1.8 fence methods", env, unsafecls, fence_methods, sizeof(fence_methods)/sizeof(JNINativeMethod));
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp Fri May 23 09:05:24 2014 -0700
@@ -449,7 +449,7 @@
if (should_create_mdo(mh(), level)) {
create_mdo(mh, thread);
}
- if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) {
+ if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
CompLevel next_level = call_event(mh(), level);
if (next_level != level) {
compile(mh, InvocationEntryBci, next_level, thread);
@@ -473,7 +473,7 @@
CompLevel next_osr_level = loop_event(imh(), level);
CompLevel max_osr_level = (CompLevel)imh->highest_osr_comp_level();
// At the very least compile the OSR version
- if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_osr_level != level) {
+ if (!CompileBroker::compilation_is_in_queue(imh) && (next_osr_level != level)) {
compile(imh, bci, next_osr_level, thread);
}
@@ -507,7 +507,7 @@
nm->make_not_entrant();
}
}
- if (!CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) {
+ if (!CompileBroker::compilation_is_in_queue(mh)) {
// Fix up next_level if necessary to avoid deopts
if (next_level == CompLevel_limited_profile && max_osr_level == CompLevel_full_profile) {
next_level = CompLevel_full_profile;
@@ -519,7 +519,7 @@
} else {
cur_level = comp_level(imh());
next_level = call_event(imh(), cur_level);
- if (!CompileBroker::compilation_is_in_queue(imh, bci) && next_level != cur_level) {
+ if (!CompileBroker::compilation_is_in_queue(imh) && (next_level != cur_level)) {
compile(imh, InvocationEntryBci, next_level, thread);
}
}
--- a/hotspot/src/share/vm/runtime/arguments.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Fri May 23 09:05:24 2014 -0700
@@ -2399,7 +2399,7 @@
status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize");
// TieredCompilation needs at least 2 compiler threads.
- const int num_min_compiler_threads = (TieredCompilation && (TieredStopAtLevel >= CompLevel_full_optimization)) ? 2 : 1;
+ const int num_min_compiler_threads = (TieredCompilation && (TieredStopAtLevel >= CompLevel_full_optimization)) ? 2 : CI_COMPILER_COUNT;
status &=verify_min_value(CICompilerCount, num_min_compiler_threads, "CICompilerCount");
if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
@@ -3638,19 +3638,9 @@
}
#endif // PRODUCT
- // JSR 292 is not supported before 1.7
- if (!JDK_Version::is_gte_jdk17x_version()) {
- if (EnableInvokeDynamic) {
- if (!FLAG_IS_DEFAULT(EnableInvokeDynamic)) {
- warning("JSR 292 is not supported before 1.7. Disabling support.");
- }
- EnableInvokeDynamic = false;
- }
- }
-
- if (EnableInvokeDynamic && ScavengeRootsInCode == 0) {
+ if (ScavengeRootsInCode == 0) {
if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
- warning("forcing ScavengeRootsInCode non-zero because EnableInvokeDynamic is true");
+ warning("forcing ScavengeRootsInCode non-zero");
}
ScavengeRootsInCode = 1;
}
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp Fri May 23 09:05:24 2014 -0700
@@ -38,6 +38,7 @@
#include "runtime/stubCodeGenerator.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/task.hpp"
+#include "runtime/thread.inline.hpp"
#include "runtime/vframe.hpp"
#include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/runtime/globals.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp Fri May 23 09:05:24 2014 -0700
@@ -3784,10 +3784,6 @@
NOT_LP64(LINUX_ONLY(2*G) NOT_LINUX(0)), \
"Address to allocate shared memory region for class data") \
\
- diagnostic(bool, EnableInvokeDynamic, true, \
- "support JSR 292 (method handles, invokedynamic, " \
- "anonymous classes") \
- \
diagnostic(bool, PrintMethodHandleStubs, false, \
"Print generated stub code for method handles") \
\
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp Fri May 23 09:05:24 2014 -0700
@@ -30,6 +30,7 @@
#include "memory/resourceArea.hpp"
#include "runtime/init.hpp"
#include "runtime/interfaceSupport.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/threadLocalStorage.hpp"
#include "runtime/vframe.hpp"
#include "utilities/preserveException.hpp"
--- a/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/javaFrameAnchor.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,39 +26,7 @@
#define SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP
#include "utilities/globalDefinitions.hpp"
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "orderAccess_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "orderAccess_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "orderAccess_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "orderAccess_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "orderAccess_solaris_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "orderAccess_windows_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "orderAccess_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "orderAccess_linux_ppc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "orderAccess_aix_ppc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "orderAccess_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "orderAccess_bsd_zero.inline.hpp"
-#endif
+#include "runtime/orderAccess.inline.hpp"
//
// An object for encapsulating the machine/os dependent part of a JavaThread frame state
--- a/hotspot/src/share/vm/runtime/mutex.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/mutex.cpp Fri May 23 09:05:24 2014 -0700
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "runtime/mutex.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/events.hpp"
--- a/hotspot/src/share/vm/runtime/objectMonitor.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp Fri May 23 09:05:24 2014 -0700
@@ -32,6 +32,7 @@
#include "runtime/mutexLocker.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/objectMonitor.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/runtime/orderAccess.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2014 SAP AG. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ *
+ */
+
+#ifndef SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP
+#define SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP
+
+#include "runtime/orderAccess.hpp"
+
+// Linux
+#ifdef TARGET_OS_ARCH_linux_x86
+# include "orderAccess_linux_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_linux_sparc
+# include "orderAccess_linux_sparc.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_linux_zero
+# include "orderAccess_linux_zero.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_linux_arm
+# include "orderAccess_linux_arm.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_linux_ppc
+# include "orderAccess_linux_ppc.inline.hpp"
+#endif
+
+// Solaris
+#ifdef TARGET_OS_ARCH_solaris_x86
+# include "orderAccess_solaris_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_solaris_sparc
+# include "orderAccess_solaris_sparc.inline.hpp"
+#endif
+
+// Windows
+#ifdef TARGET_OS_ARCH_windows_x86
+# include "orderAccess_windows_x86.inline.hpp"
+#endif
+
+// AIX
+#ifdef TARGET_OS_ARCH_aix_ppc
+# include "orderAccess_aix_ppc.inline.hpp"
+#endif
+
+// BSD
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "orderAccess_bsd_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "orderAccess_bsd_zero.inline.hpp"
+#endif
+
+#endif // SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP
--- a/hotspot/src/share/vm/runtime/perfMemory.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp Fri May 23 09:05:24 2014 -0700
@@ -28,6 +28,7 @@
#include "runtime/java.hpp"
#include "runtime/mutex.hpp"
#include "runtime/mutexLocker.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/perfData.hpp"
#include "runtime/perfMemory.hpp"
--- a/hotspot/src/share/vm/runtime/safepoint.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp Fri May 23 09:05:24 2014 -0700
@@ -41,6 +41,7 @@
#include "runtime/frame.inline.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/mutexLocker.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/signature.hpp"
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp Fri May 23 09:05:24 2014 -0700
@@ -2658,19 +2658,20 @@
JRT_END
#ifdef HAVE_DTRACE_H
-// Create a dtrace nmethod for this method. The wrapper converts the
-// java compiled calling convention to the native convention, makes a dummy call
-// (actually nops for the size of the call instruction, which become a trap if
-// probe is enabled). The returns to the caller. Since this all looks like a
-// leaf no thread transition is needed.
-
+/**
+ * Create a dtrace nmethod for this method. The wrapper converts the
+ * Java-compiled calling convention to the native convention, makes a dummy call
+ * (actually nops for the size of the call instruction, which become a trap if
+ * probe is enabled), and finally returns to the caller. Since this all looks like a
+ * leaf, no thread transition is needed.
+ */
nmethod *AdapterHandlerLibrary::create_dtrace_nmethod(methodHandle method) {
ResourceMark rm;
nmethod* nm = NULL;
if (PrintCompilation) {
ttyLocker ttyl;
- tty->print("--- n%s ");
+ tty->print("--- n ");
method->print_short_name(tty);
if (method->is_static()) {
tty->print(" (static)");
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp Fri May 23 09:05:24 2014 -0700
@@ -192,6 +192,10 @@
thread->is_interp_only_mode()) {
return NULL;
}
+ if (CompileTheWorld || ReplayCompiles) {
+ // Don't trigger other compiles in testing mode
+ return NULL;
+ }
nmethod *osr_nm = NULL;
handle_counter_overflow(method());
@@ -235,7 +239,7 @@
if (bci != InvocationEntryBci && mh->is_not_osr_compilable(level)) {
return;
}
- if (!CompileBroker::compilation_is_in_queue(mh, bci)) {
+ if (!CompileBroker::compilation_is_in_queue(mh)) {
if (PrintTieredEvents) {
print_event(COMPILE, mh, mh, bci, level);
}
@@ -374,7 +378,7 @@
// Handle the invocation event.
void SimpleThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh,
CompLevel level, nmethod* nm, JavaThread* thread) {
- if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, InvocationEntryBci)) {
+ if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
CompLevel next_level = call_event(mh(), level);
if (next_level != level) {
compile(mh, InvocationEntryBci, next_level, thread);
@@ -387,7 +391,7 @@
void SimpleThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh,
int bci, CompLevel level, nmethod* nm, JavaThread* thread) {
// If the method is already compiling, quickly bail out.
- if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh, bci)) {
+ if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
// Use loop event as an opportunity to also check there's been
// enough calls.
CompLevel cur_level = comp_level(mh());
--- a/hotspot/src/share/vm/runtime/sweeper.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp Fri May 23 09:05:24 2014 -0700
@@ -33,8 +33,10 @@
#include "runtime/atomic.hpp"
#include "runtime/compilationPolicy.hpp"
#include "runtime/mutexLocker.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/sweeper.hpp"
+#include "runtime/thread.inline.hpp"
#include "runtime/vm_operations.hpp"
#include "trace/tracing.hpp"
#include "utilities/events.hpp"
--- a/hotspot/src/share/vm/runtime/thread.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp Fri May 23 09:05:24 2014 -0700
@@ -58,6 +58,7 @@
#include "runtime/memprofiler.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/sharedRuntime.hpp"
@@ -1198,6 +1199,13 @@
va_end(ap);
}
+void NamedThread::print_on(outputStream* st) const {
+ st->print("\"%s\" ", name());
+ Thread::print_on(st);
+ st->cr();
+}
+
+
// ======= WatcherThread ========
// The watcher thread exists to simulate timer interrupts. It should
@@ -3602,9 +3610,7 @@
// It is done after compilers are initialized, because otherwise compilations of
// signature polymorphic MH intrinsics can be missed
// (see SystemDictionary::find_method_handle_intrinsic).
- if (EnableInvokeDynamic) {
- initialize_jsr292_core_classes(CHECK_JNI_ERR);
- }
+ initialize_jsr292_core_classes(CHECK_JNI_ERR);
#if INCLUDE_MANAGEMENT
Management::initialize(THREAD);
--- a/hotspot/src/share/vm/runtime/thread.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/thread.hpp Fri May 23 09:05:24 2014 -0700
@@ -436,18 +436,7 @@
jlong allocated_bytes() { return _allocated_bytes; }
void set_allocated_bytes(jlong value) { _allocated_bytes = value; }
void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
- jlong cooked_allocated_bytes() {
- jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
- if (UseTLAB) {
- size_t used_bytes = tlab().used_bytes();
- if ((ssize_t)used_bytes > 0) {
- // More-or-less valid tlab. The load_acquire above should ensure
- // that the result of the add is <= the instantaneous value
- return allocated_bytes + used_bytes;
- }
- }
- return allocated_bytes;
- }
+ inline jlong cooked_allocated_bytes();
TRACE_DATA* trace_data() { return &_trace_data; }
@@ -566,7 +555,7 @@
void set_lgrp_id(int value) { _lgrp_id = value; }
// Printing
- void print_on(outputStream* st) const;
+ virtual void print_on(outputStream* st) const;
void print() const { print_on(tty); }
virtual void print_on_error(outputStream* st, char* buf, int buflen) const;
@@ -700,6 +689,7 @@
virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; }
JavaThread *processed_thread() { return _processed_thread; }
void set_processed_thread(JavaThread *thread) { _processed_thread = thread; }
+ virtual void print_on(outputStream* st) const;
};
// Worker threads are named and have an id of an assigned work.
@@ -746,7 +736,6 @@
// Printing
char* name() const { return (char*)"VM Periodic Task Thread"; }
void print_on(outputStream* st) const;
- void print() const { print_on(tty); }
void unpark();
// Returns the single instance of WatcherThread
@@ -1046,12 +1035,8 @@
#else
// Use membars when accessing volatile _thread_state. See
// Threads::create_vm() for size checks.
- JavaThreadState thread_state() const {
- return (JavaThreadState) OrderAccess::load_acquire((volatile jint*)&_thread_state);
- }
- void set_thread_state(JavaThreadState s) {
- OrderAccess::release_store((volatile jint*)&_thread_state, (jint)s);
- }
+ inline JavaThreadState thread_state() const;
+ inline void set_thread_state(JavaThreadState s);
#endif
ThreadSafepointState *safepoint_state() const { return _safepoint_state; }
void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; }
@@ -1459,7 +1444,6 @@
// Misc. operations
char* name() const { return (char*)get_thread_name(); }
void print_on(outputStream* st) const;
- void print() const { print_on(tty); }
void print_value();
void print_thread_state_on(outputStream* ) const PRODUCT_RETURN;
void print_thread_state() const PRODUCT_RETURN;
@@ -1775,7 +1759,7 @@
// clearing/querying jni attach status
bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; }
bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; }
- void set_done_attaching_via_jni() { _jni_attach_state = _attached_via_jni; OrderAccess::fence(); }
+ inline void set_done_attaching_via_jni();
private:
// This field is used to determine if a thread has claimed
// a par_id: it is UINT_MAX if the thread has not claimed a par_id;
--- a/hotspot/src/share/vm/runtime/thread.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/thread.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -46,4 +46,32 @@
#undef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
+inline jlong Thread::cooked_allocated_bytes() {
+ jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
+ if (UseTLAB) {
+ size_t used_bytes = tlab().used_bytes();
+ if ((ssize_t)used_bytes > 0) {
+ // More-or-less valid tlab. The load_acquire above should ensure
+ // that the result of the add is <= the instantaneous value.
+ return allocated_bytes + used_bytes;
+ }
+ }
+ return allocated_bytes;
+}
+
+#ifdef PPC64
+inline JavaThreadState JavaThread::thread_state() const {
+ return (JavaThreadState) OrderAccess::load_acquire((volatile jint*)&_thread_state);
+}
+
+inline void JavaThread::set_thread_state(JavaThreadState s) {
+ OrderAccess::release_store((volatile jint*)&_thread_state, (jint)s);
+}
+#endif
+
+inline void JavaThread::set_done_attaching_via_jni() {
+ _jni_attach_state = _attached_via_jni;
+ OrderAccess::fence();
+}
+
#endif // SHARE_VM_RUNTIME_THREAD_INLINE_HPP
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Fri May 23 09:05:24 2014 -0700
@@ -878,7 +878,7 @@
nonstatic_field(nmethod, _entry_point, address) \
nonstatic_field(nmethod, _verified_entry_point, address) \
nonstatic_field(nmethod, _osr_entry_point, address) \
- nonstatic_field(nmethod, _lock_count, jint) \
+ volatile_nonstatic_field(nmethod, _lock_count, jint) \
nonstatic_field(nmethod, _stack_traversal_mark, long) \
nonstatic_field(nmethod, _compile_id, int) \
nonstatic_field(nmethod, _comp_level, int) \
--- a/hotspot/src/share/vm/runtime/vmThread.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp Fri May 23 09:05:24 2014 -0700
@@ -339,12 +339,6 @@
}
}
-void VMThread::print_on(outputStream* st) const {
- st->print("\"%s\" ", name());
- Thread::print_on(st);
- st->cr();
-}
-
void VMThread::evaluate_operation(VM_Operation* op) {
ResourceMark rm;
--- a/hotspot/src/share/vm/runtime/vmThread.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/runtime/vmThread.hpp Fri May 23 09:05:24 2014 -0700
@@ -128,9 +128,6 @@
// GC support
void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf);
- // Debugging
- void print_on(outputStream* st) const;
- void print() const { print_on(tty); }
void verify();
// Performance measurement
--- a/hotspot/src/share/vm/services/management.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/services/management.cpp Fri May 23 09:05:24 2014 -0700
@@ -39,6 +39,7 @@
#include "runtime/jniHandles.hpp"
#include "runtime/os.hpp"
#include "runtime/serviceThread.hpp"
+#include "runtime/thread.inline.hpp"
#include "services/classLoadingService.hpp"
#include "services/diagnosticCommand.hpp"
#include "services/diagnosticFramework.hpp"
--- a/hotspot/src/share/vm/services/memTracker.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/services/memTracker.cpp Fri May 23 09:05:24 2014 -0700
@@ -29,6 +29,7 @@
#include "runtime/mutexLocker.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/threadCritical.hpp"
+#include "runtime/thread.inline.hpp"
#include "runtime/vm_operations.hpp"
#include "services/memPtr.hpp"
#include "services/memReporter.hpp"
--- a/hotspot/src/share/vm/services/memoryManager.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/services/memoryManager.cpp Fri May 23 09:05:24 2014 -0700
@@ -28,6 +28,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/javaCalls.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "services/lowMemoryDetector.hpp"
#include "services/management.hpp"
#include "services/memoryManager.hpp"
--- a/hotspot/src/share/vm/services/memoryPool.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/services/memoryPool.cpp Fri May 23 09:05:24 2014 -0700
@@ -29,6 +29,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/javaCalls.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "services/lowMemoryDetector.hpp"
#include "services/management.hpp"
#include "services/memoryManager.hpp"
--- a/hotspot/src/share/vm/services/memoryService.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/services/memoryService.cpp Fri May 23 09:05:24 2014 -0700
@@ -123,12 +123,12 @@
void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) {
CollectorPolicy* policy = heap->collector_policy();
- assert(policy->is_two_generation_policy(), "Only support two generations");
+ assert(policy->is_generation_policy(), "Only support two generations");
guarantee(heap->n_gens() == 2, "Only support two-generation heap");
- TwoGenerationCollectorPolicy* two_gen_policy = policy->as_two_generation_policy();
- if (two_gen_policy != NULL) {
- GenerationSpec** specs = two_gen_policy->generations();
+ GenCollectorPolicy* gen_policy = policy->as_generation_policy();
+ if (gen_policy != NULL) {
+ GenerationSpec** specs = gen_policy->generations();
Generation::Name kind = specs[0]->name();
switch (kind) {
case Generation::DefNew:
--- a/hotspot/src/share/vm/services/threadService.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/services/threadService.cpp Fri May 23 09:05:24 2014 -0700
@@ -33,6 +33,7 @@
#include "runtime/init.hpp"
#include "runtime/thread.hpp"
#include "runtime/vframe.hpp"
+#include "runtime/thread.inline.hpp"
#include "runtime/vmThread.hpp"
#include "runtime/vm_operations.hpp"
#include "services/threadService.hpp"
--- a/hotspot/src/share/vm/utilities/array.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/utilities/array.hpp Fri May 23 09:05:24 2014 -0700
@@ -28,6 +28,7 @@
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/metaspace.hpp"
+#include "runtime/orderAccess.hpp"
// correct linkage required to compile w/o warnings
// (must be on file level - cannot be local)
--- a/hotspot/src/share/vm/utilities/constantTag.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/utilities/constantTag.cpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -76,6 +76,20 @@
}
+jbyte constantTag::error_value() const {
+ switch (_tag) {
+ case JVM_CONSTANT_UnresolvedClass:
+ return JVM_CONSTANT_UnresolvedClassInError;
+ case JVM_CONSTANT_MethodHandle:
+ return JVM_CONSTANT_MethodHandleInError;
+ case JVM_CONSTANT_MethodType:
+ return JVM_CONSTANT_MethodTypeInError;
+ default:
+ ShouldNotReachHere();
+ return JVM_CONSTANT_Invalid;
+ }
+}
+
const char* constantTag::internal_name() const {
switch (_tag) {
case JVM_CONSTANT_Invalid :
--- a/hotspot/src/share/vm/utilities/constantTag.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/utilities/constantTag.hpp Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -109,6 +109,7 @@
}
jbyte value() const { return _tag; }
+ jbyte error_value() const;
jbyte non_error_value() const;
BasicType basic_type() const; // if used with ldc, what kind of value gets pushed?
--- a/hotspot/src/share/vm/utilities/hashtable.inline.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/utilities/hashtable.inline.hpp Fri May 23 09:05:24 2014 -0700
@@ -26,6 +26,7 @@
#define SHARE_VM_UTILITIES_HASHTABLE_INLINE_HPP
#include "memory/allocation.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "utilities/hashtable.hpp"
#include "utilities/dtrace.hpp"
--- a/hotspot/src/share/vm/utilities/taskqueue.hpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp Fri May 23 09:05:24 2014 -0700
@@ -28,40 +28,8 @@
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/mutex.hpp"
+#include "runtime/orderAccess.inline.hpp"
#include "utilities/stack.hpp"
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "orderAccess_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "orderAccess_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "orderAccess_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "orderAccess_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "orderAccess_solaris_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "orderAccess_windows_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "orderAccess_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "orderAccess_linux_ppc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "orderAccess_aix_ppc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "orderAccess_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "orderAccess_bsd_zero.inline.hpp"
-#endif
// Simple TaskQueue stats that are collected by default in debug builds.
--- a/hotspot/src/share/vm/utilities/vmError.cpp Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/src/share/vm/utilities/vmError.cpp Fri May 23 09:05:24 2014 -0700
@@ -30,7 +30,7 @@
#include "runtime/frame.inline.hpp"
#include "runtime/init.hpp"
#include "runtime/os.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/thread.inline.hpp"
#include "runtime/vmThread.hpp"
#include "runtime/vm_operations.hpp"
#include "services/memTracker.hpp"
--- a/hotspot/test/compiler/5091921/Test7005594.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/5091921/Test7005594.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
/**
* @test
* @bug 7005594
+ * @ignore 7117034
* @summary Array overflow not handled correctly with loop optimzations
*
* @run shell Test7005594.sh
--- a/hotspot/test/compiler/7052494/Test7052494.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/7052494/Test7052494.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
/**
* @test
* @bug 7052494
+ * @ignore 7154567
* @summary Eclipse test fails on JDK 7 b142
*
* @run main/othervm -Xbatch Test7052494
--- a/hotspot/test/compiler/7184394/TestAESBase.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/7184394/TestAESBase.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,9 +40,20 @@
int msgSize = Integer.getInteger("msgSize", 646);
boolean checkOutput = Boolean.getBoolean("checkOutput");
boolean noReinit = Boolean.getBoolean("noReinit");
+ boolean testingMisalignment;
+ private static final int ALIGN = 8;
+ int encInputOffset = Integer.getInteger("encInputOffset", 0) % ALIGN;
+ int encOutputOffset = Integer.getInteger("encOutputOffset", 0) % ALIGN;
+ int decOutputOffset = Integer.getInteger("decOutputOffset", 0) % ALIGN;
+ int lastChunkSize = Integer.getInteger("lastChunkSize", 32);
int keySize = Integer.getInteger("keySize", 128);
+ int inputLength;
+ int encodeLength;
+ int decodeLength;
+ int decodeMsgSize;
String algorithm = System.getProperty("algorithm", "AES");
String mode = System.getProperty("mode", "CBC");
+ String paddingStr = System.getProperty("paddingStr", "PKCS5Padding");
byte[] input;
byte[] encode;
byte[] expectedEncode;
@@ -51,7 +62,6 @@
Random random = new Random(0);
Cipher cipher;
Cipher dCipher;
- String paddingStr = "PKCS5Padding";
AlgorithmParameters algParams;
SecretKey key;
@@ -67,7 +77,10 @@
public void prepare() {
try {
- System.out.println("\nalgorithm=" + algorithm + ", mode=" + mode + ", msgSize=" + msgSize + ", keySize=" + keySize + ", noReinit=" + noReinit + ", checkOutput=" + checkOutput);
+ System.out.println("\nalgorithm=" + algorithm + ", mode=" + mode + ", paddingStr=" + paddingStr + ", msgSize=" + msgSize + ", keySize=" + keySize + ", noReinit=" + noReinit + ", checkOutput=" + checkOutput + ", encInputOffset=" + encInputOffset + ", encOutputOffset=" + encOutputOffset + ", decOutputOffset=" + decOutputOffset + ", lastChunkSize=" +lastChunkSize );
+
+ if (encInputOffset % ALIGN != 0 || encOutputOffset % ALIGN != 0 || decOutputOffset % ALIGN !=0 )
+ testingMisalignment = true;
int keyLenBytes = (keySize == 0 ? 16 : keySize/8);
byte keyBytes[] = new byte[keyLenBytes];
@@ -81,10 +94,6 @@
System.out.println("Algorithm: " + key.getAlgorithm() + "("
+ key.getEncoded().length * 8 + "bit)");
}
- input = new byte[msgSize];
- for (int i=0; i<input.length; i++) {
- input[i] = (byte) (i & 0xff);
- }
cipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE");
dCipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE");
@@ -103,10 +112,35 @@
childShowCipher();
}
+ inputLength = msgSize + encInputOffset;
+ if (testingMisalignment) {
+ encodeLength = cipher.getOutputSize(msgSize - lastChunkSize) + encOutputOffset;
+ encodeLength += cipher.getOutputSize(lastChunkSize);
+ decodeLength = dCipher.getOutputSize(encodeLength - lastChunkSize) + decOutputOffset;
+ decodeLength += dCipher.getOutputSize(lastChunkSize);
+ } else {
+ encodeLength = cipher.getOutputSize(msgSize) + encOutputOffset;
+ decodeLength = dCipher.getOutputSize(encodeLength) + decOutputOffset;
+ }
+
+ input = new byte[inputLength];
+ for (int i=encInputOffset, j=0; i<inputLength; i++, j++) {
+ input[i] = (byte) (j & 0xff);
+ }
+
// do one encode and decode in preparation
- // this will also create the encode buffer and decode buffer
- encode = cipher.doFinal(input);
- decode = dCipher.doFinal(encode);
+ encode = new byte[encodeLength];
+ decode = new byte[decodeLength];
+ if (testingMisalignment) {
+ decodeMsgSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset);
+ decodeMsgSize += cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + decodeMsgSize));
+
+ int tempSize = dCipher.update(encode, encOutputOffset, (decodeMsgSize - lastChunkSize), decode, decOutputOffset);
+ dCipher.doFinal(encode, (encOutputOffset + decodeMsgSize - lastChunkSize), lastChunkSize, decode, (decOutputOffset + tempSize));
+ } else {
+ decodeMsgSize = cipher.doFinal(input, encInputOffset, msgSize, encode, encOutputOffset);
+ dCipher.doFinal(encode, encOutputOffset, decodeMsgSize, decode, decOutputOffset);
+ }
if (checkOutput) {
expectedEncode = (byte[]) encode.clone();
expectedDecode = (byte[]) decode.clone();
--- a/hotspot/test/compiler/7184394/TestAESDecode.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/7184394/TestAESDecode.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,14 +33,15 @@
public void run() {
try {
if (!noReinit) dCipher.init(Cipher.DECRYPT_MODE, key, algParams);
+ decode = new byte[decodeLength];
+ if (testingMisalignment) {
+ int tempSize = dCipher.update(encode, encOutputOffset, (decodeMsgSize - lastChunkSize), decode, decOutputOffset);
+ dCipher.doFinal(encode, (encOutputOffset + decodeMsgSize - lastChunkSize), lastChunkSize, decode, (decOutputOffset + tempSize));
+ } else {
+ dCipher.doFinal(encode, encOutputOffset, decodeMsgSize, decode, decOutputOffset);
+ }
if (checkOutput) {
- // checked version creates new output buffer each time
- decode = dCipher.doFinal(encode, 0, encode.length);
compareArrays(decode, expectedDecode);
- } else {
- // non-checked version outputs to existing encode buffer for maximum speed
- decode = new byte[dCipher.getOutputSize(encode.length)];
- dCipher.doFinal(encode, 0, encode.length, decode);
}
}
catch (Exception e) {
--- a/hotspot/test/compiler/7184394/TestAESEncode.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/7184394/TestAESEncode.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,14 +33,15 @@
public void run() {
try {
if (!noReinit) cipher.init(Cipher.ENCRYPT_MODE, key, algParams);
+ encode = new byte[encodeLength];
+ if (testingMisalignment) {
+ int tempSize = cipher.update(input, encInputOffset, (msgSize - lastChunkSize), encode, encOutputOffset);
+ cipher.doFinal(input, (encInputOffset + msgSize - lastChunkSize), lastChunkSize, encode, (encOutputOffset + tempSize));
+ } else {
+ cipher.doFinal(input, encInputOffset, msgSize, encode, encOutputOffset);
+ }
if (checkOutput) {
- // checked version creates new output buffer each time
- encode = cipher.doFinal(input, 0, msgSize);
compareArrays(encode, expectedEncode);
- } else {
- // non-checked version outputs to existing encode buffer for maximum speed
- encode = new byte[cipher.getOutputSize(msgSize)];
- cipher.doFinal(input, 0, msgSize, encode);
}
}
catch (Exception e) {
--- a/hotspot/test/compiler/7184394/TestAESMain.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/7184394/TestAESMain.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,19 @@
* @summary add intrinsics to use AES instructions
*
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencOutputOffset=1 TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DdecOutputOffset=1 TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain
* @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencOutputOffset=1 TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DdecOutputOffset=1 TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB -DencInputOffset=1 -DencOutputOffset=1 -DdecOutputOffset=1 -DpaddingStr=NoPadding -DmsgSize=640 TestAESMain
*
* @author Tom Deneau
*/
@@ -36,12 +48,13 @@
public class TestAESMain {
public static void main(String[] args) {
int iters = (args.length > 0 ? Integer.valueOf(args[0]) : 1000000);
+ int warmupIters = (args.length > 1 ? Integer.valueOf(args[1]) : 20000);
System.out.println(iters + " iterations");
TestAESEncode etest = new TestAESEncode();
etest.prepare();
- // warm-up for 20K iterations
+ // warm-up
System.out.println("Starting encryption warm-up");
- for (int i=0; i<20000; i++) {
+ for (int i=0; i<warmupIters; i++) {
etest.run();
}
System.out.println("Finished encryption warm-up");
@@ -54,9 +67,9 @@
TestAESDecode dtest = new TestAESDecode();
dtest.prepare();
- // warm-up for 20K iterations
+ // warm-up
System.out.println("Starting decryption warm-up");
- for (int i=0; i<20000; i++) {
+ for (int i=0; i<warmupIters; i++) {
dtest.run();
}
System.out.println("Finished decryption warm-up");
--- a/hotspot/test/compiler/ciReplay/TestVM.sh Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/ciReplay/TestVM.sh Fri May 23 09:05:24 2014 -0700
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
##
## @test
## @bug 8011675
+## @ignore 8032498
## @summary testing of ciReplay with using generated by VM replay.txt
## @author igor.ignatyev@oracle.com
## @run shell TestVM.sh
--- a/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh Fri May 23 09:05:24 2014 -0700
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
##
## @test
## @bug 8011675
+## @ignore 8032498
## @summary testing of ciReplay with using generated by VM replay.txt w/o comp_level
## @author igor.ignatyev@oracle.com
## @run shell TestVM_no_comp_level.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/floatingpoint/ModNaN.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8015396
+ * @summary double a%b returns NaN for some (a,b) (|a| < inf, |b|>0) (on Core i7 980X)
+ *
+ * @run main ModNaN
+ */
+public class ModNaN {
+ /* This bug was seen in the field for a particular version of the VM,
+ * but never reproduced internally, and the reason was never known,
+ * nor were the exact circumstances of the failure.
+ */
+ /*
+ * Failed on Windows 7/Core i7 980X/1.6.0_38 (64-bit):
+ *
+ * NaNs (i.e., when it fails, this is what we expect to see):
+ *
+ * 8.98846567431158E307 % 1.295163E-318 = NaN
+ * (0x7FE0000000000000L % 0x0000000000040000L)
+ *
+ * 1.7976931348623157E308 % 2.59032E-318 = NaN
+ * (0x7FEFFFFFFFFFFFFFL % 0x000000000007FFFFL)
+ *
+ * 1.7976931348623157E308 % 1.060997895E-314 = NaN
+ * (0x7FEFFFFFFFFFFFFFL % 0x000000007FFFFFFFL)
+ *
+ * 1.7976931348623157E308 % 6.767486E-317 = NaN
+ * (0x7FEFFFFFFFFFFFFFL % 0x0000000000d10208L)
+ *
+ * 1.7976931348623157E308 % 7.528725E-318 = NaN
+ * (0x7FEFFFFFFFFFFFFFL % 0x0000000000174077L)
+ *
+ * These cases did not fail, even when the previous five did:
+ * 8.98846567431158E307 % 1.29516E-318 = 2.53E-321
+ * (0x7fe0000000000000L % 0x000000000003ffffL)
+ *
+ * 1.7976931348623157E308 % 2.590327E-318 = 0.0
+ * (0x7fefffffffffffffL % 0x0000000000080000L)
+ *
+ * 1.7976931348623157E308 % 1.060965516E-314 = 9.35818525E-315
+ * (0x7fefffffffffffffL % 0x000000007ffeffffL)
+ *
+ */
+
+ static double[][] bad = new double[][] {
+ /*
+ * These hex numbers correspond to the base-10 doubles in the
+ * comment above; this can be checked by observing the output
+ * of testWithPrint.
+ */
+ new double[] { Double.longBitsToDouble(0x7FE0000000000000L),
+ Double.longBitsToDouble(0x0000000000040000L) },
+ new double[] { Double.longBitsToDouble(0x7FEFFFFFFFFFFFFFL),
+ Double.longBitsToDouble(0x000000000007FFFFL) },
+ new double[] { Double.longBitsToDouble(0x7FEFFFFFFFFFFFFFL),
+ Double.longBitsToDouble(0x000000007FFFFFFFL) },
+ new double[] { Double.longBitsToDouble(0x7FEFFFFFFFFFFFFFL),
+ 6.767486E-317 },
+ new double[] { Double.longBitsToDouble(0x7FEFFFFFFFFFFFFFL),
+ 7.528725E-318 }, };
+
+ static double[][] good = new double[][] {
+ new double[] { Double.longBitsToDouble(0x7FE0000000000000L),
+ Double.longBitsToDouble(0x000000000003FFFFL) },
+ new double[] { Double.longBitsToDouble(0x7FEFFFFFFFFFFFFFL),
+ Double.longBitsToDouble(0x0000000000080000L) },
+ new double[] { Double.longBitsToDouble(0x7FEFFFFFFFFFFFFFL),
+ Double.longBitsToDouble(0x000000007FFEFFFFL) }, };
+
+ public static void main(String[] args) throws InterruptedException {
+ int N = 10000;
+ testWithPrint();
+ for (int i = 0; i < N; i++)
+ testStrict();
+ for (int i = 0; i < N; i++)
+ test();
+ Thread.sleep(1000); // pause to let the compiler work
+ for (int i = 0; i < 10; i++)
+ testStrict();
+ for (int i = 0; i < 10; i++)
+ test();
+ }
+
+ public strictfp static void testWithPrint() {
+ for (double[] ab : bad) {
+ double a = ab[0];
+ double b = ab[1];
+ double mod = a % b;
+ System.out.println("" + a + "("+toHexRep(a)+") mod " +
+ b + "("+toHexRep(b)+") yields " +
+ mod + "("+toHexRep(mod)+")");
+ }
+
+ for (double[] ab : good) {
+ double a = ab[0];
+ double b = ab[1];
+ double mod = a % b;
+ System.out.println("" + a + "("+toHexRep(a)+") mod " +
+ b + "("+toHexRep(b)+") yields " +
+ mod + "("+toHexRep(mod)+")");
+ }
+ }
+
+ public strictfp static void testStrict() {
+ for (double[] ab : bad) {
+ double a = ab[0];
+ double b = ab[1];
+ double mod = a % b;
+ check(mod);
+ }
+
+ for (double[] ab : good) {
+ double a = ab[0];
+ double b = ab[1];
+ double mod = a % b;
+ check(mod);
+ }
+ }
+
+ public static void test() {
+ for (double[] ab : bad) {
+ double a = ab[0];
+ double b = ab[1];
+ double mod = a % b;
+ check(mod);
+ }
+
+ for (double[] ab : good) {
+ double a = ab[0];
+ double b = ab[1];
+ double mod = a % b;
+ check(mod);
+ }
+ }
+
+ static String toHexRep(double d) {
+ return "0x" + Long.toHexString(Double.doubleToRawLongBits(d)) + "L";
+ }
+
+ static void check(double mod) {
+ if (Double.isNaN(mod)) {
+ throw new Error("Saw a NaN, fail");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/profiling/TestMethodHandleInvokesIntrinsic.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8041458
+ * @summary profiling of arguments in C1 at MethodHandle invoke of intrinsic tries to profile popped argument.
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TieredStopAtLevel=3 TestMethodHandleInvokesIntrinsic
+ *
+ */
+
+import java.lang.invoke.*;
+
+public class TestMethodHandleInvokesIntrinsic {
+
+ static final MethodHandle mh_nanoTime;
+ static final MethodHandle mh_getClass;
+ static {
+ MethodHandles.Lookup lookup = MethodHandles.lookup();
+ MethodType mt = MethodType.methodType(long.class);
+ MethodHandle MH = null;
+ try {
+ MH = lookup.findStatic(System.class, "nanoTime", mt);
+ } catch(NoSuchMethodException nsme) {
+ nsme.printStackTrace();
+ throw new RuntimeException("TEST FAILED", nsme);
+ } catch(IllegalAccessException iae) {
+ iae.printStackTrace();
+ throw new RuntimeException("TEST FAILED", iae);
+ }
+ mh_nanoTime = MH;
+
+ mt = MethodType.methodType(Class.class);
+ MH = null;
+ try {
+ MH = lookup.findVirtual(Object.class, "getClass", mt);
+ } catch(NoSuchMethodException nsme) {
+ nsme.printStackTrace();
+ throw new RuntimeException("TEST FAILED", nsme);
+ } catch(IllegalAccessException iae) {
+ iae.printStackTrace();
+ throw new RuntimeException("TEST FAILED", iae);
+ }
+ mh_getClass = MH;
+ }
+
+ static long m1() throws Throwable {
+ return (long)mh_nanoTime.invokeExact();
+ }
+
+ static Class m2(Object o) throws Throwable {
+ return (Class)mh_getClass.invokeExact(o);
+ }
+
+ static public void main(String[] args) {
+ try {
+ for (int i = 0; i < 20000; i++) {
+ m1();
+ }
+ TestMethodHandleInvokesIntrinsic o = new TestMethodHandleInvokesIntrinsic();
+ for (int i = 0; i < 20000; i++) {
+ m2(o);
+ }
+ } catch(Throwable t) {
+ System.out.println("Unexpected exception");
+ t.printStackTrace();
+ throw new RuntimeException("TEST FAILED", t);
+ }
+
+ System.out.println("TEST PASSED");
+ }
+}
--- a/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java Fri May 23 09:05:24 2014 -0700
@@ -66,15 +66,6 @@
public class Agent implements ClassFileTransformer {
- static class MemoryChunk {
- MemoryChunk other;
- long[] array;
- MemoryChunk(MemoryChunk other) {
- other = other;
- array = new long[1024 * 1024 * 1024];
- }
- }
-
static public boolean m2(A a) {
boolean res = false;
if (a.getClass() == B.class) {
--- a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java Fri May 23 09:05:24 2014 -0700
@@ -30,7 +30,7 @@
* @build Agent
* @run main ClassFileInstaller Agent
* @run main Launcher
- * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -Xmx1M -XX:ReservedCodeCacheSize=3M Agent
+ * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222 -XX:ReservedCodeCacheSize=3M Agent
*/
public class Launcher {
public static void main(String[] args) throws Exception {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java Fri May 23 09:05:24 2014 -0700
@@ -27,7 +27,7 @@
* @bug 8031320
* @summary Verify UseRTMDeopt option processing on CPUs with rtm support
* when rtm locking is supported by VM.
- * @library /testlibrary /testlibrary/whitebox
+ * @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestUseRTMDeoptOptionOnSupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java Fri May 23 09:05:24 2014 -0700
@@ -27,7 +27,7 @@
* @bug 8031320
* @summary Verify UseRTMDeopt option processing on CPUs without rtm support
* or on VMs without rtm locking support.
- * @library /testlibrary /testlibrary/whitebox
+ * @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestUseRTMDeoptOptionOnUnsupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
--- a/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java Tue May 13 10:29:12 2014 -0700
+++ b/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java Fri May 23 09:05:24 2014 -0700
@@ -30,11 +30,28 @@
import com.oracle.java.testlibrary.*;
public class NumCompilerThreadsCheck {
+
public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:CICompilerCount=-1");
OutputAnalyzer out = new OutputAnalyzer(pb.start());
String expectedOutput = "CICompilerCount of -1 is invalid";
out.shouldContain(expectedOutput);
+
+ if (isZeroVm()) {
+ String expectedLowWaterMarkText = "must be at least 0";
+ out.shouldContain(expectedLowWaterMarkText);
+ }
+ }
+
+ private static boolean isZeroVm() {
+ String vmName = System.getProperty("java.vm.name");
+ if (vmName == null) {
+ throw new RuntimeException("No VM name");
+ }
+ if (vmName.toLowerCase().contains("zero")) {
+ return true;
+ }
+ return false;
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ClassResolutionFail/Property.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// Class PropertySuper is not found.
+
+public class Property extends PropertySuper {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ClassResolutionFail/PropertySuper.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// Class PropertySuper should be removed.
+
+public class PropertySuper {
+ PropertySuper() { System.out.println("remove me for NoClassDefFoundError"); }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ClassResolutionFail/TestClassResolutionFail.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 TestClassResolutionFail
+ * @bug 8023697
+ * @summary This tests that failed class resolution doesn't report different class name in detail message for the first and subsequent times
+ */
+
+import java.io.File;
+
+public class TestClassResolutionFail {
+ static String message;
+ public static void test1() throws RuntimeException {
+ try {
+ Property p = new Property();
+ } catch (LinkageError e) {
+ message = e.getMessage();
+ }
+ try {
+ Property p = new Property();
+ } catch (LinkageError e) {
+ System.out.println(e.getMessage());
+ if (!e.getMessage().equals(message)) {
+ throw new RuntimeException("Wrong message: " + message + " != " + e.getMessage());
+ }
+ }
+ }
+ public static void main(java.lang.String[] unused) throws Exception {
+ // Remove PropertySuper class
+ String testClasses = System.getProperty("test.classes", ".");
+ File f = new File(testClasses + File.separator + "PropertySuper.class");
+ f.delete();
+ test1();
+ }
+}
+
--- a/jaxp/.hgtags Tue May 13 10:29:12 2014 -0700
+++ b/jaxp/.hgtags Fri May 23 09:05:24 2014 -0700
@@ -255,3 +255,4 @@
4ce98701efe3b28f6ce3ab23385445731e968af7 jdk9-b10
6b4280dceb00642f54d5bc1c2cb7d34c99a04992 jdk9-b11
e88cecf5a21b760ff7d7761c2db6bb8c82bc9f0c jdk9-b12
+5eaf717f6e36037a6d3744ffeee0e4c88e64a0d2 jdk9-b13
--- a/jaxws/.hgtags Tue May 13 10:29:12 2014 -0700
+++ b/jaxws/.hgtags Fri May 23 09:05:24 2014 -0700
@@ -258,3 +258,4 @@
9af43f4d215f6f19b1767f6ac66da931b8ee9535 jdk9-b10
1f953ba7db2b535e19f0354abfee6d67605e0684 jdk9-b11
779f8b21c75f83e3918dac8499e4d0ecb3a54ed7 jdk9-b12
+3d42204854c9f703e3ccdc8891248e73057713ab jdk9-b13
--- a/jdk/.hgtags Tue May 13 10:29:12 2014 -0700
+++ b/jdk/.hgtags Fri May 23 09:05:24 2014 -0700
@@ -255,3 +255,5 @@
ab06ba2894313a47e4969ca37792ff119c49e711 jdk9-b10
47feccd164b7187a0147693a922ee47c6629643c jdk9-b11
83d9bc20973de232cae45b139fdff8a4549c130f jdk9-b12
+c7c8002d02721e02131d104549ebeb8b379fb8d2 jdk9-b13
+5c7a17a81afd0906b53ee31d95a3211c96ff6b25 jdk9-b14
--- a/jdk/make/data/tzdata/VERSION Tue May 13 10:29:12 2014 -0700
+++ b/jdk/make/data/tzdata/VERSION Fri May 23 09:05:24 2014 -0700
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-tzdata2014b
+tzdata2014c
--- a/jdk/make/data/tzdata/africa Tue May 13 10:29:12 2014 -0700
+++ b/jdk/make/data/tzdata/africa Fri May 23 09:05:24 2014 -0700
@@ -358,11 +358,54 @@
# http://www.worldtimezone.com/dst_news/dst_news_egypt02.html
# </a>
+# From Ahmad El-Dardiry (2014-05-07):
+# Egypt is to change back to Daylight system on May 15
+# http://english.ahram.org.eg/NewsContent/1/64/100735/Egypt/Politics-/Egypts-government-to-reapply-daylight-saving-time-.aspx
+
+# From Gunther Vermier (2015-05-13):
+# our Egypt office confirms that the change will be at 15 May "midnight" (24:00)
+
+# From Paul Eggert (2014-05-13):
+# Sarah El Deeb and Lee Keath of AP report that the Egyptian government says
+# the change is because of blackouts in Cairo, even though Ahram Online (cited
+# above) says DST had no affect on electricity consumption. The AP story says
+# DST will not be observed during Ramadan. There is no information about when
+# DST will end. See:
+# http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833
+#
+# For now, guess that later transitions will use 2010's rules, and that
+# Egypt will agree with Morocco (see below) about the date Ramadan starts and
+# ends, though (unlike Morocco) it will switch at 00:00 standard time. In
+# Egypt the spring-forward transitions are removed for 2020-2022, when the
+# guessed spring-forward date falls during the estimated Ramadan, and all
+# transitions removed for 2023-2038, where the estimated Ramadan falls entirely
+# outside the guessed daylight-saving time. Ramadan intrudes on the guessed
+# DST starting in 2039, but that's beyond our somewhat-arbitrary cutoff.
+
Rule Egypt 2008 only - Aug lastThu 23:00s 0 -
Rule Egypt 2009 only - Aug 20 23:00s 0 -
Rule Egypt 2010 only - Aug 11 0:00 0 -
Rule Egypt 2010 only - Sep 10 0:00 1:00 S
Rule Egypt 2010 only - Sep lastThu 23:00s 0 -
+Rule Egypt 2014 only - May 15 24:00 1:00 S
+Rule Egypt 2014 only - Jun 29 0:00s 0 -
+Rule Egypt 2014 only - Jul 29 0:00s 1:00 S
+Rule Egypt 2014 max - Sep lastThu 23:00s 0 -
+Rule Egypt 2015 2019 - Apr lastFri 0:00s 1:00 S
+Rule Egypt 2015 only - Jun 18 0:00s 0 -
+Rule Egypt 2015 only - Jul 18 0:00s 1:00 S
+Rule Egypt 2016 only - Jun 7 0:00s 0 -
+Rule Egypt 2016 only - Jul 7 0:00s 1:00 S
+Rule Egypt 2017 only - May 27 0:00s 0 -
+Rule Egypt 2017 only - Jun 26 0:00s 1:00 S
+Rule Egypt 2018 only - May 16 0:00s 0 -
+Rule Egypt 2018 only - Jun 15 0:00s 1:00 S
+Rule Egypt 2019 only - May 6 0:00s 0 -
+Rule Egypt 2019 only - Jun 5 0:00s 1:00 S
+Rule Egypt 2020 only - May 24 0:00s 1:00 S
+Rule Egypt 2021 only - May 13 0:00s 1:00 S
+Rule Egypt 2022 only - May 3 0:00s 1:00 S
+Rule Egypt 2023 max - Apr lastFri 0:00s 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Cairo 2:05:09 - LMT 1900 Oct
--- a/jdk/make/data/tzdata/asia Tue May 13 10:29:12 2014 -0700
+++ b/jdk/make/data/tzdata/asia Fri May 23 09:05:24 2014 -0700
@@ -1370,22 +1370,6 @@
# "Jordan will switch to winter time on Friday, October 27".
#
-# From Phil Pizzey (2009-04-02):
-# ...I think I may have spotted an error in the timezone data for
-# Jordan.
-# The current (2009d) asia file shows Jordan going to daylight
-# saving
-# time on the last Thursday in March.
-#
-# Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
-#
-# However timeanddate.com, which I usually find reliable, shows Jordan
-# going to daylight saving time on the last Friday in March since 2002.
-# Please see
-# <a href="http://www.timeanddate.com/worldclock/timezone.html?n=11">
-# http://www.timeanddate.com/worldclock/timezone.html?n=11
-# </a>
-
# From Steffen Thorsen (2009-04-02):
# This single one might be good enough, (2009-03-24, Arabic):
# <a href="http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279">
--- a/jdk/make/data/tzdata/europe Tue May 13 10:29:12 2014 -0700
+++ b/jdk/make/data/tzdata/europe Fri May 23 09:05:24 2014 -0700
@@ -2989,6 +2989,10 @@
# From Alexander Krivenyshev (2014-03-17):
# time change at 2:00 (2am) on March 30, 2014
# http://vz.ru/news/2014/3/17/677464.html
+# From Paul Eggert (2014-03-30):
+# Simferopol and Sevastopol reportedly changed their central town clocks
+# late the previous day, but this appears to have been ceremonial
+# and the discrepancies are small enough to not worry about.
2:00 EU EE%sT 2014 Mar 30 2:00
4:00 - MSK
--- a/jdk/make/mapfiles/libjava/mapfile-vers Tue May 13 10:29:12 2014 -0700
+++ b/jdk/make/mapfiles/libjava/mapfile-vers Fri May 23 09:05:24 2014 -0700
@@ -270,7 +270,10 @@
Java_sun_misc_Version_getJvmVersionInfo;
Java_sun_misc_Version_getJvmSpecialVersion;
Java_sun_misc_VM_latestUserDefinedLoader;
- Java_sun_misc_VM_isSetUID;
+ Java_sun_misc_VM_getuid;
+ Java_sun_misc_VM_geteuid;
+ Java_sun_misc_VM_getgid;
+ Java_sun_misc_VM_getegid;
Java_sun_misc_VM_initialize;
Java_sun_misc_VMSupport_initAgentProperties;
Java_sun_misc_VMSupport_getVMTemporaryDirectory;
--- a/jdk/make/profile-rtjar-includes.txt Tue May 13 10:29:12 2014 -0700
+++ b/jdk/make/profile-rtjar-includes.txt Fri May 23 09:05:24 2014 -0700
@@ -100,9 +100,7 @@
PROFILE_2_RTJAR_EXCLUDE_TYPES :=
-PROFILE_2_INCLUDE_METAINF_SERVICES := \
- META-INF/services/sun.util.spi.XmlPropertiesProvider
-
+PROFILE_2_INCLUDE_METAINF_SERVICES :=
PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
com/sun/jmx \
--- a/jdk/src/share/bin/java.c Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/bin/java.c Fri May 23 09:05:24 2014 -0700
@@ -739,6 +739,9 @@
if (s == NULL)
return;
s = JLI_WildcardExpandClasspath(s);
+ if (sizeof(format) - 2 + JLI_StrLen(s) < JLI_StrLen(s))
+ // s is became corrupted after expanding wildcards
+ return;
def = JLI_MemAlloc(sizeof(format)
- 2 /* strlen("%s") */
+ JLI_StrLen(s));
@@ -1358,9 +1361,11 @@
if (s) {
s = (char *) JLI_WildcardExpandClasspath(s);
/* 40 for -Denv.class.path= */
- envcp = (char *)JLI_MemAlloc(JLI_StrLen(s) + 40);
- sprintf(envcp, "-Denv.class.path=%s", s);
- AddOption(envcp, NULL);
+ if (JLI_StrLen(s) + 40 > JLI_StrLen(s)) { // Safeguard from overflow
+ envcp = (char *)JLI_MemAlloc(JLI_StrLen(s) + 40);
+ sprintf(envcp, "-Denv.class.path=%s", s);
+ AddOption(envcp, NULL);
+ }
}
}
--- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -459,10 +459,10 @@
// will be woken up before readTimeout only if reply is
// available
ldr.wait(readTimeout);
- waited = true;
} else {
ldr.wait(15 * 1000); // 15 second timeout
}
+ waited = true;
} else {
break;
}
--- a/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java Fri May 23 09:05:24 2014 -0700
@@ -44,12 +44,7 @@
public SocketAttachingConnector() {
super(new SocketTransportService());
- String defaultHostName;
- try {
- defaultHostName = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
- defaultHostName = "";
- }
+ String defaultHostName = "localhost";
addStringArgument(
ARG_HOST,
--- a/jdk/src/share/classes/com/sun/tools/jdi/SocketTransportService.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/SocketTransportService.java Fri May 23 09:05:24 2014 -0700
@@ -198,13 +198,17 @@
String host;
String portStr;
if (splitIndex < 0) {
- host = InetAddress.getLocalHost().getHostName();
+ host = "localhost";
portStr = address;
} else {
host = address.substring(0, splitIndex);
portStr = address.substring(splitIndex+1);
}
+ if (host.equals("*")) {
+ host = InetAddress.getLocalHost().getHostName();
+ }
+
int port;
try {
port = Integer.decode(portStr).intValue();
@@ -215,7 +219,6 @@
// open TCP connection to VM
-
InetSocketAddress sa = new InetSocketAddress(host, port);
Socket s = new Socket();
try {
--- a/jdk/src/share/classes/java/lang/ClassValue.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/java/lang/ClassValue.java Fri May 23 09:05:24 2014 -0700
@@ -25,7 +25,6 @@
package java.lang;
-import java.lang.ClassValue.ClassValueMap;
import java.util.WeakHashMap;
import java.lang.ref.WeakReference;
import java.util.concurrent.atomic.AtomicInteger;
@@ -375,10 +374,10 @@
synchronized (CRITICAL_SECTION) { // private object to avoid deadlocks
// happens about once per type
if ((map = type.classValueMap) == null)
- type.classValueMap = map = new ClassValueMap(type);
+ type.classValueMap = map = new ClassValueMap();
}
- return map;
- }
+ return map;
+ }
static <T> Entry<T> makeEntry(Version<T> explicitVersion, T value) {
// Note that explicitVersion might be different from this.version.
@@ -398,12 +397,11 @@
// The following class could also be top level and non-public:
- /** A backing map for all ClassValues, relative a single given type.
+ /** A backing map for all ClassValues.
* Gives a fully serialized "true state" for each pair (ClassValue cv, Class type).
* Also manages an unserialized fast-path cache.
*/
static class ClassValueMap extends WeakHashMap<ClassValue.Identity, Entry<?>> {
- private final Class<?> type;
private Entry<?>[] cacheArray;
private int cacheLoad, cacheLoadLimit;
@@ -413,11 +411,10 @@
*/
private static final int INITIAL_ENTRIES = 32;
- /** Build a backing map for ClassValues, relative the given type.
+ /** Build a backing map for ClassValues.
* Also, create an empty cache array and install it on the class.
*/
- ClassValueMap(Class<?> type) {
- this.type = type;
+ ClassValueMap() {
sizeCache(INITIAL_ENTRIES);
}
--- a/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/java/lang/ConditionalSpecialCasing.java Fri May 23 09:05:24 2014 -0700
@@ -62,6 +62,7 @@
//# Conditional mappings
//# ================================================================================
new Entry(0x03A3, new char[]{0x03C2}, new char[]{0x03A3}, null, FINAL_CASED), // # GREEK CAPITAL LETTER SIGMA
+ new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, null, 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
//# ================================================================================
//# Locale-sensitive mappings
@@ -77,8 +78,8 @@
//# ================================================================================
//# Turkish and Azeri
-// new Entry(0x0130, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
-// new Entry(0x0130, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
+ new Entry(0x0130, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
+ new Entry(0x0130, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
new Entry(0x0307, new char[]{}, new char[]{0x0307}, "tr", AFTER_I), // # COMBINING DOT ABOVE
new Entry(0x0307, new char[]{}, new char[]{0x0307}, "az", AFTER_I), // # COMBINING DOT ABOVE
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
@@ -147,21 +148,25 @@
private static char[] lookUpTable(String src, int index, Locale locale, boolean bLowerCasing) {
HashSet<Entry> set = entryTable.get(new Integer(src.codePointAt(index)));
+ char[] ret = null;
if (set != null) {
Iterator<Entry> iter = set.iterator();
String currentLang = locale.getLanguage();
while (iter.hasNext()) {
Entry entry = iter.next();
- String conditionLang= entry.getLanguage();
+ String conditionLang = entry.getLanguage();
if (((conditionLang == null) || (conditionLang.equals(currentLang))) &&
isConditionMet(src, index, locale, entry.getCondition())) {
- return (bLowerCasing ? entry.getLowerCase() : entry.getUpperCase());
+ ret = bLowerCasing ? entry.getLowerCase() : entry.getUpperCase();
+ if (conditionLang != null) {
+ break;
+ }
}
}
}
- return null;
+ return ret;
}
private static boolean isConditionMet(String src, int index, Locale locale, int condition) {
--- a/jdk/src/share/classes/java/lang/String.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/java/lang/String.java Fri May 23 09:05:24 2014 -0700
@@ -2583,6 +2583,9 @@
if (cp == '\u03A3') { // GREEK CAPITAL LETTER SIGMA
return toLowerCaseEx(result, i, locale, false);
}
+ if (cp == '\u0130') { // LATIN CAPITAL LETTER I WITH DOT ABOVE
+ return toLowerCaseEx(result, i, locale, true);
+ }
cp = Character.toLowerCase(cp);
if (!Character.isBmpCodePoint(cp)) {
return toLowerCaseEx(result, i, locale, false);
--- a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java Fri May 23 09:05:24 2014 -0700
@@ -54,7 +54,7 @@
*
* @implNote This implementation is not thread safe. However, it is safe to use
* {@link java.util.stream.Collectors#summarizingDouble(java.util.function.ToDoubleFunction)
- * Collectors.toDoubleStatistics()} on a parallel stream, because the parallel
+ * Collectors.summarizingDouble()} on a parallel stream, because the parallel
* implementation of {@link java.util.stream.Stream#collect Stream.collect()}
* provides the necessary partitioning, isolation, and merging of results for
* safe and efficient parallel execution.
--- a/jdk/src/share/classes/java/util/IntSummaryStatistics.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/java/util/IntSummaryStatistics.java Fri May 23 09:05:24 2014 -0700
@@ -54,7 +54,7 @@
*
* @implNote This implementation is not thread safe. However, it is safe to use
* {@link java.util.stream.Collectors#summarizingInt(java.util.function.ToIntFunction)
- * Collectors.toIntStatistics()} on a parallel stream, because the parallel
+ * Collectors.summarizingInt()} on a parallel stream, because the parallel
* implementation of {@link java.util.stream.Stream#collect Stream.collect()}
* provides the necessary partitioning, isolation, and merging of results for
* safe and efficient parallel execution.
--- a/jdk/src/share/classes/java/util/LongSummaryStatistics.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/java/util/LongSummaryStatistics.java Fri May 23 09:05:24 2014 -0700
@@ -42,7 +42,7 @@
* }</pre>
*
* <p>{@code LongSummaryStatistics} can be used as a
- * {@linkplain java.util.stream.Stream#collect(Collector)} reduction}
+ * {@linkplain java.util.stream.Stream#collect(Collector) reduction}
* target for a {@linkplain java.util.stream.Stream stream}. For example:
*
* <pre> {@code
@@ -55,7 +55,7 @@
*
* @implNote This implementation is not thread safe. However, it is safe to use
* {@link java.util.stream.Collectors#summarizingLong(java.util.function.ToLongFunction)
- * Collectors.toLongStatistics()} on a parallel stream, because the parallel
+ * Collectors.summarizingLong()} on a parallel stream, because the parallel
* implementation of {@link java.util.stream.Stream#collect Stream.collect()}
* provides the necessary partitioning, isolation, and merging of results for
* safe and efficient parallel execution.
--- a/jdk/src/share/classes/java/util/Properties.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/java/util/Properties.java Fri May 23 09:05:24 2014 -0700
@@ -37,7 +37,7 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
-import sun.util.spi.XmlPropertiesProvider;
+import jdk.internal.util.xml.PropertiesDefaultHandler;
/**
* The {@code Properties} class represents a persistent set of
@@ -877,7 +877,9 @@
public synchronized void loadFromXML(InputStream in)
throws IOException, InvalidPropertiesFormatException
{
- XmlSupport.load(this, Objects.requireNonNull(in));
+ Objects.requireNonNull(in);
+ PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
+ handler.load(this, in);
in.close();
}
@@ -949,8 +951,10 @@
public void storeToXML(OutputStream os, String comment, String encoding)
throws IOException
{
- XmlSupport.save(this, Objects.requireNonNull(os), comment,
- Objects.requireNonNull(encoding));
+ Objects.requireNonNull(os);
+ Objects.requireNonNull(encoding);
+ PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
+ handler.store(this, os, comment, encoding);
}
/**
@@ -1128,83 +1132,4 @@
private static final char[] hexDigit = {
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
};
-
- /**
- * Supporting class for loading/storing properties in XML format.
- *
- * <p> The {@code load} and {@code store} methods defined here delegate to a
- * system-wide {@code XmlPropertiesProvider}. On first invocation of either
- * method then the system-wide provider is located as follows: </p>
- *
- * <ol>
- * <li> If the system property {@code sun.util.spi.XmlPropertiesProvider}
- * is defined then it is taken to be the full-qualified name of a concrete
- * provider class. The class is loaded with the system class loader as the
- * initiating loader. If it cannot be loaded or instantiated using a zero
- * argument constructor then an unspecified error is thrown. </li>
- *
- * <li> If the system property is not defined then the service-provider
- * loading facility defined by the {@link ServiceLoader} class is used to
- * locate a provider with the system class loader as the initiating
- * loader and {@code sun.util.spi.XmlPropertiesProvider} as the service
- * type. If this process fails then an unspecified error is thrown. If
- * there is more than one service provider installed then it is
- * not specified as to which provider will be used. </li>
- *
- * <li> If the provider is not found by the above means then a system
- * default provider will be instantiated and used. </li>
- * </ol>
- */
- private static class XmlSupport {
-
- private static XmlPropertiesProvider loadProviderFromProperty(ClassLoader cl) {
- String cn = System.getProperty("sun.util.spi.XmlPropertiesProvider");
- if (cn == null)
- return null;
- try {
- Class<?> c = Class.forName(cn, true, cl);
- return (XmlPropertiesProvider)c.newInstance();
- } catch (ClassNotFoundException |
- IllegalAccessException |
- InstantiationException x) {
- throw new ServiceConfigurationError(null, x);
- }
- }
-
- private static XmlPropertiesProvider loadProviderAsService(ClassLoader cl) {
- Iterator<XmlPropertiesProvider> iterator =
- ServiceLoader.load(XmlPropertiesProvider.class, cl).iterator();
- return iterator.hasNext() ? iterator.next() : null;
- }
-
- private static XmlPropertiesProvider loadProvider() {
- return AccessController.doPrivileged(
- new PrivilegedAction<XmlPropertiesProvider>() {
- public XmlPropertiesProvider run() {
- ClassLoader cl = ClassLoader.getSystemClassLoader();
- XmlPropertiesProvider provider = loadProviderFromProperty(cl);
- if (provider != null)
- return provider;
- provider = loadProviderAsService(cl);
- if (provider != null)
- return provider;
- return new jdk.internal.util.xml.BasicXmlPropertiesProvider();
- }});
- }
-
- private static final XmlPropertiesProvider PROVIDER = loadProvider();
-
- static void load(Properties props, InputStream in)
- throws IOException, InvalidPropertiesFormatException
- {
- PROVIDER.load(props, in);
- }
-
- static void save(Properties props, OutputStream os, String comment,
- String encoding)
- throws IOException
- {
- PROVIDER.store(props, os, comment, encoding);
- }
- }
}
--- a/jdk/src/share/classes/java/util/TimeZone.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/java/util/TimeZone.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -591,8 +591,7 @@
/**
* Gets the platform defined TimeZone ID.
**/
- private static native String getSystemTimeZoneID(String javaHome,
- String country);
+ private static native String getSystemTimeZoneID(String javaHome);
/**
* Gets the custom time zone ID based on the GMT offset of the
@@ -650,12 +649,10 @@
// if the time zone ID is not set (yet), perform the
// platform to Java time zone ID mapping.
if (zoneID == null || zoneID.isEmpty()) {
- String country = AccessController.doPrivileged(
- new GetPropertyAction("user.country"));
String javaHome = AccessController.doPrivileged(
new GetPropertyAction("java.home"));
try {
- zoneID = getSystemTimeZoneID(javaHome, country);
+ zoneID = getSystemTimeZoneID(javaHome);
if (zoneID == null) {
zoneID = GMT_ID;
}
--- a/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/ThreadPoolExecutor.java Fri May 23 09:05:24 2014 -0700
@@ -1532,10 +1532,12 @@
*
* @param corePoolSize the new core size
* @throws IllegalArgumentException if {@code corePoolSize < 0}
+ * or {@code corePoolSize} is greater than the {@linkplain
+ * #getMaximumPoolSize() maximum pool size}
* @see #getCorePoolSize
*/
public void setCorePoolSize(int corePoolSize) {
- if (corePoolSize < 0)
+ if (corePoolSize < 0 || maximumPoolSize < corePoolSize)
throw new IllegalArgumentException();
int delta = corePoolSize - this.corePoolSize;
this.corePoolSize = corePoolSize;
--- a/jdk/src/share/classes/javax/crypto/JceSecurity.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/crypto/JceSecurity.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -216,26 +216,28 @@
new WeakHashMap<>();
/*
- * Retuns the CodeBase for the given class.
+ * Returns the CodeBase for the given class.
*/
static URL getCodeBase(final Class<?> clazz) {
- URL url = codeBaseCacheRef.get(clazz);
- if (url == null) {
- url = AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- ProtectionDomain pd = clazz.getProtectionDomain();
- if (pd != null) {
- CodeSource cs = pd.getCodeSource();
- if (cs != null) {
- return cs.getLocation();
+ synchronized (codeBaseCacheRef) {
+ URL url = codeBaseCacheRef.get(clazz);
+ if (url == null) {
+ url = AccessController.doPrivileged(new PrivilegedAction<URL>() {
+ public URL run() {
+ ProtectionDomain pd = clazz.getProtectionDomain();
+ if (pd != null) {
+ CodeSource cs = pd.getCodeSource();
+ if (cs != null) {
+ return cs.getLocation();
+ }
}
+ return NULL_URL;
}
- return NULL_URL;
- }
- });
- codeBaseCacheRef.put(clazz, url);
+ });
+ codeBaseCacheRef.put(clazz, url);
+ }
+ return (url == NULL_URL) ? null : url;
}
- return (url == NULL_URL) ? null : url;
}
private static void setupJurisdictionPolicies() throws Exception {
--- a/jdk/src/share/classes/javax/swing/border/BevelBorder.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/border/BevelBorder.java Fri May 23 09:05:24 2014 -0700
@@ -134,7 +134,9 @@
* when rendered on the specified component. If no highlight
* color was specified at instantiation, the highlight color
* is derived from the specified component's background color.
+ *
* @param c the component for which the highlight may be derived
+ * @return the outer highlight {@code Color}
* @since 1.3
*/
public Color getHighlightOuterColor(Component c) {
@@ -148,7 +150,9 @@
* when rendered on the specified component. If no highlight
* color was specified at instantiation, the highlight color
* is derived from the specified component's background color.
+ *
* @param c the component for which the highlight may be derived
+ * @return the inner highlight {@code Color}
* @since 1.3
*/
public Color getHighlightInnerColor(Component c) {
@@ -162,7 +166,9 @@
* when rendered on the specified component. If no shadow
* color was specified at instantiation, the shadow color
* is derived from the specified component's background color.
+ *
* @param c the component for which the shadow may be derived
+ * @return the inner shadow {@code Color}
* @since 1.3
*/
public Color getShadowInnerColor(Component c) {
@@ -176,7 +182,9 @@
* when rendered on the specified component. If no shadow
* color was specified at instantiation, the shadow color
* is derived from the specified component's background color.
+ *
* @param c the component for which the shadow may be derived
+ * @return the outer shadow {@code Color}
* @since 1.3
*/
public Color getShadowOuterColor(Component c) {
@@ -189,6 +197,9 @@
* Returns the outer highlight color of the bevel border.
* Will return null if no highlight color was specified
* at instantiation.
+ *
+ * @return the outer highlight {@code Color} or {@code null} if no highlight
+ * color was specified
* @since 1.3
*/
public Color getHighlightOuterColor() {
@@ -199,6 +210,9 @@
* Returns the inner highlight color of the bevel border.
* Will return null if no highlight color was specified
* at instantiation.
+ *
+ * @return the inner highlight {@code Color} or {@code null} if no highlight
+ * color was specified
* @since 1.3
*/
public Color getHighlightInnerColor() {
@@ -209,6 +223,9 @@
* Returns the inner shadow color of the bevel border.
* Will return null if no shadow color was specified
* at instantiation.
+ *
+ * @return the inner shadow {@code Color} or {@code null} if no shadow color
+ * was specified
* @since 1.3
*/
public Color getShadowInnerColor() {
@@ -219,6 +236,9 @@
* Returns the outer shadow color of the bevel border.
* Will return null if no shadow color was specified
* at instantiation.
+ *
+ * @return the outer shadow {@code Color} or {@code null} if no shadow color
+ * was specified
* @since 1.3
*/
public Color getShadowOuterColor() {
@@ -227,13 +247,18 @@
/**
* Returns the type of the bevel border.
+ *
+ * @return the bevel border type, either {@code RAISED} or {@code LOWERED}
*/
public int getBevelType() {
return bevelType;
}
/**
- * Returns whether or not the border is opaque.
+ * Returns whether or not the border is opaque. This implementation
+ * returns {@code true}.
+ *
+ * @return true
*/
public boolean isBorderOpaque() { return true; }
--- a/jdk/src/share/classes/javax/swing/border/Border.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/border/Border.java Fri May 23 09:05:24 2014 -0700
@@ -66,6 +66,7 @@
/**
* Paints the border for the specified component with the specified
* position and size.
+ *
* @param c the component for which this border is being painted
* @param g the paint graphics
* @param x the x position of the painted border
@@ -77,7 +78,10 @@
/**
* Returns the insets of the border.
+ *
* @param c the component for which this border insets value applies
+ * @return an {@code Insets} object containing the insets from top, left,
+ * bottom and right of this {@code Border}
*/
Insets getBorderInsets(Component c);
@@ -85,6 +89,8 @@
* Returns whether or not the border is opaque. If the border
* is opaque, it is responsible for filling in it's own
* background when painting.
+ *
+ * @return true if this {@code Border} is opaque
*/
boolean isBorderOpaque();
}
--- a/jdk/src/share/classes/javax/swing/border/CompoundBorder.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/border/CompoundBorder.java Fri May 23 09:05:24 2014 -0700
@@ -155,6 +155,8 @@
/**
* Returns the outside border object.
+ *
+ * @return the outside {@code Border} object
*/
public Border getOutsideBorder() {
return outsideBorder;
@@ -162,6 +164,8 @@
/**
* Returns the inside border object.
+ *
+ * @return the inside {@code Border} object
*/
public Border getInsideBorder() {
return insideBorder;
--- a/jdk/src/share/classes/javax/swing/border/EmptyBorder.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/border/EmptyBorder.java Fri May 23 09:05:24 2014 -0700
@@ -98,6 +98,9 @@
/**
* Returns the insets of the border.
+ *
+ * @return an {@code Insets} object containing the insets from top, left,
+ * bottom and right
* @since 1.3
*/
public Insets getBorderInsets() {
--- a/jdk/src/share/classes/javax/swing/border/EtchedBorder.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/border/EtchedBorder.java Fri May 23 09:05:24 2014 -0700
@@ -77,6 +77,7 @@
* whose colors will be derived
* from the background color of the component passed into
* the paintBorder method.
+ *
* @param etchType the type of etch to be drawn by the border
*/
public EtchedBorder(int etchType) {
@@ -86,6 +87,7 @@
/**
* Creates a lowered etched border with the specified highlight and
* shadow colors.
+ *
* @param highlight the color to use for the etched highlight
* @param shadow the color to use for the etched shadow
*/
@@ -96,6 +98,7 @@
/**
* Creates an etched border with the specified etch-type,
* highlight and shadow colors.
+ *
* @param etchType the type of etch to be drawn by the border
* @param highlight the color to use for the etched highlight
* @param shadow the color to use for the etched shadow
@@ -110,6 +113,7 @@
/**
* Paints the border for the specified component with the
* specified position and size.
+ *
* @param c the component for which this border is being painted
* @param g the paint graphics
* @param x the x position of the painted border
@@ -138,6 +142,7 @@
/**
* Reinitialize the insets parameter with this Border's current Insets.
+ *
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
*/
@@ -148,11 +153,16 @@
/**
* Returns whether or not the border is opaque.
+ * This implementation returns true.
+ *
+ * @return true
*/
public boolean isBorderOpaque() { return true; }
/**
* Returns which etch-type is set on the etched border.
+ *
+ * @return the etched border type, either {@code RAISED} or {@code LOWERED}
*/
public int getEtchType() {
return etchType;
@@ -163,7 +173,9 @@
* when rendered on the specified component. If no highlight
* color was specified at instantiation, the highlight color
* is derived from the specified component's background color.
+ *
* @param c the component for which the highlight may be derived
+ * @return the highlight {@code Color} of this {@code EtchedBorder}
* @since 1.3
*/
public Color getHighlightColor(Component c) {
@@ -175,6 +187,9 @@
* Returns the highlight color of the etched border.
* Will return null if no highlight color was specified
* at instantiation.
+ *
+ * @return the highlight {@code Color} of this {@code EtchedBorder} or null
+ * if none was specified
* @since 1.3
*/
public Color getHighlightColor() {
@@ -186,7 +201,9 @@
* when rendered on the specified component. If no shadow
* color was specified at instantiation, the shadow color
* is derived from the specified component's background color.
+ *
* @param c the component for which the shadow may be derived
+ * @return the shadow {@code Color} of this {@code EtchedBorder}
* @since 1.3
*/
public Color getShadowColor(Component c) {
@@ -197,6 +214,9 @@
* Returns the shadow color of the etched border.
* Will return null if no shadow color was specified
* at instantiation.
+ *
+ * @return the shadow {@code Color} of this {@code EtchedBorder} or null
+ * if none was specified
* @since 1.3
*/
public Color getShadowColor() {
--- a/jdk/src/share/classes/javax/swing/border/LineBorder.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/border/LineBorder.java Fri May 23 09:05:24 2014 -0700
@@ -60,8 +60,11 @@
protected Color lineColor;
protected boolean roundedCorners;
- /** Convenience method for getting the Color.black LineBorder of thickness 1.
- */
+ /**
+ * Convenience method for getting the Color.black LineBorder of thickness 1.
+ *
+ * @return a {@code LineBorder} with {@code Color.black} and thickness of 1
+ */
public static Border createBlackLineBorder() {
if (blackLine == null) {
blackLine = new LineBorder(Color.black, 1);
@@ -69,8 +72,11 @@
return blackLine;
}
- /** Convenience method for getting the Color.gray LineBorder of thickness 1.
- */
+ /**
+ * Convenience method for getting the Color.gray LineBorder of thickness 1.
+ *
+ * @return a {@code LineBorder} with {@code Color.gray} and thickness of 1
+ */
public static Border createGrayLineBorder() {
if (grayLine == null) {
grayLine = new LineBorder(Color.gray, 1);
@@ -81,6 +87,7 @@
/**
* Creates a line border with the specified color and a
* thickness = 1.
+ *
* @param color the color for the border
*/
public LineBorder(Color color) {
@@ -89,6 +96,7 @@
/**
* Creates a line border with the specified color and thickness.
+ *
* @param color the color of the border
* @param thickness the thickness of the border
*/
@@ -99,6 +107,7 @@
/**
* Creates a line border with the specified color, thickness,
* and corner shape.
+ *
* @param color the color of the border
* @param thickness the thickness of the border
* @param roundedCorners whether or not border corners should be round
@@ -114,6 +123,7 @@
/**
* Paints the border for the specified component with the
* specified position and size.
+ *
* @param c the component for which this border is being painted
* @param g the paint graphics
* @param x the x position of the painted border
@@ -152,6 +162,7 @@
/**
* Reinitialize the insets parameter with this Border's current Insets.
+ *
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
*/
@@ -162,6 +173,8 @@
/**
* Returns the color of the border.
+ *
+ * @return a {@code Color} object representing the color of this object
*/
public Color getLineColor() {
return lineColor;
@@ -169,6 +182,8 @@
/**
* Returns the thickness of the border.
+ *
+ * @return the thickness of this border
*/
public int getThickness() {
return thickness;
@@ -176,6 +191,8 @@
/**
* Returns whether this border will be drawn with rounded corners.
+ *
+ * @return {@code true} if this border should have rounded corners
* @since 1.3
*/
public boolean getRoundedCorners() {
@@ -184,6 +201,8 @@
/**
* Returns whether or not the border is opaque.
+ *
+ * @return {@code true} if the border is opaque, {@code false} otherwise
*/
public boolean isBorderOpaque() {
return !roundedCorners;
--- a/jdk/src/share/classes/javax/swing/border/MatteBorder.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/border/MatteBorder.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -196,6 +196,9 @@
/**
* Returns the color used for tiling the border or null
* if a tile icon is being used.
+ *
+ * @return the {@code Color} object used to render the border or {@code null}
+ * if a tile icon is used
* @since 1.3
*/
public Color getMatteColor() {
@@ -205,6 +208,9 @@
/**
* Returns the icon used for tiling the border or null
* if a solid color is being used.
+ *
+ * @return the {@code Icon} used to tile the border or {@code null} if a
+ * solid color is used to fill the border
* @since 1.3
*/
public Icon getTileIcon() {
@@ -213,6 +219,8 @@
/**
* Returns whether or not the border is opaque.
+ *
+ * @return {@code true} if the border is opaque, {@code false} otherwise
*/
public boolean isBorderOpaque() {
// If a tileIcon is set, then it may contain transparent bits
--- a/jdk/src/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java Fri May 23 09:05:24 2014 -0700
@@ -145,7 +145,8 @@
/**
* Invoked when the panel is added to the chooser.
* If you override this, be sure to call <code>super</code>.
- * @param enclosingChooser the panel to be added
+ *
+ * @param enclosingChooser the chooser to which the panel is to be added
* @exception RuntimeException if the chooser panel has already been
* installed
*/
@@ -163,6 +164,8 @@
/**
* Invoked when the panel is removed from the chooser.
* If override this, be sure to call <code>super</code>.
+ *
+ * @param enclosingChooser the chooser from which the panel is to be removed
*/
public void uninstallChooserPanel(JColorChooser enclosingChooser) {
chooser.removePropertyChangeListener("enabled", enabledListener);
--- a/jdk/src/share/classes/javax/swing/filechooser/FileFilter.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/filechooser/FileFilter.java Fri May 23 09:05:24 2014 -0700
@@ -51,11 +51,16 @@
public abstract class FileFilter {
/**
* Whether the given file is accepted by this filter.
+ *
+ * @param f the File to test
+ * @return true if the file is to be accepted
*/
public abstract boolean accept(File f);
/**
* The description of this filter. For example: "JPG and GIF Images"
+ *
+ * @return the description of this filter
* @see FileView#getName
*/
public abstract String getDescription();
--- a/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java Fri May 23 09:05:24 2014 -0700
@@ -324,11 +324,18 @@
/**
* Creates a new folder with a default folder name.
+ *
+ * @param containingDir a {@code File} object denoting directory to contain the new folder
+ * @return a {@code File} object denoting the newly created folder
+ * @throws IOException if new folder could not be created
*/
public abstract File createNewFolder(File containingDir) throws IOException;
/**
* Returns whether a file is hidden or not.
+ *
+ * @param f a {@code File} object
+ * @return true if the given {@code File} denotes a hidden file
*/
public boolean isHiddenFile(File f) {
return f.isHidden();
@@ -395,6 +402,9 @@
* Returns all root partitions on this system. For example, on
* Windows, this would be the "Desktop" folder, while on DOS this
* would be the A: through Z: drives.
+ *
+ * @return an array of {@code File} objects representing all root partitions
+ * on this system
*/
public File[] getRoots() {
// Don't cache this array, because filesystem might change
@@ -435,6 +445,10 @@
/**
* Returns a File object constructed in dir from the given filename.
+ *
+ * @param dir an abstract pathname denoting a directory
+ * @param filename a {@code String} representation of a pathname
+ * @return a {@code File} object created from {@code dir} and {@code filename}
*/
public File createFileObject(File dir, String filename) {
if(dir == null) {
@@ -446,6 +460,9 @@
/**
* Returns a File object constructed from the given path string.
+ *
+ * @param path {@code String} representation of path
+ * @return a {@code File} object created from the given {@code path}
*/
public File createFileObject(String path) {
File f = new File(path);
@@ -458,6 +475,12 @@
/**
* Gets the list of shown (i.e. not hidden) files.
+ *
+ * @param dir the root directory of files to be returned
+ * @param useFileHiding determine if hidden files are returned
+ * @return an array of {@code File} objects representing files and
+ * directories in the given {@code dir}. It includes hidden
+ * files if {@code useFileHiding} is false.
*/
public File[] getFiles(File dir, boolean useFileHiding) {
List<File> files = new ArrayList<File>();
--- a/jdk/src/share/classes/javax/swing/filechooser/FileView.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/filechooser/FileView.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,9 @@
/**
* The name of the file. Normally this would be simply
* <code>f.getName()</code>.
+ *
+ * @param f a {@code File} object
+ * @return a {@code String} representing the name of the file
*/
public String getName(File f) {
return null;
@@ -78,6 +81,11 @@
* A human readable description of the file. For example,
* a file named <i>jag.jpg</i> might have a description that read:
* "A JPEG image file of James Gosling's face".
+ *
+ * @param f a {@code File} object
+ * @return a {@code String} containing a description of the file or
+ * {@code null} if it is not available.
+ *
*/
public String getDescription(File f) {
return null;
@@ -87,6 +95,10 @@
* A human readable description of the type of the file. For
* example, a <code>jpg</code> file might have a type description of:
* "A JPEG Compressed Image File"
+ *
+ * @param f a {@code File} object
+ * @return a {@code String} containing a description of the type of the file
+ * or {@code null} if it is not available .
*/
public String getTypeDescription(File f) {
return null;
@@ -94,6 +106,10 @@
/**
* The icon that represents this file in the <code>JFileChooser</code>.
+ *
+ * @param f a {@code File} object
+ * @return an {@code Icon} which represents the specified {@code File} or
+ * {@code null} if it is not available.
*/
public Icon getIcon(File f) {
return null;
@@ -103,6 +119,12 @@
* Whether the directory is traversable or not. This might be
* useful, for example, if you want a directory to represent
* a compound document and don't want the user to descend into it.
+ *
+ * @param f a {@code File} object representing a directory
+ * @return {@code true} if the directory is traversable,
+ * {@code false} if it is not, and {@code null} if the
+ * file system should be checked.
+ * @see FileSystemView#isTraversable
*/
public Boolean isTraversable(File f) {
return null;
--- a/jdk/src/share/classes/javax/swing/text/html/parser/AttributeList.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/AttributeList.java Fri May 23 09:05:24 2014 -0700
@@ -59,6 +59,8 @@
/**
* Create an attribute list element.
+ *
+ * @param name the attribute name
*/
public AttributeList(String name) {
this.name = name;
@@ -66,6 +68,13 @@
/**
* Create an attribute list element.
+ *
+ * @param name the attribute name
+ * @param type the attribute type
+ * @param modifier the attribute modifier
+ * @param value the default attribute value
+ * @param values the possible attribute values
+ * @param next the next attribute in the list
*/
public AttributeList(String name, int type, int modifier, String value, Vector<?> values, AttributeList next) {
this.name = name;
--- a/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java Fri May 23 09:05:24 2014 -0700
@@ -62,6 +62,8 @@
/**
* Create a content model for an element.
+ *
+ * @param content the element
*/
public ContentModel(Element content) {
this(0, content, null);
@@ -69,6 +71,9 @@
/**
* Create a content model of a particular type.
+ *
+ * @param type the type
+ * @param content the content
*/
public ContentModel(int type, ContentModel content) {
this(type, content, null);
@@ -76,6 +81,10 @@
/**
* Create a content model of a particular type.
+ *
+ * @param type the type
+ * @param content the content
+ * @param next the next content model
*/
public ContentModel(int type, Object content, ContentModel next) {
this.type = type;
@@ -86,6 +95,9 @@
/**
* Return true if the content model could
* match an empty input stream.
+ *
+ * @return {@code true} if the content model could
+ * match an empty input stream
*/
public boolean empty() {
switch (type) {
@@ -119,6 +131,8 @@
/**
* Update elemVec with the list of elements that are
* part of the this contentModel.
+ *
+ * @param elemVec the list of elements
*/
public void getElements(Vector<Element> elemVec) {
switch (type) {
@@ -148,6 +162,11 @@
/**
* Return true if the token could potentially be the
* first token in the input stream.
+ *
+ * @param token the token
+ *
+ * @return {@code true} if the token could potentially be the first token
+ * in the input stream
*/
public boolean first(Object token) {
switch (type) {
@@ -206,6 +225,8 @@
/**
* Return the element that must be next.
+ *
+ * @return the element that must be next
*/
public Element first() {
switch (type) {
@@ -226,6 +247,8 @@
/**
* Convert to a string.
+ *
+ * @return the string representation of this {@code ContentModel}
*/
public String toString() {
switch (type) {
--- a/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -102,6 +102,7 @@
/**
* Gets an entity by name.
+ * @param name the entity name
* @return the <code>Entity</code> corresponding to the
* <code>name</code> <code>String</code>
*/
@@ -111,6 +112,7 @@
/**
* Gets a character entity.
+ * @param ch the character
* @return the <code>Entity</code> corresponding to the
* <code>ch</code> character
*/
@@ -193,13 +195,15 @@
* specified parameters. If one doesn't exist, a new
* one is created and returned.
*
- * @param name the name of the <code>Element</code>
- * @param type the type of the <code>Element</code>
- * @param omitStart <code>true</code> if start should be omitted
- * @param omitEnd <code>true</code> if end should be omitted
- * @param content the <code>ContentModel</code>
- * @param atts the <code>AttributeList</code> specifying the
- * <code>Element</code>
+ * @param name the name of the <code>Element</code>
+ * @param type the type of the <code>Element</code>
+ * @param omitStart <code>true</code> if start should be omitted
+ * @param omitEnd <code>true</code> if end should be omitted
+ * @param content the <code>ContentModel</code>
+ * @param exclusions the set of elements that must not occur inside the element
+ * @param inclusions the set of elements that can occur inside the element
+ * @param atts the <code>AttributeList</code> specifying the
+ * <code>Element</code>
* @return the <code>Element</code> specified
*/
public Element defineElement(String name, int type,
@@ -231,6 +235,8 @@
/**
* Creates and returns a character <code>Entity</code>.
* @param name the entity's name
+ * @param type the entity's type
+ * @param ch the entity's value (character)
* @return the new character <code>Entity</code>
*/
public Entity defEntity(String name, int type, int ch) {
@@ -241,6 +247,8 @@
/**
* Creates and returns an <code>Entity</code>.
* @param name the entity's name
+ * @param type the entity's type
+ * @param str the entity's data section
* @return the new <code>Entity</code>
*/
protected Entity defEntity(String name, int type, String str) {
@@ -252,7 +260,14 @@
/**
* Creates and returns an <code>Element</code>.
- * @param name the element's name
+ * @param name the element's name
+ * @param type the element's type
+ * @param omitStart {@code true} if the element needs no starting tag
+ * @param omitEnd {@code true} if the element needs no closing tag
+ * @param content the element's content
+ * @param exclusions the elements that must be excluded from the content of the element
+ * @param inclusions the elements that can be included as the content of the element
+ * @param atts the attributes of the element
* @return the new <code>Element</code>
*/
protected Element defElement(String name, int type,
@@ -280,11 +295,18 @@
}
/**
- * Creates and returns an <code>AttributeList</code>.
- * @param name the attribute list's name
+ * Creates and returns an <code>AttributeList</code> responding to a new attribute.
+ * @param name the attribute's name
+ * @param type the attribute's type
+ * @param modifier the attribute's modifier
+ * @param value the default value of the attribute
+ * @param values the allowed values for the attribute (multiple values could be separated by '|')
+ * @param atts the previous attribute of the element; to be placed to {@code AttributeList.next},
+ * creating a linked list
* @return the new <code>AttributeList</code>
*/
- protected AttributeList defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts) {
+ protected AttributeList defAttributeList(String name, int type, int modifier,
+ String value, String values, AttributeList atts) {
Vector<String> vals = null;
if (values != null) {
vals = new Vector<String>();
@@ -301,6 +323,8 @@
/**
* Creates and returns a new content model.
* @param type the type of the new content model
+ * @param obj the content of the content model
+ * @param next pointer to the next content model
* @return the new <code>ContentModel</code>
*/
protected ContentModel defContentModel(int type, Object obj, ContentModel next) {
@@ -332,6 +356,7 @@
*
* @param name the name of the DTD
* @return the DTD which corresponds to <code>name</code>
+ * @throws IOException if an I/O error occurs
*/
public static DTD getDTD(String name) throws IOException {
name = name.toLowerCase();
@@ -359,6 +384,7 @@
/**
* Recreates a DTD from an archived format.
* @param in the <code>DataInputStream</code> to read from
+ * @throws IOException if an I/O error occurs
*/
public void read(DataInputStream in) throws IOException {
if (in.readInt() != FILE_VERSION) {
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Element.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Element.java Fri May 23 09:05:24 2014 -0700
@@ -64,6 +64,9 @@
/**
* Create a new element.
+ *
+ * @param name the name of the element
+ * @param index the index
*/
Element(String name, int index) {
this.name = name;
@@ -84,6 +87,8 @@
/**
* Get the name of the element.
+ *
+ * @return the name of the element
*/
public String getName() {
return name;
@@ -91,6 +96,8 @@
/**
* Return true if the start tag can be omitted.
+ *
+ * @return {@code true} if the start tag can be omitted
*/
public boolean omitStart() {
return oStart;
@@ -98,6 +105,8 @@
/**
* Return true if the end tag can be omitted.
+ *
+ * @return {@code true} if the end tag can be omitted
*/
public boolean omitEnd() {
return oEnd;
@@ -105,6 +114,8 @@
/**
* Get type.
+ *
+ * @return the type of the element
*/
public int getType() {
return type;
@@ -112,6 +123,8 @@
/**
* Get content model
+ *
+ * @return the content model
*/
public ContentModel getContent() {
return content;
@@ -119,6 +132,8 @@
/**
* Get the attributes.
+ *
+ * @return the {@code AttributeList} specifying the element
*/
public AttributeList getAttributes() {
return atts;
@@ -126,6 +141,8 @@
/**
* Get index.
+ *
+ * @return the element index
*/
public int getIndex() {
return index;
@@ -133,6 +150,8 @@
/**
* Check if empty
+ *
+ * @return true if the current element is empty
*/
public boolean isEmpty() {
return type == EMPTY;
@@ -140,6 +159,8 @@
/**
* Convert to a string.
+ *
+ * @return a string representation for the given {@code Element} instance
*/
public String toString() {
return name;
@@ -147,6 +168,10 @@
/**
* Get an attribute by name.
+ *
+ * @param name the attribute name
+ *
+ * @return the {@code AttributeList} for the given {@code name}
*/
public AttributeList getAttribute(String name) {
for (AttributeList a = atts ; a != null ; a = a.next) {
@@ -159,10 +184,14 @@
/**
* Get an attribute by value.
+ *
+ * @param value the string representation of value
+ *
+ * @return the {@code AttributeList} for the given {@code value}
*/
- public AttributeList getAttributeByValue(String name) {
+ public AttributeList getAttributeByValue(String value) {
for (AttributeList a = atts ; a != null ; a = a.next) {
- if ((a.values != null) && a.values.contains(name)) {
+ if ((a.values != null) && a.values.contains(value)) {
return a;
}
}
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java Fri May 23 09:05:24 2014 -0700
@@ -216,6 +216,8 @@
* the current comment tag, text, block.... This is provided for
* subclassers that wish to know the start of the current block when
* called with one of the handleXXX methods.
+ *
+ * @return the start position of the current block
*/
int getBlockStartPosition() {
return Math.max(0, lastBlockStartPos - 1);
@@ -223,31 +225,55 @@
/**
* Makes a TagElement.
+ *
+ * @param elem the element storing the tag definition
+ * @param fictional the value of the flag "{@code fictional}" to be set for the tag
+ *
+ * @return the created {@code TagElement}
*/
protected TagElement makeTag(Element elem, boolean fictional) {
return new TagElement(elem, fictional);
}
+ /**
+ * Makes a TagElement.
+ *
+ * @param elem the element storing the tag definition
+ *
+ * @return the created {@code TagElement}
+ */
protected TagElement makeTag(Element elem) {
return makeTag(elem, false);
}
+ /**
+ * Returns attributes for the current tag.
+ *
+ * @return {@code SimpleAttributeSet} containing the attributes
+ */
protected SimpleAttributeSet getAttributes() {
return attributes;
}
+ /**
+ * Removes the current attributes.
+ */
protected void flushAttributes() {
attributes.removeAttributes(attributes);
}
/**
* Called when PCDATA is encountered.
+ *
+ * @param text the section text
*/
protected void handleText(char text[]) {
}
/**
* Called when an HTML title tag is encountered.
+ *
+ * @param text the title text
*/
protected void handleTitle(char text[]) {
// default behavior is to call handleText. Subclasses
@@ -257,10 +283,15 @@
/**
* Called when an HTML comment is encountered.
+ *
+ * @param text the comment being handled
*/
protected void handleComment(char text[]) {
}
+ /**
+ * Called when the content terminates without closing the HTML comment.
+ */
protected void handleEOFInComment() {
// We've reached EOF. Our recovery strategy is to
// see if we have more than one line in the comment;
@@ -288,24 +319,34 @@
/**
* Called when an empty tag is encountered.
+ *
+ * @param tag the tag being handled
+ * @throws ChangedCharSetException if the document charset was changed
*/
protected void handleEmptyTag(TagElement tag) throws ChangedCharSetException {
}
/**
* Called when a start tag is encountered.
+ *
+ * @param tag the tag being handled
*/
protected void handleStartTag(TagElement tag) {
}
/**
* Called when an end tag is encountered.
+ *
+ * @param tag the tag being handled
*/
protected void handleEndTag(TagElement tag) {
}
/**
* An error has occurred.
+ *
+ * @param ln the number of line containing the error
+ * @param msg the error message
*/
protected void handleError(int ln, String msg) {
/*
@@ -368,7 +409,12 @@
}
/**
- * Invoke the error handler.
+ * Invokes the error handler.
+ *
+ * @param err the error type
+ * @param arg1 the 1st error message argument
+ * @param arg2 the 2nd error message argument
+ * @param arg3 the 3rd error message argument
*/
protected void error(String err, String arg1, String arg2,
String arg3) {
@@ -390,6 +436,9 @@
* Handle a start tag. The new tag is pushed
* onto the tag stack. The attribute list is
* checked for required attributes.
+ *
+ * @param tag the tag
+ * @throws ChangedCharSetException if the document charset was changed
*/
protected void startTag(TagElement tag) throws ChangedCharSetException {
Element elem = tag.getElement();
@@ -441,6 +490,9 @@
/**
* Handle an end tag. The end tag is popped
* from the tag stack.
+ *
+ * @param omitted {@code true} if the tag is no actually present in the
+ * document, but is supposed by the parser
*/
protected void endTag(boolean omitted) {
handleText(stack.tag);
@@ -498,6 +550,8 @@
/**
* Marks the first time a tag has been seen in a document
+ *
+ * @param elem the element represented by the tag
*/
protected void markFirstTime(Element elem) {
@@ -1482,8 +1536,11 @@
}
/**
- * Parses th Document Declaration Type markup declaration.
+ * Parses the Document Type Declaration markup declaration.
* Currently ignores it.
+ *
+ * @return the string representation of the markup declaration
+ * @throws IOException if an I/O error occurs
*/
public String parseDTDMarkup() throws IOException {
@@ -1527,6 +1584,11 @@
* Parse markup declarations.
* Currently only handles the Document Type Declaration markup.
* Returns true if it is a markup declaration false otherwise.
+ *
+ * @param strBuff the markup declaration
+ * @return {@code true} if this is a valid markup declaration;
+ * otherwise {@code false}
+ * @throws IOException if an I/O error occurs
*/
protected boolean parseMarkupDeclarations(StringBuffer strBuff) throws IOException {
@@ -2246,6 +2308,9 @@
/**
* Parse an HTML stream, given a DTD.
+ *
+ * @param in the reader to read the source from
+ * @throws IOException if an I/O error occurs
*/
public synchronized void parse(Reader in) throws IOException {
this.in = in;
--- a/jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java Fri May 23 09:05:24 2014 -0700
@@ -149,6 +149,8 @@
* Returns the height of each row. If the returned value is less than
* or equal to 0 the height for each row is determined by the
* renderer.
+ *
+ * @return the height of each row
*/
public int getRowHeight() {
return rowHeight;
@@ -263,6 +265,9 @@
/**
* Returns true if the value identified by row is currently expanded.
+ *
+ * @param path TreePath to check
+ * @return whether TreePath is expanded
*/
public abstract boolean isExpanded(TreePath path);
@@ -496,6 +501,8 @@
/**
* Returns true if the height of each row is a fixed size.
+ *
+ * @return whether the height of each row is a fixed size
*/
protected boolean isFixedRowHeight() {
return (rowHeight > 0);
--- a/jdk/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java Fri May 23 09:05:24 2014 -0700
@@ -534,6 +534,7 @@
* Returns true if and only if <code>aNode</code> is in the same tree
* as this node. Returns false if <code>aNode</code> is null.
*
+ * @param aNode node to find common ancestor with
* @see #getSharedAncestor
* @see #getRoot
* @return true if <code>aNode</code> is in the same tree as this node;
@@ -638,6 +639,8 @@
* Returns the user object path, from the root, to get to this node.
* If some of the TreeNodes in the path have null user objects, the
* returned path will contain nulls.
+ *
+ * @return the user object path, from the root, to get to this node
*/
public Object[] getUserObjectPath() {
TreeNode[] realPath = getPath();
@@ -828,6 +831,7 @@
* Modifying the tree by inserting, removing, or moving a node invalidates
* any enumerations created before the modification.
*
+ * @param ancestor the node to start enumeration from
* @see #isNodeAncestor
* @see #isNodeDescendant
* @exception IllegalArgumentException if <code>ancestor</code> is
@@ -848,6 +852,7 @@
* Returns true if <code>aNode</code> is a child of this node. If
* <code>aNode</code> is null, this method returns false.
*
+ * @param aNode the node to determinate whether it is a child
* @return true if <code>aNode</code> is a child of this node; false if
* <code>aNode</code> is null
*/
@@ -906,6 +911,7 @@
* <code>aChild</code> and is O(n) where n is the number of children; to
* traverse the entire array of children, use an enumeration instead.
*
+ * @param aChild the child node to look for next child after it
* @see #children
* @exception IllegalArgumentException if <code>aChild</code> is
* null or is not a child of this node
@@ -938,6 +944,7 @@
* performs a linear search of this node's children for <code>aChild</code>
* and is O(n) where n is the number of children.
*
+ * @param aChild the child node to look for previous child before it
* @exception IllegalArgumentException if <code>aChild</code> is null
* or is not a child of this node
* @return the child of this node that immediately precedes
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellEditor.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellEditor.java Fri May 23 09:05:24 2014 -0700
@@ -405,7 +405,9 @@
/**
* Returns true if <code>event</code> is a <code>MouseEvent</code>
* and the click count is 1.
- * @param event the event being studied
+ *
+ * @param event the event being studied
+ * @return whether {@code event} should starts the editing timer
*/
protected boolean shouldStartEditingTimer(EventObject event) {
if((event instanceof MouseEvent) &&
@@ -433,7 +435,9 @@
* Returns true if <code>event</code> is <code>null</code>,
* or it is a <code>MouseEvent</code> with a click count > 2
* and <code>inHitRegion</code> returns true.
+ *
* @param event the event being studied
+ * @return whether editing can be started for the given {@code event}
*/
protected boolean canEditImmediately(EventObject event) {
if((event instanceof MouseEvent) &&
@@ -513,6 +517,8 @@
/**
* Creates the container to manage placement of
* <code>editingComponent</code>.
+ *
+ * @return new Container object
*/
protected Container createContainer() {
return new EditorContainer();
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java Fri May 23 09:05:24 2014 -0700
@@ -234,6 +234,9 @@
/**
* Returns the default icon, for the current laf, that is used to
* represent non-leaf nodes that are expanded.
+ *
+ * @return the default icon, for the current laf, that is used to
+ * represent non-leaf nodes that are expanded.
*/
public Icon getDefaultOpenIcon() {
return DefaultLookup.getIcon(this, ui, "Tree.openIcon");
@@ -242,6 +245,9 @@
/**
* Returns the default icon, for the current laf, that is used to
* represent non-leaf nodes that are not expanded.
+ *
+ * @return the default icon, for the current laf, that is used to
+ * represent non-leaf nodes that are not expanded.
*/
public Icon getDefaultClosedIcon() {
return DefaultLookup.getIcon(this, ui, "Tree.closedIcon");
@@ -250,6 +256,9 @@
/**
* Returns the default icon, for the current laf, that is used to
* represent leaf nodes.
+ *
+ * @return the default icon, for the current laf, that is used to
+ * represent leaf nodes.
*/
public Icon getDefaultLeafIcon() {
return DefaultLookup.getIcon(this, ui, "Tree.leafIcon");
@@ -257,6 +266,8 @@
/**
* Sets the icon used to represent non-leaf nodes that are expanded.
+ *
+ * @param newIcon the icon to be used for expanded non-leaf nodes
*/
public void setOpenIcon(Icon newIcon) {
openIcon = newIcon;
@@ -264,6 +275,8 @@
/**
* Returns the icon used to represent non-leaf nodes that are expanded.
+ *
+ * @return the icon used to represent non-leaf nodes that are expanded
*/
public Icon getOpenIcon() {
return openIcon;
@@ -271,6 +284,8 @@
/**
* Sets the icon used to represent non-leaf nodes that are not expanded.
+ *
+ * @param newIcon the icon to be used for not expanded non-leaf nodes
*/
public void setClosedIcon(Icon newIcon) {
closedIcon = newIcon;
@@ -279,6 +294,9 @@
/**
* Returns the icon used to represent non-leaf nodes that are not
* expanded.
+ *
+ * @return the icon used to represent non-leaf nodes that are not
+ * expanded
*/
public Icon getClosedIcon() {
return closedIcon;
@@ -286,6 +304,8 @@
/**
* Sets the icon used to represent leaf nodes.
+ *
+ * @param newIcon icon to be used for leaf nodes
*/
public void setLeafIcon(Icon newIcon) {
leafIcon = newIcon;
@@ -293,6 +313,8 @@
/**
* Returns the icon used to represent leaf nodes.
+ *
+ * @return the icon used to represent leaf nodes
*/
public Icon getLeafIcon() {
return leafIcon;
@@ -300,6 +322,8 @@
/**
* Sets the color the text is drawn with when the node is selected.
+ *
+ * @param newColor color to be used for text when the node is selected
*/
public void setTextSelectionColor(Color newColor) {
textSelectionColor = newColor;
@@ -307,6 +331,8 @@
/**
* Returns the color the text is drawn with when the node is selected.
+ *
+ * @return the color the text is drawn with when the node is selected
*/
public Color getTextSelectionColor() {
return textSelectionColor;
@@ -314,6 +340,8 @@
/**
* Sets the color the text is drawn with when the node isn't selected.
+ *
+ * @param newColor color to be used for text when the node isn't selected
*/
public void setTextNonSelectionColor(Color newColor) {
textNonSelectionColor = newColor;
@@ -321,6 +349,8 @@
/**
* Returns the color the text is drawn with when the node isn't selected.
+ *
+ * @return the color the text is drawn with when the node isn't selected.
*/
public Color getTextNonSelectionColor() {
return textNonSelectionColor;
@@ -328,6 +358,8 @@
/**
* Sets the color to use for the background if node is selected.
+ *
+ * @param newColor to be used for the background if the node is selected
*/
public void setBackgroundSelectionColor(Color newColor) {
backgroundSelectionColor = newColor;
@@ -336,6 +368,8 @@
/**
* Returns the color to use for the background if node is selected.
+ *
+ * @return the color to use for the background if node is selected
*/
public Color getBackgroundSelectionColor() {
return backgroundSelectionColor;
@@ -343,6 +377,8 @@
/**
* Sets the background color to be used for non selected nodes.
+ *
+ * @param newColor color to be used for the background for non selected nodes
*/
public void setBackgroundNonSelectionColor(Color newColor) {
backgroundNonSelectionColor = newColor;
@@ -350,6 +386,8 @@
/**
* Returns the background color to be used for non selected nodes.
+ *
+ * @return the background color to be used for non selected nodes.
*/
public Color getBackgroundNonSelectionColor() {
return backgroundNonSelectionColor;
@@ -357,6 +395,8 @@
/**
* Sets the color to use for the border.
+ *
+ * @param newColor color to be used for the border
*/
public void setBorderSelectionColor(Color newColor) {
borderSelectionColor = newColor;
@@ -364,6 +404,8 @@
/**
* Returns the color the border is drawn.
+ *
+ * @return the color the border is drawn
*/
public Color getBorderSelectionColor() {
return borderSelectionColor;
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java Fri May 23 09:05:24 2014 -0700
@@ -105,6 +105,9 @@
* Sets whether or not to test leafness by asking getAllowsChildren()
* or isLeaf() to the TreeNodes. If newvalue is true, getAllowsChildren()
* is messaged, otherwise isLeaf() is messaged.
+ *
+ * @param newValue if true, getAllowsChildren() is messaged, otherwise
+ * isLeaf() is messaged
*/
public void setAsksAllowsChildren(boolean newValue) {
asksAllowsChildren = newValue;
@@ -125,6 +128,8 @@
/**
* Sets the root to <code>root</code>. A null <code>root</code> implies
* the tree is to display nothing, and is legal.
+ *
+ * @param root new value of tree root
*/
public void setRoot(TreeNode root) {
Object oldRoot = this.root;
@@ -231,6 +236,10 @@
* This will then message nodesWereInserted to create the appropriate
* event. This is the preferred way to add children as it will create
* the appropriate event.
+ *
+ * @param newChild child node to be inserted
+ * @param parent node to which children new node will be added
+ * @param index index of parent's children
*/
public void insertNodeInto(MutableTreeNode newChild,
MutableTreeNode parent, int index){
@@ -247,6 +256,8 @@
* nodesWereRemoved to create the appropriate event. This is the
* preferred way to remove a node as it handles the event creation
* for you.
+ *
+ * @param node the node to be removed from it's parrent
*/
public void removeNodeFromParent(MutableTreeNode node) {
MutableTreeNode parent = (MutableTreeNode)node.getParent();
@@ -266,6 +277,8 @@
/**
* Invoke this method after you've changed how node is to be
* represented in the tree.
+ *
+ * @param node the changed node
*/
public void nodeChanged(TreeNode node) {
if(listenerList != null && node != null) {
@@ -303,6 +316,9 @@
* Invoke this method after you've inserted some TreeNodes into
* node. childIndices should be the index of the new elements and
* must be sorted in ascending order.
+ *
+ * @param node parent node which children count been incremented
+ * @param childIndices indexes of inserted children
*/
public void nodesWereInserted(TreeNode node, int[] childIndices) {
if(listenerList != null && node != null && childIndices != null
@@ -322,6 +338,10 @@
* node. childIndices should be the index of the removed elements and
* must be sorted in ascending order. And removedChildren should be
* the array of the children objects that were removed.
+ *
+ * @param node parent node which childred were removed
+ * @param childIndices indexes of removed childs
+ * @param removedChildren array of the children objects that were removed
*/
public void nodesWereRemoved(TreeNode node, int[] childIndices,
Object[] removedChildren) {
@@ -334,6 +354,9 @@
/**
* Invoke this method after you've changed how the children identified by
* childIndicies are to be represented in the tree.
+ *
+ * @param node changed node
+ * @param childIndices indexes of changed children
*/
public void nodesChanged(TreeNode node, int[] childIndices) {
if(node != null) {
@@ -360,6 +383,8 @@
* Invoke this method if you've totally changed the children of
* node and its children's children... This will post a
* treeStructureChanged event.
+ *
+ * @param node changed node
*/
public void nodeStructureChanged(TreeNode node) {
if(node != null) {
@@ -374,6 +399,7 @@
* tree.
*
* @param aNode the TreeNode to get the path for
+ * @return an array of TreeNodes giving the path from the root
*/
public TreeNode[] getPathToRoot(TreeNode aNode) {
return getPathToRoot(aNode, 0);
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java Fri May 23 09:05:24 2014 -0700
@@ -618,6 +618,9 @@
/**
* Notifies all listeners that are registered for
* tree selection events on this object.
+ *
+ * @param e the event that characterizes the change
+ *
* @see #addTreeSelectionListener
* @see EventListenerList
*/
@@ -920,6 +923,9 @@
/**
* Returns true if the paths are contiguous,
* or this object has no RowMapper.
+ *
+ * @param paths array of paths to check
+ * @return whether the paths are contiguous, or this object has no RowMapper
*/
protected boolean arePathsContiguous(TreePath[] paths) {
if(rowMapper == null || paths.length < 2)
@@ -968,6 +974,9 @@
* or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
* adding the paths to the current selection still results in a
* contiguous set of <code>TreePath</code>s.
+ *
+ * @param paths array of {@code TreePaths} to check
+ * @return whether the particular set of {@code TreePaths} can be added
*/
protected boolean canPathsBeAdded(TreePath[] paths) {
if(paths == null || paths.length == 0 || rowMapper == null ||
@@ -1019,6 +1028,10 @@
* Returns true if the paths can be removed without breaking the
* continuity of the model.
* This is rather expensive.
+ *
+ * @param paths array of {@code TreePath} to check
+ * @return whether the paths can be removed without breaking the
+ * continuity of the model
*/
protected boolean canPathsBeRemoved(TreePath[] paths) {
if(rowMapper == null || selection == null ||
@@ -1072,6 +1085,9 @@
* instances of PathPlaceHolder.
*
* @deprecated As of JDK version 1.7
+ *
+ * @param changedPaths the vector of the changed paths
+ * @param oldLeadSelection the old selection path
*/
@Deprecated
protected void notifyPathChange(Vector<?> changedPaths,
--- a/jdk/src/share/classes/javax/swing/tree/MutableTreeNode.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/MutableTreeNode.java Fri May 23 09:05:24 2014 -0700
@@ -42,22 +42,31 @@
/**
* Adds <code>child</code> to the receiver at <code>index</code>.
* <code>child</code> will be messaged with <code>setParent</code>.
+ *
+ * @param child node to be added
+ * @param index index of the receiver
*/
void insert(MutableTreeNode child, int index);
/**
* Removes the child at <code>index</code> from the receiver.
+ *
+ * @param index index of child to be removed
*/
void remove(int index);
/**
* Removes <code>node</code> from the receiver. <code>setParent</code>
* will be messaged on <code>node</code>.
+ *
+ * @param node node to be removed from the receiver
*/
void remove(MutableTreeNode node);
/**
* Resets the user object of the receiver to <code>object</code>.
+ *
+ * @param object object to be set as a receiver
*/
void setUserObject(Object object);
@@ -68,6 +77,8 @@
/**
* Sets the parent of the receiver to <code>newParent</code>.
+ *
+ * @param newParent node to be set as parent of the receiver
*/
void setParent(MutableTreeNode newParent);
}
--- a/jdk/src/share/classes/javax/swing/tree/RowMapper.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/RowMapper.java Fri May 23 09:05:24 2014 -0700
@@ -41,6 +41,10 @@
* the same length as that passed in, and if one of the TreePaths
* in <code>path</code> is not valid its entry in the array should
* be set to -1.
+ *
+ * @param path array of TreePath to parse
+ * @return the rows that the TreePath instances in {@code path} are
+ * being displayed at
*/
int[] getRowsForPaths(TreePath[] path);
}
--- a/jdk/src/share/classes/javax/swing/tree/TreeCellRenderer.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/TreeCellRenderer.java Fri May 23 09:05:24 2014 -0700
@@ -67,7 +67,14 @@
* }
* </pre>
*
- * @return the <code>Component</code> that the renderer uses to draw the value
+ * @param tree the receiver is being configured for
+ * @param value the value to render
+ * @param selected whether node is selected
+ * @param expanded whether node is expanded
+ * @param leaf whether node is a lead node
+ * @param row row index
+ * @param hasFocus whether node has focus
+ * @return the {@code Component} that the renderer uses to draw the value
*/
Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded,
--- a/jdk/src/share/classes/javax/swing/tree/TreeModel.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/TreeModel.java Fri May 23 09:05:24 2014 -0700
@@ -79,8 +79,9 @@
* is a valid index for <code>parent</code> (that is <code>index >= 0 &&
* index < getChildCount(parent</code>)).
*
- * @param parent a node in the tree, obtained from this data source
- * @return the child of <code>parent</code> at index <code>index</code>
+ * @param parent a node in the tree, obtained from this data source
+ * @param index index of child to be returned
+ * @return the child of {@code parent} at index {@code index}
*/
public Object getChild(Object parent, int index);
--- a/jdk/src/share/classes/javax/swing/tree/TreeNode.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/TreeNode.java Fri May 23 09:05:24 2014 -0700
@@ -49,17 +49,24 @@
/**
* Returns the child <code>TreeNode</code> at index
* <code>childIndex</code>.
+ *
+ * @param childIndex index of child
+ * @return the child node at given index
*/
TreeNode getChildAt(int childIndex);
/**
* Returns the number of children <code>TreeNode</code>s the receiver
* contains.
+ *
+ * @return the number of children the receiver contains
*/
int getChildCount();
/**
* Returns the parent <code>TreeNode</code> of the receiver.
+ *
+ * @return the parent of the receiver
*/
TreeNode getParent();
@@ -67,21 +74,30 @@
* Returns the index of <code>node</code> in the receivers children.
* If the receiver does not contain <code>node</code>, -1 will be
* returned.
+ *
+ * @param node node to be loked for
+ * @return index of specified node
*/
int getIndex(TreeNode node);
/**
* Returns true if the receiver allows children.
+ *
+ * @return whether the receiver allows children
*/
boolean getAllowsChildren();
/**
* Returns true if the receiver is a leaf.
+ *
+ * @return whether the receiver is a leaf
*/
boolean isLeaf();
/**
* Returns the children of the receiver as an <code>Enumeration</code>.
+ *
+ * @return the children of the receiver as an {@code Enumeration}
*/
Enumeration children();
}
--- a/jdk/src/share/classes/javax/swing/tree/TreePath.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/TreePath.java Fri May 23 09:05:24 2014 -0700
@@ -320,8 +320,10 @@
* plus <code>child</code>. <code>child</code> is the last element
* of the newly created {@code TreePath}.
*
- * @param child the path element to add
- * @throws NullPointerException if {@code child} is {@code null}
+ * @param child the path element to add
+ * @throws NullPointerException if {@code child} is {@code null}
+ * @return a new path containing all the elements of this path
+ * plus {@code child}
*/
public TreePath pathByAddingChild(Object child) {
if(child == null)
--- a/jdk/src/share/classes/javax/swing/tree/TreeSelectionModel.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/tree/TreeSelectionModel.java Fri May 23 09:05:24 2014 -0700
@@ -109,6 +109,8 @@
* selected when the mode is changed to <code>SINGLE_TREE_SELECTION</code>,
* only one TreePath will remain selected. It is up to the particular
* implementation to decide what TreePath remains selected.
+ *
+ * @param mode selection mode to be set
*/
void setSelectionMode(int mode);
@@ -117,6 +119,8 @@
* <code>SINGLE_TREE_SELECTION</code>,
* <code>CONTIGUOUS_TREE_SELECTION</code> or
* <code>DISCONTIGUOUS_TREE_SELECTION</code>.
+ *
+ * @return the current selection mode
*/
int getSelectionMode();
@@ -125,7 +129,7 @@
* the TreeSelectionListeners are notified. If <code>path</code> is
* null, this has the same effect as invoking <code>clearSelection</code>.
*
- * @param path new path to select
+ * @param path new path to select
*/
void setSelectionPath(TreePath path);
@@ -134,7 +138,7 @@
* the TreeSelectionListeners are notified. If <code>paths</code> is
* null, this has the same effect as invoking <code>clearSelection</code>.
*
- * @param paths new selection
+ * @param paths new selection
*/
void setSelectionPaths(TreePath[] paths);
@@ -143,7 +147,7 @@
* in the selection the TreeSelectionListeners are notified. This has
* no effect if <code>path</code> is null.
*
- * @param path the new path to add to the current selection
+ * @param path the new path to add to the current selection
*/
void addSelectionPath(TreePath path);
@@ -153,7 +157,7 @@
* are notified. This has
* no effect if <code>paths</code> is null.
*
- * @param paths the new paths to add to the current selection
+ * @param paths the new paths to add to the current selection
*/
void addSelectionPaths(TreePath[] paths);
@@ -162,7 +166,7 @@
* The TreeSelectionListeners are notified. This has no effect if
* <code>path</code> is null.
*
- * @param path the path to remove from the selection
+ * @param path the path to remove from the selection
*/
void removeSelectionPath(TreePath path);
@@ -172,7 +176,7 @@
* are in the selection, the TreeSelectionListeners are notified.
* This method has no effect if <code>paths</code> is null.
*
- * @param paths the path to remove from the selection
+ * @param paths the path to remove from the selection
*/
void removeSelectionPaths(TreePath[] paths);
@@ -181,28 +185,39 @@
* up to implementors, and may not necessarily be the TreePath with
* the smallest integer value as determined from the
* <code>RowMapper</code>.
+ *
+ * @return the first path in the selection
*/
TreePath getSelectionPath();
/**
* Returns the paths in the selection. This will return null (or an
* empty array) if nothing is currently selected.
+ *
+ * @return the paths in the selection
*/
TreePath[] getSelectionPaths();
/**
* Returns the number of paths that are selected.
+ *
+ * @return the number of paths that are selected
*/
int getSelectionCount();
/**
* Returns true if the path, <code>path</code>, is in the current
* selection.
+ *
+ * @param path the path to be loked for
+ * @return whether the {@code path} is in the current selection
*/
boolean isPathSelected(TreePath path);
/**
* Returns true if the selection is currently empty.
+ *
+ * @return whether the selection is currently empty
*/
boolean isSelectionEmpty();
@@ -215,12 +230,17 @@
/**
* Sets the RowMapper instance. This instance is used to determine
* the row for a particular TreePath.
+ *
+ * @param newMapper RowMapper to be set
*/
void setRowMapper(RowMapper newMapper);
/**
* Returns the RowMapper instance that is able to map a TreePath to a
* row.
+ *
+ * @return the RowMapper instance that is able to map a TreePath
+ * to a row
*/
RowMapper getRowMapper();
@@ -228,6 +248,8 @@
* Returns all of the currently selected rows. This will return
* null (or an empty array) if there are no selected TreePaths or
* a RowMapper has not been set.
+ *
+ * @return all of the currently selected rows
*/
int[] getSelectionRows();
@@ -235,6 +257,9 @@
* Returns the smallest value obtained from the RowMapper for the
* current set of selected TreePaths. If nothing is selected,
* or there is no RowMapper, this will return -1.
+ *
+ * @return the smallest value obtained from the RowMapper
+ * for the current set of selected TreePaths
*/
int getMinSelectionRow();
@@ -242,11 +267,17 @@
* Returns the largest value obtained from the RowMapper for the
* current set of selected TreePaths. If nothing is selected,
* or there is no RowMapper, this will return -1.
+ *
+ * @return the largest value obtained from the RowMapper
+ * for the current set of selected TreePaths
*/
int getMaxSelectionRow();
/**
* Returns true if the row identified by <code>row</code> is selected.
+ *
+ * @param row row to check
+ * @return whether the row is selected
*/
boolean isRowSelected(int row);
@@ -264,12 +295,16 @@
/**
* Returns the lead selection index. That is the last index that was
* added.
+ *
+ * @return the lead selection index
*/
int getLeadSelectionRow();
/**
* Returns the last path that was added. This may differ from the
* leadSelectionPath property maintained by the JTree.
+ *
+ * @return the last path that was added
*/
TreePath getLeadSelectionPath();
@@ -280,7 +315,7 @@
* A PropertyChangeEvent will get fired when the selection mode
* changes.
*
- * @param listener the PropertyChangeListener to be added
+ * @param listener the PropertyChangeListener to be added
*/
void addPropertyChangeListener(PropertyChangeListener listener);
@@ -289,7 +324,7 @@
* This removes a PropertyChangeListener that was registered
* for all properties.
*
- * @param listener the PropertyChangeListener to be removed
+ * @param listener the PropertyChangeListener to be removed
*/
void removePropertyChangeListener(PropertyChangeListener listener);
@@ -297,7 +332,7 @@
* Adds x to the list of listeners that are notified each time the
* set of selected TreePaths changes.
*
- * @param x the new listener to be added
+ * @param x the new listener to be added
*/
void addTreeSelectionListener(TreeSelectionListener x);
@@ -305,7 +340,7 @@
* Removes x from the list of listeners that are notified each time
* the set of selected TreePaths changes.
*
- * @param x the listener to remove
+ * @param x the listener to remove
*/
void removeTreeSelectionListener(TreeSelectionListener x);
}
--- a/jdk/src/share/classes/javax/swing/undo/CompoundEdit.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/undo/CompoundEdit.java Fri May 23 09:05:24 2014 -0700
@@ -82,6 +82,9 @@
* Returns the last <code>UndoableEdit</code> in
* <code>edits</code>, or <code>null</code>
* if <code>edits</code> is empty.
+ *
+ * @return the last {@code UndoableEdit} in {@code edits},
+ * or {@code null} if {@code edits} is empty.
*/
protected UndoableEdit lastEdit() {
int count = edits.size();
@@ -182,6 +185,7 @@
* received end. This generally means that edits are still being
* added to it.
*
+ * @return whether this edit is in progress
* @see #end
*/
public boolean isInProgress() {
--- a/jdk/src/share/classes/javax/swing/undo/StateEditable.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/undo/StateEditable.java Fri May 23 09:05:24 2014 -0700
@@ -43,12 +43,16 @@
/**
* Upon receiving this message the receiver should place any relevant
* state into <EM>state</EM>.
+ *
+ * @param state Hashtable object to store the state
*/
public void storeState(Hashtable<Object,Object> state);
/**
* Upon receiving this message the receiver should extract any relevant
* state out of <EM>state</EM>.
+ *
+ * @param state Hashtable object to restore the state from it
*/
public void restoreState(Hashtable<?,?> state);
} // End of interface StateEditable
--- a/jdk/src/share/classes/javax/swing/undo/UndoManager.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/undo/UndoManager.java Fri May 23 09:05:24 2014 -0700
@@ -326,6 +326,7 @@
* Undoes all changes from the index of the next edit to
* <code>edit</code>, updating the index of the next edit appropriately.
*
+ * @param edit the edit to be undo to
* @throws CannotUndoException if one of the edits throws
* <code>CannotUndoException</code>
*/
@@ -342,6 +343,7 @@
* Redoes all changes from the index of the next edit to
* <code>edit</code>, updating the index of the next edit appropriately.
*
+ * @param edit the edit to be redo to
* @throws CannotRedoException if one of the edits throws
* <code>CannotRedoException</code>
*/
--- a/jdk/src/share/classes/javax/swing/undo/UndoableEditSupport.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/undo/UndoableEditSupport.java Fri May 23 09:05:24 2014 -0700
@@ -96,6 +96,8 @@
* Called only from <code>postEdit</code> and <code>endUpdate</code>. Calls
* <code>undoableEditHappened</code> in all listeners. No synchronization
* is performed here, since the two calling methods are synchronized.
+ *
+ * @param e edit to be verified
*/
protected void _postEdit(UndoableEdit e) {
UndoableEditEvent ev = new UndoableEditEvent(realSource, e);
@@ -110,6 +112,8 @@
* DEADLOCK WARNING: Calling this method may call
* <code>undoableEditHappened</code> in all listeners.
* It is unwise to call this method from one of its listeners.
+ *
+ * @param e edit to be posted
*/
public synchronized void postEdit(UndoableEdit e) {
if (updateLevel == 0) {
@@ -142,6 +146,8 @@
/**
* Called only from <code>beginUpdate</code>.
* Exposed here for subclasses' use.
+ *
+ * @return new created {@code CompoundEdit} object
*/
protected CompoundEdit createCompoundEdit() {
return new CompoundEdit();
--- a/jdk/src/share/classes/jdk/internal/util/xml/BasicXmlPropertiesProvider.java Tue May 13 10:29:12 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.internal.util.xml;
-
-import java.util.Properties;
-import java.util.InvalidPropertiesFormatException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-
-import sun.util.spi.XmlPropertiesProvider;
-
-/**
- * A {@code XmlPropertiesProvider} implementation that uses the UKit XML parser.
- */
-
-public class BasicXmlPropertiesProvider extends XmlPropertiesProvider {
-
- public BasicXmlPropertiesProvider() { }
-
- @Override
- public void load(Properties props, InputStream in)
- throws IOException, InvalidPropertiesFormatException
- {
- PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
- handler.load(props, in);
- }
-
- @Override
- public void store(Properties props, OutputStream os, String comment,
- String encoding)
- throws IOException
- {
- PropertiesDefaultHandler handler = new PropertiesDefaultHandler();
- handler.store(props, os, comment, encoding);
- }
-}
--- a/jdk/src/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java Fri May 23 09:05:24 2014 -0700
@@ -123,7 +123,7 @@
writer.writeEndElement();
writer.writeEndDocument();
- writer.close();
+ writer.flush();
} catch (XMLStreamException e) {
if (e.getCause() instanceof UnsupportedEncodingException) {
throw (UnsupportedEncodingException) e.getCause();
--- a/jdk/src/share/classes/sun/misc/VM.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/sun/misc/VM.java Fri May 23 09:05:24 2014 -0700
@@ -370,7 +370,37 @@
/**
* Returns {@code true} if we are in a set UID program.
*/
- public static native boolean isSetUID();
+ public static boolean isSetUID() {
+ long uid = getuid();
+ long euid = geteuid();
+ long gid = getgid();
+ long egid = getegid();
+ return uid != euid || gid != egid;
+ }
+
+ /**
+ * Returns the real user ID of the calling process,
+ * or -1 if the value is not available.
+ */
+ public static native long getuid();
+
+ /**
+ * Returns the effective user ID of the calling process,
+ * or -1 if the value is not available.
+ */
+ public static native long geteuid();
+
+ /**
+ * Returns the real group ID of the calling process,
+ * or -1 if the value is not available.
+ */
+ public static native long getgid();
+
+ /**
+ * Returns the effective group ID of the calling process,
+ * or -1 if the value is not available.
+ */
+ public static native long getegid();
static {
initialize();
--- a/jdk/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Fri May 23 09:05:24 2014 -0700
@@ -34,8 +34,11 @@
import java.util.Random;
import sun.net.www.HeaderParser;
+import sun.net.NetProperties;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.security.PrivilegedAction;
+import java.security.AccessController;
import static sun.net.www.protocol.http.HttpURLConnection.HTTP_CONNECT;
/**
@@ -51,6 +54,23 @@
private String authMethod;
+ private final static String compatPropName = "http.auth.digest." +
+ "quoteParameters";
+
+ // true if http.auth.digest.quoteParameters Net property is true
+ private static final boolean delimCompatFlag;
+
+ static {
+ Boolean b = AccessController.doPrivileged(
+ new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ return NetProperties.getBoolean(compatPropName);
+ }
+ }
+ );
+ delimCompatFlag = (b == null) ? false : b.booleanValue();
+ }
+
// Authentication parameters defined in RFC2617.
// One instance of these may be shared among several DigestAuthentication
// instances as a result of a single authorization (for multiple domains)
@@ -206,7 +226,7 @@
}
/**
- * Reclaculates the request-digest and returns it.
+ * Recalculates the request-digest and returns it.
*
* <P> Used in the common case where the requestURI is simply the
* abs_path.
@@ -225,7 +245,7 @@
}
/**
- * Reclaculates the request-digest and returns it.
+ * Recalculates the request-digest and returns it.
*
* <P> Used when the requestURI is not the abs_path. The exact
* requestURI can be passed as a String.
@@ -357,24 +377,34 @@
ncfield = "\", nc=" + ncstring;
}
+ String algoS, qopS;
+
+ if (delimCompatFlag) {
+ // Put quotes around these String value parameters
+ algoS = ", algorithm=\"" + algorithm + "\"";
+ qopS = ", qop=\"auth\"";
+ } else {
+ // Don't put quotes around them, per the RFC
+ algoS = ", algorithm=" + algorithm;
+ qopS = ", qop=auth";
+ }
+
String value = authMethod
+ " username=\"" + pw.getUserName()
+ "\", realm=\"" + realm
+ "\", nonce=\"" + nonce
+ ncfield
+ ", uri=\"" + uri
- + "\", response=\"" + response
- + "\", algorithm=" + algorithm;
+ + "\", response=\"" + response + "\""
+ + algoS;
if (opaque != null) {
- value = value + ", opaque=\"" + opaque;
- value = value + "\"";
+ value += ", opaque=\"" + opaque + "\"";
}
if (cnonce != null) {
- value = value + ", cnonce=\"" + cnonce;
- value = value + "\"";
+ value += ", cnonce=\"" + cnonce + "\"";
}
if (qop) {
- value = value + ", qop=auth";
+ value += qopS;
}
return value;
}
--- a/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java Fri May 23 09:05:24 2014 -0700
@@ -75,7 +75,7 @@
if (ti.getTarget() == filter)
l.add(t);
}
- TypeAnnotation[] typeAnnotations = l.toArray(new TypeAnnotation[0]);
+ TypeAnnotation[] typeAnnotations = l.toArray(EMPTY_TYPE_ANNOTATION_ARRAY);
return AnnotatedTypeFactory.buildAnnotatedType(type,
LocationInfo.BASE_LOCATION,
typeAnnotations,
@@ -245,7 +245,6 @@
if (bounds != null) {
int startIndex = 0;
AnnotatedType[] res = new AnnotatedType[bounds.length];
- Arrays.fill(res, AnnotatedTypeFactory.EMPTY_ANNOTATED_TYPE);
// Adjust bounds index
//
@@ -276,12 +275,12 @@
tInfo.getCount() == typeVarIndex) {
l.add(t);
}
- res[i] = AnnotatedTypeFactory.buildAnnotatedType(bounds[i],
- loc,
- l.toArray(new TypeAnnotation[0]),
- candidates.toArray(new TypeAnnotation[0]),
- (AnnotatedElement)decl);
}
+ res[i] = AnnotatedTypeFactory.buildAnnotatedType(bounds[i],
+ loc,
+ l.toArray(EMPTY_TYPE_ANNOTATION_ARRAY),
+ candidates.toArray(EMPTY_TYPE_ANNOTATION_ARRAY),
+ (AnnotatedElement)decl);
}
return res;
}
--- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java Fri May 23 09:05:24 2014 -0700
@@ -39,7 +39,6 @@
import java.security.AccessController;
import java.util.*;
-import com.sun.security.auth.module.UnixSystem;
import sun.security.action.GetPropertyAction;
import sun.security.krb5.internal.KerberosTime;
import sun.security.krb5.internal.Krb5;
@@ -61,8 +60,7 @@
*
* service_euid
*
- * Java does not have a method to get euid, so uid is used instead. This
- * should normally to be since a Java program is seldom used as a setuid app.
+ * in which euid is available as sun.misc.VM.geteuid().
*
* The file has a header:
*
@@ -108,14 +106,8 @@
private static long uid;
static {
- try {
- // Available on Solaris, Linux and Mac. Otherwise, no _euid suffix
- UnixSystem us = new com.sun.security.auth.module.UnixSystem();
- uid = us.getUid();
- } catch (Throwable e) {
- // Cannot be only Exception, might be UnsatisfiedLinkError
- uid = -1;
- }
+ // Available on Solaris, Linux and Mac. Otherwise, -1 and no _euid suffix
+ uid = sun.misc.VM.geteuid();
}
public DflCache (String source) {
--- a/jdk/src/share/classes/sun/text/resources/es/FormatData_es_DO.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/sun/text/resources/es/FormatData_es_DO.java Fri May 23 09:05:24 2014 -0700
@@ -75,8 +75,8 @@
new String[] {
"EEEE d' de 'MMMM' de 'yyyy", // full date pattern
"d' de 'MMMM' de 'yyyy", // long date pattern
- "MM/dd/yyyy", // medium date pattern
- "MM/dd/yy", // short date pattern
+ "dd/MM/yyyy", // medium date pattern
+ "dd/MM/yy", // short date pattern
}
},
{ "DateTimePatterns",
--- a/jdk/src/share/classes/sun/tools/serialver/SerialVer.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/sun/tools/serialver/SerialVer.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,6 @@
package sun.tools.serialver;
import java.io.*;
-import java.awt.*;
-import java.applet.*;
import java.io.ObjectStreamClass;
import java.util.Properties;
import java.text.MessageFormat;
@@ -39,106 +37,7 @@
import java.util.StringTokenizer;
import sun.net.www.ParseUtil;
-public class SerialVer extends Applet {
- GridBagLayout gb;
- TextField classname_t;
- Button show_b;
- TextField serialversion_t;
- Label footer_l;
-
- private static final long serialVersionUID = 7666909783837760853L;
-
- public synchronized void init() {
- gb = new GridBagLayout();
- setLayout(gb);
-
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
-
- Label l1 = new Label(Res.getText("FullClassName"));
- l1.setAlignment(Label.RIGHT);
- gb.setConstraints(l1, c);
- add(l1);
-
- classname_t = new TextField(20);
- c.gridwidth = GridBagConstraints.RELATIVE;
- c.weightx = 1.0;
- gb.setConstraints(classname_t, c);
- add(classname_t);
-
- show_b = new Button(Res.getText("Show"));
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.weightx = 0.0; /* Don't grow the button */
- gb.setConstraints(show_b, c);
- add(show_b);
-
- Label l2 = new Label(Res.getText("SerialVersion"));
- l2.setAlignment(Label.RIGHT);
- c.gridwidth = 1;
- gb.setConstraints(l2, c);
- add(l2);
-
- serialversion_t = new TextField(50);
- serialversion_t.setEditable(false);
- c.gridwidth = GridBagConstraints.REMAINDER;
- gb.setConstraints(serialversion_t, c);
- add(serialversion_t);
-
- footer_l = new Label();
- c.gridwidth = GridBagConstraints.REMAINDER;
- gb.setConstraints(footer_l, c);
- add(footer_l);
-
- /* Give the focus to the type-in area */
- classname_t.requestFocus();
- }
-
- public void start() {
- /* Give the focus to the type-in area */
- classname_t.requestFocus();
- }
-
- @SuppressWarnings("deprecation")
- public boolean action(Event ev, Object obj) {
- if (ev.target == classname_t) {
- show((String)ev.arg);
- return true;
- } else if (ev.target == show_b) {
- show(classname_t.getText());
- return true;
- }
- return false;
- }
-
-
- @SuppressWarnings("deprecation")
- public boolean handleEvent(Event ev) {
- boolean rc = super.handleEvent(ev);
- return rc;
- }
-
- /**
- * Lookup the specified classname and display it.
- */
- void show(String classname) {
- try {
- footer_l.setText(""); // Clear the message
- serialversion_t.setText(""); // clear the last value
-
- if (classname.equals("")) {
- return;
- }
-
- String s = serialSyntax(classname);
- if (s != null) {
- serialversion_t.setText(s);
- } else {
- footer_l.setText(Res.getText("NotSerializable", classname));
- }
- } catch (ClassNotFoundException cnf) {
- footer_l.setText(Res.getText("ClassNotFound", classname));
- }
- }
+public class SerialVer {
/*
* A class loader that will load from the CLASSPATH environment
@@ -218,13 +117,7 @@
}
}
- @SuppressWarnings("deprecation")
- private static void showWindow(Window w) {
- w.show();
- }
-
public static void main(String[] args) {
- boolean show = false;
String envcp = null;
int i = 0;
@@ -234,9 +127,7 @@
}
for (i = 0; i < args.length; i++) {
- if (args[i].equals("-show")) {
- show = true;
- } else if (args[i].equals("-classpath")) {
+ if (args[i].equals("-classpath")) {
if ((i+1 == args.length) || args[i+1].startsWith("-")) {
System.err.println(Res.getText("error.missing.classpath"));
usage();
@@ -278,51 +169,35 @@
System.exit(3);
}
- if (!show) {
- /*
- * Check if there are any class names specified, if it is not a
- * invocation with the -show option.
- */
- if (i == args.length) {
- usage();
- System.exit(1);
- }
+ /*
+ * Check if there are any class names specified
+ */
+ if (i == args.length) {
+ usage();
+ System.exit(1);
+ }
- /*
- * The rest of the parameters are classnames.
- */
- boolean exitFlag = false;
- for (i = i; i < args.length; i++ ) {
- try {
- String syntax = serialSyntax(args[i]);
- if (syntax != null)
- System.out.println(args[i] + ":" + syntax);
- else {
- System.err.println(Res.getText("NotSerializable",
- args[i]));
- exitFlag = true;
- }
- } catch (ClassNotFoundException cnf) {
- System.err.println(Res.getText("ClassNotFound", args[i]));
+ /*
+ * The rest of the parameters are classnames.
+ */
+ boolean exitFlag = false;
+ for (i = i; i < args.length; i++ ) {
+ try {
+ String syntax = serialSyntax(args[i]);
+ if (syntax != null)
+ System.out.println(args[i] + ":" + syntax);
+ else {
+ System.err.println(Res.getText("NotSerializable",
+ args[i]));
exitFlag = true;
}
- }
- if (exitFlag) {
- System.exit(1);
- }
- } else {
- if (i < args.length) {
- System.err.println(Res.getText("ignoring.classes"));
- System.exit(1);
+ } catch (ClassNotFoundException cnf) {
+ System.err.println(Res.getText("ClassNotFound", args[i]));
+ exitFlag = true;
}
- Frame f = new SerialVerFrame();
- // f.setLayout(new FlowLayout());
- SerialVer sv = new SerialVer();
- sv.init();
-
- f.add("Center", sv);
- f.pack();
- showWindow(f);
+ }
+ if (exitFlag) {
+ System.exit(1);
}
}
@@ -337,65 +212,6 @@
}
/**
- * Top level frame so serialVer can be run as an main program
- * and have an exit menu item.
- */
-class SerialVerFrame extends Frame {
- MenuBar menu_mb;
- Menu file_m;
- MenuItem exit_i;
-
- private static final long serialVersionUID = -7248105987187532533L;
-
- /*
- * Construct a new Frame with title and menu.
- */
- SerialVerFrame() {
- super(Res.getText("SerialVersionInspector"));
-
- /* Create the file menu */
- file_m = new Menu(Res.getText("File"));
- file_m.add(exit_i = new MenuItem(Res.getText("Exit")));
-
- /* Now add the file menu to the menu bar */
- menu_mb = new MenuBar();
- menu_mb.add(file_m);
-
- /* Add the menubar to the frame */
- // Bug in JDK1.1 setMenuBar(menu_mb);
- }
-
- /*
- * Handle a window destroy event by exiting.
- */
- @SuppressWarnings("deprecation")
- public boolean handleEvent(Event e) {
- if (e.id == Event.WINDOW_DESTROY) {
- exit(0);
- }
- return super.handleEvent(e);
- }
- /*
- * Handle an Exit event by exiting.
- */
- @SuppressWarnings("deprecation")
- public boolean action(Event ev, Object obj) {
- if (ev.target == exit_i) {
- exit(0);
- }
- return false;
- }
-
- /*
- * Cleanup and exit.
- */
- void exit(int ret) {
- System.exit(ret);
- }
-
-}
-
-/**
* Utility for integrating with serialver and for localization.
* Handle Resources. Access to error and warning counts.
* Message formatting.
--- a/jdk/src/share/classes/sun/tools/serialver/resources/serialver.properties Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/classes/sun/tools/serialver/resources/serialver.properties Fri May 23 09:05:24 2014 -0700
@@ -1,9 +1,3 @@
-SerialVersionInspector=Serial Version Inspector
-File=File
-Exit=Exit
-Show=Show
-FullClassName=Full Class Name:
-SerialVersion=Serial Version:
NotSerializable=\
Class {0} is not Serializable.
ClassNotFound=\
@@ -14,7 +8,5 @@
Missing argument for -classpath option
invalid.flag=\
Invalid flag {0}.
-ignoring.classes=\
- Cannot specify class arguments with the -show option
usage=\
- use: serialver [-classpath classpath] [-show] [classname...]
+ use: serialver [-classpath classpath] [classname...]
--- a/jdk/src/share/classes/sun/util/spi/XmlPropertiesProvider.java Tue May 13 10:29:12 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.util.spi;
-
-import java.util.Properties;
-import java.util.InvalidPropertiesFormatException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * Service-provider class for loading and storing {@link Properites} in XML
- * format.
- *
- * @see Properties#loadFromXML
- * @see Properties#storeToXML
- */
-
-public abstract class XmlPropertiesProvider {
-
- /**
- * Initializes a new instance of this class.
- */
- protected XmlPropertiesProvider() {
- // do nothing for now
- }
-
- /**
- * Loads all of the properties represented by the XML document on the
- * specified input stream into a properties table.
- *
- * @param props the properties table to populate
- * @param in the input stream from which to read the XML document
- * @throws IOException if reading from the specified input stream fails
- * @throws java.io.UnsupportedEncodingException if the document's encoding
- * declaration can be read and it specifies an encoding that is not
- * supported
- * @throws InvalidPropertiesFormatException Data on input stream does not
- * constitute a valid XML document with the mandated document type.
- *
- * @see Properties#loadFromXML
- */
- public abstract void load(Properties props, InputStream in)
- throws IOException, InvalidPropertiesFormatException;
-
- /**
- * Emits an XML document representing all of the properties in a given
- * table.
- *
- * @param props the properies to store
- * @param out the output stream on which to emit the XML document.
- * @param comment a description of the property list, can be @{code null}
- * @param encoding the name of a supported character encoding
- *
- * @throws IOException if writing to the specified output stream fails
- * @throws java.io.UnsupportedEncodingException if the encoding is not
- * supported by the implementation
- * @throws NullPointerException if {@code out} is null.
- * @throws ClassCastException if this {@code Properties} object
- * contains any keys or values that are not
- * {@code Strings}.
- *
- * @see Properties#storeToXML
- */
- public abstract void store(Properties props, OutputStream out,
- String comment, String encoding)
- throws IOException;
-}
--- a/jdk/src/share/classes/sun/util/xml/META-INF/services/sun.util.spi.XmlPropertiesProvider Tue May 13 10:29:12 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-sun.util.xml.PlatformXmlPropertiesProvider
--- a/jdk/src/share/classes/sun/util/xml/PlatformXmlPropertiesProvider.java Tue May 13 10:29:12 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.util.xml;
-
-import java.io.*;
-import java.util.*;
-import java.nio.charset.*;
-import java.util.Map.Entry;
-import org.xml.sax.*;
-import org.w3c.dom.*;
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-import javax.xml.transform.stream.*;
-
-import sun.util.spi.XmlPropertiesProvider;
-
-/**
- * A {@code XmlPropertiesProvider} implementation that uses the JAXP API
- * for parsing.
- *
- * @author Michael McCloskey
- * @since 1.3
- */
-public class PlatformXmlPropertiesProvider extends XmlPropertiesProvider {
-
- // XML loading and saving methods for Properties
-
- // The required DTD URI for exported properties
- private static final String PROPS_DTD_URI =
- "http://java.sun.com/dtd/properties.dtd";
-
- private static final String PROPS_DTD =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<!-- DTD for properties -->" +
- "<!ELEMENT properties ( comment?, entry* ) >"+
- "<!ATTLIST properties" +
- " version CDATA #FIXED \"1.0\">" +
- "<!ELEMENT comment (#PCDATA) >" +
- "<!ELEMENT entry (#PCDATA) >" +
- "<!ATTLIST entry " +
- " key CDATA #REQUIRED>";
-
- /**
- * Version number for the format of exported properties files.
- */
- private static final String EXTERNAL_XML_VERSION = "1.0";
-
- @Override
- public void load(Properties props, InputStream in)
- throws IOException, InvalidPropertiesFormatException
- {
- Document doc = null;
- try {
- doc = getLoadingDoc(in);
- } catch (SAXException saxe) {
- throw new InvalidPropertiesFormatException(saxe);
- }
- Element propertiesElement = doc.getDocumentElement();
- String xmlVersion = propertiesElement.getAttribute("version");
- if (xmlVersion.compareTo(EXTERNAL_XML_VERSION) > 0)
- throw new InvalidPropertiesFormatException(
- "Exported Properties file format version " + xmlVersion +
- " is not supported. This java installation can read" +
- " versions " + EXTERNAL_XML_VERSION + " or older. You" +
- " may need to install a newer version of JDK.");
- importProperties(props, propertiesElement);
- }
-
- static Document getLoadingDoc(InputStream in)
- throws SAXException, IOException
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setIgnoringElementContentWhitespace(true);
- dbf.setValidating(true);
- dbf.setCoalescing(true);
- dbf.setIgnoringComments(true);
- try {
- DocumentBuilder db = dbf.newDocumentBuilder();
- db.setEntityResolver(new Resolver());
- db.setErrorHandler(new EH());
- InputSource is = new InputSource(in);
- return db.parse(is);
- } catch (ParserConfigurationException x) {
- throw new Error(x);
- }
- }
-
- static void importProperties(Properties props, Element propertiesElement) {
- NodeList entries = propertiesElement.getChildNodes();
- int numEntries = entries.getLength();
- int start = numEntries > 0 &&
- entries.item(0).getNodeName().equals("comment") ? 1 : 0;
- for (int i=start; i<numEntries; i++) {
- Element entry = (Element)entries.item(i);
- if (entry.hasAttribute("key")) {
- Node n = entry.getFirstChild();
- String val = (n == null) ? "" : n.getNodeValue();
- props.setProperty(entry.getAttribute("key"), val);
- }
- }
- }
-
- @Override
- public void store(Properties props, OutputStream os, String comment,
- String encoding)
- throws IOException
- {
- // fast-fail for unsupported charsets as UnsupportedEncodingException may
- // not be thrown later (see JDK-8000621)
- try {
- Charset.forName(encoding);
- } catch (IllegalCharsetNameException | UnsupportedCharsetException x) {
- throw new UnsupportedEncodingException(encoding);
- }
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db = null;
- try {
- db = dbf.newDocumentBuilder();
- } catch (ParserConfigurationException pce) {
- assert(false);
- }
- Document doc = db.newDocument();
- Element properties = (Element)
- doc.appendChild(doc.createElement("properties"));
-
- if (comment != null) {
- Element comments = (Element)properties.appendChild(
- doc.createElement("comment"));
- comments.appendChild(doc.createTextNode(comment));
- }
-
- synchronized (props) {
- for (Entry<Object, Object> e : props.entrySet()) {
- final Object k = e.getKey();
- final Object v = e.getValue();
- if (k instanceof String && v instanceof String) {
- Element entry = (Element)properties.appendChild(
- doc.createElement("entry"));
- entry.setAttribute("key", (String)k);
- entry.appendChild(doc.createTextNode((String)v));
- }
- }
- }
- emitDocument(doc, os, encoding);
- }
-
- static void emitDocument(Document doc, OutputStream os, String encoding)
- throws IOException
- {
- TransformerFactory tf = TransformerFactory.newInstance();
- Transformer t = null;
- try {
- t = tf.newTransformer();
- t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, PROPS_DTD_URI);
- t.setOutputProperty(OutputKeys.INDENT, "yes");
- t.setOutputProperty(OutputKeys.METHOD, "xml");
- t.setOutputProperty(OutputKeys.ENCODING, encoding);
- } catch (TransformerConfigurationException tce) {
- assert(false);
- }
- DOMSource doms = new DOMSource(doc);
- StreamResult sr = new StreamResult(os);
- try {
- t.transform(doms, sr);
- } catch (TransformerException te) {
- throw new IOException(te);
- }
- }
-
- private static class Resolver implements EntityResolver {
- public InputSource resolveEntity(String pid, String sid)
- throws SAXException
- {
- if (sid.equals(PROPS_DTD_URI)) {
- InputSource is;
- is = new InputSource(new StringReader(PROPS_DTD));
- is.setSystemId(PROPS_DTD_URI);
- return is;
- }
- throw new SAXException("Invalid system identifier: " + sid);
- }
- }
-
- private static class EH implements ErrorHandler {
- public void error(SAXParseException x) throws SAXException {
- throw x;
- }
- public void fatalError(SAXParseException x) throws SAXException {
- throw x;
- }
- public void warning(SAXParseException x) throws SAXException {
- throw x;
- }
- }
-
-}
--- a/jdk/src/share/lib/security/sunpkcs11-solaris.cfg Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/lib/security/sunpkcs11-solaris.cfg Fri May 23 09:05:24 2014 -0700
@@ -18,16 +18,6 @@
disabledMechanisms = {
CKM_DSA_KEY_PAIR_GEN
-# the following mechanisms are disabled due to CKR_SAVED_STATE_INVALID bug
-# (Solaris bug 7058108)
- CKM_MD2
- CKM_MD5
- CKM_SHA_1
-# the following mechanisms are disabled due to no cloning support
-# (Solaris bug 7050617)
- CKM_SHA256
- CKM_SHA384
- CKM_SHA512
# the following mechanisms are disabled due to performance issues
# (Solaris bug 6337157)
CKM_DSA_SHA1
--- a/jdk/src/share/native/java/util/TimeZone.c Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/native/java/util/TimeZone.c Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,42 +38,28 @@
*/
JNIEXPORT jstring JNICALL
Java_java_util_TimeZone_getSystemTimeZoneID(JNIEnv *env, jclass ign,
- jstring java_home, jstring country)
+ jstring java_home)
{
- const char *cname;
const char *java_home_dir;
char *javaTZ;
+ jstring jstrJavaTZ = NULL;
- if (java_home == NULL)
- return NULL;
+ CHECK_NULL_RETURN(java_home, NULL);
java_home_dir = JNU_GetStringPlatformChars(env, java_home, 0);
- if (java_home_dir == NULL)
- return NULL;
-
- if (country != NULL) {
- cname = JNU_GetStringPlatformChars(env, country, 0);
- /* ignore error cases for cname */
- } else {
- cname = NULL;
- }
+ CHECK_NULL_RETURN(java_home_dir, NULL);
/*
* Invoke platform dependent mapping function
*/
- javaTZ = findJavaTZ_md(java_home_dir, cname);
-
- free((void *)java_home_dir);
- if (cname != NULL) {
- free((void *)cname);
+ javaTZ = findJavaTZ_md(java_home_dir);
+ if (javaTZ != NULL) {
+ jstrJavaTZ = JNU_NewStringPlatform(env, javaTZ);
+ free((void *)javaTZ);
}
- if (javaTZ != NULL) {
- jstring jstrJavaTZ = JNU_NewStringPlatform(env, javaTZ);
- free((void *)javaTZ);
- return jstrJavaTZ;
- }
- return NULL;
+ JNU_ReleaseStringPlatformChars(env, java_home, java_home_dir);
+ return jstrJavaTZ;
}
/*
--- a/jdk/src/share/native/sun/security/smartcardio/pcsc.c Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/native/sun/security/smartcardio/pcsc.c Fri May 23 09:05:24 2014 -0700
@@ -108,7 +108,7 @@
JNIEXPORT jlong JNICALL Java_sun_security_smartcardio_PCSC_SCardEstablishContext
(JNIEnv *env, jclass thisClass, jint dwScope)
{
- SCARDCONTEXT context;
+ SCARDCONTEXT context = 0;
LONG rv;
dprintf("-establishContext\n");
rv = CALL_SCardEstablishContext(dwScope, NULL, NULL, &context);
@@ -180,7 +180,7 @@
SCARDCONTEXT context = (SCARDCONTEXT)jContext;
LONG rv;
LPTSTR mszReaders;
- DWORD size;
+ DWORD size = 0;
jobjectArray result;
dprintf1("-context: %x\n", context);
@@ -215,8 +215,8 @@
SCARDCONTEXT context = (SCARDCONTEXT)jContext;
LONG rv;
LPCTSTR readerName;
- SCARDHANDLE card;
- DWORD proto;
+ SCARDHANDLE card = 0;
+ DWORD proto = 0;
readerName = (*env)->GetStringUTFChars(env, jReaderName, NULL);
if (readerName == NULL) {
@@ -280,8 +280,8 @@
DWORD readerLen = READERNAME_BUFFER_SIZE;
unsigned char atr[ATR_BUFFER_SIZE];
DWORD atrLen = ATR_BUFFER_SIZE;
- DWORD state;
- DWORD protocol;
+ DWORD state = 0;
+ DWORD protocol = 0;
jbyteArray jArray;
jbyte status[2];
--- a/jdk/src/share/transport/socket/socketTransport.c Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/share/transport/socket/socketTransport.c Fri May 23 09:05:24 2014 -0700
@@ -31,6 +31,11 @@
#include "jdwpTransport.h"
#include "sysSocket.h"
+#ifdef _WIN32
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+#endif
+
/*
* The Socket Transport Library.
*
@@ -189,23 +194,83 @@
return JDWPTRANSPORT_ERROR_NONE;
}
+static uint32_t
+getLocalHostAddress() {
+ // Simple routine to guess localhost address.
+ // it looks up "localhost" and returns 127.0.0.1 if lookup
+ // fails.
+ struct addrinfo hints, *res = NULL;
+ int err;
+
+ // Use portable way to initialize the structure
+ memset((void *)&hints, 0, sizeof(hints));
+ hints.ai_family = AF_INET;
+
+ err = getaddrinfo("localhost", NULL, &hints, &res);
+ if (err < 0 || res == NULL) {
+ return dbgsysHostToNetworkLong(INADDR_LOOPBACK);
+ }
+
+ // getaddrinfo might return more than one address
+ // but we are using first one only
+ return ((struct sockaddr_in *)(res->ai_addr))->sin_addr.s_addr;
+}
+
+static int
+getPortNumber(const char *s_port) {
+ u_long n;
+ char *eptr;
+
+ if (*s_port == 0) {
+ // bad address - colon with no port number in parameters
+ return -1;
+ }
+
+ n = strtoul(s_port, &eptr, 10);
+ if (eptr != s_port + strlen(s_port)) {
+ // incomplete conversion - port number contains non-digit
+ return -1;
+ }
+
+ if (n > (u_short) -1) {
+ // check that value supplied by user is less than
+ // maximum possible u_short value (65535) and
+ // will not be truncated later.
+ return -1;
+ }
+
+ return n;
+}
+
static jdwpTransportError
-parseAddress(const char *address, struct sockaddr_in *sa, uint32_t defaultHost) {
+parseAddress(const char *address, struct sockaddr_in *sa) {
char *colon;
+ int port;
memset((void *)sa,0,sizeof(struct sockaddr_in));
sa->sin_family = AF_INET;
/* check for host:port or port */
colon = strchr(address, ':');
+ port = getPortNumber((colon == NULL) ? address : colon +1);
+ if (port < 0) {
+ RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT, "invalid port number specified");
+ }
+ sa->sin_port = dbgsysHostToNetworkShort((u_short)port);
+
if (colon == NULL) {
- u_short port = (u_short)atoi(address);
- sa->sin_port = dbgsysHostToNetworkShort(port);
- sa->sin_addr.s_addr = dbgsysHostToNetworkLong(defaultHost);
- } else {
+ // bind to localhost only if no address specified
+ sa->sin_addr.s_addr = getLocalHostAddress();
+ } else if (strncmp(address,"localhost:",10) == 0) {
+ // optimize for common case
+ sa->sin_addr.s_addr = getLocalHostAddress();
+ } else if (*address == '*' && *(address+1) == ':') {
+ // we are explicitly asked to bind server to all available IP addresses
+ // has no meaning for client.
+ sa->sin_addr.s_addr = dbgsysHostToNetworkLong(INADDR_ANY);
+ } else {
char *buf;
char *hostname;
- u_short port;
uint32_t addr;
buf = (*callback->alloc)((int)strlen(address)+1);
@@ -215,8 +280,6 @@
strcpy(buf, address);
buf[colon - address] = '\0';
hostname = buf;
- port = atoi(colon + 1);
- sa->sin_port = dbgsysHostToNetworkShort(port);
/*
* First see if the host is a literal IP address.
@@ -277,7 +340,7 @@
address = "0";
}
- err = parseAddress(address, &sa, INADDR_ANY);
+ err = parseAddress(address, &sa);
if (err != JDWPTRANSPORT_ERROR_NONE) {
return err;
}
@@ -437,7 +500,7 @@
RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT, "address is missing");
}
- err = parseAddress(addressString, &sa, 0x7f000001);
+ err = parseAddress(addressString, &sa);
if (err != JDWPTRANSPORT_ERROR_NONE) {
return err;
}
--- a/jdk/src/solaris/native/java/util/TimeZone_md.c Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/solaris/native/java/util/TimeZone_md.c Fri May 23 09:05:24 2014 -0700
@@ -652,11 +652,11 @@
* using <java_home>/lib/tzmappings. If the TZ value is not found, it
* trys some libc implementation dependent mappings. If it still
* can't map to a Java time zone ID, it falls back to the GMT+/-hh:mm
- * form. `country', which can be null, is not used for UNIX platforms.
+ * form.
*/
/*ARGSUSED1*/
char *
-findJavaTZ_md(const char *java_home_dir, const char *country)
+findJavaTZ_md(const char *java_home_dir)
{
char *tz;
char *javatz = NULL;
--- a/jdk/src/solaris/native/java/util/TimeZone_md.h Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/solaris/native/java/util/TimeZone_md.h Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
#ifndef _TIMEZONE_MD_H
#define _TIMEZONE_MD_H
-char *findJavaTZ_md(const char *java_home_dir, const char *region);
+char *findJavaTZ_md(const char *java_home_dir);
char *getGMTOffsetID();
#endif
--- a/jdk/src/solaris/native/sun/misc/VM_md.c Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/solaris/native/sun/misc/VM_md.c Fri May 23 09:05:24 2014 -0700
@@ -27,12 +27,26 @@
#include "jni_util.h"
-JNIEXPORT jboolean JNICALL
-Java_sun_misc_VM_isSetUID(JNIEnv *env, jclass thisclass) {
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
+
+ return getuid();
+}
+
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
+
+ return geteuid();
+}
- /* Return true if we are in a set UID or set GID process. */
- if (getuid() != geteuid() || getgid() != getegid()) {
- return JNI_TRUE;
- }
- return JNI_FALSE;
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
+
+ return getgid();
}
+
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
+
+ return getegid();
+}
--- a/jdk/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h Fri May 23 09:05:24 2014 -0700
@@ -62,6 +62,8 @@
#define MAX_ATR_SIZE 33 /* Maximum ATR size */
+#ifndef __APPLE__
+
typedef struct
{
const char *szReader;
@@ -73,6 +75,23 @@
}
SCARD_READERSTATE_A;
+#else // __APPLE__
+
+#pragma pack(1)
+typedef struct
+{
+ const char *szReader;
+ void *pvUserData;
+ uint32_t dwCurrentState;
+ uint32_t dwEventState;
+ uint32_t cbAtr;
+ unsigned char rgbAtr[MAX_ATR_SIZE];
+}
+SCARD_READERSTATE_A;
+#pragma pack()
+
+#endif // __APPLE__
+
typedef SCARD_READERSTATE_A SCARD_READERSTATE, *PSCARD_READERSTATE_A,
*LPSCARD_READERSTATE_A;
--- a/jdk/src/windows/native/java/util/TimeZone_md.c Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/windows/native/java/util/TimeZone_md.c Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -394,31 +394,34 @@
*
* value_type is one of the following values:
* VALUE_KEY for exact key matching
- * VALUE_MAPID for MapID and country-based mapping (this is
+ * VALUE_MAPID for MapID (this is
* required for the old Windows, such as NT 4.0 SP3).
*/
static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName,
- char *mapID, const char *country)
+ char *mapID)
{
int line;
int IDmatched = 0;
FILE *fp;
char *javaTZName = NULL;
char *items[TZ_NITEMS];
- char mapFileName[_MAX_PATH + 1];
+ char *mapFileName;
char lineBuffer[MAX_ZONE_CHAR * 4];
- char bestMatch[MAX_ZONE_CHAR];
- int noMapID = *mapID == '\0'; /* no mapID on Vista */
+ int noMapID = *mapID == '\0'; /* no mapID on Vista and later */
- bestMatch[0] = '\0';
-
+ mapFileName = malloc(strlen(java_home_dir) + strlen(MAPPINGS_FILE) + 1);
+ if (mapFileName == NULL) {
+ return NULL;
+ }
strcpy(mapFileName, java_home_dir);
strcat(mapFileName, MAPPINGS_FILE);
if ((fp = fopen(mapFileName, "r")) == NULL) {
jio_fprintf(stderr, "can't open %s.\n", mapFileName);
+ free((void *) mapFileName);
return NULL;
}
+ free((void *) mapFileName);
line = 0;
while (fgets(lineBuffer, sizeof(lineBuffer), fp) != NULL) {
@@ -469,18 +472,6 @@
javaTZName = _strdup(items[TZ_JAVA_NAME]);
break;
}
- /*
- * Try to find the most likely time zone.
- */
- if (*items[TZ_REGION] == '\0') {
- strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR);
- } else if (country != NULL && strcmp(items[TZ_REGION], country) == 0) {
- if (value_type == VALUE_MAPID) {
- javaTZName = _strdup(items[TZ_JAVA_NAME]);
- break;
- }
- strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR);
- }
} else {
if (IDmatched == 1) {
/*
@@ -492,9 +483,6 @@
}
fclose(fp);
- if (javaTZName == NULL && bestMatch[0] != '\0') {
- javaTZName = _strdup(bestMatch);
- }
return javaTZName;
illegal_format:
@@ -506,7 +494,7 @@
/*
* Detects the platform time zone which maps to a Java time zone ID.
*/
-char *findJavaTZ_md(const char *java_home_dir, const char *country)
+char *findJavaTZ_md(const char *java_home_dir)
{
char winZoneName[MAX_ZONE_CHAR];
char winMapID[MAX_MAPID_LENGTH];
@@ -521,7 +509,7 @@
std_timezone = _strdup(winZoneName);
} else {
std_timezone = matchJavaTZ(java_home_dir, result,
- winZoneName, winMapID, country);
+ winZoneName, winMapID);
}
}
--- a/jdk/src/windows/native/java/util/TimeZone_md.h Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/windows/native/java/util/TimeZone_md.h Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
#ifndef _TIMEZONE_MD_H
#define _TIMEZONE_MD_H
-char *findJavaTZ_md(const char *java_home_dir, const char *region);
+char *findJavaTZ_md(const char *java_home_dir);
char *getGMTOffsetID();
#endif
--- a/jdk/src/windows/native/sun/misc/VM_md.c Tue May 13 10:29:12 2014 -0700
+++ b/jdk/src/windows/native/sun/misc/VM_md.c Fri May 23 09:05:24 2014 -0700
@@ -26,9 +26,30 @@
#include "jni_util.h"
-JNIEXPORT jboolean JNICALL
-Java_sun_misc_VM_isSetUID(JNIEnv *env, jclass thisclass) {
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
+
+ /* -1 means function not available. */
+ return -1;
+}
+
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
+
+ /* -1 means function not available. */
+ return -1;
+}
- /* There is no set UID on Windows. */
- return JNI_FALSE;
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
+
+ /* -1 means function not available. */
+ return -1;
}
+
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
+
+ /* -1 means function not available. */
+ return -1;
+}
--- a/jdk/test/com/sun/jdi/BadHandshakeTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/com/sun/jdi/BadHandshakeTest.java Fri May 23 09:05:24 2014 -0700
@@ -26,7 +26,7 @@
* @summary Check that a bad handshake doesn't cause a debuggee to abort
* @library /lib/testlibrary
*
- * @build VMConnection BadHandshakeTest Exit0
+ * @build jdk.testlibrary.* VMConnection BadHandshakeTest Exit0
* @run main BadHandshakeTest
*
*/
@@ -110,12 +110,12 @@
}
// Connect to the debuggee and handshake with garbage
- Socket s = new Socket(InetAddress.getLocalHost(), port);
+ Socket s = new Socket("localhost", port);
s.getOutputStream().write("Here's a poke in the eye".getBytes("UTF-8"));
s.close();
// Re-connect and to a partial handshake - don't disconnect
- s = new Socket(InetAddress.getLocalHost(), port);
+ s = new Socket("localhost", port);
s.getOutputStream().write("JDWP-".getBytes("UTF-8"));
--- a/jdk/test/com/sun/jdi/ExclusiveBind.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/com/sun/jdi/ExclusiveBind.java Fri May 23 09:05:24 2014 -0700
@@ -27,8 +27,7 @@
* at the same time.
* @library /lib/testlibrary
*
- * @build jdk.testlibrary.ProcessTools jdk.testlibrary.JDKToolLauncher jdk.testlibrary.Utils
- * @build VMConnection ExclusiveBind HelloWorld
+ * @build jdk.testlibrary.* VMConnection ExclusiveBind HelloWorld
* @run main ExclusiveBind
*/
import java.net.ServerSocket;
--- a/jdk/test/com/sun/jdi/OptionTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/com/sun/jdi/OptionTest.java Fri May 23 09:05:24 2014 -0700
@@ -157,6 +157,37 @@
throw new Exception("Test failed: jdwp doesn't like " + cmds[1]);
}
}
+
+ System.out.println("Testing invalid address string");
+
+ // Test invalid addresses
+ String badAddresses[] = {
+ ":",
+ "localhost:",
+ "localhost:abc",
+ "localhost:65536",
+ "localhost:65F"
+ };
+
+ for (String badAddress : badAddresses) {
+
+ String badOptions = "transport=dt_socket" +
+ ",address=" + badAddress +
+ ",server=y" +
+ ",suspend=n";
+ String cmds[] = {javaExe, "-agentlib:jdwp=" + badOptions, targetClass};
+ OptionTest myTest = new OptionTest();
+ String results[] = myTest.run(VMConnection.insertDebuggeeVMOptions(cmds));
+
+ if (!results[RETSTAT].equals("0") && results[STDERR].startsWith("ERROR:")) {
+ // We got expected error, test passed
+ }
+ else {
+ throw new Exception("Test failed: jdwp accept invalid address '" + badAddress + "'");
+ }
+ }
+
System.out.println("Test passed: status = 0");
}
}
+
--- a/jdk/test/com/sun/jdi/RunToExit.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/com/sun/jdi/RunToExit.java Fri May 23 09:05:24 2014 -0700
@@ -161,6 +161,9 @@
Connector.IntegerArgument port_arg =
(Connector.IntegerArgument)conn_args.get("port");
port_arg.setValue(port);
+
+ System.out.println("Connection arguments: " + conn_args);
+
VirtualMachine vm = conn.attach(conn_args);
// The first event is always a VMStartEvent, and it is always in
--- a/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -64,11 +64,12 @@
env.put(Context.SECURITY_PRINCIPAL, "user");
env.put(Context.SECURITY_CREDENTIALS, "password");
- env.put("com.sun.jndi.ldap.connect.timeout", "10");
- env.put("com.sun.jndi.ldap.read.timeout", "3000");
-
InitialContext ctx = null;
try {
+ new LdapTimeoutTest().deadServerNoTimeout(env);
+
+ env.put("com.sun.jndi.ldap.connect.timeout", "10");
+ env.put("com.sun.jndi.ldap.read.timeout", "3000");
new LdapTimeoutTest().ldapReadTimeoutTest(env, false);
new LdapTimeoutTest().ldapReadTimeoutTest(env, true);
new LdapTimeoutTest().simpleAuthConnectTest(env);
@@ -84,7 +85,7 @@
void ldapReadTimeoutTest(Hashtable env, boolean ssl) {
InitialContext ctx = null;
if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl");
- ScheduledFuture killer = killSwitch();
+ ScheduledFuture killer = killSwitch(5000);
long start = System.nanoTime();
try {
ctx = new InitialDirContext(env);
@@ -112,7 +113,7 @@
void simpleAuthConnectTest(Hashtable env) {
InitialContext ctx = null;
- ScheduledFuture killer = killSwitch();
+ ScheduledFuture killer = killSwitch(5000);
long start = System.nanoTime();
try {
ctx = new InitialDirContext(env);
@@ -139,6 +140,32 @@
}
}
+ void deadServerNoTimeout(Hashtable env) {
+ InitialContext ctx = null;
+ ScheduledFuture killer = killSwitch(30000);
+ long start = System.nanoTime();
+ try {
+ ctx = new InitialDirContext(env);
+ SearchControls scl = new SearchControls();
+ scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+ NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
+ .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
+ // shouldn't reach here
+ fail();
+ } catch (NamingException e) {
+ long end = System.nanoTime();
+ if (TimeUnit.NANOSECONDS.toMillis(end - start) < 14000) {
+ System.err.println("fail: timeout should be at least 15 seconds, actual time: "
+ + TimeUnit.NANOSECONDS.toMillis(end - start));
+ fail();
+ } else {
+ pass();
+ }
+ } finally {
+ if (!shutItDown(killer, ctx)) fail();
+ }
+ }
+
boolean shutItDown(ScheduledFuture killer, InitialContext ctx) {
killer.cancel(true);
try {
@@ -149,15 +176,15 @@
}
}
- ScheduledFuture killSwitch() {
+ ScheduledFuture killSwitch(int ms) {
final Thread current = Thread.currentThread();
return LdapTimeoutTest.pool.schedule(new Callable<Void>() {
public Void call() throws Exception {
System.err.println("Fail: killSwitch()");
- current.interrupt();
+ System.exit(0);
return null;
}
- }, 5000, TimeUnit.MILLISECONDS);
+ }, ms, TimeUnit.MILLISECONDS);
}
static class Server extends Thread {
--- a/jdk/test/com/sun/tools/attach/TempDirTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java Fri May 23 09:05:24 2014 -0700
@@ -38,8 +38,8 @@
* @bug 8033104
* @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
* @library /lib/testlibrary
- * @run build Application Shutdown RunnerUtil
- * @run main/timeout=10 TempDirTest
+ * @run build jdk.testlibrary.* Application Shutdown RunnerUtil
+ * @run main TempDirTest
*/
public class TempDirTest {
--- a/jdk/test/demo/jvmti/mtrace/JFrameCreateTime.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/demo/jvmti/mtrace/JFrameCreateTime.java Fri May 23 09:05:24 2014 -0700
@@ -32,24 +32,28 @@
* was very slow (VisualMust debugger people reported this).
*/
+import java.awt.GraphicsEnvironment;
import javax.swing.*;
public class JFrameCreateTime {
public static void main(String[] args) {
JFrame f;
long start, end;
-
- start = System.currentTimeMillis();
- f = new JFrame("JFrame");
- end = System.currentTimeMillis();
-
- System.out.println("JFrame first creation took " + (end - start) + " ms");
+ if (GraphicsEnvironment.isHeadless()) {
+ System.out.println("JFrameCreateTime test was skipped due to headless mode");
+ } else {
+ start = System.currentTimeMillis();
+ f = new JFrame("JFrame");
+ end = System.currentTimeMillis();
- start = System.currentTimeMillis();
- f = new JFrame("JFrame");
- end = System.currentTimeMillis();
+ System.out.println("JFrame first creation took " + (end - start) + " ms");
- System.out.println("JFrame second creation took " + (end - start) + " ms");
- System.exit(0);
+ start = System.currentTimeMillis();
+ f = new JFrame("JFrame");
+ end = System.currentTimeMillis();
+
+ System.out.println("JFrame second creation took " + (end - start) + " ms");
+ System.exit(0);
+ }
}
}
--- a/jdk/test/demo/jvmti/mtrace/TraceJFrame.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/demo/jvmti/mtrace/TraceJFrame.java Fri May 23 09:05:24 2014 -0700
@@ -37,7 +37,7 @@
public class TraceJFrame {
public static void main(String args[]) throws Exception {
if (GraphicsEnvironment.isHeadless()) {
- System.out.println("JFrame test was skipped due to headless mode");
+ System.out.println("TraceJFrame test was skipped due to headless mode");
} else {
DemoRun demo;
--- a/jdk/test/java/lang/String/ToLowerCase.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/java/lang/String/ToLowerCase.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
@test
- @bug 4217441 4533872 4900935 8020037 8032012
+ @bug 4217441 4533872 4900935 8020037 8032012 8041791
@summary toLowerCase should lower-case Greek Sigma correctly depending
on the context (final/non-final). Also it should handle
Locale specific (lt, tr, and az) lowercasings and supplementary
@@ -72,8 +72,10 @@
// I-dot tests
test("\u0130", turkish, "i");
test("\u0130", az, "i");
- test("\u0130", lt, "i");
- test("\u0130", Locale.US, "i");
+ test("\u0130", lt, "\u0069\u0307");
+ test("\u0130", Locale.US, "\u0069\u0307");
+ test("\u0130", Locale.JAPAN, "\u0069\u0307");
+ test("\u0130", Locale.ROOT, "\u0069\u0307");
// Remove dot_above in the sequence I + dot_above (Turkish and Azeri)
test("I\u0307", turkish, "i");
@@ -111,6 +113,12 @@
if (cp >= Character.MIN_HIGH_SURROGATE && cp <= Character.MAX_HIGH_SURROGATE) {
continue;
}
+ if (cp == 0x0130) {
+ // Although UnicodeData.txt has the lower case char as \u0069, it should be
+ // handled with the rules in SpecialCasing.txt, i.e., \u0069\u0307 in
+ // non Turkic locales.
+ continue;
+ }
int lowerCase = Character.toLowerCase(cp);
if (lowerCase == -1) { //Character.ERROR
continue;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/annotation/TypeVariableBounds.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8038994
+ * @summary Test that getAnnotatedBounds().getType() match getBounds()
+ * @run testng TypeVariableBounds
+ */
+
+import java.io.Serializable;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.concurrent.Callable;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+public class TypeVariableBounds {
+ @Test(dataProvider = "classData")
+ public void testClass(Class<?> c) throws Exception {
+ assertNotEquals(c.getTypeParameters().length, 0);
+
+ TypeVariable[] tv = c.getTypeParameters();
+
+ for(TypeVariable t : tv)
+ testTv(t);
+
+ }
+
+ @Test(dataProvider = "methodData")
+ public void testMethod(Class<?>c) throws Exception {
+ Method m = c.getMethod("aMethod");
+ TypeVariable[] tv = m.getTypeParameters();
+
+ for(TypeVariable t : tv)
+ testTv(t);
+
+ }
+
+ public void testTv(TypeVariable<?> tv) {
+ Type[] t = tv.getBounds();
+ AnnotatedType[] at = tv.getAnnotatedBounds();
+
+ assertEquals(t.length, at.length, Arrays.asList(t) + " and " + Arrays.asList(at) + " should be the same length");
+
+ for (int i = 0; i < t.length; i++)
+ assertSame(at[i].getType(), t[i], "T: " + t[i] + ", AT: " + at[i] + ", AT.getType(): " + at[i].getType() + "\n");
+ }
+
+ @DataProvider
+ public Object[][] classData() { return CLASS_TESTS; }
+
+ @DataProvider
+ public Object[][] methodData() { return METHOD_TESTS; }
+
+ public static final Object[][] CLASS_TESTS = {
+ { Case1.class, },
+ { Case2.class, },
+ { Case5.class, },
+ { Case6.class, },
+ };
+
+ public static final Object[][] METHOD_TESTS = {
+ { Case3.class, },
+ { Case4.class, },
+ { Case5.class, },
+ { Case6.class, },
+ };
+
+ // Class type var
+ public static class Case1<C1T1, C1T2 extends AnnotatedElement, C1T3 extends AnnotatedElement & Type & Serializable> {}
+ public static class Case2<C2T0, @TA C2T1 extends Type, C2T2 extends @TB AnnotatedElement, C2T3 extends AnnotatedElement & @TB Type & Serializable> {}
+
+ // Method type var
+ public static class Case3 { public <C3T1, C3T2 extends AnnotatedElement, C3T3 extends AnnotatedElement & Type & Serializable> void aMethod() {}}
+ public static class Case4 { public <C4T0, @TA C4T1 extends List, C4T2 extends @TB Set, C4T3 extends Set & @TB Callable & Serializable> void aMethod() {}}
+
+ // Both
+ public static class Case5 <C5CT1, C5CT2 extends Runnable> {
+ public <C5MT1,
+ C5MT2 extends AnnotatedElement,
+ C5MT3 extends AnnotatedElement & Type & Serializable,
+ C5MT4 extends C5CT2>
+ void aMethod() {}}
+
+ public static class Case6 <@TA C6CT1, C6CT2 extends @TB Runnable> {
+ public <@TA C6MT1,
+ C6MT2 extends @TB AnnotatedElement,
+ C6MT3 extends @TB AnnotatedElement & @TB2 Type & Serializable,
+ C6MT4 extends @TB2 C6CT2>
+ void aMethod() {}}
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE_PARAMETER)
+ public @interface TA {}
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE_USE)
+ public @interface TB {}
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.TYPE_USE)
+ public @interface TB2 {}
+}
--- a/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThread.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThread.java Fri May 23 09:05:24 2014 -0700
@@ -26,7 +26,7 @@
* @summary Assert in java.lang.instrument agents during shutdown when classloading occurs after shutdown
* @library /lib/testlibrary
*
- * @build DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
+ * @build jdk.testlibrary.* DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
* @run shell ../MakeJAR3.sh DummyAgent
* @run main TestDaemonThreadLauncher /timeout=240
*
--- a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java Fri May 23 09:05:24 2014 -0700
@@ -33,7 +33,7 @@
* @author Mandy Chung
*
* @library /lib/testlibrary/
- * @build ResetPeakMemoryUsage MemoryUtil RunUtil
+ * @build jdk.testlibrary.* ResetPeakMemoryUsage MemoryUtil RunUtil
* @run main ResetPeakMemoryUsage
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/Authenticator/B8034170.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * @test
+ * @bug 8034170
+ * @summary Digest authentication interop issue
+ * @run main/othervm B8034170 unquoted
+ * @run main/othervm -Dhttp.auth.digest.quoteParameters=true B8034170 quoted
+ */
+
+public class B8034170 {
+
+ static boolean expectQuotes;
+
+ static class BasicServer extends Thread {
+
+ ServerSocket server;
+
+ Socket s;
+ InputStream is;
+ OutputStream os;
+
+ static final String realm = "wallyworld";
+
+ String reply1 = "HTTP/1.1 401 Unauthorized\r\n"+
+ "WWW-Authenticate: Digest realm=\""+realm+"\", qop=\"auth\"" +
+ ", nonce=\"8989de95ea2402b64d73cecdb15da255\"" +
+ ", opaque=\"bbfb4c9ee92ddccc73521c3e6e841ba2\"\r\n\r\n";
+
+ String OKreply = "HTTP/1.1 200 OK\r\n"+
+ "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" +
+ "Server: Apache/1.3.14 (Unix)\r\n" +
+ "Connection: close\r\n" +
+ "Content-Type: text/plain; charset=iso-8859-1\r\n" +
+ "Content-Length: 10\r\n\r\n";
+
+ String ERRreply = "HTTP/1.1 500 Internal server error\r\n"+
+ "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" +
+ "Server: Apache/1.3.14 (Unix)\r\n" +
+ "Connection: close\r\n" +
+ "Content-Length: 0\r\n\r\n";
+
+ BasicServer (ServerSocket s) {
+ server = s;
+ }
+
+ int readAll (Socket s, byte[] buf) throws IOException {
+ int pos = 0;
+ InputStream is = s.getInputStream ();
+ // wait two seconds for request, as client doesn't close
+ // the connection
+ s.setSoTimeout(2000);
+ try {
+ int n;
+ while ((n=is.read(buf, pos, buf.length-pos)) > 0)
+ pos +=n;
+ } catch (SocketTimeoutException x) { }
+ return pos;
+ }
+
+ public void run () {
+ byte[] buf = new byte[5000];
+ try {
+ System.out.println ("Server 1: accept");
+ s = server.accept ();
+ System.out.println ("accepted");
+ os = s.getOutputStream();
+ os.write (reply1.getBytes());
+ readAll (s, buf);
+ s.close ();
+
+ System.out.println ("Server 2: accept");
+ s = server.accept ();
+ System.out.println ("accepted");
+ os = s.getOutputStream();
+ int count = readAll (s, buf);
+ String reply = new String(buf, 0, count);
+
+ boolean error;
+
+ if (expectQuotes) {
+ error = false;
+ if (!reply.contains("qop=\"auth\"")) {
+ System.out.println ("Expecting quoted qop. Not found");
+ error = true;
+ }
+ if (!reply.contains("algorithm=\"MD5\"")) {
+ System.out.println ("Expecting quoted algorithm. Not found");
+ error = true;
+ }
+ } else {
+ error = false;
+ if (!reply.contains("qop=auth")) {
+ System.out.println ("Expecting unquoted qop. Not found");
+ error = true;
+ }
+ if (!reply.contains("algorithm=MD5")) {
+ System.out.println ("Expecting unquoted algorithm. Not found");
+ error = true;
+ }
+ }
+ if (error) {
+ os.write(ERRreply.getBytes());
+ os.flush();
+ s.close();
+ } else {
+ os.write((OKreply+"HelloWorld").getBytes());
+ os.flush();
+ s.close();
+ }
+ }
+ catch (Exception e) {
+ System.out.println (e);
+ }
+ finished ();
+ }
+
+ public synchronized void finished () {
+ notifyAll();
+ }
+
+ }
+
+ static class MyAuthenticator3 extends Authenticator {
+ PasswordAuthentication pw;
+ MyAuthenticator3 () {
+ super ();
+ pw = new PasswordAuthentication ("user", "passwordNotCheckedAnyway".toCharArray());
+ }
+
+ public PasswordAuthentication getPasswordAuthentication ()
+ {
+ System.out.println ("Auth called");
+ return pw;
+ }
+ }
+
+
+ static void read (InputStream is) throws IOException {
+ int c;
+ System.out.println ("reading");
+ while ((c=is.read()) != -1) {
+ System.out.write (c);
+ }
+ System.out.println ("");
+ System.out.println ("finished reading");
+ }
+
+ public static void main (String args[]) throws Exception {
+ expectQuotes = args[0].equals("quoted");
+
+ MyAuthenticator3 auth = new MyAuthenticator3 ();
+ Authenticator.setDefault (auth);
+ ServerSocket ss = new ServerSocket (0);
+ int port = ss.getLocalPort ();
+ BasicServer server = new BasicServer (ss);
+ synchronized (server) {
+ server.start();
+ System.out.println ("client 1");
+ URL url = new URL ("http://localhost:"+port+"/d1/d2/d3/foo.html");
+ URLConnection urlc = url.openConnection ();
+ InputStream is = urlc.getInputStream ();
+ read (is);
+ is.close ();
+ }
+ }
+}
--- a/jdk/test/java/sql/util/BaseTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/java/sql/util/BaseTest.java Fri May 23 09:05:24 2014 -0700
@@ -61,29 +61,31 @@
public void tearDownMethod() throws Exception {
}
- /**
+ /*
* Take some form of SQLException, serialize and deserialize it
- *
- * @param <T> SQLException
- * @param ex SQLException
- * @return deserialized SQLException
- * @throws IOException
- * @throws ClassNotFoundException
*/
@SuppressWarnings("unchecked")
protected <T extends SQLException> T
createSerializedException(T ex)
throws IOException, ClassNotFoundException {
- T ex1;
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (ObjectOutputStream oos = new ObjectOutputStream(baos) ) {
- oos.writeObject(ex);
- }
- try (ObjectInputStream ois =
- new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
- ex1 = (T) ois.readObject();
- }
- return ex1;
+ return (T) serializeDeserializeObject(ex);
}
+ /*
+ * Utility method to serialize and deserialize an object
+ */
+ @SuppressWarnings("unchecked")
+ protected <T> T serializeDeserializeObject(T o)
+ throws IOException, ClassNotFoundException {
+ T o1;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+ oos.writeObject(o);
+ }
+ try (ObjectInputStream ois
+ = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
+ o1 = (T) ois.readObject();
+ }
+ return o1;
+ }
}
--- a/jdk/test/java/util/Properties/CompatibilityTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/java/util/Properties/CompatibilityTest.java Fri May 23 09:05:24 2014 -0700
@@ -25,8 +25,6 @@
* @test
* @bug 8005280 8004371
* @summary Compatibility test
- * @run main CompatibilityTest
- * @run main/othervm -Dsun.util.spi.XmlPropertiesProvider=jdk.internal.util.xml.BasicXmlPropertiesProvider CompatibilityTest
*/
import java.io.FileInputStream;
--- a/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/java/util/Properties/ConcurrentLoadAndStoreXML.java Fri May 23 09:05:24 2014 -0700
@@ -25,9 +25,6 @@
* @bug 8005281
* @summary Test that the Properties storeToXML and loadFromXML methods are
* thread safe
- * @run main ConcurrentLoadAndStoreXML
- * @run main/othervm -Dsun.util.spi.XmlPropertiesProvider=jdk.internal.util.xml.BasicXmlPropertiesProvider ConcurrentLoadAndStoreXML
-
*/
import java.io.*;
--- a/jdk/test/java/util/Properties/CustomProvider.java Tue May 13 10:29:12 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * @test
- * @bug 8000354
- * @summary Test
- * @compile -XDignore.symbol.file CustomProvider.java MyXmlPropertiesProvider.java
- * @run main/othervm -Dsun.util.spi.XmlPropertiesProvider=MyXmlPropertiesProvider CustomProvider
- */
-
-import java.util.*;
-import java.io.*;
-
-/**
- * Sanity test to verify that the property sun.util.spi.XmlPropertiesProvider
- * can be used to specify a custom provider for loading/storing properties
- * in XML format.
- */
-public class CustomProvider {
-
- public static void main(String[] args) throws IOException {
- String provider = System.getProperty("sun.util.spi.XmlPropertiesProvider");
- assertTrue(provider != null, "sun.util.spi.XmlPropertiesProvider not set");
-
- OutputStream out = new ByteArrayOutputStream();
- InputStream in = new ByteArrayInputStream(new byte[100]);
-
- Properties props;
-
- props = new Properties();
- props.loadFromXML(in);
-
- props = System.getProperties();
- props.storeToXML(out, "comment");
- props.storeToXML(out, "comment", "UTF-8");
-
- // check that the provider's load and store methods have been invoked
-
- assertTrue(MyXmlPropertiesProvider.createCount() == 1,
- "Provider should only be created once");
- assertTrue(MyXmlPropertiesProvider.loadCount() == 1,
- "load method expected to be called once");
- assertTrue(MyXmlPropertiesProvider.storeCount() == 2,
- "store method expected to be called twice");
- }
-
- static void assertTrue(boolean b, String msg) {
- if (!b) throw new RuntimeException(msg);
- }
-}
--- a/jdk/test/java/util/Properties/LoadAndStoreXML.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/java/util/Properties/LoadAndStoreXML.java Fri May 23 09:05:24 2014 -0700
@@ -23,16 +23,28 @@
/*
* @test
- * @bug 8000354 8000685 8004371
+ * @bug 8000354 8000685 8004371 8043119
* @summary Basic test of storeToXML and loadToXML
- * @run main LoadAndStoreXML
- * @run main/othervm -Dsun.util.spi.XmlPropertiesProvider=jdk.internal.util.xml.BasicXmlPropertiesProvider LoadAndStoreXML
*/
-import java.io.*;
-import java.util.*;
-import java.security.*;
-import java.nio.file.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.InvalidPropertiesFormatException;
+import java.util.Properties;
+import java.util.PropertyPermission;
public class LoadAndStoreXML {
@@ -66,6 +78,50 @@
}
/**
+ * A {@code ByteArrayInputStream} that allows testing if the
+ * {@code close} method has been invoked.
+ */
+ static class TestInputStream extends ByteArrayInputStream {
+ private boolean closed;
+
+ TestInputStream(byte[] buf) {
+ super(buf);
+ }
+
+ boolean isOpen() {
+ return !closed;
+ }
+
+ public void close() throws IOException {
+ try {
+ super.close();
+ } finally {
+ closed = true;
+ }
+ }
+ }
+
+ /**
+ * A {@code ByteArrayOutputStream} that allows testing if the
+ * {@code close} method has been invoked.
+ */
+ static class TestOutputStream extends ByteArrayOutputStream {
+ private boolean closed;
+
+ boolean isOpen() {
+ return !closed;
+ }
+
+ public void close() throws IOException {
+ try {
+ super.close();
+ } finally {
+ closed = true;
+ }
+ }
+ }
+
+ /**
* Sanity test that properties saved with Properties#storeToXML can be
* read with Properties#loadFromXML.
*/
@@ -79,12 +135,16 @@
props.put("k4", "\u7532\u9aa8\u6587");
props.put("k5", "<java.home>/lib/jaxp.properties");
- ByteArrayOutputStream out = new ByteArrayOutputStream();
+ TestOutputStream out = new TestOutputStream();
props.storeToXML(out, null, encoding);
+ if (!out.isOpen())
+ throw new RuntimeException("OutputStream closed by storeToXML");
Properties p = new Properties();
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+ TestInputStream in = new TestInputStream(out.toByteArray());
p.loadFromXML(in);
+ if (in.isOpen())
+ throw new RuntimeException("InputStream not closed by loadFromXML");
if (!p.equals(props)) {
System.err.println("stored: " + props);
--- a/jdk/test/java/util/Properties/LoadAndStoreXMLWithDefaults.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/java/util/Properties/LoadAndStoreXMLWithDefaults.java Fri May 23 09:05:24 2014 -0700
@@ -35,58 +35,17 @@
*/
public class LoadAndStoreXMLWithDefaults {
- public static enum StoreMethod {
- // Note: this case will test the default provider when available,
- // and the basic provider when it's not.
- PROPERTIES {
- @Override
- public String writeToXML(Properties p) throws IOException {
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- p.storeToXML(baos, "Test 8016344");
- return baos.toString();
- }
- @Override
- public Properties loadFromXML(String xml, Properties defaults)
- throws IOException {
- final ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("UTF-8"));
- Properties p = new Properties(defaults);
- p.loadFromXML(bais);
- return p;
- }
- },
- // Note: this case always test the basic provider, which is always available.
- // so sometimes it's just a dup with the previous case...
- BASICPROVIDER {
- @Override
- public String writeToXML(Properties p) throws IOException {
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- jdk.internal.util.xml.BasicXmlPropertiesProvider provider =
- new jdk.internal.util.xml.BasicXmlPropertiesProvider();
- provider.store(p, baos, "Test 8016344", "UTF-8");
- return baos.toString();
- }
- @Override
- public Properties loadFromXML(String xml, Properties defaults)
- throws IOException {
- final ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("UTF-8"));
- Properties p = new Properties(defaults);
- jdk.internal.util.xml.BasicXmlPropertiesProvider provider =
- new jdk.internal.util.xml.BasicXmlPropertiesProvider();
- provider.load(p, bais);
- return p;
- }
- };
- public abstract String writeToXML(Properties p) throws IOException;
- public abstract Properties loadFromXML(String xml, Properties defaults)
- throws IOException;
- public String displayName() {
- switch(this) {
- case PROPERTIES: return "Properties.storeToXML";
- case BASICPROVIDER: return "BasicXmlPropertiesProvider.store";
- default:
- throw new UnsupportedOperationException(this.name());
- }
- }
+ static String writeToXML(Properties props) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ props.storeToXML(baos, "Test 8016344");
+ return baos.toString();
+ }
+
+ static Properties loadFromXML(String xml, Properties defaults) throws IOException {
+ ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("UTF-8"));
+ Properties props = new Properties(defaults);
+ props.loadFromXML(bais);
+ return props;
}
static enum Objects { OBJ1, OBJ2, OBJ3 };
@@ -106,63 +65,59 @@
p3.setProperty("p1.and.p2.and.p3.prop", "prop9-p3");
p3.setProperty("p2.and.p3.prop", "prop10-p3");
- for (StoreMethod m : StoreMethod.values()) {
- System.out.println("Testing with " + m.displayName());
- Properties P1 = m.loadFromXML(m.writeToXML(p1), null);
- Properties P2 = m.loadFromXML(m.writeToXML(p2), P1);
- Properties P3 = m.loadFromXML(m.writeToXML(p3), P2);
+ Properties P1 = loadFromXML(writeToXML(p1), null);
+ Properties P2 = loadFromXML(writeToXML(p2), P1);
+ Properties P3 = loadFromXML(writeToXML(p3), P2);
- testResults(m, p1, P1, p2, P2, p3, P3);
+ testResults(p1, P1, p2, P2, p3, P3);
- // Now check that properties whose keys or values are objects
- // are skipped.
+ // Now check that properties whose keys or values are objects
+ // are skipped.
- System.out.println("Testing with " + m.displayName() + " and Objects");
- P1.put("p1.object.prop", Objects.OBJ1);
- P1.put(Objects.OBJ1, "p1.object.prop");
- P1.put("p2.object.prop", "p2.object.prop");
- P2.put("p2.object.prop", Objects.OBJ2);
- P2.put(Objects.OBJ2, "p2.object.prop");
- P3.put("p3.object.prop", Objects.OBJ3);
- P3.put(Objects.OBJ3, "p3.object.prop");
+ P1.put("p1.object.prop", Objects.OBJ1);
+ P1.put(Objects.OBJ1, "p1.object.prop");
+ P1.put("p2.object.prop", "p2.object.prop");
+ P2.put("p2.object.prop", Objects.OBJ2);
+ P2.put(Objects.OBJ2, "p2.object.prop");
+ P3.put("p3.object.prop", Objects.OBJ3);
+ P3.put(Objects.OBJ3, "p3.object.prop");
- Properties PP1 = m.loadFromXML(m.writeToXML(P1), null);
- Properties PP2 = m.loadFromXML(m.writeToXML(P2), PP1);
- Properties PP3 = m.loadFromXML(m.writeToXML(P3), PP2);
+ Properties PP1 = loadFromXML(writeToXML(P1), null);
+ Properties PP2 = loadFromXML(writeToXML(P2), PP1);
+ Properties PP3 = loadFromXML(writeToXML(P3), PP2);
- p1.setProperty("p2.object.prop", "p2.object.prop");
- try {
- testResults(m, p1, PP1, p2, PP2, p3, PP3);
- } finally {
- p1.remove("p2.object.prop");
- }
+ p1.setProperty("p2.object.prop", "p2.object.prop");
+ try {
+ testResults(p1, PP1, p2, PP2, p3, PP3);
+ } finally {
+ p1.remove("p2.object.prop");
}
}
- public static void testResults(StoreMethod m, Properties... pps) {
+ public static void testResults(Properties... pps) {
for (int i=0 ; i < pps.length ; i += 2) {
if (!pps[i].equals(pps[i+1])) {
- System.err.println(m.displayName() +": P" + (i/2+1)
+ System.err.println("P" + (i/2+1)
+ " Reloaded properties differ from original");
System.err.println("\toriginal: " + pps[i]);
System.err.println("\treloaded: " + pps[i+1]);
- throw new RuntimeException(m.displayName() +": P" + (i/2+1)
+ throw new RuntimeException("P" + (i/2+1)
+ " Reloaded properties differ from original");
}
if (!pps[i].keySet().equals(pps[i+1].keySet())) {
- System.err.println(m.displayName() +": P" + (i/2+1)
+ System.err.println("P" + (i/2+1)
+ " Reloaded property names differ from original");
System.err.println("\toriginal: " + pps[i].keySet());
System.err.println("\treloaded: " + pps[i+1].keySet());
- throw new RuntimeException(m.displayName() +": P" + (i/2+1)
+ throw new RuntimeException("P" + (i/2+1)
+ " Reloaded property names differ from original");
}
if (!pps[i].stringPropertyNames().equals(pps[i+1].stringPropertyNames())) {
- System.err.println(m.displayName() +": P" + (i/2+1)
+ System.err.println("P" + (i/2+1)
+ " Reloaded string property names differ from original");
System.err.println("\toriginal: " + pps[i].stringPropertyNames());
System.err.println("\treloaded: " + pps[i+1].stringPropertyNames());
- throw new RuntimeException(m.displayName() +": P" + (i/2+1)
+ throw new RuntimeException("P" + (i/2+1)
+ " Reloaded string property names differ from original");
}
}
--- a/jdk/test/java/util/Properties/MyXmlPropertiesProvider.java Tue May 13 10:29:12 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.util.*;
-import java.io.*;
-
-public class MyXmlPropertiesProvider
- extends sun.util.spi.XmlPropertiesProvider
-{
- private static int createCount;
- private static int loadCount;
- private static int storeCount;
-
- static int createCount() { return createCount; }
- static int loadCount() { return loadCount; }
- static int storeCount() { return storeCount; }
-
- public MyXmlPropertiesProvider() {
- createCount++;
- }
-
- @Override
- public void load(Properties props, InputStream in)
- throws IOException, InvalidPropertiesFormatException
- {
- loadCount++;
- }
-
- @Override
- public void store(Properties props, OutputStream out,
- String comment, String encoding)
- throws IOException
- {
- storeCount++;
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/TEST.properties Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,2 @@
+# JDBC unit tests uses TestNG
+TestNG.dirs= .
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialArrayTests.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 test.rowset.serial;
+
+import java.sql.Array;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import javax.sql.rowset.serial.SerialArray;
+import javax.sql.rowset.serial.SerialException;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubArray;
+
+public class SerialArrayTests extends BaseTest {
+
+ private Object[] coffees;
+ private final String sqlType = "VARCHAR";
+ private Array a;
+ private Map<String, Class<?>> map;
+
+ @BeforeMethod
+ public void setUpMethod() throws Exception {
+ coffees = new Object[]{"Espresso", "Colombian", "French Roast",
+ "Cappuccino"};
+ a = new StubArray(sqlType, coffees);
+ map = new HashMap<>();
+ }
+
+ /*
+ * Validate a SerialArray can be created from an Array
+ */
+ @Test
+ public void test01() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ }
+
+ /*
+ * Validate a SQLException is thrown if the map is null
+ */
+ @Test(expectedExceptions = SQLException.class)
+ public void test02() throws Exception {
+ SerialArray sa = new SerialArray(a, null);
+ }
+
+ /*
+ * Validate a SerialException is thrown when getResultSet() is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test03() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ sa.getResultSet();
+ }
+
+ /*
+ * Validate a SerialException is thrown when getResultSet() is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test04() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ sa.getResultSet(null);
+ }
+
+ /*
+ * Validate a SerialException is thrown when getResultSet() is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test05() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ sa.getResultSet(1, 1);
+ }
+
+ /*
+ * Validate a SerialException is thrown when getResultSet() is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test06() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ sa.getResultSet(1, 1, null);
+ }
+
+ /*
+ * Validate a SerialException is thrown when getArray() is invoked after
+ * free() is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test07() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ sa.free();
+ sa.getArray();
+ }
+
+ /*
+ * Validate a SerialException is thrown when getArray() is invoked after
+ * free() is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test08() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ sa.free();
+ sa.getArray(map);
+ }
+
+ /*
+ * Validate a SerialException is thrown when getArray() is invoked after
+ * free() is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test09() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ sa.free();
+ sa.getArray(1, 1, map);
+ }
+
+ /*
+ * Validate a SerialException is thrown when getArray() is invoked after
+ * free() is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test10() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ sa.free();
+ sa.getArray(1, 1);
+ }
+
+ /*
+ * Validate a SerialException is thrown when getBaseType() is invoked after
+ * free() is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test11() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ sa.free();
+ sa.getBaseType();
+ }
+
+ /*
+ * Validate a SerialException is thrown when getBaseTypeName() is invoked after
+ * free() is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test12() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ sa.free();
+ sa.getBaseTypeName();
+ }
+
+ /*
+ * Validate getArray() returns the same Object[] used to create the
+ * SerialArray
+ */
+ @Test
+ public void test13() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ Object[] o = (Object[]) sa.getArray();
+ assertTrue(Arrays.equals(o, coffees));
+ }
+
+ /*
+ * Validate getArray() returns the same Object[] used to create the
+ * SerialArray
+ */
+ @Test
+ public void test14() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ Object[] o = (Object[]) sa.getArray(map);
+ assertTrue(Arrays.equals(o, coffees));
+ }
+
+ /*
+ * Validate getArray() returns the same Object[] used to create the
+ * SerialArray
+ */
+ @Test
+ public void test15() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ Object[] o = (Object[]) sa.getArray(1, 2);
+ assertTrue(Arrays.equals(o, Arrays.copyOfRange(coffees, 1, 3)));
+ }
+
+ /*
+ * Validate getArray() returns the same Object[] used to create the
+ * SerialArray
+ */
+ @Test
+ public void test16() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ Object[] o = (Object[]) sa.getArray(1, 2, map);
+ assertTrue(Arrays.equals(o, Arrays.copyOfRange(coffees, 1, 3)));
+ }
+
+ /*
+ * clone() a SerialArray and check that it is equal to the
+ * object it was cloned from
+ */
+ @Test
+ public void test17() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ SerialArray sa1 = (SerialArray) sa.clone();
+ assertTrue(sa.equals(sa1));
+ }
+
+ /*
+ * Validate that a SerialArray that is serialized & deserialized is equal to
+ * itself
+ */
+ @Test
+ public void test18() throws Exception {
+ SerialArray sa = new SerialArray(a);
+ SerialArray sa1 = serializeDeserializeObject(sa);;
+ assertTrue(sa.equals(sa1));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialBlobTests.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,399 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 test.rowset.serial;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import javax.sql.rowset.serial.SerialBlob;
+import javax.sql.rowset.serial.SerialException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubBlob;
+
+public class SerialBlobTests extends BaseTest {
+
+ // byte[] used to populate SerialBlob
+ private byte[] bytes = new byte[]{1, 2, 3, 4, 5};
+
+ /*
+ * Validate calling free() does not throw an Exception
+ */
+ @Test
+ public void test() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ }
+
+ /*
+ * Validate calling getBinaryStream() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test01() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ sb.getBinaryStream();
+ }
+
+ /*
+ * Validate calling getBinaryStream() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test02() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ sb.getBinaryStream(1, 5);
+ }
+
+ /*
+ * Validate calling getBytes() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test03() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ sb.getBytes(1, 1);
+ }
+
+ /*
+ * Validate calling getLength() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test04() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ sb.length();
+ }
+
+ /*
+ * Validate calling position() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test05() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ sb.position(new byte[5], 1);
+ }
+
+ /*
+ * Validate calling position() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test06() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ sb.position(new StubBlob(), 1);
+ }
+
+ /*
+ * Validate calling free() after calling setBinaryStream() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test07() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ sb.setBinaryStream(5);
+ }
+
+ /*
+ * Validate calling free() after calling setBytes() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test08() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ sb.setBytes(1, new byte[5]);
+ }
+
+ /*
+ * Validate calling setBytes() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test09() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ sb.setBytes(1, new byte[10], 0, 5);
+ }
+
+ /*
+ * Validate calling truncate() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test10() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ sb.free();
+ sb.truncate(1);
+ }
+
+ /*
+ * Validate getBinaryStream returns the correct bytes
+ */
+ @Test
+ public void test11() throws Exception {
+ byte[] expected = new byte[]{1, 2, 3};
+ SerialBlob sb = new SerialBlob(bytes);
+ InputStream is = sb.getBinaryStream(1, 3);
+ for (byte b : expected) {
+ byte val = (byte) is.read();
+ assertTrue(b == val, val + " does not match " + b);
+ }
+ }
+
+ /*
+ * Validate a SerialException is thrown if pos < 0 for getBinaryStream
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test12() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ InputStream is = sb.getBinaryStream(-1, 3);
+ }
+
+ /*
+ * Validate a SerialException is thrown if pos = 0 for getBinaryStream
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test13() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ InputStream is = sb.getBinaryStream(0, 3);
+ }
+
+ /*
+ * Validate a SerialException is thrown if len > the length of the stream
+ * for getBinaryStream
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test14() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ InputStream is = sb.getBinaryStream(0, 3);
+ }
+
+ /*
+ * Validate a SerialException is thrown if length < 1
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test15() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ InputStream is = sb.getBinaryStream(1, 0);
+ }
+
+ /*
+ * Validate a SerialException is thrown if length > byte array length
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test16() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ InputStream is = sb.getBinaryStream(1, 6);
+ }
+
+ /*
+ * Validate a SerialException is thrown if pos > byte array length
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test17() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ InputStream is = sb.getBinaryStream(bytes.length + 2, 6);
+ }
+
+ /*
+ * Validate that a cloned SerializedBlob bytes match the original
+ */
+ @Test
+ public void test18() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ SerialBlob sb2 = (SerialBlob) sb.clone();
+ assertTrue(
+ Arrays.equals(sb.getBytes(1, (int) sb.length()),
+ sb2.getBytes(1, (int) sb2.length())),
+ "arrays do not match ");
+ }
+
+ /*
+ * Test clone after free has been called that the clone is not accessible
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test19() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ sb.free();
+ SerialBlob sb2 = (SerialBlob) sb.clone();
+ InputStream is = sb2.getBinaryStream(1, 3);
+ }
+
+ /*
+ * Validate that a SerialBlob that is serialized & deserialized is equal to
+ * itself
+ */
+ @Test
+ public void test20() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ SerialBlob sb2 = serializeDeserializeObject(sb);
+ assertTrue(sb.equals(sb2), "SerialBlob not equal");
+ }
+
+ /*
+ * Validate a SerialException is thrown if byte[] is used to
+ * create the SeriablBlob and setBinaryStream is called
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test21() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ sb.setBinaryStream(3);
+ }
+
+ /*
+ * Validate that setBytes will properly write a set of bytes to the
+ * specified location in the SerialBlob and the correct count is returned
+ * for bytes written
+ */
+ @Test
+ public void test22() throws Exception {
+ byte[] diff = new byte[]{7, 8, 9};
+ byte[] expected = new byte[]{1, 7, 8, 9, 5};
+ SerialBlob sb = new SerialBlob(bytes);
+ int written = sb.setBytes(2, diff);
+ assertEquals(written, diff.length);
+ assertTrue(
+ Arrays.equals(sb.getBytes(1, (int) sb.length()),
+ expected),
+ "arrays do not match ");
+ }
+
+ /*
+ * Validate that setBytes will properly write a set of bytes to the
+ * specified location in the SerialBlob and the correct count is returned
+ * for bytes written
+ */
+ @Test
+ public void test23() throws Exception {
+ int bytesToWrite = 3;
+ byte[] diff = new byte[]{7, 8, 9, 0};
+ byte[] expected = new byte[]{1, 8, 9, 0, 5};
+ SerialBlob sb = new SerialBlob(bytes);
+ int written = sb.setBytes(2, diff, 1, bytesToWrite);
+ assertEquals(written, bytesToWrite);
+ assertTrue(
+ Arrays.equals(sb.getBytes(1, (int) sb.length()),
+ expected),
+ "arrays do not match ");
+ }
+
+ /*
+ * Validate that truncate reduces the length of the SerlizedBlob to the
+ * specified value
+ */
+ @Test
+ public void test24() throws Exception {
+ SerialBlob sb = new SerialBlob(bytes);
+ sb.truncate(0);
+ assertTrue(sb.length() == 0);
+ sb = new SerialBlob(bytes);
+ sb.truncate(3);
+ assertTrue(sb.length() == 3);
+ }
+
+ /*
+ * Validate getBinaryStream returns the correct bytes
+ */
+ @Test
+ public void test25() throws Exception {
+ byte[] expected = bytes;
+ SerialBlob sb = new SerialBlob(bytes);
+ InputStream is = sb.getBinaryStream();
+ for (byte b : expected) {
+ byte val = (byte) is.read();
+ assertTrue(b == val, val + " does not match " + b);
+ }
+ }
+
+ /*
+ * Validate setBinaryStream returns an OutputStream when passed a Blob
+ */
+ @Test
+ public void test26() throws Exception {
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ OutputStream os = sb.setBinaryStream(0);
+ assertTrue(os != null);
+ }
+
+ /*
+ * Validate that position returns the correct starting location for a
+ * pattern in the SerialBlob
+ */
+ @Test
+ public void test27() throws Exception {
+ long expectedPos = 3; // starting offset is 1 vs 0
+ byte[] pattern = new byte[]{3, 4};
+ SerialBlob sb = new SerialBlob(bytes);
+ long pos = sb.position(pattern, 1);
+ assertEquals(pos, expectedPos);
+ }
+
+ /*
+ * Validate that position returns the correct starting location for a
+ * pattern in the SerialBlob
+ */
+ @Test
+ public void test28() throws Exception {
+ long expectedPos = 3; // starting offset is 1 vs 0
+ byte[] pattern = new byte[]{3, 4, 5};
+ SerialBlob sb = new SerialBlob(bytes);
+ long pos = sb.position(pattern, 2);
+ assertEquals(pos, expectedPos);
+ }
+
+ /*
+ * Validate that position returns the correct starting location for a
+ * pattern in the SerialBlob
+ */
+ @Test
+ public void test29() throws Exception {
+ long expectedPos = 2; // starting offset is 1 vs 0
+ byte[] pattern = new byte[]{4, 6};
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ long pos = sb.position(pattern, 1);
+ assertEquals(pos, expectedPos);
+ }
+
+ /*
+ * Validate that position returns the correct starting location for a
+ * pattern in the SerialBlob
+ */
+ @Test
+ public void test30() throws Exception {
+ long expectedPos = 3; // starting offset is 1 vs 0
+ byte[] pattern = new byte[]{6, 8};
+ SerialBlob sb = new SerialBlob(new StubBlob());
+ long pos = sb.position(pattern, 2);
+ assertEquals(pos, expectedPos);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialClobTests.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,499 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 test.rowset.serial;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import javax.sql.rowset.serial.SerialClob;
+import javax.sql.rowset.serial.SerialException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubClob;
+
+public class SerialClobTests extends BaseTest {
+
+ // char[] used to populate SerialClob
+ private final char[] chars;
+
+ public SerialClobTests() {
+ this.chars = new char[]{'h', 'e', 'l', 'l', 'o', ' ', 'w',
+ 'o', 'r', 'l', 'd'};
+ }
+
+ /*
+ * Validate calling free() does not throw an Exception
+ */
+ @Test
+ public void test() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ }
+
+ /*
+ * Validate calling getCharacterStream() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test01() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.getCharacterStream();
+ }
+
+ /*
+ * Validate calling getCharacterStream() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test02() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ sc.free();
+ sc.getCharacterStream();
+ }
+
+ /*
+ * Validate calling getCharacterStream() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test03() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.getCharacterStream(1, 5);
+ }
+
+ /*
+ * Validate calling getSubString() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test04() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.getSubString(1, 1);
+ }
+
+ /*
+ * Validate calling truncate() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test05() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.truncate(1);
+ }
+
+ /*
+ * Validate calling getAsciiStream() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test06() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.getAsciiStream();
+ }
+
+ /*
+ * Validate calling length() after calling free() throws an SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test07() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.length();
+ }
+
+ /*
+ * Validate calling position() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test08() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.position("hello", 1);
+ }
+
+ /*
+ * Validate calling position() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test09() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.position(new StubClob(), 1);
+ }
+
+ /*
+ * Validate calling setAsciiStream() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test10() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.setAsciiStream(5);
+ }
+
+ /*
+ * Validate calling setCharacterStream() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test11() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.setCharacterStream(5);
+ }
+
+ /*
+ * Validate calling setString() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test12() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.setString(1, "hello");
+ }
+
+ /*
+ * Validate calling setString() after calling free() throws an
+ * SerialException
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test13() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.free();
+ sc.setString(1, "hello", 0, 5);
+ }
+
+ /*
+ * Test that SerialException is thrown if pos < 0 on a call to
+ * getCharacterStream
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test14() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ sc.getCharacterStream(-1, 5);
+ }
+
+ /*
+ * Test that SerialException is thrown if pos = 0 on a call to
+ * getCharacterStream
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test15() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ sc.getCharacterStream(0, 5);
+ }
+
+ /*
+ * Test that SerialException is thrown if pos = 0 on a call to
+ * getCharacterStream
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test16() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ sc.getCharacterStream(1, 100);
+ }
+
+ /*
+ * Test that SerialException is thrown if length = 0 on a call to
+ * getCharacterStream
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test17() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ sc.getCharacterStream(1, 0);
+ }
+
+ /*
+ * Test that SerialException is thrown if pos > length on a call to
+ * getCharacterStream
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test18() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ sc.getCharacterStream(100, 5);
+ }
+
+ /*
+ * Clone a SerialClob and check that it is equal to itself
+ */
+ @Test
+ public void test19() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ SerialClob sc1 = (SerialClob) sc.clone();
+ assertTrue(sc.equals(sc1), "SerialClobs not equal");
+ }
+
+ /*
+ * Validate that a getAsciiStream() returns an InputStream when a Clob is
+ * used to create the SerialClob
+ */
+ @Test
+ public void test20() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ InputStream is = sc.getAsciiStream();
+ assertTrue(is != null);
+ }
+
+ /*
+ * Validate that a getCharacterStream() returns an Reader when a Clob is
+ * used to create the SerialClob
+ */
+ @Test
+ public void test21() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ Reader is = sc.getCharacterStream();
+ assertTrue(is != null);
+ }
+
+ /*
+ * Validate that a getCharacterStream() returns an Reader when a char[] is
+ * used to create the SerialClob
+ */
+ @Test
+ public void test22() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ Reader is = sc.getCharacterStream();
+ assertTrue(is != null);
+ }
+
+ /*
+ * Validate that a getSubString() returns the correct value when a char[] is
+ * used to create the SerialClob
+ */
+ @Test
+ public void test23() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ String expected = "world";
+ assertEquals(expected, sc.getSubString(7, 5));
+ }
+
+ /*
+ * Validate that a getSubString() returns the correct value when a Clob is
+ * used to create the SerialClob
+ */
+ @Test
+ public void test24() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ String expected = "test string";
+ assertEquals(expected, sc.getSubString(5, 11));
+ }
+
+ /*
+ * Validate that position() returns the correct value when a Clob is used to
+ * create the SerialClob
+ */
+ @Test
+ public void test25() throws Exception {
+ long expectedPos = 5;
+ SerialClob sc = new SerialClob(new StubClob());
+ String expected = "test string";
+ long pos = sc.position(expected, 1);
+ assertEquals(expectedPos, pos);
+ }
+
+ /*
+ * Validate that position returned is -1 when an the search string is not
+ * part of the SerialClob
+ */
+ @Test
+ public void test26() throws Exception {
+ long expectedPos = -1;
+ SerialClob sc = new SerialClob(chars);
+ String expected = "test string";
+ long pos = sc.position(expected, 1);
+ assertEquals(expectedPos, pos);
+ }
+
+ /*
+ * Validate that position() returned is -1 when an the search string is not
+ * part of the SerialClob
+ */
+ @Test
+ public void test27() throws Exception {
+ long expectedPos = -1;
+ SerialClob sc = new SerialClob(new StubClob());
+ String expected = "I am Batman";
+ long pos = sc.position(expected, 2);
+ assertEquals(expectedPos, pos);
+ }
+
+ /*
+ * Validate that position() returns the correct value when a char[] is used
+ * to create the SerialClob
+ */
+ @Test
+ public void test28() throws Exception {
+ long expectedPos = 2;
+ SerialClob sc = new SerialClob(chars);
+ String expected = "ello";
+ long pos = sc.position(expected, 1);
+ assertEquals(expectedPos, pos);
+ }
+
+ /*
+ * Validate that position() returns the correct value when a SerialClob is
+ * used for the search argument
+ */
+ @Test
+ public void test29() throws Exception {
+ long expectedPos = 21;
+ String expected = "Batman";
+ String buf = "I am Joker, not the Batman, hahaha";
+ SerialClob sc = new SerialClob(expected.toCharArray());
+ SerialClob sc1 = new SerialClob(buf.toCharArray());
+ long pos = sc1.position(sc, 1);
+ assertEquals(expectedPos, pos);
+ }
+
+ /*
+ * Validate that position() returns the correct value when a SerialClob is
+ * used for the search argument
+ */
+ @Test
+ public void test30() throws Exception {
+ long expectedPos = 17;
+ String expected = "012";
+ SerialClob sc = new SerialClob(expected.toCharArray());
+ SerialClob sc1 = new SerialClob(new StubClob());
+ long pos = sc1.position(sc, 1);
+ assertEquals(expectedPos, pos);
+ }
+
+ /*
+ * Check that setString() updates the appropriate characters in the
+ * SerialClob
+ */
+ @Test
+ public void test31() throws Exception {
+ String val = "Hello, I am Bruce Wayne";
+ String val1 = "the Batman!";
+ String expected = "Hello, I am the Batman!";
+ SerialClob sc = new SerialClob(val.toCharArray());
+ int written = sc.setString(13, val1);
+ assertEquals(val1.length(), written);
+ assertTrue(expected.equals(sc.getSubString(1, (int) sc.length())));
+ }
+
+ /*
+ * Check that setString() updates the appropriate characters in the
+ * SerialClob
+ */
+ @Test(enabled = false)
+ public void test32() throws Exception {
+ int expectedWritten = 9;
+ String val = "Hi, I am Catwoman!!!!!!";
+ String val1 = "Hahaha the Joker, who are you?!";
+ String expected = "Hi, I am the Joker!";
+ SerialClob sc = new SerialClob(val.toCharArray());
+ int written = sc.setString(10, val1, 8, expectedWritten+1);
+ assertEquals(written, expectedWritten);
+
+ }
+
+ /*
+ * Check that setCharacterStream() returns a non-null Writer for an
+ * SerialClob created from a Clob
+ */
+ @Test
+ public void test33() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ Writer w = sc.setCharacterStream(1);
+ assertTrue(w != null);
+ }
+
+ /*
+ * Check that setAsciiStream() returns a non-null OutputStream for an SerialClob
+ * created from a Clob
+ */
+ @Test
+ public void test34() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ OutputStream os = sc.setAsciiStream(1);
+ assertTrue(os != null);
+ }
+
+ /*
+ * Check that truncate() truncates the length of the SerialClob to the
+ * specified size
+ */
+ @Test
+ public void test35() throws Exception {
+ SerialClob sc = new SerialClob(new StubClob());
+ sc.truncate(0);
+ assertTrue(sc.length() == 0);
+ sc = new SerialClob(chars);
+ sc.truncate(5);
+ assertTrue(sc.length() == 5);
+ }
+
+ /*
+ * Check that getCharacterStream() returns a Reader and that the char[] that
+ * was specified to create the SerialClob can be returned via the Reader
+ */
+ @Test
+ public void test36() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ Reader r = sc.getCharacterStream();
+ for (char c : chars) {
+ char val = (char) r.read();
+ assertTrue(c == val, val + " does not match " + c);
+ }
+ }
+
+ /*
+ * Check that getCharacterStream() returns a Reader and that the char[] that
+ * was specified to create the SerialClob can be returned via the Reader
+ */
+ @Test(enabled = false)
+ public void test37() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ String expected = "ello w";
+ Reader r = sc.getCharacterStream(2, 6);
+ for (char c : expected.toCharArray()) {
+ char val = (char) r.read();
+ assertTrue(c == val, val + " does not match " + c);
+ }
+ }
+
+ /*
+ * Validate that a SerialClob that is serialized & deserialized is equal to
+ * itself
+ */
+ @Test
+ public void test38() throws Exception {
+ SerialClob sc = new SerialClob(chars);
+ SerialClob sc2 = serializeDeserializeObject(sc);
+ assertTrue(sc.equals(sc2), "SerialClobs not equal");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialDataLinkTests.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 test.rowset.serial;
+
+import java.net.URL;
+import javax.sql.rowset.serial.SerialDatalink;
+import javax.sql.rowset.serial.SerialException;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SerialDataLinkTests extends BaseTest {
+
+ private URL u;
+ private URL u1;
+ private SerialDatalink dl;
+
+ @BeforeMethod
+ public void setUpMethod() throws Exception {
+ u = new URL("http://www.oracle.com/");
+ u1 = new URL("http://www.usatoday.com/");
+ dl = new SerialDatalink(u);
+ }
+
+ /*
+ * Validate that a SerialException is thrown if the URL is null
+ */
+ @Test(expectedExceptions = SerialException.class)
+ public void test() throws Exception {
+ SerialDatalink dl1 = new SerialDatalink(null);
+ }
+
+ /*
+ * Validate that getDatalink() returns the same URL used to create the
+ * SerialDatalink object
+ */
+ @Test
+ public void test01() throws Exception {
+ URL u2 = dl.getDatalink();
+ assertTrue(u2.equals(u));
+ assertTrue(u2.sameFile(u));
+ }
+
+ /*
+ * Validate that URL returned from getDatalink() differs from a URL that was
+ * not used to create the SerialDatalink
+ */
+ @Test
+ public void test02() throws Exception {
+ URL u2 = dl.getDatalink();
+ assertFalse(u2.equals(u1));
+ assertFalse(u2.sameFile(u1));
+ }
+
+ /*
+ * Create a clone of a SerialDatalink and validate that it is equal to the
+ * SerialDatalink it was cloned from
+ */
+ @Test
+ public void test03() throws Exception {
+ SerialDatalink dl2 = (SerialDatalink) dl.clone();
+ assertTrue(dl.equals(dl2));
+ SerialDatalink dl3 = new SerialDatalink(u1);
+ assertFalse(dl2.equals(dl3));
+ }
+
+ /*
+ * Validate that a SerialDatalink that is serialized & deserialized is
+ * equal to itself
+ */
+ @Test
+ public void test04() throws Exception {
+ SerialDatalink dl2 = serializeDeserializeObject(dl);
+ SerialDatalink dl3 = new SerialDatalink(u);
+ assertTrue(dl.equals(dl2));
+ assertTrue(dl3.equals(dl2));
+ }
+
+ /**
+ * Validate that a SerialDatalink that is serialized & deserialized is not equal
+ * to to a SerialDatalink created using a different URL
+ */
+ @Test
+ public void test05() throws Exception {
+ SerialDatalink dl2 = serializeDeserializeObject(dl);
+ SerialDatalink d3 = new SerialDatalink(u1);
+ assertFalse(d3.equals(dl2));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialExceptionTests.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 test.rowset.serial;
+
+import java.sql.SQLException;
+import javax.sql.rowset.serial.SerialException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SerialExceptionTests extends BaseTest {
+
+ /*
+ * Create SerialException with no-arg constructor
+ */
+ @Test
+ public void test01() {
+ SerialException ex = new SerialException();
+ assertTrue(ex.getMessage() == null
+ && ex.getSQLState() == null
+ && ex.getCause() == null
+ && ex.getErrorCode() == 0);
+ }
+
+ /*
+ * Create SerialException with message
+ */
+ @Test
+ public void test02() {
+ SerialException ex = new SerialException(reason);
+ assertTrue(ex.getMessage().equals(reason)
+ && ex.getSQLState() == null
+ && ex.getCause() == null
+ && ex.getErrorCode() == 0);
+ }
+
+ /*
+ * Validate that the ordering of the returned Exceptions is correct using
+ * for-each loop
+ */
+ @Test
+ public void test03() {
+ SerialException ex = new SerialException("Exception 1");
+ ex.initCause(t1);
+ SerialException ex1 = new SerialException("Exception 2");
+ SerialException ex2 = new SerialException("Exception 3");
+ ex2.initCause(t2);
+ ex.setNextException(ex1);
+ ex.setNextException(ex2);
+ int num = 0;
+ for (Throwable e : ex) {
+ assertTrue(msgs[num++].equals(e.getMessage()));
+ }
+ }
+
+ /*
+ * Validate that the ordering of the returned Exceptions is correct using
+ * traditional while loop
+ */
+ @Test
+ public void test04() {
+ SQLException ex = new SerialException("Exception 1");
+ ex.initCause(t1);
+ SerialException ex1 = new SerialException("Exception 2");
+ SerialException ex2 = new SerialException("Exception 3");
+ ex2.initCause(t2);
+ ex.setNextException(ex1);
+ ex.setNextException(ex2);
+ int num = 0;
+ while (ex != null) {
+ assertTrue(msgs[num++].equals(ex.getMessage()));
+ Throwable c = ex.getCause();
+ while (c != null) {
+ assertTrue(msgs[num++].equals(c.getMessage()));
+ c = c.getCause();
+ }
+ ex = ex.getNextException();
+ }
+ }
+
+ /*
+ * Serialize a SerialException and make sure you can read it back properly
+ */
+ @Test
+ public void test05() throws Exception {
+ SerialException e = new SerialException(reason);
+ SerialException ex1 = createSerializedException(e);
+ assertTrue(ex1.getMessage().equals(reason)
+ && ex1.getSQLState() == null
+ && ex1.getCause() == null
+ && ex1.getErrorCode() == 0);;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialJavaObjectTests.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 test.rowset.serial;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import javax.sql.rowset.RowSetMetaDataImpl;
+import javax.sql.rowset.serial.SerialException;
+import javax.sql.rowset.serial.SerialJavaObject;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SerialJavaObjectTests extends BaseTest {
+
+ /*
+ * Validate that an NPE is thrown when null is specified to create
+ * the SerialJavaObject
+ */
+ @Test(expectedExceptions = NullPointerException.class)
+ public void test() throws Exception {
+ SerialJavaObject sjo = new SerialJavaObject(null);
+ }
+
+ /*
+ * Validate that an SerialExcepion is thrown when the object specified
+ * contains public static fields
+ */
+ @Test(expectedExceptions = SerialException.class, enabled = false)
+ public void test01() throws Exception {
+ SerialJavaObject sjo = new SerialJavaObject(new RowSetMetaDataImpl());
+ }
+
+ /*
+ * Validate that an getFields()s returns the same Field[] for the object
+ * used to create the SerialJavaObject
+ */
+ @Test
+ public void test02() throws Exception {
+ SerialException e = new SerialException();
+ SerialJavaObject sjo = new SerialJavaObject(e);
+ Field[] f = e.getClass().getFields();
+ assertTrue(Arrays.equals(f, sjo.getFields()));
+ assertFalse(Arrays.equals("hello".getClass().getFields(),
+ sjo.getFields()));
+ }
+
+ /*
+ * clone() a SerialJavaObject and check that it is equal to the
+ * object it was cloned from
+ */
+ @Test
+ public void test03() throws Exception {
+ SerialJavaObject sjo = new SerialJavaObject("Hello");
+ SerialJavaObject sjo2 = (SerialJavaObject) sjo.clone();
+ assertTrue(sjo.equals(sjo2));
+ }
+
+ /**
+ * Validate that a SerialJavaObject that is serialized & deserialized is
+ * equal to itself
+ */
+ @Test
+ public void test04() throws Exception {
+ SerialJavaObject sjo = new SerialJavaObject("Hello");
+ SerialJavaObject sjo2 = serializeDeserializeObject(sjo);
+ assertTrue(sjo.equals(sjo2));
+ }
+
+ /*
+ * Validate that a getObject() returns an object used to create the
+ * SerialJavaObject
+ */
+ @Test
+ public void test05() throws Exception {
+ String s = "Hello world";
+ SerialJavaObject sjo = new SerialJavaObject(s);
+ assertTrue(s.equals(sjo.getObject()));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialRefTests.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 test.rowset.serial;
+
+import java.sql.Ref;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.sql.rowset.serial.SerialRef;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubRef;
+import util.SuperHero;
+
+public class SerialRefTests extends BaseTest {
+
+ private static Map<String, Class<?>> map = new HashMap<>();
+ private Ref ref;
+ private final String sqlType = "SUPERHERO";
+ private SuperHero hero;
+
+ @BeforeMethod
+ public void setUpMethod() throws Exception {
+ map.put(sqlType, Class.forName("util.SuperHero"));
+ hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman");
+ ref = new StubRef(sqlType, hero);
+ }
+
+ /*
+ * Validate that a SQLException() is thrown if the Ref is null
+ */
+ @Test(expectedExceptions = SQLException.class)
+ public void test01() throws Exception {
+ SerialRef sr = new SerialRef(null);
+ }
+
+ /*
+ * Validate that a SQLException() is thrown if the typeName is null in the
+ * Ref used to create the SerialRef
+ */
+ @Test(expectedExceptions = SQLException.class)
+ public void test02() throws Exception {
+ SerialRef sr = new SerialRef(new StubRef(null, hero));
+ }
+
+ /*
+ * Validate that getBaseTypeName() returns the same SQLType specified
+ * to create the Ref
+ */
+ @Test
+ public void test03() throws Exception {
+ SerialRef sr = new SerialRef(ref);
+ assertEquals(sr.getBaseTypeName(), sqlType);
+ }
+
+ /*
+ * Validate that getObject() returns the same object used to create the Ref
+ */
+ @Test
+ public void test04() throws Exception {
+ SerialRef sr = new SerialRef(ref);
+ assertTrue(hero.equals(sr.getObject()));
+ }
+
+ /*
+ * Validate that getObject() returns the same object used to create the Ref
+ */
+ @Test(enabled = false)
+ public void test05() throws Exception {
+ SerialRef sr = new SerialRef(ref);
+ assertTrue(hero.equals(sr.getObject(map)));
+ }
+
+ /*
+ * Validate that setObject() can be used to change the value of the object
+ * pointed to by the SerialRef
+ */
+ @Test
+ public void test06() throws Exception {
+ SerialRef sr = new SerialRef(ref);
+ assertTrue(hero.equals(sr.getObject()));
+ SuperHero h = new SuperHero(sqlType, "Dick", "Grayson", 1940, "Robin");
+ sr.setObject(h);
+ assertFalse(hero.equals(sr.getObject()));
+ }
+
+ /*
+ * clone() a SerialRef and check that it is equal to the
+ * object it was cloned from
+ */
+ @Test
+ public void test09() throws Exception {
+ SerialRef sr = new SerialRef(ref);
+ SerialRef sr1 = (SerialRef) sr.clone();
+ assertTrue(sr.equals(sr1));
+ }
+
+ /**
+ * Validate that a SerialRef that is serialized & deserialized is equal to
+ * itself for the Object & baseTypeName
+ */
+ @Test
+ public void test10() throws Exception {
+ SerialRef sr = new SerialRef(ref);
+ SerialRef sr1 = serializeDeserializeObject(sr);
+ assertTrue(sr1.getObject().equals(sr.getObject())
+ && sr1.getBaseTypeName().equals(sr.getBaseTypeName()));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialStructTests.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 test.rowset.serial;
+
+import java.sql.Struct;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import javax.sql.rowset.serial.SerialStruct;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubStruct;
+import util.SuperHero;
+
+public class SerialStructTests extends BaseTest {
+
+ private static Map<String, Class<?>> map = new HashMap<>();
+ private Object[] attributes;
+ private Struct struct;
+ private final String sqlType = "SUPERHERO";
+ private SuperHero hero;
+
+ @BeforeMethod
+ public void setUpMethod() throws Exception {
+ attributes = new Object[]{"Bruce", "Wayne", 1939,
+ "Batman"};
+ map.put(sqlType, Class.forName("util.SuperHero"));
+ struct = new StubStruct(sqlType, attributes);
+ hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman");
+ }
+
+ /*
+ * Validate that getSQLTypeName() returns the same SQLType specified by
+ * the Struct used to create the object
+ */
+ @Test
+ public void test01() throws Exception {
+ SerialStruct ss = new SerialStruct(struct, map);
+ assertEquals(ss.getSQLTypeName(), sqlType);
+ }
+
+ /*
+ * Validate that getSQLTypeName() returns the same SQLType specified by
+ * the Struct used to create the object
+ */
+ @Test
+ public void test02() throws Exception {
+ SerialStruct ss = new SerialStruct(hero, map);
+ assertEquals(ss.getSQLTypeName(), sqlType);
+ }
+
+ /*
+ * Validate that getAttributes() returns the same attributes specified by
+ * the Struct used to create the object
+ */
+ @Test
+ public void test03() throws Exception {
+ SerialStruct ss = new SerialStruct(struct, map);
+ assertTrue(Arrays.equals(attributes,
+ ss.getAttributes()));
+ }
+
+ /*
+ * Validate that getAttributes() returns the same attributes specified by
+ * the Struct used to create the object
+ */
+ @Test
+ public void test04() throws Exception {
+ SerialStruct ss = new SerialStruct(hero, map);
+ assertTrue(Arrays.equals(attributes,
+ ss.getAttributes()));
+ }
+
+ /*
+ * Validate that getAttributes() returns the
+ same attributes specified by
+ * the Struct used to create the object
+ */
+ @Test
+ public void test05() throws Exception {
+ SerialStruct ss = new SerialStruct(struct, map);
+ assertTrue(Arrays.equals(attributes,
+ ss.getAttributes(map)));
+ }
+
+ /*
+ * Validate that getAttributes() returns the same attributes specified by
+ * the Struct used to create the object
+ */
+ @Test
+ public void test06() throws Exception {
+ SerialStruct ss = new SerialStruct(hero, map);
+ assertTrue(Arrays.equals(attributes,
+ ss.getAttributes(map)));
+ }
+
+ /*
+ * clone() a SerialStruct and check that it is equal to the
+ * object it was cloned from
+ */
+ @Test
+ public void test07() throws Exception {
+ SerialStruct ss = new SerialStruct(struct, map);
+ SerialStruct ss1 = (SerialStruct) ss.clone();
+ assertTrue(ss.equals(ss1));
+ }
+
+ /**
+ * Validate that a SerialStruct that is serialized & deserialized is equal
+ * to itself
+ */
+ @Test
+ public void test08() throws Exception {
+ SerialStruct ss = new SerialStruct(struct, map);
+ SerialStruct ss1 = serializeDeserializeObject(ss);;
+ assertTrue(ss.equals(ss1));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/BaseTest.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.sql.SQLException;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+
+public class BaseTest {
+
+ protected final String reason = "reason";
+ protected final String state = "SQLState";
+ protected final String cause = "java.lang.Throwable: cause";
+ protected final Throwable t = new Throwable("cause");
+ protected final Throwable t1 = new Throwable("cause 1");
+ protected final Throwable t2 = new Throwable("cause 2");
+ protected final int errorCode = 21;
+ protected final String[] msgs = {"Exception 1", "cause 1", "Exception 2",
+ "Exception 3", "cause 2"};
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @BeforeMethod
+ public void setUpMethod() throws Exception {
+ }
+
+ @AfterMethod
+ public void tearDownMethod() throws Exception {
+ }
+
+ /*
+ * Take some form of SQLException, serialize and deserialize it
+ */
+ @SuppressWarnings("unchecked")
+ protected <T extends SQLException> T
+ createSerializedException(T ex)
+ throws IOException, ClassNotFoundException {
+ return (T) serializeDeserializeObject(ex);
+ }
+
+ /*
+ * Utility method to serialize and deserialize an object
+ */
+ @SuppressWarnings("unchecked")
+ protected <T> T serializeDeserializeObject(T o)
+ throws IOException, ClassNotFoundException {
+ T o1;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+ oos.writeObject(o);
+ }
+ try (ObjectInputStream ois
+ = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
+ o1 = (T) ois.readObject();
+ }
+ return o1;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubArray.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 util;
+
+import java.sql.Array;
+import java.sql.JDBCType;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Map;
+
+public class StubArray implements Array {
+
+ private String typeName;
+ Object[] elements;
+
+ public StubArray(String name, Object[] values) {
+ typeName = name;
+ elements = Arrays.copyOf(values, values.length);
+
+ }
+
+ @Override
+ public String getBaseTypeName() throws SQLException {
+ return typeName;
+ }
+
+ @Override
+ public int getBaseType() throws SQLException {
+ return JDBCType.valueOf(typeName).getVendorTypeNumber();
+ }
+
+ @Override
+ public Object getArray() throws SQLException {
+ return Arrays.copyOf(elements, elements.length);
+ }
+
+ @Override
+ public Object getArray(Map<String, Class<?>> map) throws SQLException {
+ return getArray();
+ }
+
+ @Override
+ public Object getArray(long index, int count) throws SQLException {
+ return getArray();
+ }
+
+ @Override
+ public Object getArray(long index, int count, Map<String, Class<?>> map) throws SQLException {
+ return getArray();
+ }
+
+ @Override
+ public ResultSet getResultSet() throws SQLException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public ResultSet getResultSet(long index, int count) throws SQLException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public ResultSet getResultSet(long index, int count, Map<String, Class<?>> map) throws SQLException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void free() throws SQLException {
+ elements = null;
+ typeName = null;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubBlob.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.sql.Blob;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class StubBlob implements Blob {
+
+ private byte[] bytes;
+
+ public StubBlob() {
+ bytes = new byte[]{2, 4, 6, 8};
+ }
+
+ public long length() throws SQLException {
+ return bytes.length;
+ }
+
+ public byte[] getBytes(long pos, int length)
+ throws SQLException {
+ return Arrays.copyOfRange(bytes, (int) pos - 1, length);
+ }
+
+ public InputStream getBinaryStream()
+ throws SQLException {
+ return null;
+ }
+
+ public long position(byte[] pattern, long start)
+ throws SQLException {
+ return 0;
+ }
+
+ public long position(Blob pattern, long start)
+ throws SQLException {
+ return 0;
+ }
+
+ public int setBytes(long pos, byte[] bytes)
+ throws SQLException {
+ return 0;
+ }
+
+ public int setBytes(long pos, byte[] bytes, int offset, int len)
+ throws SQLException {
+ return 0;
+ }
+
+ public OutputStream setBinaryStream(long pos)
+ throws SQLException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = null;
+ try {
+ oos = new ObjectOutputStream(baos);
+ } catch (IOException ex) {
+ Logger.getLogger(StubBlob.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return oos;
+ }
+
+ public void truncate(long len)
+ throws SQLException {
+ }
+
+ public void free() throws SQLException {
+ }
+
+ public InputStream getBinaryStream(long pos, long length) throws SQLException {
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubClob.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.sql.Clob;
+import java.sql.SQLException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class StubClob implements Clob {
+
+ public String buf = "The test string 0123456789";
+
+ @Override
+ public String getSubString(long pos, int length) throws SQLException {
+ return buf;
+ }
+
+ @Override
+ public long length() throws SQLException {
+ return buf.length();
+ }
+
+ @Override
+ public Reader getCharacterStream() throws SQLException {
+ return new StringReader(buf);
+ }
+
+ @Override
+ public InputStream getAsciiStream() throws SQLException {
+ return new java.io.StringBufferInputStream(buf);
+ }
+
+ @Override
+ public int setString(long pos, String str) throws SQLException {
+ return str.length();
+ }
+
+ @Override
+ public int setString(long pos, String str, int offset, int len) throws SQLException {
+ return len;
+ }
+
+ @Override
+ public long position(String searchstr, long start) throws SQLException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public long position(Clob searchstr, long start) throws SQLException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public OutputStream setAsciiStream(long pos) throws SQLException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = null;
+ try {
+ oos = new ObjectOutputStream(baos);
+ } catch (IOException ex) {
+ Logger.getLogger(StubBlob.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return oos;
+ }
+
+ @Override
+ public Writer setCharacterStream(long pos) throws SQLException {
+ return new StringWriter();
+ }
+
+ @Override
+ public void truncate(long len) throws SQLException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void free() throws SQLException {
+ }
+
+ @Override
+ public Reader getCharacterStream(long pos, long length) throws SQLException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubRef.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 util;
+
+import java.io.Serializable;
+import java.sql.Ref;
+import java.sql.SQLException;
+import java.util.Map;
+
+public class StubRef implements Ref, Serializable {
+
+ private final String baseTypeName;
+ private Object obj;
+
+ public StubRef(String type, Object o) {
+ baseTypeName = type;
+ obj = o;
+ }
+
+ @Override
+ public String getBaseTypeName() throws SQLException {
+ return baseTypeName;
+ }
+
+ @Override
+ public Object getObject(Map<String, Class<?>> map) throws SQLException {
+ return obj;
+ }
+
+ @Override
+ public Object getObject() throws SQLException {
+ return getObject(null);
+ }
+
+ @Override
+ public void setObject(Object value) throws SQLException {
+ obj = value;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubStruct.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 util;
+
+import java.sql.SQLException;
+import java.sql.Struct;
+import java.util.Arrays;
+import java.util.Map;
+
+public class StubStruct implements Struct {
+
+ private final String type;
+ private final Object[] attribs;
+
+ public StubStruct(String type, Object[] o) {
+ this.type = type;
+ this.attribs = Arrays.copyOf(o, o.length);
+ }
+
+ @Override
+ public String getSQLTypeName() throws SQLException {
+ return type;
+ }
+
+ @Override
+ public Object[] getAttributes() throws SQLException {
+ return attribs;
+ }
+
+ @Override
+ public Object[] getAttributes(Map<String, Class<?>> map) throws SQLException {
+ return attribs;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/SuperHero.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 util;
+
+import java.io.Serializable;
+import java.sql.SQLData;
+import java.sql.SQLException;
+import java.sql.SQLInput;
+import java.sql.SQLOutput;
+
+public class SuperHero implements SQLData, Serializable {
+
+ private String first;
+ private String last;
+ private final String type;
+ private Integer firstYear;
+ private String secretIdentity;
+
+ public SuperHero(String sqlType, String fname, String lname, Integer year,
+ String identity) {
+ first = fname;
+ last = lname;
+ type = sqlType;
+ firstYear = year;
+ secretIdentity = identity;
+ }
+
+ @Override
+ public String getSQLTypeName() throws SQLException {
+ return type;
+ }
+
+ @Override
+ public void readSQL(SQLInput stream, String typeName) throws SQLException {
+ first = stream.readString();
+ last = stream.readString();
+ firstYear = stream.readInt();
+ secretIdentity = stream.readString();
+ }
+
+ @Override
+ public void writeSQL(SQLOutput stream) throws SQLException {
+ stream.writeString(first);
+ stream.writeString(last);
+ stream.writeInt(firstYear);
+ stream.writeString(secretIdentity);
+ }
+
+ @Override
+ public String toString() {
+ return "[ name =" + first + " " + last + " "
+ + firstYear + " " + secretIdentity + " ]";
+ }
+
+ public void setIdentity(String identity) {
+ secretIdentity = identity;
+ }
+
+ public String getIdentity() {
+ return secretIdentity;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof SuperHero) {
+ SuperHero ss = (SuperHero) obj;
+ return first.equals(ss.first) && last.equals(ss.last)
+ && firstYear.equals(ss.firstYear)
+ && type.equals(ss.type)
+ && secretIdentity.equals(ss.secretIdentity);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return ((31 + first.hashCode()) * 31) * 31
+ + ((31 + last.hashCode()) * 31) * 31
+ + ((31 + firstYear.hashCode()) * 31) * 31
+ + ((31 + type.hashCode()) * 31) * 31
+ + secretIdentity.hashCode();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/ws/8043129/MailTest.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8043129
+ * @summary JAF initialisation in SAAJ clashing with the one in javax.mail
+ * @author mkos
+ * @library javax.mail.jar
+ * @build MailTest
+ * @run main MailTest
+ */
+
+import javax.activation.CommandMap;
+import javax.activation.MailcapCommandMap;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Session;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+public class MailTest {
+
+ String host = null;
+ String user = "";
+ String password = null;
+ String from = null;
+ String to = null;
+
+ public static void main(String[] args) {
+ MailTest t = new MailTest();
+
+ t.user = "somebody@somewhere.com";
+ t.from = "somebody@somewhere.com";
+ t.to = "somebody@somewhere.com";
+
+ t.user = "somebody@somewhere.com";
+ t.password = "somepassword";
+ t.host = "somehost";
+
+ t.sendMail(); //this works
+
+ t.addSoapAttachement();
+ t.sendMail(); //after addAttachmentPart to soapmessage it do not work
+
+ // workaroundJAFSetup();
+ // t.sendMail(); //after workaround works again
+ }
+
+ void addSoapAttachement() {
+ try {
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SOAPMessage message = messageFactory.createMessage();
+ AttachmentPart a = message.createAttachmentPart();
+ a.setContentType("binary/octet-stream");
+ message.addAttachmentPart(a);
+ } catch (SOAPException e) {
+ e.printStackTrace();
+ }
+ }
+
+ void sendMail() {
+
+ try {
+ Properties props = new Properties();
+ props.put("mail.smtp.host", host);
+ props.put("mail.smtp.auth", "true");
+
+ Session session = Session.getInstance(props);
+ session.setDebug(true);
+
+ // Define message
+ MimeMessage message = new MimeMessage(session);
+ message.setFrom(new InternetAddress(from));
+ message.addRecipients(Message.RecipientType.TO, to);
+ message.setSubject("this is a multipart test");
+
+ Multipart multipart = new MimeMultipart();
+
+ BodyPart messageBodyPart1 = new MimeBodyPart();
+ messageBodyPart1.setText("please send also this Content\n ciao!");
+ multipart.addBodyPart(messageBodyPart1);
+
+ BodyPart messageBodyPart2 = new MimeBodyPart();
+ messageBodyPart2.setContent("<b>please</b> send also this Content <br>ciao!", "text/html; charset=UTF-8");
+ multipart.addBodyPart(messageBodyPart2);
+
+ message.setContent(multipart);
+
+ /*
+ Transport tr = session.getTransport("smtp");
+ tr.connect(host,user, password);
+ tr.sendMessage(message,InternetAddress.parse(to));
+ tr.close();
+ */
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ message.writeTo(baos);
+ String output = baos.toString();
+ System.out.println("output = " + output);
+ if (output.contains("also this Content")) {
+ System.out.println("Test PASSED.");
+ } else {
+ System.out.println("Test FAILED, missing content.");
+ throw new IllegalStateException("Test FAILED, missing content.");
+ }
+ } catch (MessagingException ignored) {
+ } catch (IOException ignored) {
+ }
+ }
+
+ // this is how the error can be worked around ...
+ static void workaroundJAFSetup() {
+ MailcapCommandMap mailMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
+ mailMap.addMailcap("multipart/mixed;;x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
+ }
+}
Binary file jdk/test/javax/xml/ws/8043129/javax.mail.jar has changed
--- a/jdk/test/sun/management/jdp/JdpDefaultsTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/management/jdp/JdpDefaultsTest.java Fri May 23 09:05:24 2014 -0700
@@ -28,7 +28,7 @@
* @test JdpDefaultsTest
* @summary Assert that we can read JDP packets from a multicast socket connection, on default IP and port.
* @library /lib/testlibrary
- * @build ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
+ * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
* @run main JdpDefaultsTest
*/
--- a/jdk/test/sun/management/jdp/JdpOffTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/management/jdp/JdpOffTest.java Fri May 23 09:05:24 2014 -0700
@@ -29,7 +29,7 @@
* @test JdpOffTest.java
* @summary Assert that no JDP packets are sent to the default address and port.
* @library /lib/testlibrary
- * @build ClientConnection JdpTestUtil JdpTestCase JdpOffTestCase DynamicLauncher
+ * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOffTestCase DynamicLauncher
* @run main JdpOffTest
*/
--- a/jdk/test/sun/management/jdp/JdpSpecificAddressTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/management/jdp/JdpSpecificAddressTest.java Fri May 23 09:05:24 2014 -0700
@@ -28,7 +28,7 @@
* @test JdpSpecificAddressTest
* @summary Assert that we can read JDP packets from a multicast socket connection, on specific IP and port.
* @library /lib/testlibrary
- * @build ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
+ * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
* @run main JdpSpecificAddressTest
*/
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java Fri May 23 09:05:24 2014 -0700
@@ -42,9 +42,7 @@
* without connection or username/password details.
* TestManager will attempt a connection to the address obtained from
* both agent properties and jvmstat buffer.
- * @build jdk.testlibrary.ProcessTools
- * @build jdk.testlibrary.Utils
- * @build TestManager TestApplication
+ * @build jdk.testlibrary.* TestManager TestApplication
* @run main/othervm/timeout=300 -XX:+UsePerfData LocalManagementTest
*/
--- a/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java Fri May 23 09:05:24 2014 -0700
@@ -28,11 +28,7 @@
* @library /lib/testlibrary
* @bug 6557093
* @summary Check SSL config file permission for out-of-the-box management
- * @build jdk.testlibrary.Utils
- * @build jdk.testlibrary.ProcessTools
- * @build jdk.testlibrary.OutputAnalyzer
- * @build AbstractFilePermissionTest
- * @build Dummy
+ * @build jdk.testlibrary.* AbstractFilePermissionTest Dummy
* @run main/timeout=300 PasswordFilePermissionTest
*
* @author Taras Ledkov
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh Fri May 23 09:05:24 2014 -0700
@@ -27,11 +27,7 @@
# @summary Test RMI Bootstrap
#
# @library /lib/testlibrary
-# @library /lib/testlibrary
-# @build jdk.testlibrary.Utils
-# @build TestLogger
-# @build Utils
-# @build RmiBootstrapTest
+# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
# @run shell/timeout=300 RmiBootstrapTest.sh
# Define the Java class test name
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java Fri May 23 09:05:24 2014 -0700
@@ -42,10 +42,7 @@
* @library /lib/testlibrary
* @bug 6228231
* @summary Test that RMI registry uses SSL.
- * @build jdk.testlibrary.Utils
- * @build jdk.testlibrary.ProcessTools
- * @build jdk.testlibrary.OutputAnalyzer
- * @build RmiRegistrySslTestApp
+ * @build jdk.testlibrary.* RmiRegistrySslTestApp
* @run main/timeout=300 RmiRegistrySslTest
* @author Luis-Miguel Alventosa, Taras Ledkov
*/
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh Fri May 23 09:05:24 2014 -0700
@@ -27,10 +27,7 @@
# @summary Test RMI Bootstrap with SSL
#
# @library /lib/testlibrary
-# @build jdk.testlibrary.Utils
-# @build TestLogger
-# @build Utils
-# @build RmiBootstrapTest
+# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
# @run shell/timeout=300 RmiSslBootstrapTest.sh
# Define the Java class test name
--- a/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java Fri May 23 09:05:24 2014 -0700
@@ -27,12 +27,7 @@
* @test
* @library /lib/testlibrary
* @bug 6557093
- * @bug 6557093
- * @build jdk.testlibrary.Utils
- * @build jdk.testlibrary.ProcessTools
- * @build jdk.testlibrary.OutputAnalyzer
- * @build Dummy
- * @build AbstractFilePermissionTest
+ * @build jdk.testlibrary.* Dummy AbstractFilePermissionTest
* @summary Check SSL config file permission for out-of-the-box management
* @run main/timeout=300 SSLConfigFilePermissionTest
*
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Fri May 23 09:05:24 2014 -0700
@@ -54,10 +54,7 @@
* @test
* @bug 7110104
* @library /lib/testlibrary
- * @build jdk.testlibrary.ProcessTools
- * @build jdk.testlibrary.JDKToolLauncher
- * @build jdk.testlibrary.Utils
- * @build JMXStartStopTest JMXStartStopDoSomething
+ * @build jdk.testlibrary.* JMXStartStopTest JMXStartStopDoSomething
* @run main/othervm JMXStartStopTest
* @summary Makes sure that enabling/disabling the management agent through
* JCMD achieves the desired results
--- a/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java Fri May 23 09:05:24 2014 -0700
@@ -40,7 +40,6 @@
import java.security.MessageDigest;
import java.util.*;
-import com.sun.security.auth.module.UnixSystem;
import sun.security.jgss.GSSUtil;
import sun.security.krb5.internal.APReq;
import sun.security.krb5.internal.rcache.AuthTime;
@@ -79,13 +78,7 @@
mode = -1;
}
- try {
- UnixSystem us = new com.sun.security.auth.module.UnixSystem();
- uid = us.getUid();
- } catch (Throwable e) {
- // Cannot be only Exception, might be UnsatisfiedLinkError
- uid = -1;
- }
+ uid = sun.misc.VM.geteuid();
KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true);
for (int i=0; i<nu; i++) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/text/resources/Format/Bug8037343.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8037343
+ * @summary updating dateformat for es_DO
+ */
+
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.Locale;
+
+public class Bug8037343
+{
+
+ public static void main(String[] arg)
+ {
+ final Locale esDO = new Locale("es", "DO");
+ final String expectedShort = "31/03/12";
+ final String expectedMedium = "31/03/2012";
+
+ int errors = 0;
+ DateFormat format;
+ String result;
+
+ Calendar cal = Calendar.getInstance(esDO);
+ cal.set(Calendar.DAY_OF_MONTH, 31);
+ cal.set(Calendar.MONTH, Calendar.MARCH);
+ cal.set(Calendar.YEAR, 2012);
+
+ format = DateFormat.getDateInstance(DateFormat.SHORT, esDO);
+ result = format.format(cal.getTime());
+ if (!expectedShort.equals(result)) {
+ System.out.println(String.format("Short Date format for es_DO is not as expected. Expected: [%s] Actual: [%s]", expectedShort, result));
+ errors++;
+ }
+
+ format = DateFormat.getDateInstance(DateFormat.MEDIUM, esDO);
+ result = format.format(cal.getTime());
+ if (!expectedMedium.equals(result)) {
+ System.out.println(String.format("Medium Date format for es_DO is not as expected. Expected: [%s] Actual: [%s]", expectedMedium, result));
+ errors++;
+ }
+
+ if (errors > 0) {
+ throw new RuntimeException();
+ }
+ }
+
+}
--- a/jdk/test/sun/text/resources/LocaleData Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/text/resources/LocaleData Fri May 23 09:05:24 2014 -0700
@@ -483,8 +483,8 @@
FormatData/es_DO/TimePatterns/3=hh:mm a
FormatData/es_DO/DatePatterns/0=EEEE d' de 'MMMM' de 'yyyy
FormatData/es_DO/DatePatterns/1=d' de 'MMMM' de 'yyyy
-FormatData/es_DO/DatePatterns/2=MM/dd/yyyy
-FormatData/es_DO/DatePatterns/3=MM/dd/yy
+# FormatData/es_DO/DatePatterns/2=MM/dd/yyyy # Changed: see bug 8037343
+# FormatData/es_DO/DatePatterns/3=MM/dd/yy # Changed: see bug 8037343
FormatData/es_DO/DateTimePatterns/0={1} {0}
FormatData/es_DO/NumberElements/0=.
FormatData/es_DO/NumberElements/1=,
@@ -7692,3 +7692,7 @@
FormatData/es_EC/TimePatterns/1=H:mm:ss z
FormatData/es_EC/TimePatterns/2=H:mm:ss
FormatData/es_EC/TimePatterns/3=H:mm
+
+# bug 8037343
+FormatData/es_DO/DatePatterns/2=dd/MM/yyyy
+FormatData/es_DO/DatePatterns/3=dd/MM/yy
--- a/jdk/test/sun/text/resources/LocaleDataTest.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java Fri May 23 09:05:24 2014 -0700
@@ -36,6 +36,7 @@
* 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
* 7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
* 7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 8017142
+ * 8037343
* @summary Verify locale data
*
*/
--- a/jdk/test/sun/tools/jcmd/TestJcmdSanity.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/tools/jcmd/TestJcmdSanity.java Fri May 23 09:05:24 2014 -0700
@@ -41,7 +41,7 @@
* @bug 7104647 7154822
* @library /lib/testlibrary
* @build jdk.testlibrary.*
- * @run main TestJcmdSanity
+ * @run main/othervm -XX:+UsePerfData TestJcmdSanity
*/
public class TestJcmdSanity {
--- a/jdk/test/sun/tools/jstat/JStatInterval.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/tools/jstat/JStatInterval.java Fri May 23 09:05:24 2014 -0700
@@ -28,8 +28,7 @@
* @summary Test checks case when target application finishes execution and jstat didn't complete work.
jstat is started with interval = 100 (jstat -compiler 100) and monitored application finishes
after 500ms. This shouldn't cause crash or hang in target application or in jstat.
- * @build jdk.testlibrary.ProcessTools jdk.testlibrary.JDKToolLauncher
- * @build JStatInterval
+ * @build jdk.testlibrary.* JStatInterval
* @run main JStatInterval
*/
--- a/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java Fri May 23 09:05:24 2014 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4990825
* @library /lib/testlibrary
- * @build JstatdTest JstatGCUtilParser
+ * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
* @run main/timeout=60 TestJstatdDefaults
*/
public class TestJstatdDefaults {
--- a/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java Fri May 23 09:05:24 2014 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4990825 7092186
* @library /lib/testlibrary
- * @build JstatdTest JstatGCUtilParser
+ * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
* @run main/timeout=60 TestJstatdExternalRegistry
*/
public class TestJstatdExternalRegistry {
--- a/jdk/test/sun/tools/jstatd/TestJstatdPort.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPort.java Fri May 23 09:05:24 2014 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4990825
* @library /lib/testlibrary
- * @build JstatdTest JstatGCUtilParser
+ * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
* @run main/timeout=60 TestJstatdPort
*/
public class TestJstatdPort {
--- a/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java Fri May 23 09:05:24 2014 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4990825
* @library /lib/testlibrary
- * @build JstatdTest JstatGCUtilParser
+ * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
* @run main/timeout=60 TestJstatdPortAndServer
*/
public class TestJstatdPortAndServer {
--- a/jdk/test/sun/tools/jstatd/TestJstatdServer.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/tools/jstatd/TestJstatdServer.java Fri May 23 09:05:24 2014 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 4990825
* @library /lib/testlibrary
- * @build JstatdTest JstatGCUtilParser
+ * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
* @run main/timeout=60 TestJstatdServer
*/
public class TestJstatdServer {
--- a/jdk/test/sun/tools/jstatd/TestJstatdUsage.java Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/tools/jstatd/TestJstatdUsage.java Fri May 23 09:05:24 2014 -0700
@@ -28,7 +28,7 @@
* @test
* @bug 4990825
* @library /lib/testlibrary
- * @build jdk.testlibrary.JDKToolLauncher jdk.testlibrary.OutputAnalyzer
+ * @build jdk.testlibrary.*
* @run main TestJstatdUsage
*/
public class TestJstatdUsage {
--- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION Fri May 23 09:05:24 2014 -0700
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-tzdata2014b
+tzdata2014c
--- a/jdk/test/sun/util/calendar/zi/tzdata/africa Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/util/calendar/zi/tzdata/africa Fri May 23 09:05:24 2014 -0700
@@ -358,11 +358,54 @@
# http://www.worldtimezone.com/dst_news/dst_news_egypt02.html
# </a>
+# From Ahmad El-Dardiry (2014-05-07):
+# Egypt is to change back to Daylight system on May 15
+# http://english.ahram.org.eg/NewsContent/1/64/100735/Egypt/Politics-/Egypts-government-to-reapply-daylight-saving-time-.aspx
+
+# From Gunther Vermier (2015-05-13):
+# our Egypt office confirms that the change will be at 15 May "midnight" (24:00)
+
+# From Paul Eggert (2014-05-13):
+# Sarah El Deeb and Lee Keath of AP report that the Egyptian government says
+# the change is because of blackouts in Cairo, even though Ahram Online (cited
+# above) says DST had no affect on electricity consumption. The AP story says
+# DST will not be observed during Ramadan. There is no information about when
+# DST will end. See:
+# http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833
+#
+# For now, guess that later transitions will use 2010's rules, and that
+# Egypt will agree with Morocco (see below) about the date Ramadan starts and
+# ends, though (unlike Morocco) it will switch at 00:00 standard time. In
+# Egypt the spring-forward transitions are removed for 2020-2022, when the
+# guessed spring-forward date falls during the estimated Ramadan, and all
+# transitions removed for 2023-2038, where the estimated Ramadan falls entirely
+# outside the guessed daylight-saving time. Ramadan intrudes on the guessed
+# DST starting in 2039, but that's beyond our somewhat-arbitrary cutoff.
+
Rule Egypt 2008 only - Aug lastThu 23:00s 0 -
Rule Egypt 2009 only - Aug 20 23:00s 0 -
Rule Egypt 2010 only - Aug 11 0:00 0 -
Rule Egypt 2010 only - Sep 10 0:00 1:00 S
Rule Egypt 2010 only - Sep lastThu 23:00s 0 -
+Rule Egypt 2014 only - May 15 24:00 1:00 S
+Rule Egypt 2014 only - Jun 29 0:00s 0 -
+Rule Egypt 2014 only - Jul 29 0:00s 1:00 S
+Rule Egypt 2014 max - Sep lastThu 23:00s 0 -
+Rule Egypt 2015 2019 - Apr lastFri 0:00s 1:00 S
+Rule Egypt 2015 only - Jun 18 0:00s 0 -
+Rule Egypt 2015 only - Jul 18 0:00s 1:00 S
+Rule Egypt 2016 only - Jun 7 0:00s 0 -
+Rule Egypt 2016 only - Jul 7 0:00s 1:00 S
+Rule Egypt 2017 only - May 27 0:00s 0 -
+Rule Egypt 2017 only - Jun 26 0:00s 1:00 S
+Rule Egypt 2018 only - May 16 0:00s 0 -
+Rule Egypt 2018 only - Jun 15 0:00s 1:00 S
+Rule Egypt 2019 only - May 6 0:00s 0 -
+Rule Egypt 2019 only - Jun 5 0:00s 1:00 S
+Rule Egypt 2020 only - May 24 0:00s 1:00 S
+Rule Egypt 2021 only - May 13 0:00s 1:00 S
+Rule Egypt 2022 only - May 3 0:00s 1:00 S
+Rule Egypt 2023 max - Apr lastFri 0:00s 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Cairo 2:05:09 - LMT 1900 Oct
--- a/jdk/test/sun/util/calendar/zi/tzdata/asia Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/util/calendar/zi/tzdata/asia Fri May 23 09:05:24 2014 -0700
@@ -1370,22 +1370,6 @@
# "Jordan will switch to winter time on Friday, October 27".
#
-# From Phil Pizzey (2009-04-02):
-# ...I think I may have spotted an error in the timezone data for
-# Jordan.
-# The current (2009d) asia file shows Jordan going to daylight
-# saving
-# time on the last Thursday in March.
-#
-# Rule Jordan 2000 max - Mar lastThu 0:00s 1:00 S
-#
-# However timeanddate.com, which I usually find reliable, shows Jordan
-# going to daylight saving time on the last Friday in March since 2002.
-# Please see
-# <a href="http://www.timeanddate.com/worldclock/timezone.html?n=11">
-# http://www.timeanddate.com/worldclock/timezone.html?n=11
-# </a>
-
# From Steffen Thorsen (2009-04-02):
# This single one might be good enough, (2009-03-24, Arabic):
# <a href="http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279">
--- a/jdk/test/sun/util/calendar/zi/tzdata/europe Tue May 13 10:29:12 2014 -0700
+++ b/jdk/test/sun/util/calendar/zi/tzdata/europe Fri May 23 09:05:24 2014 -0700
@@ -2989,6 +2989,10 @@
# From Alexander Krivenyshev (2014-03-17):
# time change at 2:00 (2am) on March 30, 2014
# http://vz.ru/news/2014/3/17/677464.html
+# From Paul Eggert (2014-03-30):
+# Simferopol and Sevastopol reportedly changed their central town clocks
+# late the previous day, but this appears to have been ceremonial
+# and the discrepancies are small enough to not worry about.
2:00 EU EE%sT 2014 Mar 30 2:00
4:00 - MSK
--- a/langtools/.hgtags Tue May 13 10:29:12 2014 -0700
+++ b/langtools/.hgtags Fri May 23 09:05:24 2014 -0700
@@ -255,3 +255,4 @@
7736a820af6f15cef9a1499f122e40abc83b2fbd jdk9-b10
f04fccfbd880c819affc3ef33e0083aab9556409 jdk9-b11
72efbe612e494f98b9c3ede1b4a3d02304e1e9cc jdk9-b12
+2c8bb81b5d48161019218c7604fa88c67edc6105 jdk9-b13
--- a/langtools/make/netbeans/langtools/nbproject/project.properties Tue May 13 10:29:12 2014 -0700
+++ b/langtools/make/netbeans/langtools/nbproject/project.properties Fri May 23 09:05:24 2014 -0700
@@ -1,3 +1,34 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Fri May 23 09:05:24 2014 -0700
@@ -878,8 +878,9 @@
*/
static abstract class DocComparator<T extends Doc> implements Comparator<Doc> {
/**
- * compares two parameter arrays by first comparing the length of the arrays, and
- * then each Type of the parameter in the array.
+ * compares two parameter arrays by comparing each Type of the parameter in the array,
+ * as possible, if the matched strings are identical, and have mismatched array lengths
+ * then compare the lengths.
* @param params1 the first parameter array.
* @param params2 the first parameter array.
* @return a negative integer, zero, or a positive integer as the first
@@ -889,17 +890,14 @@
if (params1.length == 0 && params2.length == 0) {
return 0;
}
- int result = Integer.compare(params1.length, params2.length);
- if (result != 0) {
- return result;
- }
- for (int i = 0; i < params1.length; i++) {
- result = compareStrings(params1[i].typeName(), params2[i].typeName());
+ // try to compare as many as possible
+ for (int i = 0; i < params1.length && i < params2.length; i++) {
+ int result = compareStrings(params1[i].typeName(), params2[i].typeName());
if (result != 0) {
return result;
}
}
- return 0;
+ return Integer.compare(params1.length, params2.length);
}
/**
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java Fri May 23 09:05:24 2014 -0700
@@ -118,7 +118,8 @@
: types.erasure(type);
return new Type.ClassType(types.syms.classType.getEnclosingType(),
List.of(arg),
- types.syms.classType.tsym);
+ types.syms.classType.tsym,
+ Type.noAnnotations);
}
public String toString() {
return classType + ".class";
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java Fri May 23 09:05:24 2014 -0700
@@ -28,7 +28,6 @@
import java.util.Locale;
import com.sun.tools.javac.api.Messages;
-import com.sun.tools.javac.code.Type.AnnotatedType;
import com.sun.tools.javac.code.Type.ArrayType;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type.*;
@@ -150,14 +149,16 @@
@Override
public String visitCapturedType(CapturedType t, Locale locale) {
if (seenCaptured.contains(t))
- return localize(locale, "compiler.misc.type.captureof.1",
- capturedVarId(t, locale));
+ return printAnnotations(t) +
+ localize(locale, "compiler.misc.type.captureof.1",
+ capturedVarId(t, locale));
else {
try {
seenCaptured = seenCaptured.prepend(t);
- return localize(locale, "compiler.misc.type.captureof",
- capturedVarId(t, locale),
- visit(t.wildcard, locale));
+ return printAnnotations(t) +
+ localize(locale, "compiler.misc.type.captureof",
+ capturedVarId(t, locale),
+ visit(t.wildcard, locale));
}
finally {
seenCaptured = seenCaptured.tail;
@@ -167,15 +168,16 @@
@Override
public String visitForAll(ForAll t, Locale locale) {
- return "<" + visitTypes(t.tvars, locale) + ">" + visit(t.qtype, locale);
+ return printAnnotations(t) + "<" + visitTypes(t.tvars, locale) +
+ ">" + visit(t.qtype, locale);
}
@Override
public String visitUndetVar(UndetVar t, Locale locale) {
if (t.inst != null) {
- return visit(t.inst, locale);
+ return printAnnotations(t) + visit(t.inst, locale);
} else {
- return visit(t.qtype, locale) + "?";
+ return printAnnotations(t) + visit(t.qtype, locale) + "?";
}
}
@@ -187,25 +189,34 @@
return res.toString();
}
- void printBaseElementType(Type t, StringBuilder sb, Locale locale) {
+ private String printAnnotations(Type t) {
+ return printAnnotations(t, false);
+ }
+
+ private String printAnnotations(Type t, boolean prefix) {
+ StringBuilder sb = new StringBuilder();
+ List<Attribute.TypeCompound> annos = t.getAnnotationMirrors();
+ if (!annos.isEmpty()) {
+ if (prefix) sb.append(' ');
+ sb.append(annos);
+ sb.append(' ');
+ }
+ return sb.toString();
+ }
+
+ private void printBaseElementType(Type t, StringBuilder sb, Locale locale) {
Type arrel = t;
while (arrel.hasTag(TypeTag.ARRAY)) {
- arrel = arrel.unannotatedType();
arrel = ((ArrayType) arrel).elemtype;
}
sb.append(visit(arrel, locale));
}
- void printBrackets(Type t, StringBuilder sb, Locale locale) {
+ private void printBrackets(Type t, StringBuilder sb, Locale locale) {
Type arrel = t;
while (arrel.hasTag(TypeTag.ARRAY)) {
- if (arrel.isAnnotated()) {
- sb.append(' ');
- sb.append(arrel.getAnnotationMirrors());
- sb.append(' ');
- }
+ sb.append(printAnnotations(arrel, true));
sb.append("[]");
- arrel = arrel.unannotatedType();
arrel = ((ArrayType) arrel).elemtype;
}
}
@@ -216,8 +227,10 @@
if (t.getEnclosingType().hasTag(CLASS) && t.tsym.owner.kind == Kinds.TYP) {
buf.append(visit(t.getEnclosingType(), locale));
buf.append('.');
+ buf.append(printAnnotations(t));
buf.append(className(t, false, locale));
} else {
+ buf.append(printAnnotations(t));
buf.append(className(t, true, locale));
}
if (t.getTypeArguments().nonEmpty()) {
@@ -230,7 +243,8 @@
@Override
public String visitMethodType(MethodType t, Locale locale) {
- return "(" + printMethodArgs(t.argtypes, false, locale) + ")" + visit(t.restype, locale);
+ return "(" + printMethodArgs(t.argtypes, false, locale) + ")" +
+ visit(t.restype, locale);
}
@Override
@@ -243,6 +257,7 @@
StringBuilder s = new StringBuilder();
s.append(t.kind);
if (t.kind != UNBOUND) {
+ s.append(printAnnotations(t));
s.append(visit(t.type, locale));
}
return s.toString();
@@ -258,28 +273,6 @@
return visitType(t, locale);
}
- @Override
- public String visitAnnotatedType(AnnotatedType t, Locale locale) {
- if (t.getAnnotationMirrors().nonEmpty()) {
- if (t.unannotatedType().hasTag(TypeTag.ARRAY)) {
- StringBuilder res = new StringBuilder();
- printBaseElementType(t, res, locale);
- printBrackets(t, res, locale);
- return res.toString();
- } else if (t.unannotatedType().hasTag(TypeTag.CLASS) &&
- t.unannotatedType().getEnclosingType() != Type.noType) {
- return visit(t.unannotatedType().getEnclosingType(), locale) +
- ". " +
- t.getAnnotationMirrors() +
- " " + className((ClassType)t.unannotatedType(), false, locale);
- } else {
- return t.getAnnotationMirrors() + " " + visit(t.unannotatedType(), locale);
- }
- } else {
- return visit(t.unannotatedType(), locale);
- }
- }
-
public String visitType(Type t, Locale locale) {
String s = (t.tsym == null || t.tsym.name == null)
? localize(locale, "compiler.misc.type.none")
@@ -345,8 +338,8 @@
args = args.tail;
buf.append(',');
}
- if (args.head.unannotatedType().hasTag(TypeTag.ARRAY)) {
- buf.append(visit(((ArrayType) args.head.unannotatedType()).elemtype, locale));
+ if (args.head.hasTag(TypeTag.ARRAY)) {
+ buf.append(visit(((ArrayType) args.head).elemtype, locale));
if (args.head.getAnnotationMirrors().nonEmpty()) {
buf.append(' ');
buf.append(args.head.getAnnotationMirrors());
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Fri May 23 09:05:24 2014 -0700
@@ -234,7 +234,7 @@
public boolean allowGraphInference() {
return compareTo(JDK1_8) >= 0;
}
- public boolean allowStructuralMostSpecific() {
+ public boolean allowFunctionalInterfaceMostSpecific() {
return compareTo(JDK1_8) >= 0;
}
public static SourceVersion toSourceVersion(Source source) {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Fri May 23 09:05:24 2014 -0700
@@ -956,7 +956,7 @@
this(
flags,
name,
- new ClassType(Type.noType, null, null),
+ new ClassType(Type.noType, null, null, Type.noAnnotations),
owner);
this.type.tsym = this;
}
@@ -992,7 +992,8 @@
public Type erasure(Types types) {
if (erasure_field == null)
erasure_field = new ClassType(types.erasure(type.getEnclosingType()),
- List.<Type>nil(), this);
+ List.<Type>nil(), this,
+ type.getAnnotationMirrors());
return erasure_field;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Fri May 23 09:05:24 2014 -0700
@@ -80,6 +80,9 @@
/** Constant type: special type to be used for marking stuck trees. */
public static final JCNoType stuckType = new JCNoType();
+ public static final List<Attribute.TypeCompound> noAnnotations =
+ List.nil();
+
/** If this switch is turned on, the names of type variables
* and anonymous classes are printed with hashcodes appended.
*/
@@ -89,6 +92,10 @@
*/
public TypeSymbol tsym;
+ /** The type annotations on this type.
+ */
+ protected final List<Attribute.TypeCompound> annos;
+
/**
* Checks if the current type tag is equal to the given tag.
* @return true if tag is equal to the current type tag.
@@ -173,10 +180,15 @@
public <R,S> R accept(Type.Visitor<R,S> v, S s) { return v.visitType(this, s); }
- /** Define a type given its tag and type symbol
+ /** Define a type given its tag, type symbol, and type annotations
*/
- public Type(TypeSymbol tsym) {
+ public Type(TypeSymbol tsym, List<Attribute.TypeCompound> annos) {
+ if(annos == null) {
+ Assert.error("Attempting to create type " + tsym + " with null type annotations");
+ }
+
this.tsym = tsym;
+ this.annos = annos;
}
/** An abstract class for mappings from types to types
@@ -225,25 +237,15 @@
return this;
}
- public Type annotatedType(List<Attribute.TypeCompound> annos) {
- return new AnnotatedType(annos, this);
- }
+ public abstract Type annotatedType(List<Attribute.TypeCompound> annos);
public boolean isAnnotated() {
- return false;
- }
-
- /**
- * If this is an annotated type, return the underlying type.
- * Otherwise, return the type itself.
- */
- public Type unannotatedType() {
- return this;
+ return !annos.isEmpty();
}
@Override
public List<Attribute.TypeCompound> getAnnotationMirrors() {
- return List.nil();
+ return annos;
}
@@ -272,16 +274,35 @@
return ts;
}
+ protected void appendAnnotationsString(StringBuilder sb,
+ boolean prefix) {
+ if (isAnnotated()) {
+ if (prefix) {
+ sb.append(" ");
+ }
+ sb.append(annos);
+ sb.append(" ");
+ }
+ }
+
+ protected void appendAnnotationsString(StringBuilder sb) {
+ appendAnnotationsString(sb, false);
+ }
+
/** The Java source which this type represents.
*/
public String toString() {
- String s = (tsym == null || tsym.name == null)
- ? "<none>"
- : tsym.name.toString();
+ StringBuilder sb = new StringBuilder();
+ appendAnnotationsString(sb);
+ if (tsym == null || tsym.name == null) {
+ sb.append("<none>");
+ } else {
+ sb.append(tsym.name);
+ }
if (moreInfo && hasTag(TYPEVAR)) {
- s = s + hashCode();
+ sb.append(hashCode());
}
- return s;
+ return sb.toString();
}
/**
@@ -333,8 +354,8 @@
args = args.tail;
buf.append(',');
}
- if (args.head.unannotatedType().hasTag(ARRAY)) {
- buf.append(((ArrayType)args.head.unannotatedType()).elemtype);
+ if (args.head.hasTag(ARRAY)) {
+ buf.append(((ArrayType)args.head).elemtype);
if (args.head.getAnnotationMirrors().nonEmpty()) {
buf.append(args.head.getAnnotationMirrors());
}
@@ -486,12 +507,22 @@
TypeTag tag;
public JCPrimitiveType(TypeTag tag, TypeSymbol tsym) {
- super(tsym);
+ this(tag, tsym, noAnnotations);
+ }
+
+ public JCPrimitiveType(TypeTag tag, TypeSymbol tsym,
+ List<Attribute.TypeCompound> annos) {
+ super(tsym, annos);
this.tag = tag;
Assert.check(tag.isPrimitive);
}
@Override
+ public Type annotatedType(List<Attribute.TypeCompound> annos) {
+ return new JCPrimitiveType(tag, tsym, annos);
+ }
+
+ @Override
public boolean isNumeric() {
return tag != BOOLEAN;
}
@@ -517,7 +548,7 @@
@Override
public Type constType(Object constValue) {
final Object value = constValue;
- return new JCPrimitiveType(tag, tsym) {
+ return new JCPrimitiveType(tag, tsym, annos) {
@Override
public Object constValue() {
return value;
@@ -601,17 +632,35 @@
}
public WildcardType(Type type, BoundKind kind, TypeSymbol tsym) {
- super(tsym);
+ this(type, kind, tsym, null, noAnnotations);
+ }
+
+ public WildcardType(Type type, BoundKind kind, TypeSymbol tsym,
+ List<Attribute.TypeCompound> annos) {
+ this(type, kind, tsym, null, annos);
+ }
+
+ public WildcardType(WildcardType t, TypeVar bound,
+ List<Attribute.TypeCompound> annos) {
+ this(t.type, t.kind, t.tsym, bound, annos);
+ }
+
+ public WildcardType(Type type, BoundKind kind, TypeSymbol tsym,
+ TypeVar bound) {
+ this(type, kind, tsym, noAnnotations);
+ }
+
+ public WildcardType(Type type, BoundKind kind, TypeSymbol tsym,
+ TypeVar bound, List<Attribute.TypeCompound> annos) {
+ super(tsym, annos);
this.type = Assert.checkNonNull(type);
this.kind = kind;
- }
- public WildcardType(WildcardType t, TypeVar bound) {
- this(t.type, t.kind, t.tsym, bound);
+ this.bound = bound;
}
- public WildcardType(Type type, BoundKind kind, TypeSymbol tsym, TypeVar bound) {
- this(type, kind, tsym);
- this.bound = bound;
+ @Override
+ public WildcardType annotatedType(List<Attribute.TypeCompound> annos) {
+ return new WildcardType(type, kind, tsym, bound, annos);
}
@Override
@@ -658,6 +707,7 @@
boolean isPrintingBound = false;
public String toString() {
StringBuilder s = new StringBuilder();
+ appendAnnotationsString(s);
s.append(kind.toString());
if (kind != UNBOUND)
s.append(type);
@@ -679,7 +729,7 @@
if (t == type)
return this;
else
- return new WildcardType(t, kind, tsym, bound);
+ return new WildcardType(t, kind, tsym, bound, annos);
}
public Type getExtendsBound() {
@@ -736,7 +786,12 @@
public List<Type> all_interfaces_field;
public ClassType(Type outer, List<Type> typarams, TypeSymbol tsym) {
- super(tsym);
+ this(outer, typarams, tsym, noAnnotations);
+ }
+
+ public ClassType(Type outer, List<Type> typarams, TypeSymbol tsym,
+ List<Attribute.TypeCompound> annos) {
+ super(tsym, annos);
this.outer_field = outer;
this.typarams_field = typarams;
this.allparams_field = null;
@@ -754,6 +809,15 @@
}
@Override
+ public ClassType annotatedType(List<Attribute.TypeCompound> annos) {
+ final ClassType out = new ClassType(outer_field, typarams_field, tsym, annos);
+ out.allparams_field = allparams_field;
+ out.supertype_field = supertype_field;
+ out.interfaces_field = interfaces_field;
+ return out;
+ }
+
+ @Override
public TypeTag getTag() {
return CLASS;
}
@@ -765,7 +829,7 @@
public Type constType(Object constValue) {
final Object value = constValue;
- return new ClassType(getEnclosingType(), typarams_field, tsym) {
+ return new ClassType(getEnclosingType(), typarams_field, tsym, annos) {
@Override
public Object constValue() {
return value;
@@ -781,6 +845,7 @@
*/
public String toString() {
StringBuilder buf = new StringBuilder();
+ appendAnnotationsString(buf);
if (getEnclosingType().hasTag(CLASS) && tsym.owner.kind == TYP) {
buf.append(getEnclosingType().toString());
buf.append(".");
@@ -806,7 +871,7 @@
return s.toString();
} else if (sym.name.isEmpty()) {
String s;
- ClassType norm = (ClassType) tsym.type.unannotatedType();
+ ClassType norm = (ClassType) tsym.type;
if (norm == null) {
s = Log.getLocalizedString("anonymous.class", (Object)null);
} else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
@@ -858,7 +923,7 @@
return
getEnclosingType().isErroneous() ||
isErroneous(getTypeArguments()) ||
- this != tsym.type.unannotatedType() && tsym.type.isErroneous();
+ this != tsym.type && tsym.type.isErroneous();
}
public boolean isParameterized() {
@@ -897,7 +962,7 @@
List<Type> typarams = getTypeArguments();
List<Type> typarams1 = map(typarams, f);
if (outer1 == outer && typarams1 == typarams) return this;
- else return new ClassType(outer1, typarams1, tsym);
+ else return new ClassType(outer1, typarams1, tsym, annos);
}
public boolean contains(Type elem) {
@@ -924,7 +989,12 @@
public static class ErasedClassType extends ClassType {
public ErasedClassType(Type outer, TypeSymbol tsym) {
- super(outer, List.<Type>nil(), tsym);
+ this(outer, tsym, noAnnotations);
+ }
+
+ public ErasedClassType(Type outer, TypeSymbol tsym,
+ List<Attribute.TypeCompound> annos) {
+ super(outer, List.<Type>nil(), tsym, annos);
}
@Override
@@ -938,7 +1008,9 @@
final List<? extends Type> alternatives_field;
public UnionClassType(ClassType ct, List<? extends Type> alternatives) {
- super(ct.outer_field, ct.typarams_field, ct.tsym);
+ // Presently no way to refer to this type directly, so we
+ // cannot put annotations directly on it.
+ super(ct.outer_field, ct.typarams_field, ct.tsym, noAnnotations);
allparams_field = ct.allparams_field;
supertype_field = ct.supertype_field;
interfaces_field = ct.interfaces_field;
@@ -971,7 +1043,9 @@
public boolean allInterfaces;
public IntersectionClassType(List<Type> bounds, ClassSymbol csym, boolean allInterfaces) {
- super(Type.noType, List.<Type>nil(), csym);
+ // Presently no way to refer to this type directly, so we
+ // cannot put annotations directly on it.
+ super(Type.noType, List.<Type>nil(), csym, noAnnotations);
this.allInterfaces = allInterfaces;
Assert.check((csym.flags() & COMPOUND) != 0);
supertype_field = bounds.head;
@@ -1011,11 +1085,21 @@
public Type elemtype;
public ArrayType(Type elemtype, TypeSymbol arrayClass) {
- super(arrayClass);
+ this(elemtype, arrayClass, noAnnotations);
+ }
+
+ public ArrayType(Type elemtype, TypeSymbol arrayClass,
+ List<Attribute.TypeCompound> annos) {
+ super(arrayClass, annos);
this.elemtype = elemtype;
}
@Override
+ public ArrayType annotatedType(List<Attribute.TypeCompound> annos) {
+ return new ArrayType(elemtype, tsym, annos);
+ }
+
+ @Override
public TypeTag getTag() {
return ARRAY;
}
@@ -1025,7 +1109,11 @@
}
public String toString() {
- return elemtype + "[]";
+ StringBuilder sb = new StringBuilder();
+ sb.append(elemtype);
+ appendAnnotationsString(sb, true);
+ sb.append("[]");
+ return sb.toString();
}
public boolean equals(Object obj) {
@@ -1068,7 +1156,7 @@
}
public ArrayType makeVarargs() {
- return new ArrayType(elemtype, tsym) {
+ return new ArrayType(elemtype, tsym, annos) {
@Override
public boolean isVarargs() {
return true;
@@ -1079,7 +1167,7 @@
public Type map(Mapping f) {
Type elemtype1 = f.apply(elemtype);
if (elemtype1 == elemtype) return this;
- else return new ArrayType(elemtype1, tsym);
+ else return new ArrayType(elemtype1, tsym, annos);
}
public boolean contains(Type elem) {
@@ -1117,13 +1205,20 @@
Type restype,
List<Type> thrown,
TypeSymbol methodClass) {
- super(methodClass);
+ // Presently no way to refer to a method type directly, so
+ // we cannot put type annotations on it.
+ super(methodClass, noAnnotations);
this.argtypes = argtypes;
this.restype = restype;
this.thrown = thrown;
}
@Override
+ public MethodType annotatedType(List<Attribute.TypeCompound> annos) {
+ throw new AssertionError("Cannot annotate a method type");
+ }
+
+ @Override
public TypeTag getTag() {
return METHOD;
}
@@ -1138,7 +1233,13 @@
* should be.
*/
public String toString() {
- return "(" + argtypes + ")" + restype;
+ StringBuilder sb = new StringBuilder();
+ appendAnnotationsString(sb);
+ sb.append('(');
+ sb.append(argtypes);
+ sb.append(')');
+ sb.append(restype);
+ return sb.toString();
}
public List<Type> getParameterTypes() { return argtypes; }
@@ -1197,7 +1298,13 @@
public static class PackageType extends Type implements NoType {
PackageType(TypeSymbol tsym) {
- super(tsym);
+ // Package types cannot be annotated
+ super(tsym, noAnnotations);
+ }
+
+ @Override
+ public PackageType annotatedType(List<Attribute.TypeCompound> annos) {
+ throw new AssertionError("Cannot annotate a package type");
}
@Override
@@ -1245,18 +1352,29 @@
public Type lower;
public TypeVar(Name name, Symbol owner, Type lower) {
- super(null);
+ this(name, owner, lower, noAnnotations);
+ }
+
+ public TypeVar(Name name, Symbol owner, Type lower,
+ List<Attribute.TypeCompound> annos) {
+ super(null, annos);
tsym = new TypeVariableSymbol(0, name, this, owner);
this.lower = lower;
}
- public TypeVar(TypeSymbol tsym, Type bound, Type lower) {
- super(tsym);
+ public TypeVar(TypeSymbol tsym, Type bound, Type lower,
+ List<Attribute.TypeCompound> annos) {
+ super(tsym, annos);
this.bound = bound;
this.lower = lower;
}
@Override
+ public TypeVar annotatedType(List<Attribute.TypeCompound> annos) {
+ return new TypeVar(tsym, bound, lower, annos);
+ }
+
+ @Override
public TypeTag getTag() {
return TYPEVAR;
}
@@ -1317,13 +1435,29 @@
Symbol owner,
Type upper,
Type lower,
- WildcardType wildcard) {
- super(name, owner, lower);
+ WildcardType wildcard,
+ List<Attribute.TypeCompound> annos) {
+ super(name, owner, lower, annos);
this.lower = Assert.checkNonNull(lower);
this.bound = upper;
this.wildcard = wildcard;
}
+ public CapturedType(TypeSymbol tsym,
+ Type bound,
+ Type upper,
+ Type lower,
+ WildcardType wildcard,
+ List<Attribute.TypeCompound> annos) {
+ super(tsym, bound, lower, annos);
+ this.wildcard = wildcard;
+ }
+
+ @Override
+ public CapturedType annotatedType(List<Attribute.TypeCompound> annos) {
+ return new CapturedType(tsym, bound, bound, lower, wildcard, annos);
+ }
+
@Override
public <R,S> R accept(Type.Visitor<R,S> v, S s) {
return v.visitCapturedType(this, s);
@@ -1336,18 +1470,22 @@
@Override
public String toString() {
- return "capture#"
- + (hashCode() & 0xFFFFFFFFL) % Printer.PRIME
- + " of "
- + wildcard;
+ StringBuilder sb = new StringBuilder();
+ appendAnnotationsString(sb);
+ sb.append("capture#");
+ sb.append((hashCode() & 0xFFFFFFFFL) % Printer.PRIME);
+ sb.append(" of ");
+ sb.append(wildcard);
+ return sb.toString();
}
}
public static abstract class DelegatedType extends Type {
public Type qtype;
public TypeTag tag;
- public DelegatedType(TypeTag tag, Type qtype) {
- super(qtype.tsym);
+ public DelegatedType(TypeTag tag, Type qtype,
+ List<Attribute.TypeCompound> annos) {
+ super(qtype.tsym, annos);
this.tag = tag;
this.qtype = qtype;
}
@@ -1373,17 +1511,28 @@
public List<Type> tvars;
public ForAll(List<Type> tvars, Type qtype) {
- super(FORALL, (MethodType)qtype);
+ super(FORALL, (MethodType)qtype, noAnnotations);
this.tvars = tvars;
}
@Override
+ public ForAll annotatedType(List<Attribute.TypeCompound> annos) {
+ throw new AssertionError("Cannot annotate forall type");
+ }
+
+ @Override
public <R,S> R accept(Type.Visitor<R,S> v, S s) {
return v.visitForAll(this, s);
}
public String toString() {
- return "<" + tvars + ">" + qtype;
+ StringBuilder sb = new StringBuilder();
+ appendAnnotationsString(sb);
+ sb.append('<');
+ sb.append(tvars);
+ sb.append('>');
+ sb.append(qtype);
+ return sb.toString();
}
public List<Type> getTypeArguments() { return tvars; }
@@ -1479,7 +1628,8 @@
}
public UndetVar(TypeVar origin, Types types) {
- super(UNDETVAR, origin);
+ // This is a synthesized internal type, so we cannot annotate it.
+ super(UNDETVAR, origin, noAnnotations);
bounds = new EnumMap<>(InferenceBound.class);
List<Type> declaredBounds = types.getBounds(origin);
declaredCount = declaredBounds.length();
@@ -1489,7 +1639,15 @@
}
public String toString() {
- return (inst == null) ? qtype + "?" : inst.toString();
+ StringBuilder sb = new StringBuilder();
+ appendAnnotationsString(sb);
+ if (inst == null) {
+ sb.append(qtype);
+ sb.append('?');
+ } else {
+ sb.append(inst);
+ }
+ return sb.toString();
}
public String debugString() {
@@ -1507,6 +1665,11 @@
}
@Override
+ public UndetVar annotatedType(List<Attribute.TypeCompound> annos) {
+ throw new AssertionError("Cannot annotate an UndetVar type");
+ }
+
+ @Override
public boolean isPartial() {
return true;
}
@@ -1659,7 +1822,15 @@
*/
public static class JCNoType extends Type implements NoType {
public JCNoType() {
- super(null);
+ // Need to use List.nil(), because JCNoType constructor
+ // gets called in static initializers in Type, where
+ // noAnnotations is also defined.
+ super(null, List.<Attribute.TypeCompound>nil());
+ }
+
+ @Override
+ public JCNoType annotatedType(List<Attribute.TypeCompound> annos) {
+ throw new AssertionError("Cannot annotate JCNoType");
}
@Override
@@ -1686,7 +1857,13 @@
public static class JCVoidType extends Type implements NoType {
public JCVoidType() {
- super(null);
+ // Void cannot be annotated
+ super(null, noAnnotations);
+ }
+
+ @Override
+ public JCVoidType annotatedType(List<Attribute.TypeCompound> annos) {
+ throw new AssertionError("Cannot annotate void type");
}
@Override
@@ -1715,7 +1892,13 @@
static class BottomType extends Type implements NullType {
public BottomType() {
- super(null);
+ // Bottom is a synthesized internal type, so it cannot be annotated
+ super(null, noAnnotations);
+ }
+
+ @Override
+ public BottomType annotatedType(List<Attribute.TypeCompound> annos) {
+ throw new AssertionError("Cannot annotate bottom type");
}
@Override
@@ -1759,7 +1942,12 @@
private Type originalType = null;
public ErrorType(Type originalType, TypeSymbol tsym) {
- super(noType, List.<Type>nil(), null);
+ this(originalType, tsym, noAnnotations);
+ }
+
+ public ErrorType(Type originalType, TypeSymbol tsym,
+ List<Attribute.TypeCompound> typeAnnotations) {
+ super(noType, List.<Type>nil(), null, typeAnnotations);
this.tsym = tsym;
this.originalType = (originalType == null ? noType : originalType);
}
@@ -1772,6 +1960,11 @@
}
@Override
+ public ErrorType annotatedType(List<Attribute.TypeCompound> annos) {
+ return new ErrorType(originalType, tsym, annos);
+ }
+
+ @Override
public TypeTag getTag() {
return ERROR;
}
@@ -1827,182 +2020,17 @@
}
}
- public static class AnnotatedType extends Type
- implements
- javax.lang.model.type.ArrayType,
- javax.lang.model.type.DeclaredType,
- javax.lang.model.type.PrimitiveType,
- javax.lang.model.type.TypeVariable,
- javax.lang.model.type.WildcardType {
- /** The type annotations on this type.
- */
- private List<Attribute.TypeCompound> typeAnnotations;
-
- /** The underlying type that is annotated.
- */
- private Type underlyingType;
-
- protected AnnotatedType(List<Attribute.TypeCompound> typeAnnotations,
- Type underlyingType) {
- super(underlyingType.tsym);
- this.typeAnnotations = typeAnnotations;
- this.underlyingType = underlyingType;
- Assert.check(typeAnnotations != null && typeAnnotations.nonEmpty(),
- "Can't create AnnotatedType without annotations: " + underlyingType);
- Assert.check(!underlyingType.isAnnotated(),
- "Can't annotate already annotated type: " + underlyingType +
- "; adding: " + typeAnnotations);
- }
-
- @Override
- public TypeTag getTag() {
- return underlyingType.getTag();
- }
+ public static class UnknownType extends Type {
- @Override
- public boolean isAnnotated() {
- return true;
- }
-
- @Override
- public List<Attribute.TypeCompound> getAnnotationMirrors() {
- return typeAnnotations;
- }
-
-
- @Override
- public TypeKind getKind() {
- return underlyingType.getKind();
- }
-
- @Override
- public Type unannotatedType() {
- return underlyingType;
- }
-
- @Override
- public <R,S> R accept(Type.Visitor<R,S> v, S s) {
- return v.visitAnnotatedType(this, s);
- }
-
- @Override
- public <R, P> R accept(TypeVisitor<R, P> v, P p) {
- return underlyingType.accept(v, p);
- }
-
- @Override
- public Type map(Mapping f) {
- underlyingType.map(f);
- return this;
+ public UnknownType() {
+ // Unknown is a synthesized internal type, so it cannot be
+ // annotated.
+ super(null, noAnnotations);
}
@Override
- public Type constType(Object constValue) { return underlyingType.constType(constValue); }
- @Override
- public Type getEnclosingType() { return underlyingType.getEnclosingType(); }
-
- @Override
- public Type getReturnType() { return underlyingType.getReturnType(); }
- @Override
- public List<Type> getTypeArguments() { return underlyingType.getTypeArguments(); }
- @Override
- public List<Type> getParameterTypes() { return underlyingType.getParameterTypes(); }
- @Override
- public Type getReceiverType() { return underlyingType.getReceiverType(); }
- @Override
- public List<Type> getThrownTypes() { return underlyingType.getThrownTypes(); }
- @Override
- public Type getUpperBound() { return underlyingType.getUpperBound(); }
- @Override
- public Type getLowerBound() { return underlyingType.getLowerBound(); }
-
- @Override
- public boolean isErroneous() { return underlyingType.isErroneous(); }
- @Override
- public boolean isCompound() { return underlyingType.isCompound(); }
- @Override
- public boolean isInterface() { return underlyingType.isInterface(); }
- @Override
- public List<Type> allparams() { return underlyingType.allparams(); }
- @Override
- public boolean isPrimitive() { return underlyingType.isPrimitive(); }
- @Override
- public boolean isPrimitiveOrVoid() { return underlyingType.isPrimitiveOrVoid(); }
- @Override
- public boolean isNumeric() { return underlyingType.isNumeric(); }
- @Override
- public boolean isReference() { return underlyingType.isReference(); }
- @Override
- public boolean isNullOrReference() { return underlyingType.isNullOrReference(); }
- @Override
- public boolean isPartial() { return underlyingType.isPartial(); }
- @Override
- public boolean isParameterized() { return underlyingType.isParameterized(); }
- @Override
- public boolean isRaw() { return underlyingType.isRaw(); }
- @Override
- public boolean isFinal() { return underlyingType.isFinal(); }
- @Override
- public boolean isSuperBound() { return underlyingType.isSuperBound(); }
- @Override
- public boolean isExtendsBound() { return underlyingType.isExtendsBound(); }
- @Override
- public boolean isUnbound() { return underlyingType.isUnbound(); }
-
- @Override
- public String toString() {
- // This method is only used for internal debugging output.
- // See
- // com.sun.tools.javac.code.Printer.visitAnnotatedType(AnnotatedType, Locale)
- // for the user-visible logic.
- if (typeAnnotations != null &&
- !typeAnnotations.isEmpty()) {
- return "(" + typeAnnotations.toString() + " :: " + underlyingType.toString() + ")";
- } else {
- return "({} :: " + underlyingType.toString() +")";
- }
- }
-
- @Override
- public boolean contains(Type t) { return underlyingType.contains(t); }
-
- @Override
- public Type withTypeVar(Type t) {
- // Don't create a new AnnotatedType, as 'this' will
- // get its annotations set later.
- underlyingType = underlyingType.withTypeVar(t);
- return this;
- }
-
- // TODO: attach annotations?
- @Override
- public TypeSymbol asElement() { return underlyingType.asElement(); }
-
- // TODO: attach annotations?
- @Override
- public MethodType asMethodType() { return underlyingType.asMethodType(); }
-
- @Override
- public void complete() { underlyingType.complete(); }
-
- @Override
- public TypeMirror getComponentType() { return ((ArrayType)underlyingType).getComponentType(); }
-
- // The result is an ArrayType, but only in the model sense, not the Type sense.
- public Type makeVarargs() {
- return ((ArrayType) underlyingType).makeVarargs().annotatedType(typeAnnotations);
- }
-
- @Override
- public TypeMirror getExtendsBound() { return ((WildcardType)underlyingType).getExtendsBound(); }
- @Override
- public TypeMirror getSuperBound() { return ((WildcardType)underlyingType).getSuperBound(); }
- }
-
- public static class UnknownType extends Type {
-
- public UnknownType() {
- super(null);
+ public UnknownType annotatedType(List<Attribute.TypeCompound> annos) {
+ throw new AssertionError("Cannot annotate unknown type");
}
@Override
@@ -2046,7 +2074,6 @@
R visitForAll(ForAll t, S s);
R visitUndetVar(UndetVar t, S s);
R visitErrorType(ErrorType t, S s);
- R visitAnnotatedType(AnnotatedType t, S s);
R visitType(Type t, S s);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java Fri May 23 09:05:24 2014 -0700
@@ -326,15 +326,21 @@
public int getCatchType() {
Assert.check(hasCatchType(),
- "exception_index does not contain a valid catch type");
- return (-this.exception_index) - 1 ;
+ "exception_index does not contain valid catch info");
+ return ((-this.exception_index) - 1) & 0xff ;
}
- public void setCatchType(final int catchType) {
+ public int getStartPos() {
+ Assert.check(hasCatchType(),
+ "exception_index does not contain valid catch info");
+ return ((-this.exception_index) - 1) >> 8 ;
+ }
+
+ public void setCatchInfo(final int catchType, final int startPos) {
Assert.check(this.exception_index < 0,
"exception_index already contains a bytecode index");
Assert.check(catchType >= 0, "Expected a valid catch type");
- this.exception_index = -(catchType + 1);
+ this.exception_index = -((catchType | startPos << 8) + 1);
}
/**
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Fri May 23 09:05:24 2014 -0700
@@ -32,7 +32,6 @@
import javax.tools.JavaFileObject;
import com.sun.tools.javac.code.Attribute.TypeCompound;
-import com.sun.tools.javac.code.Type.AnnotatedType;
import com.sun.tools.javac.code.Type.ArrayType;
import com.sun.tools.javac.code.Type.CapturedType;
import com.sun.tools.javac.code.Type.ClassType;
@@ -331,7 +330,6 @@
// Note that we don't use the result, the call to
// typeWithAnnotations side-effects the type annotation positions.
// This is important for constructors of nested classes.
-
sym.appendUniqueTypeAttributes(typeAnnotations);
return;
}
@@ -391,14 +389,15 @@
private Type typeWithAnnotations(final JCTree typetree, final Type type,
final List<Attribute.TypeCompound> annotations,
final List<Attribute.TypeCompound> onlyTypeAnnotations) {
- // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s, onlyTypeAnnotations: %s)%n",
+ //System.err.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s, onlyTypeAnnotations: %s)%n",
// typetree, type, annotations, onlyTypeAnnotations);
if (annotations.isEmpty()) {
return type;
}
if (type.hasTag(TypeTag.ARRAY)) {
- Type.ArrayType arType = (Type.ArrayType) type.unannotatedType();
- Type.ArrayType tomodify = new Type.ArrayType(null, arType.tsym);
+ Type.ArrayType arType = (Type.ArrayType) type;
+ Type.ArrayType tomodify = new Type.ArrayType(null, arType.tsym,
+ Type.noAnnotations);
Type toreturn;
if (type.isAnnotated()) {
toreturn = tomodify.annotatedType(type.getAnnotationMirrors());
@@ -413,13 +412,15 @@
while (arType.elemtype.hasTag(TypeTag.ARRAY)) {
if (arType.elemtype.isAnnotated()) {
Type aelemtype = arType.elemtype;
- arType = (Type.ArrayType) aelemtype.unannotatedType();
+ arType = (Type.ArrayType) aelemtype;
ArrayType prevToMod = tomodify;
- tomodify = new Type.ArrayType(null, arType.tsym);
+ tomodify = new Type.ArrayType(null, arType.tsym,
+ Type.noAnnotations);
prevToMod.elemtype = tomodify.annotatedType(arType.elemtype.getAnnotationMirrors());
} else {
arType = (Type.ArrayType) arType.elemtype;
- tomodify.elemtype = new Type.ArrayType(null, arType.tsym);
+ tomodify.elemtype = new Type.ArrayType(null, arType.tsym,
+ Type.noAnnotations);
tomodify = (Type.ArrayType) tomodify.elemtype;
}
arTree = arrayTypeTree(arTree.elemtype);
@@ -569,6 +570,7 @@
private Type typeWithAnnotations(final Type type,
final Type stopAt,
final List<Attribute.TypeCompound> annotations) {
+ //System.err.println("typeWithAnnotations " + type + " " + annotations + " stopAt " + stopAt);
Visitor<Type, List<TypeCompound>> visitor =
new Type.Visitor<Type, List<Attribute.TypeCompound>>() {
@Override
@@ -579,7 +581,8 @@
return t.annotatedType(s);
} else {
ClassType ret = new ClassType(t.getEnclosingType().accept(this, s),
- t.typarams_field, t.tsym);
+ t.typarams_field, t.tsym,
+ t.getAnnotationMirrors());
ret.all_interfaces_field = t.all_interfaces_field;
ret.allparams_field = t.allparams_field;
ret.interfaces_field = t.interfaces_field;
@@ -590,18 +593,14 @@
}
@Override
- public Type visitAnnotatedType(AnnotatedType t, List<TypeCompound> s) {
- return t.unannotatedType().accept(this, s).annotatedType(t.getAnnotationMirrors());
- }
-
- @Override
public Type visitWildcardType(WildcardType t, List<TypeCompound> s) {
return t.annotatedType(s);
}
@Override
public Type visitArrayType(ArrayType t, List<TypeCompound> s) {
- ArrayType ret = new ArrayType(t.elemtype.accept(this, s), t.tsym);
+ ArrayType ret = new ArrayType(t.elemtype.accept(this, s), t.tsym,
+ t.getAnnotationMirrors());
return ret;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Fri May 23 09:05:24 2014 -0700
@@ -131,7 +131,7 @@
* @return the upper bound of the given type
*/
public Type upperBound(Type t) {
- return upperBound.visit(t).unannotatedType();
+ return upperBound.visit(t);
}
// where
private final MapVisitor<Void> upperBound = new MapVisitor<Void>() {
@@ -205,7 +205,7 @@
WildcardType unb = new WildcardType(syms.objectType,
BoundKind.UNBOUND,
syms.boundClass,
- (TypeVar)parms.head.unannotatedType());
+ (TypeVar)parms.head);
if (!containsType(args.head, unb))
return false;
parms = parms.tail;
@@ -269,7 +269,9 @@
List<Type> opens = openVars.toList();
ListBuffer<Type> qs = new ListBuffer<>();
for (List<Type> iter = opens; iter.nonEmpty(); iter = iter.tail) {
- qs.append(new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass, (TypeVar) iter.head.unannotatedType()));
+ qs.append(new WildcardType(syms.objectType, BoundKind.UNBOUND,
+ syms.boundClass, (TypeVar) iter.head,
+ Type.noAnnotations));
}
res = subst(res, opens, qs.toList());
}
@@ -599,12 +601,12 @@
//simply replace the wildcards with its bound
for (Type t : formalInterface.getTypeArguments()) {
if (actualTypeargs.head.hasTag(WILDCARD)) {
- WildcardType wt = (WildcardType)actualTypeargs.head.unannotatedType();
+ WildcardType wt = (WildcardType)actualTypeargs.head;
Type bound;
switch (wt.kind) {
case EXTENDS:
case UNBOUND:
- CapturedType capVar = (CapturedType)capturedTypeargs.head.unannotatedType();
+ CapturedType capVar = (CapturedType)capturedTypeargs.head;
//use declared bound if it doesn't depend on formal type-args
bound = capVar.bound.containsAny(capturedSite.getTypeArguments()) ?
wt.type : capVar.bound;
@@ -642,7 +644,8 @@
csym.members_field = new Scope(csym);
MethodSymbol instDescSym = new MethodSymbol(descSym.flags(), descSym.name, descType, csym);
csym.members_field.enter(instDescSym);
- Type.ClassType ctype = new Type.ClassType(Type.noType, List.<Type>nil(), csym);
+ Type.ClassType ctype = new Type.ClassType(Type.noType, List.<Type>nil(), csym,
+ Type.noAnnotations);
ctype.supertype_field = syms.objectType;
ctype.interfaces_field = targets;
csym.type = ctype;
@@ -747,8 +750,6 @@
//where
private boolean isSubtypeUncheckedInternal(Type t, Type s, Warner warn) {
if (t.hasTag(ARRAY) && s.hasTag(ARRAY)) {
- t = t.unannotatedType();
- s = s.unannotatedType();
if (((ArrayType)t).elemtype.isPrimitive()) {
return isSameType(elemtype(t), elemtype(s));
} else {
@@ -776,8 +777,6 @@
if (!t.hasTag(ARRAY) || isReifiable(t)) {
return;
}
- t = t.unannotatedType();
- s = s.unannotatedType();
ArrayType from = (ArrayType)t;
boolean shouldWarn = false;
switch (s.getTag()) {
@@ -810,12 +809,6 @@
if (t == s)
return true;
- t = t.unannotatedType();
- s = s.unannotatedType();
-
- if (t == s)
- return true;
-
if (s.isPartial())
return isSuperType(s, t);
@@ -828,8 +821,9 @@
}
// Generally, if 's' is a type variable, recur on lower bound; but
- // for alpha <: CAP, alpha should get upper bound CAP
- if (!t.hasTag(UNDETVAR)) {
+ // for inference variables and intersections, we need to keep 's'
+ // (see JLS 4.10.2 for intersections and 18.2.3 for inference vars)
+ if (!t.hasTag(UNDETVAR) && !t.isCompound()) {
// TODO: JDK-8039198, bounds checking sometimes passes in a wildcard as s
Type lower = cvarLowerBound(wildLowerBound(s));
if (s != lower)
@@ -899,12 +893,14 @@
if (s.isSuperBound() && !s.isExtendsBound()) {
s = new WildcardType(syms.objectType,
BoundKind.UNBOUND,
- syms.boundClass);
+ syms.boundClass,
+ s.getAnnotationMirrors());
changed = true;
} else if (s != orig) {
s = new WildcardType(upperBound(s),
BoundKind.EXTENDS,
- syms.boundClass);
+ syms.boundClass,
+ s.getAnnotationMirrors());
changed = true;
}
rewrite.append(s);
@@ -918,14 +914,11 @@
@Override
public Boolean visitClassType(ClassType t, Type s) {
Type sup = asSuper(t, s.tsym);
- return sup != null
- && sup.tsym == s.tsym
- // You're not allowed to write
- // Vector<Object> vec = new Vector<String>();
- // But with wildcards you can write
- // Vector<? extends Object> vec = new Vector<String>();
- // which means that subtype checking must be done
- // here instead of same-type checking (via containsType).
+ if (sup == null) return false;
+ // If t is an intersection, sup might not be a class type
+ if (!sup.hasTag(CLASS)) return isSubtypeNoCapture(sup, s);
+ return sup.tsym == s.tsym
+ // Check type variable containment
&& (!s.isParameterized() || containsTypeRecursive(s, sup))
&& isSubtypeNoCapture(sup.getEnclosingType(),
s.getEnclosingType());
@@ -1107,7 +1100,7 @@
if (s.hasTag(TYPEVAR)) {
//type-substitution does not preserve type-var types
//check that type var symbols and bounds are indeed the same
- return sameTypeVars((TypeVar)t.unannotatedType(), (TypeVar)s.unannotatedType());
+ return sameTypeVars((TypeVar)t, (TypeVar)s);
}
else {
//special case for s == ? super X, where upper(s) = u
@@ -1149,9 +1142,9 @@
HashSet<UniqueType> set = new HashSet<>();
for (Type x : interfaces(t))
- set.add(new UniqueType(x.unannotatedType(), Types.this));
+ set.add(new UniqueType(x, Types.this));
for (Type x : interfaces(s)) {
- if (!set.remove(new UniqueType(x.unannotatedType(), Types.this)))
+ if (!set.remove(new UniqueType(x, Types.this)))
return false;
}
return (set.isEmpty());
@@ -1256,30 +1249,47 @@
if (!s.hasTag(WILDCARD)) {
return false;
} else {
- WildcardType t2 = (WildcardType)s.unannotatedType();
+ WildcardType t2 = (WildcardType)s;
return t.kind == t2.kind &&
isSameType(t.type, t2.type, true);
}
}
};
- /**
- * A version of LooseSameTypeVisitor that takes AnnotatedTypes
- * into account.
- */
- TypeRelation isSameAnnotatedType = new LooseSameTypeVisitor() {
+ // </editor-fold>
+
+ TypeRelation isSameAnnotatedType = new LooseSameTypeVisitor() {
+ private Boolean compareAnnotations(Type t1, Type t2) {
+ List<Attribute.TypeCompound> annos1 = t1.getAnnotationMirrors();
+ List<Attribute.TypeCompound> annos2 = t2.getAnnotationMirrors();
+ return annos1.containsAll(annos2) && annos2.containsAll(annos1);
+ }
+
+ @Override
+ public Boolean visitType(Type t, Type s) {
+ return compareAnnotations(t, s) && super.visitType(t, s);
+ }
+
@Override
- public Boolean visitAnnotatedType(AnnotatedType t, Type s) {
- if (!s.isAnnotated())
- return false;
- if (!t.getAnnotationMirrors().containsAll(s.getAnnotationMirrors()))
- return false;
- if (!s.getAnnotationMirrors().containsAll(t.getAnnotationMirrors()))
- return false;
- return visit(t.unannotatedType(), s);
+ public Boolean visitWildcardType(WildcardType t, Type s) {
+ return compareAnnotations(t, s) && super.visitWildcardType(t, s);
+ }
+
+ @Override
+ public Boolean visitClassType(ClassType t, Type s) {
+ return compareAnnotations(t, s) && super.visitClassType(t, s);
+ }
+
+ @Override
+ public Boolean visitArrayType(ArrayType t, Type s) {
+ return compareAnnotations(t, s) && super.visitArrayType(t, s);
+ }
+
+ @Override
+ public Boolean visitForAll(ForAll t, Type s) {
+ return compareAnnotations(t, s) && super.visitForAll(t, s);
}
};
- // </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Contains Type">
public boolean containedBy(Type t, Type s) {
@@ -1287,7 +1297,7 @@
case UNDETVAR:
if (s.hasTag(WILDCARD)) {
UndetVar undetvar = (UndetVar)t;
- WildcardType wt = (WildcardType)s.unannotatedType();
+ WildcardType wt = (WildcardType)s;
switch(wt.kind) {
case UNBOUND: //similar to ? extends Object
case EXTENDS: {
@@ -1354,7 +1364,7 @@
private Type U(Type t) {
while (t.hasTag(WILDCARD)) {
- WildcardType w = (WildcardType)t.unannotatedType();
+ WildcardType w = (WildcardType)t;
if (w.isSuperBound())
return w.bound == null ? syms.objectType : w.bound.bound;
else
@@ -1365,7 +1375,7 @@
private Type L(Type t) {
while (t.hasTag(WILDCARD)) {
- WildcardType w = (WildcardType)t.unannotatedType();
+ WildcardType w = (WildcardType)t;
if (w.isExtendsBound())
return syms.botType;
else
@@ -1424,15 +1434,15 @@
};
public boolean isCaptureOf(Type s, WildcardType t) {
- if (!s.hasTag(TYPEVAR) || !((TypeVar)s.unannotatedType()).isCaptured())
+ if (!s.hasTag(TYPEVAR) || !((TypeVar)s).isCaptured())
return false;
- return isSameWildcard(t, ((CapturedType)s.unannotatedType()).wildcard);
+ return isSameWildcard(t, ((CapturedType)s).wildcard);
}
public boolean isSameWildcard(WildcardType t, Type s) {
if (!s.hasTag(WILDCARD))
return false;
- WildcardType w = (WildcardType)s.unannotatedType();
+ WildcardType w = (WildcardType)s;
return w.kind == t.kind && w.type == t.type;
}
@@ -1541,8 +1551,8 @@
if (t.isCompound() || s.isCompound()) {
return !t.isCompound() ?
- visitIntersectionType((IntersectionClassType)s.unannotatedType(), t, true) :
- visitIntersectionType((IntersectionClassType)t.unannotatedType(), s, false);
+ visitIntersectionType((IntersectionClassType)s, t, true) :
+ visitIntersectionType((IntersectionClassType)t, s, false);
}
if (s.hasTag(CLASS) || s.hasTag(ARRAY)) {
@@ -1873,7 +1883,6 @@
case WILDCARD:
return elemtype(upperBound(t));
case ARRAY:
- t = t.unannotatedType();
return ((ArrayType)t).elemtype;
case FORALL:
return elemtype(((ForAll)t).qtype);
@@ -1920,7 +1929,7 @@
if (t.hasTag(VOID) || t.hasTag(PACKAGE)) {
Assert.error("Type t must not be a VOID or PACKAGE type, " + t.toString());
}
- return new ArrayType(t, syms.arrayClass);
+ return new ArrayType(t, syms.arrayClass, Type.noAnnotations);
}
// </editor-fold>
@@ -1959,16 +1968,18 @@
return t;
Type st = supertype(t);
- if (st.hasTag(CLASS) || st.hasTag(TYPEVAR) || st.hasTag(ERROR)) {
+ if (st.hasTag(CLASS) || st.hasTag(TYPEVAR)) {
Type x = asSuper(st, sym);
if (x != null)
return x;
}
if ((sym.flags() & INTERFACE) != 0) {
for (List<Type> l = interfaces(t); l.nonEmpty(); l = l.tail) {
- Type x = asSuper(l.head, sym);
- if (x != null)
- return x;
+ if (!l.head.hasTag(ERROR)) {
+ Type x = asSuper(l.head, sym);
+ if (x != null)
+ return x;
+ }
}
}
return null;
@@ -2175,56 +2186,65 @@
}
private Type erasure(Type t, boolean recurse) {
- if (t.isPrimitive())
+ if (t.isPrimitive()) {
return t; /* fast special case */
- else
- return erasure.visit(t, recurse);
+ } else {
+ Type out = erasure.visit(t, recurse);
+ return out;
+ }
}
// where
private SimpleVisitor<Type, Boolean> erasure = new SimpleVisitor<Type, Boolean>() {
public Type visitType(Type t, Boolean recurse) {
if (t.isPrimitive())
return t; /*fast special case*/
- else
- return t.map(recurse ? erasureRecFun : erasureFun);
+ else {
+ final List<Attribute.TypeCompound> annos = t.getAnnotationMirrors();
+ Type erased = t.map(recurse ? erasureRecFun : erasureFun);
+ if (!annos.isEmpty()) {
+ erased = erased.annotatedType(annos);
+ }
+ return erased;
+ }
}
@Override
public Type visitWildcardType(WildcardType t, Boolean recurse) {
- return erasure(upperBound(t), recurse);
+ final List<Attribute.TypeCompound> annos = t.getAnnotationMirrors();
+ Type erased = erasure(upperBound(t), recurse);
+ if (!annos.isEmpty()) {
+ erased = erased.annotatedType(annos);
+ }
+ return erased;
}
@Override
public Type visitClassType(ClassType t, Boolean recurse) {
Type erased = t.tsym.erasure(Types.this);
+ List<Attribute.TypeCompound> annos = t.getAnnotationMirrors();
if (recurse) {
erased = new ErasedClassType(erased.getEnclosingType(),erased.tsym);
}
+ if (!annos.isEmpty()) {
+ erased = erased.annotatedType(annos);
+ }
return erased;
}
@Override
public Type visitTypeVar(TypeVar t, Boolean recurse) {
- return erasure(t.bound, recurse);
+ final List<Attribute.TypeCompound> annos = t.getAnnotationMirrors();
+ Type erased = erasure(t.bound, recurse);
+ if (!annos.isEmpty()) {
+ erased = erased.annotatedType(annos);
+ }
+ return erased;
}
@Override
public Type visitErrorType(ErrorType t, Boolean recurse) {
return t;
}
-
- @Override
- public Type visitAnnotatedType(AnnotatedType t, Boolean recurse) {
- Type erased = erasure(t.unannotatedType(), recurse);
- if (erased.isAnnotated()) {
- // This can only happen when the underlying type is a
- // type variable and the upper bound of it is annotated.
- // The annotation on the type variable overrides the one
- // on the bound.
- erased = ((AnnotatedType)erased).unannotatedType();
- }
- return erased.annotatedType(t.getAnnotationMirrors());
- }
};
private Mapping erasureFun = new Mapping ("erasure") {
@@ -2550,7 +2570,8 @@
public Type visitClassType(ClassType t, Void ignored) {
Type outer1 = classBound(t.getEnclosingType());
if (outer1 != t.getEnclosingType())
- return new ClassType(outer1, t.getTypeArguments(), t.tsym);
+ return new ClassType(outer1, t.getTypeArguments(), t.tsym,
+ t.getAnnotationMirrors());
else
return t;
}
@@ -2965,7 +2986,8 @@
if (typarams1 == typarams && outer1 == outer)
return t;
else
- return new ClassType(outer1, typarams1, t.tsym);
+ return new ClassType(outer1, typarams1, t.tsym,
+ t.getAnnotationMirrors());
} else {
Type st = subst(supertype(t));
List<Type> is = upperBounds(subst(interfaces(t)));
@@ -2986,7 +3008,8 @@
} else {
if (t.isExtendsBound() && bound.isExtendsBound())
bound = upperBound(bound);
- return new WildcardType(bound, t.kind, syms.boundClass, t.bound);
+ return new WildcardType(bound, t.kind, syms.boundClass,
+ t.bound, t.getAnnotationMirrors());
}
}
@@ -2996,7 +3019,7 @@
if (elemtype == t.elemtype)
return t;
else
- return new ArrayType(elemtype, t.tsym);
+ return new ArrayType(elemtype, t.tsym, t.getAnnotationMirrors());
}
@Override
@@ -3006,7 +3029,7 @@
//if 'to' types contain variables that are free in 't'
List<Type> freevars = newInstances(t.tvars);
t = new ForAll(freevars,
- Types.this.subst(t.qtype, t.tvars, freevars));
+ Types.this.subst(t.qtype, t.tvars, freevars));
}
List<Type> tvars1 = substBounds(t.tvars, from, to);
Type qtype1 = subst(t.qtype);
@@ -3015,7 +3038,8 @@
} else if (tvars1 == t.tvars) {
return new ForAll(tvars1, qtype1);
} else {
- return new ForAll(tvars1, Types.this.subst(qtype1, t.tvars, tvars1));
+ return new ForAll(tvars1,
+ Types.this.subst(qtype1, t.tvars, tvars1));
}
}
@@ -3045,7 +3069,8 @@
ListBuffer<Type> newTvars = new ListBuffer<>();
// create new type variables without bounds
for (Type t : tvars) {
- newTvars.append(new TypeVar(t.tsym, null, syms.botType));
+ newTvars.append(new TypeVar(t.tsym, null, syms.botType,
+ t.getAnnotationMirrors()));
}
// the new bounds should use the new type variables in place
// of the old
@@ -3071,7 +3096,8 @@
return t;
else {
// create new type variable without bounds
- TypeVar tv = new TypeVar(t.tsym, null, syms.botType);
+ TypeVar tv = new TypeVar(t.tsym, null, syms.botType,
+ t.getAnnotationMirrors());
// the new bound should use the new type variable in place
// of the old
tv.bound = subst(bound1, List.<Type>of(t), List.<Type>of(tv));
@@ -3112,7 +3138,7 @@
return tvars1;
}
private static final Mapping newInstanceFun = new Mapping("newInstanceFun") {
- public Type apply(Type t) { return new TypeVar(t.tsym, t.getUpperBound(), t.getLowerBound()); }
+ public Type apply(Type t) { return new TypeVar(t.tsym, t.getUpperBound(), t.getLowerBound(), t.getAnnotationMirrors()); }
};
// </editor-fold>
@@ -3185,7 +3211,6 @@
* graph. Undefined for all but reference types.
*/
public int rank(Type t) {
- t = t.unannotatedType();
switch(t.getTag()) {
case CLASS: {
ClassType cls = (ClassType)t;
@@ -3267,7 +3292,7 @@
for (Type t : tvars) {
if (!first) s.append(", ");
first = false;
- appendTyparamString(((TypeVar)t.unannotatedType()), s);
+ appendTyparamString(((TypeVar)t), s);
}
s.append('>');
return s.toString();
@@ -3439,12 +3464,14 @@
m = new WildcardType(lub(upperBound(act1.head),
upperBound(act2.head)),
BoundKind.EXTENDS,
- syms.boundClass);
+ syms.boundClass,
+ Type.noAnnotations);
mergeCache.remove(pair);
} else {
m = new WildcardType(syms.objectType,
BoundKind.UNBOUND,
- syms.boundClass);
+ syms.boundClass,
+ Type.noAnnotations);
}
merged.append(m.withTypeVar(typarams.head));
}
@@ -3453,7 +3480,10 @@
typarams = typarams.tail;
}
Assert.check(act1.isEmpty() && act2.isEmpty() && typarams.isEmpty());
- return new ClassType(class1.getEnclosingType(), merged.toList(), class1.tsym);
+ // There is no spec detailing how type annotations are to
+ // be inherited. So set it to noAnnotations for now
+ return new ClassType(class1.getEnclosingType(), merged.toList(),
+ class1.tsym, Type.noAnnotations);
}
/**
@@ -3571,7 +3601,8 @@
}
}
// lub(A[], B[]) is lub(A, B)[]
- return new ArrayType(lub(elements), syms.arrayClass);
+ return new ArrayType(lub(elements), syms.arrayClass,
+ Type.noAnnotations);
case CLASS_BOUND:
// calculate lub(A, B)
@@ -3932,7 +3963,6 @@
t = subst(type1, t.tsym.type.getTypeArguments(), t.getTypeArguments());
}
}
- t = t.unannotatedType();
ClassType cls = (ClassType)t;
if (cls.isRaw() || !cls.isParameterized())
return cls;
@@ -3951,9 +3981,9 @@
!currentS.isEmpty()) {
if (currentS.head != currentT.head) {
captured = true;
- WildcardType Ti = (WildcardType)currentT.head.unannotatedType();
+ WildcardType Ti = (WildcardType)currentT.head;
Type Ui = currentA.head.getUpperBound();
- CapturedType Si = (CapturedType)currentS.head.unannotatedType();
+ CapturedType Si = (CapturedType)currentS.head;
if (Ui == null)
Ui = syms.objectType;
switch (Ti.kind) {
@@ -3986,7 +4016,8 @@
return erasure(t); // some "rare" type involved
if (captured)
- return new ClassType(cls.getEnclosingType(), S, cls.tsym);
+ return new ClassType(cls.getEnclosingType(), S, cls.tsym,
+ cls.getAnnotationMirrors());
else
return t;
}
@@ -3995,7 +4026,6 @@
ListBuffer<Type> result = new ListBuffer<>();
for (Type t : types) {
if (t.hasTag(WILDCARD)) {
- t = t.unannotatedType();
Type bound = ((WildcardType)t).getExtendsBound();
if (bound == null)
bound = syms.objectType;
@@ -4003,7 +4033,8 @@
syms.noSymbol,
bound,
syms.botType,
- (WildcardType)t));
+ (WildcardType)t,
+ Type.noAnnotations));
} else {
result.append(t);
}
@@ -4089,7 +4120,7 @@
private boolean giveWarning(Type from, Type to) {
List<Type> bounds = to.isCompound() ?
- ((IntersectionClassType)to.unannotatedType()).getComponents() : List.of(to);
+ ((IntersectionClassType)to).getComponents() : List.of(to);
for (Type b : bounds) {
Type subFrom = asSub(from, b.tsym);
if (b.isParameterized() &&
@@ -4354,7 +4385,7 @@
Type B(Type t) {
while (t.hasTag(WILDCARD)) {
- WildcardType w = (WildcardType)t.unannotatedType();
+ WildcardType w = (WildcardType)t;
t = high ?
w.getExtendsBound() :
w.getSuperBound();
@@ -4380,12 +4411,14 @@
return new WildcardType(syms.objectType,
BoundKind.UNBOUND,
syms.boundClass,
- formal);
+ formal,
+ Type.noAnnotations);
} else {
return new WildcardType(bound,
BoundKind.EXTENDS,
syms.boundClass,
- formal);
+ formal,
+ Type.noAnnotations);
}
}
@@ -4402,12 +4435,14 @@
return new WildcardType(syms.objectType,
BoundKind.UNBOUND,
syms.boundClass,
- formal);
+ formal,
+ Type.noAnnotations);
} else {
return new WildcardType(bound,
BoundKind.SUPER,
syms.boundClass,
- formal);
+ formal,
+ Type.noAnnotations);
}
}
@@ -4429,7 +4464,7 @@
public boolean equals(Object obj) {
return (obj instanceof UniqueType) &&
- types.isSameAnnotatedType(type, ((UniqueType)obj).type);
+ types.isSameType(type, ((UniqueType)obj).type);
}
public String toString() {
@@ -4464,8 +4499,6 @@
public R visitForAll(ForAll t, S s) { return visitType(t, s); }
public R visitUndetVar(UndetVar t, S s) { return visitType(t, s); }
public R visitErrorType(ErrorType t, S s) { return visitType(t, s); }
- // Pretend annotations don't exist
- public R visitAnnotatedType(AnnotatedType t, S s) { return visit(t.unannotatedType(), s); }
}
/**
@@ -4596,7 +4629,6 @@
* Assemble signature of given type in string buffer.
*/
public void assembleSig(Type type) {
- type = type.unannotatedType();
switch (type.getTag()) {
case BYTE:
append('B');
@@ -4693,7 +4725,6 @@
}
public void assembleClassSig(Type type) {
- type = type.unannotatedType();
ClassType ct = (ClassType) type;
ClassSymbol c = (ClassSymbol) ct.tsym;
classReference(c);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri May 23 09:05:24 2014 -0700
@@ -517,6 +517,10 @@
return new ResultInfo(pkind, pt, newContext);
}
+ protected ResultInfo dup(Type newPt, CheckContext newContext) {
+ return new ResultInfo(pkind, newPt, newContext);
+ }
+
@Override
public String toString() {
if (pt != null) {
@@ -1865,8 +1869,10 @@
return new ClassType(restype.getEnclosingType(),
List.<Type>of(new WildcardType(types.erasure(qualifierType),
BoundKind.EXTENDS,
- syms.boundClass)),
- restype.tsym);
+ syms.boundClass,
+ Type.noAnnotations)),
+ restype.tsym,
+ restype.getAnnotationMirrors());
} else {
return restype;
}
@@ -2036,7 +2042,8 @@
} else if (TreeInfo.isDiamond(tree)) {
ClassType site = new ClassType(clazztype.getEnclosingType(),
clazztype.tsym.type.getTypeArguments(),
- clazztype.tsym);
+ clazztype.tsym,
+ clazztype.getAnnotationMirrors());
Env<AttrContext> diamondEnv = localEnv.dup(tree);
diamondEnv.info.selectSuper = cdef != null;
@@ -2255,7 +2262,8 @@
owntype = elemtype;
for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
attribExpr(l.head, localEnv, syms.intType);
- owntype = new ArrayType(owntype, syms.arrayClass);
+ owntype = new ArrayType(owntype, syms.arrayClass,
+ Type.noAnnotations);
}
} else {
// we are seeing an untyped aggregate { ... }
@@ -2272,7 +2280,8 @@
}
if (tree.elems != null) {
attribExprs(tree.elems, localEnv, elemtype);
- owntype = new ArrayType(elemtype, syms.arrayClass);
+ owntype = new ArrayType(elemtype, syms.arrayClass,
+ Type.noAnnotations);
}
if (!types.isReifiable(elemtype))
log.error(tree.pos(), "generic.array.creation");
@@ -2763,7 +2772,7 @@
targetError = false;
}
- JCDiagnostic detailsDiag = ((Resolve.ResolveError)refSym).getDiagnostic(JCDiagnostic.DiagnosticType.FRAGMENT,
+ JCDiagnostic detailsDiag = ((Resolve.ResolveError)refSym.baseSymbol()).getDiagnostic(JCDiagnostic.DiagnosticType.FRAGMENT,
that, exprType.tsym, exprType, that.name, argtypes, typeargtypes);
JCDiagnostic.DiagnosticType diagKind = targetError ?
@@ -2838,7 +2847,8 @@
ResultInfo checkInfo =
resultInfo.dup(newMethodTemplate(
desc.getReturnType().hasTag(VOID) ? Type.noType : desc.getReturnType(),
- that.kind.isUnbound() ? argtypes.tail : argtypes, typeargtypes));
+ that.kind.isUnbound() ? argtypes.tail : argtypes, typeargtypes),
+ new FunctionalReturnContext(resultInfo.checkContext));
Type refType = checkId(that, lookupHelper.site, refSym, localEnv, checkInfo);
@@ -3244,7 +3254,7 @@
if (skind == TYP) {
Type elt = site;
while (elt.hasTag(ARRAY))
- elt = ((ArrayType)elt.unannotatedType()).elemtype;
+ elt = ((ArrayType)elt).elemtype;
if (elt.hasTag(TYPEVAR)) {
log.error(tree.pos(), "type.var.cant.be.deref");
result = types.createErrorType(tree.type);
@@ -3557,7 +3567,8 @@
normOuter = types.erasure(ownOuter);
if (normOuter != ownOuter)
owntype = new ClassType(
- normOuter, List.<Type>nil(), owntype.tsym);
+ normOuter, List.<Type>nil(), owntype.tsym,
+ owntype.getAnnotationMirrors());
}
}
break;
@@ -3861,7 +3872,7 @@
public void visitTypeArray(JCArrayTypeTree tree) {
Type etype = attribType(tree.elemtype, env);
- Type type = new ArrayType(etype, syms.arrayClass);
+ Type type = new ArrayType(etype, syms.arrayClass, Type.noAnnotations);
result = check(tree, type, TYP, resultInfo);
}
@@ -3909,7 +3920,8 @@
clazzOuter = site;
}
}
- owntype = new ClassType(clazzOuter, actuals, clazztype.tsym);
+ owntype = new ClassType(clazzOuter, actuals, clazztype.tsym,
+ clazztype.getAnnotationMirrors());
} else {
if (formals.length() != 0) {
log.error(tree.pos(), "wrong.number.type.args",
@@ -4060,7 +4072,8 @@
: attribType(tree.inner, env);
result = check(tree, new WildcardType(chk.checkRefType(tree.pos(), type),
tree.kind.kind,
- syms.boundClass),
+ syms.boundClass,
+ Type.noAnnotations),
TYP, resultInfo);
}
@@ -4088,7 +4101,7 @@
public void run() {
List<Attribute.TypeCompound> compounds = fromAnnotations(annotations);
Assert.check(annotations.size() == compounds.size());
- tree.type = tree.type.unannotatedType().annotatedType(compounds);
+ tree.type = tree.type.annotatedType(compounds);
}
});
}
@@ -4470,6 +4483,7 @@
}
}
public void visitVarDef(final JCVariableDecl tree) {
+ //System.err.println("validateTypeAnnotations.visitVarDef " + tree);
if (tree.sym != null && tree.sym.type != null)
validateAnnotatedType(tree.vartype, tree.sym.type);
scan(tree.mods);
@@ -4512,6 +4526,7 @@
super.visitNewArray(tree);
}
public void visitClassDef(JCClassDecl tree) {
+ //System.err.println("validateTypeAnnotations.visitClassDef " + tree);
if (sigOnly) {
scan(tree.mods);
scan(tree.typarams);
@@ -4540,7 +4555,7 @@
* can occur.
*/
private void validateAnnotatedType(final JCTree errtree, final Type type) {
- // System.out.println("Attr.validateAnnotatedType: " + errtree + " type: " + type);
+ //System.err.println("Attr.validateAnnotatedType: " + errtree + " type: " + type);
if (type.isPrimitiveOrVoid()) {
return;
@@ -4578,8 +4593,7 @@
}
} else if (enclTr.hasTag(ANNOTATED_TYPE)) {
JCAnnotatedType at = (JCTree.JCAnnotatedType) enclTr;
- if (enclTy == null ||
- enclTy.hasTag(NONE)) {
+ if (enclTy == null || enclTy.hasTag(NONE)) {
if (at.getAnnotations().size() == 1) {
log.error(at.underlyingType.pos(), "cant.type.annotate.scoping.1", at.getAnnotations().head.attribute);
} else {
@@ -4598,16 +4612,16 @@
} else if (enclTr.hasTag(JCTree.Tag.WILDCARD)) {
JCWildcard wc = (JCWildcard) enclTr;
if (wc.getKind() == JCTree.Kind.EXTENDS_WILDCARD) {
- validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy.unannotatedType()).getExtendsBound());
+ validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy).getExtendsBound());
} else if (wc.getKind() == JCTree.Kind.SUPER_WILDCARD) {
- validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy.unannotatedType()).getSuperBound());
+ validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy).getSuperBound());
} else {
// Nothing to do for UNBOUND
}
repeat = false;
} else if (enclTr.hasTag(TYPEARRAY)) {
JCArrayTypeTree art = (JCArrayTypeTree) enclTr;
- validateAnnotatedType(art.getType(), ((ArrayType)enclTy.unannotatedType()).getComponentType());
+ validateAnnotatedType(art.getType(), ((ArrayType)enclTy).getComponentType());
repeat = false;
} else if (enclTr.hasTag(TYPEUNION)) {
JCTypeUnion ut = (JCTypeUnion) enclTr;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Fri May 23 09:05:24 2014 -0700
@@ -2234,11 +2234,11 @@
if (t.hasTag(TYPEVAR) && (t.tsym.flags() & UNATTRIBUTED) != 0)
return;
if (seen.contains(t)) {
- tv = (TypeVar)t.unannotatedType();
+ tv = (TypeVar)t;
tv.bound = types.createErrorType(t);
log.error(pos, "cyclic.inheritance", t);
} else if (t.hasTag(TYPEVAR)) {
- tv = (TypeVar)t.unannotatedType();
+ tv = (TypeVar)t;
seen = seen.prepend(tv);
for (Type b : types.getBounds(tv))
checkNonCyclic1(pos, b, seen);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Fri May 23 09:05:24 2014 -0700
@@ -134,13 +134,18 @@
SpeculativeCache speculativeCache;
DeferredType(JCExpression tree, Env<AttrContext> env) {
- super(null);
+ super(null, noAnnotations);
this.tree = tree;
this.env = attr.copyEnv(env);
this.speculativeCache = new SpeculativeCache();
}
@Override
+ public DeferredType annotatedType(List<Attribute.TypeCompound> typeAnnotations) {
+ throw new AssertionError("Cannot annotate a deferred type");
+ }
+
+ @Override
public TypeTag getTag() {
return DEFERRED;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Fri May 23 09:05:24 2014 -0700
@@ -373,7 +373,7 @@
List<Type> upperBounds = uv.getBounds(InferenceBound.UPPER);
if (Type.containsAny(upperBounds, vars)) {
TypeSymbol fresh_tvar = new TypeVariableSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
- fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null);
+ fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null, Type.noAnnotations);
todo.append(uv);
uv.inst = fresh_tvar.type;
} else if (upperBounds.nonEmpty()) {
@@ -1505,7 +1505,9 @@
LOWER.solve(uv, inferenceContext) :
infer.syms.botType;
CapturedType prevCaptured = (CapturedType)uv.qtype;
- return new CapturedType(prevCaptured.tsym.name, prevCaptured.tsym.owner, upper, lower, prevCaptured.wildcard);
+ return new CapturedType(prevCaptured.tsym.name, prevCaptured.tsym.owner,
+ upper, lower, prevCaptured.wildcard,
+ Type.noAnnotations);
}
};
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Fri May 23 09:05:24 2014 -0700
@@ -28,7 +28,6 @@
import java.util.*;
import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Type.AnnotatedType;
import com.sun.tools.javac.jvm.*;
import com.sun.tools.javac.main.Option.PkgInfo;
import com.sun.tools.javac.tree.*;
@@ -452,7 +451,8 @@
ClassSymbol outerCacheClass = outerCacheClass();
this.mapVar = new VarSymbol(STATIC | SYNTHETIC | FINAL,
varName,
- new ArrayType(syms.intType, syms.arrayClass),
+ new ArrayType(syms.intType, syms.arrayClass,
+ Type.noAnnotations),
outerCacheClass);
enterSynthetic(pos, mapVar, outerCacheClass.members());
}
@@ -493,7 +493,8 @@
syms.lengthVar);
JCExpression mapVarInit = make
.NewArray(make.Type(syms.intType), List.of(size), null)
- .setType(new ArrayType(syms.intType, syms.arrayClass));
+ .setType(new ArrayType(syms.intType, syms.arrayClass,
+ Type.noAnnotations));
// try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {}
ListBuffer<JCStatement> stmts = new ListBuffer<>();
@@ -1979,7 +1980,7 @@
List.<JCExpression>of(make.Literal(INT, 0).setType(syms.intType)),
null);
newcache.type = new ArrayType(types.erasure(outerCacheClass.type),
- syms.arrayClass);
+ syms.arrayClass, Type.noAnnotations);
// forNameSym := java.lang.Class.forName(
// String s,boolean init,ClassLoader loader)
@@ -2568,7 +2569,8 @@
Name valuesName = names.fromString(target.syntheticNameChar() + "VALUES");
while (tree.sym.members().lookup(valuesName).scope != null) // avoid name clash
valuesName = names.fromString(valuesName + "" + target.syntheticNameChar());
- Type arrayType = new ArrayType(types.erasure(tree.type), syms.arrayClass);
+ Type arrayType = new ArrayType(types.erasure(tree.type),
+ syms.arrayClass, Type.noAnnotations);
VarSymbol valuesVar = new VarSymbol(PRIVATE|FINAL|STATIC|SYNTHETIC,
valuesName,
arrayType,
@@ -2841,7 +2843,7 @@
tree.underlyingType = translate(tree.underlyingType);
// but maintain type annotations in the type.
if (tree.type.isAnnotated()) {
- tree.type = tree.underlyingType.type.unannotatedType().annotatedType(tree.type.getAnnotationMirrors());
+ tree.type = tree.underlyingType.type.annotatedType(tree.type.getAnnotationMirrors());
} else if (tree.underlyingType.type.isAnnotated()) {
tree.type = tree.underlyingType.type;
}
@@ -3145,7 +3147,8 @@
JCNewArray boxedArgs = make.NewArray(make.Type(varargsElement),
List.<JCExpression>nil(),
elems.toList());
- boxedArgs.type = new ArrayType(varargsElement, syms.arrayClass);
+ boxedArgs.type = new ArrayType(varargsElement, syms.arrayClass,
+ Type.noAnnotations);
result.append(boxedArgs);
} else {
if (args.length() != 1) throw new AssertionError(args);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Fri May 23 09:05:24 2014 -0700
@@ -457,7 +457,8 @@
* to the symbol table.
*/
private void addEnumMembers(JCClassDecl tree, Env<AttrContext> env) {
- JCExpression valuesType = make.Type(new ArrayType(tree.sym.type, syms.arrayClass));
+ JCExpression valuesType = make.Type(new ArrayType(tree.sym.type, syms.arrayClass,
+ Type.noAnnotations));
// public static T[] values() { return ???; }
JCMethodDecl values = make.
@@ -677,7 +678,7 @@
//because varargs is represented in the tree as a
//modifier on the parameter declaration, and not as a
//distinct type of array node.
- ArrayType atype = (ArrayType)tree.vartype.type.unannotatedType();
+ ArrayType atype = (ArrayType)tree.vartype.type;
tree.vartype.type = atype.makeVarargs();
}
Scope enclScope = enter.enterScope(env);
@@ -1255,11 +1256,13 @@
ClassType ct = (ClassType) sym.type;
Assert.check(ct.typarams_field.isEmpty());
if (n == 1) {
- TypeVar v = new TypeVar(names.fromString("T"), sym, syms.botType);
+ TypeVar v = new TypeVar(names.fromString("T"), sym, syms.botType,
+ Type.noAnnotations);
ct.typarams_field = ct.typarams_field.prepend(v);
} else {
for (int i = n; i > 0; i--) {
- TypeVar v = new TypeVar(names.fromString("T" + i), sym, syms.botType);
+ TypeVar v = new TypeVar(names.fromString("T" + i), sym,
+ syms.botType, Type.noAnnotations);
ct.typarams_field = ct.typarams_field.prepend(v);
}
}
@@ -1310,8 +1313,8 @@
}
Type mType = new MethodType(argtypes, null, thrown, c);
Type initType = typarams.nonEmpty() ?
- new ForAll(typarams, mType) :
- mType;
+ new ForAll(typarams, mType) :
+ mType;
MethodSymbol init = new MethodSymbol(flags, names.init,
initType, c);
init.params = createDefaultConstructorParams(make, baseInit, init,
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri May 23 09:05:24 2014 -0700
@@ -94,7 +94,7 @@
public final boolean boxingEnabled;
public final boolean varargsEnabled;
public final boolean allowMethodHandles;
- public final boolean allowStructuralMostSpecific;
+ public final boolean allowFunctionalInterfaceMostSpecific;
private final boolean debugResolve;
private final boolean compactMethodDiags;
final EnumSet<VerboseResolutionMode> verboseResolutionMode;
@@ -135,7 +135,7 @@
verboseResolutionMode = VerboseResolutionMode.getVerboseResolutionMode(options);
Target target = Target.instance(context);
allowMethodHandles = target.hasMethodHandles();
- allowStructuralMostSpecific = source.allowStructuralMostSpecific();
+ allowFunctionalInterfaceMostSpecific = source.allowFunctionalInterfaceMostSpecific();
polymorphicSignatureScope = new Scope(syms.noSymbol);
inapplicableMethodException = new InapplicableMethodException(diags);
@@ -1084,50 +1084,47 @@
}
public boolean compatible(Type found, Type req, Warner warn) {
- if (!allowStructuralMostSpecific || actual == null) {
- return super.compatible(found, req, warn);
- } else {
- switch (actual.getTag()) {
- case DEFERRED:
- DeferredType dt = (DeferredType) actual;
- DeferredType.SpeculativeCache.Entry e = dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
- return (e == null || e.speculativeTree == deferredAttr.stuckTree)
- ? super.compatible(found, req, warn) :
- mostSpecific(found, req, e.speculativeTree, warn);
- default:
- return standaloneMostSpecific(found, req, actual, warn);
+ if (allowFunctionalInterfaceMostSpecific &&
+ unrelatedFunctionalInterfaces(found, req) &&
+ (actual != null && actual.getTag() == DEFERRED)) {
+ DeferredType dt = (DeferredType) actual;
+ DeferredType.SpeculativeCache.Entry e =
+ dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
+ if (e != null && e.speculativeTree != deferredAttr.stuckTree) {
+ return functionalInterfaceMostSpecific(found, req, e.speculativeTree, warn);
}
}
+ return super.compatible(found, req, warn);
}
- private boolean mostSpecific(Type t, Type s, JCTree tree, Warner warn) {
- MostSpecificChecker msc = new MostSpecificChecker(t, s, warn);
+ /** Whether {@code t} and {@code s} are unrelated functional interface types. */
+ private boolean unrelatedFunctionalInterfaces(Type t, Type s) {
+ return types.isFunctionalInterface(t.tsym) &&
+ types.isFunctionalInterface(s.tsym) &&
+ types.asSuper(t, s.tsym) == null &&
+ types.asSuper(s, t.tsym) == null;
+ }
+
+ /** Parameters {@code t} and {@code s} are unrelated functional interface types. */
+ private boolean functionalInterfaceMostSpecific(Type t, Type s, JCTree tree, Warner warn) {
+ FunctionalInterfaceMostSpecificChecker msc = new FunctionalInterfaceMostSpecificChecker(t, s, warn);
msc.scan(tree);
return msc.result;
}
- boolean polyMostSpecific(Type t1, Type t2, Warner warn) {
- return (!t1.isPrimitive() && t2.isPrimitive())
- ? true : super.compatible(t1, t2, warn);
- }
-
- boolean standaloneMostSpecific(Type t1, Type t2, Type exprType, Warner warn) {
- return (exprType.isPrimitive() == t1.isPrimitive()
- && exprType.isPrimitive() != t2.isPrimitive())
- ? true : super.compatible(t1, t2, warn);
- }
-
/**
- * Structural checker for most specific.
+ * Tests whether one functional interface type can be considered more specific
+ * than another unrelated functional interface type for the scanned expression.
*/
- class MostSpecificChecker extends DeferredAttr.PolyScanner {
+ class FunctionalInterfaceMostSpecificChecker extends DeferredAttr.PolyScanner {
final Type t;
final Type s;
final Warner warn;
boolean result;
- MostSpecificChecker(Type t, Type s, Warner warn) {
+ /** Parameters {@code t} and {@code s} are unrelated functional interface types. */
+ FunctionalInterfaceMostSpecificChecker(Type t, Type s, Warner warn) {
this.t = t;
this.s = s;
this.warn = warn;
@@ -1136,102 +1133,96 @@
@Override
void skip(JCTree tree) {
- result &= standaloneMostSpecific(t, s, tree.type, warn);
+ result &= false;
}
@Override
public void visitConditional(JCConditional tree) {
- if (tree.polyKind == PolyKind.STANDALONE) {
- result &= standaloneMostSpecific(t, s, tree.type, warn);
- } else {
- super.visitConditional(tree);
- }
- }
-
- @Override
- public void visitApply(JCMethodInvocation tree) {
- result &= (tree.polyKind == PolyKind.STANDALONE)
- ? standaloneMostSpecific(t, s, tree.type, warn)
- : polyMostSpecific(t, s, warn);
- }
-
- @Override
- public void visitNewClass(JCNewClass tree) {
- result &= (tree.polyKind == PolyKind.STANDALONE)
- ? standaloneMostSpecific(t, s, tree.type, warn)
- : polyMostSpecific(t, s, warn);
+ scan(tree.truepart);
+ scan(tree.falsepart);
}
@Override
public void visitReference(JCMemberReference tree) {
- if (types.isFunctionalInterface(t.tsym) &&
- types.isFunctionalInterface(s.tsym)) {
- Type desc_t = types.findDescriptorType(t);
- Type desc_s = types.findDescriptorType(s);
- if (types.isSameTypes(desc_t.getParameterTypes(),
- inferenceContext().asUndetVars(desc_s.getParameterTypes()))) {
- if (types.asSuper(t, s.tsym) != null ||
- types.asSuper(s, t.tsym) != null) {
- result &= MostSpecificCheckContext.super.compatible(t, s, warn);
- } else if (!desc_s.getReturnType().hasTag(VOID)) {
- //perform structural comparison
- Type ret_t = desc_t.getReturnType();
- Type ret_s = desc_s.getReturnType();
- result &= ((tree.refPolyKind == PolyKind.STANDALONE)
- ? standaloneMostSpecific(ret_t, ret_s, tree.sym.type.getReturnType(), warn)
- : polyMostSpecific(ret_t, ret_s, warn));
- } else {
- return;
- }
+ Type desc_t = types.findDescriptorType(t);
+ Type desc_s = types.findDescriptorType(s);
+ // use inference variables here for more-specific inference (18.5.4)
+ if (!types.isSameTypes(desc_t.getParameterTypes(),
+ inferenceContext().asUndetVars(desc_s.getParameterTypes()))) {
+ result &= false;
+ } else {
+ // compare return types
+ Type ret_t = desc_t.getReturnType();
+ Type ret_s = desc_s.getReturnType();
+ if (ret_s.hasTag(VOID)) {
+ result &= true;
+ } else if (ret_t.hasTag(VOID)) {
+ result &= false;
+ } else if (ret_t.isPrimitive() != ret_s.isPrimitive()) {
+ boolean retValIsPrimitive =
+ tree.refPolyKind == PolyKind.STANDALONE &&
+ tree.sym.type.getReturnType().isPrimitive();
+ result &= (retValIsPrimitive == ret_t.isPrimitive()) &&
+ (retValIsPrimitive != ret_s.isPrimitive());
+ } else {
+ result &= MostSpecificCheckContext.super.compatible(ret_t, ret_s, warn);
}
- } else {
- result &= false;
}
}
@Override
public void visitLambda(JCLambda tree) {
- if (types.isFunctionalInterface(t.tsym) &&
- types.isFunctionalInterface(s.tsym)) {
- Type desc_t = types.findDescriptorType(t);
- Type desc_s = types.findDescriptorType(s);
- if (types.isSameTypes(desc_t.getParameterTypes(),
- inferenceContext().asUndetVars(desc_s.getParameterTypes()))) {
- if (types.asSuper(t, s.tsym) != null ||
- types.asSuper(s, t.tsym) != null) {
- result &= MostSpecificCheckContext.super.compatible(t, s, warn);
- } else if (!desc_s.getReturnType().hasTag(VOID)) {
- //perform structural comparison
- Type ret_t = desc_t.getReturnType();
- Type ret_s = desc_s.getReturnType();
- scanLambdaBody(tree, ret_t, ret_s);
- } else {
- return;
+ Type desc_t = types.findDescriptorType(t);
+ Type desc_s = types.findDescriptorType(s);
+ // use inference variables here for more-specific inference (18.5.4)
+ if (!types.isSameTypes(desc_t.getParameterTypes(),
+ inferenceContext().asUndetVars(desc_s.getParameterTypes()))) {
+ result &= false;
+ } else {
+ // compare return types
+ Type ret_t = desc_t.getReturnType();
+ Type ret_s = desc_s.getReturnType();
+ if (ret_s.hasTag(VOID)) {
+ result &= true;
+ } else if (ret_t.hasTag(VOID)) {
+ result &= false;
+ } else if (unrelatedFunctionalInterfaces(ret_t, ret_s)) {
+ for (JCExpression expr : lambdaResults(tree)) {
+ result &= functionalInterfaceMostSpecific(ret_t, ret_s, expr, warn);
}
+ } else if (ret_t.isPrimitive() != ret_s.isPrimitive()) {
+ for (JCExpression expr : lambdaResults(tree)) {
+ boolean retValIsPrimitive = expr.isStandalone() && expr.type.isPrimitive();
+ result &= (retValIsPrimitive == ret_t.isPrimitive()) &&
+ (retValIsPrimitive != ret_s.isPrimitive());
+ }
+ } else {
+ result &= MostSpecificCheckContext.super.compatible(ret_t, ret_s, warn);
}
- } else {
- result &= false;
}
}
//where
- void scanLambdaBody(JCLambda lambda, final Type t, final Type s) {
+ private List<JCExpression> lambdaResults(JCLambda lambda) {
if (lambda.getBodyKind() == JCTree.JCLambda.BodyKind.EXPRESSION) {
- result &= MostSpecificCheckContext.this.mostSpecific(t, s, lambda.body, warn);
+ return List.of((JCExpression) lambda.body);
} else {
+ final ListBuffer<JCExpression> buffer = new ListBuffer<>();
DeferredAttr.LambdaReturnScanner lambdaScanner =
new DeferredAttr.LambdaReturnScanner() {
@Override
public void visitReturn(JCReturn tree) {
if (tree.expr != null) {
- result &= MostSpecificCheckContext.this.mostSpecific(t, s, tree.expr, warn);
+ buffer.append(tree.expr);
}
}
};
lambdaScanner.scan(lambda.body);
+ return buffer.toList();
}
}
}
+
}
public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) {
@@ -1435,7 +1426,7 @@
return bestSoFar;
} else if (useVarargs && (sym.flags() & VARARGS) == 0) {
return bestSoFar.kind >= ERRONEOUS ?
- new BadVarargsMethod((ResolveError)bestSoFar) :
+ new BadVarargsMethod((ResolveError)bestSoFar.baseSymbol()) :
bestSoFar;
}
Assert.check(sym.kind < AMBIGUOUS);
@@ -1527,14 +1518,22 @@
if (m2SignatureMoreSpecific) return m2;
return ambiguityError(m1, m2);
case AMBIGUOUS:
- //check if m1 is more specific than all ambiguous methods in m2
+ //compare m1 to ambiguous methods in m2
AmbiguityError e = (AmbiguityError)m2.baseSymbol();
+ boolean m1MoreSpecificThanAnyAmbiguous = true;
+ boolean allAmbiguousMoreSpecificThanM1 = true;
for (Symbol s : e.ambiguousSyms) {
- if (mostSpecific(argtypes, m1, s, env, site, allowBoxing, useVarargs) != m1) {
- return e.addAmbiguousSymbol(m1);
- }
+ Symbol moreSpecific = mostSpecific(argtypes, m1, s, env, site, allowBoxing, useVarargs);
+ m1MoreSpecificThanAnyAmbiguous &= moreSpecific == m1;
+ allAmbiguousMoreSpecificThanM1 &= moreSpecific == s;
}
- return m1;
+ if (m1MoreSpecificThanAnyAmbiguous)
+ return m1;
+ //if m1 is more specific than some ambiguous methods, but other ambiguous methods are
+ //more specific than m1, add it as a new ambiguous method:
+ if (!allAmbiguousMoreSpecificThanM1)
+ e.addAmbiguousSymbol(m1);
+ return e;
default:
throw new AssertionError();
}
@@ -2195,7 +2194,7 @@
List<Type> typeargtypes,
LogResolveHelper logResolveHelper) {
if (sym.kind >= AMBIGUOUS) {
- ResolveError errSym = (ResolveError)sym;
+ ResolveError errSym = (ResolveError)sym.baseSymbol();
sym = errSym.access(name, qualified ? site.tsym : syms.noSymbol);
argtypes = logResolveHelper.getArgumentTypes(errSym, sym, name, argtypes);
if (logResolveHelper.resolveDiagnosticNeeded(site, argtypes, typeargtypes)) {
@@ -2584,7 +2583,7 @@
sym = super.access(env, pos, location, sym);
} else {
final JCDiagnostic details = sym.kind == WRONG_MTH ?
- ((InapplicableSymbolError)sym).errCandidate().snd :
+ ((InapplicableSymbolError)sym.baseSymbol()).errCandidate().snd :
null;
sym = new InapplicableSymbolError(sym.kind, "diamondError", currentResolutionContext) {
@Override
@@ -2631,7 +2630,7 @@
((ForAll)sym.type).tvars :
List.<Type>nil();
Type constrType = new ForAll(site.tsym.type.getTypeArguments().appendList(oldParams),
- types.createMethodTypeWithReturn(sym.type.asMethodType(), site));
+ types.createMethodTypeWithReturn(sym.type.asMethodType(), site));
MethodSymbol newConstr = new MethodSymbol(sym.flags(), names.init, constrType, site.tsym) {
@Override
public Symbol baseSymbol() {
@@ -2992,12 +2991,12 @@
return true;
case WRONG_MTH:
InapplicableSymbolError errSym =
- (InapplicableSymbolError)s;
+ (InapplicableSymbolError)s.baseSymbol();
return new Template(MethodCheckDiag.ARITY_MISMATCH.regex())
.matches(errSym.errCandidate().snd);
case WRONG_MTHS:
InapplicableSymbolsError errSyms =
- (InapplicableSymbolsError)s;
+ (InapplicableSymbolsError)s.baseSymbol();
return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty();
case WRONG_STATICNESS:
return false;
@@ -3272,7 +3271,7 @@
List<Type> typeargtypes, MethodResolutionPhase maxPhase) {
super(referenceTree, names.init, site, argtypes, typeargtypes, maxPhase);
if (site.isRaw()) {
- this.site = new ClassType(site.getEnclosingType(), site.tsym.type.getTypeArguments(), site.tsym);
+ this.site = new ClassType(site.getEnclosingType(), site.tsym.type.getTypeArguments(), site.tsym, site.getAnnotationMirrors());
needsInference = true;
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri May 23 09:05:24 2014 -0700
@@ -624,18 +624,18 @@
case '+': {
sigp++;
Type t = sigToType();
- return new WildcardType(t, BoundKind.EXTENDS,
- syms.boundClass);
+ return new WildcardType(t, BoundKind.EXTENDS, syms.boundClass,
+ Type.noAnnotations);
}
case '*':
sigp++;
return new WildcardType(syms.objectType, BoundKind.UNBOUND,
- syms.boundClass);
+ syms.boundClass, Type.noAnnotations);
case '-': {
sigp++;
Type t = sigToType();
- return new WildcardType(t, BoundKind.SUPER,
- syms.boundClass);
+ return new WildcardType(t, BoundKind.SUPER, syms.boundClass,
+ Type.noAnnotations);
}
case 'B':
sigp++;
@@ -680,7 +680,8 @@
return syms.booleanType;
case '[':
sigp++;
- return new ArrayType(sigToType(), syms.arrayClass);
+ return new ArrayType(sigToType(), syms.arrayClass,
+ Type.noAnnotations);
case '(':
sigp++;
List<Type> argtypes = sigToTypes(')');
@@ -735,7 +736,8 @@
try {
return (outer == Type.noType) ?
t.erasure(types) :
- new ClassType(outer, List.<Type>nil(), t);
+ new ClassType(outer, List.<Type>nil(), t,
+ Type.noAnnotations);
} finally {
sbp = startSbp;
}
@@ -745,7 +747,8 @@
ClassSymbol t = syms.enterClass(names.fromUtf(signatureBuffer,
startSbp,
sbp - startSbp));
- outer = new ClassType(outer, sigToTypes('>'), t) {
+ outer = new ClassType(outer, sigToTypes('>'), t,
+ Type.noAnnotations) {
boolean completed = false;
@Override
public Type getEnclosingType() {
@@ -808,7 +811,8 @@
t = syms.enterClass(names.fromUtf(signatureBuffer,
startSbp,
sbp - startSbp));
- outer = new ClassType(outer, List.<Type>nil(), t);
+ outer = new ClassType(outer, List.<Type>nil(), t,
+ Type.noAnnotations);
}
signatureBuffer[sbp++] = (byte)'$';
continue;
@@ -871,7 +875,8 @@
Name name = names.fromUtf(signature, start, sigp - start);
TypeVar tvar;
if (sigEnterPhase) {
- tvar = new TypeVar(name, currentOwner, syms.botType);
+ tvar = new TypeVar(name, currentOwner, syms.botType,
+ Type.noAnnotations);
typevars.enter(tvar.tsym);
} else {
tvar = (TypeVar)findTypeVar(name);
@@ -910,7 +915,8 @@
// we don't know for sure if this owner is correct. It could
// be a method and there is no way to tell before reading the
// enclosing method attribute.
- TypeVar t = new TypeVar(name, currentOwner, syms.botType);
+ TypeVar t = new TypeVar(name, currentOwner, syms.botType,
+ Type.noAnnotations);
missingTypeVariables = missingTypeVariables.prepend(t);
// System.err.println("Missing type var " + name);
return t;
@@ -1534,35 +1540,41 @@
// local variable
case LOCAL_VARIABLE: {
final int table_length = nextChar();
- final TypeAnnotationPosition position =
- TypeAnnotationPosition.localVariable(readTypePath());
-
- position.lvarOffset = new int[table_length];
- position.lvarLength = new int[table_length];
- position.lvarIndex = new int[table_length];
+ final int[] newLvarOffset = new int[table_length];
+ final int[] newLvarLength = new int[table_length];
+ final int[] newLvarIndex = new int[table_length];
for (int i = 0; i < table_length; ++i) {
- position.lvarOffset[i] = nextChar();
- position.lvarLength[i] = nextChar();
- position.lvarIndex[i] = nextChar();
+ newLvarOffset[i] = nextChar();
+ newLvarLength[i] = nextChar();
+ newLvarIndex[i] = nextChar();
}
+
+ final TypeAnnotationPosition position =
+ TypeAnnotationPosition.localVariable(readTypePath());
+ position.lvarOffset = newLvarOffset;
+ position.lvarLength = newLvarLength;
+ position.lvarIndex = newLvarIndex;
return position;
}
// resource variable
case RESOURCE_VARIABLE: {
final int table_length = nextChar();
- final TypeAnnotationPosition position =
- TypeAnnotationPosition.resourceVariable(readTypePath());
-
- position.lvarOffset = new int[table_length];
- position.lvarLength = new int[table_length];
- position.lvarIndex = new int[table_length];
+ final int[] newLvarOffset = new int[table_length];
+ final int[] newLvarLength = new int[table_length];
+ final int[] newLvarIndex = new int[table_length];
for (int i = 0; i < table_length; ++i) {
- position.lvarOffset[i] = nextChar();
- position.lvarLength[i] = nextChar();
- position.lvarIndex[i] = nextChar();
+ newLvarOffset[i] = nextChar();
+ newLvarLength[i] = nextChar();
+ newLvarIndex[i] = nextChar();
}
+
+ final TypeAnnotationPosition position =
+ TypeAnnotationPosition.resourceVariable(readTypePath());
+ position.lvarOffset = newLvarOffset;
+ position.lvarLength = newLvarLength;
+ position.lvarIndex = newLvarIndex;
return position;
}
// exception parameter
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Fri May 23 09:05:24 2014 -0700
@@ -286,7 +286,6 @@
*/
@Override
public void assembleSig(Type type) {
- type = type.unannotatedType();
switch (type.getTag()) {
case UNINITIALIZED_THIS:
case UNINITIALIZED_OBJECT:
@@ -354,7 +353,7 @@
} else if (t.hasTag(ARRAY)) {
return typeSig(types.erasure(t));
} else {
- throw new AssertionError("xClassName");
+ throw new AssertionError("xClassName expects class or array type, got " + t);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java Fri May 23 09:05:24 2014 -0700
@@ -928,7 +928,7 @@
if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
if (o instanceof Type) {
- Type ty = ((Type)o).unannotatedType();
+ Type ty = (Type) o;
if (ty instanceof Type.ArrayType) return syms.classType;
if (ty instanceof Type.MethodType) return syms.methodTypeType;
@@ -1579,8 +1579,8 @@
/** Add a catch clause to code.
*/
- public void addCatch(
- char startPc, char endPc, char handlerPc, char catchType) {
+ public void addCatch(char startPc, char endPc,
+ char handlerPc, char catchType) {
catchInfo.append(new char[]{startPc, endPc, handlerPc, catchType});
}
@@ -2149,7 +2149,7 @@
for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) {
TypeAnnotationPosition p = ta.position;
if (p.hasCatchType()) {
- final int idx = findExceptionIndex(p.getCatchType());
+ final int idx = findExceptionIndex(p);
if (idx == -1)
Assert.error("Could not find exception index for type annotation " +
ta + " on exception parameter");
@@ -2159,14 +2159,17 @@
}
}
- private int findExceptionIndex(int catchType) {
+ private int findExceptionIndex(TypeAnnotationPosition p) {
+ final int catchType = p.getCatchType();
+ final int startPos = p.getStartPos();
+ final int len = catchInfo.length();
List<char[]> iter = catchInfo.toList();
- int len = catchInfo.length();
for (int i = 0; i < len; ++i) {
char[] catchEntry = iter.head;
iter = iter.tail;
- char ct = catchEntry[3];
- if (catchType == ct) {
+ int ct = catchEntry[3];
+ int sp = catchEntry[0];
+ if (catchType == ct && sp == startPos) {
return i;
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri May 23 09:05:24 2014 -0700
@@ -317,10 +317,6 @@
int makeRef(DiagnosticPosition pos, Type type) {
checkDimension(pos, type);
if (type.isAnnotated()) {
- // Treat annotated types separately - we don't want
- // to collapse all of them - at least for annotated
- // exceptions.
- // TODO: review this.
return pool.put((Object)type);
} else {
return pool.put(type.hasTag(CLASS) ? (Object)type.tsym : (Object)type);
@@ -1647,7 +1643,7 @@
if (subCatch.type.isAnnotated()) {
for (Attribute.TypeCompound tc :
subCatch.type.getAnnotationMirrors()) {
- tc.position.setCatchType(catchType);
+ tc.position.setCatchInfo(catchType, startpc);
}
}
}
@@ -1664,7 +1660,7 @@
if (subCatch.type.isAnnotated()) {
for (Attribute.TypeCompound tc :
subCatch.type.getAnnotationMirrors()) {
- tc.position.setCatchType(catchType);
+ tc.position.setCatchInfo(catchType, startpc);
}
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java Fri May 23 09:05:24 2014 -0700
@@ -674,11 +674,6 @@
}
@Override
- public R visitAnnotatedType(Type.AnnotatedType t, P p) {
- return defaultAction(t, p);
- }
-
- @Override
public R visitType(Type t, P p) {
return defaultAction(t, p);
}
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java Fri May 23 09:05:24 2014 -0700
@@ -102,10 +102,11 @@
*/
public int put(Object value) {
value = makePoolValue(value);
-// assert !(value instanceof Type.TypeVar);
+ Assert.check(!(value instanceof Type.TypeVar));
+ Assert.check(!(value instanceof Types.UniqueType &&
+ ((UniqueType) value).type instanceof Type.TypeVar));
Integer index = indices.get(value);
if (index == null) {
-// System.err.println("put " + value + " " + value.getClass());//DEBUG
index = pp;
indices.put(value, index);
pool = ArrayUtils.ensureCapacity(pool, pp);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/UninitializedType.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/UninitializedType.java Fri May 23 09:05:24 2014 -0700
@@ -26,6 +26,7 @@
package com.sun.tools.javac.jvm;
import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.util.List;
import static com.sun.tools.javac.code.TypeTag.UNINITIALIZED_OBJECT;
import static com.sun.tools.javac.code.TypeTag.UNINITIALIZED_THIS;
@@ -41,19 +42,27 @@
class UninitializedType extends Type.DelegatedType {
public static UninitializedType uninitializedThis(Type qtype) {
- return new UninitializedType(UNINITIALIZED_THIS, qtype, -1);
+ return new UninitializedType(UNINITIALIZED_THIS, qtype, -1,
+ qtype.getAnnotationMirrors());
}
public static UninitializedType uninitializedObject(Type qtype, int offset) {
- return new UninitializedType(UNINITIALIZED_OBJECT, qtype, offset);
+ return new UninitializedType(UNINITIALIZED_OBJECT, qtype, offset,
+ qtype.getAnnotationMirrors());
}
public final int offset; // PC where allocation took place
- private UninitializedType(TypeTag tag, Type qtype, int offset) {
- super(tag, qtype);
+ private UninitializedType(TypeTag tag, Type qtype, int offset,
+ List<Attribute.TypeCompound> typeAnnotations) {
+ super(tag, qtype, typeAnnotations);
this.offset = offset;
}
+ @Override
+ public UninitializedType annotatedType(List<Attribute.TypeCompound> typeAnnotations) {
+ return new UninitializedType(tag, qtype, offset, typeAnnotations);
+ }
+
Type initializedType() {
return qtype;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Fri May 23 09:05:24 2014 -0700
@@ -35,9 +35,6 @@
import java.util.Queue;
import java.util.ResourceBundle;
import java.util.Set;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.annotation.processing.Processor;
import javax.lang.model.SourceVersion;
@@ -1292,11 +1289,16 @@
* Perform dataflow checks on an attributed parse tree.
*/
protected void flow(Env<AttrContext> env, Queue<Env<AttrContext>> results) {
+ if (compileStates.isDone(env, CompileState.FLOW)) {
+ results.add(env);
+ return;
+ }
+
try {
if (shouldStop(CompileState.FLOW))
return;
- if (relax || compileStates.isDone(env, CompileState.FLOW)) {
+ if (relax) {
results.add(env);
return;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Fri May 23 09:05:24 2014 -0700
@@ -168,7 +168,8 @@
case PACKAGE:
throw new IllegalArgumentException(componentType.toString());
}
- return new Type.ArrayType((Type) componentType, syms.arrayClass);
+ return new Type.ArrayType((Type) componentType, syms.arrayClass,
+ Type.noAnnotations);
}
public WildcardType getWildcardType(TypeMirror extendsBound,
@@ -193,7 +194,8 @@
case DECLARED:
case ERROR:
case TYPEVAR:
- return new Type.WildcardType(bound, bkind, syms.boundClass);
+ return new Type.WildcardType(bound, bkind, syms.boundClass,
+ Type.noAnnotations);
default:
throw new IllegalArgumentException(bound.toString());
}
@@ -243,7 +245,8 @@
}
// TODO: Would like a way to check that type args match formals.
- return (DeclaredType) new Type.ClassType(outer, targs.toList(), sym);
+ return (DeclaredType) new Type.ClassType(outer, targs.toList(), sym,
+ Type.noAnnotations);
}
/**
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Fri May 23 09:05:24 2014 -0700
@@ -1089,7 +1089,8 @@
for (ClassSymbol cs : symtab.classes.values()) {
if (cs.classfile != null || cs.kind == Kinds.ERR) {
cs.reset();
- cs.type = new ClassType(cs.type.getEnclosingType(), null, cs);
+ cs.type = new ClassType(cs.type.getEnclosingType(),
+ null, cs, Type.noAnnotations);
if (cs.completer == null) {
cs.completer = initialCompleter;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Fri May 23 09:05:24 2014 -0700
@@ -643,6 +643,9 @@
super.setPos(pos);
return this;
}
+
+ public boolean isPoly() { return false; }
+ public boolean isStandalone() { return true; }
}
/**
@@ -663,6 +666,9 @@
/** is this poly expression a 'true' poly expression? */
public PolyKind polyKind;
+
+ @Override public boolean isPoly() { return polyKind == PolyKind.POLY; }
+ @Override public boolean isStandalone() { return polyKind == PolyKind.STANDALONE; }
}
/**
--- a/langtools/src/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java Fri May 23 09:05:24 2014 -0700
@@ -65,7 +65,7 @@
@Override
public com.sun.javadoc.Type underlyingType() {
- return TypeMaker.getType(env, type.unannotatedType(), true, false);
+ return TypeMaker.getType(env, type, true, false);
}
@Override
--- a/langtools/src/share/classes/com/sun/tools/javadoc/TypeMaker.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/TypeMaker.java Fri May 23 09:05:24 2014 -0700
@@ -140,9 +140,6 @@
*/
static String getTypeString(DocEnv env, Type t, boolean full) {
// TODO: should annotations be included here?
- if (t.isAnnotated()) {
- t = t.unannotatedType();
- }
switch (t.getTag()) {
case ARRAY:
StringBuilder s = new StringBuilder();
--- a/langtools/test/Makefile Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/Makefile Fri May 23 09:05:24 2014 -0700
@@ -186,6 +186,12 @@
JTREG_OPTIONS += -timeoutFactor:$(JTREG_TIMEOUT_FACTOR)
endif
+# Default verbosity setting for jtreg
+JTREG_VERBOSE = fail,error,nopass
+
+# Default verbosity setting for jck
+JCK_VERBOSE = non-pass
+
# Assertions: some tests show failures when assertions are enabled.
# Since javac is typically loaded via the bootclassloader (either via TESTJAVA
# or TESTBOOTCLASSPATH), you may need -esa to enable assertions in javac.
@@ -256,6 +262,8 @@
# Version of java used to run jtreg. Should normally be the same as TESTJAVA
# TESTJAVA
# Version of java to be tested.
+# JTREG_VERBOSE
+# Verbosity setting for jtreg
# JTREG_OPTIONS
# Additional options for jtreg
# JTREG_TESTDIRS
@@ -273,7 +281,7 @@
JT_JAVA=$(JT_JAVA) $(JTREG) \
-J-Xmx512m \
-vmoption:-Xmx768m \
- -a -ignore:quiet -v:fail,error,nopass \
+ -a -ignore:quiet $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE)) \
-r:$(JTREG_OUTPUT_DIR)/JTreport \
-w:$(JTREG_OUTPUT_DIR)/JTwork \
-jdk:$(TESTJAVA) \
@@ -312,6 +320,8 @@
# Default is JDK 7
# TESTJAVA
# Version of java to be tested.
+# JCK_VERBOSE
+# Verbosity setting for jtjck
# JCK_COMPILER_OPTIONS
# Additional options for JCK-compiler
# JCK_COMPILER_TESTDIRS
@@ -325,9 +335,9 @@
@rm -f -r $(JCK_COMPILER_OUTPUT_DIR)/work $(JCK_COMPILER_OUTPUT_DIR)/report \
$(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt
@mkdir -p $(JCK_COMPILER_OUTPUT_DIR)
- $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \
+ $(JT_JAVA)/bin/java -Xmx512m \
-jar $(JCK_HOME)/JCK-compiler-8/lib/jtjck.jar \
- -v:non-pass \
+ $(if $(JCK_VERBOSE),-v:$(JCK_VERBOSE)) \
-r:$(JCK_COMPILER_OUTPUT_DIR)/report \
-w:$(JCK_COMPILER_OUTPUT_DIR)/work \
-jdk:$(TESTJAVA) \
@@ -361,6 +371,8 @@
# Version of java used to run JCK. Should normally be the same as TESTJAVA
# TESTJAVA
# Version of java to be tested.
+# JCK_VERBOSE
+# Verbosity setting for jtjck
# JCK_RUNTIME_OPTIONS
# Additional options for JCK-runtime
# JCK_RUNTIME_TESTDIRS
@@ -374,9 +386,9 @@
@rm -f -r $(JCK_RUNTIME_OUTPUT_DIR)/work $(JCK_RUNTIME_OUTPUT_DIR)/report \
$(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt
@mkdir -p $(JCK_RUNTIME_OUTPUT_DIR)
- $(JT_JAVA)/bin/java -XX:MaxPermSize=256m -Xmx512m \
+ $(JT_JAVA)/bin/java -Xmx512m \
-jar $(JCK_HOME)/JCK-runtime-8/lib/jtjck.jar \
- -v:non-pass \
+ $(if $(JCK_VERBOSE),-v:$(JCK_VERBOSE)) \
-r:$(JCK_RUNTIME_OUTPUT_DIR)/report \
-w:$(JCK_RUNTIME_OUTPUT_DIR)/work \
-jdk:$(TESTJAVA) \
--- a/langtools/test/com/sun/javadoc/5093723/T5093723.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/5093723/T5093723.java Fri May 23 09:05:24 2014 -0700
@@ -25,23 +25,24 @@
* @test
* @bug 5093723
* @summary REGRESSION: ClassCastException in SingleIndexWriter
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build T5093723
* @run main T5093723
*/
public class T5093723 extends JavadocTester {
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR + ".out", "-Xdoclint:none",
- SRC_DIR + "/DocumentedClass.java",
- SRC_DIR + "/UndocumentedClass.java"
- };
+ public static void main(String... args) throws Exception {
+ T5093723 tester = new T5093723();
+ tester.runTests();
+ }
- public static void main(String... args) {
- T5093723 tester = new T5093723();
- if (tester.runJavadoc(ARGS) != 0)
- throw new AssertionError("non-zero return code from javadoc");
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-Xdoclint:none",
+ testSrc("DocumentedClass.java"),
+ testSrc("UndocumentedClass.java"));
+ checkExit(Exit.OK);
}
}
--- a/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java Fri May 23 09:05:24 2014 -0700
@@ -26,142 +26,31 @@
* @bug 4706779 4956908
* @summary Add text equivalent of class tree ASCII art for accessibility
* @author dkramer
+ * @library ../lib
+ * @build JavadocTester
* @run main AccessAsciiArt
*/
-
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-
-
-/**
- * Runs javadoc and runs regression tests on the resulting HTML.
- * It reads each file, complete with newlines, into a string to easily
- * find strings that contain newlines.
- */
-public class AccessAsciiArt {
-
- private static final String BUGID = "4706779-4956908";
- private static final String BUGNAME = "AccessAsciiArt";
- private static final String TMPDEST_DIR1 = "./docs1/";
- private static final String TMPDEST_DIR2 = "./docs2/";
+public class AccessAsciiArt extends JavadocTester {
- // Subtest number. Needed because runResultsOnHTML is run twice,
- // and subtestNum should increment across subtest runs.
- public static int subtestNum = 0;
- public static int numSubtestsPassed = 0;
-
- // Entry point
- public static void main(String[] args) {
-
- // Directory that contains source files that javadoc runs on
- String srcdir = System.getProperty("test.src", ".");
-
- // Test for all cases except the split index page
- runJavadoc(new String[] {"-d", TMPDEST_DIR1,
- "-sourcepath", srcdir,
- "p1", "p1.subpkg"});
- runTestsOnHTML(testArray);
-
- printSummary();
- }
-
- /** Run javadoc */
- public static void runJavadoc(String[] javadocArgs) {
- if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
- throw new Error("Javadoc failed to execute");
- }
+ public static void main(String... args) throws Exception {
+ AccessAsciiArt tester = new AccessAsciiArt();
+ tester.runTests();
}
- /**
- * Assign value for [ stringToFind, filename ]
- * NOTE: The standard doclet uses the same separator "\n" for all OS's
- */
- private static final String[][] testArray = {
-
- // Test the top line of the class tree
- {
-"<li><a href=\"../../p1/C.html\" title=\"class in p1\">p1.C</a></li>",
- TMPDEST_DIR1 + "p1/subpkg/SSC.html" },
-
- // Test the second line of the class tree
- {
-"<li><a href=\"../../p1/SC.html\" title=\"class in p1\">p1.SC</a></li>",
- TMPDEST_DIR1 + "p1/subpkg/SSC.html" },
-
- // Test the third line of the class tree
- {
-"<li>p1.subpkg.SSC</li>",
- TMPDEST_DIR1 + "p1/subpkg/SSC.html" },
-
- };
-
- public static void runTestsOnHTML(String[][] testArray) {
-
- for (int i = 0; i < testArray.length; i++) {
-
- subtestNum += 1;
-
- // Read contents of file into a string
- String fileString = readFileToString(testArray[i][1]);
-
- // Get string to find
- String stringToFind = testArray[i][0];
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "p1", "p1.subpkg");
+ checkExit(Exit.OK);
- // Find string in file's contents
- if (findString(fileString, stringToFind) == -1) {
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
- + "when searching for:\n"
- + stringToFind);
- } else {
- numSubtestsPassed += 1;
- System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
- }
- }
- }
-
- public static void printSummary() {
- if ( numSubtestsPassed == subtestNum ) {
- System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
- } else {
- throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
- + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
- }
- }
-
- // Read the file into a String
- public static String readFileToString(String filename) {
- try {
- File file = new File(filename);
- if ( !file.exists() ) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
- BufferedReader in = new BufferedReader(new FileReader(file));
-
- // Create an array of characters the size of the file
- char[] allChars = new char[(int)file.length()];
-
- // Read the characters into the allChars array
- in.read(allChars, 0, (int)file.length());
- in.close();
-
- // Convert to a string
- String allCharsString = new String(allChars);
-
- return allCharsString;
-
- } catch (FileNotFoundException e) {
- System.err.println(e);
- return "";
- } catch (IOException e) {
- System.err.println(e);
- return "";
- }
- }
-
- public static int findString(String fileString, String stringToFind) {
- return fileString.indexOf(stringToFind);
+ checkOutput("p1/subpkg/SSC.html", true,
+ // Test the top line of the class tree
+ "<li><a href=\"../../p1/C.html\" title=\"class in p1\">p1.C</a></li>",
+ // Test the second line of the class tree
+ "<li><a href=\"../../p1/SC.html\" title=\"class in p1\">p1.SC</a></li>",
+ // Test the third line of the class tree
+ "<li>p1.subpkg.SSC</li>");
}
}
--- a/langtools/test/com/sun/javadoc/AccessFrameTitle/AccessFrameTitle.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/AccessFrameTitle/AccessFrameTitle.java Fri May 23 09:05:24 2014 -0700
@@ -26,141 +26,32 @@
* @bug 4636655
* @summary Add title attribute to <FRAME> tags for accessibility
* @author dkramer
+ * @library ../lib
+ * @build JavadocTester
* @run main AccessFrameTitle
*/
-
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-
-
-/**
- * Runs javadoc and runs regression tests on the resulting HTML.
- * It reads each file, complete with newlines, into a string to easily
- * find strings that contain newlines.
- */
-public class AccessFrameTitle {
-
- private static final String BUGID = "4636655";
- private static final String BUGNAME = "AccessFrameTitle";
- private static final String TMPDEST_DIR1 = "./docs1/";
- private static final String TMPDEST_DIR2 = "./docs2/";
+public class AccessFrameTitle extends JavadocTester {
- // Subtest number. Needed because runResultsOnHTML is run twice,
- // and subtestNum should increment across subtest runs.
- public static int subtestNum = 0;
- public static int numSubtestsPassed = 0;
-
- // Entry point
- public static void main(String[] args) {
-
- // Directory that contains source files that javadoc runs on
- String srcdir = System.getProperty("test.src", ".");
-
- // Test for all cases except the split index page
- runJavadoc(new String[] {"-d", TMPDEST_DIR1,
- "-sourcepath", srcdir,
- "p1", "p2"});
- runTestsOnHTML(testArray);
-
- printSummary();
- }
-
- /** Run javadoc */
- public static void runJavadoc(String[] javadocArgs) {
- if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
- throw new Error("Javadoc failed to execute");
- }
+ public static void main(String... args) throws Exception {
+ AccessFrameTitle tester = new AccessFrameTitle();
+ tester.runTests();
}
- /**
- * Assign value for [ stringToFind, filename ]
- * NOTE: The standard doclet uses the same separator "\n" for all OS's
- */
- private static final String[][] testArray = {
-
- // Testing only for the presence of the title attributes.
- // To make this test more robust, only
- // the initial part of each title string is tested for,
- // in case the ending part of the string later changes
-
- { "title=\"All classes and interfaces (except non-static nested types)\"",
- TMPDEST_DIR1 + "index.html" },
-
- { "title=\"All Packages\"",
- TMPDEST_DIR1 + "index.html" },
-
- { "title=\"Package, class and interface descriptions\"",
- TMPDEST_DIR1 + "index.html" },
-
- };
-
- public static void runTestsOnHTML(String[][] testArray) {
-
- for (int i = 0; i < testArray.length; i++) {
-
- subtestNum += 1;
-
- // Read contents of file into a string
- String fileString = readFileToString(testArray[i][1]);
-
- // Get string to find
- String stringToFind = testArray[i][0];
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
- // Find string in file's contents
- if (findString(fileString, stringToFind) == -1) {
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
- + "when searching for:\n"
- + stringToFind);
- } else {
- numSubtestsPassed += 1;
- System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
- }
- }
- }
-
- public static void printSummary() {
- if ( numSubtestsPassed == subtestNum ) {
- System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
- } else {
- throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
- + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
- }
- }
-
- // Read the file into a String
- public static String readFileToString(String filename) {
- try {
- File file = new File(filename);
- if ( !file.exists() ) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
- BufferedReader in = new BufferedReader(new FileReader(file));
-
- // Create an array of characters the size of the file
- char[] allChars = new char[(int)file.length()];
-
- // Read the characters into the allChars array
- in.read(allChars, 0, (int)file.length());
- in.close();
-
- // Convert to a string
- String allCharsString = new String(allChars);
-
- return allCharsString;
-
- } catch (FileNotFoundException e) {
- System.err.println(e);
- return "";
- } catch (IOException e) {
- System.err.println(e);
- return "";
- }
- }
-
- public static int findString(String fileString, String stringToFind) {
- return fileString.indexOf(stringToFind);
+ // Testing only for the presence of the title attributes.
+ // To make this test more robust, only
+ // the initial part of each title string is tested for,
+ // in case the ending part of the string later changes
+ checkOutput("index.html", true,
+ "title=\"All classes and interfaces (except non-static nested types)\"",
+ "title=\"All Packages\"",
+ "title=\"Package, class and interface descriptions\"");
}
}
--- a/langtools/test/com/sun/javadoc/AccessH1/AccessH1.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/AccessH1/AccessH1.java Fri May 23 09:05:24 2014 -0700
@@ -26,141 +26,35 @@
* @bug 4636667 7052425 8016549
* @summary Use <H1, <H2>, and <H3> in proper sequence for accessibility
* @author dkramer
+ * @library ../lib
+ * @build JavadocTester
* @run main AccessH1
*/
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-
-
-/**
- * Runs javadoc and runs regression tests on the resulting HTML.
- * It reads each file, complete with newlines, into a string to easily
- * find strings that contain newlines.
- */
-public class AccessH1 {
-
- protected static final String NL = System.getProperty("line.separator");
-
- private static final String BUGID = "4636667-7052425";
- private static final String BUGNAME = "AccessH1";
- private static final String TMPDEST_DIR1 = "./docs1/";
- private static final String TMPDEST_DIR2 = "./docs2/";
+public class AccessH1 extends JavadocTester {
- // Subtest number. Needed because runResultsOnHTML is run twice,
- // and subtestNum should increment across subtest runs.
- public static int subtestNum = 0;
- public static int numSubtestsPassed = 0;
-
- // Entry point
- public static void main(String[] args) {
-
- // Directory that contains source files that javadoc runs on
- String srcdir = System.getProperty("test.src", ".");
-
- // Test for all cases except the split index page
- runJavadoc(new String[] {"-d", TMPDEST_DIR1,
- "-doctitle", "Document Title",
- "-sourcepath", srcdir,
- "p1", "p2"});
- runTestsOnHTML(testArray);
-
- printSummary();
- }
-
- /** Run javadoc */
- public static void runJavadoc(String[] javadocArgs) {
- if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
- throw new Error("Javadoc failed to execute");
- }
+ public static void main(String... args) throws Exception {
+ AccessH1 tester = new AccessH1();
+ tester.runTests();
}
- /**
- * Assign value for [ stringToFind, filename ]
- * NOTE: The standard doclet uses the same separator "\n" for all OS's
- */
- private static final String[][] testArray = {
- // Test the style sheet
- {
- "h1 {\n" +
- " font-size:20px;\n" +
- "}",
- TMPDEST_DIR1 + "stylesheet.css"
- },
- // Test the doc title in the overview page
- {
- "<h1 class=\"title\">Document Title</h1>",
- TMPDEST_DIR1 + "overview-summary.html"
- }
- };
-
- public static void runTestsOnHTML(String[][] testArray) {
-
- for (int i = 0; i < testArray.length; i++) {
-
- subtestNum += 1;
-
- // Read contents of file into a string
- String fileString = readFileToString(testArray[i][1]);
-
- // Get string to find
- String stringToFind = testArray[i][0];
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-doctitle", "Document Title",
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
- // Find string in file's contents
- if (findString(fileString, stringToFind) == -1) {
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
- + "when searching for:\n"
- + stringToFind);
- } else {
- numSubtestsPassed += 1;
- System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
- }
- }
- }
-
- public static void printSummary() {
- if ( numSubtestsPassed == subtestNum ) {
- System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
- } else {
- throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
- + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
- }
- }
+ // Test the style sheet
+ checkOutput("stylesheet.css", true,
+ "h1 {\n"
+ + " font-size:20px;\n"
+ + "}");
- // Read the file into a String
- public static String readFileToString(String filename) {
- try {
- File file = new File(filename);
- if ( !file.exists() ) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
- BufferedReader in = new BufferedReader(new FileReader(file));
-
- // Create an array of characters the size of the file
- char[] allChars = new char[(int)file.length()];
-
- // Read the characters into the allChars array
- in.read(allChars, 0, (int)file.length());
- in.close();
-
- // Convert to a string
- String allCharsString = new String(allChars);
-
- return allCharsString;
-
- } catch (FileNotFoundException e) {
- System.err.println(e);
- return "";
- } catch (IOException e) {
- System.err.println(e);
- return "";
- }
- }
-
- public static int findString(String fileString, String stringToFind) {
- return fileString.replace(NL, "\n").indexOf(stringToFind);
+ // Test the doc title in the overview page
+ checkOutput("overview-summary.html", true,
+ "<h1 class=\"title\">Document Title</h1>");
}
}
--- a/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Fri May 23 09:05:24 2014 -0700
@@ -26,150 +26,40 @@
* @bug 4638136 7198273 8025633
* @summary Add ability to skip over nav bar for accessibility
* @author dkramer
+ * @library ../lib
+ * @build JavadocTester
* @run main AccessSkipNav
*/
-
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-
-
-/**
- * Runs javadoc and runs regression tests on the resulting HTML.
- * It reads each file, complete with newlines, into a string to easily
- * find strings that contain newlines.
- */
-public class AccessSkipNav {
-
- protected static final String NL = System.getProperty("line.separator");
-
- private static final String BUGID = "4638136 - 7198273";
- private static final String BUGNAME = "AccessSkipNav";
- private static final String TMPDEST_DIR1 = "./docs1/";
- private static final String TMPDEST_DIR2 = "./docs2/";
+public class AccessSkipNav extends JavadocTester {
- // Subtest number. Needed because runResultsOnHTML is run twice,
- // and subtestNum should increment across subtest runs.
- public static int subtestNum = 0;
- public static int numSubtestsPassed = 0;
-
- // Entry point
- public static void main(String[] args) {
-
- // Directory that contains source files that javadoc runs on
- String srcdir = System.getProperty("test.src", ".");
-
- // Test for all cases except the split index page
- runJavadoc(new String[] {"-d", TMPDEST_DIR1,
- "-sourcepath", srcdir,
- "p1", "p2"});
- runTestsOnHTML(testArray);
-
- printSummary();
- }
-
- /** Run javadoc */
- public static void runJavadoc(String[] javadocArgs) {
- if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
- throw new Error("Javadoc failed to execute");
- }
+ public static void main(String... args) throws Exception {
+ AccessSkipNav tester = new AccessSkipNav();
+ tester.runTests();
}
- /**
- * Assign value for [ stringToFind, filename ]
- * NOTE: The standard doclet uses the same separator "\n" for all OS's
- */
- private static final String[][] testArray = {
-
- // Testing only for the presence of the <a href> and <a name>
-
- // Top navbar <a href>
- { "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
- TMPDEST_DIR1 + "p1/C1.html" },
-
- // Top navbar <a name>
- { "<a name=\"skip.navbar.top\">\n" +
- "<!-- -->\n" +
- "</a>",
- TMPDEST_DIR1 + "p1/C1.html" },
-
- // Bottom navbar <a href>
- { "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
- TMPDEST_DIR1 + "p1/C1.html" },
-
- // Bottom navbar <a name>
- { "<a name=\"skip.navbar.bottom\">\n" +
- "<!-- -->\n" +
- "</a>",
- TMPDEST_DIR1 + "p1/C1.html" }
- };
-
- public static void runTestsOnHTML(String[][] testArray) {
-
- for (int i = 0; i < testArray.length; i++) {
-
- subtestNum += 1;
-
- // Read contents of file into a string
- String fileString = readFileToString(testArray[i][1]);
-
- // Get string to find
- String stringToFind = testArray[i][0];
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
- // Find string in file's contents
- if (findString(fileString, stringToFind) == -1) {
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
- + "when searching for:\n"
- + stringToFind);
- } else {
- numSubtestsPassed += 1;
- System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
- }
- }
- }
-
- public static void printSummary() {
- if ( numSubtestsPassed == subtestNum ) {
- System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
- } else {
- throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
- + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
- }
- }
+ // Testing only for the presence of the <a href> and <a name>
+ checkOutput("p1/C1.html", true,
+ // Top navbar <a href>
+ "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
+ // Top navbar <a name>
+ "<a name=\"skip.navbar.top\">\n"
+ + "<!-- -->\n"
+ + "</a>",
+ // Bottom navbar <a href>
+ "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
+ // Bottom navbar <a name>
+ "<a name=\"skip.navbar.bottom\">\n"
+ + "<!-- -->\n"
+ + "</a>");
- // Read the file into a String
- public static String readFileToString(String filename) {
- try {
- File file = new File(filename);
- if ( !file.exists() ) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
- BufferedReader in = new BufferedReader(new FileReader(file));
- // Create an array of characters the size of the file
- char[] allChars = new char[(int)file.length()];
-
- // Read the characters into the allChars array
- in.read(allChars, 0, (int)file.length());
- in.close();
-
- // Convert to a string
- String allCharsString = new String(allChars);
-
- return allCharsString;
-
- } catch (FileNotFoundException e) {
- System.err.println(e);
- return "";
- } catch (IOException e) {
- System.err.println(e);
- return "";
- }
- }
-
- public static int findString(String fileString, String stringToFind) {
- return fileString.replace(NL, "\n").indexOf(stringToFind);
}
}
--- a/langtools/test/com/sun/javadoc/AccessSummary/AccessSummary.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/AccessSummary/AccessSummary.java Fri May 23 09:05:24 2014 -0700
@@ -26,45 +26,35 @@
* @bug 4637604 4775148
* @summary Test the tables for summary attribute
* @author dkramer
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build AccessSummary
* @run main AccessSummary
*/
public class AccessSummary extends JavadocTester {
-
- /**
- * Assign value for [ fileToSearch, stringToFind ]
- */
- private static final String[][] TESTARRAY1 = {
-
- // Test that the summary attribute appears
- { "overview-summary.html",
- "summary=\"Packages table, listing packages, and an explanation\"" },
-
- // Test that the summary attribute appears
- { "p1/C1.html",
- "summary=\"Constructor Summary table, listing constructors, and an explanation\"" },
-
- // Test that the summary attribute appears
- { "constant-values.html",
- "summary=\"Constant Field Values table, listing constant fields, and values\"" }
- };
-
- // First test with -header only
- private static final String[] JAVADOC_ARGS = new String[] {
- "-d", OUTPUT_DIR,
- "-sourcepath", SRC_DIR,
- "p1", "p2"};
-
/**
* The entry point of the test.
* @param args the array of command line arguments.
+ * @throws Exception if the test fails
*/
- public static void main(String[] args) {
- JavadocTester tester = new AccessSummary();
- tester.run(JAVADOC_ARGS, TESTARRAY1, new String[][] {});
- tester.printSummary(); // Necessary for string search
+ public static void main(String... args) throws Exception {
+ AccessSummary tester = new AccessSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void testAccessSummary() {
+ javadoc("-d", "out", "-sourcepath", testSrc, "p1", "p2");
+ checkExit(Exit.OK);
+ checkOutput("overview-summary.html", true,
+ "summary=\"Packages table, listing packages, and an explanation\"");
+
+ // Test that the summary attribute appears
+ checkOutput("p1/C1.html", true,
+ "summary=\"Constructor Summary table, listing constructors, and an explanation\"");
+
+ // Test that the summary attribute appears
+ checkOutput("constant-values.html", true,
+ "summary=\"Constant Field Values table, listing constant fields, and values\"");
}
}
--- a/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java Fri May 23 09:05:24 2014 -0700
@@ -26,143 +26,37 @@
* @bug 4651598 8026567
* @summary Javadoc wrongly inserts </DD> tags when using multiple @author tags
* @author dkramer
+ * @library ../lib
+ * @build JavadocTester
* @run main AuthorDD
*/
-
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-
-
/**
* Runs javadoc and runs regression tests on the resulting HTML.
- * It reads each file, complete with newlines, into a string to easily
- * find strings that contain newlines.
*/
-public class AuthorDD
-{
-
- protected static final String NL = System.getProperty("line.separator");
-
- private static final String BUGID = "4651598";
- private static final String BUGNAME = "AuthorDD";
-
- // Subtest number. Needed because runResultsOnHTML is run twice, and subtestNum
- // should increment across subtest runs.
- public static int subtestNum = 0;
- public static int numSubtestsPassed = 0;
-
- // Entry point
- public static void main(String[] args) {
+public class AuthorDD extends JavadocTester {
- // Directory that contains source files that javadoc runs on
- String srcdir = System.getProperty("test.src", ".");
-
- // Test for all cases except the split index page
- runJavadoc(new String[] {"-d", BUGID,
- "-author",
- "-version",
- "-sourcepath", srcdir,
- "p1"});
- runTestsOnHTML(testArray);
-
- printSummary();
- }
-
- /** Run javadoc */
- public static void runJavadoc(String[] javadocArgs) {
- if (com.sun.tools.javadoc.Main.execute(AuthorDD.class.getClassLoader(),
- javadocArgs) != 0) {
- throw new Error("Javadoc failed to execute");
- }
+ public static void main(String... args) throws Exception {
+ AuthorDD tester = new AuthorDD();
+ tester.runTests();
}
- /**
- * Assign value for [ stringToFind, filename ]
- * NOTE: The standard doclet uses the same separator "\n" for all OS's
- */
- private static final String[][] testArray = {
-
- // Test single @since tag:
-
- { "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
- "<dd>JDK 1.0</dd>",
- BUGID + "/p1/C1.html" },
-
- // Test multiple @author tags:
-
- { "<dt><span class=\"simpleTagLabel\">Author:</span></dt>\n" +
- "<dd>Doug Kramer, Jamie, Neal</dd>",
- BUGID + "/p1/C1.html" },
-
- };
-
- public static void runTestsOnHTML(String[][] testArray) {
-
- for (int i = 0; i < testArray.length; i++) {
-
- subtestNum += 1;
-
- // Read contents of file into a string
- String fileString = readFileToString(testArray[i][1]);
-
- // Get string to find
- String stringToFind = testArray[i][0];
+ @Test
+ void test() {
+ // Test for all cases except the split index page
+ javadoc("-d", "out",
+ "-author",
+ "-version",
+ "-sourcepath", testSrc,
+ "p1");
+ checkExit(Exit.OK);
- // Find string in file's contents
- if (findString(fileString, stringToFind) == -1) {
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
- + "when searching for:\n"
- + stringToFind);
- } else {
- numSubtestsPassed += 1;
- System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
- }
- }
- }
-
- public static void printSummary() {
- if ( numSubtestsPassed == subtestNum ) {
- System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
- } else {
- throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
- + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
- }
- }
-
- // Read the file into a String
- public static String readFileToString(String filename) {
- try {
- File file = new File(filename);
- if ( !file.exists() ) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
- BufferedReader in = new BufferedReader(new FileReader(file));
-
- // Create an array of characters the size of the file
- char[] allChars = new char[(int)file.length()];
-
- // Read the characters into the allChars array
- in.read(allChars, 0, (int)file.length());
- in.close();
-
- // Convert to a string
- String allCharsString = new String(allChars);
-
- return allCharsString;
-
- } catch (FileNotFoundException e) {
- System.err.println(e);
- return "";
- } catch (IOException e) {
- System.err.println(e);
- return "";
- }
- }
-
- public static int findString(String fileString, String stringToFind) {
- return fileString.replace(NL, "\n").indexOf(stringToFind);
+ checkOutput("p1/C1.html", true,
+ // Test single @since tag:
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>JDK 1.0</dd>",
+ // Test multiple @author tags:
+ "<dt><span class=\"simpleTagLabel\">Author:</span></dt>\n"
+ + "<dd>Doug Kramer, Jamie, Neal</dd>");
}
}
--- a/langtools/test/com/sun/javadoc/DocRootSlash/DocRootSlash.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/DocRootSlash/DocRootSlash.java Fri May 23 09:05:24 2014 -0700
@@ -26,13 +26,11 @@
* @bug 4524350 4662945 4633447
* @summary stddoclet: {@docRoot} inserts an extra trailing "/"
* @author dkramer
+ * @library ../lib
+ * @build JavadocTester
* @run main DocRootSlash
*/
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-import java.nio.*;
import java.util.regex.*;
/**
@@ -40,149 +38,55 @@
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
-public class DocRootSlash
-{
- private static final String BUGID = "4524350, 4662945, or 4633447";
- private static final String BUGNAME = "DocRootSlash";
- private static final String TMPDIR_STRING1 = "./docs1/";
+public class DocRootSlash extends JavadocTester {
- // Test number. Needed because runResultsOnHTMLFile is run twice, and subtestNum
- // should increment across test runs.
- public static int subtestNum = 0;
- public static int numOfSubtestsPassed = 0;
+ public static void main(String... args) throws Exception {
+ DocRootSlash tester = new DocRootSlash();
+ tester.runTests();
+ }
- // Entry point
- public static void main(String[] args) {
-
+ @Test
+ void test() {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
- runJavadoc(new String[] {"-d", TMPDIR_STRING1,
- "-Xdoclint:none",
- "-overview", (srcdir + "/overview.html"),
- "-header", "<A HREF=\"{@docroot}/package-list\">{@docroot}</A> <A HREF=\"{@docRoot}/help-doc\">{@docRoot}</A>",
- "-sourcepath", srcdir,
- "p1", "p2"});
- runTestsOnHTMLFiles(filenameArray);
-
- printSummary();
- }
-
- /** Run javadoc */
- public static void runJavadoc(String[] javadocArgs) {
- if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
- throw new Error("Javadoc failed to execute");
- }
- }
+ javadoc("-d", "out",
+ "-Xdoclint:none",
+ "-overview", (srcdir + "/overview.html"),
+ "-header", "<A HREF=\"{@docroot}/package-list\">{@docroot}</A> <A HREF=\"{@docRoot}/help-doc\">{@docRoot}</A>",
+ "-sourcepath", srcdir,
+ "p1", "p2");
- /** The array of filenames to test */
- private static final String[] filenameArray = {
- TMPDIR_STRING1 + "p1/C1.html" ,
- TMPDIR_STRING1 + "p1/package-summary.html",
- TMPDIR_STRING1 + "overview-summary.html"
- };
-
- public static void runTestsOnHTMLFiles(String[] filenameArray) {
- String fileString;
-
- // Bugs 4524350 4662945
- for (int i = 0; i < filenameArray.length; i++ ) {
-
- // Read contents of file (whose filename is in filenames) into a string
- fileString = readFileToString(filenameArray[i]);
-
- System.out.println("\nSub-tests for file: " + filenameArray[i]
- + " --------------");
-
- // Loop over all tests in a single file
- for ( int j = 0; j < 11; j++ ) {
- subtestNum += 1;
-
- // Compare actual to expected string for a single subtest
- compareActualToExpected(fileString);
- }
- }
+ checkFiles(
+ "p1/C1.html" ,
+ "p1/package-summary.html",
+ "overview-summary.html");
// Bug 4633447: Special test for overview-frame.html
// Find two strings in file "overview-frame.html"
- String filename = TMPDIR_STRING1 + "overview-frame.html";
- fileString = readFileToString(filename);
-
- // Find first string <A HREF="./package-list"> in overview-frame.html
- subtestNum += 1;
- String stringToFind = "<A HREF=\"./package-list\">";
- String result;
- if ( fileString.indexOf(stringToFind) == -1 ) {
- result = "FAILED";
- } else {
- result = "succeeded";
- numOfSubtestsPassed += 1;
- }
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") " + result + "\n"
- + "when searching for:\n"
- + stringToFind + "\n"
- + "in file " + filename);
-
- // Find second string <A HREF="./help-doc"> in overview-frame.html
- subtestNum += 1;
- stringToFind = "<A HREF=\"./help-doc\">";
- if ( fileString.indexOf(stringToFind) == -1 ) {
- result = "FAILED";
- } else {
- result = "succeeded";
- numOfSubtestsPassed += 1;
- }
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") " + result + "\n"
- + "when searching for:\n"
- + stringToFind + "\n"
- + "in file " + filename);
+ checkOutput("overview-frame.html", true,
+ "<A HREF=\"./package-list\">",
+ "<A HREF=\"./help-doc\">");
}
- public static void printSummary() {
- System.out.println("");
- if ( numOfSubtestsPassed == subtestNum ) {
- System.out.println("\nAll " + numOfSubtestsPassed + " subtests passed");
- } else {
- throw new Error("\n" + (subtestNum - numOfSubtestsPassed) + " of " + (subtestNum)
- + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
- }
- }
-
- // Read the contents of the file into a String
- public static String readFileToString(String filename) {
- try {
- File file = new File(filename);
- if ( !file.exists() ) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
+ void checkFiles(String... filenameArray) {
+ int count = 0;
- BufferedReader in = new BufferedReader(new FileReader(file));
-
- // Create an array of characters the size of the file
- char[] allChars = new char[(int)file.length()];
-
- // Read the characters into the allChars array
- in.read(allChars, 0, (int)file.length());
- in.close();
+ for (String f : filenameArray) {
+ // Read contents of file into a string
+ String fileString = readFile(f);
+ System.out.println("\nSub-tests for file: " + f + " --------------");
+ // Loop over all tests in a single file
+ for ( int j = 0; j < 11; j++ ) {
- // Convert to a string
- String allCharsString = new String(allChars);
-
- return allCharsString;
- } catch (FileNotFoundException e) {
- System.err.println(e);
- return "";
- } catch (IOException e) {
- System.err.println(e);
- return "";
+ // Compare actual to expected string for a single subtest
+ compareActualToExpected(++count, fileString);
+ }
}
}
/**
- * Regular expression pattern matching code adapted from Eric's
- * /java/pubs/dev/linkfix/src/LinkFix.java
+ * Regular expression pattern matching code
*
* Prefix Pattern:
* flag (?i) (case insensitive, so "a href" == "A HREF" and all combinations)
@@ -197,34 +101,33 @@
* group4 (.*?) (label - zero or more characters)
* group5 (</a>) (end tag)
*/
- static String prefix = "(?i)(<a\\s+href="; // <a href= (start group1)
- static String ref1 = "\")([^\"]*)(\".*?>)"; // doublequotes (end group1, group2, group3)
- static String ref2 = ")(\\S+?)([^<>]*>)"; // no quotes (end group1, group2, group3)
- static String label = "(.*?)"; // text label (group4)
- static String end = "(</a>)"; // </a> (group5)
+ private static final String prefix = "(?i)(<a\\s+href="; // <a href= (start group1)
+ private static final String ref1 = "\")([^\"]*)(\".*?>)"; // doublequotes (end group1, group2, group3)
+ private static final String ref2 = ")(\\S+?)([^<>]*>)"; // no quotes (end group1, group2, group3)
+ private static final String label = "(.*?)"; // text label (group4)
+ private static final String end = "(</a>)"; // </a> (group5)
/**
* Compares the actual string to the expected string in the specified string
- * str String to search through
+ * @param str String to search through
*/
- static void compareActualToExpected(String str) {
- // Pattern must be compiled each run because subtestNum is incremented
+ void compareActualToExpected(int count, String str) {
+ checking("comparison for " + str);
+
+ // Pattern must be compiled each run because numTestsRun is incremented
Pattern actualLinkPattern1 =
- Pattern.compile("Sub-test " + subtestNum + " Actual: " + prefix + ref1, Pattern.DOTALL);
+ Pattern.compile("Sub-test " + count + " Actual: " + prefix + ref1, Pattern.DOTALL);
Pattern expectLinkPattern1 =
- Pattern.compile("Sub-test " + subtestNum + " Expect: " + prefix + ref1, Pattern.DOTALL);
+ Pattern.compile("Sub-test " + count + " Expect: " + prefix + ref1, Pattern.DOTALL);
// Pattern linkPattern2 = Pattern.compile(prefix + ref2 + label + end, Pattern.DOTALL);
- CharBuffer charBuffer = CharBuffer.wrap(str);
- Matcher actualLinkMatcher1 = actualLinkPattern1.matcher(charBuffer);
- Matcher expectLinkMatcher1 = expectLinkPattern1.matcher(charBuffer);
- String result;
- if ( expectLinkMatcher1.find() && actualLinkMatcher1.find() ) {
+ Matcher actualLinkMatcher1 = actualLinkPattern1.matcher(str);
+ Matcher expectLinkMatcher1 = expectLinkPattern1.matcher(str);
+ if (expectLinkMatcher1.find() && actualLinkMatcher1.find()) {
String expectRef = expectLinkMatcher1.group(2);
String actualRef = actualLinkMatcher1.group(2);
- if ( actualRef.equals(expectRef) ) {
- result = "succeeded";
- numOfSubtestsPassed += 1;
+ if (actualRef.equals(expectRef)) {
+ passed(expectRef);
// System.out.println("pattern: " + actualLinkPattern1.pattern());
// System.out.println("actualRef: " + actualRef);
// System.out.println("group0: " + actualLinkMatcher1.group());
@@ -233,15 +136,13 @@
// System.out.println("group3: " + actualLinkMatcher1.group(3));
// System.exit(0);
} else {
- result = "FAILED";
+ failed("\n"
+ + "Actual: \"" + actualRef + "\"\n"
+ + "Expect: \"" + expectRef + "\"");
}
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") " + result + "\n"
- + "Actual: \"" + actualRef + "\"" + "\n"
- + "Expect: \"" + expectRef + "\"");
} else {
- System.out.println("Didn't find <A HREF> that fits the pattern: "
- + expectLinkPattern1.pattern() );
+ failed("Didn't find <A HREF> that fits the pattern: "
+ + expectLinkPattern1.pattern());
}
}
}
--- a/langtools/test/com/sun/javadoc/InheritDocForUserTags/DocTest.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/InheritDocForUserTags/DocTest.java Fri May 23 09:05:24 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,11 +26,11 @@
* @bug 8008768
* @summary Using {@inheritDoc} in simple tag defined via -tag fails
* @author Mike Duigou
+ * @library ../lib
+ * @build JavadocTester
* @run main DocTest
*/
-import java.io.*;
-
/**
* DocTest documentation.
*
@@ -38,41 +38,27 @@
* @implSpec DocTest implementation spec.
* @implNote DocTest implementation note.
*/
-public class DocTest {
+public class DocTest extends JavadocTester {
public static void main(String... args) throws Exception {
- String[] javadoc_args = {
- "-verbose",
- "-d", "DocTest",
- "-tag", "apiNote:optcm:<em>API Note</em>",
- "-tag", "implSpec:optcm:<em>Implementation Requirements</em>:",
- "-tag", "implNote:optcm:<em>Implementation Note</em>:",
- "-package",
- new File(System.getProperty("test.src"), "DocTest.java").getPath()
- };
+ DocTest tester = new DocTest();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-verbose",
+ "-d", "DocTest",
+ "-tag", "apiNote:optcm:<em>API Note</em>",
+ "-tag", "implSpec:optcm:<em>Implementation Requirements</em>:",
+ "-tag", "implNote:optcm:<em>Implementation Note</em>:",
+ "-package",
+ testSrc("DocTest.java")
+ );
+ checkExit(Exit.OK);
// javadoc does not report an exit code for an internal exception (!)
// so monitor stderr for stack dumps.
- PrintStream prevErr = System.err;
- ByteArrayOutputStream err_baos = new ByteArrayOutputStream();
- PrintStream err_ps = new PrintStream(err_baos);
- System.setErr(err_ps);
-
- int rc;
- try {
- rc = com.sun.tools.javadoc.Main.execute(javadoc_args);
- } finally {
- err_ps.close();
- System.setErr(prevErr);
- }
-
- String err = err_baos.toString();
- System.err.println(err);
-
- if (rc != 0)
- throw new Exception("javadoc exited with rc=" + rc);
-
- if (err.contains("at com.sun."))
- throw new Exception("javadoc output contains stack trace");
+ checkOutput(Output.STDERR, false, "at com.sun");
}
/**
--- a/langtools/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java Fri May 23 09:05:24 2014 -0700
@@ -27,172 +27,49 @@
* @summary Javascript IE load error when linked by -linkoffline
* Window title shouldn't change when loading left frames (javascript)
* @author dkramer
+ * @library ../lib
+ * @build JavadocTester
* @run main JavascriptWinTitle
*/
-
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-
-
-/**
- * Runs javadoc and runs regression tests on the resulting HTML.
- * It reads each file, complete with newlines, into a string to easily
- * find strings that contain newlines.
- */
-public class JavascriptWinTitle {
-
- protected static final String NL = System.getProperty("line.separator");
-
- private static final String BUGID = "4645058";
- private static final String BUGNAME = "JavascriptWinTitle";
- private static final String TMPDEST_DIR1 = "./docs1/";
- private static final String TMPDEST_DIR2 = "./docs2/";
-
- // Subtest number. Needed because runResultsOnHTML is run twice,
- // and subtestNum should increment across subtest runs.
- public static int subtestNum = 0;
- public static int numSubtestsPassed = 0;
+public class JavascriptWinTitle extends JavadocTester {
- // Entry point
- public static void main(String[] args) {
-
- // Directory that contains source files that javadoc runs on
- String srcdir = System.getProperty("test.src", ".");
-
- // Test for all cases except the split index page
- runJavadoc(new String[] {"-d", TMPDEST_DIR1,
- "-doctitle", "Document Title",
- "-windowtitle", "Window Title",
- "-overview", (srcdir + "/overview.html"),
- "-linkoffline",
- "http://java.sun.com/j2se/1.4/docs/api", srcdir,
- "-sourcepath", srcdir,
- "p1", "p2"});
- runTestsOnHTML(testArray);
-
- printSummary();
- }
-
- /** Run javadoc */
- public static void runJavadoc(String[] javadocArgs) {
- if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
- throw new Error("Javadoc failed to execute");
- }
+ public static void main(String... args) throws Exception {
+ JavascriptWinTitle tester = new JavascriptWinTitle();
+ tester.runTests();
}
- /**
- * Assign value for [ stringToFind, filename ]
- * NOTE: The standard doclet uses the same separator "\n" for all OS's
- */
- private static final String[][] testArray = {
-
- // Test the javascript "type" attribute is present:
- { "<script type=\"text/javascript\">",
- TMPDEST_DIR1 + "overview-summary.html" },
-
- // Test onload is absent:
- { "<body>",
- TMPDEST_DIR1 + "overview-summary.html" },
-
- // Test onload is present:
- { "<body>",
- TMPDEST_DIR1 + "/p1/package-summary.html" },
-
- // Test that "onload" is not present in BODY tag:
- { "<body>",
- TMPDEST_DIR1 + "overview-frame.html" },
-
- // Test that "onload" is not present in BODY tag:
- { "<body>",
- TMPDEST_DIR1 + "allclasses-frame.html" },
-
- // Test that "onload" is not present in BODY tag:
- { "<body>",
- TMPDEST_DIR1 + "/p1/package-frame.html" },
-
- // Test that win title javascript is followed by NOSCRIPT code.
- {"<script type=\"text/javascript\"><!--\n" +
- " try {\n" +
- " if (location.href.indexOf('is-external=true') == -1) {\n" +
- " parent.document.title=\"C (Window Title)\";\n" +
- " }\n" +
- " }\n" +
- " catch(err) {\n" +
- " }\n" +
- "//-->\n" +
- "</script>",
- TMPDEST_DIR1 + "/p1/C.html"
- }
-
- };
-
- public static void runTestsOnHTML(String[][] testArray) {
-
- for (int i = 0; i < testArray.length; i++) {
-
- subtestNum += 1;
-
- // Read contents of file into a string
- String fileString = readFileToString(testArray[i][1]);
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-doctitle", "Document Title",
+ "-windowtitle", "Window Title",
+ "-overview", testSrc("overview.html"),
+ "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api", testSrc,
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
+ checkOutput("overview-summary.html", true,
+ "<script type=\"text/javascript\">",
+ "<body>");
- // Get string to find
- String stringToFind = testArray[i][0];
-
- // Find string in file's contents
- if (findString(fileString, stringToFind) == -1) {
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
- + "when searching for:\n"
- + stringToFind);
- } else {
- numSubtestsPassed += 1;
- System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
- }
- }
- }
-
- public static void printSummary() {
- if ( numSubtestsPassed == subtestNum ) {
- System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
- } else {
- throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
- + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
- }
- }
+ // Test that "onload" is not present in BODY tag:
+ checkOutput("p1/package-summary.html", true, "<body>");
+ checkOutput("overview-frame.html", true, "<body>");
+ checkOutput("allclasses-frame.html", true, "<body>");
+ checkOutput("p1/package-frame.html", true, "<body>");
- // Read the file into a String
- public static String readFileToString(String filename) {
- try {
- File file = new File(filename);
- if ( !file.exists() ) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
- BufferedReader in = new BufferedReader(new FileReader(file));
-
- // Create an array of characters the size of the file
- char[] allChars = new char[(int)file.length()];
-
- // Read the characters into the allChars array
- in.read(allChars, 0, (int)file.length());
- in.close();
-
- // Convert to a string
- String allCharsString = new String(allChars);
-
- return allCharsString;
-
- } catch (FileNotFoundException e) {
- System.err.println(e);
- return "";
- } catch (IOException e) {
- System.err.println(e);
- return "";
- }
- }
-
- public static int findString(String fileString, String stringToFind) {
- return fileString.replace(NL, "\n").indexOf(stringToFind);
+ // Test that win title javascript is followed by NOSCRIPT code.
+ checkOutput("p1/C.html", true,
+ "<script type=\"text/javascript\"><!--\n"
+ + " try {\n"
+ + " if (location.href.indexOf('is-external=true') == -1) {\n"
+ + " parent.document.title=\"C (Window Title)\";\n"
+ + " }\n"
+ + " }\n"
+ + " catch(err) {\n"
+ + " }\n"
+ + "//-->\n"
+ + "</script>");
}
}
--- a/langtools/test/com/sun/javadoc/MetaTag/MetaTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/MetaTag/MetaTag.java Fri May 23 09:05:24 2014 -0700
@@ -21,114 +21,94 @@
* questions.
*/
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
/*
* @test
* @bug 4034096 4764726 6235799
* @summary Add support for HTML keywords via META tag for
* class and member names to improve API search
* @author dkramer
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build MetaTag
* @run main MetaTag
*/
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
public class MetaTag extends JavadocTester {
- //Test information.
- private static final SimpleDateFormat m_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR,
- "-sourcepath", SRC_DIR,
- "-keywords",
- "-doctitle", "Sample Packages",
- "p1", "p2"
- };
-
- private static final String[] ARGS_NO_TIMESTAMP_NO_KEYWORDS = new String[] {
- "-d", OUTPUT_DIR + "-2",
- "-sourcepath", SRC_DIR,
- "-notimestamp",
- "-doctitle", "Sample Packages",
- "p1", "p2"
- };
-
- //Input for string search tests.
- private static final String[][] TEST = {
-
- { "p1/C1.html",
- "<meta name=\"keywords\" content=\"p1.C1 class\">" },
-
- { "p1/C1.html",
- "<meta name=\"keywords\" content=\"field1\">" },
-
- { "p1/C1.html",
- "<meta name=\"keywords\" content=\"field2\">" },
-
- { "p1/C1.html",
- "<meta name=\"keywords\" content=\"method1()\">" },
-
- { "p1/C1.html",
- "<meta name=\"keywords\" content=\"method2()\">" },
-
- { "p1/package-summary.html",
- "<meta name=\"keywords\" content=\"p1 package\">" },
-
- { "overview-summary.html",
- "<meta name=\"keywords\" content=\"Overview, Sample Packages\">" },
-
- //NOTE: Hopefully, this regression test is not run at midnight. If the output
- //was generated yesterday and this test is run today, the test will fail.
- { "overview-summary.html",
- "<meta name=\"date\" "
- + "content=\"" + m_dateFormat.format(new Date()) + "\">"},
- };
-
- private static final String[][] NEGATED_TEST2 = {
- //No keywords when -keywords is not used.
- { "p1/C1.html",
- "<META NAME=\"keywords\" CONTENT=\"p1.C1 class\">" },
-
- { "p1/C1.html",
- "<META NAME=\"keywords\" CONTENT=\"field1\">" },
-
- { "p1/C1.html",
- "<META NAME=\"keywords\" CONTENT=\"field2\">" },
-
- { "p1/C1.html",
- "<META NAME=\"keywords\" CONTENT=\"method1()\">" },
-
- { "p1/C1.html",
- "<META NAME=\"keywords\" CONTENT=\"method2()\">" },
-
- { "p1/package-summary.html",
- "<META NAME=\"keywords\" CONTENT=\"p1 package\">" },
-
- { "overview-summary.html",
- "<META NAME=\"keywords\" CONTENT=\"Overview Summary, Sample Packages\">" },
-
- //The date metatag should not show up when -notimestamp is used.
-
- //NOTE: Hopefully, this regression test is not run at midnight. If the output
- //was generated yesterday and this test is run today, the test will fail.
- { "overview-summary.html",
- "<META NAME=\"date\" "
- + "CONTENT=\"" + m_dateFormat.format(new Date()) + "\">"},
- };
-
/**
* The entry point of the test.
- * @param args the array of command line arguments.
+ * @param args the array of command line arguments
+ * @throws Exception if the test fails
*/
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
MetaTag tester = new MetaTag();
- tester.run(ARGS, TEST, NO_TEST);
- tester.run(ARGS_NO_TIMESTAMP_NO_KEYWORDS, NO_TEST, NEGATED_TEST2);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void testStandard() {
+ javadoc("-d", "out-1",
+ "-sourcepath", testSrc,
+ "-keywords",
+ "-doctitle", "Sample Packages",
+ "p1", "p2");
+
+ checkExit(Exit.OK);
+
+ checkOutput("p1/C1.html", true,
+ "<meta name=\"keywords\" content=\"p1.C1 class\">",
+ "<meta name=\"keywords\" content=\"field1\">",
+ "<meta name=\"keywords\" content=\"field2\">",
+ "<meta name=\"keywords\" content=\"method1()\">",
+ "<meta name=\"keywords\" content=\"method2()\">");
+
+ checkOutput("p1/package-summary.html", true,
+ "<meta name=\"keywords\" content=\"p1 package\">");
+
+ checkOutput("overview-summary.html", true,
+ "<meta name=\"keywords\" content=\"Overview, Sample Packages\">");
+
+ // NOTE: Hopefully, this regression test is not run at midnight. If the output
+ // was generated yesterday and this test is run today, the test will fail.
+ checkOutput("overview-summary.html", true,
+ "<meta name=\"date\" content=\"" + date() + "\">");
+ }
+
+ @Test
+ void testNoTimestamp() {
+ javadoc("-d", "out-2",
+ "-sourcepath", testSrc,
+ "-notimestamp",
+ "-doctitle", "Sample Packages",
+ "p1", "p2");
+ checkExit(Exit.OK);
+
+ // No keywords when -keywords is not used.
+ checkOutput("p1/C1.html", false,
+ "<META NAME=\"keywords\" CONTENT=\"p1.C1 class\">",
+ "<META NAME=\"keywords\" CONTENT=\"field1\">",
+ "<META NAME=\"keywords\" CONTENT=\"field2\">",
+ "<META NAME=\"keywords\" CONTENT=\"method1()\">",
+ "<META NAME=\"keywords\" CONTENT=\"method2()\">");
+
+ checkOutput("p1/package-summary.html", false,
+ "<META NAME=\"keywords\" CONTENT=\"p1 package\">");
+
+ checkOutput("overview-summary.html", false,
+ "<META NAME=\"keywords\" CONTENT=\"Overview Summary, Sample Packages\">");
+
+ // The date metatag should not show up when -notimestamp is used.
+ // NOTE: Hopefully, this regression test is not run at midnight. If the output
+ // was generated yesterday and this test is run today, the test will fail.
+ checkOutput("overview-summary.html", false,
+ "<META NAME=\"date\" CONTENT=\"" + date() + "\">");
+ }
+
+ private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+
+ String date() {
+ return dateFormat.format(new Date());
}
}
--- a/langtools/test/com/sun/javadoc/PackagesHeader/PackagesHeader.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/PackagesHeader/PackagesHeader.java Fri May 23 09:05:24 2014 -0700
@@ -28,83 +28,62 @@
* is present for three sets of options: (1) -header,
* (2) -packagesheader, and (3) -header -packagesheader
* @author dkramer
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build PackagesHeader
* @run main PackagesHeader
*/
public class PackagesHeader extends JavadocTester {
- //Test information.
- private static final String OUTPUT_DIR1 = OUTPUT_DIR + "-1/";
- private static final String OUTPUT_DIR2 = OUTPUT_DIR + "-2/";
- private static final String OUTPUT_DIR3 = OUTPUT_DIR + "-3/";
+ public static void main(String... args) throws Exception {
+ JavadocTester tester = new PackagesHeader();
+ tester.runTests();
+ }
- /**
- * Assign value for [ fileToSearch, stringToFind ]
- */
- private static final String[][] TESTARRAY1 = {
+ @Test
+ void testHeader() {
+ // First test with -header only
+ javadoc("-d", "out-header",
+ "-header", "Main Frame Header",
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
// Test that the -header shows up in the packages frame
- { "overview-frame.html",
- "Main Frame Header" }
- };
+ checkOutput("overview-frame.html", true,
+ "Main Frame Header");
+ }
- private static final String[][] TESTARRAY2 = {
+ @Test
+ void testPackagesHeader() {
+ // Second test with -packagesheader only
+ javadoc("-d", "out-packages-header",
+ "-packagesheader", "Packages Frame Header",
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
// Test that the -packagesheader string shows
// up in the packages frame
+ checkOutput("overview-frame.html", true,
+ "Packages Frame Header");
+ }
- { "overview-frame.html",
- "Packages Frame Header" }
- };
-
- private static final String[][] TESTARRAY3 = {
+ @Test
+ void testBothHeaders() {
+ // Third test with both -packagesheader and -header
+ javadoc("-d", "out-both",
+ "-packagesheader", "Packages Frame Header",
+ "-header", "Main Frame Header",
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
// Test that the both headers show up and are different
-
- { "overview-frame.html",
- "Packages Frame Header" },
-
- { "overview-summary.html",
- "Main Frame Header" }
- };
-
- // First test with -header only
- private static final String[] JAVADOC_ARGS1 = new String[] {
- "-d", OUTPUT_DIR1,
- "-header", "Main Frame Header",
- "-sourcepath", SRC_DIR,
- "p1", "p2"};
-
- // Second test with -packagesheader only
- private static final String[] JAVADOC_ARGS2 = new String[] {
- "-d", OUTPUT_DIR2,
- "-packagesheader", "Packages Frame Header",
- "-sourcepath", SRC_DIR,
- "p1", "p2"};
+ checkOutput("overview-frame.html", true,
+ "Packages Frame Header");
- // Third test with both -packagesheader and -header
- private static final String[] JAVADOC_ARGS3 = new String[] {
- "-d", OUTPUT_DIR3,
- "-packagesheader", "Packages Frame Header",
- "-header", "Main Frame Header",
- "-sourcepath", SRC_DIR,
- "p1", "p2"};
-
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- JavadocTester tester = new PackagesHeader();
-
- tester.run(JAVADOC_ARGS1, TESTARRAY1, NO_TEST);
- tester.run(JAVADOC_ARGS2, TESTARRAY2, NO_TEST);
- tester.run(JAVADOC_ARGS3, TESTARRAY3, NO_TEST);
-
- tester.printSummary();
+ checkOutput("overview-summary.html", true,
+ "Main Frame Header");
}
}
--- a/langtools/test/com/sun/javadoc/T6735320/T6735320.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/T6735320/T6735320.java Fri May 23 09:05:24 2014 -0700
@@ -25,24 +25,24 @@
* @test
* @bug 6735320
* @summary javadoc throws exception if serialField value is missing
- * @library ../lib/
- * @build JavadocTester T6735320
+ * @library ../lib
+ * @build JavadocTester
* @run main T6735320
*/
+
public class T6735320 extends JavadocTester {
- private static final String[] ARGS = new String[]{
- "-d", OUTPUT_DIR + ".out",
- SRC_DIR + "/SerialFieldTest.java"
- };
-
- public static void main(String... args) {
+ public static void main(String... args) throws Exception {
T6735320 tester = new T6735320();
- if (tester.runJavadoc(ARGS) == 0) {
- throw new AssertionError("zero return code from javadoc");
- }
- if (tester.getErrorOutput().contains("StringIndexOutOfBoundsException")) {
- throw new AssertionError("javadoc threw StringIndexOutOfBoundsException");
- }
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ testSrc("SerialFieldTest.java"));
+ checkExit(Exit.FAILED);
+ checkOutput(Output.STDERR, false,
+ "StringIndexOutOfBoundsException");
}
}
--- a/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java Fri May 23 09:05:24 2014 -0700
@@ -30,174 +30,52 @@
* <NOFRAMES> not allowed outside <FRAMESET> element
* HTML table tags inserted in wrong place in pakcage use page
* @author dkramer
+ * @library ../lib
+ * @build JavadocTester
* @run main ValidHtml
*/
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-
-/**
- * Runs javadoc and runs regression tests on the resulting HTML.
- * It reads each file, complete with newlines, into a string to easily
- * find strings that contain newlines.
- */
-public class ValidHtml {
-
- protected static final String NL = System.getProperty("line.separator");
+public class ValidHtml extends JavadocTester {
- private static final String BUGID = "4275630";
- private static final String BUGNAME = "ValidHtml";
- private static final String TMPDEST_DIR1 = "./docs1/";
- private static final String TMPDEST_DIR2 = "./docs2/";
+ public static void main(String... args) throws Exception {
+ ValidHtml tester = new ValidHtml();
+ tester.runTests();
+ }
- // Subtest number. Needed because runResultsOnHTML is run twice,
- // and subtestNum should increment across subtest runs.
- public static int subtestNum = 0;
- public static int numSubtestsPassed = 0;
-
- // Entry point
- public static void main(String[] args) {
-
- // Directory that contains source files that javadoc runs on
- String srcdir = System.getProperty("test.src", ".");
-
+ @Test
+ void test() {
// Test for all cases except the split index page
- runJavadoc(new String[]{"-d", TMPDEST_DIR1,
+ javadoc("-d", "out",
"-doctitle", "Document Title",
"-windowtitle", "Window Title",
"-use",
- "-overview", (srcdir + "/overview.html"),
- "-sourcepath", srcdir,
- "p1", "p2"
- });
- runTestsOnHTML(testArray);
+ "-overview", testSrc("overview.html"),
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
- printSummary();
- }
+ // Test the proper DOCTYPE element are present:
+ checkOutput("index.html", true, FRAMESET);
+ checkOutput("overview-summary.html", true, LOOSE);
+ checkOutput("p1/package-summary.html", true, LOOSE);
+ checkOutput("p1/C.html", true, LOOSE);
+ checkOutput("overview-frame.html", true, LOOSE);
+ checkOutput("allclasses-frame.html", true, LOOSE);
+ checkOutput("p1/package-frame.html", true, LOOSE);
- /** Run javadoc */
- public static void runJavadoc(String[] javadocArgs) {
- if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
- throw new Error("Javadoc failed to execute");
- }
+ // Test that <NOFRAMES> is inside <FRAMESET> element:
+ checkOutput("index.html", true,
+ "</noframes>\n"
+ + "</frameset>");
+
+ // Test the table elements are in the correct order:
+ checkOutput("p1/package-use.html", true,
+ "</td>\n"
+ + "</tr>");
}
- /**
- * Assign value for [ stringToFind, filename ]
- * NOTE: The standard doclet uses the same separator "\n" for all OS's
- */
- private static final String[][] testArray = {
- // Test the proper DOCTYPE element is present:
- {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">",
- TMPDEST_DIR1 + "index.html"
- },
- // Test the proper DOCTYPE element is present:
- {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
- TMPDEST_DIR1 + "overview-summary.html"
- },
- // Test the proper DOCTYPE element is present:
- {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
- TMPDEST_DIR1 + "p1/package-summary.html"
- },
- // Test the proper DOCTYPE element is present:
- {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
- TMPDEST_DIR1 + "p1/C.html"
- },
- // Test the proper DOCTYPE element is present:
- {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
- TMPDEST_DIR1 + "overview-frame.html"
- },
- // Test the proper DOCTYPE element is present:
- {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
- TMPDEST_DIR1 + "allclasses-frame.html"
- },
- // Test the proper DOCTYPE element is present:
- {
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
- TMPDEST_DIR1 + "p1/package-frame.html"
- },
- // Test that <NOFRAMES> is inside <FRAMESET> element:
- {
- "</noframes>\n" +
- "</frameset>",
- TMPDEST_DIR1 + "index.html"
- },
- // Test the table elements are in the correct order:
- {
- "</td>\n" +
- "</tr>",
- TMPDEST_DIR1 + "/p1/package-use.html"
- }
- };
-
- public static void runTestsOnHTML(String[][] testArray) {
-
- for (int i = 0; i < testArray.length; i++) {
-
- subtestNum += 1;
-
- // Read contents of file into a string
- String fileString = readFileToString(testArray[i][1]);
-
- // Get string to find
- String stringToFind = testArray[i][0];
-
- // Find string in file's contents
- if (findString(fileString, stringToFind) == -1) {
- System.out.println("\nSub-test " + (subtestNum) + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n" + "when searching for:\n" + stringToFind);
- } else {
- numSubtestsPassed += 1;
- System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
- }
- }
- }
-
- public static void printSummary() {
- if (numSubtestsPassed == subtestNum) {
- System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
- } else {
- throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum) + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
- }
- }
-
- // Read the file into a String
- public static String readFileToString(String filename) {
- try {
- File file = new File(filename);
- if (!file.exists()) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
- BufferedReader in = new BufferedReader(new FileReader(file));
-
- // Create an array of characters the size of the file
- char[] allChars = new char[(int) file.length()];
-
- // Read the characters into the allChars array
- in.read(allChars, 0, (int) file.length());
- in.close();
-
- // Convert to a string
- String allCharsString = new String(allChars);
-
- return allCharsString;
-
- } catch (FileNotFoundException e) {
- System.err.println(e);
- return "";
- } catch (IOException e) {
- System.err.println(e);
- return "";
- }
- }
-
- public static int findString(String fileString, String stringToFind) {
- return fileString.replace(NL, "\n").indexOf(stringToFind);
- }
+ private static final String FRAMESET =
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
+ private static final String LOOSE =
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
}
--- a/langtools/test/com/sun/javadoc/VersionNumber/VersionNumber.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/VersionNumber/VersionNumber.java Fri May 23 09:05:24 2014 -0700
@@ -26,131 +26,31 @@
* @bug 4720849
* @summary com.sun.tools.doclets.standard.Standard contains hard-coded version number
* @author dkramer
+ * @library ../lib
+ * @build JavadocTester
* @run main VersionNumber
*/
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-
-
/**
* Runs javadoc and runs regression tests on the resulting HTML.
- * It reads each file, complete with newlines, into a string to easily
- * find strings that contain newlines.
*/
-public class VersionNumber {
-
- private static final String BUGID = "4720849";
- private static final String BUGNAME = "VersionNumber";
- private static final String TMPDEST_DIR1 = "./docs1/";
- private static final String TMPDEST_DIR2 = "./docs2/";
-
- // Subtest number. Needed because runResultsOnHTML is run twice,
- // and subtestNum should increment across subtest runs.
- public static int subtestNum = 0;
- public static int numSubtestsPassed = 0;
+public class VersionNumber extends JavadocTester {
- // Entry point
- public static void main(String[] args) {
-
- // Directory that contains source files that javadoc runs on
- String srcdir = System.getProperty("test.src", ".");
-
- // Test for all cases except the split index page
- runJavadoc(new String[] {"-d", TMPDEST_DIR1,
- "p1"});
- runTestsOnHTML(testArray);
-
- printSummary();
- }
-
- /** Run javadoc */
- public static void runJavadoc(String[] javadocArgs) {
- if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
- throw new Error("Javadoc failed to execute");
- }
+ public static void main(String... args) throws Exception {
+ VersionNumber tester = new VersionNumber();
+ tester.runTests();
}
- /**
- * Assign value for [ stringToFind, filename ]
- * NOTE: The standard doclet uses the same separator "\n" for all OS's
- */
- private static final String[][] testArray = {
-
- // Test the proper DOCTYPE element is present:
- {
- "<!-- Generated by javadoc (",
- TMPDEST_DIR1 + "p1/C.html" },
-
- };
-
- public static void runTestsOnHTML(String[][] testArray) {
-
- for (int i = 0; i < testArray.length; i++) {
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "p1");
+ checkExit(Exit.OK);
- subtestNum += 1;
-
- // Read contents of file into a string
- String fileString = readFileToString(testArray[i][1]);
-
- // Get string to find
- String stringToFind = testArray[i][0];
-
- // Find string in file's contents
- if (findString(fileString, stringToFind) == -1) {
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
- + "when searching for:\n"
- + stringToFind);
- } else {
- numSubtestsPassed += 1;
- System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
- }
- }
+ // Test the proper DOCTYPE element is present:
+ checkOutput("p1/C.html", true,
+ "<!-- Generated by javadoc (");
}
- public static void printSummary() {
- if ( numSubtestsPassed == subtestNum ) {
- System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
- } else {
- throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
- + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
- }
- }
-
- // Read the file into a String
- public static String readFileToString(String filename) {
- try {
- File file = new File(filename);
- if ( !file.exists() ) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
- BufferedReader in = new BufferedReader(new FileReader(file));
-
- // Create an array of characters the size of the file
- char[] allChars = new char[(int)file.length()];
-
- // Read the characters into the allChars array
- in.read(allChars, 0, (int)file.length());
- in.close();
-
- // Convert to a string
- String allCharsString = new String(allChars);
-
- return allCharsString;
-
- } catch (FileNotFoundException e) {
- System.err.println(e);
- return "";
- } catch (IOException e) {
- System.err.println(e);
- return "";
- }
- }
-
- public static int findString(String fileString, String stringToFind) {
- return fileString.indexOf(stringToFind);
- }
}
--- a/langtools/test/com/sun/javadoc/WindowTitles/WindowTitles.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/WindowTitles/WindowTitles.java Fri May 23 09:05:24 2014 -0700
@@ -26,193 +26,62 @@
* @bug 4530730
* @summary stddoclet: With frames off, window titles have "()" appended
* @author dkramer
+ * @library ../lib
+ * @build JavadocTester
* @run main WindowTitles
*/
-
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-
-// If needing regular expression pattern matching,
-// see /java/pubs/dev/linkfix/src/LinkFix.java
-
/**
* Runs javadoc and runs regression tests on the resulting HTML.
- * It reads each file, complete with newlines, into a string to easily
- * find strings that contain newlines.
*/
-public class WindowTitles
-{
- private static final String BUGID = "4530730";
- private static final String BUGNAME = "WindowTitles";
- private static final String TMPDIR_STRING1 = "./docs1/";
- private static final String TMPDIR_STRING2 = "./docs2/";
-
- // Subtest number. Needed because runResultsOnHTML is run twice, and subtestNum
- // should increment across subtest runs.
- public static int subtestNum = 0;
- public static int numSubtestsPassed = 0;
-
- // Entry point
- public static void main(String[] args) {
-
- // Directory that contains source files that javadoc runs on
- String srcdir = System.getProperty("test.src", ".");
+public class WindowTitles extends JavadocTester {
- // Test for all cases except the split index page
- runJavadoc(new String[] {"-d", TMPDIR_STRING1,
- "-use",
- "-sourcepath", srcdir,
- "p1", "p2"});
- runTestsOnHTML(testArray);
-
- // Test only for the split-index case (and run on only one package)
- System.out.println(""); // blank line
- runJavadoc(new String[] {"-d", TMPDIR_STRING2,
- "-splitindex",
- "-sourcepath", System.getProperty("test.src", "."),
- "p1"});
- runTestsOnHTML(testSplitIndexArray);
-
- printSummary();
- }
-
- /** Run javadoc */
- public static void runJavadoc(String[] javadocArgs) {
- if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
- throw new Error("Javadoc failed to execute");
- }
+ public static void main(String... args) throws Exception {
+ WindowTitles tester = new WindowTitles();
+ tester.runTests();
}
- /**
- * Assign value for [ stringToFind, filename ]
- * NOTE: The standard doclet uses platform-specific line separators ("\n")
- */
- private static final String[][] testArray = {
-
- { "<title>Overview</title>",
- TMPDIR_STRING1 + "overview-summary.html" },
-
- { "<title>Class Hierarchy</title>",
- TMPDIR_STRING1 + "overview-tree.html" },
-
- { "<title>Overview List</title>",
- TMPDIR_STRING1 + "overview-frame.html" },
-
- { "<title>p1</title>",
- TMPDIR_STRING1 + "p1/package-summary.html" },
-
- { "<title>p1</title>",
- TMPDIR_STRING1 + "p1/package-frame.html" },
-
- { "<title>p1 Class Hierarchy</title>",
- TMPDIR_STRING1 + "p1/package-tree.html" },
-
- { "<title>Uses of Package p1</title>",
- TMPDIR_STRING1 + "p1/package-use.html" },
-
- { "<title>C1</title>",
- TMPDIR_STRING1 + "p1/C1.html" },
-
- { "<title>All Classes</title>",
- TMPDIR_STRING1 + "allclasses-frame.html" },
-
- { "<title>All Classes</title>",
- TMPDIR_STRING1 + "allclasses-noframe.html" },
-
- { "<title>Constant Field Values</title>",
- TMPDIR_STRING1 + "constant-values.html" },
-
- { "<title>Deprecated List</title>",
- TMPDIR_STRING1 + "deprecated-list.html" },
+ @Test
+ void test() {
+ // Test for all cases except the split index page
+ javadoc("-d", "out-1",
+ "-use",
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
- { "<title>Serialized Form</title>",
- TMPDIR_STRING1 + "serialized-form.html" },
-
- { "<title>API Help</title>",
- TMPDIR_STRING1 + "help-doc.html" },
-
- { "<title>Index</title>",
- TMPDIR_STRING1 + "index-all.html" },
-
- { "<title>Uses of Class p1.C1</title>",
- TMPDIR_STRING1 + "p1/class-use/C1.html" },
- };
-
- /**
- * Assign value for [ stringToFind, filename ] for split index page
- */
- private static final String[][] testSplitIndexArray = {
- { "<title>C-Index</title>",
- TMPDIR_STRING2 + "index-files/index-1.html" },
- };
-
- public static void runTestsOnHTML(String[][] testArray) {
-
- for (int i = 0; i < testArray.length; i++) {
-
- subtestNum += 1;
-
- // Read contents of file into a string
- String fileString = readFileToString(testArray[i][1]);
-
- // Get string to find
- String stringToFind = testArray[i][0];
-
- // Find string in file's contents
- if (findString(fileString, stringToFind) == -1) {
- System.out.println("\nSub-test " + (subtestNum)
- + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
- + "when searching for:\n"
- + stringToFind);
- } else {
- numSubtestsPassed += 1;
- System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
- }
- }
+ checkTitle("overview-summary.html", "Overview");
+ checkTitle("overview-tree.html", "Class Hierarchy");
+ checkTitle("overview-frame.html", "Overview List");
+ checkTitle("p1/package-summary.html", "p1");
+ checkTitle("p1/package-frame.html", "p1");
+ checkTitle("p1/package-tree.html", "p1 Class Hierarchy");
+ checkTitle("p1/package-use.html", "Uses of Package p1");
+ checkTitle("p1/C1.html", "C1");
+ checkTitle("allclasses-frame.html", "All Classes");
+ checkTitle("allclasses-noframe.html", "All Classes");
+ checkTitle("constant-values.html", "Constant Field Values");
+ checkTitle("deprecated-list.html", "Deprecated List");
+ checkTitle("serialized-form.html", "Serialized Form");
+ checkTitle("help-doc.html", "API Help");
+ checkTitle("index-all.html", "Index");
+ checkTitle("p1/class-use/C1.html", "Uses of Class p1.C1");
}
- public static void printSummary() {
- if ( numSubtestsPassed == subtestNum ) {
- System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
- } else {
- throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
- + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
- }
+ @Test
+ void test2() {
+ // Test only for the split-index case (and run on only one package)
+ javadoc("-d", "out-2",
+ "-splitindex",
+ "-sourcepath", testSrc,
+ "p1");
+ checkExit(Exit.OK);
+
+ checkTitle("index-files/index-1.html", "C-Index");
}
- // Read the file into a String
- public static String readFileToString(String filename) {
- try {
- File file = new File(filename);
- if ( !file.exists() ) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
- BufferedReader in = new BufferedReader(new FileReader(file));
-
- // Create an array of characters the size of the file
- char[] allChars = new char[(int)file.length()];
-
- // Read the characters into the allChars array
- in.read(allChars, 0, (int)file.length());
- in.close();
-
- // Convert to a string
- String allCharsString = new String(allChars);
-
- return allCharsString;
-
- } catch (FileNotFoundException e) {
- System.err.println(e);
- return "";
- } catch (IOException e) {
- System.err.println(e);
- return "";
- }
+ void checkTitle(String file, String title) {
+ checkOutput(file, true, "<title>" + title + "</title>");
}
- public static int findString(String fileString, String stringToFind) {
- return fileString.indexOf(stringToFind);
- }
}
--- a/langtools/test/com/sun/javadoc/constantValues/TestConstantValuesDriver.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/constantValues/TestConstantValuesDriver.java Fri May 23 09:05:24 2014 -0700
@@ -26,42 +26,30 @@
* @bug 4504730 4526070 5077317
* @summary Test the generation of constant-values.html.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestConstantValuesDriver
* @run main TestConstantValuesDriver
*/
public class TestConstantValuesDriver extends JavadocTester {
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, SRC_DIR + "/TestConstantValues.java",
- SRC_DIR + "/TestConstantValues2.java",
- SRC_DIR + "/A.java"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- String[][] tests = new String[5][2];
- for (int i = 0; i < tests.length-1; i++) {
- tests[i][0] = "constant-values.html";
- tests[i][1] = "TEST"+(i+1)+"PASSES";
- }
- tests[tests.length-1][0] = "constant-values.html";
- tests[tests.length-1][1] = "<code>\"<Hello World>\"</code>";
+ public static void main(String... args) throws Exception {
TestConstantValuesDriver tester = new TestConstantValuesDriver();
- tester.run(ARGS, tests, NO_TEST);
- tester.printSummary();
+ tester.runTests();
}
- /**
- * @throws java.io.IOException Test 1 passes
- * @throws java.io.IOException Test 2 passes
- * @throws java.lang.NullPointerException comment three
- * @throws java.io.IOException Test 3 passes
- */
- public void method(){}
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ testSrc("TestConstantValues.java"),
+ testSrc("TestConstantValues2.java"),
+ testSrc("A.java"));
+ checkExit(Exit.OK);
+ checkOutput("constant-values.html", true,
+ "TEST1PASSES",
+ "TEST2PASSES",
+ "TEST3PASSES",
+ "TEST4PASSES",
+ "<code>\"<Hello World>\"</code>");
+ }
}
--- a/langtools/test/com/sun/javadoc/dupThrowsTags/TestDupThrowsTags.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/dupThrowsTags/TestDupThrowsTags.java Fri May 23 09:05:24 2014 -0700
@@ -26,30 +26,28 @@
* @bug 4525364
* @summary Determine if duplicate throws tags can be used.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestDupThrowsTags
* @run main TestDupThrowsTags
*/
public class TestDupThrowsTags extends JavadocTester {
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, SRC_DIR + "/TestDupThrowsTags.java"
- };
+ public static void main(String... args) throws Exception {
+ TestDupThrowsTags tester = new TestDupThrowsTags();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- String[][] tests = new String[4][2];
- for (int i = 0; i < tests.length; i++) {
- tests[i][0] = "TestDupThrowsTags.html";
- tests[i][1] = "Test "+(i+1)+" passes";
- }
- TestDupThrowsTags tester = new TestDupThrowsTags();
- tester.run(ARGS, tests, NO_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ testSrc("TestDupThrowsTags.java"));
+ checkExit(Exit.FAILED);
+
+ checkOutput("TestDupThrowsTags.html", true,
+ "Test 1 passes",
+ "Test 2 passes",
+ "Test 3 passes",
+ "Test 4 passes");
}
/**
@@ -58,6 +56,6 @@
* @throws java.lang.NullPointerException Test 3 passes
* @throws java.io.IOException Test 4 passes
*/
- public void method(){}
+ public void method() {}
}
--- a/langtools/test/com/sun/javadoc/lib/JavadocTester.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/lib/JavadocTester.java Fri May 23 09:05:24 2014 -0700
@@ -21,102 +21,163 @@
* questions.
*/
-import java.io.*;
+import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.ref.SoftReference;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
- * Runs javadoc and then runs regression tests on the resulting output.
- * This class currently contains three tests:
- * <ul>
- * <li> String search: Reads each file, complete with newlines,
- * into a string. Lets you search for strings that contain
- * newlines. String matching is case-sensitive.
- * You can run javadoc multiple times with different arguments,
- * generating output into different destination directories, and
- * then perform a different array of tests on each one.
- * To do this, the run method accepts a test array for testing
- * that a string is found, and a negated test array for testing
- * that a string is not found.
- * <li> Run diffs: Iterate through the list of given file pairs
- * and diff the pairs.
- * <li> Check exit code: Check the exit code of Javadoc and
- * record whether the test passed or failed.
- * </ul>
+ * Test framework for running javadoc and performing tests on the resulting output.
+ *
+ * <p>
+ * Tests are typically written as subtypes of JavadocTester, with a main
+ * method that creates an instance of the test class and calls the runTests()
+ * method. The runTests() methods calls all the test methods declared in the class,
+ * and then calls a method to print a summary, and throw an exception if
+ * any of the test methods reported a failure.
+ *
+ * <p>
+ * Test methods are identified with a @Test annotation. They have no parameters.
+ * The name of the method is not important, but if you have more than one, it is
+ * recommended that the names be meaningful and suggestive of the test case
+ * contained therein.
+ *
+ * <p>
+ * Typically, a test method will invoke javadoc, and then perform various
+ * checks on the results. The standard checks are:
+ *
+ * <dl>
+ * <dt>checkExitCode
+ * <dd>Check the exit code returned from javadoc.
+ * <dt>checkOutput
+ * <dd>Perform a series of checks on the contents on a file or output stream
+ * generated by javadoc.
+ * The checks can be either that a series of strings are found or are not found.
+ * <dt>checkFiles
+ * <dd>Perform a series of checks on the files generated by javadoc.
+ * The checks can be that a series of files are found or are not found.
+ * </dl>
+ *
+ * <pre><code>
+ * public class MyTester extends JavadocTester {
+ * public static void main(String... args) throws Exception {
+ * MyTester tester = new MyTester();
+ * tester.runTests();
+ * }
+ *
+ * // test methods...
+ * @Test
+ * void test() {
+ * javadoc(<i>args</i>);
+ * checkExit(Exit.OK);
+ * checkOutput(<i>file</i>, true,
+ * <i>strings-to-find</i>);
+ * checkOutput(<i>file</i>, false,
+ * <i>strings-to-not-find</i>);
+ * }
+ * }
+ * </code></pre>
+ *
+ * <p>
+ * If javadoc is run more than once in a test method, you can compare the
+ * results that are generated with the diff method. Since files written by
+ * javadoc typically contain a timestamp, you may want to use the -notimestamp
+ * option if you are going to compare the results from two runs of javadoc.
+ *
+ * <p>
+ * If you have many calls of checkOutput that are very similar, you can write
+ * your own check... method to reduce the amount of duplication. For example,
+ * if you want to check that many files contain the same string, you could
+ * write a method that takes a varargs list of files and calls checkOutput
+ * on each file in turn with the string to be checked.
+ *
+ * <p>
+ * You can also write you own custom check methods, which can use
+ * readFile to get the contents of a file generated by javadoc,
+ * and then use pass(...) or fail(...) to report whether the check
+ * succeeded or not.
+ *
+ * <p>
+ * You can have many separate test methods, each identified with a @Test
+ * annotation. However, you should <b>not</b> assume they will be called
+ * in the order declared in your source file. If the order of a series
+ * of javadoc invocations is important, do that within a single method.
+ * If the invocations are independent, for better clarity, use separate
+ * test methods, each with their own set of checks on the results.
*
* @author Doug Kramer
* @author Jamie Ho
- * @since 1.4.2
+ * @author Jonathan Gibbons (rewrite)
*/
public abstract class JavadocTester {
- protected static final String NL = System.getProperty("line.separator");
- protected static final String FS = System.getProperty("file.separator");
+ public static final String FS = System.getProperty("file.separator");
+ public static final String PS = System.getProperty("path.separator");
+ public static final String NL = System.getProperty("line.separator");
- protected static final String SRC_DIR = System.getProperty("test.src", ".");
- protected static final String JAVA_VERSION = System.getProperty("java.version");
- protected static final String OUTPUT_DIR = "out";
- protected static final String[][] NO_TEST = new String[][] {};
- protected static final String[] NO_FILE_TEST = new String[] {};
+ public enum Output {
+ /** The name for error output from javadoc. */
+ ERROR,
+ /** The name for the notice output from javadoc. */
+ NOTICE,
+ /** The name for the warning output from javadoc. */
+ WARNING,
+ /** The name for any output written to System.out. */
+ STDOUT,
+ /** The name for any output written to System.err. */
+ STDERR
+ }
- /**
- * Use this as the file name in the test array when you want to search
- * for a string in the error output.
- */
- public static final String ERROR_OUTPUT = "ERROR_OUTPUT";
+ /** The output directory used in the most recent call of javadoc. */
+ protected File outputDir;
+
+ /** The exit code of the most recent call of javadoc. */
+ private int exitCode;
+
+ /** The output generated by javadoc to the various writers and streams. */
+ private final Map<Output, String> outputMap = new EnumMap<>(Output.class);
- /**
- * Use this as the file name in the test array when you want to search
- * for a string in the notice output.
- */
- public static final String NOTICE_OUTPUT = "NOTICE_OUTPUT";
+ /** A cache of file content, to avoid reading files unnecessarily. */
+ private final Map<File,SoftReference<String>> fileContentCache = new HashMap<>();
- /**
- * Use this as the file name in the test array when you want to search
- * for a string in the warning output.
- */
- public static final String WARNING_OUTPUT = "WARNING_OUTPUT";
+ /** Stream used for logging messages. */
+ private final PrintStream out = System.out;
+
+ /** The directory containing the source code for the test. */
+ public static final String testSrc = System.getProperty("test.src");
/**
- * Use this as the file name in the test array when you want to search
- * for a string in standard output.
- */
- public static final String STANDARD_OUTPUT = "STANDARD_OUTPUT";
-
- /**
- * The default doclet.
- */
- public static final String DEFAULT_DOCLET_CLASS = "com.sun.tools.doclets.formats.html.HtmlDoclet";
- public static final String DEFAULT_DOCLET_CLASS_OLD = "com.sun.tools.doclets.standard.Standard";
-
- /**
- * The writer to write error messages.
+ * Get the path for a source file in the test source directory.
+ * @param path the path of a file or directory in the source directory
+ * @return the full path of the specified file
*/
- public StringWriter errors;
-
- /**
- * The writer to write notices.
- */
- public StringWriter notices;
-
- /**
- * The writer to write warnings.
- */
- public StringWriter warnings;
-
- /**
- * The buffer of warning output.
- */
- public StringBuffer standardOut;
-
- /**
- * The output directory.
- */
- private File outputDir;
+ public static String testSrc(String path) {
+ return new File(testSrc, path).getPath();
+ }
/**
* Alternatives for checking the contents of a directory.
*/
- enum DirectoryCheck {
+ public enum DirectoryCheck {
/**
* Check that the directory is empty.
*/
@@ -153,91 +214,75 @@
private DirectoryCheck outputDirectoryCheck = DirectoryCheck.EMPTY;
- /**
- * The current subtest number.
- */
- private static int numTestsRun = 0;
+ /** The current subtest number. Incremented when checking(...) is called. */
+ private int numTestsRun = 0;
+
+ /** The number of subtests passed. Incremented when passed(...) is called. */
+ private int numTestsPassed = 0;
+
+ /** The current run of javadoc. Incremented when javadoc is called. */
+ private int javadocRunNum = 0;
- /**
- * The number of subtests passed.
- */
- private static int numTestsPassed = 0;
+ /** The name of the standard doclet. */
+ // This ought not to be necessary; there ought to be a javadoc entry point
+ // that does not require this to be know externally.
+ private static final String standardDocletClassName =
+ "com.sun.tools.doclets.standard.Standard";
- /**
- * The current run of javadoc
- */
- private static int javadocRunNum = 0;
+ /** Marker annotation for test methods to be invoked by runTests. */
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface Test { }
/**
- * Construct a JavadocTester.
+ * Run all methods annotated with @Test, followed by printSummary.
+ * Typically called on a tester object in main()
+ * @throws Exception if any errors occurred
*/
- public JavadocTester() {
- }
-
- /**
- * Execute the tests.
- *
- * @param args the arguments to pass to Javadoc
- * @param testArray the array of tests
- * @param negatedTestArray the array of negated tests
- * @return the return code for the execution of Javadoc
- */
- public int run(String[] args,
- String[][] testArray, String[][] negatedTestArray) {
- int returnCode = runJavadoc(args);
- runTestsOnHTML(testArray, negatedTestArray);
- return returnCode;
+ public void runTests() throws Exception {
+ for (Method m: getClass().getDeclaredMethods()) {
+ Annotation a = m.getAnnotation(Test.class);
+ if (a != null) {
+ try {
+ out.println("Running test " + m.getName());
+ m.invoke(this, new Object[] { });
+ } catch (InvocationTargetException e) {
+ Throwable cause = e.getCause();
+ throw (cause instanceof Exception) ? ((Exception) cause) : e;
+ }
+ out.println();
+ }
+ }
+ printSummary();
}
/**
- * Execute the tests.
+ * Run javadoc.
+ * The output directory used by this call and the final exit code
+ * will be saved for later use.
+ * To aid the reader, it is recommended that calls to this method
+ * put each option and the arguments it takes on a separate line.
*
- * @param args the arguments to pass to Javadoc
- * @param testArray the array of tests
- * @param negatedTestArray the array of negated tests
- * @param fileTestArray the array of file tests
- * @param negatedFileTestArray the array of negated file tests
- * @return the return code for the execution of Javadoc
+ * Example:
+ * <pre><code>
+ * javadoc("-d", "out",
+ * "-sourcepath", testSrc,
+ * "-notimestamp",
+ * "pkg1", "pkg2", "pkg3/C.java");
+ * </code></pre>
+ *
+ * @param args the arguments to pass to javadoc
*/
- public int run(String[] args,
- String[][] testArray, String[][] negatedTestArray,
- String[] fileTestArray, String[] negatedFileTestArray) {
- int returnCode = runJavadoc(args);
- runTestsOnHTML(testArray, negatedTestArray);
- runTestsOnFile(fileTestArray, negatedFileTestArray);
- return returnCode;
- }
+ public void javadoc(String... args) {
+ outputMap.clear();
+ fileContentCache.clear();
- /**
- * Execute Javadoc using the default doclet.
- *
- * @param args the arguments to pass to Javadoc
- * @return the return code from the execution of Javadoc
- */
- public int runJavadoc(String[] args) {
- float javaVersion = Float.parseFloat(JAVA_VERSION.substring(0,3));
- String docletClass = javaVersion < 1.5 ?
- DEFAULT_DOCLET_CLASS_OLD : DEFAULT_DOCLET_CLASS;
- return runJavadoc(docletClass, args);
- }
-
-
- /**
- * Execute Javadoc.
- *
- * @param docletClass the doclet being tested.
- * @param args the arguments to pass to Javadoc
- * @return the return code from the execution of Javadoc
- */
- public int runJavadoc(String docletClass, String[] args) {
javadocRunNum++;
if (javadocRunNum == 1) {
- System.out.println("\n" + "Running javadoc...");
+ out.println("Running javadoc...");
} else {
- System.out.println("\n" + "Running javadoc (run "
+ out.println("Running javadoc (run "
+ javadocRunNum + ")...");
}
- initOutputBuffers();
outputDir = new File(".");
for (int i = 0; i < args.length - 2; i++) {
if (args[i].equals("-d")) {
@@ -245,363 +290,199 @@
break;
}
}
+// log.setOutDir(outputDir);
outputDirectoryCheck.check(outputDir);
- ByteArrayOutputStream stdout = new ByteArrayOutputStream();
- PrintStream prevOut = System.out;
- System.setOut(new PrintStream(stdout));
-
- ByteArrayOutputStream stderr = new ByteArrayOutputStream();
- PrintStream prevErr = System.err;
- System.setErr(new PrintStream(stderr));
-
- int returnCode = com.sun.tools.javadoc.Main.execute(
- "javadoc",
- new PrintWriter(errors, true),
- new PrintWriter(warnings, true),
- new PrintWriter(notices, true),
- docletClass,
- getClass().getClassLoader(),
- args);
- System.setOut(prevOut);
- standardOut = new StringBuffer(stdout.toString());
- System.setErr(prevErr);
- errors.write(NL + stderr.toString());
+ // These are the primary streams used by javadoc
+ WriterOutput errOut = new WriterOutput();
+ WriterOutput warnOut = new WriterOutput();
+ WriterOutput noticeOut = new WriterOutput();
+ // These are to catch output to System.out and System.err,
+ // in case these are used instead of the primary streams
+ StreamOutput sysOut = new StreamOutput(System.out, System::setOut);
+ StreamOutput sysErr = new StreamOutput(System.err, System::setErr);
- printJavadocOutput();
- return returnCode;
- }
+ try {
+ exitCode = com.sun.tools.javadoc.Main.execute(
+ "javadoc",
+ errOut.pw, warnOut.pw, noticeOut.pw,
+ standardDocletClassName,
+ args);
+ } finally {
+ outputMap.put(Output.STDOUT, sysOut.close());
+ outputMap.put(Output.STDERR, sysErr.close());
+ outputMap.put(Output.ERROR, errOut.close());
+ outputMap.put(Output.WARNING, warnOut.close());
+ outputMap.put(Output.NOTICE, noticeOut.close());
+ }
- /**
- * Set a filter to check the initial contents of the output directory
- * before javadoc is run.
- * The filter should return true for files that should <b>not</b> appear.
- */
- public void setCheckOutputDirectoryCheck(DirectoryCheck c) {
- outputDirectoryCheck = c;
- }
-
- /**
- * Create new string writer buffers
- */
- private void initOutputBuffers() {
- errors = new StringWriter();
- notices = new StringWriter();
- warnings = new StringWriter();
+ outputMap.forEach((name, text) -> {
+ if (!text.isEmpty()) {
+ out.println("javadoc " + name + ":");
+ out.println(text);
+ }
+ });
}
/**
- * Run array of tests on the resulting HTML.
- * This method accepts a testArray for testing that a string is found
- * and a negatedTestArray for testing that a string is not found.
- *
- * @param testArray the array of tests
- * @param negatedTestArray the array of negated tests
+ * Set the kind of check for the initial contents of the output directory
+ * before javadoc is run.
+ * The filter should return true for files that should <b>not</b> appear.
+ * @param c the kind of check to perform
*/
- public void runTestsOnHTML(String[][] testArray, String[][] negatedTestArray) {
- runTestsOnHTML(testArray, false);
- runTestsOnHTML(negatedTestArray, true);
+ public void setOutputDirectoryCheck(DirectoryCheck c) {
+ outputDirectoryCheck = c;
}
- /**
- * Run array of tests on the generated files.
- * This method accepts a fileTestArray for testing if a file is generated
- * and a negatedFileTestArray for testing if a file is not found.
- * The files are relative to the most recent output directory specified
- * with -d.
- *
- * @param fileTestArray the array of file tests
- * @param negatedFileTestArray the array of negated file tests
- */
- public void runTestsOnFile(String[] fileTestArray, String[] negatedFileTestArray) {
- runTestsOnFile(outputDir, fileTestArray, false);
- runTestsOnFile(outputDir, negatedFileTestArray, true);
+ public enum Exit {
+ OK(0),
+ FAILED(1);
+
+ Exit(int code) {
+ this.code = code;
+ }
+
+ final int code;
}
/**
- * Run the array of tests on the resulting HTML.
- * The files are relative to the most recent output directory specified
- * with -d.
+ * Check the exit code of the most recent call of javadoc.
*
- * @param testArray the array of tests
- * @param isNegated true if test is negated; false otherwise
+ * @param expected the exit code that is required for the test
+ * to pass.
*/
- private void runTestsOnHTML(String[][] testArray , boolean isNegated) {
- for (String[] test : testArray) {
- numTestsRun++;
- System.out.print("Running subtest #" + numTestsRun + "... ");
- // Get string to find
- String stringToFind = test[1];
- // Read contents of file into a string
- String fileString;
- try {
- fileString = readFileToString(outputDir, test[0]);
- } catch (Error e) {
- if (isNegated) {
- System.out.println( "FAILED, due to " + e + "\n");
- continue;
- }
- throw e;
- }
- // Find string in file's contents
- boolean isFound = findString(fileString, stringToFind);
- if ((isNegated && !isFound) || (!isNegated && isFound)) {
- numTestsPassed += 1;
- System.out.println("Passed" + "\n"
- + (isNegated ? "not found:" : "found:") + "\n"
- + stringToFind + " in " + test[0] + "\n");
- } else {
- System.out.println("FAILED, when searching for:" + "\n"
- + stringToFind
- + " in " + test[0] + "\n");
- }
+ public void checkExit(Exit expected) {
+ checking("check exit code");
+ if (exitCode == expected.code) {
+ passed("return code " + exitCode);
+ } else {
+ failed("return code " + exitCode +"; expected " + expected.code + " (" + expected + ")");
}
}
/**
- * Run the array of file tests on the generated files.
- *
- * @param testArray the array of file tests
- * @param isNegated true if test is negated; false otherwise
+ * Check for content in (or not in) the generated output.
+ * Within the search strings, the newline character \n
+ * will be translated to the platform newline character sequence.
+ * @param path a path within the most recent output directory
+ * or the name of one of the output buffers, identifying
+ * where to look for the search strings.
+ * @param expectedFound true if all of the search strings are expected
+ * to be found, or false if all of the strings are expected to be
+ * not found
+ * @param strings the strings to be searched for
*/
- private void runTestsOnFile(File baseDir, String[] testArray, boolean isNegated) {
- for (String fileName : testArray) {
- numTestsRun++;
- String failedString = "FAILED: file (" + fileName + ") found" + "\n";
- String passedString = "Passed" + "\n" +
- "file (" + fileName + ") not found" + "\n";
- System.out.print("Running subtest #" + numTestsRun + "... ");
- try {
- File file = new File(baseDir, fileName);
- if ((file.exists() && !isNegated) || (!file.exists() && isNegated)) {
- numTestsPassed += 1;
- System.out.println(passedString);
- } else {
- System.out.println(failedString);
- }
- } catch (Error e) {
- System.err.println(e);
+ public void checkOutput(String path, boolean expectedFound, String... strings) {
+ // Read contents of file
+ String fileString;
+ try {
+ fileString = readFile(outputDir, path);
+ } catch (Error e) {
+ if (!expectedFound) {
+ failed("Error reading file: " + e);
+ return;
+ }
+ throw e;
+ }
+ checkOutput(path, fileString, expectedFound, strings);
+ }
+
+ /**
+ * Check for content in (or not in) the one of the output streams written by
+ * javadoc. Within the search strings, the newline character \n
+ * will be translated to the platform newline character sequence.
+ * @param output the output stream to check
+ * @param expectedFound true if all of the search strings are expected
+ * to be found, or false if all of the strings are expected to be
+ * not found
+ * @param strings the strings to be searched for
+ */
+ public void checkOutput(Output output, boolean expectedFound, String... strings) {
+ checkOutput(output.toString(), outputMap.get(output), expectedFound, strings);
+ }
+
+ private void checkOutput(String path, String fileString, boolean expectedFound, String... strings) {
+ for (String stringToFind : strings) {
+// log.logCheckOutput(path, expectedFound, stringToFind);
+ checking("checkOutput");
+ // Find string in file's contents
+ boolean isFound = findString(fileString, stringToFind);
+ if (isFound == expectedFound) {
+ passed(path + ": " + (isFound ? "found:" : "not found:") + "\n"
+ + stringToFind + "\n");
+ } else {
+ failed(path + ": " + (isFound ? "found:" : "not found:") + "\n"
+ + stringToFind + "\n");
}
}
}
/**
- * Iterate through the list of given file pairs and diff each file.
- *
- * @param baseDir1 the directory containing the first set of files
- * @param baseDir2 the directory containing the second set of files
- * @param files the set of files to be compared
- * @throws Error if any differences are found between
- * file pairs.
- */
- public void runDiffs(String baseDir1, String baseDir2, String[] files) throws Error {
- runDiffs(baseDir1, baseDir2, files, true);
- }
-
- /**
- * Iterate through the list of given file pairs and diff each file.
- *
- * @param baseDir1 the directory containing the first set of files
- * @param baseDir2 the directory containing the second set of files
- * @param files the set of files to be compared
- * @param throwErrorIfNoMatch flag to indicate whether or not to throw
- * an error if the files do not match.
- *
- * @throws Error if any differences are found between
- * file pairs and throwErrorIfNoMatch is true.
- */
- public void runDiffs(String baseDir1, String baseDir2, String[] files, boolean throwErrorIfNoMatch) throws Error {
- File bd1 = new File(baseDir1);
- File bd2 = new File(baseDir2);
- for (String file : files) {
- diff(bd1, bd2, file, throwErrorIfNoMatch);
- }
- }
-
- /**
- * Check the exit code of Javadoc and record whether the test passed
- * or failed.
- *
- * @param expectedExitCode The exit code that is required for the test
- * to pass.
- * @param actualExitCode The actual exit code from the previous run of
- * Javadoc.
- */
- public void checkExitCode(int expectedExitCode, int actualExitCode) {
- numTestsRun++;
- if (expectedExitCode == actualExitCode) {
- System.out.println( "Passed" + "\n" + " got return code " +
- actualExitCode);
- numTestsPassed++;
- } else {
- System.out.println( "FAILED: expected return code " +
- expectedExitCode + " but got " + actualExitCode);
- }
- }
-
- /**
- * Print a summary of the test results.
- */
- protected void printSummary() {
- if ( numTestsRun != 0 && numTestsPassed == numTestsRun ) {
- // Test passed
- System.out.println("\n" + "All " + numTestsPassed
- + " subtests passed");
- } else {
- // Test failed
- throw new Error("\n" + (numTestsRun - numTestsPassed)
- + " of " + (numTestsRun)
- + " subtests failed\n");
+ * Check for files in (or not in) the generated output.
+ * @param expectedFound true if all of the files are expected
+ * to be found, or false if all of the files are expected to be
+ * not found
+ * @param paths the files to check, within the most recent output directory.
+ * */
+ public void checkFiles(boolean expectedFound, String... paths) {
+ for (String path: paths) {
+// log.logCheckFile(path, expectedFound);
+ checking("checkFile");
+ File file = new File(outputDir, path);
+ boolean isFound = file.exists();
+ if (isFound == expectedFound) {
+ passed(path + ": " + (isFound ? "found:" : "not found:") + "\n");
+ } else {
+ failed(path + ": " + (isFound ? "found:" : "not found:") + "\n");
+ }
}
}
/**
- * Print the output stored in the buffers.
- */
- protected void printJavadocOutput() {
- System.out.println(STANDARD_OUTPUT + " : \n" + getStandardOutput());
- System.err.println(ERROR_OUTPUT + " : \n" + getErrorOutput());
- System.err.println(WARNING_OUTPUT + " : \n" + getWarningOutput());
- System.out.println(NOTICE_OUTPUT + " : \n" + getNoticeOutput());
- }
-
- /**
- * Read the file and return it as a string.
- *
- * @param fileName the name of the file to read
- * @return the file in string format
- */
- public String readFileToString(String fileName) throws Error {
- return readFileToString(outputDir, fileName);
- }
-
- /**
- * Read the file and return it as a string.
- *
- * @param baseDir the directory in which to locate the file
- * @param fileName the name of the file to read
- * @return the file in string format
+ * Check that a series of strings are found in order in a file in
+ * the generated output.
+ * @param path the file to check
+ * @param strings the strings whose order to check
*/
- private String readFileToString(File baseDir, String fileName) throws Error {
- switch (fileName) {
- case ERROR_OUTPUT:
- return getErrorOutput();
- case NOTICE_OUTPUT:
- return getNoticeOutput();
- case WARNING_OUTPUT:
- return getWarningOutput();
- case STANDARD_OUTPUT:
- return getStandardOutput();
- }
- try {
- File file = new File(baseDir, fileName);
- if ( !file.exists() ) {
- System.out.println("\n" + "FILE DOES NOT EXIST: " + fileName);
+ public void checkOrder(String path, String... strings) {
+ String fileString = readOutputFile(path);
+ int prevIndex = -1;
+ for (String s : strings) {
+ int currentIndex = fileString.indexOf(s);
+ checking(s + " at index " + currentIndex);
+ if (currentIndex >= prevIndex) {
+ passed(s + "is in the correct order");
+ } else {
+ failed(s + " is in the wrong order.");
}
- char[] allChars;
- try (BufferedReader in = new BufferedReader(new FileReader(file))) {
- // Create an array of characters the size of the file
- allChars = new char[(int)file.length()];
- // Read the characters into the allChars array
- in.read(allChars, 0, (int)file.length());
- }
-
- // Convert to a string
- String allCharsString = new String(allChars);
- return allCharsString;
- } catch (FileNotFoundException e) {
- System.err.println(e);
- throw new Error("File not found: " + fileName);
- } catch (IOException e) {
- System.err.println(e);
- throw new Error("Error reading file: " + fileName);
+ prevIndex = currentIndex;
}
}
/**
- * Compare the two given files.
+ * Compare a set of files in each of two directories.
*
- * @param baseDir1 the directory in which to locate the first file
- * @param baseDir2 the directory in which to locate the second file
- * @param file the file to compare in the two base directories
- * @param throwErrorIFNoMatch flag to indicate whether or not to throw
- * an error if the files do not match.
- * @return true if the files are the same and false otherwise.
+ * @param baseDir1 the directory containing the first set of files
+ * @param baseDir2 the directory containing the second set of files
+ * @param files the set of files to be compared
*/
- private boolean diff(File baseDir1, File baseDir2, String file,
- boolean throwErrorIFNoMatch) throws Error {
- String file1Contents = readFileToString(baseDir1, file);
- String file2Contents = readFileToString(baseDir2, file);
- numTestsRun++;
- if (file1Contents.trim().compareTo(file2Contents.trim()) == 0) {
- System.out.println("Diff successful: " + new File(baseDir1, file) + ", " + new File(baseDir2, file));
- numTestsPassed++;
- return true;
- } else if (throwErrorIFNoMatch) {
- throw new Error("Diff failed: " + new File(baseDir1, file) + ", " + new File(baseDir2, file));
- } else {
- return false;
+ public void diff(String baseDir1, String baseDir2, String... files) {
+ File bd1 = new File(baseDir1);
+ File bd2 = new File(baseDir2);
+ for (String file : files) {
+ diff(bd1, bd2, file);
}
}
/**
- * Search for the string in the given file and return true
- * if the string was found.
- *
- * @param fileString the contents of the file to search through
- * @param stringToFind the string to search for
- * @return true if the string was found
- */
- private boolean findString(String fileString, String stringToFind) {
- return fileString.contains(stringToFind.replace("\n", NL));
- }
-
-
- /**
- * Return the standard output.
- * @return the standard output
- */
- public String getStandardOutput() {
- return standardOut.toString();
- }
-
- /**
- * Return the error output.
- * @return the error output
- */
- public String getErrorOutput() {
- return errors.getBuffer().toString();
- }
-
- /**
- * Return the notice output.
- * @return the notice output
- */
- public String getNoticeOutput() {
- return notices.getBuffer().toString();
- }
-
- /**
- * Return the warning output.
- * @return the warning output
- */
- public String getWarningOutput() {
- return warnings.getBuffer().toString();
- }
-
- /**
* A utility to copy a directory from one place to another.
- * We may possibly want to move this to our doclet toolkit in
- * the near future and maintain it from there.
*
* @param targetDir the directory to copy.
* @param destDir the destination to copy the directory to.
*/
- public static void copyDir(String targetDir, String destDir) {
- if (targetDir.endsWith("SCCS")) {
- return;
- }
+ // TODO: convert to using java.nio.Files.walkFileTree
+ public void copyDir(String targetDir, String destDir) {
try {
File targetDirObj = new File(targetDir);
File destDirParentObj = new File(destDir);
@@ -617,7 +498,7 @@
File srcFile = new File(targetDirObj, file);
File destFile = new File(destDirObj, file);
if (srcFile.isFile()) {
- System.out.println("Copying " + srcFile + " to " + destFile);
+ out.println("Copying " + srcFile + " to " + destFile);
copyFile(destFile, srcFile);
} else if(srcFile.isDirectory()) {
copyDir(srcFile.getAbsolutePath(), destDirObj.getAbsolutePath());
@@ -633,25 +514,235 @@
*
* @param destfile the destination file
* @param srcfile the source file
- * @throws SecurityException
* @throws IOException
*/
- public static void copyFile(File destfile, File srcfile)
- throws IOException {
- byte[] bytearr = new byte[512];
- int len;
- FileInputStream input = new FileInputStream(srcfile);
- File destDir = destfile.getParentFile();
- destDir.mkdirs();
- FileOutputStream output = new FileOutputStream(destfile);
+ public void copyFile(File destfile, File srcfile) throws IOException {
+ Files.copy(srcfile.toPath(), destfile.toPath());
+ }
+
+ /**
+ * Read a file from the output directory.
+ *
+ * @param fileName the name of the file to read
+ * @return the file in string format
+ */
+ public String readOutputFile(String fileName) throws Error {
+ return readFile(outputDir, fileName);
+ }
+
+ protected String readFile(String fileName) throws Error {
+ return readFile(outputDir, fileName);
+ }
+
+ protected String readFile(String baseDir, String fileName) throws Error {
+ return readFile(new File(baseDir), fileName);
+ }
+
+ /**
+ * Read the file and return it as a string.
+ *
+ * @param baseDir the directory in which to locate the file
+ * @param fileName the name of the file to read
+ * @return the file in string format
+ */
+ private String readFile(File baseDir, String fileName) throws Error {
try {
- while ((len = input.read(bytearr)) != -1) {
- output.write(bytearr, 0, len);
+ File file = new File(baseDir, fileName);
+ SoftReference<String> ref = fileContentCache.get(file);
+ String content = (ref == null) ? null : ref.get();
+ if (content != null)
+ return content;
+
+ content = new String(Files.readAllBytes(file.toPath()));
+ fileContentCache.put(file, new SoftReference(content));
+ return content;
+ } catch (FileNotFoundException e) {
+ System.err.println(e);
+ throw new Error("File not found: " + fileName);
+ } catch (IOException e) {
+ System.err.println(e);
+ throw new Error("Error reading file: " + fileName);
+ }
+ }
+
+ protected void checking(String message) {
+ numTestsRun++;
+ print("Starting subtest " + numTestsRun, message);
+ }
+
+ protected void passed(String message) {
+ numTestsPassed++;
+ print("Passed", message);
+ }
+
+ protected void failed(String message) {
+ print("FAILED", message);
+ }
+
+ private void print(String prefix, String message) {
+ if (message.isEmpty())
+ out.println(prefix);
+ else {
+ out.print(prefix);
+ out.print(": ");
+ out.println(message.replace("\n", NL));
+ }
+ }
+
+ /**
+ * Print a summary of the test results.
+ */
+ protected void printSummary() {
+// log.write();
+ if (numTestsRun != 0 && numTestsPassed == numTestsRun) {
+ // Test passed
+ out.println();
+ out.println("All " + numTestsPassed + " subtests passed");
+ } else {
+ // Test failed
+ throw new Error((numTestsRun - numTestsPassed)
+ + " of " + (numTestsRun)
+ + " subtests failed");
+ }
+ }
+
+ /**
+ * Search for the string in the given file and return true
+ * if the string was found.
+ *
+ * @param fileString the contents of the file to search through
+ * @param stringToFind the string to search for
+ * @return true if the string was found
+ */
+ private boolean findString(String fileString, String stringToFind) {
+ // javadoc (should) always use the platform newline sequence,
+ // but in the strings to find it is more convenient to use the Java
+ // newline character. So we translate \n to NL before we search.
+ stringToFind = stringToFind.replace("\n", NL);
+ return fileString.contains(stringToFind);
+ }
+
+ /**
+ * Compare the two given files.
+ *
+ * @param baseDir1 the directory in which to locate the first file
+ * @param baseDir2 the directory in which to locate the second file
+ * @param file the file to compare in the two base directories
+ * @param throwErrorIFNoMatch flag to indicate whether or not to throw
+ * an error if the files do not match.
+ * @return true if the files are the same and false otherwise.
+ */
+ private void diff(File baseDir1, File baseDir2, String file) {
+ String file1Contents = readFile(baseDir1, file);
+ String file2Contents = readFile(baseDir2, file);
+ checking("diff " + new File(baseDir1, file) + ", " + new File(baseDir2, file));
+ if (file1Contents.trim().compareTo(file2Contents.trim()) == 0) {
+ passed("files are equal");
+ } else {
+ failed("files differ");
+ }
+ }
+
+ /**
+ * Utility class to simplify the handling of temporarily setting a
+ * new stream for System.out or System.err.
+ */
+ private static class StreamOutput {
+ // functional interface to set a stream.
+ private interface Initializer {
+ void set(PrintStream s);
+ }
+
+ private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ private final PrintStream ps = new PrintStream(baos);
+ private final PrintStream prev;
+ private final Initializer init;
+
+ StreamOutput(PrintStream s, Initializer init) {
+ prev = s;
+ init.set(ps);
+ this.init = init;
+ }
+
+ String close() {
+ init.set(prev);
+ ps.close();
+ return baos.toString();
+ }
+ }
+
+ /**
+ * Utility class to simplify the handling of creating an in-memory PrintWriter.
+ */
+ private static class WriterOutput {
+ private final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
+ String close() {
+ pw.close();
+ return sw.toString();
+ }
+ }
+
+
+// private final Logger log = new Logger();
+
+ //--------- Logging --------------------------------------------------------
+ //
+ // This class writes out the details of calls to checkOutput and checkFile
+ // in a canonical way, so that the resulting file can be checked against
+ // similar files from other versions of JavadocTester using the same logging
+ // facilities.
+
+ static class Logger {
+ private static final int PREFIX = 40;
+ private static final int SUFFIX = 20;
+ private static final int MAX = PREFIX + SUFFIX;
+ List<String> tests = new ArrayList<>();
+ String outDir;
+ String rootDir = rootDir();
+
+ static String rootDir() {
+ File f = new File(".").getAbsoluteFile();
+ while (!new File(f, ".hg").exists())
+ f = f.getParentFile();
+ return f.getPath();
+ }
+
+ void setOutDir(File outDir) {
+ this.outDir = outDir.getPath();
+ }
+
+ void logCheckFile(String file, boolean positive) {
+ // Strip the outdir because that will typically not be the same
+ if (file.startsWith(outDir + "/"))
+ file = file.substring(outDir.length() + 1);
+ tests.add(file + " " + positive);
+ }
+
+ void logCheckOutput(String file, boolean positive, String text) {
+ // Compress the string to be displayed in the log file
+ String simpleText = text.replaceAll("\\s+", " ").replace(rootDir, "[ROOT]");
+ if (simpleText.length() > MAX)
+ simpleText = simpleText.substring(0, PREFIX)
+ + "..." + simpleText.substring(simpleText.length() - SUFFIX);
+ // Strip the outdir because that will typically not be the same
+ if (file.startsWith(outDir + "/"))
+ file = file.substring(outDir.length() + 1);
+ // The use of text.hashCode ensure that all of "text" is taken into account
+ tests.add(file + " " + positive + " " + text.hashCode() + " " + simpleText);
+ }
+
+ void write() {
+ // sort the log entries because the subtests may not be executed in the same order
+ tests.sort((a, b) -> a.compareTo(b));
+ try (BufferedWriter bw = new BufferedWriter(new FileWriter("tester.log"))) {
+ for (String t: tests) {
+ bw.write(t);
+ bw.newLine();
+ }
+ } catch (IOException e) {
+ throw new Error("problem writing log: " + e);
}
- } catch (FileNotFoundException | SecurityException exc) {
- } finally {
- input.close();
- output.close();
}
}
}
--- a/langtools/test/com/sun/javadoc/testAbsLinkPath/TestAbsLinkPath.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testAbsLinkPath/TestAbsLinkPath.java Fri May 23 09:05:24 2014 -0700
@@ -26,33 +26,31 @@
* @bug 4640745
* @summary This test verifys that the -link option handles absolute paths.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestAbsLinkPath
* @run main TestAbsLinkPath
*/
public class TestAbsLinkPath extends JavadocTester {
- private static final String[][] TEST = {
- { "pkg1/C1.html", "C2.html"}};
+ public static void main(String... args) throws Exception {
+ TestAbsLinkPath tester = new TestAbsLinkPath();
+ tester.runTests();
+ }
- private static final String[] ARGS1 =
- new String[] {
- "-d", "tmp2", "-sourcepath", SRC_DIR, "pkg2"};
- private static final String[] ARGS2 =
- new String[] {
- "-d", "tmp", "-sourcepath", SRC_DIR,
- "-link", "../tmp2", "pkg1"};
+ @Test
+ void test1() {
+ String out1 = "out1";
+ javadoc("-d", out1, "-sourcepath", testSrc, "pkg2");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestAbsLinkPath tester = new TestAbsLinkPath();
- tester.run(ARGS1, NO_TEST, NO_TEST);
- tester.run(ARGS2, TEST, NO_TEST);
- tester.printSummary();
+ javadoc("-d", "out2",
+ "-sourcepath", testSrc,
+ "-link", "../" + out1,
+ "pkg1");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg1/C1.html", true,
+ "C2.html");
}
}
--- a/langtools/test/com/sun/javadoc/testAbstractMethod/TestAbstractMethod.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testAbstractMethod/TestAbstractMethod.java Fri May 23 09:05:24 2014 -0700
@@ -27,80 +27,72 @@
* @summary Make sure that the abstract method is identified correctly
* if the abstract modifier is present explicitly or implicitly.
* @author bpatel
- * @library ../lib/
- * @build JavadocTester TestAbstractMethod
+ * @library ../lib
+ * @build JavadocTester
* @run main TestAbstractMethod
*/
public class TestAbstractMethod extends JavadocTester {
- //Test information.
+ public static void main(String... args) throws Exception {
+ TestAbstractMethod tester = new TestAbstractMethod();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ checkOutput("pkg/A.html", true,
+ "<td class=\"colFirst\"><code>default void</code></td>",
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+ + "All Methods</span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t2\" class=\"tableTab\"><span>"
+ + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+ + "<span class=\"tabEnd\"> </span></span><span id=\"t3\" "
+ + "class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+ + "Abstract Methods</a></span><span class=\"tabEnd\"> </span>"
+ + "</span><span id=\"t5\" class=\"tableTab\"><span>"
+ + "<a href=\"javascript:show(16);\">Default Methods</a></span>"
+ + "<span class=\"tabEnd\"> </span></span></caption>");
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/A.html",
- "<td class=\"colFirst\"><code>default void</code></td>"},
- { "pkg/A.html",
- "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
- "All Methods</span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t2\" class=\"tableTab\"><span>" +
- "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
- "<span class=\"tabEnd\"> </span></span><span id=\"t3\" " +
- "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
- "Abstract Methods</a></span><span class=\"tabEnd\"> </span>" +
- "</span><span id=\"t5\" class=\"tableTab\"><span>" +
- "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
- "<span class=\"tabEnd\"> </span></span></caption>"},
- { "pkg/B.html",
- "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
- "All Methods</span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t2\" class=\"tableTab\"><span>" +
- "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
- "<span class=\"tabEnd\"> </span></span><span id=\"t3\" " +
- "class=\"tableTab\"><span><a href=\"javascript:show(4);\">Abstract " +
- "Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t4\" class=\"tableTab\"><span>" +
- "<a href=\"javascript:show(8);\">Concrete Methods</a></span>" +
- "<span class=\"tabEnd\"> </span></span></caption>"},
- { "pkg/B.html",
- "<td class=\"colFirst\"><code>abstract void</code></td>"},
- { "pkg/C.html",
- "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
- "All Methods</span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t2\" class=\"tableTab\"><span>" +
- "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
- "<span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t5\" class=\"tableTab\"><span>" +
- "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
- "<span class=\"tabEnd\"> </span></span></caption>"},
- { "pkg/C.html",
- "<td class=\"colFirst\"><code>default void</code></td>"}
- };
- private static final String[][] NEGATED_TEST = {
- { "pkg/A.html",
- "<td class=\"colFirst\"><code>abstract void</code></td>"},
- { "pkg/B.html",
- "<span><a href=\"javascript:show(16);\">Default Methods</a></span>" +
- "<span class=\"tabEnd\"> </span>"},
- { "pkg/B.html",
- "<td class=\"colFirst\"><code>default void</code></td>"},
- { "pkg/C.html",
- "<span><a href=\"javascript:show(4);\">Abstract Methods</a></span>" +
- "<span class=\"tabEnd\"> </span>"}
- };
+ checkOutput("pkg/B.html", true,
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+ + "All Methods</span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t2\" class=\"tableTab\"><span>"
+ + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+ + "<span class=\"tabEnd\"> </span></span><span id=\"t3\" "
+ + "class=\"tableTab\"><span><a href=\"javascript:show(4);\">Abstract "
+ + "Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t4\" class=\"tableTab\"><span>"
+ + "<a href=\"javascript:show(8);\">Concrete Methods</a></span>"
+ + "<span class=\"tabEnd\"> </span></span></caption>",
+ "<td class=\"colFirst\"><code>abstract void</code></td>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestAbstractMethod tester = new TestAbstractMethod();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg/C.html", true,
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+ + "All Methods</span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t2\" class=\"tableTab\"><span>"
+ + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+ + "<span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t5\" class=\"tableTab\"><span>"
+ + "<a href=\"javascript:show(16);\">Default Methods</a></span>"
+ + "<span class=\"tabEnd\"> </span></span></caption>",
+ "<td class=\"colFirst\"><code>default void</code></td>");
+
+ checkOutput("pkg/A.html", false,
+ "<td class=\"colFirst\"><code>abstract void</code></td>");
+
+ checkOutput("pkg/B.html", false,
+ "<span><a href=\"javascript:show(16);\">Default Methods</a></span>"
+ + "<span class=\"tabEnd\"> </span>",
+ "<td class=\"colFirst\"><code>default void</code></td>");
+
+ checkOutput("pkg/C.html", false,
+ "<span><a href=\"javascript:show(4);\">Abstract Methods</a></span>"
+ + "<span class=\"tabEnd\"> </span>");
}
}
--- a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Fri May 23 09:05:24 2014 -0700
@@ -26,250 +26,136 @@
* @bug 8025633 8025524
* @summary Test for valid name attribute in HTML anchors.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestAnchorNames
+ * @library ../lib
+ * @build JavadocTester
* @run main TestAnchorNames
*/
public class TestAnchorNames extends JavadocTester {
-
- //Input for string search tests.
- private static final String[][] TEST = {
-
- //Test some section markers and links to these markers
-
- { "pkg1/RegClass.html",
- "<a name=\"skip.navbar.top\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"nested.class.summary\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"#nested.class.summary\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"method.summary\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"#method.summary\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"field.detail\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"#field.detail\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"constructor.detail\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"#constructor.detail\">"
- },
-
- //Test some members and link to these members
+ private static final String[] ARGS = new String[] {
- //The marker for this appears in the serialized-form.html which we will
- //test below
- { "pkg1/RegClass.html",
- "<a href=\"../serialized-form.html#pkg1.RegClass\">"
- },
- //Test some fields
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z_\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z_\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z_:D\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z:D_\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z:Dfield\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"fieldInCla:D:D\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"S_:D:D:D:D:DINT\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"method:D:D\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#method:D:D\">"
- },
- { "pkg1/DeprMemClass.html",
- "<a name=\"Z:Z_field_In_Class\">"
- },
- { "pkg1/DeprMemClass.html",
- "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
- },
- //Test constructor
- { "pkg1/RegClass.html",
- "<a name=\"RegClass-java.lang.String-int-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">"
- },
- //Test some methods
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z_methodInClass-java.lang.String-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"method--\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#method--\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"foo-java.util.Map-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"methodInCla:Ds-java.lang.String:A-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"methodD-pkg1.RegClass.:DA-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"methodD-pkg1.RegClass.D:A-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">"
- },
- { "pkg1/DeprMemClass.html",
- "<a name=\"Z:Z:Dmethod_In_Class--\">"
- },
- { "pkg1/DeprMemClass.html",
- "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
- },
-
- //Test enum
-
- { "pkg1/RegClass.Te$t_Enum.html",
- "<a name=\"Z:Z:DFLD2\">"
- },
- { "pkg1/RegClass.Te$t_Enum.html",
- "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">"
- },
-
- //Test nested class
-
- { "pkg1/RegClass._NestedClas$.html",
- "<a name=\"Z:Z_NestedClas:D--\">"
- },
- { "pkg1/RegClass._NestedClas$.html",
- "<a href=\"../pkg1/RegClass._NestedClas$.html#Z:Z_NestedClas:D--\">"
- },
-
- //Test class use page
-
- { "pkg1/class-use/DeprMemClass.html",
- "<a href=\"../../pkg1/RegClass.html#d____mc\">"
- },
-
- //Test deprecated list page
-
- { "deprecated-list.html",
- "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
- },
- { "deprecated-list.html",
- "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
- },
-
- //Test constant values page
-
- { "constant-values.html",
- "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
- },
-
- //Test serialized form page
-
- //This is the marker for the link that appears in the pkg1.RegClass.html page
- { "serialized-form.html",
- "<a name=\"pkg1.RegClass\">"
- },
-
- //Test member name index page
-
- { "index-all.html",
- "<a name=\"I:Z:Z:D\">"
- },
- { "index-all.html",
- "<a href=\"#I:Z:Z:D\">$"
- },
- { "index-all.html",
- "<a href=\"#I:Z:Z_\">_"
- }
};
- private static final String[][] NEGATED_TEST = {
- //The marker name conversion should only affect HTML anchors. It should not
- //affect the lables.
- { "pkg1/RegClass.html",
- " Z:Z_"
- },
- { "pkg1/RegClass.html",
- " Z:Z:Dfield"
- },
- { "pkg1/RegClass.html",
- " Z:Z_field_In_Class"
- },
- { "pkg1/RegClass.html",
- " S_:D:D:D:D:DINT"
- },
- };
-
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
public static void main(String[] args) throws Exception {
TestAnchorNames tester = new TestAnchorNames();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-use",
+ "pkg1");
+ checkExit(Exit.OK);
+
+ // Test some section markers and links to these markers
+ checkOutput("pkg1/RegClass.html", true,
+ "<a name=\"skip.navbar.top\">",
+ "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">",
+ "<a name=\"nested.class.summary\">",
+ "<a href=\"#nested.class.summary\">",
+ "<a name=\"method.summary\">",
+ "<a href=\"#method.summary\">",
+ "<a name=\"field.detail\">",
+ "<a href=\"#field.detail\">",
+ "<a name=\"constructor.detail\">",
+ "<a href=\"#constructor.detail\">");
+
+ // Test some members and link to these members
+ checkOutput("pkg1/RegClass.html", true,
+ //The marker for this appears in the serialized-form.html which we will
+ //test below
+ "<a href=\"../serialized-form.html#pkg1.RegClass\">");
+
+ // Test some fields
+ checkOutput("pkg1/RegClass.html", true,
+ "<a name=\"Z:Z_\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_\">",
+ "<a name=\"Z:Z_:D\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">",
+ "<a name=\"Z:Z:D_\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">",
+ "<a name=\"Z:Z:Dfield\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">",
+ "<a name=\"fieldInCla:D:D\">",
+ "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">",
+ "<a name=\"S_:D:D:D:D:DINT\">",
+ "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">",
+ "<a name=\"method:D:D\">",
+ "<a href=\"../pkg1/RegClass.html#method:D:D\">");
+
+ checkOutput("pkg1/DeprMemClass.html", true,
+ "<a name=\"Z:Z_field_In_Class\">",
+ "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">");
+
+ // Test constructor
+ checkOutput("pkg1/RegClass.html", true,
+ "<a name=\"RegClass-java.lang.String-int-\">",
+ "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">");
+
+ // Test some methods
+ checkOutput("pkg1/RegClass.html", true,
+ "<a name=\"Z:Z_methodInClass-java.lang.String-\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">",
+ "<a name=\"method--\">",
+ "<a href=\"../pkg1/RegClass.html#method--\">",
+ "<a name=\"foo-java.util.Map-\">",
+ "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">",
+ "<a name=\"methodInCla:Ds-java.lang.String:A-\">",
+ "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">",
+ "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">",
+ "<a name=\"methodD-pkg1.RegClass.:DA-\">",
+ "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">",
+ "<a name=\"methodD-pkg1.RegClass.D:A-\">",
+ "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">");
+
+ checkOutput("pkg1/DeprMemClass.html", true,
+ "<a name=\"Z:Z:Dmethod_In_Class--\">",
+ "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">");
+
+ // Test enum
+ checkOutput("pkg1/RegClass.Te$t_Enum.html", true,
+ "<a name=\"Z:Z:DFLD2\">",
+ "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">");
+
+ // Test nested class
+ checkOutput("pkg1/RegClass._NestedClas$.html", true,
+ "<a name=\"Z:Z_NestedClas:D--\">",
+ "<a href=\"../pkg1/RegClass._NestedClas$.html#Z:Z_NestedClas:D--\">");
+
+ // Test class use page
+ checkOutput("pkg1/class-use/DeprMemClass.html", true,
+ "<a href=\"../../pkg1/RegClass.html#d____mc\">");
+
+ // Test deprecated list page
+ checkOutput("deprecated-list.html", true,
+ "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">",
+ "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">");
+
+ // Test constant values page
+ checkOutput("constant-values.html", true,
+ "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">");
+
+ // Test serialized form page
+ checkOutput("serialized-form.html", true,
+ //This is the marker for the link that appears in the pkg1.RegClass.html page
+ "<a name=\"pkg1.RegClass\">");
+
+ // Test member name index page
+ checkOutput("index-all.html", true,
+ "<a name=\"I:Z:Z:D\">",
+ "<a href=\"#I:Z:Z:D\">$",
+ "<a href=\"#I:Z:Z_\">_");
+
+ // The marker name conversion should only affect HTML anchors. It should not
+ // affect the lables.
+ checkOutput("pkg1/RegClass.html", false,
+ " Z:Z_",
+ " Z:Z:Dfield",
+ " Z:Z_field_In_Class",
+ " S_:D:D:D:D:DINT");
}
}
--- a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java Fri May 23 09:05:24 2014 -0700
@@ -27,32 +27,26 @@
* @summary Make sure that annotations types with optional elements have
* element headers
* @author Mahmood Ali
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestAnnotationOptional
* @run main TestAnnotationOptional
*/
public class TestAnnotationOptional extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestAnnotationOptional tester = new TestAnnotationOptional();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/AnnotationOptional.html",
- "<a name=\"annotation.type.element.detail\">"
- }
- };
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestAnnotationOptional tester = new TestAnnotationOptional();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/AnnotationOptional.html", true,
+ "<a name=\"annotation.type.element.detail\">");
}
}
--- a/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Fri May 23 09:05:24 2014 -0700
@@ -27,64 +27,52 @@
* @summary Make sure that annotation types with 0 members does not have
* extra HR tags.
* @author jamieh
- * @library ../lib/
- * @build JavadocTester TestAnnotationTypes
+ * @library ../lib
+ * @build JavadocTester
* @run main TestAnnotationTypes
*/
public class TestAnnotationTypes extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestAnnotationTypes tester = new TestAnnotationTypes();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/AnnotationTypeField.html",
- "<li>Summary: </li>\n" +
- "<li><a href=\"#annotation.type." +
- "field.summary\">Field</a> | </li>"},
- { "pkg/AnnotationTypeField.html",
- "<li>Detail: </li>\n" +
- "<li><a href=\"#annotation.type." +
- "field.detail\">Field</a> | </li>"},
- { "pkg/AnnotationTypeField.html",
- "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->"},
- { "pkg/AnnotationTypeField.html",
- "<h3>Field Summary</h3>"},
- { "pkg/AnnotationTypeField.html",
- "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../" +
- "pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>" +
- "</code> </td>"},
- { "pkg/AnnotationTypeField.html",
- "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->"},
- { "pkg/AnnotationTypeField.html",
- "<h4>DEFAULT_NAME</h4>\n" +
- "<pre>public static final java." +
- "lang.String DEFAULT_NAME</pre>"},
- { "pkg/AnnotationType.html",
- "<li>Summary: </li>\n" +
- "<li>Field | </li>"},
- { "pkg/AnnotationType.html",
- "<li>Detail: </li>\n" +
- "<li>Field | </li>"},
- };
- private static final String[][] NEGATED_TEST = {
- { "pkg/AnnotationType.html",
- "<HR>\n\n" +
- "<P>\n\n" +
- "<P>" +
- "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>"}
- };
+ checkOutput("pkg/AnnotationTypeField.html", true,
+ "<li>Summary: </li>\n"
+ + "<li><a href=\"#annotation.type."
+ + "field.summary\">Field</a> | </li>",
+ "<li>Detail: </li>\n"
+ + "<li><a href=\"#annotation.type."
+ + "field.detail\">Field</a> | </li>",
+ "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->",
+ "<h3>Field Summary</h3>",
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../"
+ + "pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>"
+ + "</code> </td>",
+ "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->",
+ "<h4>DEFAULT_NAME</h4>\n"
+ + "<pre>public static final java."
+ + "lang.String DEFAULT_NAME</pre>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestAnnotationTypes tester = new TestAnnotationTypes();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg/AnnotationType.html", true,
+ "<li>Summary: </li>\n"
+ + "<li>Field | </li>",
+ "<li>Detail: </li>\n"
+ + "<li>Field | </li>");
+
+ checkOutput("pkg/AnnotationType.html", false,
+ "<HR>\n\n"
+ + "<P>\n\n"
+ + "<P>"
+ + "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>");
}
}
--- a/langtools/test/com/sun/javadoc/testBackSlashInLink/TestBackSlashInLink.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testBackSlashInLink/TestBackSlashInLink.java Fri May 23 09:05:24 2014 -0700
@@ -27,28 +27,27 @@
* @summary Test to make sure that the link to source documentation
* has a forward slash. It would be wrong to use a back slash.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestBackSlashInLink
* @run main TestBackSlashInLink
*/
public class TestBackSlashInLink extends JavadocTester {
- private static final String[][] TEST = {
- { "C.html", "src-html/C.html#line.7"}};
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-linksource", SRC_DIR + "/C.java"};
+ public static void main(String... args) throws Exception {
+ TestBackSlashInLink tester = new TestBackSlashInLink();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestBackSlashInLink tester = new TestBackSlashInLink();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-linksource",
+ testSrc("C.java"));
+ checkExit(Exit.OK);
+
+ checkOutput("C.html", true,
+ "src-html/C.html#line.7");
}
}
--- a/langtools/test/com/sun/javadoc/testBadPackageFileInJar/TestBadPackageFileInJar.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testBadPackageFileInJar/TestBadPackageFileInJar.java Fri May 23 09:05:24 2014 -0700
@@ -27,33 +27,27 @@
* @summary Test to make sure that Javadoc emits a useful warning
* when a bad package.html file is in the JAR.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestBadPackageFileInJar
* @run main TestBadPackageFileInJar
*/
public class TestBadPackageFileInJar extends JavadocTester {
- private static final String[][] TEST =
- new String[][] {
- {ERROR_OUTPUT,
- "badPackageFileInJar.jar" + FS + "pkg/package.html: error - Body tag missing from HTML"}
- };
+ public static void main(String... args) throws Exception {
+ TestBadPackageFileInJar tester = new TestBadPackageFileInJar();
+ tester.runTests();
+ }
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-classpath",
- SRC_DIR + "/badPackageFileInJar.jar", "pkg"};
-
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-classpath", testSrc("badPackageFileInJar.jar"),
+ "pkg");
+ checkExit(Exit.FAILED);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestBadPackageFileInJar tester = new TestBadPackageFileInJar();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput(Output.ERROR, true,
+ "badPackageFileInJar.jar" + FS + "pkg/package.html: error - Body tag missing from HTML");
}
}
--- a/langtools/test/com/sun/javadoc/testBadSourceFile/TestBadSourceFile.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testBadSourceFile/TestBadSourceFile.java Fri May 23 09:05:24 2014 -0700
@@ -27,27 +27,28 @@
* @summary Make sure exception is not thrown if there is a bad source
* file in the same directory as the file being documented.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestBadSourceFile
* @run main TestBadSourceFile
*/
public class TestBadSourceFile extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR, SRC_DIR + "/C2.java"
- };
-
/**
* The entry point of the test.
- * @param args the array of command line arguments.
+ * @param args the array of command line arguments
+ * @throws Exception if the test fails
*/
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestBadSourceFile tester = new TestBadSourceFile();
- int exitCode = tester.run(ARGS, NO_TEST, NO_TEST);
- tester.checkExitCode(0, exitCode);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-Xdoclint:none",
+ "-d", "out",
+ testSrc("C2.java"));
+ checkExit(Exit.OK);
}
}
--- a/langtools/test/com/sun/javadoc/testBaseClass/TestBaseClass.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testBaseClass/TestBaseClass.java Fri May 23 09:05:24 2014 -0700
@@ -26,29 +26,25 @@
* @bug 4197513
* @summary Javadoc does not process base class.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build BaseClass
* @build JavadocTester
- * @build TestBaseClass
* @run main TestBaseClass
*/
public class TestBaseClass extends JavadocTester {
- private static final String[] ARGS =
- new String[] {
- "-sourcepath", SRC_DIR,
- "-docletpath", SRC_DIR, "-doclet", "BaseClass",
- SRC_DIR + "/Bar.java", "baz"};
+ public static void main(String... args) throws Exception {
+ TestBaseClass tester = new TestBaseClass();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestBaseClass tester = new TestBaseClass();
- if (tester.run(ARGS, NO_TEST, NO_TEST) != 0) {
- throw new Error("Javadoc failed to execute.");
- }
+ @Test
+ void test() {
+ javadoc("-sourcepath", testSrc,
+ "-docletpath", testSrc,
+ "-doclet", "BaseClass",
+ testSrc("Bar.java"), "baz");
+ checkExit(Exit.OK);
}
}
--- a/langtools/test/com/sun/javadoc/testBreakIterator/TestBreakIterator.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testBreakIterator/TestBreakIterator.java Fri May 23 09:05:24 2014 -0700
@@ -29,29 +29,27 @@
* Correct Answer: "The class is empty (i.e. it has no members)."
* Wrong Answer: "The class is empty (i.e."
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestBreakIterator
* @run main TestBreakIterator
*/
public class TestBreakIterator extends JavadocTester {
- private static final String[][] TEST = {
- { "pkg/BreakIteratorTest.html",
- "The class is empty (i.e. it has no members)."}};
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-breakiterator", "pkg"};
+ public static void main(String... args) throws Exception {
+ TestBreakIterator tester = new TestBreakIterator();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestBreakIterator tester = new TestBreakIterator();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-breakiterator",
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/BreakIteratorTest.html", true,
+ "The class is empty (i.e. it has no members).");
}
}
--- a/langtools/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java Fri May 23 09:05:24 2014 -0700
@@ -26,9 +26,8 @@
* @bug 4979486
* @summary Make sure tool parses CR line separators properly.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestCRLineSeparator
* @run main TestCRLineSeparator
*/
@@ -37,32 +36,27 @@
public class TestCRLineSeparator extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", ".", "pkg"
- };
-
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/MyClass.html", "Line 1\n" +
- " Line 2"}
- };
+ public static void main(String... args) throws Exception {
+ TestCRLineSeparator tester = new TestCRLineSeparator();
+ tester.runTests();
+ }
+ @Test
+ void test() throws IOException {
+ initFiles(new File(testSrc), new File("src"), "pkg");
+ javadoc("-d", "out",
+ "-sourcepath", "src",
+ "pkg");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) throws Exception {
- initFiles(new File(SRC_DIR), new File("."), "pkg");
- TestCRLineSeparator tester = new TestCRLineSeparator();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/MyClass.html", true,
+ "Line 1\n"
+ + " Line 2");
}
// recursively copy files from fromDir to toDir, replacing newlines
// with \r
- static void initFiles(File fromDir, File toDir, String f) throws IOException {
+ void initFiles(File fromDir, File toDir, String f) throws IOException {
File from_f = new File(fromDir, f);
File to_f = new File(toDir, f);
if (from_f.isDirectory()) {
@@ -71,23 +65,17 @@
initFiles(from_f, to_f, child);
}
} else {
- List<String> lines = new ArrayList<String>();
- BufferedReader in = new BufferedReader(new FileReader(from_f));
- try {
+ List<String> lines = new ArrayList<>();
+ try (BufferedReader in = new BufferedReader(new FileReader(from_f))) {
String line;
while ((line = in.readLine()) != null)
lines.add(line);
- } finally {
- in.close();
}
- BufferedWriter out = new BufferedWriter(new FileWriter(to_f));
- try {
+ try (BufferedWriter out = new BufferedWriter(new FileWriter(to_f))) {
for (String line: lines) {
out.write(line);
out.write("\r");
}
- } finally {
- out.close();
}
}
}
--- a/langtools/test/com/sun/javadoc/testCharset/TestCharset.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testCharset/TestCharset.java Fri May 23 09:05:24 2014 -0700
@@ -27,39 +27,34 @@
* @summary Run a test on -charset to make sure the charset gets generated as a
* part of the meta tag.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestCharset
+ * @library ../lib
+ * @build JavadocTester
* @run main TestCharset
*/
public class TestCharset extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-charset", "UTF-8", "-sourcepath", SRC_DIR, "pkg"
- };
-
- private static final String[][] TEST = {
- { "index.html",
- "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"},
- { "pkg/Foo.html",
- "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"}
- };
+ public static void main(String... args) throws Exception {
+ TestCharset tester = new TestCharset();
+ tester.runTests();
+ }
- private static final String[][] NEGATED_TEST = {
- { "index.html",
- "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"},
- { "pkg/Foo.html",
- "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"}
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-charset", "UTF-8",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestCharset tester = new TestCharset();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("index.html", true,
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
+ checkOutput("pkg/Foo.html", true,
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
+
+ checkOutput("index.html", false,
+ "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">");
+ checkOutput("pkg/Foo.html", false,
+ "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">");
}
}
--- a/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Fri May 23 09:05:24 2014 -0700
@@ -26,7 +26,7 @@
* @bug 4652655 4857717 8025633 8026567
* @summary This test verifies that class cross references work properly.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
* @build TestClassCrossReferences
* @run main TestClassCrossReferences
@@ -34,37 +34,34 @@
public class TestClassCrossReferences extends JavadocTester {
- private static final String[][] TEST = {
- { "C.html",
- "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/package-summary.html?is-external=true\"><code>Link to math package</code></a>"},
- { "C.html",
- "<a href=\"http://java.sun.com/j2se/1.4/docs/api/javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" " +
- "title=\"class or interface in javax.swing.text\"><code>Link to AttributeContext innerclass</code></a>"},
- { "C.html",
- "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " +
- "title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>"},
- { "C.html",
- "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" " +
- "title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>"},
- { "C.html",
- "<dl>\n" +
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code>toString</code> in class <code>java.lang.Object</code></dd>\n" +
- "</dl>"}
- };
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/",
- SRC_DIR, SRC_DIR + "/C.java"};
+ public static void main(String... args) throws Exception {
+ TestClassCrossReferences tester = new TestClassCrossReferences();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ final String uri = "http://java.sun.com/j2se/1.4/docs/api/";
+
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-linkoffline", uri, testSrc,
+ testSrc("C.java"));
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestClassCrossReferences tester = new TestClassCrossReferences();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("C.html", true,
+ "<a href=\"" + uri + "java/math/package-summary.html?is-external=true\">"
+ + "<code>Link to math package</code></a>",
+ "<a href=\"" + uri + "javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" "
+ + "title=\"class or interface in javax.swing.text\"><code>Link to AttributeContext innerclass</code></a>",
+ "<a href=\"" + uri + "java/math/BigDecimal.html?is-external=true\" "
+ + "title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>",
+ "<a href=\"" + uri + "java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" "
+ + "title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>",
+ "<dl>\n"
+ + "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code>toString</code> in class <code>java.lang.Object</code></dd>\n"
+ + "</dl>");
}
+
}
--- a/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java Fri May 23 09:05:24 2014 -0700
@@ -29,64 +29,52 @@
* Make sure class tree includes heirarchy for enums and annotation
* types.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestClassTree
* @run main TestClassTree
*/
public class TestClassTree extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestClassTree tester = new TestClassTree();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/package-tree.html",
- "<ul>\n" +
- "<li type=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" " +
- "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a>"},
-
- { "pkg/package-tree.html",
- "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n" +
- "<ul>\n" +
- "<li type=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" " +
- "title=\"annotation in pkg\"><span class=\"typeNameLink\">AnnotationType</span></a> " +
- "(implements java.lang.annotation.Annotation)</li>\n" +
- "</ul>"},
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- { "pkg/package-tree.html",
- "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n" +
- "<ul>\n" +
- "<li type=\"circle\">java.lang.Object\n" +
- "<ul>\n" +
- "<li type=\"circle\">java.lang.Enum<E> (implements java.lang." +
- "Comparable<T>, java.io.Serializable)\n" +
- "<ul>\n" +
- "<li type=\"circle\">pkg.<a href=\"../pkg/Coin.html\" " +
- "title=\"enum in pkg\"><span class=\"typeNameLink\">Coin</span></a></li>\n" +
- "</ul>\n" +
- "</li>\n" +
- "</ul>\n" +
- "</li>\n" +
- "</ul>"
- },
- };
- private static final String[][] NEGATED_TEST = {
- { "pkg/package-tree.html",
- "<li type=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" " +
- "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a></li>"}
- };
+ checkOutput("pkg/package-tree.html", true,
+ "<ul>\n"
+ + "<li type=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" "
+ + "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a>",
+ "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n"
+ + "<ul>\n"
+ + "<li type=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" "
+ + "title=\"annotation in pkg\"><span class=\"typeNameLink\">AnnotationType</span></a> "
+ + "(implements java.lang.annotation.Annotation)</li>\n"
+ + "</ul>",
+ "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n"
+ + "<ul>\n"
+ + "<li type=\"circle\">java.lang.Object\n"
+ + "<ul>\n"
+ + "<li type=\"circle\">java.lang.Enum<E> (implements java.lang."
+ + "Comparable<T>, java.io.Serializable)\n"
+ + "<ul>\n"
+ + "<li type=\"circle\">pkg.<a href=\"../pkg/Coin.html\" "
+ + "title=\"enum in pkg\"><span class=\"typeNameLink\">Coin</span></a></li>\n"
+ + "</ul>\n"
+ + "</li>\n"
+ + "</ul>\n"
+ + "</li>\n"
+ + "</ul>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestClassTree tester = new TestClassTree();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg/package-tree.html", false,
+ "<li type=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" "
+ + "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a></li>");
}
}
--- a/langtools/test/com/sun/javadoc/testCmndLineClass/TestCmndLineClass.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testCmndLineClass/TestCmndLineClass.java Fri May 23 09:05:24 2014 -0700
@@ -28,47 +28,44 @@
* when specifying packages on the command line and specifying individual
* classes.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestCmndLineClass
* @run main TestCmndLineClass
*/
public class TestCmndLineClass extends JavadocTester {
- private static final String OUTPUT_DIR1 = "4506980-tmp1";
- private static final String OUTPUT_DIR2 = "4506980-tmp2";
- private static final String[] ARGS1 =
- new String[] {
- "-d", OUTPUT_DIR1, "-sourcepath", SRC_DIR,
- "-notimestamp", SRC_DIR + "/C5.java", "pkg1", "pkg2"
- };
- private static final String[] ARGS2 =
- new String[] {
- "-d", OUTPUT_DIR2, "-sourcepath", SRC_DIR,
- "-notimestamp", SRC_DIR + "/C5.java",
- SRC_DIR + "/pkg1/C1.java",
- SRC_DIR + "/pkg1/C2.java",
- SRC_DIR + "/pkg2/C3.java",
- SRC_DIR + "/pkg2/C4.java"
- };
- private static final String[] FILES_TO_DIFF = {
- "C5.html",
- "pkg1/C1.html",
- "pkg1/C2.html",
- "pkg2/C3.html",
- "pkg2/C4.html"
- };
+ public static void main(String... args) throws Exception {
+ TestCmndLineClass tester = new TestCmndLineClass();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ String outdir1 = "out-1";
+ String outdir2 = "out-2";
+
+ javadoc("-d", outdir1,
+ "-sourcepath", testSrc,
+ "-notimestamp",
+ testSrc("C5.java"), "pkg1", "pkg2");
+ checkExit(Exit.OK);
+ javadoc("-d", outdir2,
+ "-sourcepath", testSrc,
+ "-notimestamp",
+ testSrc("C5.java"),
+ testSrc("pkg1/C1.java"),
+ testSrc("pkg1/C2.java"),
+ testSrc("pkg2/C3.java"),
+ testSrc("pkg2/C4.java"));
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestCmndLineClass tester = new TestCmndLineClass();
- tester.run(ARGS1, NO_TEST, NO_TEST);
- tester.run(ARGS2, NO_TEST, NO_TEST);
- tester.runDiffs(OUTPUT_DIR1, OUTPUT_DIR2, FILES_TO_DIFF);
+ diff(outdir1, outdir2,
+ "C5.html",
+ "pkg1/C1.html",
+ "pkg1/C2.html",
+ "pkg2/C3.html",
+ "pkg2/C4.html");
}
}
--- a/langtools/test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java Fri May 23 09:05:24 2014 -0700
@@ -26,32 +26,28 @@
* @bug 8027977
* @summary Test to verify javadoc executes without CompletionFailure exception.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestCompletionFailure
+ * @library ../lib
+ * @build JavadocTester
* @run main TestCompletionFailure
*/
public class TestCompletionFailure extends JavadocTester {
- //Input for string search tests.
- private static final String[][] NEGATED_TEST = {
- {ERROR_OUTPUT, "TestCompletionFailure: error - " +
- "com.sun.tools.javac.code.Symbol$CompletionFailure: class file for " +
- "sun.util.locale.provider.LocaleProviderAdapter not found"
- }
- };
+ public static void main(String... args) throws Exception {
+ TestCompletionFailure tester = new TestCompletionFailure();
+ tester.runTests();
+ }
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) throws Exception {
- TestCompletionFailure tester = new TestCompletionFailure();
- tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput(Output.STDERR, false,
+ "TestCompletionFailure: error - "
+ + "com.sun.tools.javac.code.Symbol$CompletionFailure: class file for "
+ + "sun.util.locale.provider.LocaleProviderAdapter not found");
}
}
--- a/langtools/test/com/sun/javadoc/testConstantValuesPage/TestConstantValuesPage.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testConstantValuesPage/TestConstantValuesPage.java Fri May 23 09:05:24 2014 -0700
@@ -27,28 +27,26 @@
* @summary Test to make sure that constant values page does not get
* generated when doclet has nothing to document.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestConstantValuesPage
* @run main TestConstantValuesPage
*/
public class TestConstantValuesPage extends JavadocTester {
- private static final String[][] NEGATED_TEST = {
- {NOTICE_OUTPUT, "constant-values.html..."}
- };
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "foo"};
+ public static void main(String... args) throws Exception {
+ TestConstantValuesPage tester = new TestConstantValuesPage();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestConstantValuesPage tester = new TestConstantValuesPage();
- tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "foo");
+ checkExit(Exit.FAILED);
+
+ checkOutput(Output.NOTICE, false,
+ "constant-values.html...");
}
}
--- a/langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java Fri May 23 09:05:24 2014 -0700
@@ -27,37 +27,31 @@
* @summary The constructor comments should be surrounded by
* <dl></dl>. Check for this in the output.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestConstructorIndent
* @run main TestConstructorIndent
*/
public class TestConstructorIndent extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, SRC_DIR + "/C.java"
- };
+ public static void main(String... args) throws Exception {
+ TestConstructorIndent tester = new TestConstructorIndent();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "C.html", "<div class=\"block\">" +
- "This is just a simple constructor.</div>\n" +
- "<dl>\n" +
- "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
- "<dd><code>i</code> - a param.</dd>\n" +
- "</dl>"
- }
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ testSrc("C.java"));
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestConstructorIndent tester = new TestConstructorIndent();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("C.html", true,
+ "<div class=\"block\">"
+ + "This is just a simple constructor.</div>\n"
+ + "<dl>\n"
+ + "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n"
+ + "<dd><code>i</code> - a param.</dd>\n"
+ + "</dl>");
}
}
--- a/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java Fri May 23 09:05:24 2014 -0700
@@ -26,106 +26,66 @@
* @bug 8025524 8031625
* @summary Test for constructor name which should be a non-qualified name.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestConstructors
+ * @library ../lib
+ * @build JavadocTester
* @run main TestConstructors
*/
public class TestConstructors extends JavadocTester {
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg1/Outer.html",
- "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
- "<dd><a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, \n" +
- "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\"><code>Inner(int)</code></a>, \n" +
- "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\"><code>NestedInner()</code></a>, \n" +
- "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>NestedInner(int)</code></a>, \n" +
- "<a href=\"../pkg1/Outer.html#Outer--\"><code>Outer()</code></a>, \n" +
- "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>"
- },
- { "pkg1/Outer.html",
- "Link: <a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, " +
- "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>, " +
- "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>" +
- "NestedInner(int)</code></a>"
- },
- { "pkg1/Outer.html",
- "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()"
- },
- { "pkg1/Outer.html",
- "<a name=\"Outer--\">"
- },
- { "pkg1/Outer.html",
- "<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>(int i)"
- },
- { "pkg1/Outer.html",
- "<a name=\"Outer-int-\">"
- },
- { "pkg1/Outer.Inner.html",
- "<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()"
- },
- { "pkg1/Outer.Inner.html",
- "<a name=\"Inner--\">"
- },
- { "pkg1/Outer.Inner.html",
- "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>(int i)"
- },
- { "pkg1/Outer.Inner.html",
- "<a name=\"Inner-int-\">"
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()"
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- "<a name=\"NestedInner--\">"
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>(int i)"
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- "<a name=\"NestedInner-int-\">"
- }
- };
+ public static void main(String... args) throws Exception {
+ TestConstructors tester = new TestConstructors();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
- private static final String[][] NEGATED_TEST = {
- { "pkg1/Outer.Inner.html",
- "Outer.Inner--"
- },
- { "pkg1/Outer.Inner.html",
- "Outer.Inner-int-"
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- "Outer.Inner.NestedInner--"
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- "Outer.Inner.NestedInner-int-"
- },
- { "pkg1/Outer.html",
- "<a href=\"../pkg1/Outer.Inner.html#Outer.Inner--\"><code>Outer.Inner()</code></a>"
- },
- { "pkg1/Outer.html",
- "<a href=\"../pkg1/Outer.Inner.html#Outer.Inner-int-\"><code>Outer.Inner(int)</code></a>"
- },
- { "pkg1/Outer.html",
- "<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner--\"><code>Outer.Inner.NestedInner()</code></a>"
- },
- { "pkg1/Outer.html",
- "<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner-int-\"><code>Outer.Inner.NestedInner(int)</code></a>"
- }
- };
+ checkOutput("pkg1/Outer.html", true,
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ + "<dd><a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, \n"
+ + "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\"><code>Inner(int)</code></a>, \n"
+ + "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\"><code>NestedInner()</code></a>, \n"
+ + "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>NestedInner(int)</code></a>, \n"
+ + "<a href=\"../pkg1/Outer.html#Outer--\"><code>Outer()</code></a>, \n"
+ + "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>",
+ "Link: <a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, "
+ + "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>, "
+ + "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>"
+ + "NestedInner(int)</code></a>",
+ "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()",
+ "<a name=\"Outer--\">",
+ "<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>(int i)",
+ "<a name=\"Outer-int-\">");
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
- };
+ checkOutput("pkg1/Outer.Inner.html", true,
+ "<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()",
+ "<a name=\"Inner--\">",
+ "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>(int i)",
+ "<a name=\"Inner-int-\">");
+
+ checkOutput("pkg1/Outer.Inner.NestedInner.html", true,
+ "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()",
+ "<a name=\"NestedInner--\">",
+ "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>(int i)",
+ "<a name=\"NestedInner-int-\">");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) throws Exception {
- TestConstructors tester = new TestConstructors();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg1/Outer.Inner.html", false,
+ "Outer.Inner--",
+ "Outer.Inner-int-");
+
+ checkOutput("pkg1/Outer.Inner.NestedInner.html", false,
+ "Outer.Inner.NestedInner--",
+ "Outer.Inner.NestedInner-int-");
+
+ checkOutput("pkg1/Outer.html", false,
+ "<a href=\"../pkg1/Outer.Inner.html#Outer.Inner--\"><code>Outer.Inner()</code></a>",
+ "<a href=\"../pkg1/Outer.Inner.html#Outer.Inner-int-\"><code>Outer.Inner(int)</code></a>",
+ "<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner--\"><code>Outer.Inner.NestedInner()</code></a>",
+ "<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner-int-\"><code>Outer.Inner.NestedInner(int)</code></a>");
}
}
--- a/langtools/test/com/sun/javadoc/testCustomTag/TestCustomTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testCustomTag/TestCustomTag.java Fri May 23 09:05:24 2014 -0700
@@ -26,69 +26,67 @@
* @bug 8006248
* @summary Test custom tag. Verify that an unknown tag generates appropriate warnings.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester taglets.CustomTag TestCustomTag
+ * @library ../lib
+ * @build JavadocTester taglets.CustomTag
* @run main TestCustomTag
*/
public class TestCustomTag extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR, "-tagletpath", SRC_DIR,
- "-taglet", "taglets.CustomTag", "-sourcepath",
- SRC_DIR, SRC_DIR + "/TagTestClass.java"
- };
+ public static void main(String... args) throws Exception {
+ TestCustomTag tester = new TestCustomTag();
+ tester.runTests();
+ }
- private static final String[] ARGS1 = new String[] {
- "-d", OUTPUT_DIR + "-1", "-tagletpath",
- SRC_DIR, "-taglet", "taglets.CustomTag",
- "-sourcepath", SRC_DIR, SRC_DIR + "/TagTestClass.java"
- };
- private static final String[] ARGS2 = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-sourcepath",
- SRC_DIR, SRC_DIR + "/TagTestClass.java"
- };
+ @Test
+ void test1() {
+ javadoc("-Xdoclint:none",
+ "-d", "out-1",
+ "-tagletpath", testSrc, // TODO: probably useless
+ "-taglet", "taglets.CustomTag",
+ "-sourcepath", testSrc,
+ testSrc("TagTestClass.java"));
+ checkExit(Exit.OK);
- private static final String[] ARGS3 = new String[] {
- "-d", OUTPUT_DIR + "-3", "-sourcepath",
- SRC_DIR, SRC_DIR + "/TagTestClass.java"
- };
+ checkOutput(Output.WARNING, true,
+ "warning - @unknownTag is an unknown tag.");
+ }
- //Input for string search tests.
- private static final String[][] TEST = new String[][] {
- {WARNING_OUTPUT, "warning - @unknownTag is an unknown tag."
- }
- };
+ @Test
+ void test2() {
+ javadoc("-d", "out-2",
+ "-tagletpath", testSrc, // TODO: probably useless
+ "-taglet", "taglets.CustomTag",
+ "-sourcepath", testSrc,
+ testSrc("TagTestClass.java"));
+ checkExit(Exit.FAILED);
- private static final String[][] TEST1 = new String[][] {
- {ERROR_OUTPUT, "error: unknown tag: unknownTag"
- }
- };
- private static final String[][] TEST2 = new String[][] {
- {WARNING_OUTPUT, "warning - @customTag is an unknown tag."
- },
- {WARNING_OUTPUT, "warning - @unknownTag is an unknown tag."
- }
- };
+ checkOutput(Output.ERROR, true,
+ "error: unknown tag: unknownTag");
+ }
+
+ @Test
+ void test3() {
+ javadoc("-Xdoclint:none",
+ "-d", "out-3",
+ "-sourcepath", testSrc,
+ testSrc("TagTestClass.java"));
+ checkExit(Exit.OK);
- private static final String[][] TEST3 = new String[][] {
- {ERROR_OUTPUT, "error: unknown tag: customTag"
- },
- {ERROR_OUTPUT, "error: unknown tag: unknownTag"
- }
- };
+ checkOutput(Output.WARNING, true,
+ "warning - @customTag is an unknown tag.",
+ "warning - @unknownTag is an unknown tag.");
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestCustomTag tester = new TestCustomTag();
- tester.run(ARGS, TEST, NO_TEST);
- tester.run(ARGS1, TEST1, NO_TEST);
- tester.run(ARGS2, TEST2, NO_TEST);
- tester.run(ARGS3, TEST3, NO_TEST);
- tester.printSummary();
+ @Test
+ void test4() {
+ javadoc("-d", "out-4",
+ "-sourcepath", testSrc,
+ testSrc("TagTestClass.java"));
+ checkExit(Exit.FAILED);
+
+ checkOutput(Output.ERROR, true,
+ "error: unknown tag: customTag",
+ "error: unknown tag: unknownTag");
}
}
--- a/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java Fri May 23 09:05:24 2014 -0700
@@ -26,76 +26,65 @@
* @bug 4927552 8026567
* @summary <DESC>
* @author jamieh
- * @library ../lib/
- * @build JavadocTester TestDeprecatedDocs
+ * @library ../lib
+ * @build JavadocTester
* @run main TestDeprecatedDocs
*/
public class TestDeprecatedDocs extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestDeprecatedDocs tester = new TestDeprecatedDocs();
+ tester.runTests();
+ }
- private static final String TARGET_FILE =
- "deprecated-list.html";
-
- private static final String TARGET_FILE2 =
- "pkg/DeprecatedClassByAnnotation.html";
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- //Input for string search tests.
- private static final String[][] TEST = {
- {TARGET_FILE, "annotation_test1 passes"},
- {TARGET_FILE, "annotation_test2 passes"},
- {TARGET_FILE, "annotation_test3 passes"},
- {TARGET_FILE, "class_test1 passes"},
- {TARGET_FILE, "class_test2 passes"},
- {TARGET_FILE, "class_test3 passes"},
- {TARGET_FILE, "class_test4 passes"},
- {TARGET_FILE, "enum_test1 passes"},
- {TARGET_FILE, "enum_test2 passes"},
- {TARGET_FILE, "error_test1 passes"},
- {TARGET_FILE, "error_test2 passes"},
- {TARGET_FILE, "error_test3 passes"},
- {TARGET_FILE, "error_test4 passes"},
- {TARGET_FILE, "exception_test1 passes"},
- {TARGET_FILE, "exception_test2 passes"},
- {TARGET_FILE, "exception_test3 passes"},
- {TARGET_FILE, "exception_test4 passes"},
- {TARGET_FILE, "interface_test1 passes"},
- {TARGET_FILE, "interface_test2 passes"},
- {TARGET_FILE, "interface_test3 passes"},
- {TARGET_FILE, "interface_test4 passes"},
- {TARGET_FILE, "pkg.DeprecatedClassByAnnotation"},
- {TARGET_FILE, "pkg.DeprecatedClassByAnnotation()"},
- {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.method()"},
- {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"},
+ checkOutput("deprecated-list.html", true,
+ "annotation_test1 passes",
+ "annotation_test2 passes",
+ "annotation_test3 passes",
+ "class_test1 passes",
+ "class_test2 passes",
+ "class_test3 passes",
+ "class_test4 passes",
+ "enum_test1 passes",
+ "enum_test2 passes",
+ "error_test1 passes",
+ "error_test2 passes",
+ "error_test3 passes",
+ "error_test4 passes",
+ "exception_test1 passes",
+ "exception_test2 passes",
+ "exception_test3 passes",
+ "exception_test4 passes",
+ "interface_test1 passes",
+ "interface_test2 passes",
+ "interface_test3 passes",
+ "interface_test4 passes",
+ "pkg.DeprecatedClassByAnnotation",
+ "pkg.DeprecatedClassByAnnotation()",
+ "pkg.DeprecatedClassByAnnotation.method()",
+ "pkg.DeprecatedClassByAnnotation.field"
+ );
- {TARGET_FILE2, "<pre>@Deprecated\n" +
- "public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>\n" +
- "extends java.lang.Object</pre>"},
-
- {TARGET_FILE2, "<pre>@Deprecated\n" +
- "public int field</pre>\n" +
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"},
-
- {TARGET_FILE2, "<pre>@Deprecated\n" +
- "public DeprecatedClassByAnnotation()</pre>\n" +
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"},
-
- {TARGET_FILE2, "<pre>@Deprecated\n" +
- "public void method()</pre>\n" +
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"},
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestDeprecatedDocs tester = new TestDeprecatedDocs();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/DeprecatedClassByAnnotation.html", true,
+ "<pre>@Deprecated\n"
+ + "public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>\n"
+ + "extends java.lang.Object</pre>",
+ "<pre>@Deprecated\n"
+ + "public int field</pre>\n"
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>",
+ "<pre>@Deprecated\n"
+ + "public DeprecatedClassByAnnotation()</pre>\n"
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>",
+ "<pre>@Deprecated\n"
+ + "public void method()</pre>\n"
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>");
}
}
--- a/langtools/test/com/sun/javadoc/testDocEncoding/TestDocEncoding.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testDocEncoding/TestDocEncoding.java Fri May 23 09:05:24 2014 -0700
@@ -31,36 +31,30 @@
* @summary Run tests on -docencoding to see if the value is
used for stylesheet as well.
* @author jayashree viswanathan
- * @library ../lib/
- * @build JavadocTester TestDocEncoding
+ * @library ../lib
+ * @build JavadocTester
* @run main TestDocEncoding
*/
public class TestDocEncoding extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR,
- "-docencoding", "Cp930",
- "-sourcepath", SRC_DIR,
- "-notimestamp",
- "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestDocEncoding tester = new TestDocEncoding();
+ tester.runTests();
+ }
- private static final String[][] NEGATED_TEST = {
- { "stylesheet.css",
- "body {\n" +
- " background-color:#ffffff;"}
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-docencoding", "Cp930",
+ "-sourcepath", testSrc,
+ "-notimestamp",
+ "pkg");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestDocEncoding tester = new TestDocEncoding();
- tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("stylesheet.css", false,
+ "body {\n"
+ + " background-color:#ffffff;");
}
}
--- a/langtools/test/com/sun/javadoc/testDocErrorReporter/TestDocErrorReporter.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testDocErrorReporter/TestDocErrorReporter.java Fri May 23 09:05:24 2014 -0700
@@ -27,31 +27,30 @@
* @summary Make sure that option validation errors and sent to the
* DocErrorReporter.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestDocErrorReporter
* @run main TestDocErrorReporter
*/
public class TestDocErrorReporter extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-encoding", "xyz",
- SRC_DIR + "/TestDocErrorReporter.java"
- };
-
- //Input for Javadoc return code test.
- private static final int EXPECTED_EXIT_CODE = 1;
-
/**
* The entry point of the test.
- * @param args the array of command line arguments.
+ * @param args the array of command line arguments
+ * @throws Exception if the test fails
*/
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestDocErrorReporter tester = new TestDocErrorReporter();
- int actualExitCode = tester.run(ARGS, NO_TEST, NO_TEST);
- tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-encoding", "xyz",
+ testSrc("TestDocErrorReporter.java"));
+
+ checkExit(Exit.FAILED);
}
}
--- a/langtools/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java Fri May 23 09:05:24 2014 -0700
@@ -21,8 +21,6 @@
* questions.
*/
-import java.io.File;
-
/*
* @test
* @bug 4258405 4973606 8024096
@@ -31,68 +29,59 @@
* directory.
* Also test that -docfilessubdirs and -excludedocfilessubdir both work.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestDocFileDir
* @run main TestDocFileDir
*/
public class TestDocFileDir extends JavadocTester {
- private static final String[][] TEST1 = {
- { "pkg/doc-files/testfile.txt",
- "This doc file did not get trashed."}
- };
+ public static void main(String... args) throws Exception {
+ TestDocFileDir tester = new TestDocFileDir();
+ tester.runTests();
+ }
- private static final String[] FILE_TEST2 = {
- "pkg/doc-files/subdir-used1/testfile.txt",
- "pkg/doc-files/subdir-used2/testfile.txt"
- };
- private static final String[] FILE_NEGATED_TEST2 = {
- "pkg/doc-files/subdir-excluded1/testfile.txt",
- "pkg/doc-files/subdir-excluded2/testfile.txt"
- };
-
- private static final String[][] TEST0 = {
- {"pkg/doc-files/testfile.txt",
- "This doc file did not get trashed."}
- };
-
- //Output dir = Input Dir
- private static final String[] ARGS1 =
- new String[] {
- "-d", OUTPUT_DIR + "-1",
- "-sourcepath",
- "blah" + File.pathSeparator + OUTPUT_DIR + "-1" +
- File.pathSeparator + "blah", "pkg"};
+ // Output dir = "", Input dir = ""
+ @Test
+ void test1() {
+ copyDir(testSrc("pkg"), ".");
+ setOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
+ javadoc("pkg/C.java");
+ checkExit(Exit.OK);
+ checkOutput("pkg/doc-files/testfile.txt", true,
+ "This doc file did not get trashed.");
+ }
- //Exercising -docfilessubdirs and -excludedocfilessubdir
- private static final String[] ARGS2 =
- new String[] {
- "-d", OUTPUT_DIR + "-2",
- "-sourcepath", SRC_DIR,
- "-docfilessubdirs",
- "-excludedocfilessubdir", "subdir-excluded1:subdir-excluded2",
- "pkg"};
-
- //Output dir = "", Input dir = ""
- private static final String[] ARGS0 =
- new String[] {"pkg/C.java"};
-
+ // Output dir = Input Dir
+ @Test
+ void test2() {
+ String outdir = "out2";
+ copyDir(testSrc("pkg"), outdir);
+ setOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
+ javadoc("-d", outdir,
+ "-sourcepath", "blah" + PS + outdir + PS + "blah",
+ "pkg");
+ checkExit(Exit.OK);
+ checkOutput("pkg/doc-files/testfile.txt", true,
+ "This doc file did not get trashed.");
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestDocFileDir tester = new TestDocFileDir();
- tester.setCheckOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
- copyDir(SRC_DIR + "/pkg", ".");
- tester.run(ARGS0, TEST0, NO_TEST);
- copyDir(SRC_DIR + "/pkg", OUTPUT_DIR + "-1");
- tester.run(ARGS1, TEST1, NO_TEST);
- tester.setCheckOutputDirectoryCheck(DirectoryCheck.NONE);
- tester.run(ARGS2, NO_TEST, NO_TEST, FILE_TEST2, FILE_NEGATED_TEST2);
- tester.printSummary();
+ // Exercising -docfilessubdirs and -excludedocfilessubdir
+ @Test
+ void test3() {
+ String outdir = "out3";
+ setOutputDirectoryCheck(DirectoryCheck.NONE);
+ javadoc("-d", outdir,
+ "-sourcepath", testSrc,
+ "-docfilessubdirs",
+ "-excludedocfilessubdir", "subdir-excluded1:subdir-excluded2",
+ "pkg");
+ checkExit(Exit.OK);
+ checkFiles(true,
+ "pkg/doc-files/subdir-used1/testfile.txt",
+ "pkg/doc-files/subdir-used2/testfile.txt");
+ checkFiles(false,
+ "pkg/doc-files/subdir-excluded1/testfile.txt",
+ "pkg/doc-files/subdir-excluded2/testfile.txt");
}
}
--- a/langtools/test/com/sun/javadoc/testDocFiles/TestDocFiles.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testDocFiles/TestDocFiles.java Fri May 23 09:05:24 2014 -0700
@@ -25,28 +25,26 @@
* @test
* @bug 8008949
* @summary verify that doc-files get copied
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestDocFiles
* @run main TestDocFiles
*/
public class TestDocFiles extends JavadocTester {
- private static final String[][] TEST = {
- { "pkg/doc-files/test.txt", "test file"}};
-
- private static final String[] ARGS =
- new String[] {
- "-d", "tmp", "-sourcepath", SRC_DIR, "pkg"};
+ public static void main(String... args) throws Exception {
+ TestDocFiles tester = new TestDocFiles();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestDocFiles tester = new TestDocFiles();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/doc-files/test.txt", true,
+ "test file");
}
}
--- a/langtools/test/com/sun/javadoc/testDocRootInlineTag/TestDocRootInlineTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testDocRootInlineTag/TestDocRootInlineTag.java Fri May 23 09:05:24 2014 -0700
@@ -28,42 +28,38 @@
* If docRoot performs as documented, the test passes.
* Make sure that the docRoot tag works with the -bottom option.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestDocRootInlineTag
* @run main TestDocRootInlineTag
*/
public class TestDocRootInlineTag extends JavadocTester {
- private static final String[][] TEST = {
- { "TestDocRootTag.html",
- "<a href=\"http://www.java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" " +
- "title=\"class or interface in java.io\"><code>File</code></a>"},
- { "TestDocRootTag.html",
- "<a href=\"./glossary.html\">glossary</a>"},
- { "TestDocRootTag.html",
- "<a href=\"http://www.java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" " +
- "title=\"class or interface in java.io\"><code>Second File Link</code></a>"},
- { "TestDocRootTag.html", "The value of @docRoot is \"./\""},
- { "index-all.html", "My package page is " +
- "<a href=\"./pkg/package-summary.html\">here</a>"}
- };
- private static final String[] ARGS =
- new String[] {
- "-bottom", "The value of @docRoot is \"{@docRoot}\"",
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-linkoffline", "http://www.java.sun.com/j2se/1.4/docs/api",
- SRC_DIR, SRC_DIR + "/TestDocRootTag.java", "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestDocRootInlineTag tester = new TestDocRootInlineTag();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ String uri = "http://www.java.sun.com/j2se/1.4/docs/api";
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestDocRootInlineTag tester = new TestDocRootInlineTag();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ javadoc("-bottom", "The value of @docRoot is \"{@docRoot}\"",
+ "-d", "out",
+ "-sourcepath", testSrc,
+ "-linkoffline", uri, testSrc,
+ testSrc("TestDocRootTag.java"), "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("TestDocRootTag.html", true,
+ "<a href=\"" + uri + "/java/io/File.html?is-external=true\" "
+ + "title=\"class or interface in java.io\"><code>File</code></a>",
+ "<a href=\"./glossary.html\">glossary</a>",
+ "<a href=\"" + uri + "/java/io/File.html?is-external=true\" "
+ + "title=\"class or interface in java.io\"><code>Second File Link</code></a>",
+ "The value of @docRoot is \"./\"");
+
+ checkOutput("index-all.html", true,
+ "My package page is <a href=\"./pkg/package-summary.html\">here</a>");
}
}
--- a/langtools/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java Fri May 23 09:05:24 2014 -0700
@@ -26,109 +26,78 @@
* @bug 6553182 8025416 8029504
* @summary This test verifies the -Xdocrootparent option.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestDocRootLink
+ * @library ../lib
+ * @build JavadocTester
* @run main TestDocRootLink
*/
public class TestDocRootLink extends JavadocTester {
- private static final String[][] TEST1 = {
- { "pkg1/C1.html",
- "Refer <a href=\"../../technotes/guides/index.html\">Here</a>"
- },
- { "pkg1/C1.html",
+ public static void main(String... args) throws Exception {
+ TestDocRootLink tester = new TestDocRootLink();
+ tester.runTests();
+ }
+
+ @Test
+ void test1() {
+ javadoc("-d", "out-1",
+ "-sourcepath", testSrc,
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg1/C1.html", true,
+ "Refer <a href=\"../../technotes/guides/index.html\">Here</a>",
"This <a href=\"../pkg2/C2.html\">Here</a> should not be replaced\n" +
- " with an absolute link."
- },
- { "pkg1/C1.html",
- "Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
- " <a href=\"../pkg2/C2.html\">Link 2</a>."
- },
- { "pkg1/package-summary.html",
- "<a href=\"../../technotes/guides/index.html\">\n" +
- " Test document 1</a>"
- },
- { "pkg1/package-summary.html",
- "<a href=\"../pkg2/C2.html\">\n" +
- " Another Test document 1</a>"
- },
- { "pkg1/package-summary.html",
- "<a href=\"../technotes/guides/index.html\">\n" +
- " Another Test document 2.</a>"
- }
- };
- private static final String[][] NEGATED_TEST1 = {
- { "pkg1/C1.html",
- "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
- },
- { "pkg1/C1.html",
- "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
- },
- { "pkg1/package-summary.html",
- "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
- },
- { "pkg1/package-summary.html",
- "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
- }
- };
- private static final String[][] TEST2 = {
- { "pkg2/C2.html",
- "Refer <a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a>"
- },
- { "pkg2/C2.html",
- "This <a href=\"../pkg1/C1.html\">Here</a> should not be replaced\n" +
- " with an absolute link."
- },
- { "pkg2/C2.html",
+ " with an absolute link.",
"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
- " <a href=\"../pkg1/C1.html\">Link 2</a>."
- },
- { "pkg2/package-summary.html",
- "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">\n" +
- " Test document 1</a>"
- },
- { "pkg2/package-summary.html",
- "<a href=\"../pkg1/C1.html\">\n" +
- " Another Test document 1</a>"
- },
- { "pkg2/package-summary.html",
+ " <a href=\"../pkg2/C2.html\">Link 2</a>.");
+
+ checkOutput("pkg1/package-summary.html", true,
+ "<a href=\"../../technotes/guides/index.html\">\n" +
+ " Test document 1</a>",
+ "<a href=\"../pkg2/C2.html\">\n" +
+ " Another Test document 1</a>",
"<a href=\"../technotes/guides/index.html\">\n" +
- " Another Test document 2.</a>"
- }
- };
- private static final String[][] NEGATED_TEST2 = {
- { "pkg2/C2.html",
- "<a href=\"../../technotes/guides/index.html\">"
- },
- { "pkg2/C2.html",
- "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
- },
- { "pkg2/package-summary.html",
- "<a href=\"../../technotes/guides/index.html\">"
- },
- { "pkg2/package-summary.html",
- "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
- }
- };
- private static final String[] ARGS1 =
- new String[]{
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1", "pkg2"
- };
- private static final String[] ARGS2 =
- new String[]{
- "-d", OUTPUT_DIR + "-1", "-Xdocrootparent",
- "http://download.oracle.com/javase/7/docs", "-sourcepath",
- SRC_DIR, "pkg1", "pkg2"
- };
+ " Another Test document 2.</a>");
+
+ // TODO: should this check *any* reference to http://download.oracle.com/
+ checkOutput("pkg1/C1.html", false,
+ "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">",
+ "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">");
+
+ checkOutput("pkg1/package-summary.html", false,
+ "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">",
+ "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">");
+ }
+
+ @Test
+ void test2() {
+ javadoc("-d", "out-2",
+ "-Xdocrootparent", "http://download.oracle.com/javase/7/docs",
+ "-sourcepath", testSrc,
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestDocRootLink tester = new TestDocRootLink();
- tester.run(ARGS1, TEST1, NEGATED_TEST1);
- tester.run(ARGS2, TEST2, NEGATED_TEST2);
- tester.printSummary();
+ checkOutput("pkg2/C2.html", true,
+ "Refer <a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a>",
+ "This <a href=\"../pkg1/C1.html\">Here</a> should not be replaced\n" +
+ " with an absolute link.",
+ "Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
+ " <a href=\"../pkg1/C1.html\">Link 2</a>.");
+
+ checkOutput("pkg2/package-summary.html", true,
+ "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">\n" +
+ " Test document 1</a>",
+ "<a href=\"../pkg1/C1.html\">\n" +
+ " Another Test document 1</a>",
+ "<a href=\"../technotes/guides/index.html\">\n" +
+ " Another Test document 2.</a>");
+
+ checkOutput("pkg2/C2.html", false,
+ "<a href=\"../../technotes/guides/index.html\">",
+ "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">");
+
+ checkOutput("pkg2/package-summary.html", false,
+ "<a href=\"../../technotes/guides/index.html\">",
+ "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">");
}
}
--- a/langtools/test/com/sun/javadoc/testDupParamWarn/TestDupParamWarn.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testDupParamWarn/TestDupParamWarn.java Fri May 23 09:05:24 2014 -0700
@@ -27,28 +27,26 @@
* @summary Test to ensure that the doclet does not print out bad
* warning messages about duplicate param tags.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestDupParamWarn
* @run main TestDupParamWarn
*/
public class TestDupParamWarn extends JavadocTester {
- private static final String[] ARGS =
- new String[] {"-d", OUTPUT_DIR, "-sourcepath",
- SRC_DIR + "/", "pkg"};
- private static final String[][] NEGATED_TEST =
- new String[][] {{WARNING_OUTPUT,
- "Parameter \"a\" is documented more than once."}};
+ public static void main(String... args) throws Exception {
+ JavadocTester tester = new TestDupParamWarn();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- JavadocTester tester = new TestDupParamWarn();
- tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput(Output.WARNING, false,
+ "Parameter \"a\" is documented more than once.");
}
}
--- a/langtools/test/com/sun/javadoc/testEmptyClass/TestEmptyClass.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testEmptyClass/TestEmptyClass.java Fri May 23 09:05:24 2014 -0700
@@ -27,39 +27,32 @@
* @summary Test to make sure that Javadoc behaves properly when
* run on a completely empty class (no comments or members).
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestEmptyClass
* @run main TestEmptyClass
*/
public class TestEmptyClass extends JavadocTester {
- private static final String[][] NEGATED_TEST = {
+ public static void main(String... args) throws Exception {
+ TestEmptyClass tester = new TestEmptyClass();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-classpath", testSrc("src"),
+ "-d", "out",
+ "-sourcepath", testSrc("src"),
+ testSrc("src/Empty.java"));
+ checkExit(Exit.OK);
//The overview tree should not link to classes that were not documented
- { "overview-tree.html", "<A HREF=\"TestEmptyClass.html\">"},
+ checkOutput("overview-tree.html", false,
+ "<A HREF=\"TestEmptyClass.html\">");
//The index page should not link to classes that were not documented
- { "index-all.html", "<A HREF=\"TestEmptyClass.html\">"},
- };
- private static final String[] ARGS =
- new String[] {
- "-classpath", SRC_DIR + "/src",
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR + "/src",
- SRC_DIR + "/src/Empty.java"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestEmptyClass tester = new TestEmptyClass();
- int exitCode = tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
- if (exitCode != 0) {
- throw new Error("Error found while executing Javadoc");
- }
+ checkOutput("index-all.html", false,
+ "<A HREF=\"TestEmptyClass.html\">");
}
}
--- a/langtools/test/com/sun/javadoc/testEnclosingClass/TestEnclosingClass.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testEnclosingClass/TestEnclosingClass.java Fri May 23 09:05:24 2014 -0700
@@ -26,31 +26,26 @@
* @bug 5008230
* @summary Check the outer class when documenting enclosing class/interface.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestEnclosingClass
* @run main TestEnclosingClass
*/
public class TestEnclosingClass extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestEnclosingClass tester = new TestEnclosingClass();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/MyClass.MyInterface.html", "Enclosing class:"}
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestEnclosingClass tester = new TestEnclosingClass();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/MyClass.MyInterface.html", true,
+ "Enclosing class:");
}
}
--- a/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java Fri May 23 09:05:24 2014 -0700
@@ -27,32 +27,28 @@
* @summary This test determines if the value of the -encoding option is
* properly passed from Javadoc to the source file parser.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestEncoding
* @run main TestEncoding
*/
public class TestEncoding extends JavadocTester {
+ public static void main(String... args) throws Exception {
+ TestEncoding tester = new TestEncoding();
+ tester.runTests();
+ }
- //If ??? is found in the output, the source file was not read with the correct encoding setting.
- private static final String[][] NEGATED_TEST = {
- { "EncodeTest.html", "??"}
- };
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-encoding", "iso-8859-1", SRC_DIR + "/EncodeTest.java"
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-encoding", "iso-8859-1",
+ testSrc("EncodeTest.java"));
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestEncoding tester = new TestEncoding();
- tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
+ // If ??? is found in the output, the source file was not read with the correct encoding setting.
+ checkOutput("EncodeTest.html", false,
+ "??");
}
}
--- a/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Fri May 23 09:05:24 2014 -0700
@@ -28,41 +28,38 @@
* are documented properly. The method should still include "implements" or
* "overrides" documentation even though the method is external.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester TestExternalOverridenMethod
* @run main TestExternalOverridenMethod
*/
public class TestExternalOverridenMethod extends JavadocTester {
- private static final String[][] TEST = {
- { "pkg/XReader.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read--\" " +
- "title=\"class or interface in java.io\">read</a></code> in class <code>" +
- "<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\" " +
- "title=\"class or interface in java.io\">FilterReader</a></code></dd>"},
- { "pkg/XReader.html",
- "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" +
- "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt--\" " +
- "title=\"class or interface in java.io\">readInt</a></code> in interface <code>" +
- "<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\" " +
- "title=\"class or interface in java.io\">DataInput</a></code></dd>"}};
+ public static void main(String... args) throws Exception {
+ TestExternalOverridenMethod tester = new TestExternalOverridenMethod();
+ tester.runTests();
+ }
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-linkoffline", "http://java.sun.com/j2se/1.4.1/docs/api", SRC_DIR,
- "pkg"
- };
+ @Test
+ void test() {
+ String uri = "http://java.sun.com/j2se/1.4.1/docs/api";
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-linkoffline", uri, testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestExternalOverridenMethod tester = new TestExternalOverridenMethod();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/XReader.html", true,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"" + uri + "/java/io/FilterReader.html?is-external=true#read--\" "
+ + "title=\"class or interface in java.io\">read</a></code> in class <code>"
+ + "<a href=\"" + uri + "/java/io/FilterReader.html?is-external=true\" "
+ + "title=\"class or interface in java.io\">FilterReader</a></code></dd>",
+ "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ + "<dd><code><a href=\"" + uri + "/java/io/DataInput.html?is-external=true#readInt--\" "
+ + "title=\"class or interface in java.io\">readInt</a></code> in interface <code>"
+ + "<a href=\"" + uri + "/java/io/DataInput.html?is-external=true\" "
+ + "title=\"class or interface in java.io\">DataInput</a></code></dd>"
+ );
}
}
--- a/langtools/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java Fri May 23 09:05:24 2014 -0700
@@ -25,14 +25,41 @@
* @test
* @bug 8000418 8024288
* @summary Verify that files use a common Generated By string
- * @library ../lib/
- * @build JavadocTester TestGeneratedBy
+ * @library ../lib
+ * @build JavadocTester
* @run main TestGeneratedBy
*/
public class TestGeneratedBy extends JavadocTester {
- private static final String[] FILES = {
+ public static void main(String... args) throws Exception {
+ TestGeneratedBy tester = new TestGeneratedBy();
+ tester.runTests();
+ }
+
+ @Test
+ void testTimestamp() {
+ javadoc("-d", "out-timestamp",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkTimestamps(true);
+ }
+
+ @Test
+ void testNoTimestamp() {
+ javadoc("-d", "out-notimestamp",
+ "-notimestamp",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkTimestamps(false);
+ }
+
+ void checkTimestamps(boolean timestamp) {
+ checkTimestamps(timestamp,
"pkg/MyClass.html",
"pkg/package-summary.html",
"pkg/package-frame.html",
@@ -45,63 +72,25 @@
"serialized-form.html",
"help-doc.html",
"index-all.html",
- "index.html"
- };
-
- private static final String[] STD_ARGS =
- new String[] {
- "-d", OUTPUT_DIR,
- "-sourcepath", SRC_DIR,
- "pkg"
- };
+ "index.html");
- private static final String[] NO_TIMESTAMP_ARGS =
- new String[] {
- "-notimestamp",
- "-d", OUTPUT_DIR + "-1",
- "-sourcepath", SRC_DIR,
- "pkg"
- };
-
-
- private static String[][] getTests(boolean timestamp) {
- String version = System.getProperty("java.version");
- String[][] tests = new String[FILES.length][];
- for (int i = 0; i < FILES.length; i++) {
- String genBy = "Generated by javadoc";
- if (timestamp) genBy += " (" + version + ") on ";
- tests[i] = new String[] {
- FILES[i], genBy
- };
- }
- return tests;
}
- private static String[][] getNegatedTests(boolean timestamp) {
- String[][] tests = new String[FILES.length][];
- for (int i = 0; i < FILES.length; i++) {
- tests[i] = new String[] {
- FILES[i],
+ void checkTimestamps(boolean timestamp, String... files) {
+ String version = System.getProperty("java.version");
+ String genBy = "Generated by javadoc";
+ if (timestamp) genBy += " (" + version + ") on ";
+
+ for (String file: files) {
+ // genBy is the current standard "Generated by" text
+ checkOutput(file, true, genBy);
+
+ // These are older versions of the "Generated by" text
+ checkOutput(file, false,
(timestamp
? "Generated by javadoc (version"
: "Generated by javadoc ("),
- "Generated by javadoc on"
- };
- }
- return tests;
- }
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestGeneratedBy tester = new TestGeneratedBy();
- int ec1 = tester.run(STD_ARGS, getTests(true), getNegatedTests(true));
- int ec2 = tester.run(NO_TIMESTAMP_ARGS, getTests(false), getNegatedTests(false));
- tester.printSummary();
- if (ec1 != 0 || ec2 != 0) {
- throw new Error("Error found while executing Javadoc");
+ "Generated by javadoc on");
}
}
}
--- a/langtools/test/com/sun/javadoc/testGroupOption/TestGroupOption.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testGroupOption/TestGroupOption.java Fri May 23 09:05:24 2014 -0700
@@ -27,49 +27,46 @@
* @summary Test to make sure the -group option does not cause a bad warning
* to be printed.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestGroupOption
* @run main TestGroupOption
*/
public class TestGroupOption extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS1 = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-group", "Package One", "pkg1",
- "-group", "Package Two", "pkg2",
- "-group", "Package Three", "pkg3",
- "pkg1", "pkg2", "pkg3"
- };
+ public static void main(String... args) throws Exception {
+ TestGroupOption tester = new TestGroupOption();
+ tester.runTests();
+ }
- private static final String[] ARGS2 = new String[] {
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR,
- "-group", "Package One", "pkg1",
- "-group", "Package One", "pkg2",
- "-group", "Package One", "pkg3",
- "pkg1", "pkg2", "pkg3"
- };
+ @Test
+ void test1() {
+ //Make sure the warning is not printed when -group is used correctly.
+ javadoc("-d", "out-1",
+ "-sourcepath", testSrc,
+ "-group", "Package One", "pkg1",
+ "-group", "Package Two", "pkg2",
+ "-group", "Package Three", "pkg3",
+ "pkg1", "pkg2", "pkg3");
+ checkExit(Exit.OK);
- //Input for string search tests.
- private static final String[][] NEGATED_TEST1 = {{WARNING_OUTPUT, "-group"}};
-
- private static final String[][] TEST2 = {{WARNING_OUTPUT, "-group"}};
+ checkOutput(Output.WARNING, false,
+ "-group");
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- //Make sure the warning is not printed when -group is used correctly.
- TestGroupOption tester = new TestGroupOption();
- tester.run(ARGS1, NO_TEST, NEGATED_TEST1);
- tester.printSummary();
+ @Test
+ void test2() {
+ //Make sure the warning is printed when -group is not used correctly.
+ javadoc("-d", "out-2",
+ "-sourcepath", testSrc,
+ "-group", "Package One", "pkg1",
+ "-group", "Package One", "pkg2",
+ "-group", "Package One", "pkg3",
+ "pkg1", "pkg2", "pkg3");
+ checkExit(Exit.OK);
- //Make sure the warning is printed when -group is not used correctly.
- tester = new TestGroupOption();
- tester.run(ARGS2, TEST2, NO_TEST);
- tester.printSummary();
+ checkOutput(Output.WARNING, true,
+ "-group");
+
}
}
--- a/langtools/test/com/sun/javadoc/testHeadings/TestHeadings.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHeadings/TestHeadings.java Fri May 23 09:05:24 2014 -0700
@@ -26,7 +26,7 @@
* @bug 4905786 6259611
* @summary Make sure that headings use the TH tag instead of the TD tag.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
* @build TestHeadings
* @run main TestHeadings
@@ -34,87 +34,82 @@
public class TestHeadings extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "-header", "Test Files",
- "pkg1", "pkg2"
- };
-
- //Input for string search tests.
private static final String[][] TEST = {
- //Package summary
- { "pkg1/package-summary.html",
- "<th class=\"colFirst\" scope=\"col\">" +
- "Class</th>\n" +
- "<th class=\"colLast\" scope=\"col\"" +
- ">Description</th>"
- },
- // Class documentation
- { "pkg1/C1.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
- },
- { "pkg1/C1.html",
- "<h3>Methods inherited from class java.lang.Object</h3>"
+ {
},
-
- // Class use documentation
- { "pkg1/class-use/C1.html",
- "<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Description</th>"
+ { "serialized-form.html"
},
- { "pkg1/class-use/C1.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
+ { "serialized-form.html"
},
- // Deprecated
- { "deprecated-list.html",
- "<th class=\"colOne\" scope=\"col\">Method and Description</th>"
- },
-
- // Constant values
- { "constant-values.html",
- "<th class=\"colFirst\" scope=\"col\">" +
- "Modifier and Type</th>\n" +
- "<th scope=\"col\">Constant Field</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Value</th>"
- },
-
- // Serialized Form
- { "serialized-form.html",
- "<h2 title=\"Package\">Package pkg1</h2>"
+ {
},
- { "serialized-form.html",
- "<h3>Class <a href=\"pkg1/C1.html\" title=\"class in pkg1\">" +
- "pkg1.C1</a> extends java.lang.Object implements Serializable</h3>"
- },
- { "serialized-form.html",
- "<h3>Serialized Fields</h3>"
+ { "overview-frame.html"
},
-
- // Overview Frame
- { "overview-frame.html",
- "<h1 title=\"Test Files\" class=\"bar\">Test Files</h1>"
- },
- { "overview-frame.html",
- "<title>Overview List</title>"
- },
-
- // Overview Summary
- { "overview-summary.html",
- "<title>Overview</title>"
+ {
}
};
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestHeadings tester = new TestHeadings();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-use",
+ "-header", "Test Files",
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
+
+ //Package summary
+ checkOutput("pkg1/package-summary.html", true,
+ "<th class=\"colFirst\" scope=\"col\">"
+ + "Class</th>\n"
+ + "<th class=\"colLast\" scope=\"col\""
+ + ">Description</th>");
+
+ // Class documentation
+ checkOutput("pkg1/C1.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
+ "<h3>Methods inherited from class java.lang.Object</h3>");
+
+ // Class use documentation
+ checkOutput("pkg1/class-use/C1.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Description</th>",
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Field and Description</th>");
+
+ // Deprecated
+ checkOutput("deprecated-list.html", true,
+ "<th class=\"colOne\" scope=\"col\">Method and Description</th>");
+
+ // Constant values
+ checkOutput("constant-values.html", true,
+ "<th class=\"colFirst\" scope=\"col\">"
+ + "Modifier and Type</th>\n"
+ + "<th scope=\"col\">Constant Field</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Value</th>");
+
+ // Serialized Form
+ checkOutput("serialized-form.html", true,
+ "<h2 title=\"Package\">Package pkg1</h2>",
+ "<h3>Class <a href=\"pkg1/C1.html\" title=\"class in pkg1\">"
+ + "pkg1.C1</a> extends java.lang.Object implements Serializable</h3>",
+ "<h3>Serialized Fields</h3>");
+
+ // Overview Frame
+ checkOutput("overview-frame.html", true,
+ "<h1 title=\"Test Files\" class=\"bar\">Test Files</h1>",
+ "<title>Overview List</title>");
+
+ // Overview Summary
+ checkOutput("overview-summary.html", true,
+ "<title>Overview</title>");
}
}
--- a/langtools/test/com/sun/javadoc/testHelpFile/TestHelpFile.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHelpFile/TestHelpFile.java Fri May 23 09:05:24 2014 -0700
@@ -26,32 +26,26 @@
* @bug 7132631
* @summary Make sure that the help file is generated correctly.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestHelpFile
+ * @library ../lib
+ * @build JavadocTester
* @run main TestHelpFile
*/
public class TestHelpFile extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- SRC_DIR + "/TestHelpFile.java"
- };
+ public static void main(String... args) throws Exception {
+ TestHelpFile tester = new TestHelpFile();
+ tester.runTests();
+ }
- private static final String[][] TEST = {
- { "help-doc.html",
- "<a href=\"constant-values.html\">Constant Field Values</a>"
- },
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ testSrc("TestHelpFile.java"));
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestHelpFile tester = new TestHelpFile();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("help-doc.html", true,
+ "<a href=\"constant-values.html\">Constant Field Values</a>");
}
}
--- a/langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java Fri May 23 09:05:24 2014 -0700
@@ -27,81 +27,79 @@
* @summary Make sure that the -help option works properly. Make sure
* the help link appears in the documentation.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester TestHelpOption
* @run main TestHelpOption
*/
public class TestHelpOption extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-help",
- SRC_DIR + "/TestHelpOption.java"
- };
+ public static void main(String... args) throws Exception {
+ TestHelpOption tester = new TestHelpOption();
+ tester.runTests();
+ }
+
+ @Test
+ void testWithOption() {
+ javadoc("-d", "out1",
+ "-sourcepath", testSrc,
+ "-help",
+ testSrc("TestHelpOption.java"));
+ checkExit(Exit.OK);
- private static final String[] ARGS2 = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- SRC_DIR + "/TestHelpOption.java"
- };
+ checkOutput(true);
+ }
+
+ @Test
+ void testWithoutOption() {
+ javadoc("-d", "out2",
+ "-sourcepath", testSrc,
+ testSrc("TestHelpOption.java"));
+ checkExit(Exit.OK);
+
+ checkOutput(false);
+ }
- private static final String[][] TEST = {
- {STANDARD_OUTPUT, "-d "},
- {STANDARD_OUTPUT, "-use "},
- {STANDARD_OUTPUT, "-version "},
- {STANDARD_OUTPUT, "-author "},
- {STANDARD_OUTPUT, "-docfilessubdirs "},
- {STANDARD_OUTPUT, "-splitindex "},
- {STANDARD_OUTPUT, "-windowtitle "},
- {STANDARD_OUTPUT, "-doctitle "},
- {STANDARD_OUTPUT, "-header "},
- {STANDARD_OUTPUT, "-footer "},
- {STANDARD_OUTPUT, "-bottom "},
- {STANDARD_OUTPUT, "-link "},
- {STANDARD_OUTPUT, "-linkoffline "},
- {STANDARD_OUTPUT, "-excludedocfilessubdir "},
- {STANDARD_OUTPUT, "-group "},
- {STANDARD_OUTPUT, "-nocomment "},
- {STANDARD_OUTPUT, "-nodeprecated "},
- {STANDARD_OUTPUT, "-noqualifier "},
- {STANDARD_OUTPUT, "-nosince "},
- {STANDARD_OUTPUT, "-notimestamp "},
- {STANDARD_OUTPUT, "-nodeprecatedlist "},
- {STANDARD_OUTPUT, "-notree "},
- {STANDARD_OUTPUT, "-noindex "},
- {STANDARD_OUTPUT, "-nohelp "},
- {STANDARD_OUTPUT, "-nonavbar "},
- {STANDARD_OUTPUT, "-serialwarn "},
- {STANDARD_OUTPUT, "-tag "},
- {STANDARD_OUTPUT, "-taglet "},
- {STANDARD_OUTPUT, "-tagletpath "},
- {STANDARD_OUTPUT, "-charset "},
- {STANDARD_OUTPUT, "-helpfile "},
- {STANDARD_OUTPUT, "-linksource "},
- {STANDARD_OUTPUT, "-sourcetab "},
- {STANDARD_OUTPUT, "-keywords "},
- {STANDARD_OUTPUT, "-stylesheetfile "},
- {STANDARD_OUTPUT, "-docencoding "},
- };
+ private void checkOutput(boolean withOption) {
+ checkOutput(Output.STDOUT, withOption,
+ "-d ",
+ "-use ",
+ "-version ",
+ "-author ",
+ "-docfilessubdirs ",
+ "-splitindex ",
+ "-windowtitle ",
+ "-doctitle ",
+ "-header ",
+ "-footer ",
+ "-bottom ",
+ "-link ",
+ "-linkoffline ",
+ "-excludedocfilessubdir ",
+ "-group ",
+ "-nocomment ",
+ "-nodeprecated ",
+ "-noqualifier ",
+ "-nosince ",
+ "-notimestamp ",
+ "-nodeprecatedlist ",
+ "-notree ",
+ "-noindex ",
+ "-nohelp ",
+ "-nonavbar ",
+ "-serialwarn ",
+ "-tag ",
+ "-taglet ",
+ "-tagletpath ",
+ "-charset ",
+ "-helpfile ",
+ "-linksource ",
+ "-sourcetab ",
+ "-keywords ",
+ "-stylesheetfile ",
+ "-docencoding ");
- private static final String[][] TEST2 = {
- { "TestHelpOption.html",
- "<li><a href=\"help-doc.html\">Help</a></li>"
- },
- };
-
- //The help option should not crash the doclet.
- private static final int EXPECTED_EXIT_CODE = 0;
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestHelpOption tester = new TestHelpOption();
- int actualExitCode = tester.run(ARGS, TEST, NO_TEST);
- tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
- tester.run(ARGS2, TEST2, NO_TEST);
- tester.printSummary();
+ checkOutput("TestHelpOption.html", !withOption,
+ "<li><a href=\"help-doc.html\">Help</a></li>");
}
}
--- a/langtools/test/com/sun/javadoc/testHiddenMembers/TestHiddenMembers.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHiddenMembers/TestHiddenMembers.java Fri May 23 09:05:24 2014 -0700
@@ -27,34 +27,37 @@
* @summary Test to make sure that hidden overriden members are not
* documented as inherited.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestHiddenMembers
* @run main TestHiddenMembers
*/
public class TestHiddenMembers extends JavadocTester {
-
- //We should not inherit any members from BaseClass because they are all overriden and hidden
- //(declared as private).
private static final String[][] NEGATED_TEST = {
- { "pkg/SubClass.html",
- "inherited from class pkg.<A HREF=\"../pkg/BaseClass.html\">BaseClass</A>"}
+ { }
};
private static final String[] ARGS =
new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "pkg"
+
};
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestHiddenMembers tester = new TestHiddenMembers();
- tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ // We should not inherit any members from BaseClass because they are all overriden and hidden
+ // (declared as private).
+ // TODO: check normal case of generated tags: upper case of lower case
+ checkOutput("pkg/SubClass.html", false,
+ "inherited from class pkg.<A HREF=\"../pkg/BaseClass.html\">BaseClass</A>");
}
}
--- a/langtools/test/com/sun/javadoc/testHref/TestHref.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java Fri May 23 09:05:24 2014 -0700
@@ -26,73 +26,57 @@
* @bug 4663254 8016328 8025633 8026567
* @summary Verify that spaces do not appear in hrefs and anchors.
* @author jamieh
- * @library ../lib/
- * @build JavadocTester TestHref
+ * @library ../lib
+ * @build JavadocTester
* @run main TestHref
*/
public class TestHref extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-linkoffline",
- "http://java.sun.com/j2se/1.4/docs/api/", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestHref tester = new TestHref();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-Xdoclint:none",
+ "-d", "out",
+ "-sourcepath", testSrc,
+ "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- //Input for string search tests.
- private static final String[][] TEST = {
- //External link.
- { "pkg/C1.html",
- "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\""
- },
- //Member summary table link.
- { "pkg/C1.html",
- "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\""
- },
- //Anchor test.
- { "pkg/C1.html",
- "<a name=\"method-int-int-java.util.ArrayList-\">\n" +
- "<!-- -->\n" +
- "</a>"
- },
- //Backward compatibility anchor test.
- { "pkg/C1.html",
- "<a name=\"method-int-int-java.util.ArrayList-\">\n" +
- "<!-- -->\n" +
- "</a>"
- },
- //{@link} test.
- { "pkg/C2.html",
- "Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
- },
- //@see test.
- { "pkg/C2.html",
- "See Also:</span></dt>\n" +
- "<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
- },
+ checkOutput("pkg/C1.html", true,
+ //External link.
+ "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\"",
+ //Member summary table link.
+ "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"",
+ //Anchor test.
+ "<a name=\"method-int-int-java.util.ArrayList-\">\n"
+ + "<!-- -->\n"
+ + "</a>",
+ //Backward compatibility anchor test."pkg/C1.html",
+ "<a name=\"method-int-int-java.util.ArrayList-\">\n"
+ + "<!-- -->\n"
+ + "</a>");
- //Header does not link to the page itself.
- { "pkg/C4.html",
- "Class C4<E extends C4<E>></h2>"
- },
+ checkOutput("pkg/C2.html", true,
+ //{@link} test.
+ "Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">",
+ //@see test.
+ "See Also:</span></dt>\n"
+ + "<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
+ );
- //Signature does not link to the page itself.
- { "pkg/C4.html",
- "public abstract class <span class=\"typeNameLabel\">C4<E extends C4<E>></span>"
- },
- };
- private static final String[][] NEGATED_TEST =
- {
- {WARNING_OUTPUT, "<a> tag is malformed"}
- };
+ checkOutput("pkg/C4.html", true,
+ //Header does not link to the page itself.
+ "Class C4<E extends C4<E>></h2>",
+ //Signature does not link to the page itself.
+ "public abstract class <span class=\"typeNameLabel\">C4<E extends C4<E>></span>"
+ );
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestHref tester = new TestHref();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput(Output.WARNING, false,
+ "<a> tag is malformed");
}
}
--- a/langtools/test/com/sun/javadoc/testHrefInDocComment/TestHrefInDocComment.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHrefInDocComment/TestHrefInDocComment.java Fri May 23 09:05:24 2014 -0700
@@ -27,26 +27,22 @@
* @summary Determine if Hrefs are processed properly when they
* appear in doc comments.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestHrefInDocComment
* @run main TestHrefInDocComment
*/
public class TestHrefInDocComment extends JavadocTester {
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"};
+ public static void main(String... args) throws Exception {
+ TestHrefInDocComment tester = new TestHrefInDocComment();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestHrefInDocComment tester = new TestHrefInDocComment();
- if (tester.run(ARGS, NO_TEST, NO_TEST) != 0) {
- throw new Error("Javadoc failed to execute properly with given source.");
- }
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc, "pkg");
+ checkExit(Exit.OK);
}
}
--- a/langtools/test/com/sun/javadoc/testHtmlComments/TestHtmlComments.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlComments/TestHtmlComments.java Fri May 23 09:05:24 2014 -0700
@@ -27,32 +27,26 @@
* @summary The field detail comment should not show up in the output if there
* are no fields to document.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestHtmlComments
* @run main TestHtmlComments
*/
public class TestHtmlComments extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, SRC_DIR + "/C.java"
- };
+ public static void main(String... args) throws Exception {
+ TestHtmlComments tester = new TestHtmlComments();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] NEGATED_TEST = {
- { "C.html",
- "<!-- ============ FIELD DETAIL =========== -->"}
- };
+ @Test
+ void run() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ testSrc("C.java"));
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestHtmlComments tester = new TestHtmlComments();
- tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("C.html", false,
+ "<!-- ============ FIELD DETAIL =========== -->");
}
}
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Fri May 23 09:05:24 2014 -0700
@@ -28,159 +28,250 @@
* @bug 6786690 6820360 8025633 8026567
* @summary This test verifies the nesting of definition list tags.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestHtmlDefinitionListTag
+ * @library ../lib
+ * @build JavadocTester
* @run main TestHtmlDefinitionListTag
*/
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
public class TestHtmlDefinitionListTag extends JavadocTester {
- // Test common to all runs of javadoc. The class signature should print
- // properly enclosed definition list tags and the Annotation Type
- // Optional Element should print properly nested definition list tags
- // for default value.
- private static final String[][] TEST_ALL = {
- { "pkg1/C1.html",
+ public static void main(String... args) throws Exception {
+ TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag();
+ tester.runTests();
+ }
+
+ @Test
+ void test_Comment_Deprecated() {
+// tester.run(ARGS1, TEST_ALL, NEGATED_TEST_NO_C5);
+// tester.runTestsOnHTML(NO_TEST, NEGATED_TEST_C5);
+// tester.runTestsOnHTML(TEST_CMNT_DEPR, NO_TEST);
+ javadoc("-Xdoclint:none",
+ "-d", "out-1",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
+ checkCommon(true);
+ checkCommentDeprecated(true);
+ }
+
+ @Test
+ void test_NoComment_Deprecated() {
+// tester.run(ARGS2, TEST_ALL, NEGATED_TEST_NO_C5);
+// tester.runTestsOnHTML(NO_TEST, NEGATED_TEST_C5);
+// tester.runTestsOnHTML(NO_TEST, TEST_CMNT_DEPR);
+ javadoc("-Xdoclint:none",
+ "-d", "out-2",
+ "-nocomment",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
+ checkCommon(true);
+ checkCommentDeprecated(false); // ??
+ }
+
+ @Test
+ void test_Comment_NoDeprecated() {
+// tester.run(ARGS3, TEST_ALL, NEGATED_TEST_NO_C5);
+// tester.runTestsOnHTML(TEST_NODEPR, TEST_NOCMNT_NODEPR);
+ javadoc("-Xdoclint:none",
+ "-d", "out-3",
+ "-nodeprecated",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
+ checkCommon(false);
+ checkNoDeprecated();
+ checkNoCommentNoDeprecated(false);
+ }
+
+ @Test
+ void testNoCommentNoDeprecated() {
+// tester.run(ARGS4, TEST_ALL, NEGATED_TEST_NO_C5);
+// tester.runTestsOnHTML(TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR);
+ javadoc("-Xdoclint:none",
+ "-d", "out-4",
+ "-nocomment",
+ "-nodeprecated",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
+ checkCommon(false);
+ checkNoCommentNoDeprecated(true);
+ checkCommentDeprecated(false);
+ }
+
+ void checkCommon(boolean checkC5) {
+ // Test common to all runs of javadoc. The class signature should print
+ // properly enclosed definition list tags and the Annotation Type
+ // Optional Element should print properly nested definition list tags
+ // for default value.
+ checkOutput("pkg1/C1.html", true,
"<pre>public class <span class=\"typeNameLabel\">C1</span>\n" +
"extends java.lang.Object\n" +
- "implements java.io.Serializable</pre>"},
- { "pkg1/C4.html",
+ "implements java.io.Serializable</pre>");
+ checkOutput("pkg1/C4.html", true,
"<dl>\n" +
"<dt>Default:</dt>\n" +
"<dd>true</dd>\n" +
- "</dl>"}};
+ "</dl>");
+
+ // Test for valid HTML generation which should not comprise of empty
+ // definition list tags.
+ List<String> files= new ArrayList<>(Arrays.asList(
+ "pkg1/package-summary.html",
+ "pkg1/C1.html",
+ "pkg1/C1.ModalExclusionType.html",
+ "pkg1/C2.html",
+ "pkg1/C2.ModalType.html",
+ "pkg1/C3.html",
+ "pkg1/C4.html",
+ "overview-tree.html",
+ "serialized-form.html"
+ ));
- // Test for normal run of javadoc in which various ClassDocs and
- // serialized form should have properly nested definition list tags
- // enclosing comments, tags and deprecated information.
- private static final String[][] TEST_CMNT_DEPR = {
- { "pkg1/package-summary.html",
- "<dl>\n" +
- "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
- "<dd>JDK1.0</dd>\n" +
- "</dl>"},
- { "pkg1/C1.html",
+ if (checkC5)
+ files.add("pkg1/C5.html");
+
+ for (String f: files) {
+ checkOutput(f, false,
+ "<dl></dl>",
+ "<dl>\n</dl>");
+ }
+ }
+
+ void checkCommentDeprecated(boolean expectFound) {
+ // Test for normal run of javadoc in which various ClassDocs and
+ // serialized form should have properly nested definition list tags
+ // enclosing comments, tags and deprecated information.
+ checkOutput("pkg1/package-summary.html", expectFound,
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>JDK1.0</dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
- "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>" +
- "C2</code></a>, \n" +
- "<a href=\"../serialized-form.html#pkg1.C1\">" +
- "Serialized Form</a></dd>\n" +
- "</dl>"},
- { "pkg1/C1.html",
- "<dl>\n" +
- "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
- "<dd>1.4</dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
- "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a></dd>\n" +
- "</dl>"},
- { "pkg1/C1.html",
- "<dl>\n" +
- "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
- "<dd><code>title</code> - the title</dd>\n" +
- "<dd><code>test</code> - boolean value" +
- "</dd>\n" +
- "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
- "<dd><code>java.lang.IllegalArgumentException</code> - if the " +
- "<code>owner</code>'s\n" +
- " <code>GraphicsConfiguration</code> is not from a screen " +
- "device</dd>\n" +
- "<dd><code>HeadlessException</code></dd>\n" +
- "</dl>"},
- { "pkg1/C1.html",
- "<dl>\n" +
- "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
- "<dd><code>undecorated" +
- "</code> - <code>true</code> if no decorations are\n" +
- " to be enabled;\n" +
- " <code>false</code> " +
- "if decorations are to be enabled.</dd>\n" +
- "<dt><span class=\"simpleTagLabel\">Since:" +
- "</span></dt>\n" +
- "<dd>1.4</dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
- "<dd>" +
- "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()" +
- "</code></a></dd>\n" +
- "</dl>"},
- { "pkg1/C1.html",
- "<dl>\n" +
- "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
- "<dd><code>java.io.IOException</code></dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:" +
- "</span></dt>\n" +
- "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a></dd>\n" +
- "</dl>"},
- { "pkg1/C2.html",
- "<dl>\n" +
- "<dt><span class=\"paramLabel\">Parameters:" +
- "</span></dt>\n" +
- "<dd><code>set</code> - boolean</dd>\n" +
- "<dt><span class=\"simpleTagLabel\">" +
- "Since:</span></dt>\n" +
- "<dd>1.4</dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<dl>\n" +
- "<dt><span class=\"throwsLabel\">Throws:</span>" +
- "</dt>\n" +
- "<dd><code>" +
- "java.io.IOException</code></dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span>" +
- "</dt>\n" +
- "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<span class=\"deprecatedLabel\">Deprecated.</span>" +
- " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
- " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
- "<div class=\"block\">This field indicates whether the C1 is " +
- "undecorated.</div>\n" +
- " \n" +
- "<dl>\n" +
- "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
- "<dd>1.4</dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span>" +
- "</dt>\n" +
- "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<span class=\"deprecatedLabel\">Deprecated.</span>" +
- " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
- " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
- "<div class=\"block\">Reads the object stream.</div>\n" +
- "<dl>\n" +
- "<dt><span class=\"throwsLabel\">Throws:" +
- "</span></dt>\n" +
- "<dd><code><code>" +
- "IOException</code></code></dd>\n" +
- "<dd><code>java.io.IOException</code></dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<span class=\"deprecatedLabel\">Deprecated.</span>" +
- " </div>\n" +
- "<div class=\"block\">The name for this class.</div>"}};
+ "</dl>");
+
+ checkOutput("pkg1/C1.html", expectFound,
+ "<dl>\n"
+ + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>JDK1.0</dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ + "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>"
+ + "C2</code></a>, \n"
+ + "<a href=\"../serialized-form.html#pkg1.C1\">"
+ + "Serialized Form</a></dd>\n"
+ + "</dl>",
+ "<dl>\n"
+ + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>1.4</dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a></dd>\n"
+ + "</dl>",
+ "<dl>\n"
+ + "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n"
+ + "<dd><code>title</code> - the title</dd>\n"
+ + "<dd><code>test</code> - boolean value"
+ + "</dd>\n"
+ + "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
+ + "<dd><code>java.lang.IllegalArgumentException</code> - if the "
+ + "<code>owner</code>'s\n"
+ + " <code>GraphicsConfiguration</code> is not from a screen "
+ + "device</dd>\n"
+ + "<dd><code>HeadlessException</code></dd>\n"
+ + "</dl>",
+ "<dl>\n"
+ + "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n"
+ + "<dd><code>undecorated"
+ + "</code> - <code>true</code> if no decorations are\n"
+ + " to be enabled;\n"
+ + " <code>false</code> "
+ + "if decorations are to be enabled.</dd>\n"
+ + "<dt><span class=\"simpleTagLabel\">Since:"
+ + "</span></dt>\n"
+ + "<dd>1.4</dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ + "<dd>"
+ + "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()"
+ + "</code></a></dd>\n"
+ + "</dl>",
+ "<dl>\n"
+ + "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
+ + "<dd><code>java.io.IOException</code></dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:"
+ + "</span></dt>\n"
+ + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a></dd>\n"
+ + "</dl>");
- // Test with -nodeprecated option. The ClassDocs should have properly nested
- // definition list tags enclosing comments and tags. The ClassDocs should not
- // display definition list for deprecated information. The serialized form
- // should display properly nested definition list tags for comments, tags
- // and deprecated information.
- private static final String[][] TEST_NODEPR = {
- { "pkg1/package-summary.html",
+ checkOutput("pkg1/C2.html", expectFound,
+ "<dl>\n"
+ + "<dt><span class=\"paramLabel\">Parameters:"
+ + "</span></dt>\n"
+ + "<dd><code>set</code> - boolean</dd>\n"
+ + "<dt><span class=\"simpleTagLabel\">"
+ + "Since:</span></dt>\n"
+ + "<dd>1.4</dd>\n"
+ + "</dl>");
+
+ checkOutput("serialized-form.html", expectFound,
+ "<dl>\n"
+ + "<dt><span class=\"throwsLabel\">Throws:</span>"
+ + "</dt>\n"
+ + "<dd><code>"
+ + "java.io.IOException</code></dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span>"
+ + "</dt>\n"
+ + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ + "</dl>",
+ "<span class=\"deprecatedLabel\">Deprecated.</span>"
+ + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<div class=\"block\">This field indicates whether the C1 is "
+ + "undecorated.</div>\n"
+ + " \n"
+ + "<dl>\n"
+ + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>1.4</dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span>"
+ + "</dt>\n"
+ + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ + "</dl>",
+ "<span class=\"deprecatedLabel\">Deprecated.</span>"
+ + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<div class=\"block\">Reads the object stream.</div>\n"
+ + "<dl>\n"
+ + "<dt><span class=\"throwsLabel\">Throws:"
+ + "</span></dt>\n"
+ + "<dd><code><code>"
+ + "IOException</code></code></dd>\n"
+ + "<dd><code>java.io.IOException</code></dd>\n"
+ + "</dl>",
+ "<span class=\"deprecatedLabel\">Deprecated.</span>"
+ + " </div>\n"
+ + "<div class=\"block\">The name for this class.</div>");
+ }
+
+ void checkNoDeprecated() {
+ // Test with -nodeprecated option. The ClassDocs should have properly nested
+ // definition list tags enclosing comments and tags. The ClassDocs should not
+ // display definition list for deprecated information. The serialized form
+ // should display properly nested definition list tags for comments, tags
+ // and deprecated information.
+ checkOutput("pkg1/package-summary.html", true,
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>JDK1.0</dd>\n" +
- "</dl>"},
- { "pkg1/C1.html",
+ "</dl>");
+
+ checkOutput("pkg1/C1.html", true,
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span>" +
"</dt>\n" +
@@ -191,216 +282,124 @@
"<code>C2</code></a>, \n" +
"<a href=\"../serialized-form.html#pkg1.C1\">" +
"Serialized Form</a></dd>\n" +
- "</dl>"},
- { "pkg1/C1.html",
- "<dl>\n" +
- "<dt><span class=\"paramLabel\">Parameters:" +
- "</span></dt>\n" +
- "<dd><code>title</code> - the title</dd>\n" +
- "<dd><code>" +
- "test</code> - boolean value</dd>\n" +
- "<dt><span class=\"throwsLabel\">Throws:" +
- "</span></dt>\n" +
- "<dd><code>java.lang.IllegalArgumentException" +
- "</code> - if the <code>owner</code>'s\n" +
- " <code>GraphicsConfiguration" +
- "</code> is not from a screen device</dd>\n" +
- "<dd><code>" +
- "HeadlessException</code></dd>\n" +
- "</dl>"},
- { "pkg1/C1.html",
- "<dl>\n" +
- "<dt><span class=\"paramLabel\">Parameters:" +
- "</span></dt>\n" +
- "<dd><code>undecorated</code> - <code>true</code>" +
- " if no decorations are\n" +
- " to be enabled;\n" +
- " <code>false</code> if decorations are to be enabled." +
- "</dd>\n" +
- "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
- "<dd>1.4</dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
- "<dd><a href=\"../pkg1/C1.html#readObject--\">" +
- "<code>readObject()</code></a></dd>\n" +
- "</dl>"},
- { "pkg1/C1.html",
- "<dl>\n" +
- "<dt><span class=\"throwsLabel\">Throws:</span>" +
- "</dt>\n" +
- "<dd><code>java.io.IOException</code></dd>\n" +
- "<dt>" +
- "<span class=\"seeLabel\">See Also:</span></dt>\n" +
- "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a></dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<dl>\n" +
- "<dt><span class=\"throwsLabel\">Throws:</span>" +
- "</dt>\n" +
- "<dd><code>" +
- "java.io.IOException</code></dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span>" +
- "</dt>\n" +
- "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<span class=\"deprecatedLabel\">Deprecated.</span>" +
- " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
- " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
- "<div class=\"block\">This field indicates whether the C1 is " +
- "undecorated.</div>\n" +
- " \n" +
- "<dl>\n" +
- "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
- "<dd>1.4</dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span>" +
- "</dt>\n" +
- "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<span class=\"deprecatedLabel\">Deprecated.</span>" +
- " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
- " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
- "<div class=\"block\">Reads the object stream.</div>\n" +
- "<dl>\n" +
- "<dt><span class=\"throwsLabel\">Throws:" +
- "</span></dt>\n" +
- "<dd><code><code>" +
- "IOException</code></code></dd>\n" +
- "<dd><code>java.io.IOException</code></dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<span class=\"deprecatedLabel\">Deprecated.</span>" +
- " </div>\n" +
- "<div class=\"block\">" +
- "The name for this class.</div>"}};
+ "</dl>");
+
+ checkOutput("pkg1/C1.html", true,
+ "<dl>\n"
+ + "<dt><span class=\"paramLabel\">Parameters:"
+ + "</span></dt>\n"
+ + "<dd><code>title</code> - the title</dd>\n"
+ + "<dd><code>"
+ + "test</code> - boolean value</dd>\n"
+ + "<dt><span class=\"throwsLabel\">Throws:"
+ + "</span></dt>\n"
+ + "<dd><code>java.lang.IllegalArgumentException"
+ + "</code> - if the <code>owner</code>'s\n"
+ + " <code>GraphicsConfiguration"
+ + "</code> is not from a screen device</dd>\n"
+ + "<dd><code>"
+ + "HeadlessException</code></dd>\n"
+ + "</dl>",
+ "<dl>\n"
+ + "<dt><span class=\"paramLabel\">Parameters:"
+ + "</span></dt>\n"
+ + "<dd><code>undecorated</code> - <code>true</code>"
+ + " if no decorations are\n"
+ + " to be enabled;\n"
+ + " <code>false</code> if decorations are to be enabled."
+ + "</dd>\n"
+ + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>1.4</dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ + "<dd><a href=\"../pkg1/C1.html#readObject--\">"
+ + "<code>readObject()</code></a></dd>\n"
+ + "</dl>",
+ "<dl>\n"
+ + "<dt><span class=\"throwsLabel\">Throws:</span>"
+ + "</dt>\n"
+ + "<dd><code>java.io.IOException</code></dd>\n"
+ + "<dt>"
+ + "<span class=\"seeLabel\">See Also:</span></dt>\n"
+ + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a></dd>\n"
+ + "</dl>");
- // Test with -nocomment and -nodeprecated options. The ClassDocs whould
- // not display definition lists for any member details.
- private static final String[][] TEST_NOCMNT_NODEPR = {
- { "pkg1/C1.html",
+ checkOutput("serialized-form.html", true,
+ "<dl>\n"
+ + "<dt><span class=\"throwsLabel\">Throws:</span>"
+ + "</dt>\n"
+ + "<dd><code>"
+ + "java.io.IOException</code></dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span>"
+ + "</dt>\n"
+ + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ + "</dl>",
+ "<span class=\"deprecatedLabel\">Deprecated.</span>"
+ + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<div class=\"block\">This field indicates whether the C1 is "
+ + "undecorated.</div>\n"
+ + " \n"
+ + "<dl>\n"
+ + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>1.4</dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span>"
+ + "</dt>\n"
+ + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ + "</dl>",
+ "<span class=\"deprecatedLabel\">Deprecated.</span>"
+ + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<div class=\"block\">Reads the object stream.</div>\n"
+ + "<dl>\n"
+ + "<dt><span class=\"throwsLabel\">Throws:"
+ + "</span></dt>\n"
+ + "<dd><code><code>"
+ + "IOException</code></code></dd>\n"
+ + "<dd><code>java.io.IOException</code></dd>\n"
+ + "</dl>",
+ "<span class=\"deprecatedLabel\">Deprecated.</span>"
+ + " </div>\n"
+ + "<div class=\"block\">"
+ + "The name for this class.</div>");
+ }
+
+ void checkNoCommentNoDeprecated(boolean expectFound) {
+ // Test with -nocomment and -nodeprecated options. The ClassDocs whould
+ // not display definition lists for any member details.
+ checkOutput("pkg1/C1.html", expectFound,
"<pre>public void readObject()\n" +
" throws java.io.IOException</pre>\n" +
- "</li>"},
- { "pkg1/C2.html", "<pre>public C2()</pre>\n" +
- "</li>"},
- { "pkg1/C1.ModalExclusionType.html", "<pre>public " +
+ "</li>");
+
+ checkOutput("pkg1/C2.html", expectFound,
+ "<pre>public C2()</pre>\n" +
+ "</li>");
+
+ checkOutput("pkg1/C1.ModalExclusionType.html", expectFound,
+ "<pre>public " +
"static final <a href=\"../pkg1/C1.ModalExclusionType.html\" " +
"title=\"enum in pkg1\">C1.ModalExclusionType</a> " +
"APPLICATION_EXCLUDE</pre>\n" +
- "</li>"},
- { "serialized-form.html", "<pre>boolean " +
+ "</li>");
+
+ checkOutput("serialized-form.html", expectFound,
+ "<pre>boolean " +
"undecorated</pre>\n" +
"<div class=\"block\"><span class=\"deprecatedLabel\">" +
"Deprecated.</span> <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
"setUndecorated(boolean)</code></a>.</span></div>\n" +
- "</li>"},
- { "serialized-form.html", "<span class=\"deprecatedLabel\">" +
+ "</li>",
+ "<span class=\"deprecatedLabel\">" +
"Deprecated.</span> <span class=\"deprecationComment\">As of JDK version" +
" 1.5, replaced by\n" +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
- "</li>"}};
-
- // Test for valid HTML generation which should not comprise of empty
- // definition list tags.
- private static final String[][] NEGATED_TEST_NO_C5 = {
- { "pkg1/package-summary.html",
- "<dl></dl>"},
- { "pkg1/package-summary.html",
- "<dl>\n" +
- "</dl>"},
- { "pkg1/C1.html",
- "<dl></dl>"},
- { "pkg1/C1.html",
- "<dl>\n" +
- "</dl>"},
- { "pkg1/C1.ModalExclusionType.html",
- "<dl></dl>"},
- { "pkg1/C1.ModalExclusionType.html",
- "<dl>\n" +
- "</dl>"},
- { "pkg1/C2.html",
- "<dl></dl>"},
- { "pkg1/C2.html",
- "<dl>\n" +
- "</dl>"},
- { "pkg1/C2.ModalType.html",
- "<dl></dl>"},
- { "pkg1/C2.ModalType.html",
- "<dl>\n" +
- "</dl>"},
- { "pkg1/C3.html",
- "<dl></dl>"},
- { "pkg1/C3.html",
- "<dl>\n" +
- "</dl>"},
- { "pkg1/C4.html",
- "<dl></dl>"},
- { "pkg1/C4.html",
- "<dl>\n" +
- "</dl>"},
- { "overview-tree.html",
- "<dl></dl>"},
- { "overview-tree.html",
- "<dl>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<dl></dl>"},
- { "serialized-form.html",
- "<dl>\n" +
- "</dl>"}};
- private static final String[][] NEGATED_TEST_C5 = {
- { "pkg1/C5.html",
- "<dl></dl>"},
- { "pkg1/C5.html",
- "<dl>\n" +
- "</dl>"}};
-
- private static final String[] ARGS1 =
- new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
-
- private static final String[] ARGS2 =
- new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-nocomment", "-sourcepath",
- SRC_DIR, "pkg1"};
-
- private static final String[] ARGS3 =
- new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR + "-3", "-nodeprecated", "-sourcepath",
- SRC_DIR, "pkg1"};
-
- private static final String[] ARGS4 =
- new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR + "-4", "-nocomment", "-nodeprecated",
- "-sourcepath", SRC_DIR, "pkg1"};
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag();
- tester.run(ARGS1, TEST_ALL, NEGATED_TEST_NO_C5);
- tester.runTestsOnHTML(NO_TEST, NEGATED_TEST_C5);
- tester.runTestsOnHTML(TEST_CMNT_DEPR, NO_TEST);
-
- tester.run(ARGS2, TEST_ALL, NEGATED_TEST_NO_C5);
- tester.runTestsOnHTML(NO_TEST, NEGATED_TEST_C5);
- tester.runTestsOnHTML(NO_TEST, TEST_CMNT_DEPR);
-
- tester.run(ARGS3, TEST_ALL, NEGATED_TEST_NO_C5);
- tester.runTestsOnHTML(TEST_NODEPR, TEST_NOCMNT_NODEPR);
-
- tester.run(ARGS4, TEST_ALL, NEGATED_TEST_NO_C5);
- tester.runTestsOnHTML(TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR);
-
- tester.printSummary();
+ "</li>");
}
}
--- a/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java Fri May 23 09:05:24 2014 -0700
@@ -27,33 +27,38 @@
* @test
* @bug 6851834
* @summary This test verifies the HTML document generation for javadoc output.
+ * @library ../lib
+ * @build JavadocTester
* @author Bhavesh Patel
- * @build TestHtmlDocument
* @run main TestHtmlDocument
*/
-import java.io.*;
import com.sun.tools.doclets.formats.html.markup.*;
/**
* The class reads each file, complete with newlines, into a string to easily
* compare the existing markup with the generated markup.
*/
-public class TestHtmlDocument {
-
- protected static final String NL = System.getProperty("line.separator");
-
- private static final String BUGID = "6851834";
- private static final String BUGNAME = "TestHtmlDocument";
- private static String srcdir = System.getProperty("test.src", ".");
+public class TestHtmlDocument extends JavadocTester {
// Entry point
- public static void main(String[] args) throws IOException {
+ public static void main(String... args) throws Exception {
+ TestHtmlDocument tester = new TestHtmlDocument();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ checking("markup");
// Check whether the generated markup is same as the existing markup.
- if (generateHtmlTree().equals(readFileToString(srcdir + "/testMarkup.html"))) {
- System.out.println("\nTest passed for bug " + BUGID + " (" + BUGNAME + ")\n");
+ String expected = readFile(testSrc, "testMarkup.html").replace("\n", NL);
+ String actual = generateHtmlTree();
+ if (actual.equals(expected)) {
+ passed("");
} else {
- throw new Error("\nTest failed for bug " + BUGID + " (" + BUGNAME + ")\n");
+ failed("expected content in " + testSrc("testMarkup.html") + "\n"
+ + "Actual output:\n"
+ + actual);
}
}
@@ -136,25 +141,4 @@
HtmlDocument htmlDoc = new HtmlDocument(htmlDocType, html);
return htmlDoc.toString();
}
-
- // Read the file into a String
- public static String readFileToString(String filename) throws IOException {
- File file = new File(filename);
- if ( !file.exists() ) {
- System.out.println("\nFILE DOES NOT EXIST: " + filename);
- }
- BufferedReader in = new BufferedReader(new FileReader(file));
- StringBuilder fileString = new StringBuilder();
- // Create an array of characters the size of the file
- try {
- String line;
- while ((line = in.readLine()) != null) {
- fileString.append(line);
- fileString.append(NL);
- }
- } finally {
- in.close();
- }
- return fileString.toString();
- }
}
--- a/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java Fri May 23 09:05:24 2014 -0700
@@ -26,44 +26,49 @@
/*
* @test
* @bug 6786028 8026567
- * @summary This test verifys the use of <strong> HTML tag instead of <B> by Javadoc std doclet.
+ * @summary This test verifies the use of <strong> HTML tag instead of <B> by Javadoc std doclet.
* @author Bhavesh Patel
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestHtmlStrongTag
* @run main TestHtmlStrongTag
*/
public class TestHtmlStrongTag extends JavadocTester {
- private static final String[][] TEST1 = {
- { "pkg1/C1.html",
- "<span class=\"seeLabel\">See Also:</span>"}};
- private static final String[][] NEGATED_TEST1 = {
- { "pkg1/C1.html", "<STRONG>Method Summary</STRONG>"},
- { "pkg1/C1.html", "<B>"},
- { "pkg1/package-summary.html",
- "<STRONG>Class Summary</STRONG>"}};
- private static final String[][] TEST2 = {
- { "pkg2/C2.html", "<B>Comments:</B>"}};
- private static final String[][] NEGATED_TEST2 = {
- { "pkg2/C2.html", "<STRONG>Method Summary</STRONG>"}};
+ public static void main(String... args) throws Exception {
+ TestHtmlStrongTag tester = new TestHtmlStrongTag();
+ tester.runTests();
+ }
+
+ @Test
+ void test1() {
+ javadoc("-d", "out-1",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg1/C1.html", true,
+ "<span class=\"seeLabel\">See Also:</span>");
- private static final String[] ARGS1 =
- new String[] {
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
- private static final String[] ARGS2 =
- new String[] {
- "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "pkg2"};
+ checkOutput("pkg1/C1.html", false,
+ "<STRONG>Method Summary</STRONG>",
+ "<B>");
+
+ checkOutput("pkg1/package-summary.html", false,
+ "<STRONG>Class Summary</STRONG>");
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestHtmlStrongTag tester = new TestHtmlStrongTag();
- tester.run(ARGS1, TEST1, NEGATED_TEST1);
- tester.run(ARGS2, TEST2, NEGATED_TEST2);
- tester.printSummary();
+ @Test
+ void test2() {
+ javadoc("-d", "out-2",
+ "-sourcepath", testSrc,
+ "pkg2");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg2/C2.html", true,
+ "<B>Comments:</B>");
+
+ checkOutput("pkg2/C2.html", false,
+ "<STRONG>Method Summary</STRONG>");
}
}
--- a/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java Fri May 23 09:05:24 2014 -0700
@@ -26,69 +26,59 @@
* @bug 8008164
* @summary Test styles on HTML tables generated by javadoc.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestHtmlTableStyles
+ * @library ../lib
+ * @build JavadocTester
* @run main TestHtmlTableStyles
*/
public class TestHtmlTableStyles extends JavadocTester {
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg1/TestTable.html",
- "<table border cellpadding=3 cellspacing=1>"
- },
- { "pkg1/TestTable.html",
- "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Field Summary table, listing fields, " +
- "and an explanation\">"
- },
- { "pkg1/TestTable.html",
- "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Constructor Summary table, listing " +
- "constructors, and an explanation\">"
- },
- { "pkg1/TestTable.html",
- "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Method Summary table, listing methods, " +
- "and an explanation\">"
- },
- { "pkg1/package-summary.html",
- "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Class Summary table, listing classes, " +
- "and an explanation\">"
- },
- { "pkg1/class-use/TestTable.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Use table, listing fields, and an explanation\">"
- },
- { "overview-summary.html",
- "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Packages table, listing packages, and an explanation\">"
- },
- { "deprecated-list.html",
+ public static void main(String... args) throws Exception {
+ TestHtmlTableStyles tester = new TestHtmlTableStyles();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-use",
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg1/TestTable.html", true,
+ "<table border cellpadding=3 cellspacing=1>",
+ "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Field Summary table, listing fields, "
+ + "and an explanation\">",
+ "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Constructor Summary table, listing "
+ + "constructors, and an explanation\">",
+ "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Method Summary table, listing methods, "
+ + "and an explanation\">");
+
+ checkOutput("pkg1/package-summary.html", true,
+ "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Class Summary table, listing classes, "
+ + "and an explanation\">");
+
+ checkOutput("pkg1/class-use/TestTable.html", true,
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Use table, listing fields, and an explanation\">");
+
+ checkOutput("overview-summary.html", true,
+ "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Packages table, listing packages, and an explanation\">");
+
+ checkOutput("deprecated-list.html", true,
"<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Deprecated Methods table, listing " +
- "deprecated methods, and an explanation\">"
- },
- { "constant-values.html",
+ "deprecated methods, and an explanation\">");
+
+ checkOutput("constant-values.html", true,
"<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Constant Field Values table, listing " +
- "constant fields, and values\">"
- },
- };
-
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) throws Exception {
- TestHtmlTableStyles tester = new TestHtmlTableStyles();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ "constant fields, and values\">");
}
}
--- a/langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java Fri May 23 09:05:24 2014 -0700
@@ -26,9 +26,8 @@
* @bug 6786688 8008164
* @summary HTML tables should have table summary, caption and table headers.
* @author Bhavesh Patel
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestHtmlTableTags
* @run main TestHtmlTableTags
*/
@@ -36,400 +35,350 @@
//Javadoc arguments.
private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
+
};
- //Input for string tests for HTML table tags.
- private static final String[][] TABLE_TAGS_TEST = {
- /*
- * Test for validating summary for HTML tables
- */
+
+ public static void main(String... args) throws Exception {
+ TestHtmlTableTags tester = new TestHtmlTableTags();
+ tester.runTests();
+ }
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-use",
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
+
+ checkHtmlTableSummaries();
+ checkHtmlTableCaptions();
+ checkHtmlTableHeaders();
+ }
+
+ /*
+ * Tests for validating summary for HTML tables
+ */
+ void checkHtmlTableSummaries() {
//Package summary
- { "pkg1/package-summary.html",
- "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
- " cellspacing=\"0\" summary=\"Class Summary table, " +
- "listing classes, and an explanation\">"
- },
- { "pkg1/package-summary.html",
- "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
- " cellspacing=\"0\" summary=\"Interface Summary table, " +
- "listing interfaces, and an explanation\">"
- },
- { "pkg2/package-summary.html",
- "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
- " cellspacing=\"0\" summary=\"Enum Summary table, " +
- "listing enums, and an explanation\">"
- },
- { "pkg2/package-summary.html",
- "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
- " cellspacing=\"0\" summary=\"Annotation Types Summary table, " +
- "listing annotation types, and an explanation\">"
- },
+ checkOutput("pkg1/package-summary.html", true,
+ "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ + " cellspacing=\"0\" summary=\"Class Summary table, "
+ + "listing classes, and an explanation\">",
+ "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ + " cellspacing=\"0\" summary=\"Interface Summary table, "
+ + "listing interfaces, and an explanation\">");
+
+ checkOutput("pkg2/package-summary.html", true,
+ "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ + " cellspacing=\"0\" summary=\"Enum Summary table, "
+ + "listing enums, and an explanation\">",
+ "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ + " cellspacing=\"0\" summary=\"Annotation Types Summary table, "
+ + "listing annotation types, and an explanation\">");
+
// Class documentation
- { "pkg1/C1.html",
- "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Field Summary table, listing fields, " +
- "and an explanation\">"
- },
- { "pkg1/C1.html",
- "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Method Summary table, listing methods, " +
- "and an explanation\">"
- },
- { "pkg2/C2.html",
- "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Nested Class Summary table, listing " +
- "nested classes, and an explanation\">"
- },
- { "pkg2/C2.html",
- "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Constructor Summary table, listing " +
- "constructors, and an explanation\">"
- },
- { "pkg2/C2.ModalExclusionType.html",
- "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Enum Constant Summary table, listing " +
- "enum constants, and an explanation\">"
- },
- { "pkg2/C3.html",
- "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Required Element Summary table, " +
- "listing required elements, and an explanation\">"
- },
- { "pkg2/C4.html",
- "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Optional Element Summary table, " +
- "listing optional elements, and an explanation\">"
- },
- // Class use documentation
- { "pkg1/class-use/I1.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing packages, and an explanation\">"
- },
- { "pkg1/class-use/C1.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing fields, and an explanation\">"
- },
- { "pkg1/class-use/C1.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing methods, and an explanation\">"
- },
- { "pkg2/class-use/C2.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing fields, and an explanation\">"
- },
- { "pkg2/class-use/C2.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing methods, and an explanation\">"
- },
- { "pkg2/class-use/C2.ModalExclusionType.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing packages, and an explanation\">"
- },
- { "pkg2/class-use/C2.ModalExclusionType.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing methods, and an explanation\">"
- },
- // Package use documentation
- { "pkg1/package-use.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing packages, and an explanation\">"
- },
- { "pkg1/package-use.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing classes, and an explanation\">"
- },
- { "pkg2/package-use.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing packages, and an explanation\">"
- },
- { "pkg2/package-use.html",
- "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
- "table, listing classes, and an explanation\">"
- },
- // Deprecated
- { "deprecated-list.html",
- "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
- "summary=\"Deprecated Fields table, listing deprecated fields, " +
- "and an explanation\">"
- },
- { "deprecated-list.html",
- "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
- "summary=\"Deprecated Methods table, listing deprecated methods, " +
- "and an explanation\">"
- },
- // Constant values
- { "constant-values.html",
- "<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
- "summary=\"Constant Field Values table, listing " +
- "constant fields, and values\">"
- },
- // Overview Summary
- { "overview-summary.html",
- "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
- "cellspacing=\"0\" summary=\"Packages table, " +
- "listing packages, and an explanation\">"
- },
+ checkOutput("pkg1/C1.html", true,
+ "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Field Summary table, listing fields, "
+ + "and an explanation\">",
+ "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Method Summary table, listing methods, "
+ + "and an explanation\">");
+
+ checkOutput("pkg2/C2.html", true,
+ "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Nested Class Summary table, listing "
+ + "nested classes, and an explanation\">",
+ "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Constructor Summary table, listing "
+ + "constructors, and an explanation\">");
- /*
- * Test for validating caption for HTML tables
- */
+ checkOutput("pkg2/C2.ModalExclusionType.html", true,
+ "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Enum Constant Summary table, listing "
+ + "enum constants, and an explanation\">");
- //Package summary
- { "pkg1/package-summary.html",
- "<caption><span>Class Summary</span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg1/package-summary.html",
- "<caption><span>Interface Summary</span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/package-summary.html",
- "<caption><span>Enum Summary</span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/package-summary.html",
- "<caption><span>Annotation Types Summary</span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- // Class documentation
- { "pkg1/C1.html",
- "<caption><span>Fields</span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg1/C1.html",
- "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
- "Methods</span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
- "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" +
- "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">" +
- "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "</caption>"
- },
- { "pkg2/C2.html",
- "<caption><span>Nested Classes</span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/C2.html",
- "<caption><span>Constructors</span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/C2.ModalExclusionType.html",
- "<caption><span>Enum Constants</span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/C3.html",
- "<caption><span>Required Elements</span><span class=\"tabEnd\"> " +
- "</span></caption>"
- },
- { "pkg2/C4.html",
- "<caption><span>Optional Elements</span><span class=\"tabEnd\"> " +
- "</span></caption>"
- },
+ checkOutput("pkg2/C3.html", true,
+ "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Required Element Summary table, "
+ + "listing required elements, and an explanation\">");
+
+ checkOutput("pkg2/C4.html", true,
+ "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Optional Element Summary table, "
+ + "listing optional elements, and an explanation\">");
+
// Class use documentation
- { "pkg1/class-use/I1.html",
- "<caption><span>Packages that use <a href=\"../../pkg1/I1.html\" " +
- "title=\"interface in pkg1\">I1</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg1/class-use/C1.html",
- "<caption><span>Fields in <a href=\"../../pkg2/package-summary.html\">" +
- "pkg2</a> declared as <a href=\"../../pkg1/C1.html\" " +
- "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\"> " +
- "</span></caption>"
- },
- { "pkg1/class-use/C1.html",
- "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">" +
- "pkg2</a> that return <a href=\"../../pkg1/C1.html\" " +
- "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/class-use/C2.html",
- "<caption><span>Fields in <a href=\"../../pkg1/package-summary.html\">" +
- "pkg1</a> declared as <a href=\"../../pkg2/C2.html\" " +
- "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/class-use/C2.html",
- "<caption><span>Methods in <a href=\"../../pkg1/package-summary.html\">" +
- "pkg1</a> that return <a href=\"../../pkg2/C2.html\" " +
- "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/class-use/C2.ModalExclusionType.html",
- "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">" +
- "pkg2</a> that return <a href=\"../../pkg2/C2.ModalExclusionType.html\" " +
- "title=\"enum in pkg2\">C2.ModalExclusionType</a></span>" +
- "<span class=\"tabEnd\"> </span></caption>"
- },
+ checkOutput("pkg1/class-use/I1.html", true,
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing packages, and an explanation\">");
+
+ checkOutput("pkg1/class-use/C1.html", true,
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing fields, and an explanation\">",
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing methods, and an explanation\">");
+
+ checkOutput("pkg2/class-use/C2.html", true,
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing fields, and an explanation\">",
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing methods, and an explanation\">");
+
+ checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing packages, and an explanation\">");
+
+ checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing methods, and an explanation\">");
+
// Package use documentation
- { "pkg1/package-use.html",
- "<caption><span>Packages that use <a href=\"../pkg1/package-summary.html\">" +
- "pkg1</a></span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg1/package-use.html",
- "<caption><span>Classes in <a href=\"../pkg1/package-summary.html\">" +
- "pkg1</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>" +
- "</span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/package-use.html",
- "<caption><span>Packages that use <a href=\"../pkg2/package-summary.html\">" +
- "pkg2</a></span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/package-use.html",
- "<caption><span>Classes in <a href=\"../pkg2/package-summary.html\">" +
- "pkg2</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>" +
- "</span><span class=\"tabEnd\"> </span></caption>"
- },
+ checkOutput("pkg1/package-use.html", true,
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing packages, and an explanation\">",
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing classes, and an explanation\">");
+
+ checkOutput("pkg2/package-use.html", true,
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing packages, and an explanation\">",
+ "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ + "table, listing classes, and an explanation\">");
+
// Deprecated
- { "deprecated-list.html",
- "<caption><span>Deprecated Fields</span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "deprecated-list.html",
- "<caption><span>Deprecated Methods</span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
+ checkOutput("deprecated-list.html", true,
+ "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ + "summary=\"Deprecated Fields table, listing deprecated fields, "
+ + "and an explanation\">",
+ "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ + "summary=\"Deprecated Methods table, listing deprecated methods, "
+ + "and an explanation\">");
+
// Constant values
- { "constant-values.html",
- "<caption><span>pkg1.<a href=\"pkg1/C1.html\" title=\"class in pkg1\">" +
- "C1</a></span><span class=\"tabEnd\"> </span></caption>"
- },
+ checkOutput("constant-values.html", true,
+ "<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ + "summary=\"Constant Field Values table, listing "
+ + "constant fields, and values\">");
+
// Overview Summary
- { "overview-summary.html",
- "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>"
- },
+ checkOutput("overview-summary.html", true,
+ "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Packages table, "
+ + "listing packages, and an explanation\">");
+ }
- /*
- * Test for validating headers for HTML tables
- */
-
+ /*
+ * Tests for validating caption for HTML tables
+ */
+ void checkHtmlTableCaptions() {
//Package summary
- { "pkg1/package-summary.html",
- "<th class=\"colFirst\" scope=\"col\">" +
- "Class</th>\n" +
- "<th class=\"colLast\" scope=\"col\"" +
- ">Description</th>"
- },
- { "pkg1/package-summary.html",
- "<th class=\"colFirst\" scope=\"col\">" +
- "Interface</th>\n" +
- "<th class=\"colLast\" scope=\"col\"" +
- ">Description</th>"
- },
- { "pkg2/package-summary.html",
- "<th class=\"colFirst\" scope=\"col\">" +
- "Enum</th>\n" +
- "<th class=\"colLast\" scope=\"col\"" +
- ">Description</th>"
- },
- { "pkg2/package-summary.html",
- "<th class=\"colFirst\" scope=\"col\">" +
- "Annotation Type</th>\n" +
- "<th class=\"colLast\"" +
- " scope=\"col\">Description</th>"
- },
+ checkOutput("pkg1/package-summary.html", true,
+ "<caption><span>Class Summary</span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<caption><span>Interface Summary</span><span class=\"tabEnd\">"
+ + " </span></caption>");
+
+ checkOutput("pkg2/package-summary.html", true,
+ "<caption><span>Enum Summary</span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<caption><span>Annotation Types Summary</span><span class=\"tabEnd\">"
+ + " </span></caption>");
+
// Class documentation
- { "pkg1/C1.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
- },
- { "pkg1/C1.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
- },
- { "pkg2/C2.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Class and Description</th>"
- },
- { "pkg2/C2.html",
- "<th class=\"colOne\" scope=\"col\">Constructor and Description</th>"
- },
- { "pkg2/C2.ModalExclusionType.html",
- "<th class=\"colOne\" scope=\"col\">Enum Constant and Description</th>"
- },
- { "pkg2/C3.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Required Element and Description</th>"
- },
- { "pkg2/C4.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Optional Element and Description</th>"
- },
+ checkOutput("pkg1/C1.html", true,
+ "<caption><span>Fields</span><span class=\"tabEnd\"> </span></caption>",
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All "
+ + "Methods</span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">"
+ + "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">"
+ + "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">"
+ + "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "</caption>");
+
+ checkOutput("pkg2/C2.html", true,
+ "<caption><span>Nested Classes</span><span class=\"tabEnd\"> </span></caption>",
+ "<caption><span>Constructors</span><span class=\"tabEnd\"> </span></caption>");
+
+ checkOutput("pkg2/C2.ModalExclusionType.html", true,
+ "<caption><span>Enum Constants</span><span class=\"tabEnd\"> </span></caption>");
+
+ checkOutput("pkg2/C3.html", true,
+ "<caption><span>Required Elements</span><span class=\"tabEnd\"> "
+ + "</span></caption>");
+
+ checkOutput("pkg2/C4.html", true,
+ "<caption><span>Optional Elements</span><span class=\"tabEnd\"> "
+ + "</span></caption>");
+
// Class use documentation
- { "pkg1/class-use/I1.html",
- "<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Description</th>"
- },
- { "pkg1/class-use/C1.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
- },
- { "pkg1/class-use/C1.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
- },
- { "pkg2/class-use/C2.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
- },
- { "pkg2/class-use/C2.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
- },
- { "pkg2/class-use/C2.ModalExclusionType.html",
- "<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Description</th>"
- },
- { "pkg2/class-use/C2.ModalExclusionType.html",
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
- },
+ checkOutput("pkg1/class-use/I1.html", true,
+ "<caption><span>Packages that use <a href=\"../../pkg1/I1.html\" "
+ + "title=\"interface in pkg1\">I1</a></span><span class=\"tabEnd\">"
+ + " </span></caption>");
+
+ checkOutput("pkg1/class-use/C1.html", true,
+ "<caption><span>Fields in <a href=\"../../pkg2/package-summary.html\">"
+ + "pkg2</a> declared as <a href=\"../../pkg1/C1.html\" "
+ + "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\"> "
+ + "</span></caption>",
+ "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">"
+ + "pkg2</a> that return <a href=\"../../pkg1/C1.html\" "
+ + "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">"
+ + " </span></caption>");
+
+ checkOutput("pkg2/class-use/C2.html", true,
+ "<caption><span>Fields in <a href=\"../../pkg1/package-summary.html\">"
+ + "pkg1</a> declared as <a href=\"../../pkg2/C2.html\" "
+ + "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<caption><span>Methods in <a href=\"../../pkg1/package-summary.html\">"
+ + "pkg1</a> that return <a href=\"../../pkg2/C2.html\" "
+ + "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">"
+ + " </span></caption>");
+
+ checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
+ "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">"
+ + "pkg2</a> that return <a href=\"../../pkg2/C2.ModalExclusionType.html\" "
+ + "title=\"enum in pkg2\">C2.ModalExclusionType</a></span>"
+ + "<span class=\"tabEnd\"> </span></caption>");
+
// Package use documentation
- { "pkg1/package-use.html",
- "<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Description</th>"
- },
- { "pkg1/package-use.html",
- "<th class=\"colOne\" scope=\"col\">Class and Description</th>"
- },
- { "pkg2/package-use.html",
- "<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Description</th>"
- },
- { "pkg2/package-use.html",
- "<th class=\"colOne\" scope=\"col\">Class and Description</th>"
- },
+ checkOutput("pkg1/package-use.html", true,
+ "<caption><span>Packages that use <a href=\"../pkg1/package-summary.html\">"
+ + "pkg1</a></span><span class=\"tabEnd\"> </span></caption>",
+ "<caption><span>Classes in <a href=\"../pkg1/package-summary.html\">"
+ + "pkg1</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>"
+ + "</span><span class=\"tabEnd\"> </span></caption>");
+
+ checkOutput("pkg2/package-use.html", true,
+ "<caption><span>Packages that use <a href=\"../pkg2/package-summary.html\">"
+ + "pkg2</a></span><span class=\"tabEnd\"> </span></caption>",
+ "<caption><span>Classes in <a href=\"../pkg2/package-summary.html\">"
+ + "pkg2</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>"
+ + "</span><span class=\"tabEnd\"> </span></caption>");
+
// Deprecated
- { "deprecated-list.html",
- "<th class=\"colOne\" scope=\"col\">Field and Description</th>"
- },
- { "deprecated-list.html",
- "<th class=\"colOne\" scope=\"col\">Method and Description</th>"
- },
+ checkOutput("deprecated-list.html", true,
+ "<caption><span>Deprecated Fields</span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<caption><span>Deprecated Methods</span><span class=\"tabEnd\">"
+ + " </span></caption>");
+
// Constant values
- { "constant-values.html",
- "<th class=\"colFirst\" scope=\"col\">" +
- "Modifier and Type</th>\n" +
- "<th" +
- " scope=\"col\">Constant Field</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Value</th>"
- },
+ checkOutput("constant-values.html", true,
+ "<caption><span>pkg1.<a href=\"pkg1/C1.html\" title=\"class in pkg1\">"
+ + "C1</a></span><span class=\"tabEnd\"> </span></caption>");
+
// Overview Summary
- { "overview-summary.html",
- "<th class=\"colFirst\" scope=\"col\">" +
- "Package</th>\n" +
- "<th class=\"colLast\" scope=\"col\"" +
- ">Description</th>"
- }
- };
+ checkOutput("overview-summary.html", true,
+ "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>");
+ }
+
+ /*
+ * Test for validating headers for HTML tables
+ */
+ void checkHtmlTableHeaders() {
+ //Package summary
+ checkOutput("pkg1/package-summary.html", true,
+ "<th class=\"colFirst\" scope=\"col\">"
+ + "Class</th>\n"
+ + "<th class=\"colLast\" scope=\"col\""
+ + ">Description</th>",
+ "<th class=\"colFirst\" scope=\"col\">"
+ + "Interface</th>\n"
+ + "<th class=\"colLast\" scope=\"col\""
+ + ">Description</th>");
+
+ checkOutput("pkg2/package-summary.html", true,
+ "<th class=\"colFirst\" scope=\"col\">"
+ + "Enum</th>\n"
+ + "<th class=\"colLast\" scope=\"col\""
+ + ">Description</th>",
+ "<th class=\"colFirst\" scope=\"col\">"
+ + "Annotation Type</th>\n"
+ + "<th class=\"colLast\""
+ + " scope=\"col\">Description</th>");
+
+ // Class documentation
+ checkOutput("pkg1/C1.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
+
+ checkOutput("pkg2/C2.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Class and Description</th>",
+ "<th class=\"colOne\" scope=\"col\">Constructor and Description</th>");
+
+ checkOutput("pkg2/C2.ModalExclusionType.html", true,
+ "<th class=\"colOne\" scope=\"col\">Enum Constant and Description</th>");
+
+ checkOutput("pkg2/C3.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Required Element and Description</th>");
+
+ checkOutput("pkg2/C4.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Optional Element and Description</th>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestHtmlTableTags tester = new TestHtmlTableTags();
- tester.run(ARGS, TABLE_TAGS_TEST, NO_TEST);
- tester.printSummary();
+ // Class use documentation
+ checkOutput("pkg1/class-use/I1.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Description</th>");
+
+ checkOutput("pkg1/class-use/C1.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
+
+ checkOutput("pkg2/class-use/C2.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
+
+ checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Description</th>",
+ "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
+
+ // Package use documentation
+ checkOutput("pkg1/package-use.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Description</th>",
+ "<th class=\"colOne\" scope=\"col\">Class and Description</th>");
+
+ checkOutput("pkg2/package-use.html", true,
+ "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Description</th>",
+ "<th class=\"colOne\" scope=\"col\">Class and Description</th>");
+
+ // Deprecated
+ checkOutput("deprecated-list.html", true,
+ "<th class=\"colOne\" scope=\"col\">Field and Description</th>",
+ "<th class=\"colOne\" scope=\"col\">Method and Description</th>");
+
+ // Constant values
+ checkOutput("constant-values.html", true,
+ "<th class=\"colFirst\" scope=\"col\">"
+ + "Modifier and Type</th>\n"
+ + "<th"
+ + " scope=\"col\">Constant Field</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Value</th>");
+
+ // Overview Summary
+ checkOutput("overview-summary.html", true,
+ "<th class=\"colFirst\" scope=\"col\">"
+ + "Package</th>\n"
+ + "<th class=\"colLast\" scope=\"col\""
+ + ">Description</th>");
}
}
--- a/langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java Fri May 23 09:05:24 2014 -0700
@@ -28,9 +28,8 @@
* @bug 6786682
* @summary This test verifies the use of lang attribute by <HTML>.
* @author Bhavesh Patel
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestHtmlTag
* @run main TestHtmlTag
*/
@@ -38,43 +37,65 @@
public class TestHtmlTag extends JavadocTester {
- private static final String[][] TEST1 = {
- { "pkg1/C1.html",
- "<html lang=\"" + Locale.getDefault().getLanguage() + "\">"},
- { "pkg1/package-summary.html",
- "<html lang=\"" + Locale.getDefault().getLanguage() + "\">"}};
- private static final String[][] NEGATED_TEST1 = {
- { "pkg1/C1.html", "<html>"}};
- private static final String[][] TEST2 = {
- { "pkg2/C2.html", "<html lang=\"ja\">"},
- { "pkg2/package-summary.html", "<html lang=\"ja\">"}};
- private static final String[][] NEGATED_TEST2 = {
- { "pkg2/C2.html", "<html>"}};
- private static final String[][] TEST3 = {
- { "pkg1/C1.html", "<html lang=\"en\">"},
- { "pkg1/package-summary.html", "<html lang=\"en\">"}};
- private static final String[][] NEGATED_TEST3 = {
- { "pkg1/C1.html", "<html>"}};
+ public static void main(String... args) throws Exception {
+ TestHtmlTag tester = new TestHtmlTag();
+ tester.runTests();
+ }
+
+ @Test
+ void test_default() {
+ javadoc("-d", "out-default",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
+
+ String defaultLanguage = Locale.getDefault().getLanguage();
+
+ checkOutput("pkg1/C1.html", true,
+ "<html lang=\"" + defaultLanguage + "\">");
+
+ checkOutput("pkg1/package-summary.html", true,
+ "<html lang=\"" + defaultLanguage + "\">");
+
+ checkOutput("pkg1/C1.html", false,
+ "<html>");
+ }
- private static final String[] ARGS1 =
- new String[] {
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
- private static final String[] ARGS2 =
- new String[] {
- "-locale", "ja", "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "pkg2"};
- private static final String[] ARGS3 =
- new String[] {
- "-locale", "en_US", "-d", OUTPUT_DIR + "-3", "-sourcepath", SRC_DIR, "pkg1"};
+ @Test
+ void test_ja() {
+ // TODO: why does this test need/use pkg2; why can't it use pkg1
+ // like the other two tests, so that we can share the check methods?
+ javadoc("-locale", "ja",
+ "-d", "out-ja",
+ "-sourcepath", testSrc,
+ "pkg2");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg2/C2.html", true,
+ "<html lang=\"ja\">");
+
+ checkOutput("pkg2/package-summary.html", true,
+ "<html lang=\"ja\">");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestHtmlTag tester = new TestHtmlTag();
- tester.run(ARGS1, TEST1, NEGATED_TEST1);
- tester.run(ARGS2, TEST2, NEGATED_TEST2);
- tester.run(ARGS3, TEST3, NEGATED_TEST3);
- tester.printSummary();
+ checkOutput("pkg2/C2.html", false,
+ "<html>");
+ }
+
+ @Test
+ void test_en_US() {
+ javadoc("-locale", "en_US",
+ "-d", "out-en_US",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg1/C1.html", true,
+ "<html lang=\"en\">");
+
+ checkOutput("pkg1/package-summary.html", true,
+ "<html lang=\"en\">");
+
+ checkOutput("pkg1/C1.html", false,
+ "<html>");
}
}
--- a/langtools/test/com/sun/javadoc/testIndentation/TestIndentation.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testIndentation/TestIndentation.java Fri May 23 09:05:24 2014 -0700
@@ -25,37 +25,30 @@
* @test
* @bug 8011288
* @summary Erratic/inconsistent indentation of signatures
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
* @run main TestIndentation
*/
public class TestIndentation extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "p"
- };
+ public static void main(String... args) throws Exception {
+ TestIndentation tester = new TestIndentation();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "p/Indent.html",
- "<pre>public <T> void m(T t1," },
- { "p/Indent.html",
- "\n" +
- " T t2)" },
- { "p/Indent.html",
- "\n" +
- " throws java.lang.Exception" }
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "p");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestIndentation tester = new TestIndentation();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("p/Indent.html", true,
+ "<pre>public <T> void m(T t1,",
+ "\n"
+ + " T t2)",
+ "\n"
+ + " throws java.lang.Exception");
}
}
--- a/langtools/test/com/sun/javadoc/testIndex/TestIndex.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testIndex/TestIndex.java Fri May 23 09:05:24 2014 -0700
@@ -28,64 +28,53 @@
* Also test that index-all.html has the appropriate output.
* Test for unnamed package in index.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestIndex
* @run main TestIndex
*/
public class TestIndex extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", SRC_DIR + "/NoPackage.java"
- };
+ public static void main(String... args) throws Exception {
+ TestIndex tester = new TestIndex();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg", testSrc("NoPackage.java"));
+ checkExit(Exit.OK);
+
//Make sure the horizontal scroll bar does not appear in class frame.
- { "index.html",
- "<frame src=\"overview-summary.html\" name=\"classFrame\" title=\"" +
- "Package, class and interface descriptions\" scrolling=\"yes\">"},
+ checkOutput("index.html", true,
+ "<frame src=\"overview-summary.html\" name=\"classFrame\" title=\""
+ + "Package, class and interface descriptions\" scrolling=\"yes\">");
//Test index-all.html
- { "index-all.html",
- "<a href=\"pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">C</span></a>" +
- " - Class in <a href=\"pkg/package-summary.html\">pkg</a>"},
- { "index-all.html",
- "<a href=\"pkg/Interface.html\" title=\"interface in pkg\">" +
- "<span class=\"typeNameLink\">Interface</span></a> - Interface in " +
- "<a href=\"pkg/package-summary.html\">pkg</a>"},
- { "index-all.html",
- "<a href=\"pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
- "<span class=\"typeNameLink\">AnnotationType</span></a> - Annotation Type in " +
- "<a href=\"pkg/package-summary.html\">pkg</a>"},
- { "index-all.html",
- "<a href=\"pkg/Coin.html\" title=\"enum in pkg\">" +
- "<span class=\"typeNameLink\">Coin</span></a> - Enum in " +
- "<a href=\"pkg/package-summary.html\">pkg</a>"},
- { "index-all.html",
- "Class in <a href=\"package-summary.html\"><Unnamed></a>"},
- { "index-all.html",
- "<dl>\n" +
- "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#Java\">" +
- "Java</a></span> - Static variable in class pkg.<a href=\"pkg/C.html\" " +
- "title=\"class in pkg\">C</a></dt>\n" +
- "<dd> </dd>\n" +
- "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#JDK\">JDK</a></span> " +
- "- Static variable in class pkg.<a href=\"pkg/C.html\" title=\"class in pkg\">" +
- "C</a></dt>\n" +
- "<dd> </dd>\n" +
- "</dl>"},
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestIndex tester = new TestIndex();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("index-all.html", true,
+ "<a href=\"pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">C</span></a>"
+ + " - Class in <a href=\"pkg/package-summary.html\">pkg</a>",
+ "<a href=\"pkg/Interface.html\" title=\"interface in pkg\">"
+ + "<span class=\"typeNameLink\">Interface</span></a> - Interface in "
+ + "<a href=\"pkg/package-summary.html\">pkg</a>",
+ "<a href=\"pkg/AnnotationType.html\" title=\"annotation in pkg\">"
+ + "<span class=\"typeNameLink\">AnnotationType</span></a> - Annotation Type in "
+ + "<a href=\"pkg/package-summary.html\">pkg</a>",
+ "<a href=\"pkg/Coin.html\" title=\"enum in pkg\">"
+ + "<span class=\"typeNameLink\">Coin</span></a> - Enum in "
+ + "<a href=\"pkg/package-summary.html\">pkg</a>",
+ "Class in <a href=\"package-summary.html\"><Unnamed></a>",
+ "<dl>\n"
+ + "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#Java\">"
+ + "Java</a></span> - Static variable in class pkg.<a href=\"pkg/C.html\" "
+ + "title=\"class in pkg\">C</a></dt>\n"
+ + "<dd> </dd>\n"
+ + "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#JDK\">JDK</a></span> "
+ + "- Static variable in class pkg.<a href=\"pkg/C.html\" title=\"class in pkg\">"
+ + "C</a></dt>\n"
+ + "<dd> </dd>\n"
+ + "</dl>");
}
}
--- a/langtools/test/com/sun/javadoc/testInlineLinkLabel/TestInlineLinkLabel.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testInlineLinkLabel/TestInlineLinkLabel.java Fri May 23 09:05:24 2014 -0700
@@ -26,34 +26,29 @@
* @bug 4524136
* @summary Test to make sure label is used for inline links.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestInlineLinkLabel
* @run main TestInlineLinkLabel
*/
public class TestInlineLinkLabel extends JavadocTester {
- private static final String[][] TEST = {
- //Search for the label to the package link.
- { "pkg/C1.html" ,
- "<a href=\"../pkg/package-summary.html\"><code>Here is a link to a package</code></a>"},
+ public static void main(String... args) throws Exception {
+ TestInlineLinkLabel tester = new TestInlineLinkLabel();
+ tester.runTests();
+ }
- //Search for the label to the class link
- { "pkg/C1.html" ,
- "<a href=\"../pkg/C2.html\" title=\"class in pkg\"><code>Here is a link to a class</code></a>"}
- };
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"};
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestInlineLinkLabel tester = new TestInlineLinkLabel();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/C1.html", true,
+ //Search for the label to the package link.
+ "<a href=\"../pkg/package-summary.html\"><code>Here is a link to a package</code></a>",
+ //Search for the label to the class link
+ "<a href=\"../pkg/C2.html\" title=\"class in pkg\"><code>Here is a link to a class</code></a>");
}
}
--- a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testInterface/TestInterface.java Fri May 23 09:05:24 2014 -0700
@@ -29,101 +29,82 @@
* If A implements I and B extends A, B should be in the list of
* implementing classes in the documentation for I.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestInterface
* @run main TestInterface
*/
public class TestInterface extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestInterface tester = new TestInterface();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/Interface.html",
- "<pre>int method()</pre>"},
- { "pkg/Interface.html",
- "<pre>static final int field</pre>"},
-
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- // Make sure known implementing class list is correct and omits type parameters.
- { "pkg/Interface.html",
- "<dl>\n" +
- "<dt>All Known Implementing Classes:</dt>\n" +
- "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
- "</a>, <a href=\"../pkg/Parent.html\" title=\"class in pkg\">Parent" +
- "</a></dd>\n" +
- "</dl>"},
+ checkOutput("pkg/Interface.html", true,
+ "<pre>int method()</pre>",
+ "<pre>static final int field</pre>",
+ // Make sure known implementing class list is correct and omits type parameters.
+ "<dl>\n"
+ + "<dt>All Known Implementing Classes:</dt>\n"
+ + "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child"
+ + "</a>, <a href=\"../pkg/Parent.html\" title=\"class in pkg\">Parent"
+ + "</a></dd>\n"
+ + "</dl>");
- // Make sure "All Implemented Interfaces": has substituted type parameters
- { "pkg/Child.html",
- "<dl>\n" +
- "<dt>All Implemented Interfaces:</dt>\n" +
- "<dd><a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
- "Interface</a><T></dd>\n" +
- "</dl>"
- },
- //Make sure Class Tree has substituted type parameters.
- { "pkg/Child.html",
- "<ul class=\"inheritance\">\n" +
- "<li>java.lang.Object</li>\n" +
- "<li>\n" +
- "<ul class=\"inheritance\">\n" +
- "<li><a href=\"../pkg/Parent.html\" title=\"class in pkg\">" +
- "pkg.Parent</a><T></li>\n" +
- "<li>\n" +
- "<ul class=\"inheritance\">\n" +
- "<li>pkg.Child<T></li>\n" +
- "</ul>\n" +
- "</li>\n" +
- "</ul>\n" +
- "</li>\n" +
- "</ul>"
- },
- //Make sure "Direct Know Subclasses" omits type parameters
- { "pkg/Parent.html",
- "<dl>\n" +
- "<dt>Direct Known Subclasses:</dt>\n" +
- "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
- "</a></dd>\n" +
- "</dl>"
- },
- //Make sure "Specified By" has substituted type parameters.
- { "pkg/Child.html",
- "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" +
- "<dd><code><a href=\"../pkg/Interface.html#method--\">method</a>" +
- "</code> in interface <code>" +
- "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
- "Interface</a><<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">" +
- "T</a>></code></dd>"
- },
- //Make sure "Overrides" has substituted type parameters.
- { "pkg/Child.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg/Parent.html#method--\">method</a>" +
- "</code> in class <code><a href=\"../pkg/Parent.html\" " +
- "title=\"class in pkg\">Parent</a><<a href=\"../pkg/Child.html\" " +
- "title=\"type parameter in Child\">T</a>></code></dd>"
- },
- };
- private static final String[][] NEGATED_TEST = {
- { "pkg/Interface.html",
- "public int method()"},
- { "pkg/Interface.html",
- "public static final int field"},
- };
+ checkOutput("pkg/Child.html", true,
+ // Make sure "All Implemented Interfaces": has substituted type parameters
+ "<dl>\n"
+ + "<dt>All Implemented Interfaces:</dt>\n"
+ + "<dd><a href=\"../pkg/Interface.html\" title=\"interface in pkg\">"
+ + "Interface</a><T></dd>\n"
+ + "</dl>",
+ //Make sure Class Tree has substituted type parameters.
+ "<ul class=\"inheritance\">\n"
+ + "<li>java.lang.Object</li>\n"
+ + "<li>\n"
+ + "<ul class=\"inheritance\">\n"
+ + "<li><a href=\"../pkg/Parent.html\" title=\"class in pkg\">"
+ + "pkg.Parent</a><T></li>\n"
+ + "<li>\n"
+ + "<ul class=\"inheritance\">\n"
+ + "<li>pkg.Child<T></li>\n"
+ + "</ul>\n"
+ + "</li>\n"
+ + "</ul>\n"
+ + "</li>\n"
+ + "</ul>",
+ //Make sure "Specified By" has substituted type parameters.
+ "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg/Interface.html#method--\">method</a>"
+ + "</code> in interface <code>"
+ + "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">"
+ + "Interface</a><<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">"
+ + "T</a>></code></dd>",
+ //Make sure "Overrides" has substituted type parameters.
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg/Parent.html#method--\">method</a>"
+ + "</code> in class <code><a href=\"../pkg/Parent.html\" "
+ + "title=\"class in pkg\">Parent</a><<a href=\"../pkg/Child.html\" "
+ + "title=\"type parameter in Child\">T</a>></code></dd>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestInterface tester = new TestInterface();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg/Parent.html", true,
+ //Make sure "Direct Know Subclasses" omits type parameters
+ "<dl>\n"
+ + "<dt>Direct Known Subclasses:</dt>\n"
+ + "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child"
+ + "</a></dd>\n"
+ + "</dl>");
+
+ checkOutput("pkg/Interface.html", false,
+ "public int method()",
+ "public static final int field");
}
}
--- a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Fri May 23 09:05:24 2014 -0700
@@ -26,73 +26,57 @@
* @bug 7112427 8012295 8025633 8026567
* @summary Test of the JavaFX doclet features.
* @author jvalenta
- * @library ../lib/
- * @build JavadocTester TestJavaFX
+ * @library ../lib
+ * @build JavadocTester
* @run main TestJavaFX
*/
public class TestJavaFX extends JavadocTester {
- private static final String[][] TEST =
- new String[][] {
- { "C.html",
- "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
- "<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, \n" +
- "<a href=\"C.html#setRate-double-\"><code>setRate(double)</code></a></dd>"},
- { "C.html",
- "<pre>public final void setRate(double value)</pre>\n" +
- "<div class=\"block\">Sets the value of the property rate.</div>\n" +
- "<dl>\n" +
- "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>" },
- { "C.html",
- "<pre>public final double getRate()</pre>\n" +
- "<div class=\"block\">Gets the value of the property rate.</div>\n" +
- "<dl>\n" +
- "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>" },
- { "C.html",
- "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#rateProperty\">rate</a></span></code>\n" +
- "<div class=\"block\">Defines the direction/speed at which the <code>Timeline</code> is expected to"},
+ public static void main(String... args) throws Exception {
+ TestJavaFX tester = new TestJavaFX();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-javafx",
+ testSrc("C.java"), testSrc("D.java"));
+ checkExit(Exit.FAILED); // should be EXIT_OK -- need to fix C.java
- { "C.html",
- "<span class=\"simpleTagLabel\">Default value:</span>"},
- { "C.html",
- "<span class=\"simpleTagLabel\">Since:</span></dt>\n" +
- "<dd>JavaFX 8.0</dd>" },
- { "C.html",
- "<p>Sets the value of the property <code>Property</code>"},
- { "C.html",
- "<p>Gets the value of the property <code>Property</code>"},
- { "C.html",
- "<span class=\"simpleTagLabel\">Property description:</span>"},
- { "C.html",
- "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code> </td>" },
- { "C.html",
- "<h4>isPaused</h4>\n" +
- "<pre>public final double isPaused()</pre>\n" +
- "<div class=\"block\">Gets the value of the property paused.</div>" },
- { "D.html",
- "<h3>Properties inherited from class <a href=\"C.html\" title=\"class in <Unnamed>\">C</a></h3>\n" +
- "<code><a href=\"C.html#pausedProperty\">paused</a>, <a href=\"C.html#rateProperty\">rate</a></code></li>" },
- };
- private static final String[][] NO_TEST =
- new String[][] {
- { "C.html",
- "A()"},
- };
+ checkOutput("C.html", true,
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ + "<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, \n"
+ + "<a href=\"C.html#setRate-double-\"><code>setRate(double)</code></a></dd>",
+ "<pre>public final void setRate(double value)</pre>\n"
+ + "<div class=\"block\">Sets the value of the property rate.</div>\n"
+ + "<dl>\n"
+ + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
+ "<pre>public final double getRate()</pre>\n"
+ + "<div class=\"block\">Gets the value of the property rate.</div>\n"
+ + "<dl>\n"
+ + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#rateProperty\">rate</a></span></code>\n"
+ + "<div class=\"block\">Defines the direction/speed at which the <code>Timeline</code> is expected to",
+ "<span class=\"simpleTagLabel\">Default value:</span>",
+ "<span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>JavaFX 8.0</dd>",
+ "<p>Sets the value of the property <code>Property</code>",
+ "<p>Gets the value of the property <code>Property</code>",
+ "<span class=\"simpleTagLabel\">Property description:</span>",
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code> </td>",
+ "<h4>isPaused</h4>\n"
+ + "<pre>public final double isPaused()</pre>\n"
+ + "<div class=\"block\">Gets the value of the property paused.</div>");
-
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-javafx",
- SRC_DIR + "/C.java", SRC_DIR + "/D.java"
- };
+ checkOutput("C.html", false,
+ "A()");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestJavaFX tester = new TestJavaFX();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("D.html", true,
+ "<h3>Properties inherited from class <a href=\"C.html\" title=\"class in <Unnamed>\">C</a></h3>\n"
+ + "<code><a href=\"C.html#pausedProperty\">paused</a>, <a href=\"C.html#rateProperty\">rate</a></code></li>");
}
+
}
--- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java Fri May 23 09:05:24 2014 -0700
@@ -26,98 +26,93 @@
* @bug 4665566 4855876 7025314 8012375 8015997 8016328 8024756
* @summary Verify that the output has the right javascript.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestJavascript
* @run main TestJavascript
*/
public class TestJavascript extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", SRC_DIR +
- "/TestJavascript.java"
- };
+ public static void main(String... args) throws Exception {
+ TestJavascript tester = new TestJavascript();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg", testSrc("TestJavascript.java"));
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/C.html", true,
+ "<a href=\"../index.html?pkg/C.html\" target=\"_top\">Frames</a>");
+
+ checkOutput("TestJavascript.html", true,
+ "<a href=\"index.html?TestJavascript.html\" target=\"_top\">Frames</a>");
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/C.html",
- "<a href=\"../index.html?pkg/C.html\" target=\"_top\">Frames</a>"},
- { "TestJavascript.html",
- "<a href=\"index.html?TestJavascript.html\" target=\"_top\">Frames</a>"},
- { "index.html",
- "<script type=\"text/javascript\">\n" +
- " targetPage = \"\" + window.location.search;\n" +
- " if (targetPage != \"\" && targetPage != \"undefined\")\n" +
- " targetPage = targetPage.substring(1);\n" +
- " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))\n" +
- " targetPage = \"undefined\";\n" +
- " function validURL(url) {\n" +
- " try {\n" +
- " url = decodeURIComponent(url);\n" +
- " }\n" +
- " catch (error) {\n" +
- " return false;\n" +
- " }\n" +
- " var pos = url.indexOf(\".html\");\n" +
- " if (pos == -1 || pos != url.length - 5)\n" +
- " return false;\n" +
- " var allowNumber = false;\n" +
- " var allowSep = false;\n" +
- " var seenDot = false;\n" +
- " for (var i = 0; i < url.length - 5; i++) {\n" +
- " var ch = url.charAt(i);\n" +
- " if ('a' <= ch && ch <= 'z' ||\n" +
- " 'A' <= ch && ch <= 'Z' ||\n" +
- " ch == '$' ||\n" +
- " ch == '_' ||\n" +
- " ch.charCodeAt(0) > 127) {\n" +
- " allowNumber = true;\n" +
- " allowSep = true;\n" +
- " } else if ('0' <= ch && ch <= '9'\n" +
- " || ch == '-') {\n" +
- " if (!allowNumber)\n" +
- " return false;\n" +
- " } else if (ch == '/' || ch == '.') {\n" +
- " if (!allowSep)\n" +
- " return false;\n" +
- " allowNumber = false;\n" +
- " allowSep = false;\n" +
- " if (ch == '.')\n" +
- " seenDot = true;\n" +
- " if (ch == '/' && seenDot)\n" +
- " return false;\n" +
- " } else {\n" +
- " return false;\n" +
- " }\n" +
- " }\n" +
- " return true;\n" +
- " }\n" +
- " function loadFrames() {\n" +
- " if (targetPage != \"\" && targetPage != \"undefined\")\n" +
- " top.classFrame.location = top.targetPage;\n" +
- " }\n" +
- "</script>"},
+ checkOutput("index.html", true,
+ "<script type=\"text/javascript\">\n"
+ + " targetPage = \"\" + window.location.search;\n"
+ + " if (targetPage != \"\" && targetPage != \"undefined\")\n"
+ + " targetPage = targetPage.substring(1);\n"
+ + " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))\n"
+ + " targetPage = \"undefined\";\n"
+ + " function validURL(url) {\n"
+ + " try {\n"
+ + " url = decodeURIComponent(url);\n"
+ + " }\n"
+ + " catch (error) {\n"
+ + " return false;\n"
+ + " }\n"
+ + " var pos = url.indexOf(\".html\");\n"
+ + " if (pos == -1 || pos != url.length - 5)\n"
+ + " return false;\n"
+ + " var allowNumber = false;\n"
+ + " var allowSep = false;\n"
+ + " var seenDot = false;\n"
+ + " for (var i = 0; i < url.length - 5; i++) {\n"
+ + " var ch = url.charAt(i);\n"
+ + " if ('a' <= ch && ch <= 'z' ||\n"
+ + " 'A' <= ch && ch <= 'Z' ||\n"
+ + " ch == '$' ||\n"
+ + " ch == '_' ||\n"
+ + " ch.charCodeAt(0) > 127) {\n"
+ + " allowNumber = true;\n"
+ + " allowSep = true;\n"
+ + " } else if ('0' <= ch && ch <= '9'\n"
+ + " || ch == '-') {\n"
+ + " if (!allowNumber)\n"
+ + " return false;\n"
+ + " } else if (ch == '/' || ch == '.') {\n"
+ + " if (!allowSep)\n"
+ + " return false;\n"
+ + " allowNumber = false;\n"
+ + " allowSep = false;\n"
+ + " if (ch == '.')\n"
+ + " seenDot = true;\n"
+ + " if (ch == '/' && seenDot)\n"
+ + " return false;\n"
+ + " } else {\n"
+ + " return false;\n"
+ + " }\n"
+ + " }\n"
+ + " return true;\n"
+ + " }\n"
+ + " function loadFrames() {\n"
+ + " if (targetPage != \"\" && targetPage != \"undefined\")\n"
+ + " top.classFrame.location = top.targetPage;\n"
+ + " }\n"
+ + "</script>");
//Make sure title javascript only runs if is-external is not true
- { "pkg/C.html",
- " try {\n" +
- " if (location.href.indexOf('is-external=true') == -1) {\n" +
- " parent.document.title=\"C\";\n" +
- " }\n" +
- " }\n" +
- " catch(err) {\n" +
- " }"},
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestJavascript tester = new TestJavascript();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/C.html", true,
+ " try {\n"
+ + " if (location.href.indexOf('is-external=true') == -1) {\n"
+ + " parent.document.title=\"C\";\n"
+ + " }\n"
+ + " }\n"
+ + " catch(err) {\n"
+ + " }");
}
}
--- a/langtools/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java Fri May 23 09:05:24 2014 -0700
@@ -40,79 +40,74 @@
public class TestLambdaFeature extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", "pkg1"
- };
+ public static void main(String... args) throws Exception {
+ TestLambdaFeature tester = new TestLambdaFeature();
+ tester.runTests();
+ }
+
+ @Test
+ void testDefault() {
+ javadoc("-d", "out-default",
+ "-sourcepath", testSrc,
+ "pkg", "pkg1");
+ checkExit(Exit.OK);
- private static final String[] ARGS_1 = new String[] {
- "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-source", "1.7", "pkg1"
- };
+ checkOutput("pkg/A.html", true,
+ "<td class=\"colFirst\"><code>default void</code></td>",
+ "<pre>default void defaultMethod()</pre>",
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+ + "All Methods</span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t2\" class=\"tableTab\"><span>"
+ + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+ + "<span class=\"tabEnd\"> </span></span><span id=\"t3\" "
+ + "class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+ + "Abstract Methods</a></span><span class=\"tabEnd\"> </span>"
+ + "</span><span id=\"t5\" class=\"tableTab\"><span>"
+ + "<a href=\"javascript:show(16);\">Default Methods</a></span>"
+ + "<span class=\"tabEnd\"> </span></span></caption>",
+ "<dl>\n"
+ + "<dt>Functional Interface:</dt>\n"
+ + "<dd>This is a functional interface and can therefore be used as "
+ + "the assignment target for a lambda expression or method "
+ + "reference.</dd>\n"
+ + "</dl>");
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/A.html",
- "<td class=\"colFirst\"><code>default void</code></td>"},
- { "pkg/A.html",
- "<pre>default void defaultMethod()</pre>"},
- { "pkg/A.html",
- "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
- "All Methods</span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t2\" class=\"tableTab\"><span>" +
- "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
- "<span class=\"tabEnd\"> </span></span><span id=\"t3\" " +
- "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
- "Abstract Methods</a></span><span class=\"tabEnd\"> </span>" +
- "</span><span id=\"t5\" class=\"tableTab\"><span>" +
- "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
- "<span class=\"tabEnd\"> </span></span></caption>"},
- { "pkg/A.html",
- "<dl>\n" +
- "<dt>Functional Interface:</dt>\n" +
- "<dd>This is a functional interface and can therefore be used as " +
- "the assignment target for a lambda expression or method " +
- "reference.</dd>\n" +
- "</dl>"},
- { "pkg1/FuncInf.html",
- "<dl>\n" +
- "<dt>Functional Interface:</dt>\n" +
- "<dd>This is a functional interface and can therefore be used as " +
- "the assignment target for a lambda expression or method " +
- "reference.</dd>\n" +
- "</dl>"}
- };
- private static final String[][] NEGATED_TEST = {
- { "pkg/A.html",
- "<td class=\"colFirst\"><code>default default void</code></td>"},
- { "pkg/A.html",
- "<pre>default default void defaultMethod()</pre>"},
- { "pkg/B.html",
- "<td class=\"colFirst\"><code>default void</code></td>"},
- { "pkg1/NotAFuncInf.html",
- "<dl>\n" +
- "<dt>Functional Interface:</dt>\n" +
- "<dd>This is a functional interface and can therefore be used as " +
- "the assignment target for a lambda expression or method " +
- "reference.</dd>\n" +
- "</dl>"},
- { "pkg/B.html",
- "<dl>\n" +
- "<dt>Functional Interface:</dt>"}
- };
- private static final String[][] NEGATED_TEST_1 = {
- { "pkg1/FuncInf.html",
- "<dl>\n" +
- "<dt>Functional Interface:</dt>"}
- };
+ checkOutput("pkg1/FuncInf.html", true,
+ "<dl>\n"
+ + "<dt>Functional Interface:</dt>\n"
+ + "<dd>This is a functional interface and can therefore be used as "
+ + "the assignment target for a lambda expression or method "
+ + "reference.</dd>\n"
+ + "</dl>");
+
+ checkOutput("pkg/A.html", false,
+ "<td class=\"colFirst\"><code>default default void</code></td>",
+ "<pre>default default void defaultMethod()</pre>");
+
+ checkOutput("pkg/B.html", false,
+ "<td class=\"colFirst\"><code>default void</code></td>",
+ "<dl>\n"
+ + "<dt>Functional Interface:</dt>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestLambdaFeature tester = new TestLambdaFeature();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.run(ARGS_1, NO_TEST, NEGATED_TEST_1);
- tester.printSummary();
+ checkOutput("pkg1/NotAFuncInf.html", false,
+ "<dl>\n"
+ + "<dt>Functional Interface:</dt>\n"
+ + "<dd>This is a functional interface and can therefore be used as "
+ + "the assignment target for a lambda expression or method "
+ + "reference.</dd>\n"
+ + "</dl>");
+ }
+
+ @Test
+ void testSource7() {
+ javadoc("-d", "out-7",
+ "-sourcepath", testSrc,
+ "-source", "1.7",
+ "pkg1");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg1/FuncInf.html", false,
+ "<dl>\n"
+ + "<dt>Functional Interface:</dt>");
}
}
--- a/langtools/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java Fri May 23 09:05:24 2014 -0700
@@ -29,37 +29,35 @@
* begin their comment without a leading star without leading
* spaces stripped
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build LeadingSpaces
* @run main LeadingSpaces
*/
public class LeadingSpaces extends JavadocTester {
-
- private static final String[][] TEST = {
- { "LeadingSpaces.html",
-" 1\n" +
-" 2\n" +
-" 3\n" +
-" 4\n" +
-" 5\n" +
-" 6\n" +
-" 7"}
- };
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- SRC_DIR + "/LeadingSpaces.java"};
-
/**
* The entry point of the test.
* @param args the array of command line arguments.
+ * @throws Exception if the test fails
*/
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
LeadingSpaces tester = new LeadingSpaces();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void testLeadingSpaces() {
+ javadoc("-d", "out", "-sourcepath", testSrc,
+ testSrc("LeadingSpaces.java"));
+ checkExit(Exit.OK);
+ checkOutput("LeadingSpaces.html", true,
+ " 1\n"
+ + " 2\n"
+ + " 3\n"
+ + " 4\n"
+ + " 5\n"
+ + " 6\n"
+ + " 7");
}
/**
--- a/langtools/test/com/sun/javadoc/testLegacyTaglet/TestLegacyTaglet.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testLegacyTaglet/TestLegacyTaglet.java Fri May 23 09:05:24 2014 -0700
@@ -27,38 +27,35 @@
* @summary Test to ensure that the refactored version of the standard
* doclet still works with Taglets that implement the 1.4.0 interface.
* @author jamieh
- * @library ../lib/
- * @compile ../lib/JavadocTester.java TestLegacyTaglet.java ToDoTaglet.java UnderlineTaglet.java Check.java
+ * @library ../lib
+ * @build JavadocTester ToDoTaglet UnderlineTaglet Check
* @run main TestLegacyTaglet
*/
public class TestLegacyTaglet extends JavadocTester {
- private static final String[] ARGS =
- new String[] {"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-tagletpath", SRC_DIR, "-taglet", "ToDoTaglet", "-taglet", "Check",
- "-taglet", "UnderlineTaglet", SRC_DIR + "/C.java"};
+ public static void main(String... args) throws Exception {
+ TestLegacyTaglet tester = new TestLegacyTaglet();
+ tester.runTests();
+ }
- private static final String[][] TEST = new String[][] {
- { "C.html", "This is an <u>underline</u>"},
- { "C.html",
- "<DT><B>To Do:</B><DD><table cellpadding=2 cellspacing=0><tr>" +
- "<td bgcolor=\"yellow\">Finish this class.</td></tr></table></DD>"},
- { "C.html",
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-tagletpath", testSrc,
+ "-taglet", "ToDoTaglet",
+ "-taglet", "Check",
+ "-taglet", "UnderlineTaglet",
+ testSrc("C.java"));
+ checkExit(Exit.OK);
+ checkOutput("C.html", true,
+ "This is an <u>underline</u>",
"<DT><B>To Do:</B><DD><table cellpadding=2 cellspacing=0><tr>" +
- "<td bgcolor=\"yellow\">Tag in Method.</td></tr></table></DD>"}
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestLegacyTaglet tester = new TestLegacyTaglet();
- tester.run(ARGS, TEST, NO_TEST);
- if (tester.getErrorOutput().contains("NullPointerException")) {
- throw new AssertionError("javadoc threw NullPointerException");
- }
- tester.printSummary();
+ "<td bgcolor=\"yellow\">Finish this class.</td></tr></table></DD>",
+ "<DT><B>To Do:</B><DD><table cellpadding=2 cellspacing=0><tr>" +
+ "<td bgcolor=\"yellow\">Tag in Method.</td></tr></table></DD>");
+ checkOutput(Output.STDERR, false,
+ "NullPointerException");
}
}
--- a/langtools/test/com/sun/javadoc/testLinkOption/TestBadLinkOption.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testLinkOption/TestBadLinkOption.java Fri May 23 09:05:24 2014 -0700
@@ -26,34 +26,32 @@
* @bug 4625883
* @summary Make sure that bad -link arguments trigger warnings.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestBadLinkOption
* @run main TestBadLinkOption
*/
public class TestBadLinkOption extends JavadocTester {
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-link", OUTPUT_DIR, "pkg"
- };
-
- private static final String[][] TEST = {
- {WARNING_OUTPUT, "Error reading file:"}
- };
+ public static void main(String... args) throws Exception {
+ TestBadLinkOption tester = new TestBadLinkOption();
+ tester.runTests();
+ }
- private static final String[][] NEG_TEST = {
- {ERROR_OUTPUT, "Error reading file:"}
- };
+ @Test
+ void test() {
+ String out = "out";
+ javadoc("-d", out,
+ "-sourcepath", testSrc,
+ "-link", out,
+ "pkg");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestBadLinkOption tester = new TestBadLinkOption();
- tester.run(ARGS, TEST, NEG_TEST);
- tester.printSummary();
+ // TODO: the file it is trying to read, out/out/package-list, warrants investigation
+ checkOutput(Output.WARNING, true,
+ "Error reading file:");
+
+ checkOutput(Output.ERROR, false,
+ "Error reading file:");
}
}
--- a/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java Fri May 23 09:05:24 2014 -0700
@@ -27,105 +27,111 @@
* @summary Test to make sure that -link and -linkoffline link to
* right files, and URLs with and without trailing slash are accepted.
* @author jamieh
- * @library ../lib/
- * @build JavadocTester TestLinkOption
+ * @library ../lib
+ * @build JavadocTester
* @run main TestLinkOption
*/
import java.io.File;
public class TestLinkOption extends JavadocTester {
+ /**
+ * The entry point of the test.
+ * @param args the array of command line arguments.
+ */
+ public static void main(String... args) throws Exception {
+ TestLinkOption tester = new TestLinkOption();
+ tester.runTests();
+ }
- //Generate the documentation using -linkoffline and a URL as the first parameter.
- private static final String[] ARGS1 = new String[] {
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR,
- "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/",
- SRC_DIR, "-package", "pkg", "java.lang"
- };
+ // The following test runs javadoc multiple times; it is important that the
+ // first one is run first, since the subsequent runs refer to the output
+ // it generates. Therefore we run everything serially in a single @Test
+ // method and not in independent @Test methods.
+ @Test
+ void test() {
+ // Generate the documentation using -linkoffline and a URL as the first parameter.
+ String out1 = "out1";
+ String url = "http://java.sun.com/j2se/1.4/docs/api/";
+ javadoc("-d", out1,
+ "-sourcepath", testSrc,
+ "-linkoffline", url, testSrc,
+ "-package",
+ "pkg", "java.lang");
+ checkExit(Exit.OK);
- private static final String[][] TEST1 = {
- { "pkg/C.html",
- "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true\" " +
- "title=\"class or interface in java.lang\"><code>Link to String Class</code></a>"
- },
- //Make sure the parameters are indented properly when the -link option is used.
- { "pkg/C.html",
- "(int p1,\n" +
- " int p2,\n" +
- " int p3)"
- },
- { "pkg/C.html",
- "(int p1,\n" +
- " int p2,\n" +
- " <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">" +
- "Object</a> p3)"
- },
- { "java/lang/StringBuilderChild.html",
- "<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>\n" +
- "extends <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" " +
- "title=\"class or interface in java.lang\">Object</a></pre>"
- },
+ checkOutput("pkg/C.html", true,
+ "<a href=\"" + url + "java/lang/String.html?is-external=true\" "
+ + "title=\"class or interface in java.lang\"><code>Link to String Class</code></a>",
+ //Make sure the parameters are indented properly when the -link option is used.
+ "(int p1,\n"
+ + " int p2,\n"
+ + " int p3)",
+ "(int p1,\n"
+ + " int p2,\n"
+ + " <a href=\"" + url + "java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">"
+ + "Object</a> p3)");
+
+ checkOutput("java/lang/StringBuilderChild.html", true,
+ "<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>\n"
+ + "extends <a href=\"" + url + "java/lang/Object.html?is-external=true\" "
+ + "title=\"class or interface in java.lang\">Object</a></pre>"
+ );
- };
- private static final String[][] NEGATED_TEST1 = NO_TEST;
+ // Generate the documentation using -linkoffline and a relative path as the first parameter.
+ // We will try linking to the docs generated in test 1 with a relative path.
+ String out2 = "out2";
+ javadoc("-d", out2,
+ "-sourcepath", testSrc,
+ "-linkoffline", "../" + out1, out1,
+ "-package",
+ "pkg2");
+ checkExit(Exit.OK);
+ checkOutput("pkg2/C2.html", true,
+ "This is a link to <a href=\"../../" + out1 + "/pkg/C.html?is-external=true\" " +
+ "title=\"class or interface in pkg\"><code>Class C</code></a>."
+ );
- //Generate the documentation using -linkoffline and a relative path as the first parameter.
- //We will try linking to the docs generated in test 1 with a relative path.
- private static final String[] ARGS2 = new String[] {
- "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR,
- "-linkoffline", "../" + OUTPUT_DIR + "-1",
- OUTPUT_DIR + "-1", "-package", "pkg2"
- };
+ String out3 = "out3";
+ javadoc(createArguments(out3, out1, true)); // with trailing slash
+ checkExit(Exit.OK);
- private static final String[][] TEST2 = {
- { "pkg2/C2.html",
- "This is a link to <a href=\"../../" +
- OUTPUT_DIR + "-1/pkg/C.html?is-external=true\" " +
- "title=\"class or interface in pkg\"><code>Class C</code></a>."
- }
- };
+ String out4 = "out4";
+ javadoc(createArguments(out4, out1, false)); // without trailing slash
+ checkExit(Exit.OK);
+ // Note: the following test is very weak, and will fail if ever the test
+ // of the message is changed. We should have a separate test to verify
+ // this is the text that is given when there is a problem with a URL
+ checkOutput(Output.WARNING, false,
+ "warning - Error fetching URL");
+ }
+
/*
* Create the documentation using the -link option, vary the behavior with
* both trailing and no trailing slash. We are only interested in ensuring
* that the command executes with no errors or related warnings.
*/
- static String[] createArguments(boolean withTrailingSlash) {
- String packagePath = new File(OUTPUT_DIR + "-1").getAbsolutePath();
- String outputDirName = OUTPUT_DIR;
+ static String[] createArguments(String outDir, String packageDir, boolean withTrailingSlash) {
+ String packagePath = new File(packageDir).getAbsolutePath();
if (withTrailingSlash) {
// add the trailing slash, if it is not present!
if (!packagePath.endsWith(FS)) {
packagePath = packagePath + FS;
}
- outputDirName = outputDirName + "-3";
} else {
// remove the trailing slash, if it is present!
if (packagePath.endsWith(FS)) {
packagePath = packagePath.substring(0, packagePath.length() - 1);
}
- outputDirName = outputDirName + "-4";
}
String args[] = {
- "-d", outputDirName, "-sourcepath", SRC_DIR,
- "-link", "file:///" + packagePath, "-package", "pkg2"
+ "-d", outDir,
+ "-sourcepath", testSrc,
+ "-link", "file:///" + packagePath,
+ "-package",
+ "pkg2"
};
System.out.println("packagePath: " + packagePath);
return args;
}
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestLinkOption tester = new TestLinkOption();
- tester.run(ARGS1, TEST1, NEGATED_TEST1);
- tester.run(ARGS2, TEST2, NO_TEST);
- tester.runJavadoc(createArguments(true)); // with trailing slash
- tester.runJavadoc(createArguments(false)); // without trailing slash
- tester.printSummary();
- if (tester.getWarningOutput().contains("warning - Error fetching URL")) {
- throw new Error("URL rejected ?");
- }
- tester.printSummary();
- }
}
--- a/langtools/test/com/sun/javadoc/testLinkOption/TestNewLineInLink.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testLinkOption/TestNewLineInLink.java Fri May 23 09:05:24 2014 -0700
@@ -27,32 +27,27 @@
* @summary Make sure that a new line may act as a separator between
* link and label.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestNewLineInLink
* @run main TestNewLineInLink
*/
public class TestNewLineInLink extends JavadocTester {
- private static final String[][] NEGATED_TEST =
- new String[][] {
- {ERROR_OUTPUT,
- "illegal character"}
- };
+ public static void main(String... args) throws Exception {
+ TestNewLineInLink tester = new TestNewLineInLink();
+ tester.runTests();
+ }
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-linkoffline", "http://www.java.sun.com/j2se/1.4/docs/api",
- SRC_DIR, "testNewLineInLink"};
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-linkoffline", "http://www.java.sun.com/j2se/1.4/docs/api", testSrc,
+ "testNewLineInLink");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestNewLineInLink tester = new TestNewLineInLink();
- tester.run(ARGS, new String[][] {}, NEGATED_TEST);
- tester.printSummary();
+ checkOutput(Output.ERROR, false,
+ "illegal character");
}
}
--- a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Fri May 23 09:05:24 2014 -0700
@@ -27,53 +27,46 @@
* @summary Make sure that you can link from one member to another using
* non-qualified name, furthermore, ensure the right one is linked.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestLinkTaglet
* @run main TestLinkTaglet
*/
public class TestLinkTaglet extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", SRC_DIR +
- "/checkPkg/B.java"
- };
+ public static void main(String... args) throws Exception {
+ TestLinkTaglet tester = new TestLinkTaglet();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-Xdoclint:none",
+ "-d", "out",
+ "-sourcepath", testSrc,
+ "pkg", testSrc("checkPkg/B.java"));
+ checkExit(Exit.OK);
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/C.html",
- "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
- " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
- " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
- " Qualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>\n" +
- " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n" +
- " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
- },
- { "pkg/C.InnerC.html",
- "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>\n" +
- " Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>\n" +
- " Link to another inner class: <a href=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><code>C.InnerC2</code></a>"
- },
- { "pkg/C.InnerC2.html",
- "<dl>\n" +
- "<dt>Enclosing class:</dt>\n" +
- "<dd><a href=\"../pkg/C.html\" title=\"class in pkg\">C</a></dd>\n" +
- "</dl>"
- },
- };
- private static final String[][] NEGATED_TEST = {
- {WARNING_OUTPUT, "Tag @see: reference not found: A"},
- };
+ checkOutput("pkg/C.html", true,
+ "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ + " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ + " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ + " Qualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>\n"
+ + " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n"
+ + " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(InnerC, InnerC2)</code></a>.<br/>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestLinkTaglet tester = new TestLinkTaglet();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg/C.InnerC.html", true,
+ "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>\n"
+ + " Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>\n"
+ + " Link to another inner class: <a href=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><code>C.InnerC2</code></a>");
+
+ checkOutput("pkg/C.InnerC2.html", true,
+ "<dl>\n"
+ + "<dt>Enclosing class:</dt>\n"
+ + "<dd><a href=\"../pkg/C.html\" title=\"class in pkg\">C</a></dd>\n"
+ + "</dl>");
+
+ checkOutput(Output.WARNING, false,
+ "Tag @see: reference not found: A");
}
}
--- a/langtools/test/com/sun/javadoc/testLinkToSerialForm/TestLinkToSerialForm.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testLinkToSerialForm/TestLinkToSerialForm.java Fri May 23 09:05:24 2014 -0700
@@ -27,29 +27,28 @@
* @summary Test to make sure that there is a link with a proper anchor
* from a serializable class to serialized-form.html.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestLinkToSerialForm
* @run main TestLinkToSerialForm
*/
public class TestLinkToSerialForm extends JavadocTester {
- private static final String[][] TEST = {
- { "serialized-form.html", "<a name=\"pkg.C\">"},
- { "pkg/C.html", "<a href=\"../serialized-form.html#pkg.C\">"}
- };
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"};
+ public static void main(String... args) throws Exception {
+ TestLinkToSerialForm tester = new TestLinkToSerialForm();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestLinkToSerialForm tester = new TestLinkToSerialForm();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("serialized-form.html", true,
+ "<a name=\"pkg.C\">");
+ checkOutput("pkg/C.html", true,
+ "<a href=\"../serialized-form.html#pkg.C\">");
}
}
--- a/langtools/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java Fri May 23 09:05:24 2014 -0700
@@ -25,73 +25,61 @@
* @test
* @bug 8002387 8014636
* @summary Improve rendered HTML formatting for {@code}
- * @library ../lib/
- * @build JavadocTester TestLiteralCodeInPre
+ * @library ../lib
+ * @build JavadocTester
* @run main TestLiteralCodeInPre
*/
public class TestLiteralCodeInPre extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-Xdoclint:none", "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestLiteralCodeInPre tester = new TestLiteralCodeInPre();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-Xdoclint:none",
+ "pkg");
+ checkExit(Exit.OK);
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/Test.html",
- "no_pre()</pre>\n" +
- "<div class=\"block\">abc<code>def</code>ghi</div>" },
- { "pkg/Test.html",
- "no_pre_extra_whitespace()</pre>\n" +
- "<div class=\"block\">abc<code>def </code>ghi</div>" },
- { "pkg/Test.html",
- "in_pre()</pre>\n" +
- "<div class=\"block\"><pre> abc<code> def </code>ghi</pre></div>" },
- { "pkg/Test.html",
- "pre_after_text()</pre>\n" +
- "<div class=\"block\">xyz <pre> abc<code> def </code>ghi</pre></div>" },
- { "pkg/Test.html",
- "after_pre()</pre>\n" +
- "<div class=\"block\">xyz <pre> pqr </pre> abc<code>def </code>ghi</div>" },
- { "pkg/Test.html",
- "back_in_pre()</pre>\n" +
- "<div class=\"block\">xyz <pre> pqr </pre> mno <pre> abc<code> def </code>ghi</pre></div>" },
- { "pkg/Test.html",
- "typical_usage_code()</pre>\n" +
- "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" +
- " Example: <pre><code>\n" +
- " line 1 <T> void m(T t) {\n" +
- " line 2 // do something with T\n" +
- " line 3 }\n" +
- " </code></pre>\n" +
- " and so it goes.</div>" },
- { "pkg/Test.html",
- "typical_usage_literal()</pre>\n" +
- "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" +
- " Example: <pre>\n" +
- " line 1 <T> void m(T t) {\n" +
- " line 2 // do something with T\n" +
- " line 3 }\n" +
- " </pre>\n" +
- " and so it goes.</div>" },
- { "pkg/Test.html",
- "recommended_usage_literal()</pre>\n" +
- "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" +
- " Example: <pre>\n" +
- " line 1 <T> void m(T t) {\n" +
- " line 2 // do something with T\n" +
- " line 3 } </pre>\n" +
- " and so it goes.</div>" }
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestLiteralCodeInPre tester = new TestLiteralCodeInPre();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/Test.html", true,
+ "no_pre()</pre>\n"
+ + "<div class=\"block\">abc<code>def</code>ghi</div>",
+ "no_pre_extra_whitespace()</pre>\n"
+ + "<div class=\"block\">abc<code>def </code>ghi</div>",
+ "in_pre()</pre>\n"
+ + "<div class=\"block\"><pre> abc<code> def </code>ghi</pre></div>",
+ "pre_after_text()</pre>\n"
+ + "<div class=\"block\">xyz <pre> abc<code> def </code>ghi</pre></div>",
+ "after_pre()</pre>\n"
+ + "<div class=\"block\">xyz <pre> pqr </pre> abc<code>def </code>ghi</div>",
+ "back_in_pre()</pre>\n"
+ + "<div class=\"block\">xyz <pre> pqr </pre> mno <pre> abc<code> def </code>ghi</pre></div>",
+ "typical_usage_code()</pre>\n"
+ + "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
+ + " Example: <pre><code>\n"
+ + " line 1 <T> void m(T t) {\n"
+ + " line 2 // do something with T\n"
+ + " line 3 }\n"
+ + " </code></pre>\n"
+ + " and so it goes.</div>",
+ "typical_usage_literal()</pre>\n"
+ + "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
+ + " Example: <pre>\n"
+ + " line 1 <T> void m(T t) {\n"
+ + " line 2 // do something with T\n"
+ + " line 3 }\n"
+ + " </pre>\n"
+ + " and so it goes.</div>",
+ "recommended_usage_literal()</pre>\n"
+ + "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
+ + " Example: <pre>\n"
+ + " line 1 <T> void m(T t) {\n"
+ + " line 2 // do something with T\n"
+ + " line 3 } </pre>\n"
+ + " and so it goes.</div>");
}
}
--- a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Fri May 23 09:05:24 2014 -0700
@@ -27,83 +27,63 @@
* @summary Test to make sure that members are inherited properly in the Javadoc.
* Verify that inheritence labels are correct.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestMemberInheritence
* @run main TestMemberInheritence
*/
public class TestMemberInheritence extends JavadocTester {
- private static final String[][] TEST = {
- //Public field should be inherited
- { "pkg/SubClass.html",
- "<a href=\"../pkg/BaseClass.html#pubField\">"},
-
- //Public method should be inherited
- { "pkg/SubClass.html",
- "<a href=\"../pkg/BaseClass.html#pubMethod--\">"},
-
- //Public inner class should be inherited.
- { "pkg/SubClass.html",
- "<a href=\"../pkg/BaseClass.pubInnerClass.html\" title=\"class in pkg\">"},
+ public static void main(String... args) throws Exception {
+ TestMemberInheritence tester = new TestMemberInheritence();
+ tester.runTests();
+ }
- //Protected field should be inherited
- { "pkg/SubClass.html",
- "<a href=\"../pkg/BaseClass.html#proField\">"},
-
- //Protected method should be inherited
- { "pkg/SubClass.html",
- "<a href=\"../pkg/BaseClass.html#proMethod--\">"},
-
- //Protected inner class should be inherited.
- { "pkg/SubClass.html",
- "<a href=\"../pkg/BaseClass.proInnerClass.html\" title=\"class in pkg\">"},
-
- // New labels as of 1.5.0
- { "pkg/SubClass.html",
- "Nested classes/interfaces inherited from class pkg." +
- "<a href=\"../pkg/BaseClass.html\" title=\"class in pkg\">BaseClass</a>"},
- { "pkg/SubClass.html",
- "Nested classes/interfaces inherited from interface pkg." +
- "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</a>"},
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg", "diamond", "inheritDist");
+ checkExit(Exit.OK);
- // Test overriding/implementing methods with generic parameters.
- { "pkg/BaseClass.html",
- "<dl>\n" +
- "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" +
- "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation-java.lang.Class-\">" +
- "getAnnotation</a></code> in interface <code>" +
- "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
- "BaseInterface</a></code></dd>\n" +
- "</dl>"},
-
- // Test diamond inheritence member summary (6256068)
- { "diamond/Z.html",
- "<code><a href=\"../diamond/A.html#aMethod--\">aMethod</a></code>"},
-
- // Test that doc is inherited from closed parent (6270645)
- { "inheritDist/C.html",
- "<div class=\"block\">m1-B</div>"},
+ checkOutput("pkg/SubClass.html", true,
+ // Public field should be inherited
+ "<a href=\"../pkg/BaseClass.html#pubField\">",
+ // Public method should be inherited
+ "<a href=\"../pkg/BaseClass.html#pubMethod--\">",
+ // Public inner class should be inherited.
+ "<a href=\"../pkg/BaseClass.pubInnerClass.html\" title=\"class in pkg\">",
+ // Protected field should be inherited
+ "<a href=\"../pkg/BaseClass.html#proField\">",
+ // Protected method should be inherited
+ "<a href=\"../pkg/BaseClass.html#proMethod--\">",
+ // Protected inner class should be inherited.
+ "<a href=\"../pkg/BaseClass.proInnerClass.html\" title=\"class in pkg\">",
+ // New labels as of 1.5.0
+ "Nested classes/interfaces inherited from class pkg."
+ + "<a href=\"../pkg/BaseClass.html\" title=\"class in pkg\">BaseClass</a>",
+ "Nested classes/interfaces inherited from interface pkg."
+ + "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</a>");
- };
+ checkOutput("pkg/BaseClass.html", true,
+ // Test overriding/implementing methods with generic parameters.
+ "<dl>\n"
+ + "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation-java.lang.Class-\">"
+ + "getAnnotation</a></code> in interface <code>"
+ + "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">"
+ + "BaseInterface</a></code></dd>\n"
+ + "</dl>");
- private static final String[][] NEGATED_TEST = {
- { "pkg/SubClass.html",
- "<a href=\"../pkg/BaseClass.html#staticMethod--\">staticMethod</a></code>"},
- };
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", "diamond",
- "inheritDist"};
+ checkOutput("diamond/Z.html", true,
+ // Test diamond inheritence member summary (6256068)
+ "<code><a href=\"../diamond/A.html#aMethod--\">aMethod</a></code>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestMemberInheritence tester = new TestMemberInheritence();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("inheritDist/C.html", true,
+ // Test that doc is inherited from closed parent (6270645)
+ "<div class=\"block\">m1-B</div>");
+
+ checkOutput("pkg/SubClass.html", false,
+ "<a href=\"../pkg/BaseClass.html#staticMethod--\">staticMethod</a></code>");
}
}
--- a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Fri May 23 09:05:24 2014 -0700
@@ -28,50 +28,40 @@
* type than the method in the child class. Make sure the
* documentation is inherited but the return type isn't.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestMemberSummary
* @run main TestMemberSummary
*/
public class TestMemberSummary extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg","pkg2"
- };
+ public static void main(String... args) throws Exception {
+ TestMemberSummary tester = new TestMemberSummary();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- // Check return type in member summary.
- { "pkg/PublicChild.html",
- "<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>\n" +
- "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">" +
- "returnTypeTest</a></span>()</code>"
- },
- // Check return type in member detail.
- { "pkg/PublicChild.html",
- "<pre>public <a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">" +
- "PublicChild</a> returnTypeTest()</pre>"
- },
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg","pkg2");
+ checkExit(Exit.OK);
- // Legacy anchor dimensions (6290760)
- { "pkg2/A.html",
- "<a name=\"f-java.lang.Object:A-\">\n" +
- "<!-- -->\n" +
- "</a><a name=\"f-T:A-\">\n" +
- "<!-- -->\n" +
- "</a>"
- },
- };
+ checkOutput("pkg/PublicChild.html", true,
+ // Check return type in member summary.
+ "<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>\n"
+ + "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">"
+ + "returnTypeTest</a></span>()</code>",
+ // Check return type in member detail.
+ "<pre>public <a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">"
+ + "PublicChild</a> returnTypeTest()</pre>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestMemberSummary tester = new TestMemberSummary();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ // Legacy anchor dimensions (6290760)
+ checkOutput("pkg2/A.html", true,
+ "<a name=\"f-java.lang.Object:A-\">\n"
+ + "<!-- -->\n"
+ + "</a><a name=\"f-T:A-\">\n"
+ + "<!-- -->\n"
+ + "</a>");
}
}
--- a/langtools/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java Fri May 23 09:05:24 2014 -0700
@@ -26,97 +26,74 @@
* @bug 8002304 8024096
* @summary Test for various method types in the method summary table
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestMethodTypes
+ * @library ../lib
+ * @build JavadocTester
* @run main TestMethodTypes
*/
public class TestMethodTypes extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
- };
+ public static void main(String... args) throws Exception {
+ TestMethodTypes tester = new TestMethodTypes();
+ tester.runTests();
+ }
- private static final String[][] TEST = {
- { "pkg1/A.html",
- "var methods = {"
- },
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
- { "pkg1/A.html",
- "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
- "Methods</span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:show(1);\">" +
- "Static Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
- "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" +
- "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">" +
- "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "</caption>"
- },
-
- { "pkg1/A.html",
- "<tr id=\"i0\" class=\"altColor\">"
- },
-
- { "pkg1/B.html",
- "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
- "Methods</span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
- "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
- "Abstract Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "</caption>"
- },
-
- { "pkg1/D.html",
- "var methods = {"
- },
+ checkOutput("pkg1/A.html", true,
+ "var methods = {",
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All "
+ + "Methods</span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:show(1);\">"
+ + "Static Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">"
+ + "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">"
+ + "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">"
+ + "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "</caption>",
+ "<tr id=\"i0\" class=\"altColor\">");
- { "pkg1/D.html",
- "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
- "Methods</span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
- "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
- "Abstract Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" +
- "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">" +
- "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>" +
- "</caption>"
- },
+ checkOutput("pkg1/B.html", true,
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All "
+ + "Methods</span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">"
+ + "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+ + "Abstract Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "</caption>");
- { "pkg1/D.html",
- "<tr id=\"i0\" class=\"altColor\">"
- },
- };
- private static final String[][] NEGATED_TEST = {
- { "pkg1/A.html",
- "<caption><span>Methods</span><span class=\"tabEnd\"> </span>" +
- "</caption>"
- },
-
- { "pkg1/B.html",
- "<caption><span>Methods</span><span class=\"tabEnd\"> </span>" +
- "</caption>"
- },
+ checkOutput("pkg1/D.html", true,
+ "var methods = {",
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All "
+ + "Methods</span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">"
+ + "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+ + "Abstract Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">"
+ + "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">"
+ + "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>"
+ + "</caption>",
+ "<tr id=\"i0\" class=\"altColor\">");
- { "pkg1/D.html",
- "<caption><span>Methods</span><span class=\"tabEnd\"> </span>" +
- "</caption>"
- },
- };
+ checkOutput("pkg1/A.html", false,
+ "<caption><span>Methods</span><span class=\"tabEnd\"> </span>"
+ + "</caption>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestMethodTypes tester = new TestMethodTypes();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg1/B.html", false,
+ "<caption><span>Methods</span><span class=\"tabEnd\"> </span>"
+ + "</caption>");
+
+ checkOutput("pkg1/D.html", false,
+ "<caption><span>Methods</span><span class=\"tabEnd\"> </span>"
+ + "</caption>");
}
}
--- a/langtools/test/com/sun/javadoc/testModifier/TestModifier.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testModifier/TestModifier.java Fri May 23 09:05:24 2014 -0700
@@ -26,29 +26,25 @@
* @bug 4210388
* @summary Javadoc declares interfaces to be "abstract".
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build ModifierAbstract
* @build JavadocTester
- * @build TestModifier
* @run main TestModifier
*/
public class TestModifier extends JavadocTester {
- private static final String[] ARGS =
- new String[] {
- "-sourcepath", SRC_DIR,
- "-docletpath", SRC_DIR, "-doclet", "ModifierAbstract",
- SRC_DIR + "/Interface.java", SRC_DIR + "/Test.java"};
+ public static void main(String... args) throws Exception {
+ TestModifier tester = new TestModifier();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestModifier tester = new TestModifier();
- if (tester.run(ARGS, NO_TEST, NO_TEST) != 0) {
- throw new Error("Javadoc error occured during execution.");
- }
+ @Test
+ void test() {
+ javadoc("-sourcepath", testSrc,
+ "-docletpath", testSrc,
+ "-doclet", "ModifierAbstract",
+ testSrc("Interface.java"), testSrc("Test.java"));
+ checkExit(Exit.OK);
}
}
--- a/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java Fri May 23 09:05:24 2014 -0700
@@ -27,49 +27,44 @@
* @summary Make sure the Next/Prev Class links iterate through all types.
* Make sure the navagation is 2 columns, not 3.
* @author jamieh
- * @library ../lib/
- * @build JavadocTester TestNavigation
+ * @library ../lib
+ * @build JavadocTester
* @run main TestNavigation
*/
public class TestNavigation extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestNavigation tester = new TestNavigation();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/A.html", true,
+ "<li>Prev Class</li>",
+ "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Next Class</span></a>");
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/A.html", "<li>Prev Class</li>"},
- { "pkg/A.html",
- "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Next Class</span></a>"},
- { "pkg/C.html",
- "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>"},
- { "pkg/C.html",
- "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Next Class</span></a>"},
- { "pkg/E.html",
- "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>"},
- { "pkg/E.html",
- "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"typeNameLink\">Next Class</span></a>"},
- { "pkg/I.html",
- "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>"},
- { "pkg/I.html", "<li>Next Class</li>"},
- // Test for 4664607
- { "pkg/I.html",
- "<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>\n" +
- "<a name=\"navbar.top.firstrow\">\n" +
- "<!-- -->\n" +
- "</a>"}
- };
+ checkOutput("pkg/C.html", true,
+ "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>",
+ "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Next Class</span></a>");
+
+ checkOutput("pkg/E.html", true,
+ "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>",
+ "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"typeNameLink\">Next Class</span></a>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestNavigation tester = new TestNavigation();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/I.html", true,
+ "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>",
+ "<li>Next Class</li>",
+ // Test for 4664607
+ "<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>\n"
+ + "<a name=\"navbar.top.firstrow\">\n"
+ + "<!-- -->\n"
+ + "</a>");
}
}
--- a/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java Fri May 23 09:05:24 2014 -0700
@@ -26,35 +26,28 @@
* @bug 6758050 8025633
* @summary Test HTML output for nested generic types.
* @author bpatel
- * @library ../lib/
- * @build JavadocTester TestNestedGenerics
+ * @library ../lib
+ * @build JavadocTester
* @run main TestNestedGenerics
*/
public class TestNestedGenerics extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[]{
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestNestedGenerics tester = new TestNestedGenerics();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/NestedGenerics.html",
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/NestedGenerics.html", true,
"<div class=\"block\">Contains <a " +
"href=\"../pkg/NestedGenerics.html#foo-java.util.Map-\"><code>foo" +
- "(java.util.Map<A, java.util.Map<A, A>>)</code></a></div>"
- }
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestNestedGenerics tester = new TestNestedGenerics();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ "(java.util.Map<A, java.util.Map<A, A>>)</code></a></div>");
}
}
--- a/langtools/test/com/sun/javadoc/testNestedInlineTag/TestNestedInlineTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testNestedInlineTag/TestNestedInlineTag.java Fri May 23 09:05:24 2014 -0700
@@ -25,12 +25,11 @@
* @test
* @summary Test for nested inline tags. *
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
* @build testtaglets.UnderlineTaglet
* @build testtaglets.BoldTaglet
* @build testtaglets.GreenTaglet
- * @build TestNestedInlineTag
* @run main TestNestedInlineTag
*/
@@ -38,7 +37,6 @@
* This should be green, underlined and bold (Class): {@underline {@bold {@green My test}}} .
*/
public class TestNestedInlineTag extends JavadocTester {
-
/**
* This should be green, underlined and bold (Field): {@underline {@bold {@green My test}}} .
*/
@@ -54,44 +52,35 @@
*/
public void method(){}
- private static final String[][] TEST = {
- //Test nested inline tag in class description.
- { "TestNestedInlineTag.html",
- "This should be green, underlined and bold (Class): <u><b><font color=\"green\">My test</font></b></u>"
- },
-
- //Test nested inline tag in field description.
- { "TestNestedInlineTag.html",
- "This should be green, underlined and bold (Field): <u><b><font color=\"green\">My test</font></b></u>"
- },
-
- //Test nested inline tag in constructor description.
- { "TestNestedInlineTag.html",
- "This should be green, underlined and bold (Constructor): <u><b><font color=\"green\">My test</font></b></u>"
- },
-
- //Test nested inline tag in method description.
- { "TestNestedInlineTag.html",
- "This should be green, underlined and bold (Method): <u><b><font color=\"green\">My test</font></b></u>"
- }
- };
-
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-taglet", "testtaglets.UnderlineTaglet",
- "-taglet", "testtaglets.BoldTaglet",
- "-taglet", "testtaglets.GreenTaglet",
- SRC_DIR + "/TestNestedInlineTag.java"
- };
-
/**
* The entry point of the test.
* @param args the array of command line arguments.
+ * @throws Exception if the test fails
*/
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestNestedInlineTag tester = new TestNestedInlineTag();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-taglet", "testtaglets.UnderlineTaglet",
+ "-taglet", "testtaglets.BoldTaglet",
+ "-taglet", "testtaglets.GreenTaglet",
+ testSrc("TestNestedInlineTag.java"));
+ checkExit(Exit.OK);
+
+ checkOutput("TestNestedInlineTag.html", true,
+ //Test nested inline tag in class description.
+ "This should be green, underlined and bold (Class): <u><b><font color=\"green\">My test</font></b></u>",
+ //Test nested inline tag in field description.
+ "This should be green, underlined and bold (Field): <u><b><font color=\"green\">My test</font></b></u>",
+ //Test nested inline tag in constructor description.
+ "This should be green, underlined and bold (Constructor): <u><b><font color=\"green\">My test</font></b></u>",
+ //Test nested inline tag in method description.
+ "This should be green, underlined and bold (Method): <u><b><font color=\"green\">My test</font></b></u>"
+ );
}
}
--- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Fri May 23 09:05:24 2014 -0700
@@ -28,738 +28,612 @@
* language features. Check the output to ensure that the new
* language features are properly documented.
* @author jamieh
- * @library ../lib/
- * @build JavadocTester TestNewLanguageFeatures
+ * @library ../lib
+ * @build JavadocTester
* @run main TestNewLanguageFeatures
*/
public class TestNewLanguageFeatures extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR, "-use", "-sourcepath", SRC_DIR,
- "pkg", "pkg1", "pkg2"
- };
+ public static void main(String... args) throws Exception {
+ TestNewLanguageFeatures tester = new TestNewLanguageFeatures();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-Xdoclint:none",
+ "-d", "out",
+ "-use", "-sourcepath",
+ testSrc,
+ "pkg", "pkg1", "pkg2");
+ checkExit(Exit.OK);
+
+ checkEnums();
+ checkTypeParameters();
+ checkVarArgs();
+ checkAnnotationTypeUsage();
+ }
- //Input for string search tests.
- private static final String[][] TEST =
- {
- //=================================
- // ENUM TESTING
- //=================================
- //Make sure enum header is correct.
- { "pkg/Coin.html", "Enum Coin</h2>"},
- //Make sure enum signature is correct.
- { "pkg/Coin.html", "<pre>public enum " +
- "<span class=\"typeNameLabel\">Coin</span>\n" +
- "extends java.lang.Enum<<a href=\"../pkg/Coin.html\" " +
- "title=\"enum in pkg\">Coin</a>></pre>"
- },
- //Check for enum constant section
- { "pkg/Coin.html", "<caption><span>Enum Constants" +
- "</span><span class=\"tabEnd\"> </span></caption>"},
- //Detail for enum constant
- { "pkg/Coin.html",
- "<span class=\"memberNameLink\"><a href=\"../pkg/Coin.html#Dime\">Dime</a></span>"},
- //Automatically insert documentation for values() and valueOf().
- { "pkg/Coin.html",
- "Returns an array containing the constants of this enum type,"},
- { "pkg/Coin.html",
- "Returns the enum constant of this type with the specified name"},
- { "pkg/Coin.html", "for (Coin c : Coin.values())"},
- { "pkg/Coin.html",
- "Overloaded valueOf() method has correct documentation."},
- { "pkg/Coin.html",
- "Overloaded values method has correct documentation."},
+ //=================================
+ // ENUM TESTING
+ //=================================
+ void checkEnums() {
+ checkOutput("pkg/Coin.html", true,
+ // Make sure enum header is correct.
+ "Enum Coin</h2>",
+ // Make sure enum signature is correct.
+ "<pre>public enum "
+ + "<span class=\"typeNameLabel\">Coin</span>\n"
+ + "extends java.lang.Enum<<a href=\"../pkg/Coin.html\" "
+ + "title=\"enum in pkg\">Coin</a>></pre>",
+ // Check for enum constant section
+ "<caption><span>Enum Constants"
+ + "</span><span class=\"tabEnd\"> </span></caption>",
+ // Detail for enum constant
+ "<span class=\"memberNameLink\"><a href=\"../pkg/Coin.html#Dime\">Dime</a></span>",
+ // Automatically insert documentation for values() and valueOf().
+ "Returns an array containing the constants of this enum type,",
+ "Returns the enum constant of this type with the specified name",
+ "for (Coin c : Coin.values())",
+ "Overloaded valueOf() method has correct documentation.",
+ "Overloaded values method has correct documentation.");
+
+ // NO constructor section
+ checkOutput("pkg/Coin.html", false,
+ "<h3>Constructor Summary</h3>");
+ }
+
+ //=================================
+ // TYPE PARAMETER TESTING
+ //=================================
- //=================================
- // TYPE PARAMETER TESTING
- //=================================
- //Make sure the header is correct.
- { "pkg/TypeParameters.html",
- "Class TypeParameters<E></h2>"},
- //Check class type parameters section.
- { "pkg/TypeParameters.html",
- "<dt><span class=\"paramLabel\">Type Parameters:</span></dt>\n" +
- "<dd><code>E</code> - " +
- "the type parameter for this class."},
- //Type parameters in @see/@link
- { "pkg/TypeParameters.html",
- "<dl>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
- "<dd>" +
- "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
- "<code>TypeParameters</code></a></dd>\n" +
- "</dl>"},
- //Method that uses class type parameter.
- { "pkg/TypeParameters.html",
- "(<a href=\"../pkg/TypeParameters.html\" title=\"type " +
- "parameter in TypeParameters\">E</a> param)"},
- //Method type parameter section.
- { "pkg/TypeParameters.html",
- "<span class=\"paramLabel\">Type Parameters:</span></dt>\n" +
- "<dd><code>T</code> - This is the first " +
- "type parameter.</dd>\n" +
- "<dd><code>V</code> - This is the second type " +
- "parameter."},
- //Signature of method with type parameters
- { "pkg/TypeParameters.html",
- "public <T extends java.util.List,V> " +
- "java.lang.String[] methodThatHasTypeParameters"},
- //Wildcard testing.
- { "pkg/Wildcards.html",
- "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
- "TypeParameters</a><? super java.lang.String> a"},
- { "pkg/Wildcards.html",
- "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
- "TypeParameters</a><? extends java.lang.StringBuffer> b"},
- { "pkg/Wildcards.html",
- "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
- "TypeParameters</a> c"},
- //Bad type parameter warnings.
- {WARNING_OUTPUT, "warning - @param argument " +
- "\"<BadClassTypeParam>\" is not a type parameter name."},
- {WARNING_OUTPUT, "warning - @param argument " +
- "\"<BadMethodTypeParam>\" is not a type parameter name."},
-
- //Signature of subclass that has type parameters.
- { "pkg/TypeParameterSubClass.html",
- "<pre>public class <span class=\"typeNameLabel\">TypeParameterSubClass<T extends " +
- "java.lang.String></span>\n" +
- "extends " +
- "<a href=\"../pkg/TypeParameterSuperClass.html\" title=\"class in pkg\">" +
- "TypeParameterSuperClass</a><T></pre>"},
+ void checkTypeParameters() {
+ checkOutput("pkg/TypeParameters.html", true,
+ // Make sure the header is correct.
+ "Class TypeParameters<E></h2>",
+ // Check class type parameters section.
+ "<dt><span class=\"paramLabel\">Type Parameters:</span></dt>\n"
+ + "<dd><code>E</code> - "
+ + "the type parameter for this class.",
+ // Type parameters in @see/@link
+ "<dl>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ + "<dd>"
+ + "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
+ + "<code>TypeParameters</code></a></dd>\n"
+ + "</dl>",
+ // Method that uses class type parameter.
+ "(<a href=\"../pkg/TypeParameters.html\" title=\"type "
+ + "parameter in TypeParameters\">E</a> param)",
+ // Method type parameter section.
+ "<span class=\"paramLabel\">Type Parameters:</span></dt>\n"
+ + "<dd><code>T</code> - This is the first "
+ + "type parameter.</dd>\n"
+ + "<dd><code>V</code> - This is the second type "
+ + "parameter.",
+ // Signature of method with type parameters
+ "public <T extends java.util.List,V> "
+ + "java.lang.String[] methodThatHasTypeParameters");
- //Interface generic parameter substitution
- //Signature of subclass that has type parameters.
- { "pkg/TypeParameters.html",
- "<dl>\n" +
- "<dt>All Implemented Interfaces:</dt>\n" +
- "<dd><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">" +
- "SubInterface</a><E>, <a href=\"../pkg/SuperInterface.html\" " +
- "title=\"interface in pkg\">SuperInterface</a><E></dd>\n" +
- "</dl>"},
- { "pkg/SuperInterface.html",
- "<dl>\n" +
- "<dt>All Known Subinterfaces:</dt>\n" +
- "<dd><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">" +
- "SubInterface</a><V></dd>\n" +
- "</dl>"},
- { "pkg/SubInterface.html",
- "<dl>\n" +
- "<dt>All Superinterfaces:</dt>\n" +
- "<dd><a href=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">" +
- "SuperInterface</a><V></dd>\n" +
- "</dl>"},
+ checkOutput("pkg/Wildcards.html", true,
+ // Wildcard testing.
+ "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
+ + "TypeParameters</a><? super java.lang.String> a",
+ "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
+ + "TypeParameters</a><? extends java.lang.StringBuffer> b",
+ "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
+ + "TypeParameters</a> c");
- //=================================
- // VAR ARG TESTING
- //=================================
- { "pkg/VarArgs.html", "(int... i)"},
- { "pkg/VarArgs.html", "(int[][]... i)"},
- { "pkg/VarArgs.html", "-int:A...-"},
- { "pkg/VarArgs.html",
- "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
- "TypeParameters</a>... t"},
+ checkOutput(Output.WARNING, true,
+ // Bad type parameter warnings.
+ "warning - @param argument "
+ + "\"<BadClassTypeParam>\" is not a type parameter name.",
+ "warning - @param argument "
+ + "\"<BadMethodTypeParam>\" is not a type parameter name.");
- //=================================
- // ANNOTATION TYPE TESTING
- //=================================
- //Make sure the summary links are correct.
- { "pkg/AnnotationType.html",
- "<li>Summary: </li>\n" +
- "<li>Field | </li>\n" +
- "<li><a href=\"#annotation.type.required.element.summary\">" +
- "Required</a> | </li>\n" +
- "<li>" +
- "<a href=\"#annotation.type.optional.element.summary\">Optional</a></li>"},
- //Make sure the detail links are correct.
- { "pkg/AnnotationType.html",
- "<li>Detail: </li>\n" +
- "<li>Field | </li>\n" +
- "<li><a href=\"#annotation.type.element.detail\">Element</a></li>"},
- //Make sure the heading is correct.
- { "pkg/AnnotationType.html",
- "Annotation Type AnnotationType</h2>"},
- //Make sure the signature is correct.
- { "pkg/AnnotationType.html",
- "public @interface <span class=\"memberNameLabel\">AnnotationType</span>"},
- //Make sure member summary headings are correct.
- { "pkg/AnnotationType.html",
- "<h3>Required Element Summary</h3>"},
- { "pkg/AnnotationType.html",
- "<h3>Optional Element Summary</h3>"},
- //Make sure element detail heading is correct
- { "pkg/AnnotationType.html",
- "Element Detail"},
- //Make sure default annotation type value is printed when necessary.
- { "pkg/AnnotationType.html",
- "<dl>\n" +
- "<dt>Default:</dt>\n" +
- "<dd>\"unknown\"</dd>\n" +
- "</dl>"},
+ // Signature of subclass that has type parameters.
+ checkOutput("pkg/TypeParameterSubClass.html", true,
+ "<pre>public class <span class=\"typeNameLabel\">TypeParameterSubClass<T extends "
+ + "java.lang.String></span>\n"
+ + "extends "
+ + "<a href=\"../pkg/TypeParameterSuperClass.html\" title=\"class in pkg\">"
+ + "TypeParameterSuperClass</a><T></pre>");
- //=================================
- // ANNOTATION TYPE USAGE TESTING
- //=================================
+ // Interface generic parameter substitution
+ // Signature of subclass that has type parameters.
+ checkOutput("pkg/TypeParameters.html", true,
+ "<dl>\n"
+ + "<dt>All Implemented Interfaces:</dt>\n"
+ + "<dd><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">"
+ + "SubInterface</a><E>, <a href=\"../pkg/SuperInterface.html\" "
+ + "title=\"interface in pkg\">SuperInterface</a><E></dd>\n"
+ + "</dl>");
- //PACKAGE
- { "pkg/package-summary.html",
- "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"Package Annotation\",\n" +
- " <a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)"},
-
- //CLASS
- { "pkg/AnnotationTypeUsage.html",
- "<pre><a href=\"../pkg/AnnotationType.html\" " +
- "title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
- "=\"Class Annotation\",\n" +
- " <a href=\"../pkg/AnnotationType.html#required--\">" +
- "required</a>=1994)\n" +
- "public class <span class=\"typeNameLabel\">" +
- "AnnotationTypeUsage</span>\n" +
- "extends java.lang.Object</pre>"},
+ checkOutput("pkg/SuperInterface.html", true,
+ "<dl>\n"
+ + "<dt>All Known Subinterfaces:</dt>\n"
+ + "<dd><a href=\"../pkg/SubInterface.html\" title=\"interface in pkg\">"
+ + "SubInterface</a><V></dd>\n"
+ + "</dl>");
+ checkOutput("pkg/SubInterface.html", true,
+ "<dl>\n"
+ + "<dt>All Superinterfaces:</dt>\n"
+ + "<dd><a href=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">"
+ + "SuperInterface</a><V></dd>\n"
+ + "</dl>");
- //FIELD
- { "pkg/AnnotationTypeUsage.html",
- "<pre><a href=\"../pkg/AnnotationType.html\" " +
- "title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
- "=\"Field Annotation\",\n" +
- " <a href=\"../pkg/AnnotationType.html#required--\">" +
- "required</a>=1994)\n" +
- "public int field</pre>"},
-
- //CONSTRUCTOR
- { "pkg/AnnotationTypeUsage.html",
- "<pre><a href=\"../pkg/AnnotationType.html\" " +
- "title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
- "=\"Constructor Annotation\",\n" +
- " <a href=\"../pkg/AnnotationType.html#required--\">" +
- "required</a>=1994)\n" +
- "public AnnotationTypeUsage()</pre>"},
+ //==============================================================
+ // Handle multiple bounds.
+ //==============================================================
+ checkOutput("pkg/MultiTypeParameters.html", true,
+ "public <T extends java.lang.Number & java.lang.Runnable> T foo(T t)");
- //METHOD
- { "pkg/AnnotationTypeUsage.html",
- "<pre><a href=\"../pkg/AnnotationType.html\" " +
- "title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
- "=\"Method Annotation\",\n" +
- " <a href=\"../pkg/AnnotationType.html#required--\">" +
- "required</a>=1994)\n" +
- "public void method()</pre>"},
-
- //METHOD PARAMS
- { "pkg/AnnotationTypeUsage.html",
- "<pre>public void methodWithParams(" +
- "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
- "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" +
- "optional</a>=\"Parameter Annotation\",<a " +
- "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)\n" +
- " int documented,\n" +
- " int undocmented)</pre>"},
+ //==============================================================
+ // Test Class-Use Documentation for Type Parameters.
+ //==============================================================
+ // ClassUseTest1: <T extends Foo & Foo2>
+ checkOutput("pkg2/class-use/Foo.html", true,
+ "<caption><span>Classes in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">"
+ + "Foo</a></span><span class=\"tabEnd\"> </span></caption>",
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" "
+ + "title=\"class in pkg2\">ClassUseTest1</a><T extends "
+ + "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo"
+ + "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">"
+ + "Foo2</a>></span></code> </td>",
+ "<caption><span>Methods in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/Foo.html\" title=\"class in "
+ + "pkg2\">Foo</a></span><span class=\"tabEnd\"> </span></caption>",
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest1."
+ + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/"
+ + "ClassUseTest1.html#method-T-\">method</a></span>"
+ + "(T t)</code> </td>",
+ "<caption><span>Fields in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">"
+ + "Foo</a></span><span class=\"tabEnd\"> </span></caption>",
+ "td class=\"colFirst\"><code><a href=\"../../pkg2/"
+ + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>"
+ + "<<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\""
+ + ">Foo</a>></code></td>"
+ );
- //CONSTRUCTOR PARAMS
- { "pkg/AnnotationTypeUsage.html",
- "<pre>public AnnotationTypeUsage(<a " +
- "href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
- "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" +
- "optional</a>=\"Constructor Param Annotation\",<a " +
- "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)\n" +
- " int documented,\n" +
- " int undocmented)</pre>"},
-
- //=================================
- // ANNOTATION TYPE USAGE TESTING (All Different Types).
- //=================================
-
- //Integer
- { "pkg1/B.html",
- "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,"},
-
- //Double
- { "pkg1/B.html",
- "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,"},
-
- //Boolean
- { "pkg1/B.html",
- "<a href=\"../pkg1/A.html#b--\">b</a>=true,"},
+ checkOutput("pkg2/class-use/ParamTest.html", true,
+ "<caption><span>Fields in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> declared as <a href=\"../"
+ + "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest"
+ + "</a></span><span class=\"tabEnd\"> </span></caption>",
+ "<td class=\"colFirst\"><code><a href=\"../../pkg2/"
+ + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a><<a "
+ + "href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</a"
+ + ">></code></td>"
+ );
- //String
- { "pkg1/B.html",
- "<a href=\"../pkg1/A.html#s--\">s</a>=\"sigh\","},
-
- //Class
- { "pkg1/B.html",
- "<a href=\"../pkg1/A.html#c--\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,"},
-
- //Bounded Class
- { "pkg1/B.html",
- "<a href=\"../pkg1/A.html#w--\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,"},
-
- //Enum
- { "pkg1/B.html",
- "<a href=\"../pkg1/A.html#e--\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,"},
-
- //Annotation Type
- { "pkg1/B.html",
- "<a href=\"../pkg1/A.html#a--\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994),"},
-
- //String Array
- { "pkg1/B.html",
- "<a href=\"../pkg1/A.html#sa--\">sa</a>={\"up\",\"down\"},"},
-
- //Primitive
- { "pkg1/B.html",
- "<a href=\"../pkg1/A.html#primitiveClassTest--\">primitiveClassTest</a>=boolean.class,"},
-
- //XXX: Add array test case after this if fixed:
- //5020899: Incorrect internal representation of class-valued annotation elements
-
- //Make sure that annotations are surrounded by <pre> and </pre>
- { "pkg1/B.html",
- "<pre><a href=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</a>"},
- { "pkg1/B.html",
- "public interface <span class=\"typeNameLabel\">B</span></pre>"},
-
+ checkOutput("pkg2/class-use/Foo2.html", true,
+ "<caption><span>Classes in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/Foo2.html\" title=\"interface "
+ + "in pkg2\">Foo2</a></span><span class=\"tabEnd\"> "
+ + "</span></caption>",
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" "
+ + "title=\"class in pkg2\">ClassUseTest1</a><T extends "
+ + "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo"
+ + "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">"
+ + "Foo2</a>></span></code> </td>",
+ "<caption><span>Methods in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/Foo2.html\" title=\"interface "
+ + "in pkg2\">Foo2</a></span><span class=\"tabEnd\"> "
+ + "</span></caption>",
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">"
+ + "ClassUseTest1.</span><code><span class=\"memberNameLink\"><a href=\"../../"
+ + "pkg2/ClassUseTest1.html#method-T-\">method</a></span>"
+ + "(T t)</code> </td>"
+ );
- //==============================================================
- // Handle multiple bounds.
- //==============================================================
- { "pkg/MultiTypeParameters.html",
- "public <T extends java.lang.Number & java.lang.Runnable> T foo(T t)"},
-
- //==============================================================
- // Test Class-Use Documenation for Type Parameters.
- //==============================================================
-
- //ClassUseTest1: <T extends Foo & Foo2>
- { "pkg2/class-use/Foo.html",
- "<caption><span>Classes in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">" +
- "Foo</a></span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/class-use/Foo.html",
- "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" " +
- "title=\"class in pkg2\">ClassUseTest1</a><T extends " +
- "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" +
- "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" +
- "Foo2</a>></span></code> </td>"
- },
- { "pkg2/class-use/Foo.html",
- "<caption><span>Methods in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/Foo.html\" title=\"class in " +
- "pkg2\">Foo</a></span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/class-use/Foo.html",
- "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest1." +
- "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/" +
- "ClassUseTest1.html#method-T-\">method</a></span>" +
- "(T t)</code> </td>"
- },
- { "pkg2/class-use/Foo.html",
- "<caption><span>Fields in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">" +
- "Foo</a></span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/class-use/Foo.html",
- "td class=\"colFirst\"><code><a href=\"../../pkg2/" +
- "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>" +
- "<<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\"" +
- ">Foo</a>></code></td>"
- },
+ // ClassUseTest2: <T extends ParamTest<Foo3>>
+ checkOutput("pkg2/class-use/ParamTest.html", true,
+ "<caption><span>Classes in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class "
+ + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" "
+ + "title=\"class in pkg2\">ClassUseTest2</a><T extends "
+ + "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">"
+ + "ParamTest</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">"
+ + "Foo3</a>>></span></code> </td>",
+ "<caption><span>Methods in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class "
+ + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest2."
+ + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/"
+ + "ClassUseTest2.html#method-T-\">method</a></span>"
+ + "(T t)</code> </td>",
+ "<caption><span>Fields in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> declared as <a href=\"../"
+ + "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest"
+ + "</a></span><span class=\"tabEnd\"> </span></caption>",
+ "<td class=\"colFirst\"><code><a href=\"../../pkg2/"
+ + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>"
+ + "<<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">"
+ + "Foo</a>></code></td>",
+ "<caption><span>Methods in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/ParamTest.html\" title=\"class "
+ + "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<td class=\"colFirst\"><code><T extends <a href=\"../"
+ + "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest"
+ + "</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in "
+ + "pkg2\">Foo3</a>>><br><a href=\"../../pkg2/"
+ + "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>"
+ + "<<a href=\"../../pkg2/Foo3.html\" title=\"class in "
+ + "pkg2\">Foo3</a>></code></td>"
+ );
- { "pkg2/class-use/ParamTest.html",
- "<caption><span>Fields in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> declared as <a href=\"../" +
- "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest" +
- "</a></span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/class-use/ParamTest.html",
- "<td class=\"colFirst\"><code><a href=\"../../pkg2/" +
- "ParamTest.html\" title=\"class in pkg2\">ParamTest</a><<a " +
- "href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</a" +
- ">></code></td>"
- },
+ checkOutput("pkg2/class-use/Foo3.html", true,
+ "<caption><span>Classes in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">"
+ + "Foo3</a></span><span class=\"tabEnd\"> </span></caption>",
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" "
+ + "title=\"class in pkg2\">ClassUseTest2</a><T extends "
+ + "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">"
+ + "ParamTest</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">"
+ + "Foo3</a>>></span></code> </td>",
+ "<caption><span>Methods in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/Foo3.html\" title=\"class in "
+ + "pkg2\">Foo3</a></span><span class=\"tabEnd\"> "
+ + "</span></caption>",
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest2."
+ + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/"
+ + "ClassUseTest2.html#method-T-\">method</a></span>"
+ + "(T t)</code> </td>",
+ "<caption><span>Methods in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> that return types with "
+ + "arguments of type <a href=\"../../pkg2/Foo3.html\" title"
+ + "=\"class in pkg2\">Foo3</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<td class=\"colFirst\"><code><T extends <a href=\"../../"
+ + "pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</a><"
+ + "<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3"
+ + "</a>>><br><a href=\"../../pkg2/ParamTest.html\" "
+ + "title=\"class in pkg2\">ParamTest</a><<a href=\"../../pkg2/"
+ + "Foo3.html\" title=\"class in pkg2\">Foo3</a>></code></td>"
+ );
- { "pkg2/class-use/Foo2.html",
- "<caption><span>Classes in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/Foo2.html\" title=\"interface " +
- "in pkg2\">Foo2</a></span><span class=\"tabEnd\"> " +
- "</span></caption>"
- },
- { "pkg2/class-use/Foo2.html",
- "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" " +
- "title=\"class in pkg2\">ClassUseTest1</a><T extends " +
- "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" +
- "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" +
- "Foo2</a>></span></code> </td>"
- },
- { "pkg2/class-use/Foo2.html",
- "<caption><span>Methods in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/Foo2.html\" title=\"interface " +
- "in pkg2\">Foo2</a></span><span class=\"tabEnd\"> " +
- "</span></caption>"
- },
- { "pkg2/class-use/Foo2.html",
- "<td class=\"colLast\"><span class=\"typeNameLabel\">" +
- "ClassUseTest1.</span><code><span class=\"memberNameLink\"><a href=\"../../" +
- "pkg2/ClassUseTest1.html#method-T-\">method</a></span>" +
- "(T t)</code> </td>"
- },
+ // ClassUseTest3: <T extends ParamTest2<List<? extends Foo4>>>
+ checkOutput("pkg2/class-use/ParamTest2.html", true,
+ "<caption><span>Classes in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class "
+ + "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" "
+ + "title=\"class in pkg2\">ClassUseTest3</a><T extends "
+ + "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
+ + "ParamTest2</a><java.util.List<? extends "
+ + "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">"
+ + "Foo4</a>>>></span></code> </td>",
+ "<caption><span>Methods in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class "
+ + "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3"
+ + ".</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3."
+ + "html#method-T-\">method</a></span>(T t)</code> </td>",
+ "<td class=\"colFirst\"><code><T extends <a href=\"../"
+ + "../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
+ + "ParamTest2</a><java.util.List<? extends <a href=\".."
+ + "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>>"
+ + ">><br><a href=\"../../pkg2/ParamTest2.html\" "
+ + "title=\"class in pkg2\">ParamTest2</a><java.util.List"
+ + "<? extends <a href=\"../../pkg2/Foo4.html\" title=\""
+ + "class in pkg2\">Foo4</a>>></code></td>"
+ );
- //ClassUseTest2: <T extends ParamTest<Foo3>>
- { "pkg2/class-use/ParamTest.html",
- "<caption><span>Classes in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/ParamTest.html\" title=\"class " +
- "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/class-use/ParamTest.html",
- "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" " +
- "title=\"class in pkg2\">ClassUseTest2</a><T extends " +
- "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">" +
- "ParamTest</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
- "Foo3</a>>></span></code> </td>"
- },
- { "pkg2/class-use/ParamTest.html",
- "<caption><span>Methods in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/ParamTest.html\" title=\"class " +
- "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/class-use/ParamTest.html",
- "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest2." +
- "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/" +
- "ClassUseTest2.html#method-T-\">method</a></span>" +
- "(T t)</code> </td>"
- },
- { "pkg2/class-use/ParamTest.html",
- "<caption><span>Fields in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> declared as <a href=\"../" +
- "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest" +
- "</a></span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/class-use/ParamTest.html",
- "<td class=\"colFirst\"><code><a href=\"../../pkg2/" +
- "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>" +
- "<<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">" +
- "Foo</a>></code></td>"
- },
- { "pkg2/class-use/ParamTest.html",
- "<caption><span>Methods in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/ParamTest.html\" title=\"class " +
- "in pkg2\">ParamTest</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/class-use/ParamTest.html",
- "<td class=\"colFirst\"><code><T extends <a href=\"../" +
- "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest" +
- "</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in " +
- "pkg2\">Foo3</a>>><br><a href=\"../../pkg2/" +
- "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>" +
- "<<a href=\"../../pkg2/Foo3.html\" title=\"class in " +
- "pkg2\">Foo3</a>></code></td>"
- },
+ checkOutput("pkg2/class-use/Foo4.html", true,
+ "<caption><span>Classes in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
+ + "pkg2\">Foo4</a></span><span class=\"tabEnd\"> "
+ + "</span></caption>",
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" "
+ + "title=\"class in pkg2\">ClassUseTest3</a><T extends "
+ + "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
+ + "ParamTest2</a><java.util.List<? extends "
+ + "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">"
+ + "Foo4</a>>>></span></code> </td>",
+ "<caption><span>Methods in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type parameters of "
+ + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
+ + "pkg2\">Foo4</a></span><span class=\"tabEnd\"> </span></caption>",
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3."
+ + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3."
+ + "html#method-T-\">method</a></span>(T t)</code>"
+ + " </td>",
+ "<caption><span>Methods in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> that return types with "
+ + "arguments of type <a href=\"../../pkg2/Foo4.html\" "
+ + "title=\"class in pkg2\">Foo4</a></span><span class=\""
+ + "tabEnd\"> </span></caption>",
+ "<td class=\"colFirst\"><code><T extends <a href=\"../"
+ + "../pkg2/ParamTest2.html\" title=\"class in pkg2\">"
+ + "ParamTest2</a><java.util.List<? extends <a href=\".."
+ + "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>>"
+ + ">><br><a href=\"../../pkg2/ParamTest2.html\" "
+ + "title=\"class in pkg2\">ParamTest2</a><java.util.List"
+ + "<? extends <a href=\"../../pkg2/Foo4.html\" title=\""
+ + "class in pkg2\">Foo4</a>>></code></td>"
+ );
- { "pkg2/class-use/Foo3.html",
- "<caption><span>Classes in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
- "Foo3</a></span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/class-use/Foo3.html",
- "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" " +
- "title=\"class in pkg2\">ClassUseTest2</a><T extends " +
- "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">" +
- "ParamTest</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
- "Foo3</a>>></span></code> </td>"
- },
- { "pkg2/class-use/Foo3.html",
- "<caption><span>Methods in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/Foo3.html\" title=\"class in " +
- "pkg2\">Foo3</a></span><span class=\"tabEnd\"> " +
- "</span></caption>"
- },
- { "pkg2/class-use/Foo3.html",
- "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest2." +
- "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/" +
- "ClassUseTest2.html#method-T-\">method</a></span>" +
- "(T t)</code> </td>"
- },
- { "pkg2/class-use/Foo3.html",
- "<caption><span>Methods in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> that return types with " +
- "arguments of type <a href=\"../../pkg2/Foo3.html\" title" +
- "=\"class in pkg2\">Foo3</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/class-use/Foo3.html",
- "<td class=\"colFirst\"><code><T extends <a href=\"../../" +
- "pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</a><" +
- "<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3" +
- "</a>>><br><a href=\"../../pkg2/ParamTest.html\" " +
- "title=\"class in pkg2\">ParamTest</a><<a href=\"../../pkg2/" +
- "Foo3.html\" title=\"class in pkg2\">Foo3</a>></code></td>"
- },
+ // Type parameters in constructor and method args
+ checkOutput("pkg2/class-use/Foo4.html", true,
+ "<caption><span>Method parameters in <a href=\"../../pkg2/"
+ + "package-summary.html\">pkg2</a> with type arguments of "
+ + "type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
+ + "pkg2\">Foo4</a></span><span class=\"tabEnd\"> "
+ + "</span></caption>\n"
+ + "<tr>\n"
+ + "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Method and Description</th>\n"
+ + "</tr>\n"
+ + "<tbody>\n"
+ + "<tr class=\"altColor\">\n"
+ + "<td class=\"colFirst\"><code>void</code></td>\n"
+ + "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3."
+ + "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3."
+ + "html#method-java.util.Set-\">method</a></span>(java."
+ + "util.Set<<a href=\"../../pkg2/Foo4.html\" title=\""
+ + "class in pkg2\">Foo4</a>> p)</code> </td>\n"
+ + "</tr>\n"
+ + "</tbody>",
+ "<caption><span>Constructor parameters in <a href=\"../../"
+ + "pkg2/package-summary.html\">pkg2</a> with type arguments "
+ + "of type <a href=\"../../pkg2/Foo4.html\" title=\"class in "
+ + "pkg2\">Foo4</a></span><span class=\"tabEnd\"> "
+ + "</span></caption>"
+ );
+
+ //=================================
+ // TYPE PARAMETER IN INDEX
+ //=================================
+ checkOutput("index-all.html", true,
+ "<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">"
+ + "method(Vector<Object>)</a></span>"
+ );
+
+ // TODO: duplicate of previous case; left in delibarately for now to simplify comparison testing
+ //=================================
+ // TYPE PARAMETER IN INDEX
+ //=================================
+ checkOutput("index-all.html", true,
+ "<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">"
+ + "method(Vector<Object>)</a></span>"
+ );
- //ClassUseTest3: <T extends ParamTest2<List<? extends Foo4>>>
- { "pkg2/class-use/ParamTest2.html",
- "<caption><span>Classes in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class " +
- "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/class-use/ParamTest2.html",
- "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" " +
- "title=\"class in pkg2\">ClassUseTest3</a><T extends " +
- "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
- "ParamTest2</a><java.util.List<? extends " +
- "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
- "Foo4</a>>>></span></code> </td>"
- },
- { "pkg2/class-use/ParamTest2.html",
- "<caption><span>Methods in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/ParamTest2.html\" title=\"class " +
- "in pkg2\">ParamTest2</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
- { "pkg2/class-use/ParamTest2.html",
- "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3" +
- ".</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3." +
- "html#method-T-\">method</a></span>(T t)</code> </td>"
- },
- { "pkg2/class-use/ParamTest2.html",
- "<td class=\"colFirst\"><code><T extends <a href=\"../" +
- "../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
- "ParamTest2</a><java.util.List<? extends <a href=\".." +
- "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>>" +
- ">><br><a href=\"../../pkg2/ParamTest2.html\" " +
- "title=\"class in pkg2\">ParamTest2</a><java.util.List" +
- "<? extends <a href=\"../../pkg2/Foo4.html\" title=\"" +
- "class in pkg2\">Foo4</a>>></code></td>"
- },
+ // No type parameters in class frame.
+ checkOutput("allclasses-frame.html", false,
+ "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
+ + "TypeParameters</a><<a href=\"../pkg/TypeParameters.html\" "
+ + "title=\"type parameter in TypeParameters\">E</a>>"
+ );
+
+ }
+
+ //=================================
+ // VAR ARG TESTING
+ //=================================
+ void checkVarArgs() {
+ checkOutput("pkg/VarArgs.html", true,
+ "(int... i)",
+ "(int[][]... i)",
+ "-int:A...-",
+ "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">"
+ + "TypeParameters</a>... t");
+ }
- { "pkg2/class-use/Foo4.html",
- "<caption><span>Classes in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/Foo4.html\" title=\"class in " +
- "pkg2\">Foo4</a></span><span class=\"tabEnd\"> " +
- "</span></caption>"
- },
- { "pkg2/class-use/Foo4.html",
- "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" " +
- "title=\"class in pkg2\">ClassUseTest3</a><T extends " +
- "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
- "ParamTest2</a><java.util.List<? extends " +
- "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
- "Foo4</a>>>></span></code> </td>"
- },
- { "pkg2/class-use/Foo4.html",
- "<caption><span>Methods in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type parameters of " +
- "type <a href=\"../../pkg2/Foo4.html\" title=\"class in " +
- "pkg2\">Foo4</a></span><span class=\"tabEnd\"> </span></caption>"
- },
- { "pkg2/class-use/Foo4.html",
- "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3." +
- "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3." +
- "html#method-T-\">method</a></span>(T t)</code>" +
- " </td>"
- },
- { "pkg2/class-use/Foo4.html",
- "<caption><span>Methods in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> that return types with " +
- "arguments of type <a href=\"../../pkg2/Foo4.html\" " +
- "title=\"class in pkg2\">Foo4</a></span><span class=\"" +
- "tabEnd\"> </span></caption>"
- },
- { "pkg2/class-use/Foo4.html",
- "<td class=\"colFirst\"><code><T extends <a href=\"../" +
- "../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
- "ParamTest2</a><java.util.List<? extends <a href=\".." +
- "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>>" +
- ">><br><a href=\"../../pkg2/ParamTest2.html\" " +
- "title=\"class in pkg2\">ParamTest2</a><java.util.List" +
- "<? extends <a href=\"../../pkg2/Foo4.html\" title=\"" +
- "class in pkg2\">Foo4</a>>></code></td>"
- },
+ //=================================
+ // ANNOTATION TYPE TESTING
+ //=================================
+ void checkAnnotationTypes() {
+ checkOutput("pkg/AnnotationType.html", true,
+ // Make sure the summary links are correct.
+ "<li>Summary: </li>\n"
+ + "<li>Field | </li>\n"
+ + "<li><a href=\"#annotation.type.required.element.summary\">"
+ + "Required</a> | </li>\n"
+ + "<li>"
+ + "<a href=\"#annotation.type.optional.element.summary\">Optional</a></li>",
+ // Make sure the detail links are correct.
+ "<li>Detail: </li>\n"
+ + "<li>Field | </li>\n"
+ + "<li><a href=\"#annotation.type.element.detail\">Element</a></li>",
+ // Make sure the heading is correct.
+ "Annotation Type AnnotationType</h2>",
+ // Make sure the signature is correct.
+ "public @interface <span class=\"memberNameLabel\">AnnotationType</span>",
+ // Make sure member summary headings are correct.
+ "<h3>Required Element Summary</h3>",
+ "<h3>Optional Element Summary</h3>",
+ // Make sure element detail heading is correct
+ "Element Detail",
+ // Make sure default annotation type value is printed when necessary.
+ "<dl>\n"
+ + "<dt>Default:</dt>\n"
+ + "<dd>\"unknown\"</dd>\n"
+ + "</dl>");
+ }
+
+ //=================================
+ // ANNOTATION TYPE USAGE TESTING
+ //=================================
+ void checkAnnotationTypeUsage() {
+ checkOutput("pkg/package-summary.html", true,
+ // PACKAGE
+ "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"Package Annotation\",\n"
+ + " <a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)");
- //Type parameters in constructor and method args
- { "pkg2/class-use/Foo4.html",
- "<caption><span>Method parameters in <a href=\"../../pkg2/" +
- "package-summary.html\">pkg2</a> with type arguments of " +
- "type <a href=\"../../pkg2/Foo4.html\" title=\"class in " +
- "pkg2\">Foo4</a></span><span class=\"tabEnd\"> " +
- "</span></caption>\n" +
- "<tr>\n" +
- "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
- "<th class=\"colLast\" scope=\"col\">Method and Description</th>\n" +
- "</tr>\n" +
- "<tbody>\n" +
- "<tr class=\"altColor\">\n" +
- "<td class=\"colFirst\"><code>void</code></td>\n" +
- "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3." +
- "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3." +
- "html#method-java.util.Set-\">method</a></span>(java." +
- "util.Set<<a href=\"../../pkg2/Foo4.html\" title=\"" +
- "class in pkg2\">Foo4</a>> p)</code> </td>\n" +
- "</tr>\n" +
- "</tbody>"
- },
- { "pkg2/class-use/Foo4.html",
- "<caption><span>Constructor parameters in <a href=\"../../" +
- "pkg2/package-summary.html\">pkg2</a> with type arguments " +
- "of type <a href=\"../../pkg2/Foo4.html\" title=\"class in " +
- "pkg2\">Foo4</a></span><span class=\"tabEnd\"> " +
- "</span></caption>"
- },
-
- //=================================
- // Annotatation Type Usage
- //=================================
- { "pkg/class-use/AnnotationType.html",
- "<caption><span>Packages with annotations of type <a href=\"" +
- "../../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
- "AnnotationType</a></span><span class=\"tabEnd\"> " +
- "</span></caption>"
- },
-
- { "pkg/class-use/AnnotationType.html",
- "<caption><span>Classes in <a href=\"../../pkg/" +
- "package-summary.html\">pkg</a> with annotations of type " +
- "<a href=\"../../pkg/AnnotationType.html\" title=\"" +
- "annotation in pkg\">AnnotationType</a></span><span class" +
- "=\"tabEnd\"> </span></caption>"
- },
-
- { "pkg/class-use/AnnotationType.html",
- "<caption><span>Fields in <a href=\"../../pkg/" +
- "package-summary.html\">pkg</a> with annotations of type " +
- "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " +
- "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
+ checkOutput("pkg/AnnotationTypeUsage.html", true,
+ // CLASS
+ "<pre><a href=\"../pkg/AnnotationType.html\" "
+ + "title=\"annotation in pkg\">@AnnotationType</a>("
+ + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>"
+ + "=\"Class Annotation\",\n"
+ + " <a href=\"../pkg/AnnotationType.html#required--\">"
+ + "required</a>=1994)\n"
+ + "public class <span class=\"typeNameLabel\">"
+ + "AnnotationTypeUsage</span>\n"
+ + "extends java.lang.Object</pre>",
+ // FIELD
+ "<pre><a href=\"../pkg/AnnotationType.html\" "
+ + "title=\"annotation in pkg\">@AnnotationType</a>("
+ + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>"
+ + "=\"Field Annotation\",\n"
+ + " <a href=\"../pkg/AnnotationType.html#required--\">"
+ + "required</a>=1994)\n"
+ + "public int field</pre>",
+ // CONSTRUCTOR
+ "<pre><a href=\"../pkg/AnnotationType.html\" "
+ + "title=\"annotation in pkg\">@AnnotationType</a>("
+ + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>"
+ + "=\"Constructor Annotation\",\n"
+ + " <a href=\"../pkg/AnnotationType.html#required--\">"
+ + "required</a>=1994)\n"
+ + "public AnnotationTypeUsage()</pre>",
+ // METHOD
+ "<pre><a href=\"../pkg/AnnotationType.html\" "
+ + "title=\"annotation in pkg\">@AnnotationType</a>("
+ + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>"
+ + "=\"Method Annotation\",\n"
+ + " <a href=\"../pkg/AnnotationType.html#required--\">"
+ + "required</a>=1994)\n"
+ + "public void method()</pre>",
+ // METHOD PARAMS
+ "<pre>public void methodWithParams("
+ + "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">"
+ + "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">"
+ + "optional</a>=\"Parameter Annotation\",<a "
+ + "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)\n"
+ + " int documented,\n"
+ + " int undocmented)</pre>",
+ // CONSTRUCTOR PARAMS
+ "<pre>public AnnotationTypeUsage(<a "
+ + "href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">"
+ + "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">"
+ + "optional</a>=\"Constructor Param Annotation\",<a "
+ + "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)\n"
+ + " int documented,\n"
+ + " int undocmented)</pre>");
- { "pkg/class-use/AnnotationType.html",
- "<caption><span>Methods in <a href=\"../../pkg/" +
- "package-summary.html\">pkg</a> with annotations of type " +
- "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " +
- "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
-
- { "pkg/class-use/AnnotationType.html",
- "<caption><span>Method parameters in <a href=\"../../pkg/" +
- "package-summary.html\">pkg</a> with annotations of type " +
- "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " +
- "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
-
- { "pkg/class-use/AnnotationType.html",
- "<caption><span>Constructors in <a href=\"../../pkg/" +
- "package-summary.html\">pkg</a> with annotations of type " +
- "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation " +
- "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">" +
- " </span></caption>"
- },
-
- { "pkg/class-use/AnnotationType.html",
- "<caption><span>Constructor parameters in <a href=\"../../" +
- "pkg/package-summary.html\">pkg</a> with annotations of " +
- "type <a href=\"../../pkg/AnnotationType.html\" title=\"" +
- "annotation in pkg\">AnnotationType</a></span><span class=\"" +
- "tabEnd\"> </span></caption>"
- },
-
- //=================================
- // TYPE PARAMETER IN INDEX
- //=================================
- { "index-all.html",
- "<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
- "method(Vector<Object>)</a></span>"
- },
- //=================================
- // TYPE PARAMETER IN INDEX
- //=================================
- { "index-all.html",
- "<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
- "method(Vector<Object>)</a></span>"
- },
- };
- private static final String[][] NEGATED_TEST = {
+ //=================================
+ // Annotatation Type Usage
//=================================
- // ENUM TESTING
- //=================================
- //NO constructor section
- { "pkg/Coin.html", "<h3>Constructor Summary</h3>"},
- //=================================
- // TYPE PARAMETER TESTING
- //=================================
- //No type parameters in class frame.
- { "allclasses-frame.html",
- "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
- "TypeParameters</a><<a href=\"../pkg/TypeParameters.html\" " +
- "title=\"type parameter in TypeParameters\">E</a>>"
- },
+ checkOutput("pkg/class-use/AnnotationType.html", true,
+ "<caption><span>Packages with annotations of type <a href=\""
+ + "../../pkg/AnnotationType.html\" title=\"annotation in pkg\">"
+ + "AnnotationType</a></span><span class=\"tabEnd\"> "
+ + "</span></caption>",
+ "<caption><span>Classes in <a href=\"../../pkg/"
+ + "package-summary.html\">pkg</a> with annotations of type "
+ + "<a href=\"../../pkg/AnnotationType.html\" title=\""
+ + "annotation in pkg\">AnnotationType</a></span><span class"
+ + "=\"tabEnd\"> </span></caption>",
+ "<caption><span>Fields in <a href=\"../../pkg/"
+ + "package-summary.html\">pkg</a> with annotations of type "
+ + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation "
+ + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<caption><span>Methods in <a href=\"../../pkg/"
+ + "package-summary.html\">pkg</a> with annotations of type "
+ + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation "
+ + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<caption><span>Method parameters in <a href=\"../../pkg/"
+ + "package-summary.html\">pkg</a> with annotations of type "
+ + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation "
+ + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<caption><span>Constructors in <a href=\"../../pkg/"
+ + "package-summary.html\">pkg</a> with annotations of type "
+ + "<a href=\"../../pkg/AnnotationType.html\" title=\"annotation "
+ + "in pkg\">AnnotationType</a></span><span class=\"tabEnd\">"
+ + " </span></caption>",
+ "<caption><span>Constructor parameters in <a href=\"../../"
+ + "pkg/package-summary.html\">pkg</a> with annotations of "
+ + "type <a href=\"../../pkg/AnnotationType.html\" title=\""
+ + "annotation in pkg\">AnnotationType</a></span><span class=\""
+ + "tabEnd\"> </span></caption>"
+ );
//==============================================================
// ANNOTATION TYPE USAGE TESTING (When @Documented is omitted)
//===============================================================
-
- //CLASS
- { "pkg/AnnotationTypeUsage.html",
- "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Class Annotation\",\n" +
- " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n" +
- "public class <span class=\"typeNameLabel\">AnnotationTypeUsage</span></dt><dt>extends java.lang.Object</dt>"},
-
- //FIELD
- { "pkg/AnnotationTypeUsage.html",
- "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Field Annotation\",\n" +
- " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n" +
- "public int <span class=\"memberNameLabel\">field</span>"},
-
- //CONSTRUCTOR
- { "pkg/AnnotationTypeUsage.html",
- "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Constructor Annotation\",\n" +
- " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n" +
- "public <span class=\"typeNameLabel\">AnnotationTypeUsage</span>()"},
-
- //METHOD
- { "pkg/AnnotationTypeUsage.html",
- "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Method Annotation\",\n" +
- " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n" +
- "public void <span class=\"memberNameLabel\">method</span>()"},
+ checkOutput("pkg/AnnotationTypeUsage.html", false,
+ // CLASS
+ "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Class Annotation\",\n"
+ + " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n"
+ + "public class <span class=\"typeNameLabel\">AnnotationTypeUsage</span></dt><dt>extends java.lang.Object</dt>",
+ // FIELD
+ "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Field Annotation\",\n"
+ + " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n"
+ + "public int <span class=\"memberNameLabel\">field</span>",
+ // CONSTRUCTOR
+ "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Constructor Annotation\",\n"
+ + " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n"
+ + "public <span class=\"typeNameLabel\">AnnotationTypeUsage</span>()",
+ // METHOD
+ "<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Method Annotation\",\n"
+ + " <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)\n"
+ + "public void <span class=\"memberNameLabel\">method</span>()");
//=================================
// Make sure annotation types do not
// trigger this warning.
//=================================
- {WARNING_OUTPUT,
- "Internal error: package sets don't match: [] with: null"
- },
- };
+ checkOutput(Output.WARNING, false,
+ "Internal error: package sets don't match: [] with: null");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestNewLanguageFeatures tester = new TestNewLanguageFeatures();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ //=================================
+ // ANNOTATION TYPE USAGE TESTING (All Different Types).
+ //=================================
+ checkOutput("pkg1/B.html", true,
+ // Integer
+ "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,",
+ // Double
+ "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,",
+ // Boolean
+ "<a href=\"../pkg1/A.html#b--\">b</a>=true,",
+ // String
+ "<a href=\"../pkg1/A.html#s--\">s</a>=\"sigh\",",
+ // Class
+ "<a href=\"../pkg1/A.html#c--\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,",
+ // Bounded Class
+ "<a href=\"../pkg1/A.html#w--\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,",
+ // Enum
+ "<a href=\"../pkg1/A.html#e--\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,",
+ // Annotation Type
+ "<a href=\"../pkg1/A.html#a--\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994),",
+ // String Array
+ "<a href=\"../pkg1/A.html#sa--\">sa</a>={\"up\",\"down\"},",
+ // Primitive
+ "<a href=\"../pkg1/A.html#primitiveClassTest--\">primitiveClassTest</a>=boolean.class,");
+
+ // XXX: Add array test case after this if fixed:
+ //5020899: Incorrect internal representation of class-valued annotation elements
+ // Make sure that annotations are surrounded by <pre> and </pre>
+ checkOutput("pkg1/B.html", true,
+ "<pre><a href=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</a>",
+ "public interface <span class=\"typeNameLabel\">B</span></pre>");
+
}
+
}
--- a/langtools/test/com/sun/javadoc/testNoPackagesFile/TestNoPackagesFile.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testNoPackagesFile/TestNoPackagesFile.java Fri May 23 09:05:24 2014 -0700
@@ -27,31 +27,26 @@
* @summary Verify that packages.html is no longer generated since it is no
* longer used.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestNoPackagesFile
* @run main TestNoPackagesFile
*/
public class TestNoPackagesFile extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- SRC_DIR + "/C.java"
- };
+ public static void main(String... args) throws Exception {
+ TestNoPackagesFile tester = new TestNoPackagesFile();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestNoPackagesFile tester = new TestNoPackagesFile();
- tester.run(ARGS, NO_TEST, NO_TEST);
- if ((new java.io.File(OUTPUT_DIR + "/packages.html")).exists()) {
- throw new Error("Test Fails: packages file should not be " + "generated anymore.");
- } else {
- System.out.println("Test passes: packages.html not found.");
- }
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ testSrc("C.java"));
+ checkExit(Exit.OK);
+
+ // packages.html file should not be generated anymore.
+ checkFiles(false, "packages.html");
}
}
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java Fri May 23 09:05:24 2014 -0700
@@ -26,31 +26,28 @@
* @bug 7001086
* @summary Test Non-frame warning.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestNonFrameWarning
+ * @library ../lib
+ * @build JavadocTester
* @run main TestNonFrameWarning
*/
public class TestNonFrameWarning extends JavadocTester {
- private static final String[][] TEST = {
- { "index.html",
- "<p>This document is designed to be viewed using the frames feature. " +
- "If you see this message, you are using a non-frame-capable web client. " +
- "Link to <a href=\"pkg/package-summary.html\">Non-frame version</a>.</p>"
- }
- };
- private static final String[] ARGS = new String[]{
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestNonFrameWarning tester = new TestNonFrameWarning();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestNonFrameWarning tester = new TestNonFrameWarning();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("index.html", true,
+ "<p>This document is designed to be viewed using the frames feature. "
+ + "If you see this message, you are using a non-frame-capable web client. "
+ + "Link to <a href=\"pkg/package-summary.html\">Non-frame version</a>.</p>");
}
}
--- a/langtools/test/com/sun/javadoc/testNotifications/TestNotifications.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testNotifications/TestNotifications.java Fri May 23 09:05:24 2014 -0700
@@ -28,50 +28,43 @@
* be created.
* Make sure classname is not include in javadoc usage message.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestNotifications
* @run main TestNotifications
*/
public class TestNotifications extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
-
- private static final String[] ARGS2 = new String[] {
- "-help"
- };
+ public static void main(String... args) throws Exception {
+ TestNotifications tester = new TestNotifications();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- {NOTICE_OUTPUT, "Creating destination directory: \"" + OUTPUT_DIR}
- };
- private static final String[][] NEGATED_TEST = {
- {NOTICE_OUTPUT, "Creating destination directory: \"" + OUTPUT_DIR}
- };
+ @Test
+ void test1() {
+ String outDir = "out";
- private static final String[][] NEGATED_TEST2 = {
- {NOTICE_OUTPUT, "[classnames]"}
- };
+ // Notify that the destination directory must be created.
+ javadoc("-d", outDir, "-sourcepath", testSrc, "pkg");
+ checkExit(Exit.OK);
+ checkOutput(Output.NOTICE, true,
+ "Creating destination directory: \"" + outDir);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestNotifications tester = new TestNotifications();
- // Notify that the destination directory must be created.
- tester.run(ARGS, TEST, NO_TEST);
// No need to notify that the destination must be created because
// it already exists.
- tester.setCheckOutputDirectoryCheck(DirectoryCheck.NONE);
- tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.setCheckOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
+ setOutputDirectoryCheck(DirectoryCheck.NONE);
+ javadoc("-d", outDir, "-sourcepath", testSrc, "pkg");
+ checkExit(Exit.OK);
+ checkOutput(Output.NOTICE, false,
+ "Creating destination directory: \"" + outDir);
+ }
+
+ @Test
+ void test() {
//Make sure classname is not include in javadoc usage message.
- tester.run(ARGS2, NO_TEST, NEGATED_TEST2);
- tester.printSummary();
+ setOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
+ javadoc("-help");
+ checkOutput(Output.NOTICE, false,
+ "[classnames]");
}
}
--- a/langtools/test/com/sun/javadoc/testOptions/TestOptions.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testOptions/TestOptions.java Fri May 23 09:05:24 2014 -0700
@@ -26,34 +26,30 @@
* @bug 4749567
* @summary Test the output for -header and -footer options.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestOptions
+ * @library ../lib
+ * @build JavadocTester
* @run main TestOptions
*/
public class TestOptions extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-header", "Test header", "-footer", "Test footer",
- "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestOptions tester = new TestOptions();
+ tester.runTests();
+ }
- private static final String[][] TEST = {
- { "pkg/package-summary.html",
- "<div class=\"aboutLanguage\">Test header</div>"},
- { "pkg/package-summary.html",
- "<div class=\"aboutLanguage\">Test footer</div>"}
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-header", "Test header",
+ "-footer", "Test footer",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestOptions tester = new TestOptions();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/package-summary.html", true,
+ "<div class=\"aboutLanguage\">Test header</div>",
+ "<div class=\"aboutLanguage\">Test footer</div>");
}
}
--- a/langtools/test/com/sun/javadoc/testOrdering/TestOrdering.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testOrdering/TestOrdering.java Fri May 23 09:05:24 2014 -0700
@@ -23,113 +23,115 @@
/*
* @test
- * @bug 8039410
+ * @bug 8039410 8042601
* @summary test to determine if members are ordered correctly
* @author ksrini
* @library ../lib/
* @build JavadocTester
- * @build TestOrdering
* @run main TestOrdering
*/
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+public class TestOrdering extends JavadocTester {
-public class TestOrdering extends JavadocTester {
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
public static void main(String[] args) throws Exception {
TestOrdering tester = new TestOrdering();
- // test unnamed packages
- String[] ARGS = {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use",
- SRC_DIR + "/C.java", SRC_DIR + "/UsedInC.java"
- };
- tester.runJavadoc(ARGS);
- checkExecutableMemberOrdering(tester.readFileToString("class-use/UsedInC.html"));
+ tester.runTests();
+ }
- // next test using packages
- String[] ARGS1 = {
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "-use",
- "pkg1"
- };
- tester.runJavadoc(ARGS1);
- checkClassUseOrdering(tester.readFileToString("pkg1/class-use/UsedClass.html"));
- checkIndexPathOrdering(tester.readFileToString("index-all.html"));
+ @Test
+ void testUnnamedPackages() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-use",
+ testSrc("C.java"), testSrc("UsedInC.java"));
+ checkExit(Exit.OK);
+ checkExecutableMemberOrdering("class-use/UsedInC.html");
+ }
+
+ @Test
+ void testNamedPackages() {
+ javadoc("-d", "out-1",
+ "-sourcepath", testSrc,
+ "-use",
+ "pkg1");
+ checkExit(Exit.OK);
+ checkClassUseOrdering("pkg1/class-use/UsedClass.html");
+ checkIndexPathOrdering("index-all.html");
}
- static void checkExecutableMemberOrdering(String usePage) {
+ void checkExecutableMemberOrdering(String usePage) {
+ String contents = readFile(usePage);
// check constructors
- int idx1 = usePage.indexOf("C.html#C-UsedInC");
- int idx2 = usePage.indexOf("C.html#C-UsedInC-int");
- int idx3 = usePage.indexOf("C.html#C-UsedInC-java.lang.String");
+ checking("constructors");
+ int idx1 = contents.indexOf("C.html#C-UsedInC");
+ int idx2 = contents.indexOf("C.html#C-UsedInC-int");
+ int idx3 = contents.indexOf("C.html#C-UsedInC-java.lang.String");
if (idx1 == -1 || idx2 == -1 || idx3 == -1) {
- throw new Error("ctor strings not found");
- }
- if (idx1 > idx2 || idx2 > idx3 || idx1 > idx3) {
- throw new Error("ctor strings are out of order");
- }
+ failed("ctor strings not found");
+ } else if (idx1 > idx2 || idx2 > idx3 || idx1 > idx3) {
+ failed("ctor strings are out of order");
+ } else
+ passed("ctor strings are in order");
// check methods
- idx1 = usePage.indexOf("C.html#ymethod-int");
- idx2 = usePage.indexOf("C.html#ymethod-java.lang.String");
+ checking("methods");
+ idx1 = contents.indexOf("C.html#ymethod-int");
+ idx2 = contents.indexOf("C.html#ymethod-java.lang.String");
if (idx1 == -1 || idx2 == -1) {
- throw new Error("#ymethod strings not found");
- }
- if (idx1 > idx2) {
- throw new Error("#ymethod strings are out of order");
- }
- System.out.println("Executable Member Ordering: OK");
+ failed("#ymethod strings not found");
+ } else if (idx1 > idx2) {
+ failed("#ymethod strings are out of order");
+ } else
+ passed("Executable Member Ordering: OK");
}
- static void checkClassUseOrdering(String usePage) {
+ void checkClassUseOrdering(String usePage) {
checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zfield");
checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#fieldInC#ITERATION#");
checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zmethod-pkg1.UsedClass");
checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#methodInC#ITERATION#");
}
- static void checkClassUseOrdering(String usePage, String searchString) {
+ void checkClassUseOrdering(String usePage, String searchString) {
+ String contents = readFile(usePage);
int lastidx = 0;
System.out.println("testing for " + searchString);
for (int i = 1; i < 5; i++) {
String s = searchString.replaceAll("#ITERATION#", Integer.toString(i));
- System.out.println(s);
- int idx = usePage.indexOf(s);
+ checking(s);
+ int idx = contents.indexOf(s);
if (idx < lastidx) {
- throw new Error(s + ", member ordering error, last:" + lastidx + ", got:" + idx);
+ failed(s + ", member ordering error, last:" + lastidx + ", got:" + idx);
+ } else {
+ passed("\tlast: " + lastidx + " got:" + idx);
}
- System.out.println("\tlast: " + lastidx + " got:" + idx);
lastidx = idx;
}
}
- static void checkIndexPathOrdering(String indexPage) {
- String[] OrderedExpectedStrings = {
- "pkg1/UsedClass.html#add-java.lang.Double",
- "pkg1/ZZTop.html#add-double",
- "pkg1/ZZTop.html#add-java.lang.Double",
- "pkg1/UsedClass.html#add-float",
- "pkg1/ZZTop.html#add-float",
- "pkg1/UsedClass.html#add-int",
- "pkg1/ZZTop.html#add-int",
- "pkg1/UsedClass.html#add-java.lang.Integer",
- "pkg1/ZZTop.html#add-java.lang.Integer",
- "pkg1/UsedClass.html#add-double-double",
- "pkg1/UsedClass.html#add-double-java.lang.Double",
- "pkg1/ZZTop.html#add-double-double",
- "pkg1/ZZTop.html#add-double-java.lang.Double"
- };
- int lastidx = 0;
- for (String x : OrderedExpectedStrings) {
- int idx = indexPage.indexOf(x);
- if (idx < lastidx) {
- throw new Error(x + ", index is out of order, last:" + lastidx + ", got:" + idx);
- }
- System.out.println(x + ": OK");
- lastidx = idx;
- }
+ void checkIndexPathOrdering(String indexPage) {
+ checkOrder(indexPage,
+ "pkg1/UsedClass.html#add--",
+ "pkg1/ZZTop.html#add--",
+ "pkg1/UsedClass.html#add-double-",
+ "pkg1/UsedClass.html#add-java.lang.Double-",
+ "pkg1/ZZTop.html#add-double-",
+ "pkg1/ZZTop.html#add-java.lang.Double-",
+ "pkg1/UsedClass.html#add-double-byte-",
+ "pkg1/ZZTop.html#add-double-byte-",
+ "pkg1/UsedClass.html#add-double-double-",
+ "pkg1/UsedClass.html#add-double-java.lang.Double-",
+ "pkg1/ZZTop.html#add-double-double-",
+ "pkg1/ZZTop.html#add-double-java.lang.Double-",
+ "pkg1/UsedClass.html#add-float-",
+ "pkg1/ZZTop.html#add-float-",
+ "pkg1/UsedClass.html#add-float-int-",
+ "pkg1/ZZTop.html#add-float-int-",
+ "pkg1/UsedClass.html#add-int-",
+ "pkg1/ZZTop.html#add-int-",
+ "pkg1/UsedClass.html#add-int-float-",
+ "pkg1/ZZTop.html#add-int-float-",
+ "pkg1/UsedClass.html#add-java.lang.Integer-",
+ "pkg1/ZZTop.html#add-java.lang.Integer-");
}
}
--- a/langtools/test/com/sun/javadoc/testOrdering/pkg1/UsedClass.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/UsedClass.java Fri May 23 09:05:24 2014 -0700
@@ -26,18 +26,11 @@
* For index and class-use testing
*/
public class UsedClass {
- // This is the exact order we expect to see
/**
- * @param i param
+ * just an empty param method.
*/
- public void add(int i){}
-
- /**
- * @param i param
- * @return double
- */
- public int add(Integer i) {return 0;}
+ public void add(){}
/**
* @param d param
@@ -45,18 +38,30 @@
public void add(double d){}
/**
+ * @param i param
+ * @param f param
+ */
+ public void add(int i, float f){}
+
+ /**
+ * @param f param
+ * @param i param
+ */
+ public void add(float f, int i){}
+
+ /**
+ * @param d param
+ * @param b param
+ */
+ public void add(double d, byte b){}
+
+ /**
* @param d param
* @return Double
*/
public Double add(Double d) {return (double) 22/7;}
/**
- * @param f param
- * @return Float
- */
- public Float add(float f) {return (float) 22/7;}
-
- /**
* @param d1 param
* @param d2 param
* @return double
@@ -69,4 +74,21 @@
* @return double
*/
public double add(double d1, Double d2) {return d1 + d2;}
+
+ /**
+ * @param f param
+ * @return Float
+ */
+ public Float add(float f) {return (float) 22/7;}
+
+ /**
+ * @param i param
+ */
+ public void add(int i){}
+
+ /**
+ * @param i param
+ * @return double
+ */
+ public int add(Integer i) {return 0;}
}
--- a/langtools/test/com/sun/javadoc/testOrdering/pkg1/ZZTop.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/ZZTop.java Fri May 23 09:05:24 2014 -0700
@@ -26,18 +26,11 @@
* For index testing only
*/
public class ZZTop {
- // This is the exact order we expect to see
/**
- * @param i param
+ * just an empty param method.
*/
- public void add(int i){}
-
- /**
- * @param i param
- * @return double
- */
- public int add(Integer i) {return 0;}
+ public void add(){}
/**
* @param d param
@@ -45,17 +38,30 @@
public void add(double d){}
/**
+ * @param i param
+ * @param f param
+ */
+ public void add(int i, float f){}
+
+ /**
+ * @param f param
+ * @param i param
+ */
+ public void add(float f, int i){}
+
+ /**
+ * @param d param
+ * @param b param
+ */
+ public void add(double d, byte b){}
+
+ /**
* @param d param
* @return Double
*/
public Double add(Double d) {return (double) 22/7;}
/**
- * @param f param
- * @return Float
- */
- public Float add(float f) {return (float) 22/7;}
- /**
* @param d1 param
* @param d2 param
* @return double
@@ -68,4 +74,21 @@
* @return double
*/
public double add(double d1, Double d2) {return d1 + d2;}
+
+ /**
+ * @param f param
+ * @return Float
+ */
+ public Float add(float f) {return (float) 22/7;}
+
+ /**
+ * @param i param
+ */
+ public void add(int i){}
+
+ /**
+ * @param i param
+ * @return double
+ */
+ public int add(Integer i) {return 0;}
}
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestMultiInheritence.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestMultiInheritence.java Fri May 23 09:05:24 2014 -0700
@@ -27,59 +27,54 @@
* @summary Make sure that all inherited methods from multiple extended
* interfaces are documented
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestMultiInheritence
* @run main TestMultiInheritence
*/
+// TODO: should be TestMultiInheritance
public class TestMultiInheritence extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg3"
- };
+ public static void main(String... args) throws Exception {
+ TestMultiInheritence tester = new TestMultiInheritence();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg3");
+ checkExit(Exit.OK);
+
+ // Method foo() is inherited from BOTH I2 and I3
- //Method foo() is inherited from BOTH I2 and I3
- private static final String[][] TEST = {
- { "pkg3/I1.html",
- "Methods inherited from interface pkg3." +
- "<a href=\"../pkg3/I2.html\" title=\"interface in pkg3\">" +
- "I2</a>"},
- { "pkg3/I1.html",
- "Methods inherited from interface pkg3." +
- "<a href=\"../pkg3/I3.html\" title=\"interface in pkg3\">" +
- "I3</a>"},
- { "pkg3/I0.html",
- "Methods inherited from interface pkg3." +
- "<a href=\"../pkg3/I2.html\" title=\"interface in pkg3\">" +
- "I2</a>"},
- { "pkg3/I0.html",
- "Methods inherited from interface pkg3." +
- "<a href=\"../pkg3/I3.html\" title=\"interface in pkg3\">" +
- "I3</a>"},
- };
+ checkOutput("pkg3/I1.html", true,
+ "Methods inherited from interface pkg3."
+ + "<a href=\"../pkg3/I2.html\" title=\"interface in pkg3\">"
+ + "I2</a>",
+ "Methods inherited from interface pkg3."
+ + "<a href=\"../pkg3/I3.html\" title=\"interface in pkg3\">"
+ + "I3</a>");
- //Method foo() is NOT inherited from I4 because it is overriden by
- //I3.
- private static final String[][] NEGATED_TEST = {
- { "pkg3/I1.html",
- "Methods inherited from interface pkg3." +
- "<a href=\"../pkg3/I4.html\" title=\"interface in pkg3\">" +
- "I4</a>"},
- { "pkg3/I0.html",
- "Methods inherited from interface pkg3." +
- "<a href=\"../pkg3/I4.html\" title=\"interface in pkg3\">" +
- "I4</a>"},
- };
+ checkOutput("pkg3/I0.html", true,
+ "Methods inherited from interface pkg3."
+ + "<a href=\"../pkg3/I2.html\" title=\"interface in pkg3\">"
+ + "I2</a>",
+ "Methods inherited from interface pkg3."
+ + "<a href=\"../pkg3/I3.html\" title=\"interface in pkg3\">"
+ + "I3</a>");
+
+ // Method foo() is NOT inherited from I4 because it is overriden by I3.
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestMultiInheritence tester = new TestMultiInheritence();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg3/I1.html", false,
+ "Methods inherited from interface pkg3."
+ + "<a href=\"../pkg3/I4.html\" title=\"interface in pkg3\">"
+ + "I4</a>");
+
+ checkOutput("pkg3/I0.html", false,
+ "Methods inherited from interface pkg3."
+ + "<a href=\"../pkg3/I4.html\" title=\"interface in pkg3\">"
+ + "I4</a>");
}
}
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Fri May 23 09:05:24 2014 -0700
@@ -27,35 +27,32 @@
* @summary Inherited comment should link directly to member, not just
* class
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestOverridenMethodDocCopy
* @run main TestOverridenMethodDocCopy
*/
public class TestOverridenMethodDocCopy extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1", "pkg2"
- };
-
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg1/SubClass.html",
- "<span class=\"descfrmTypeLabel\">Description copied from class: <code>" +
- "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy--\">" +
- "BaseClass</a></code></span>"
- }
- };
-
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestOverridenMethodDocCopy tester = new TestOverridenMethodDocCopy();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg1/SubClass.html", true,
+ "<span class=\"descfrmTypeLabel\">Description copied from class: <code>"
+ + "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy--\">"
+ + "BaseClass</a></code></span>");
}
}
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java Fri May 23 09:05:24 2014 -0700
@@ -27,61 +27,50 @@
* @summary Determine if overriden methods are properly documented when
* -protected (default) visibility flag is used.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestOverridenPrivateMethods
* @run main TestOverridenPrivateMethods
*/
public class TestOverridenPrivateMethods extends JavadocTester {
- private static final String[][] TEST = {
- //The public method should be overriden
- { "pkg1/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
+ public static void main(String... args) throws Exception {
+ TestOverridenPrivateMethods tester = new TestOverridenPrivateMethods();
+ tester.runTests();
+ }
- //The public method in different package should be overriden
- { "pkg2/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"}
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
- private static final String[][] NEGATED_TEST = {
-
- //The package private method should be overriden since the base and sub class are in the same
- //package. However, the link should not show up because the package private methods are not documented.
- { "pkg1/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"},
+ // The public method should be overridden
+ checkOutput("pkg1/SubClass.html", true,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod");
- //The private method in should not be overriden
- { "pkg1/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
-
- //The private method in different package should not be overriden
- { "pkg2/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
+ // The public method in different package should be overridden
+ checkOutput("pkg2/SubClass.html", true,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod");
- //The package private method should not be overriden since the base and sub class are in
- //different packages.
- { "pkg2/SubClass.html",
- "Overrides:</span></dt><dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"}
- };
+ checkOutput("pkg1/SubClass.html", false,
+ //The package private method should be overridden since the base and sub class are in the same
+ //package. However, the link should not show up because the package private methods are not documented.
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod",
+ //The private method in should not be overridden
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod");
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1", "pkg2"};
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestOverridenPrivateMethods tester = new TestOverridenPrivateMethods();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg2/SubClass.html", false,
+ //The private method in different package should not be overridden
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod",
+ //The package private method should not be overridden since the base and sub class are in
+ //different packages.
+ "Overrides:</span></dt><dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod");
}
}
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java Fri May 23 09:05:24 2014 -0700
@@ -24,71 +24,65 @@
/*
* @test
* @bug 4634891 8025633 8026567
- * @summary Determine if overriden methods are properly documented when
+ * @summary Determine if overridden methods are properly documented when
* -protected (default) visibility flag is used.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestOverridenPrivateMethodsWithPackageFlag
* @run main TestOverridenPrivateMethodsWithPackageFlag
*/
public class TestOverridenPrivateMethodsWithPackageFlag extends JavadocTester {
- private static final String[][] TEST = {
- //The public method should be overriden
- { "pkg1/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
- "publicMethod</a></code> in class <code>" +
- "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
+ public static void main(String... args) throws Exception {
+ TestOverridenPrivateMethodsWithPackageFlag tester = new TestOverridenPrivateMethodsWithPackageFlag();
+ tester.runTests();
+ }
- //The public method in different package should be overriden
- { "pkg2/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
- "publicMethod</a></code> in class <code>" +
- "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-package",
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
- //The package private method should be overriden since the base and sub class are in the same
- //package.
- { "pkg1/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">" +
- "packagePrivateMethod</a></code> in class <code>" +
- "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"}
- };
-
- private static final String[][] NEGATED_TEST = {
+ // The public method should be overridden
+ checkOutput("pkg1/SubClass.html", true,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">"
+ + "publicMethod</a></code> in class <code>"
+ + "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
- //The private method in should not be overriden
- { "pkg1/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">"},
+ // The public method in different package should be overridden
+ checkOutput("pkg2/SubClass.html", true,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">"
+ + "publicMethod</a></code> in class <code>"
+ + "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
- //The private method in different package should not be overriden
- { "pkg2/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">"},
+ // The package private method should be overridden since the base and sub class are in the same
+ // package.
+ checkOutput("pkg1/SubClass.html", true,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">"
+ + "packagePrivateMethod</a></code> in class <code>"
+ + "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
- //The package private method should not be overriden since the base and sub class are in
- //different packages.
- { "pkg2/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">"},
- };
+ // The private method in should not be overridden
+ checkOutput("pkg1/SubClass.html", false,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">");
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-package", "pkg1", "pkg2"};
+ // The private method in different package should not be overridden
+ checkOutput("pkg2/SubClass.html", false,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestOverridenPrivateMethodsWithPackageFlag tester = new TestOverridenPrivateMethodsWithPackageFlag();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ // The package private method should not be overridden since the base and sub class are in
+ // different packages.
+ checkOutput("pkg2/SubClass.html", false,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">");
}
}
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java Fri May 23 09:05:24 2014 -0700
@@ -24,67 +24,59 @@
/*
* @test
* @bug 4634891 8026567
- * @summary Determine if overriden methods are properly documented when
+ * @summary Determine if overridden methods are properly documented when
* -protected (default) visibility flag is used.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestOverridenPrivateMethodsWithPrivateFlag
* @run main TestOverridenPrivateMethodsWithPrivateFlag
*/
public class TestOverridenPrivateMethodsWithPrivateFlag extends JavadocTester {
- private static final String[][] TEST = {
- //The public method should be overriden
- { "pkg1/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
-
- //The package private method should be overriden since the base and sub class are in the same
- //package.
- { "pkg1/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"},
+ public static void main(String... args) throws Exception {
+ TestOverridenPrivateMethodsWithPrivateFlag tester = new TestOverridenPrivateMethodsWithPrivateFlag();
+ tester.runTests();
+ }
- //The public method in different package should be overriden
- { "pkg2/SubClass.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-private",
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
- private static final String[][] NEGATED_TEST = {
-
- //The private method in should not be overriden
- { "pkg1/SubClass.html",
+ // The public method should be overridden
+ checkOutput("pkg1/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod");
- //The private method in different package should not be overriden
- { "pkg2/SubClass.html",
+ // The package private method should be overridden since the base and sub class are in the same
+ // package.
+ checkOutput("pkg1/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
+ "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod");
- //The package private method should not be overriden since the base and sub class are in
- //different packages.
- { "pkg2/SubClass.html",
+ // The public method in different package should be overridden
+ checkOutput("pkg2/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"}
-
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod");
- };
-
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-private", "pkg1", "pkg2"};
+ // The private method in should not be overridden
+ checkOutput("pkg1/SubClass.html", false,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
+ "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestOverridenPrivateMethodsWithPrivateFlag tester = new TestOverridenPrivateMethodsWithPrivateFlag();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ // The private method in different package should not be overridden
+ checkOutput("pkg2/SubClass.html", false,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
+ "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod");
+
+ // The package private method should not be overridden since the base and sub class are in
+ // different packages.
+ checkOutput("pkg2/SubClass.html", false,
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
+ "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod");
}
}
--- a/langtools/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java Fri May 23 09:05:24 2014 -0700
@@ -33,53 +33,46 @@
public class TestPackageDeprecation extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS1 = new String[]{
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1",
- SRC_DIR + "/C2.java", SRC_DIR + "/FooDepr.java"
- };
- private static final String[] ARGS2 = new String[]{
- "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-use", "-nodeprecated",
- "pkg", "pkg1", SRC_DIR + "/C2.java", SRC_DIR + "/FooDepr.java"
- };
+ public static void main(String... args) throws Exception {
+ TestPackageDeprecation tester = new TestPackageDeprecation();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST1 = {
- { "pkg1/package-summary.html",
+ @Test
+ void testDefault() {
+ javadoc("-d", "out-default",
+ "-sourcepath", testSrc,
+ "-use",
+ "pkg", "pkg1", testSrc("C2.java"), testSrc("FooDepr.java"));
+ checkExit(Exit.OK);
+
+ checkOutput("pkg1/package-summary.html", true,
"<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" +
"<div class=\"block\"><span class=\"deprecationComment\">This package is Deprecated." +
"</span></div>"
- },
- { "deprecated-list.html",
+ );
+
+ checkOutput("deprecated-list.html", true,
"<li><a href=\"#package\">Deprecated Packages</a></li>"
- }
- };
- private static final String[][] NEGATED_TEST2 = {
- { "overview-summary.html", "pkg1"},
- { "allclasses-frame.html", "FooDepr"}
- };
+ );
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestPackageDeprecation tester = new TestPackageDeprecation();
- tester.run(ARGS1, TEST1, NO_TEST);
- tester.run(ARGS2, NO_TEST, NEGATED_TEST2);
- if ((new java.io.File(OUTPUT_DIR + "-2/pkg1/" +
- "package-summary.html")).exists()) {
- throw new Error("Test Fails: packages summary should not be" +
- "generated for deprecated package.");
- } else {
- System.out.println("Test passes: package-summary.html not found.");
- }
- if ((new java.io.File(OUTPUT_DIR + "-2/FooDepr.html")).exists()) {
- throw new Error("Test Fails: FooDepr should not be" +
- "generated as it is deprecated.");
- } else {
- System.out.println("Test passes: FooDepr.html not found.");
- }
- tester.printSummary();
+ @Test
+ void testNoDeprecated() {
+ javadoc("-d", "out-nodepr",
+ "-sourcepath", testSrc,
+ "-use",
+ "-nodeprecated",
+ "pkg", "pkg1", testSrc("C2.java"), testSrc("FooDepr.java"));
+ checkExit(Exit.OK);
+
+ checkOutput("overview-summary.html", false,
+ "pkg1");
+ checkOutput("allclasses-frame.html", false,
+ "FooDepr");
+
+ checkFiles(false,
+ "pkg1/package-summary.html",
+ "FooDepr.html");
}
}
--- a/langtools/test/com/sun/javadoc/testPackagePage/TestPackagePage.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testPackagePage/TestPackagePage.java Fri May 23 09:05:24 2014 -0700
@@ -28,69 +28,58 @@
* passed to Javadoc. Also test that the proper package links are generated
* when single or multiple packages are documented.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestPackagePage
* @run main TestPackagePage
*/
public class TestPackagePage extends JavadocTester {
+ public static void main(String... args) throws Exception {
+ TestPackagePage tester = new TestPackagePage();
+ tester.runTests();
+ }
+
+ @Test
+ void testSinglePackage() {
+ javadoc("-d", "out-1",
+ "-sourcepath", testSrc,
+ testSrc("com/pkg/C.java"));
+ checkExit(Exit.OK);
+
+ checkOutput("com/pkg/package-summary.html", true,
+ "This is a package page.");
+
+ // With just one package, all general pages link to the single package page.
+ checkOutput("com/pkg/C.html", true,
+ "<a href=\"../../com/pkg/package-summary.html\">Package</a>");
+ checkOutput("com/pkg/package-tree.html", true,
+ "<li><a href=\"../../com/pkg/package-summary.html\">Package</a></li>");
+ checkOutput("deprecated-list.html", true,
+ "<li><a href=\"com/pkg/package-summary.html\">Package</a></li>");
+ checkOutput("index-all.html", true,
+ "<li><a href=\"com/pkg/package-summary.html\">Package</a></li>");
+ checkOutput("help-doc.html", true,
+ "<li><a href=\"com/pkg/package-summary.html\">Package</a></li>");
+ }
+
private static final String[][] TEST1 = {
- { "com/pkg/package-summary.html",
- "This is a package page."
- },
- //With just one package, all general pages link to the single package page.
- { "com/pkg/C.html",
- "<a href=\"../../com/pkg/package-summary.html\">Package</a>"
- },
- { "com/pkg/package-tree.html",
- "<li><a href=\"../../com/pkg/package-summary.html\">Package</a></li>"
- },
- { "deprecated-list.html",
- "<li><a href=\"com/pkg/package-summary.html\">Package</a></li>"
- },
- { "index-all.html",
- "<li><a href=\"com/pkg/package-summary.html\">Package</a></li>"
- },
- { "help-doc.html",
- "<li><a href=\"com/pkg/package-summary.html\">Package</a></li>"
- },
};
- private static final String[][] TEST2 = {
- //With multiple packages, there is no package link in general pages.
- { "deprecated-list.html",
- "<li>Package</li>"
- },
- { "index-all.html",
- "<li>Package</li>"
- },
- { "help-doc.html",
- "<li>Package</li>"
- },
- };
+
+ @Test
+ void testMultiplePackages() {
+ javadoc("-d", "out-2",
+ "-sourcepath", testSrc,
+ "com.pkg", "pkg2");
+ checkExit(Exit.OK);
- private static final String[] ARGS1 =
- new String[] {
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR,
- SRC_DIR + "/com/pkg/C.java"
- };
-
- private static final String[] ARGS2 =
- new String[] {
- "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR,
- "com.pkg", "pkg2"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestPackagePage tester = new TestPackagePage();
- tester.run(ARGS1, TEST1, NO_TEST);
- tester.run(ARGS2, TEST2, NO_TEST);
- tester.printSummary();
+ //With multiple packages, there is no package link in general pages.
+ checkOutput("deprecated-list.html", true,
+ "<li>Package</li>");
+ checkOutput("index-all.html", true,
+ "<li>Package</li>");
+ checkOutput("help-doc.html", true,
+ "<li>Package</li>");
}
}
--- a/langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java Fri May 23 09:05:24 2014 -0700
@@ -28,50 +28,38 @@
* match up with a real parameters.
* Make sure inheritDoc cannot be used in an invalid param tag.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestParamTaglet
* @run main TestParamTaglet
*/
public class TestParamTaglet extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestParamTaglet tester = new TestParamTaglet();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.FAILED);
- //Input for string search tests.
- private static final String[][] TEST = {
- //Regular param tags.
- { "pkg/C.html",
- "<span class=\"paramLabel\">Parameters:</span></dt>\n" +
- "<dd><code>param1</code> - testing 1 2 3.</dd>\n" +
- "<dd><code>param2</code> - testing 1 2 3."
- },
- //Param tags that don't match with any real parameters.
- { "pkg/C.html",
- "<span class=\"paramLabel\">Parameters:</span></dt>\n" +
- "<dd><code><I>p1</I></code> - testing 1 2 3.</dd>\n" +
- "<dd><code><I>p2</I></code> - testing 1 2 3."
- },
- //{@inherit} doc misuse does not cause doclet to throw exception.
- // Param is printed with nothing inherited.
- //XXX: in the future when Configuration is available during doc inheritence,
- //print a warning for this mistake.
- { "pkg/C.html",
- "<code><I>inheritBug</I></code> -"
- },
-
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestParamTaglet tester = new TestParamTaglet();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/C.html", true,
+ //Regular param tags.
+ "<span class=\"paramLabel\">Parameters:</span></dt>\n"
+ + "<dd><code>param1</code> - testing 1 2 3.</dd>\n"
+ + "<dd><code>param2</code> - testing 1 2 3.",
+ //Param tags that don't match with any real parameters.
+ "<span class=\"paramLabel\">Parameters:</span></dt>\n"
+ + "<dd><code><I>p1</I></code> - testing 1 2 3.</dd>\n"
+ + "<dd><code><I>p2</I></code> - testing 1 2 3.",
+ //{@inherit} doc misuse does not cause doclet to throw exception.
+ // Param is printed with nothing inherited.
+ //XXX: in the future when Configuration is available during doc inheritence,
+ //print a warning for this mistake.
+ "<code><I>inheritBug</I></code> -");
}
}
--- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Fri May 23 09:05:24 2014 -0700
@@ -37,237 +37,185 @@
* Make sure when no modifier appear in the class signature, the
* signature is displayed correctly without extra space at the beginning.
* @author jamieh
- * @library ../lib/
- * @build JavadocTester TestPrivateClasses
+ * @library ../lib
+ * @build JavadocTester
* @run main TestPrivateClasses
*/
public class TestPrivateClasses extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS1 = new String[] {
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg", "pkg2"
- };
- private static final String[] ARGS2 = new String[] {
- "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-private",
- "pkg", "pkg2"
- };
+ public static void main(String... args) throws Exception {
+ TestPrivateClasses tester = new TestPrivateClasses();
+ tester.runTests();
+ }
- // Test output when -private flag is not used.
- private static final String[][] TEST1 = {
- // Field inheritence from non-public superclass.
- { "pkg/PublicChild.html",
- "<a href=\"../pkg/PublicChild.html#fieldInheritedFromParent\">" +
- "fieldInheritedFromParent</a>"
- },
-
- // Method inheritence from non-public superclass.
- { "pkg/PublicChild.html",
- "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent-int-\">" +
- "methodInheritedFromParent</a>"
- },
+ @Test
+ void testDefault() {
+ javadoc("-d", "out-default",
+ "-sourcepath", testSrc,
+ "pkg", "pkg2");
+ checkExit(Exit.OK);
- // Field inheritence from non-public superinterface.
- { "pkg/PublicInterface.html",
- "<a href=\"../pkg/PublicInterface.html#fieldInheritedFromInterface\">" +
- "fieldInheritedFromInterface</a>"
- },
-
- // Method inheritence from non-public superinterface.
- { "pkg/PublicInterface.html",
- "<a href=\"../pkg/PublicInterface.html#methodInterface-int-\">" +
- "methodInterface</a>"
- },
-
- // private class does not show up in tree
- { "pkg/PublicChild.html",
- "<ul class=\"inheritance\">\n" +
- "<li>java.lang.Object</li>\n" +
- "<li>\n" +
- "<ul class=\"inheritance\">\n" +
- "<li>pkg.PublicChild</li>\n" +
- "</ul>\n" +
- "</li>\n" +
- "</ul>"
- },
-
- // Method is documented as though it is declared in the inheriting method.
- { "pkg/PublicChild.html",
- "<pre>public void methodInheritedFromParent(int p1)"
- },
+ checkOutput("pkg/PublicChild.html", true,
+ // Field inheritence from non-public superclass.
+ "<a href=\"../pkg/PublicChild.html#fieldInheritedFromParent\">"
+ + "fieldInheritedFromParent</a>",
+ // Method inheritance from non-public superclass.
+ "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent-int-\">"
+ + "methodInheritedFromParent</a>",
+ // private class does not show up in tree
+ "<ul class=\"inheritance\">\n"
+ + "<li>java.lang.Object</li>\n"
+ + "<li>\n"
+ + "<ul class=\"inheritance\">\n"
+ + "<li>pkg.PublicChild</li>\n"
+ + "</ul>\n"
+ + "</li>\n"
+ + "</ul>",
+ // Method is documented as though it is declared in the inheriting method.
+ "<pre>public void methodInheritedFromParent(int p1)",
+ "<dl>\n"
+ + "<dt>All Implemented Interfaces:</dt>\n"
+ + "<dd><a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">"
+ + "PublicInterface</a></dd>\n"
+ + "</dl>");
- //Make sure implemented interfaces from private superclass are inherited
- { "pkg/PublicInterface.html",
- "<dl>\n" +
- "<dt>All Known Implementing Classes:</dt>\n" +
- "<dd><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">" +
- "PublicChild</a></dd>\n" +
- "</dl>"},
-
- { "pkg/PublicChild.html",
- "<dl>\n" +
- "<dt>All Implemented Interfaces:</dt>\n" +
- "<dd><a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" +
- "PublicInterface</a></dd>\n" +
- "</dl>"},
+ checkOutput("pkg/PublicChild.html", false,
+ // Should not document that a method overrides method from private class.
+ "<span class=\"overrideSpecifyLabel\">Overrides:</span>",
+ // Should not document that a method specified by private interface.
+ "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
+ // Should not mention that any documentation was copied.
+ "Description copied from",
+ // Don't extend private classes or interfaces
+ "PrivateParent",
+ "PrivateInterface");
- //Generic interface method test.
- { "pkg2/C.html",
- "This comment should get copied to the implementing class"},
- };
- private static final String[][] NEGATED_TEST1 = {
- // Should not document that a method overrides method from private class.
- { "pkg/PublicChild.html",
- "<span class=\"overrideSpecifyLabel\">Overrides:</span>"},
- // Should not document that a method specified by private interface.
- { "pkg/PublicChild.html",
- "<span class=\"overrideSpecifyLabel\">Specified by:</span>"},
- { "pkg/PublicInterface.html",
- "<span class=\"overrideSpecifyLabel\">Specified by:</span>"},
- // Should not mention that any documentation was copied.
- { "pkg/PublicChild.html",
- "Description copied from"},
- { "pkg/PublicInterface.html",
- "Description copied from"},
- // Don't extend private classes or interfaces
- { "pkg/PublicChild.html",
- "PrivateParent"},
- { "pkg/PublicInterface.html",
- "PrivateInterface"},
- { "pkg/PublicChild.html",
- "PrivateInterface"},
- { "pkg/PublicInterface.html",
- "All Superinterfaces"},
- // Make inherited constant are documented correctly.
- { "constant-values.html",
- "PrivateInterface"},
+ checkOutput("pkg/PublicInterface.html", true,
+ // Field inheritance from non-public superinterface.
+ "<a href=\"../pkg/PublicInterface.html#fieldInheritedFromInterface\">"
+ + "fieldInheritedFromInterface</a>",
+ // Method inheritance from non-public superinterface.
+ "<a href=\"../pkg/PublicInterface.html#methodInterface-int-\">"
+ + "methodInterface</a>",
+ //Make sure implemented interfaces from private superclass are inherited
+ "<dl>\n"
+ + "<dt>All Known Implementing Classes:</dt>\n"
+ + "<dd><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">"
+ + "PublicChild</a></dd>\n"
+ + "</dl>");
- //Do not inherit private interface method with generic parameters.
- //This method has been implemented.
- { "pkg2/C.html",
- "<span class=\"memberNameLink\"><a href=\"../pkg2/I.html#hello-T-\">hello</a></span>"},
- };
+ checkOutput("pkg/PublicInterface.html", false,
+ "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
+ "Description copied from",
+ "PrivateInterface",
+ "All Superinterfaces");
+
+ checkOutput("pkg2/C.html", true,
+ //Generic interface method test.
+ "This comment should get copied to the implementing class");
+
+ checkOutput("pkg2/C.html", false,
+ //Do not inherit private interface method with generic parameters.
+ //This method has been implemented.
+ "<span class=\"memberNameLink\"><a href=\"../pkg2/I.html#hello-T-\">hello</a></span>");
+
+ checkOutput("constant-values.html", false,
+ // Make inherited constant are documented correctly.
+ "PrivateInterface");
+ }
- // Test output when -private flag is used.
- private static final String[][] TEST2 = {
- // Field inheritence from non-public superclass.
- { "pkg/PublicChild.html",
- "Fields inherited from class pkg." +
- "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
- "PrivateParent</a>"
- },
- { "pkg/PublicChild.html",
- "<a href=\"../pkg/PrivateParent.html#fieldInheritedFromParent\">" +
- "fieldInheritedFromParent</a>"
- },
- // Field inheritence from non-public superinterface.
- { "pkg/PublicInterface.html",
- "Fields inherited from interface pkg." +
- "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
- "PrivateInterface</a>"
- },
- { "pkg/PublicInterface.html",
- "<a href=\"../pkg/PrivateInterface.html#fieldInheritedFromInterface\">" +
- "fieldInheritedFromInterface</a>"
- },
- // Method inheritence from non-public superclass.
- { "pkg/PublicChild.html",
- "Methods inherited from class pkg." +
- "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
- "PrivateParent</a>"
- },
- { "pkg/PublicChild.html",
- "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent-int-\">" +
- "methodInheritedFromParent</a>"
- },
- // Should document that a method overrides method from private class.
- { "pkg/PublicChild.html",
- "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
- "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">" +
- "methodOverridenFromParent</a></code> in class <code>" +
- "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
- "PrivateParent</a></code></dd>"},
- // Should document that a method is specified by private interface.
- { "pkg/PublicChild.html",
- "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" +
- "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
- "methodInterface</a></code> in interface <code>" +
- "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
- "PrivateInterface</a></code></dd>"},
- // Method inheritence from non-public superinterface.
- { "pkg/PublicInterface.html",
- "Methods inherited from interface pkg." +
- "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
- "PrivateInterface</a>"
- },
- { "pkg/PrivateInterface.html",
- "<a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
- "methodInterface</a>"
- },
- // Should mention that any documentation was copied.
- { "pkg/PublicChild.html",
- "Description copied from"},
- // Extend documented private classes or interfaces
- { "pkg/PublicChild.html",
- "extends"},
- { "pkg/PublicInterface.html",
- "extends"},
- { "pkg/PublicInterface.html",
- "All Superinterfaces"},
+ @Test
+ void testPrivate() {
+ javadoc("-d", "out-private",
+ "-sourcepath", testSrc,
+ "-private",
+ "pkg", "pkg2");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/PublicChild.html", true,
+ // Field inheritence from non-public superclass.
+ "Fields inherited from class pkg."
+ + "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">"
+ + "PrivateParent</a>",
+ "<a href=\"../pkg/PrivateParent.html#fieldInheritedFromParent\">"
+ + "fieldInheritedFromParent</a>",
+ // Method inheritence from non-public superclass.
+ "Methods inherited from class pkg."
+ + "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">"
+ + "PrivateParent</a>",
+ "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent-int-\">"
+ + "methodInheritedFromParent</a>",
+ // Should document that a method overrides method from private class.
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">"
+ + "methodOverridenFromParent</a></code> in class <code>"
+ + "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">"
+ + "PrivateParent</a></code></dd>",
+ // Should document that a method is specified by private interface.
+ "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">"
+ + "methodInterface</a></code> in interface <code>"
+ + "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">"
+ + "PrivateInterface</a></code></dd>",
+ // Should mention that any documentation was copied.
+ "Description copied from",
+ // Extend documented private classes or interfaces
+ "extends",
+ "<dl>\n"
+ + "<dt>All Implemented Interfaces:</dt>\n"
+ + "<dd><a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">"
+ + "PrivateInterface</a>, "
+ + "<a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">"
+ + "PublicInterface</a></dd>\n"
+ + "</dl>",
+ "<pre>public class <span class=\"typeNameLabel\">PublicChild</span>");
- //Make sure implemented interfaces from private superclass are inherited
- { "pkg/PublicInterface.html",
- "<dl>\n" +
- "<dt>All Known Implementing Classes:</dt>\n" +
- "<dd><a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
- "PrivateParent</a>, " +
- "<a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild" +
- "</a></dd>\n" +
- "</dl>"},
-
- { "pkg/PublicChild.html",
- "<dl>\n" +
- "<dt>All Implemented Interfaces:</dt>\n" +
- "<dd><a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
- "PrivateInterface</a>, " +
- "<a href=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" +
- "PublicInterface</a></dd>\n" +
- "</dl>"},
-
- //Since private flag is used, we can document that private interface method
- //with generic parameters has been implemented.
- { "pkg2/C.html",
- "<span class=\"descfrmTypeLabel\">Description copied from interface: <code>" +
- "<a href=\"../pkg2/I.html#hello-T-\">I</a></code></span>"},
+ checkOutput("pkg/PublicInterface.html", true,
+ // Field inheritence from non-public superinterface.
+ "Fields inherited from interface pkg."
+ + "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">"
+ + "PrivateInterface</a>",
+ "<a href=\"../pkg/PrivateInterface.html#fieldInheritedFromInterface\">"
+ + "fieldInheritedFromInterface</a>",
+ // Method inheritance from non-public superinterface.
+ "Methods inherited from interface pkg."
+ + "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">"
+ + "PrivateInterface</a>",
+ // Extend documented private classes or interfaces
+ "extends",
+ "All Superinterfaces",
+ //Make sure implemented interfaces from private superclass are inherited
+ "<dl>\n"
+ + "<dt>All Known Implementing Classes:</dt>\n"
+ + "<dd><a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">"
+ + "PrivateParent</a>, "
+ + "<a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild"
+ + "</a></dd>\n"
+ + "</dl>");
- { "pkg2/C.html",
- "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" +
- "<dd><code><a href=\"../pkg2/I.html#hello-T-\">hello</a></code>" +
- " in interface <code>" +
- "<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>" +
- "<java.lang.String></code></dd>"},
-
- //Make sure when no modifier appear in the class signature, the
- //signature is displayed correctly without extra space at the beginning.
- { "pkg/PrivateParent.html",
- "<pre>class <span class=\"typeNameLabel\">PrivateParent</span>"},
+ checkOutput("pkg/PrivateInterface.html", true,
+ "<a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">"
+ + "methodInterface</a>"
+ );
- { "pkg/PublicChild.html",
- "<pre>public class <span class=\"typeNameLabel\">PublicChild</span>"},
- };
- private static final String[][] NEGATED_TEST2 = {
- { "pkg/PrivateParent.html",
- "<pre> class <span class=\"typeNameLabel\">PrivateParent</span>"},
- };
+ checkOutput("pkg2/C.html", true,
+ //Since private flag is used, we can document that private interface method
+ //with generic parameters has been implemented.
+ "<span class=\"descfrmTypeLabel\">Description copied from interface: <code>"
+ + "<a href=\"../pkg2/I.html#hello-T-\">I</a></code></span>",
+ "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ + "<dd><code><a href=\"../pkg2/I.html#hello-T-\">hello</a></code>"
+ + " in interface <code>"
+ + "<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>"
+ + "<java.lang.String></code></dd>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestPrivateClasses tester = new TestPrivateClasses();
- tester.run(ARGS1, TEST1, NEGATED_TEST1);
- tester.run(ARGS2, TEST2, NEGATED_TEST2);
- tester.printSummary();
+ checkOutput("pkg/PrivateParent.html", true,
+ //Make sure when no modifier appear in the class signature, the
+ //signature is displayed correctly without extra space at the beginning.
+ "<pre>class <span class=\"typeNameLabel\">PrivateParent</span>");
+
+ checkOutput("pkg/PrivateParent.html", false,
+ "<pre> class <span class=\"typeNameLabel\">PrivateParent</span>");
}
}
--- a/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java Fri May 23 09:05:24 2014 -0700
@@ -26,194 +26,174 @@
* @bug 8006124 8009684 8016921 8023700 8024096 8008164 8026567 8026770
* @summary Test javadoc support for profiles.
* @author Bhavesh Patel, Evgeniya Stepanova
- * @library ../lib/
- * @build JavadocTester TestProfiles
+ * @library ../lib
+ * @build JavadocTester
* @run main TestProfiles
*/
public class TestProfiles extends JavadocTester {
- //Test information.
- private static final String PROFILE_OUTPUT_DIR = OUTPUT_DIR + "-1";
- private static final String PACKAGE_OUTPUT_DIR = OUTPUT_DIR + "-2";
- //Javadoc arguments.
- private static final String[] ARGS1 = new String[]{
- "-d", PROFILE_OUTPUT_DIR, "-sourcepath", SRC_DIR, "-Xprofilespath",
- SRC_DIR + "/profile-rtjar-includes.txt", "pkg1", "pkg2",
- "pkg3", "pkg4", "pkg5", "pkgDeprecated"
- };
- private static final String[] ARGS2 = new String[]{
- "-d", PACKAGE_OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1", "pkg2",
- "pkg3", "pkg4", "pkg5"
- };
- //Input for string tests for profiles.
- private static final String[][] PROFILES_TEST = {
+ public static void main(String... args) throws Exception {
+ TestProfiles tester = new TestProfiles();
+ tester.runTests();
+ }
+
+ @Test
+ void testProfiles() {
+ javadoc("-d", "out-profiles",
+ "-sourcepath", testSrc,
+ "-Xprofilespath", testSrc("profile-rtjar-includes.txt"),
+ "pkg1", "pkg2", "pkg3", "pkg4", "pkg5", "pkgDeprecated");
+ checkExit(Exit.OK);
+
// Tests for profile-overview-frame.html listing all profiles.
- { "profile-overview-frame.html",
- "<span><a href=\"overview-frame.html\" "
- + "target=\"packageListFrame\">All Packages</a></span>"
- },
- { "profile-overview-frame.html",
- "<li><a href=\"compact1-frame.html\" target=\"packageListFrame\">"
- + "compact1</a></li>"
- },
+ checkOutput("profile-overview-frame.html", true,
+ "<span><a href=\"overview-frame.html\" "
+ + "target=\"packageListFrame\">All Packages</a></span>",
+ "<li><a href=\"compact1-frame.html\" target=\"packageListFrame\">"
+ + "compact1</a></li>");
+
// Tests for profileName-frame.html listing all packages in a profile.
- { "compact2-frame.html",
- "<span><a href=\"overview-frame.html\" target=\"packageListFrame\">"
- + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
- + "target=\"packageListFrame\">All Profiles</a></span>"
- },
- { "compact2-frame.html",
- "<li><a href=\"pkg4/compact2-package-frame.html\" "
- + "target=\"packageFrame\">pkg4</a></li>"
- },
+ checkOutput("compact2-frame.html", true,
+ "<span><a href=\"overview-frame.html\" target=\"packageListFrame\">"
+ + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
+ + "target=\"packageListFrame\">All Profiles</a></span>",
+ "<li><a href=\"pkg4/compact2-package-frame.html\" "
+ + "target=\"packageFrame\">pkg4</a></li>");
+
// Test for profileName-package-frame.html listing all types in a
// package of a profile.
- { "pkg2/compact2-package-frame.html",
- "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
- + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
- + "target=\"classFrame\">pkg2</a>"
- },
+ checkOutput("pkg2/compact2-package-frame.html", true,
+ "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
+ + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
+ + "target=\"classFrame\">pkg2</a>");
+
// Tests for profileName-summary.html listing the summary for a profile.
- { "compact2-summary.html",
- "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>\n"
- + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>"
- },
- { "compact2-summary.html",
- "<h1 title=\"Profile\" class=\"title\">Profile compact2</h1>"
- },
- { "compact2-summary.html",
- "<h3><a href=\"pkg2/compact2-package-summary.html\" "
- + "target=\"classFrame\">pkg2</a></h3>"
- },
- { "compact2-summary.html",
- "<ul class=\"blockList\">\n" +
- "<li class=\"blockList\">\n"
- + "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">"
- + "pkg2</a></h3>\n" +
- "<table class=\"typeSummary\" border=\"0\" "
- + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
- + "listing classes, and an explanation\">"
- },
- { "compact2-summary.html",
- "<ul class=\"blockList\">\n" +
- "<li class=\"blockList\">\n"
- + "<h3><a href=\"pkg4/compact2-package-summary.html\" target=\"classFrame\">"
- + "pkg4</a></h3>\n" +
- "<table class=\"typeSummary\" border=\"0\" "
- + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
- + "listing classes, and an explanation\">"
- },
+ checkOutput("compact2-summary.html", true,
+ "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>\n"
+ + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>",
+ "<h1 title=\"Profile\" class=\"title\">Profile compact2</h1>",
+ "<h3><a href=\"pkg2/compact2-package-summary.html\" "
+ + "target=\"classFrame\">pkg2</a></h3>",
+ "<ul class=\"blockList\">\n"
+ + "<li class=\"blockList\">\n"
+ + "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">"
+ + "pkg2</a></h3>\n"
+ + "<table class=\"typeSummary\" border=\"0\" "
+ + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
+ + "listing classes, and an explanation\">",
+ "<ul class=\"blockList\">\n"
+ + "<li class=\"blockList\">\n"
+ + "<h3><a href=\"pkg4/compact2-package-summary.html\" target=\"classFrame\">"
+ + "pkg4</a></h3>\n"
+ + "<table class=\"typeSummary\" border=\"0\" "
+ + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
+ + "listing classes, and an explanation\">");
+
+
// Tests for profileName-package-summary.html listing the summary for a
// package in a profile.
- { "pkg5/compact3-package-summary.html",
- "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package"
- + "</a></li>"
- },
- { "pkg5/compact3-package-summary.html",
- "<div class=\"subTitle\">compact3</div>"
- },
- { "pkg5/compact3-package-summary.html",
- "<ul class=\"blockList\">\n" +
- "<li class=\"blockList\">\n"
- + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
- + "cellspacing=\"0\" summary=\"Interface Summary table, listing "
- + "interfaces, and an explanation\">"
- },
- //Test for "overview-frame.html" showing the "All Profiles" link.
- { "overview-frame.html",
- "<span><a href=\"profile-overview-frame.html\" "
- + "target=\"packageListFrame\">All Profiles</a></span>"
- },
- //Test for "className.html" showing the profile information for the type.
- { "pkg2/Class1Pkg2.html",
- "<div class=\"subTitle\">compact1, compact2, compact3</div>"
- },
- { "index.html",
- "<frame src=\"overview-frame.html\" name=\"packageListFrame\" " +
- "title=\"All Packages\">"
- },
- //Test for "overview-summary.html" showing the profile list.
- { "overview-summary.html",
- "<ul>\n" +
- "<li><a href=\"compact1-summary.html\" target=\"classFrame\">" +
- "compact1</a></li>\n" +
- "<li><a href=\"compact2-summary.html\" " +
- "target=\"classFrame\">compact2</a></li>\n" +
- "<li><a href=\"" +
- "compact3-summary.html\" target=\"classFrame\">compact3</a></li>\n" +
- "</ul>"
- },
- //Test deprecated class in profiles
- { "compact1-summary.html",
- "<td class=\"colFirst\"><a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">Class1Pkg2</a></td>\n"
- + "<td class=\"colLast\">Deprecated"
- },
- { "deprecated-list.html",
- "<td class=\"colOne\"><a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">pkg2.Class1Pkg2</a>\n"
- +"<div class=\"block\"><span class=\"deprecationComment\">Class1Pkg2. This class is deprecated</span></div>"
- },
+ checkOutput("pkg5/compact3-package-summary.html", true,
+ "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package"
+ + "</a></li>",
+ "<div class=\"subTitle\">compact3</div>",
+ "<ul class=\"blockList\">\n"
+ + "<li class=\"blockList\">\n"
+ + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Interface Summary table, listing "
+ + "interfaces, and an explanation\">");
+
+ // Test for "overview-frame.html" showing the "All Profiles" link.
+ checkOutput("overview-frame.html", true,
+ "<span><a href=\"profile-overview-frame.html\" "
+ + "target=\"packageListFrame\">All Profiles</a></span>");
+
+ // Test for "className.html" showing the profile information for the type.
+ checkOutput("pkg2/Class1Pkg2.html", true,
+ "<div class=\"subTitle\">compact1, compact2, compact3</div>");
+
+ checkOutput("index.html", true,
+ "<frame src=\"overview-frame.html\" name=\"packageListFrame\" "
+ + "title=\"All Packages\">");
+
+ // Test for "overview-summary.html" showing the profile list.
+ checkOutput("overview-summary.html", true,
+ "<ul>\n"
+ + "<li><a href=\"compact1-summary.html\" target=\"classFrame\">"
+ + "compact1</a></li>\n"
+ + "<li><a href=\"compact2-summary.html\" "
+ + "target=\"classFrame\">compact2</a></li>\n"
+ + "<li><a href=\""
+ + "compact3-summary.html\" target=\"classFrame\">compact3</a></li>\n"
+ + "</ul>");
+
+ // Test deprecated class in profiles
+ checkOutput("compact1-summary.html", true,
+ "<td class=\"colFirst\"><a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">Class1Pkg2</a></td>\n"
+ + "<td class=\"colLast\">Deprecated");
+
+ checkOutput("deprecated-list.html", true,
+ "<td class=\"colOne\"><a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">pkg2.Class1Pkg2</a>\n"
+ + "<div class=\"block\"><span class=\"deprecationComment\">Class1Pkg2. This class is deprecated</span></div>");
+
//Test deprecated package in profile
- { "deprecated-list.html",
- "<td class=\"colOne\"><a href=\"pkgDeprecated/package-summary.html\">pkgDeprecated</a>\n"
- +"<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>."
- + " Use pkg1.</span></div>"
- },
- { "pkgDeprecated/package-summary.html",
- "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
- + "<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>."
- + " Use pkg1.</span></div>"
- },
- // need to add teststring when JDK-8015496 will be fixed
- //Test exception in profiles
- { "compact1-summary.html",
- "<table class=\"typeSummary\" "
- + "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
- + "summary=\"Exception Summary table, listing exceptions, and an explanation\">\n"
- + "<caption><span>Exception Summary</span><span class=\"tabEnd\">"
- + " </span></caption>\n" +
- "<tr>\n" +
- "<th class=\"colFirst\" "
- + "scope=\"col\">Exception</th>\n" +
- "<th class=\"colLast\" scope=\"col\">"
- + "Description</th>\n" +
- "</tr>\n" +
- "<tbody>\n" +
- "<tr class=\"altColor\">\n"
- + "<td class=\"colFirst\"><a href=\"pkg2/ClassException.html\""
- + " title=\"class in pkg2\">ClassException</a></td>"
- },
+ checkOutput("deprecated-list.html", true,
+ "<td class=\"colOne\"><a href=\"pkgDeprecated/package-summary.html\">pkgDeprecated</a>\n"
+ + "<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>."
+ + " Use pkg1.</span></div>");
+
+ checkOutput("pkgDeprecated/package-summary.html", true,
+ "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n"
+ + "<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>."
+ + " Use pkg1.</span></div>");
+
+ // TODO: need to add teststring when JDK-8015496 will be fixed
+ // Test exception in profiles
+ checkOutput("compact1-summary.html", true,
+ "<table class=\"typeSummary\" "
+ + "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ + "summary=\"Exception Summary table, listing exceptions, and an explanation\">\n"
+ + "<caption><span>Exception Summary</span><span class=\"tabEnd\">"
+ + " </span></caption>\n"
+ + "<tr>\n"
+ + "<th class=\"colFirst\" scope=\"col\">Exception</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">"
+ + "Description</th>\n"
+ + "</tr>\n"
+ + "<tbody>\n"
+ + "<tr class=\"altColor\">\n"
+ + "<td class=\"colFirst\"><a href=\"pkg2/ClassException.html\""
+ + " title=\"class in pkg2\">ClassException</a></td>");
+
//Test errors in profiles
- { "compact1-summary.html",
- "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
- + "summary=\"Error Summary table, listing errors, and an explanation\">\n"
- + "<caption><span>Error Summary</span><span class=\"tabEnd\"> "
- + "</span></caption>\n" +
- "<tr>\n" +
- "<th class=\"colFirst\""
- + " scope=\"col\">Error</th>\n" +
- "<th class=\"colLast\" "
- + "scope=\"col\">Description</th>\n" +
- "</tr>\n" +
- "<tbody>\n"
- + "<tr class=\"altColor\">\n" +
- "<td class=\"colFirst\">"
- + "<a href=\"pkg2/ClassError.html\" title=\"class in pkg2\">ClassError</a></td>"
- }
- };
- private static final String[][] PROFILES_NEGATED_TEST = {
- { "pkg3/Class2Pkg3.html",
- "<div class=\"subTitle\">compact1"
- },
- { "pkg3/Interface1Pkg3.html",
- "<div class=\"subTitle\">compact1"
- },
- { "pkg4/compact2-package-frame.html",
+ checkOutput("compact1-summary.html", true,
+ "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ + "summary=\"Error Summary table, listing errors, and an explanation\">\n"
+ + "<caption><span>Error Summary</span><span class=\"tabEnd\"> "
+ + "</span></caption>\n"
+ + "<tr>\n"
+ + "<th class=\"colFirst\" scope=\"col\">Error</th>\n"
+ + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
+ + "</tr>\n"
+ + "<tbody>\n"
+ + "<tr class=\"altColor\">\n"
+ + "<td class=\"colFirst\">"
+ + "<a href=\"pkg2/ClassError.html\" title=\"class in pkg2\">ClassError</a></td>");
+
+ // negative tests
+ checkOutput("pkg3/Class2Pkg3.html", false,
+ "<div class=\"subTitle\">compact1");
+
+ checkOutput("pkg3/Interface1Pkg3.html", false,
+ "<div class=\"subTitle\">compact1");
+
+ checkOutput("pkg4/compact2-package-frame.html", false,
"<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" "
- + "target=\"classFrame\">Anno1Pkg4</a></li>"
- },
- { "compact1-summary.html","<li>Use</li>"
- },
- { "compact2-summary.html",
+ + "target=\"classFrame\">Anno1Pkg4</a></li>");
+
+ checkOutput("compact1-summary.html", false,
+ "<li>Use</li>");
+
+ checkOutput("compact2-summary.html", false,
"<ul class=\"blockList\">\n" +
"<li class=\"blockList\">\n"
+ "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">"
@@ -221,68 +201,59 @@
"<li class=\"blockList\">\n"
+ "<table class=\"typeSummary\" border=\"0\" "
+ "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
- + "listing classes, and an explanation\">"
- },
- { "pkg5/compact3-package-summary.html",
+ + "listing classes, and an explanation\">");
+
+ checkOutput("pkg5/compact3-package-summary.html", false,
"<ul class=\"blockList\">\n" +
"<li class=\"blockList\">\n"
+ "<li class=\"blockList\">\n"
+ "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Interface Summary table, listing "
- + "interfaces, and an explanation\">"
- }
- };
- private static final String[][] PACKAGES_TEST = {
- { "overview-frame.html",
- "<h2 title=\"Packages\">Packages</h2>"
- },
- { "pkg4/package-frame.html",
- "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" "
- + "target=\"classFrame\">pkg4</a></h1>"
- },
- { "pkg4/package-summary.html",
- "<div class=\"header\">\n" +
- "<h1 title=\"Package\" "
- + "class=\"title\">Package pkg4</h1>\n" +
- "</div>"
- }
- };
- private static final String[][] PACKAGES_NEGATED_TEST = {
- { "overview-frame.html",
- "<span><a href=\"profile-overview-frame.html\" "
- + "target=\"packageListFrame\">All Profiles</a></span>"
- },
- { "pkg2/Class1Pkg2.html",
- "<div class=\"subTitle\">compact1, compact2, compact3</div>"
- },
- { "overview-summary.html",
- "<ul>\n" +
- "<li><a href=\"compact1-summary.html\" target=\"classFrame\">" +
- "compact1</a></li>\n" +
- "<li><a href=\"compact2-summary.html\" " +
- "target=\"classFrame\">compact2</a></li>\n" +
- "<li><a href=\"" +
- "compact3-summary.html\" target=\"classFrame\">compact3</a></li>\n" +
- "</ul>"
- }
- };
- private static final String[] PACKAGES_NEGATED_FILE_TEST = {
- "profile-overview-frame.html",
- "compact2-frame.html",
- "pkg2/compact2-package-frame.html",
- "compact2-summary.html",
- "pkg5/compact3-package-summary.html"
- };
+ + "interfaces, and an explanation\">");
+ }
+
+ @Test
+ void testPackages() {
+ javadoc("-d", "out-packages",
+ "-sourcepath", testSrc,
+ "pkg1", "pkg2", "pkg3", "pkg4", "pkg5");
+ checkExit(Exit.OK);
+
+ checkOutput("overview-frame.html", true,
+ "<h2 title=\"Packages\">Packages</h2>");
+
+ checkOutput("pkg4/package-frame.html", true,
+ "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" "
+ + "target=\"classFrame\">pkg4</a></h1>");
+
+ checkOutput("pkg4/package-summary.html", true,
+ "<div class=\"header\">\n"
+ + "<h1 title=\"Package\" "
+ + "class=\"title\">Package pkg4</h1>\n"
+ + "</div>");
- /**
- * The entry point of the test.
- *
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestProfiles tester = new TestProfiles();
- tester.run(ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST);
- tester.run(ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST, NO_FILE_TEST, PACKAGES_NEGATED_FILE_TEST);
- tester.printSummary();
+ checkOutput("overview-frame.html", false,
+ "<span><a href=\"profile-overview-frame.html\" "
+ + "target=\"packageListFrame\">All Profiles</a></span>");
+
+ checkOutput("pkg2/Class1Pkg2.html", false,
+ "<div class=\"subTitle\">compact1, compact2, compact3</div>");
+
+ checkOutput("overview-summary.html", false,
+ "<ul>\n"
+ + "<li><a href=\"compact1-summary.html\" target=\"classFrame\">"
+ + "compact1</a></li>\n"
+ + "<li><a href=\"compact2-summary.html\" "
+ + "target=\"classFrame\">compact2</a></li>\n"
+ + "<li><a href=\""
+ + "compact3-summary.html\" target=\"classFrame\">compact3</a></li>\n"
+ + "</ul>");
+
+ checkFiles(false,
+ "profile-overview-frame.html",
+ "compact2-frame.html",
+ "pkg2/compact2-package-frame.html",
+ "compact2-summary.html",
+ "pkg5/compact3-package-summary.html");
}
}
--- a/langtools/test/com/sun/javadoc/testProfiles/TestProfilesConfiguration.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testProfiles/TestProfilesConfiguration.java Fri May 23 09:05:24 2014 -0700
@@ -26,97 +26,98 @@
* @bug 8006124 8009684 8015663 8015496 8026567
* @summary Test javadoc options support for profiles.
* @author Evgeniya Stepanova
- * @library ../lib/
- * @build JavadocTester TestProfilesConfiguration
+ * @library ../lib
+ * @build JavadocTester
* @run main TestProfilesConfiguration
*/
public class TestProfilesConfiguration extends JavadocTester {
- //Test information.
- private static final String PROFILE_CONFIGURATION_OUTPUT_DIR = OUTPUT_DIR + "-3";
- private static final String NODEPR_NOPKGS_OUTPUT_DIR = OUTPUT_DIR + "-4";
- //Javadoc arguments.
- private static final String[] ARGS3 = new String[]{
- "-d", PROFILE_CONFIGURATION_OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-nocomment", "-keywords", "-Xprofilespath", SRC_DIR +
- "/profile-rtjar-includes.txt", "-doctitle", "Simple doctitle",
- "-use", "pkg3", "pkg1", "pkg2", "pkg4",
- "pkg5", "-packagesheader", "Simple packages header","pkgDeprecated"
- };
- private static final String[] ARGS4 = new String[]{
- "-d", NODEPR_NOPKGS_OUTPUT_DIR, "-sourcepath", SRC_DIR, "-nocomment",
- "-nodeprecated", "-keywords", "-Xprofilespath", SRC_DIR +
- "/profile-rtjar-includes-nopkgs.txt", "-doctitle", "Simple doctitle",
- "-use", "-packagesheader", "Simple packages header",
- "pkg1", "pkg2", "pkg3", "pkg4", "pkg5", "pkgDeprecated"
- };
- private static final String[][] NODEPR_NOPKGS_TEST = {
- { "overview-summary.html",
- "<ul>\n" +
- "<li><a href=\"compact2-summary.html\" target=\"classFrame\">" +
- "compact2</a></li>\n" +
- "<li><a href=\"compact3-summary.html\" target=\"" +
- "classFrame\">compact3</a></li>\n" +
- "</ul>"
- },
- { "profile-overview-frame.html",
- "<ul title=\"Profiles\">\n" +
- "<li><a href=\"compact2-frame.html\" target=\"packageListFrame\">" +
- "compact2</a></li>\n" +
- "<li><a href=\"compact3-frame.html\" target=\"" +
- "packageListFrame\">compact3</a></li>\n" +
- "</ul>"
- }
- };
- private static final String[][] NODEPR_NOPKGS_NEGATED_TEST = {
- { "overview-summary.html",
- "compact1"
- }
- };
+ public static void main(String... args) throws Exception {
+ TestProfilesConfiguration tester = new TestProfilesConfiguration();
+ tester.runTests();
+// tester.run(ARGS3, PROFILES_CONFIGURATION_TEST, PROFILES_CONFIGURATION_NEGATED_TEST);
+// tester.run(ARGS4, NODEPR_NOPKGS_TEST, NODEPR_NOPKGS_NEGATED_TEST);
+// tester.printSummary();
+ }
+
+ @Test
+ void testProfiles() {
+ javadoc("-d", "out-profiles",
+ "-sourcepath", testSrc,
+ "-nocomment",
+ "-keywords",
+ "-Xprofilespath", testSrc("profile-rtjar-includes.txt"),
+ "-doctitle", "Simple doctitle",
+ "-use",
+ "-packagesheader", "Simple packages header",
+ "pkg3", "pkg1", "pkg2", "pkg4", "pkg5", "pkgDeprecated");
+ checkExit(Exit.OK);
+
+ checkOutput("compact1-summary.html", true,
+ //-use option test string fo profile view page
+ "<li>Use</li>",
+ // -keywords option test string for profiles
+ "<meta name=\"keywords\" content=\"compact1 profile\">",
+ // Deprecated information on a package
+ "<h3><a href=\"pkgDeprecated/compact1-package-summary.html\" target=\""
+ + "classFrame\">pkgDeprecated</a></h3>\n"
+ + "<div class=\"deprecatedContent\">"
+ + "<span class=\"deprecatedLabel\">Deprecated.</span></div>"
+ );
+
+ //-nocomments option test string
+ checkOutput("compact1-summary.html", false,
+ "<div class=\"block\"><i>Class1Pkg2.</i></div>"
+ );
+
+ // -doctitle option test string
+ checkOutput("overview-summary.html", true,
+ "<div class=\"header\">\n"
+ + "<h1 class=\"title\">Simple doctitle</h1>"
+ );
- private static final String[][] PROFILES_CONFIGURATION_TEST = {
- //-use option test string fo profile view page
- { "compact1-summary.html","<li>Use</li>"
- },
- //-doctitle option test string
- { "overview-summary.html",
- "<div class=\"header\">\n" +
- "<h1 class=\"title\">Simple doctitle</h1>"
- },
- //-packagesheader option test string fo profiles
- { "profile-overview-frame.html",
- "<h1 title=\"Simple packages header\" class=\"bar\">Simple packages header</h1>"
- },
- //-keywords option test string for profiles
- { "compact1-summary.html",
- "<meta name=\"keywords\" content=\"compact1 profile\">"
- },
- //Deprecated information on a package
- { "compact1-summary.html",
- "<h3><a href=\"pkgDeprecated/compact1-package-summary.html\" target=\"" +
- "classFrame\">pkgDeprecated</a></h3>\n" +
- "<div class=\"deprecatedContent\">" +
- "<span class=\"deprecatedLabel\">Deprecated.</span></div>"
- }
- };
- private static final String[][] PROFILES_CONFIGURATION_NEGATED_TEST = {
- //-nocomments option test string
- { "compact1-summary.html",
- "<div class=\"block\"><i>Class1Pkg2.</i></div>"
- }
- };
+ // -packagesheader option test string fo profiles
+ checkOutput("profile-overview-frame.html", true,
+ "<h1 title=\"Simple packages header\" class=\"bar\">Simple packages header</h1>"
+ );
+ }
+
+
+ @Test
+ void testNoDeprNoPackages() {
+ javadoc("-d", "out-noDeprNoPackages",
+ "-sourcepath", testSrc,
+ "-nocomment",
+ "-nodeprecated",
+ "-keywords",
+ "-Xprofilespath", testSrc("profile-rtjar-includes-nopkgs.txt"),
+ "-doctitle", "Simple doctitle",
+ "-use",
+ "-packagesheader", "Simple packages header",
+ "pkg1", "pkg2", "pkg3", "pkg4", "pkg5", "pkgDeprecated");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- *
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestProfilesConfiguration tester = new TestProfilesConfiguration();
- tester.run(ARGS3, PROFILES_CONFIGURATION_TEST,
- PROFILES_CONFIGURATION_NEGATED_TEST);
- tester.run(ARGS4, NODEPR_NOPKGS_TEST,
- NODEPR_NOPKGS_NEGATED_TEST);
- tester.printSummary();
+ checkOutput("overview-summary.html", true,
+ "<ul>\n"
+ + "<li><a href=\"compact2-summary.html\" target=\"classFrame\">"
+ + "compact2</a></li>\n"
+ + "<li><a href=\"compact3-summary.html\" target=\""
+ + "classFrame\">compact3</a></li>\n"
+ + "</ul>"
+ );
+
+ checkOutput("profile-overview-frame.html", true,
+ "<ul title=\"Profiles\">\n"
+ + "<li><a href=\"compact2-frame.html\" target=\"packageListFrame\">"
+ + "compact2</a></li>\n"
+ + "<li><a href=\"compact3-frame.html\" target=\""
+ + "packageListFrame\">compact3</a></li>\n"
+ + "</ul>"
+ );
+
+ checkOutput("overview-summary.html", false,
+ "compact1"
+ );
+
}
}
--- a/langtools/test/com/sun/javadoc/testRecurseSubPackages/TestRecurseSubPackages.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testRecurseSubPackages/TestRecurseSubPackages.java Fri May 23 09:05:24 2014 -0700
@@ -26,35 +26,33 @@
* @bug 4074234
* @summary Make Javadoc capable of traversing/recursing all of given subpackages.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestRecurseSubPackages
* @run main TestRecurseSubPackages
*/
public class TestRecurseSubPackages extends JavadocTester {
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-subpackages", "pkg1", "-exclude", "pkg1.pkg2.packageToExclude"
- };
+ public static void main(String... args) throws Exception {
+ TestRecurseSubPackages tester = new TestRecurseSubPackages();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- String[][] tests = new String[6][2];
- for (int i = 0; i < tests.length; i++) {
- tests[i][0] = "allclasses-frame.html";
- tests[i][1] = "C" + (i+1) + ".html";
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-subpackages", "pkg1",
+ "-exclude", "pkg1.pkg2.packageToExclude");
+ checkExit(Exit.OK);
+
+ for (int i = 1; i <= 6; i++) {
+ checkOutput("allclasses-frame.html", true,
+ "C" + i + ".html");
}
- String[][] negatedTests = new String[][] {
- { "allclasses-frame.html", "DummyClass.html"}
- };
- TestRecurseSubPackages tester = new TestRecurseSubPackages();
- tester.run(ARGS, tests, negatedTests);
- tester.printSummary();
+
+ checkOutput("allclasses-frame.html", false,
+ "DummyClass.html");
}
+
}
--- a/langtools/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java Fri May 23 09:05:24 2014 -0700
@@ -27,81 +27,64 @@
* @summary Test to make sure that relative paths are redirected in the
* output so that they are not broken.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestRelativeLinks
* @run main TestRelativeLinks
*/
public class TestRelativeLinks extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-use", "-sourcepath", SRC_DIR, "pkg", "pkg2"
- };
+ public static void main(String... args) throws Exception {
+ TestRelativeLinks tester = new TestRelativeLinks();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- //These relative paths should stay relative because they appear
- //in the right places.
- { "pkg/C.html",
- "<a href=\"relative-class-link.html\">relative class link</a>"},
- { "pkg/C.html",
- "<a href=\"relative-field-link.html\">relative field link</a>"},
- { "pkg/C.html",
- "<a href=\"relative-method-link.html\">relative method link</a>"},
- { "pkg/package-summary.html",
- "<a href=\"relative-package-link.html\">relative package link</a>"},
- { "pkg/C.html",
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-use",
+ "-sourcepath", testSrc,
+ "pkg", "pkg2");
+ checkExit(Exit.OK);
+
+ // These relative paths should stay relative because they appear
+ // in the right places.
+ checkOutput("pkg/C.html", true,
+ "<a href=\"relative-class-link.html\">relative class link</a>",
+ "<a href=\"relative-field-link.html\">relative field link</a>",
+ "<a href=\"relative-method-link.html\">relative method link</a>",
" <a\n" +
- " href=\"relative-multi-line-link.html\">relative-multi-line-link</a>."},
-
- //These relative paths should be redirected because they are in different
- //places.
+ " href=\"relative-multi-line-link.html\">relative-multi-line-link</a>.");
+ checkOutput("pkg/package-summary.html", true,
+ "<a href=\"relative-package-link.html\">relative package link</a>");
- //INDEX PAGE
- { "index-all.html",
- "<a href=\"./pkg/relative-class-link.html\">relative class link</a>"},
- { "index-all.html",
- "<a href=\"./pkg/relative-field-link.html\">relative field link</a>"},
- { "index-all.html",
- "<a href=\"./pkg/relative-method-link.html\">relative method link</a>"},
- { "index-all.html",
- "<a href=\"./pkg/relative-package-link.html\">relative package link</a>"},
- { "index-all.html",
+ // These relative paths should be redirected because they are in different
+ // places.
+
+ // INDEX PAGE
+ checkOutput("index-all.html", true,
+ "<a href=\"./pkg/relative-class-link.html\">relative class link</a>",
+ "<a href=\"./pkg/relative-field-link.html\">relative field link</a>",
+ "<a href=\"./pkg/relative-method-link.html\">relative method link</a>",
+ "<a href=\"./pkg/relative-package-link.html\">relative package link</a>",
" <a\n" +
- " href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
-
-
- //PACKAGE USE
- { "pkg/package-use.html",
- "<a href=\"../pkg/relative-package-link.html\">relative package link</a>."},
- { "pkg/package-use.html",
- "<a href=\"../pkg/relative-class-link.html\">relative class link</a>"},
+ " href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>.");
- //CLASS_USE
- { "pkg/class-use/C.html",
- "<a href=\"../../pkg/relative-field-link.html\">relative field link</a>"},
- { "pkg/class-use/C.html",
- "<a href=\"../../pkg/relative-method-link.html\">relative method link</a>"},
- { "pkg/class-use/C.html",
- "<a href=\"../../pkg/relative-package-link.html\">relative package link</a>"},
- { "pkg/class-use/C.html",
- " <a\n" +
- " href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
+ // PACKAGE USE
+ checkOutput("pkg/package-use.html", true,
+ "<a href=\"../pkg/relative-package-link.html\">relative package link</a>.",
+ "<a href=\"../pkg/relative-class-link.html\">relative class link</a>");
- //PACKAGE OVERVIEW
- { "overview-summary.html",
- "<a href=\"./pkg/relative-package-link.html\">relative package link</a>"},
- };
+ // CLASS_USE
+ checkOutput("pkg/class-use/C.html", true,
+ "<a href=\"../../pkg/relative-field-link.html\">relative field link</a>",
+ "<a href=\"../../pkg/relative-method-link.html\">relative method link</a>",
+ "<a href=\"../../pkg/relative-package-link.html\">relative package link</a>",
+ " <a\n" +
+ " href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>.");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestRelativeLinks tester = new TestRelativeLinks();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ // PACKAGE OVERVIEW
+ checkOutput("overview-summary.html", true,
+ "<a href=\"./pkg/relative-package-link.html\">relative package link</a>");
}
}
--- a/langtools/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java Fri May 23 09:05:24 2014 -0700
@@ -26,147 +26,125 @@
* @bug 8005092
* @summary Test repeated annotations output.
* @author bpatel
- * @library ../lib/
- * @build JavadocTester TestRepeatedAnnotations
+ * @library ../lib
+ * @build JavadocTester
* @run main TestRepeatedAnnotations
*/
public class TestRepeatedAnnotations extends JavadocTester {
- //Test information.
+ public static void main(String... args) throws Exception {
+ TestRepeatedAnnotations tester = new TestRepeatedAnnotations();
+ tester.runTests();
+ }
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", "pkg1"
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg", "pkg1");
+ checkExit(Exit.OK);
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/C.html",
- "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg\">@ContaineeSynthDoc</a> " +
- "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg\">@ContaineeSynthDoc</a>"},
- { "pkg/C.html",
- "<a href=\"../pkg/ContaineeRegDoc.html\" " +
- "title=\"annotation in pkg\">@ContaineeRegDoc</a> " +
- "<a href=\"../pkg/ContaineeRegDoc.html\" " +
- "title=\"annotation in pkg\">@ContaineeRegDoc</a>"},
- { "pkg/C.html",
- "<a href=\"../pkg/RegContainerDoc.html\" " +
- "title=\"annotation in pkg\">@RegContainerDoc</a>" +
- "(<a href=\"../pkg/RegContainerDoc.html#value--\">value</a>={" +
- "<a href=\"../pkg/RegContaineeNotDoc.html\" " +
- "title=\"annotation in pkg\">@RegContaineeNotDoc</a>," +
- "<a href=\"../pkg/RegContaineeNotDoc.html\" " +
- "title=\"annotation in pkg\">@RegContaineeNotDoc</a>})"},
- { "pkg/C.html",
- "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg\">@ContaineeSynthDoc</a> " +
- "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg\">@ContaineeSynthDoc</a> " +
- "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg\">@ContaineeSynthDoc</a>"},
- { "pkg/C.html",
- "<a href=\"../pkg/ContainerSynthDoc.html\" " +
- "title=\"annotation in pkg\">@ContainerSynthDoc</a>(" +
- "<a href=\"../pkg/ContainerSynthDoc.html#value--\">value</a>=" +
- "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg\">@ContaineeSynthDoc</a>)"},
- { "pkg/C.html",
- "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg\">@ContaineeSynthDoc</a> " +
- "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg\">@ContaineeSynthDoc</a>"},
+ checkOutput("pkg/C.html", true,
+ "<a href=\"../pkg/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg\">@ContaineeSynthDoc</a> "
+ + "<a href=\"../pkg/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg\">@ContaineeSynthDoc</a>",
+ "<a href=\"../pkg/ContaineeRegDoc.html\" "
+ + "title=\"annotation in pkg\">@ContaineeRegDoc</a> "
+ + "<a href=\"../pkg/ContaineeRegDoc.html\" "
+ + "title=\"annotation in pkg\">@ContaineeRegDoc</a>",
+ "<a href=\"../pkg/RegContainerDoc.html\" "
+ + "title=\"annotation in pkg\">@RegContainerDoc</a>"
+ + "(<a href=\"../pkg/RegContainerDoc.html#value--\">value</a>={"
+ + "<a href=\"../pkg/RegContaineeNotDoc.html\" "
+ + "title=\"annotation in pkg\">@RegContaineeNotDoc</a>,"
+ + "<a href=\"../pkg/RegContaineeNotDoc.html\" "
+ + "title=\"annotation in pkg\">@RegContaineeNotDoc</a>})",
+ "<a href=\"../pkg/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg\">@ContaineeSynthDoc</a> "
+ + "<a href=\"../pkg/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg\">@ContaineeSynthDoc</a> "
+ + "<a href=\"../pkg/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg\">@ContaineeSynthDoc</a>",
+ "<a href=\"../pkg/ContainerSynthDoc.html\" "
+ + "title=\"annotation in pkg\">@ContainerSynthDoc</a>("
+ + "<a href=\"../pkg/ContainerSynthDoc.html#value--\">value</a>="
+ + "<a href=\"../pkg/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg\">@ContaineeSynthDoc</a>)",
+ "<a href=\"../pkg/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg\">@ContaineeSynthDoc</a> "
+ + "<a href=\"../pkg/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg\">@ContaineeSynthDoc</a>");
- { "pkg/D.html",
- "<a href=\"../pkg/RegDoc.html\" title=\"annotation in pkg\">@RegDoc</a>" +
- "(<a href=\"../pkg/RegDoc.html#x--\">x</a>=1)"},
- { "pkg/D.html",
- "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>" +
- "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>=1)"},
- { "pkg/D.html",
- "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>" +
- "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>={1,2})"},
- { "pkg/D.html",
- "<a href=\"../pkg/NonSynthDocContainer.html\" " +
- "title=\"annotation in pkg\">@NonSynthDocContainer</a>" +
- "(<a href=\"../pkg/NonSynthDocContainer.html#value--\">value</a>=" +
- "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>)"},
+ checkOutput("pkg/D.html", true,
+ "<a href=\"../pkg/RegDoc.html\" title=\"annotation in pkg\">@RegDoc</a>"
+ + "(<a href=\"../pkg/RegDoc.html#x--\">x</a>=1)",
+ "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>"
+ + "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>=1)",
+ "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>"
+ + "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>={1,2})",
+ "<a href=\"../pkg/NonSynthDocContainer.html\" "
+ + "title=\"annotation in pkg\">@NonSynthDocContainer</a>"
+ + "(<a href=\"../pkg/NonSynthDocContainer.html#value--\">value</a>="
+ + "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>)");
- { "pkg1/C.html",
- "<a href=\"../pkg1/RegContainerValDoc.html\" " +
- "title=\"annotation in pkg1\">@RegContainerValDoc</a>" +
- "(<a href=\"../pkg1/RegContainerValDoc.html#value--\">value</a>={" +
- "<a href=\"../pkg1/RegContaineeNotDoc.html\" " +
- "title=\"annotation in pkg1\">@RegContaineeNotDoc</a>," +
- "<a href=\"../pkg1/RegContaineeNotDoc.html\" " +
- "title=\"annotation in pkg1\">@RegContaineeNotDoc</a>}," +
- "<a href=\"../pkg1/RegContainerValDoc.html#y--\">y</a>=3)"},
- { "pkg1/C.html",
- "<a href=\"../pkg1/ContainerValDoc.html\" " +
- "title=\"annotation in pkg1\">@ContainerValDoc</a>" +
- "(<a href=\"../pkg1/ContainerValDoc.html#value--\">value</a>={" +
- "<a href=\"../pkg1/ContaineeNotDoc.html\" " +
- "title=\"annotation in pkg1\">@ContaineeNotDoc</a>," +
- "<a href=\"../pkg1/ContaineeNotDoc.html\" " +
- "title=\"annotation in pkg1\">@ContaineeNotDoc</a>}," +
- "<a href=\"../pkg1/ContainerValDoc.html#x--\">x</a>=1)"}
- };
-
- private static final String[][] NEGATED_TEST = {
- { "pkg/C.html",
- "<a href=\"../pkg/RegContaineeDoc.html\" " +
- "title=\"annotation in pkg\">@RegContaineeDoc</a> " +
- "<a href=\"../pkg/RegContaineeDoc.html\" " +
- "title=\"annotation in pkg\">@RegContaineeDoc</a>"},
- { "pkg/C.html",
- "<a href=\"../pkg/RegContainerNotDoc.html\" " +
- "title=\"annotation in pkg\">@RegContainerNotDoc</a>" +
- "(<a href=\"../pkg/RegContainerNotDoc.html#value--\">value</a>={" +
- "<a href=\"../pkg/RegContaineeNotDoc.html\" " +
- "title=\"annotation in pkg\">@RegContaineeNotDoc</a>," +
- "<a href=\"../pkg/RegContaineeNotDoc.html\" " +
- "title=\"annotation in pkg\">@RegContaineeNotDoc</a>})"},
+ checkOutput("pkg1/C.html", true,
+ "<a href=\"../pkg1/RegContainerValDoc.html\" "
+ + "title=\"annotation in pkg1\">@RegContainerValDoc</a>"
+ + "(<a href=\"../pkg1/RegContainerValDoc.html#value--\">value</a>={"
+ + "<a href=\"../pkg1/RegContaineeNotDoc.html\" "
+ + "title=\"annotation in pkg1\">@RegContaineeNotDoc</a>,"
+ + "<a href=\"../pkg1/RegContaineeNotDoc.html\" "
+ + "title=\"annotation in pkg1\">@RegContaineeNotDoc</a>},"
+ + "<a href=\"../pkg1/RegContainerValDoc.html#y--\">y</a>=3)",
+ "<a href=\"../pkg1/ContainerValDoc.html\" "
+ + "title=\"annotation in pkg1\">@ContainerValDoc</a>"
+ + "(<a href=\"../pkg1/ContainerValDoc.html#value--\">value</a>={"
+ + "<a href=\"../pkg1/ContaineeNotDoc.html\" "
+ + "title=\"annotation in pkg1\">@ContaineeNotDoc</a>,"
+ + "<a href=\"../pkg1/ContaineeNotDoc.html\" "
+ + "title=\"annotation in pkg1\">@ContaineeNotDoc</a>},"
+ + "<a href=\"../pkg1/ContainerValDoc.html#x--\">x</a>=1)");
- { "pkg1/C.html",
- "<a href=\"../pkg1/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg1\">@ContaineeSynthDoc</a> " +
- "<a href=\"../pkg1/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg1\">@ContaineeSynthDoc</a>"},
- { "pkg1/C.html",
- "<a href=\"../pkg1/RegContainerValNotDoc.html\" " +
- "title=\"annotation in pkg1\">@RegContainerValNotDoc</a>" +
- "(<a href=\"../pkg1/RegContainerValNotDoc.html#value--\">value</a>={" +
- "<a href=\"../pkg1/RegContaineeDoc.html\" " +
- "title=\"annotation in pkg1\">@RegContaineeDoc</a>," +
- "<a href=\"../pkg1/RegContaineeDoc.html\" " +
- "title=\"annotation in pkg1\">@RegContaineeDoc</a>}," +
- "<a href=\"../pkg1/RegContainerValNotDoc.html#y--\">y</a>=4)"},
- { "pkg1/C.html",
- "<a href=\"../pkg1/ContainerValNotDoc.html\" " +
- "title=\"annotation in pkg1\">@ContainerValNotDoc</a>" +
- "(<a href=\"../pkg1/ContainerValNotDoc.html#value--\">value</a>={" +
- "<a href=\"../pkg1/ContaineeNotDoc.html\" " +
- "title=\"annotation in pkg1\">@ContaineeNotDoc</a>," +
- "<a href=\"../pkg1/ContaineeNotDoc.html\" " +
- "title=\"annotation in pkg1\">@ContaineeNotDoc</a>}," +
- "<a href=\"../pkg1/ContainerValNotDoc.html#x--\">x</a>=2)"},
- { "pkg1/C.html",
- "<a href=\"../pkg1/ContainerSynthNotDoc.html\" " +
- "title=\"annotation in pkg1\">@ContainerSynthNotDoc</a>(" +
- "<a href=\"../pkg1/ContainerSynthNotDoc.html#value--\">value</a>=" +
- "<a href=\"../pkg1/ContaineeSynthDoc.html\" " +
- "title=\"annotation in pkg1\">@ContaineeSynthDoc</a>)"}
- };
+ checkOutput("pkg/C.html", false,
+ "<a href=\"../pkg/RegContaineeDoc.html\" "
+ + "title=\"annotation in pkg\">@RegContaineeDoc</a> "
+ + "<a href=\"../pkg/RegContaineeDoc.html\" "
+ + "title=\"annotation in pkg\">@RegContaineeDoc</a>",
+ "<a href=\"../pkg/RegContainerNotDoc.html\" "
+ + "title=\"annotation in pkg\">@RegContainerNotDoc</a>"
+ + "(<a href=\"../pkg/RegContainerNotDoc.html#value--\">value</a>={"
+ + "<a href=\"../pkg/RegContaineeNotDoc.html\" "
+ + "title=\"annotation in pkg\">@RegContaineeNotDoc</a>,"
+ + "<a href=\"../pkg/RegContaineeNotDoc.html\" "
+ + "title=\"annotation in pkg\">@RegContaineeNotDoc</a>})");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestRepeatedAnnotations tester = new TestRepeatedAnnotations();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg1/C.html", false,
+ "<a href=\"../pkg1/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg1\">@ContaineeSynthDoc</a> "
+ + "<a href=\"../pkg1/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg1\">@ContaineeSynthDoc</a>",
+ "<a href=\"../pkg1/RegContainerValNotDoc.html\" "
+ + "title=\"annotation in pkg1\">@RegContainerValNotDoc</a>"
+ + "(<a href=\"../pkg1/RegContainerValNotDoc.html#value--\">value</a>={"
+ + "<a href=\"../pkg1/RegContaineeDoc.html\" "
+ + "title=\"annotation in pkg1\">@RegContaineeDoc</a>,"
+ + "<a href=\"../pkg1/RegContaineeDoc.html\" "
+ + "title=\"annotation in pkg1\">@RegContaineeDoc</a>},"
+ + "<a href=\"../pkg1/RegContainerValNotDoc.html#y--\">y</a>=4)",
+ "<a href=\"../pkg1/ContainerValNotDoc.html\" "
+ + "title=\"annotation in pkg1\">@ContainerValNotDoc</a>"
+ + "(<a href=\"../pkg1/ContainerValNotDoc.html#value--\">value</a>={"
+ + "<a href=\"../pkg1/ContaineeNotDoc.html\" "
+ + "title=\"annotation in pkg1\">@ContaineeNotDoc</a>,"
+ + "<a href=\"../pkg1/ContaineeNotDoc.html\" "
+ + "title=\"annotation in pkg1\">@ContaineeNotDoc</a>},"
+ + "<a href=\"../pkg1/ContainerValNotDoc.html#x--\">x</a>=2)",
+ "<a href=\"../pkg1/ContainerSynthNotDoc.html\" "
+ + "title=\"annotation in pkg1\">@ContainerSynthNotDoc</a>("
+ + "<a href=\"../pkg1/ContainerSynthNotDoc.html#value--\">value</a>="
+ + "<a href=\"../pkg1/ContaineeSynthDoc.html\" "
+ + "title=\"annotation in pkg1\">@ContaineeSynthDoc</a>)");
}
}
--- a/langtools/test/com/sun/javadoc/testReturnTag/TestReturnTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testReturnTag/TestReturnTag.java Fri May 23 09:05:24 2014 -0700
@@ -26,26 +26,13 @@
* @bug 4490068
* @summary Warn when a return tag is used on a method without a return type.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestReturnTag
* @run main TestReturnTag
*/
public class TestReturnTag extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, SRC_DIR +
- "/TestReturnTag.java"
- };
-
- //Input for string search tests.
- private static final String[][] TEST = {
- {WARNING_OUTPUT,
- "warning - @return tag cannot be used in method with void return type."}
- };
-
/**
* Trigger warning message when return tag is used on a void method.
*
@@ -53,13 +40,20 @@
*/
public void method() {}
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestReturnTag tester = new TestReturnTag();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void tests() {
+ javadoc("-Xdoclint:none",
+ "-d", "out",
+ "-sourcepath", testSrc,
+ testSrc("TestReturnTag.java"));
+ checkExit(Exit.OK);
+
+ checkOutput(Output.WARNING, true,
+ "warning - @return tag cannot be used in method with void return type.");
}
}
--- a/langtools/test/com/sun/javadoc/testSeeTag/TestSeeTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSeeTag/TestSeeTag.java Fri May 23 09:05:24 2014 -0700
@@ -26,37 +26,29 @@
* @bug 8017191
* @summary Javadoc is confused by at-link to imported classes outside of the set of generated packages
* @author jjg
- * @library ../lib/
- * @build JavadocTester TestSeeTag
+ * @library ../lib
+ * @build JavadocTester
* @run main TestSeeTag
*/
public class TestSeeTag extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestSeeTag tester = new TestSeeTag();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/Test.html",
- "<code>List</code>"
- }
- };
- private static final String[][] NEGATED_TEST = {
- { "pkg/Test.html",
- "<code>List</code>"
- }
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestSeeTag tester = new TestSeeTag();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg/Test.html", true,
+ "<code>List</code>");
+
+ checkOutput("pkg/Test.html", false,
+ "<code>List</code>");
}
}
--- a/langtools/test/com/sun/javadoc/testSerialVersionUID/TestSerialVersionUID.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSerialVersionUID/TestSerialVersionUID.java Fri May 23 09:05:24 2014 -0700
@@ -27,32 +27,25 @@
* @summary Test to make sure that the serialVersionUID is properly
* documented in the serialized form.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestSerialVersionUID
* @run main TestSerialVersionUID
*/
public class TestSerialVersionUID extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR,
- SRC_DIR + "/C.java"
- };
+ public static void main(String... args) throws Exception {
+ TestSerialVersionUID tester = new TestSerialVersionUID();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "serialized-form.html", "-111111111111111L"}
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ testSrc("C.java"));
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestSerialVersionUID tester = new TestSerialVersionUID();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("serialized-form.html", true,
+ "-111111111111111L");
}
}
--- a/langtools/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java Fri May 23 09:05:24 2014 -0700
@@ -38,85 +38,76 @@
* @run main TestSerializedForm
*/
-import java.lang.*;
import java.io.*;
public class TestSerializedForm extends JavadocTester implements Serializable {
+ public static void main(String... args) throws Exception {
+ TestSerializedForm tester = new TestSerializedForm();
+ tester.runTests();
+// tester.run(ARGS, TEST, NEGATED_TEST);
+// tester.run(ARGS_PRIVATE, TEST_PRIVATE, NEGATED_TEST_PRIVATE);
+// tester.printSummary();
+ }
- private static final String[][] TEST = {
- { "serialized-form.html",
- "protected java.lang.Object readResolve()"},
- { "serialized-form.html",
- "protected java.lang.Object writeReplace()"},
- { "serialized-form.html",
- "protected java.lang.Object readObjectNoData()"},
- { "serialized-form.html",
- "See Also"},
- { "serialized-form.html",
- "<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass " +
- "extends java.lang.Object implements Serializable</h3>"},
- { "serialized-form.html",
- "<h3>Class pkg1.PrivateIncludeInnerClass.PriInnerClass extends " +
- "java.lang.Object implements Serializable</h3>"},
- { "serialized-form.html",
- "<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends " +
- "java.lang.Object implements Serializable</h3>"}
- };
+ @Test
+ void testDefault() {
+ javadoc("-d", "out-default",
+ "-sourcepath", testSrc,
+ testSrc("TestSerializedForm.java"), "pkg1");
+ checkExit(Exit.OK);
- private static final String[][] TEST_PRIVATE = {
- { "serialized-form.html",
- "<h3>Class <a href=\"pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html\" " +
- "title=\"class in pkg1\">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> " +
- "extends java.lang.Object implements Serializable</h3>"},
- { "serialized-form.html",
- "<h3>Class <a href=\"pkg1/PrivateIncludeInnerClass.PriInnerClass.html\" title=\"class in pkg1\">" +
- "pkg1.PrivateIncludeInnerClass.PriInnerClass</a> extends java.lang.Object implements Serializable</h3>"},
- { "serialized-form.html",
- "<h3>Class <a href=\"pkg1/ProtectedInnerClass.ProInnerClass.html\" title=\"class in pkg1\">" +
- "pkg1.ProtectedInnerClass.ProInnerClass</a> extends java.lang.Object implements Serializable</h3>"}
- };
+ checkOutput("serialized-form.html", true,
+ "protected java.lang.Object readResolve()",
+ "protected java.lang.Object writeReplace()",
+ "protected java.lang.Object readObjectNoData()",
+ "See Also",
+ "<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass "
+ + "extends java.lang.Object implements Serializable</h3>",
+ "<h3>Class pkg1.PrivateIncludeInnerClass.PriInnerClass extends "
+ + "java.lang.Object implements Serializable</h3>",
+ "<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends "
+ + "java.lang.Object implements Serializable</h3>");
- private static final String[][] NEGATED_TEST = {
- { "serialized-form.html",
- "<h3>Class <a href=\"pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html\" " +
- "title=\"class in pkg1\">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> " +
- "extends java.lang.Object implements Serializable</h3>"},
- { "serialized-form.html",
- "<h3>Class <a href=\"pkg1/PrivateInnerClass.PriInnerClass.html\" title=\"class in pkg1\">" +
- "pkg1.PrivateInnerClass.PriInnerClass</a> extends java.lang.Object implements Serializable</h3>"},
- { "serialized-form.html",
- "<h3>Class <a href=\"pkg1/ProtectedInnerClass.ProInnerClass.html\" title=\"class in pkg1\">" +
- "pkg1.ProtectedInnerClass.ProInnerClass</a> extends java.lang.Object implements Serializable</h3>"},
- { "serialized-form.html",
- "<h3>Class pkg1.PublicExcludeInnerClass.PubInnerClass extends java.lang.Object implements " +
- "Serializable</h3>"}
- };
+ checkOutput("serialized-form.html", false,
+ "<h3>Class <a href=\"pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html\" "
+ + "title=\"class in pkg1\">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> "
+ + "extends java.lang.Object implements Serializable</h3>",
+ "<h3>Class <a href=\"pkg1/PrivateInnerClass.PriInnerClass.html\" title=\"class in pkg1\">"
+ + "pkg1.PrivateInnerClass.PriInnerClass</a> extends java.lang.Object implements Serializable</h3>",
+ "<h3>Class <a href=\"pkg1/ProtectedInnerClass.ProInnerClass.html\" title=\"class in pkg1\">"
+ + "pkg1.ProtectedInnerClass.ProInnerClass</a> extends java.lang.Object implements Serializable</h3>",
+ "<h3>Class pkg1.PublicExcludeInnerClass.PubInnerClass extends java.lang.Object implements "
+ + "Serializable</h3>");
+ }
+
+ @Test
+ void testPrivate() {
+ javadoc("-private",
+ "-d", "out-private",
+ "-sourcepath", testSrc,
+ testSrc("TestSerializedForm.java"), "pkg1");
+ checkExit(Exit.OK);
- private static final String[][] NEGATED_TEST_PRIVATE = {
- { "serialized-form.html",
- "<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass " +
- "extends java.lang.Object implements Serializable</h3>"},
- { "serialized-form.html",
- "<h3>Class pkg1.PrivateInnerClass.PriInnerClass extends " +
- "java.lang.Object implements Serializable</h3>"},
- { "serialized-form.html",
- "<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends " +
- "java.lang.Object implements Serializable</h3>"},
- { "serialized-form.html",
- "<h3>Class <a href=\"pkg1/PublicExcludeInnerClass.PubInnerClass.html\" " +
- "title=\"class in pkg1\">pkg1.PublicExcludeInnerClass.PubInnerClass</a> " +
- "extends java.lang.Object implements Serializable</h3>"}
- };
+ checkOutput("serialized-form.html", true,
+ "<h3>Class <a href=\"pkg1/NestedInnerClass.InnerClass.ProNestedInnerClass.html\" "
+ + "title=\"class in pkg1\">pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass</a> "
+ + "extends java.lang.Object implements Serializable</h3>",
+ "<h3>Class <a href=\"pkg1/PrivateIncludeInnerClass.PriInnerClass.html\" title=\"class in pkg1\">"
+ + "pkg1.PrivateIncludeInnerClass.PriInnerClass</a> extends java.lang.Object implements Serializable</h3>",
+ "<h3>Class <a href=\"pkg1/ProtectedInnerClass.ProInnerClass.html\" title=\"class in pkg1\">"
+ + "pkg1.ProtectedInnerClass.ProInnerClass</a> extends java.lang.Object implements Serializable</h3>");
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- SRC_DIR + "/TestSerializedForm.java", "pkg1"
- };
-
- private static final String[] ARGS_PRIVATE = new String[] {
- "-private", "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR,
- SRC_DIR + "/TestSerializedForm.java", "pkg1"
- };
+ checkOutput("serialized-form.html", false,
+ "<h3>Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass "
+ + "extends java.lang.Object implements Serializable</h3>",
+ "<h3>Class pkg1.PrivateInnerClass.PriInnerClass extends "
+ + "java.lang.Object implements Serializable</h3>",
+ "<h3>Class pkg1.ProtectedInnerClass.ProInnerClass extends "
+ + "java.lang.Object implements Serializable</h3>",
+ "<h3>Class <a href=\"pkg1/PublicExcludeInnerClass.PubInnerClass.html\" "
+ + "title=\"class in pkg1\">pkg1.PublicExcludeInnerClass.PubInnerClass</a> "
+ + "extends java.lang.Object implements Serializable</h3>");
+ }
/**
* @serial
@@ -128,12 +119,6 @@
* The entry point of the test.
* @param args the array of command line arguments.
*/
- public static void main(String[] args) {
- TestSerializedForm tester = new TestSerializedForm();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.run(ARGS_PRIVATE, TEST_PRIVATE, NEGATED_TEST_PRIVATE);
- tester.printSummary();
- }
/**
* @param s ObjectInputStream.
--- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Fri May 23 09:05:24 2014 -0700
@@ -28,118 +28,142 @@
* @bug 6802694 8025633 8026567
* @summary This test verifies deprecation info in serialized-form.html.
* @author Bhavesh Patel
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestSerializedFormDeprecationInfo
* @run main TestSerializedFormDeprecationInfo
*/
public class TestSerializedFormDeprecationInfo extends JavadocTester {
+ public static void main(String... args) throws Exception {
+ TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
+ tester.runTests();
+ }
+
+ @Test
+ void testDefault() {
+ javadoc("-d", "out-default",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.FAILED); // TODO: should be OK
+
+ checkCommentDeprecated(true);
+ checkNoComment(false);
+ }
+
+ @Test
+ void testNoComment() {
+ javadoc("-d", "out-nocmnt",
+ "-nocomment",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.FAILED); // TODO: should be OK
+
+ checkNoComment(true);
+ checkCommentDeprecated(false);
+ }
+
+ @Test
+ void testNoDeprecated() {
+ javadoc("-d", "out-nodepr",
+ "-nodeprecated",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.FAILED); // TODO: should be OK
+
+ checkNoDeprecated(true);
+ checkNoCommentNoDeprecated(false);
+ }
+
+ @Test
+ void testNoCommentNoDeprecated() {
+ javadoc("-d", "out-nocmnt-nodepr",
+ "-nocomment",
+ "-nodeprecated",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.FAILED); // TODO: should be OK
+ checkNoCommentNoDeprecated(true);
+ checkNoDeprecated(false);
+ }
+
// Test for normal run of javadoc. The serialized-form.html should
// display the inline comments, tags and deprecation information if any.
- private static final String[][] TEST_CMNT_DEPR = {
- { "serialized-form.html", "<dl>\n" +
- "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
- "<dd><code>" +
- "java.io.IOException</code></dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span>" +
- "</dt>\n" +
- "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<span class=\"deprecatedLabel\">Deprecated.</span>" +
- " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
- " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
- "<div class=\"block\">This field indicates whether the C1 " +
- "is undecorated.</div>\n" +
- " \n" +
- "<dl>\n" +
- "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
- "<dd>1.4</dd>\n" +
- "<dt><span class=\"seeLabel\">See Also:</span>" +
- "</dt>\n" +
- "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<span class=\"deprecatedLabel\">Deprecated.</span>" +
- " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
- " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
- "<div class=\"block\">Reads the object stream.</div>\n" +
- "<dl>\n" +
- "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
- "<dd><code><code>" +
- "IOException</code></code></dd>\n" +
- "<dd><code>java.io.IOException</code></dd>\n" +
- "</dl>"},
- { "serialized-form.html",
- "<span class=\"deprecatedLabel\">Deprecated.</span>" +
- " </div>\n" +
- "<div class=\"block\">" +
- "The name for this class.</div>"}};
+ void checkCommentDeprecated(boolean expectFound) {
+ checkOutput("serialized-form.html", expectFound,
+ "<dl>\n"
+ + "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
+ + "<dd><code>"
+ + "java.io.IOException</code></dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span>"
+ + "</dt>\n"
+ + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ + "</dl>",
+ "<span class=\"deprecatedLabel\">Deprecated.</span>"
+ + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<div class=\"block\">This field indicates whether the C1 "
+ + "is undecorated.</div>\n"
+ + " \n"
+ + "<dl>\n"
+ + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>1.4</dd>\n"
+ + "<dt><span class=\"seeLabel\">See Also:</span>"
+ + "</dt>\n"
+ + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ + "</dl>",
+ "<span class=\"deprecatedLabel\">Deprecated.</span>"
+ + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "<div class=\"block\">Reads the object stream.</div>\n"
+ + "<dl>\n"
+ + "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
+ + "<dd><code><code>"
+ + "IOException</code></code></dd>\n"
+ + "<dd><code>java.io.IOException</code></dd>\n"
+ + "</dl>",
+ "<span class=\"deprecatedLabel\">Deprecated.</span>"
+ + " </div>\n"
+ + "<div class=\"block\">"
+ + "The name for this class.</div>");
+ }
// Test with -nocomment option. The serialized-form.html should
// not display the inline comments and tags but should display deprecation
// information if any.
- private static final String[][] TEST_NOCMNT = {
- { "serialized-form.html",
- "<pre>boolean undecorated</pre>\n" +
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">" +
- "As of JDK version 1.5, replaced by\n" +
- " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
- "setUndecorated(boolean)</code></a>.</span></div>\n" +
- "</li>"},
- { "serialized-form.html",
- "<span class=\"deprecatedLabel\">" +
- "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version" +
- " 1.5, replaced by\n" +
- " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
- "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
- "</li>"}};
+ void checkNoComment(boolean expectFound) {
+ checkOutput("serialized-form.html", expectFound,
+ "<pre>boolean undecorated</pre>\n"
+ + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">"
+ + "As of JDK version 1.5, replaced by\n"
+ + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>"
+ + "setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "</li>",
+ "<span class=\"deprecatedLabel\">"
+ + "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version"
+ + " 1.5, replaced by\n"
+ + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ + "</li>");
+ }
// Test with -nodeprecated option. The serialized-form.html should
// ignore the -nodeprecated tag and display the deprecation info. This
// test is similar to the normal run of javadoc in which inline comment, tags
// and deprecation information will be displayed.
- private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR;
+ void checkNoDeprecated(boolean expectFound) {
+ checkCommentDeprecated(expectFound);
+ }
// Test with -nodeprecated and -nocomment options. The serialized-form.html should
// ignore the -nodeprecated tag and display the deprecation info but should not
// display the inline comments and tags. This test is similar to the test with
// -nocomment option.
- private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT;
-
- private static final String[] ARGS1 =
- new String[] {
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
-
- private static final String[] ARGS2 =
- new String[] {
- "-d", OUTPUT_DIR + "-2", "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
-
- private static final String[] ARGS3 =
- new String[] {
- "-d", OUTPUT_DIR + "-3", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
-
- private static final String[] ARGS4 =
- new String[] {
- "-d", OUTPUT_DIR + "-4", "-nocomment", "-nodeprecated", "-sourcepath",
- SRC_DIR, "pkg1"};
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
- tester.run(ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT);
- tester.run(ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
- tester.run(ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
- tester.run(ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR);
- tester.printSummary();
+ void checkNoCommentNoDeprecated(boolean expectFound) {
+ checkNoComment(expectFound);
}
}
--- a/langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java Fri May 23 09:05:24 2014 -0700
@@ -24,47 +24,38 @@
/*
* @test
* @bug 4695326 4750173 4920381 8026567
- * @summary Test the declarartion of simple tags using -tag. Verify that
+ * @summary Test the declaration of simple tags using -tag. Verify that
* "-tag name" is a shortcut for "-tag name:a:Name:". Also verity that
* you can escape the ":" character with a back slash so that it is not
* considered a separator when parsing the simple tag argument.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestSimpleTag
* @run main TestSimpleTag
*/
public class TestSimpleTag extends JavadocTester {
- private static final String[][] TEST =
- new String[][] {
- { "C.html",
- "<span class=\"simpleTagLabel\">Todo:</span>"},
- { "C.html",
- "<span class=\"simpleTagLabel\">EJB Beans:</span>"},
- { "C.html",
- "<span class=\"simpleTagLabel\">Regular Tag:</span>"},
- { "C.html",
- "<span class=\"simpleTagLabel\">Back-Slash-Tag:</span>"},
- };
+ public static void main(String... args) throws Exception {
+ TestSimpleTag tester = new TestSimpleTag();
+ tester.runTests();
+ }
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-tag", "todo",
- "-tag", "ejb\\:bean:a:EJB Beans:",
- "-tag", "regular:a:Regular Tag:",
- "-tag", "back-slash\\:tag\\\\:a:Back-Slash-Tag:",
- SRC_DIR + "/C.java"
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-tag", "todo",
+ "-tag", "ejb\\:bean:a:EJB Beans:",
+ "-tag", "regular:a:Regular Tag:",
+ "-tag", "back-slash\\:tag\\\\:a:Back-Slash-Tag:",
+ testSrc("C.java"));
+ checkExit(Exit.FAILED); // TODO: investigate why failed
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestSimpleTag tester = new TestSimpleTag();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("C.html", true,
+ "<span class=\"simpleTagLabel\">Todo:</span>",
+ "<span class=\"simpleTagLabel\">EJB Beans:</span>",
+ "<span class=\"simpleTagLabel\">Regular Tag:</span>",
+ "<span class=\"simpleTagLabel\">Back-Slash-Tag:</span>");
}
}
--- a/langtools/test/com/sun/javadoc/testSimpleTagExclude/TestSimpleTagExclude.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSimpleTagExclude/TestSimpleTagExclude.java Fri May 23 09:05:24 2014 -0700
@@ -27,31 +27,27 @@
* @summary Test the parsing of the -tag option. The user should be able to
* exclude a simple tag by using -tag tagname:X
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestSimpleTagExclude
* @run main TestSimpleTagExclude
*/
public class TestSimpleTagExclude extends JavadocTester {
- private static final String[][] NEGATED_TEST = {
- { "DummyClass.html", "todo"}
- };
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-tag", "todo:X",
- SRC_DIR + "/DummyClass.java"
- };
+ public static void main(String... args) throws Exception {
+ TestSimpleTagExclude tester = new TestSimpleTagExclude();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestSimpleTagExclude tester = new TestSimpleTagExclude();
- if (tester.run(ARGS, NO_TEST, NEGATED_TEST) != 0) {
- throw new Error("Javadoc failed to execute.");
- }
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-tag", "todo:X",
+ testSrc("DummyClass.java"));
+ checkExit(Exit.OK);
+
+ checkOutput("DummyClass.html", false,
+ "todo");
}
}
--- a/langtools/test/com/sun/javadoc/testSimpleTagInherit/TestSimpleTagInherit.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSimpleTagInherit/TestSimpleTagInherit.java Fri May 23 09:05:24 2014 -0700
@@ -25,8 +25,8 @@
* @test
* @bug 8008768 8026567
* @summary Using {@inheritDoc} in simple tag defined via -tag fails
- * @library ../lib/
- * @build JavadocTester TestSimpleTagInherit
+ * @library ../lib
+ * @build JavadocTester
* @run main TestSimpleTagInherit
*/
@@ -34,28 +34,31 @@
//Javadoc arguments.
private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-tag", "custom:optcm:<em>Custom:</em>",
- "p"
+
};
//Input for string search tests.
private static final String[][] TEST = {
- { "p/TestClass.html",
- "<dt><span class=\"simpleTagLabel\"><em>Custom:</em></span></dt>\n" +
- "<dd>doc for BaseClass class</dd>" },
- { "p/TestClass.html",
- "<dt><span class=\"simpleTagLabel\"><em>Custom:</em></span></dt>\n" +
- "<dd>doc for BaseClass method</dd>" }
+ { }
};
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestSimpleTagInherit tester = new TestSimpleTagInherit();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-tag", "custom:optcm:<em>Custom:</em>",
+ "p");
+ checkExit(Exit.OK);
+
+ checkOutput("p/TestClass.html", true,
+ "<dt><span class=\"simpleTagLabel\"><em>Custom:</em></span></dt>\n"
+ + "<dd>doc for BaseClass class</dd>",
+ "<dt><span class=\"simpleTagLabel\"><em>Custom:</em></span></dt>\n"
+ + "<dd>doc for BaseClass method</dd>");
}
}
--- a/langtools/test/com/sun/javadoc/testSinceTag/TestSinceTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSinceTag/TestSinceTag.java Fri May 23 09:05:24 2014 -0700
@@ -26,44 +26,49 @@
* @bug 7180906 8026567
* @summary Test to make sure that the since tag works correctly
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestSinceTag
+ * @library ../lib
+ * @build JavadocTester
* @run main TestSinceTag
*/
public class TestSinceTag extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS1 = new String[] {
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"
- };
-
- private static final String[] ARGS2 = new String[] {
- "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-nosince", "pkg1"
- };
-
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg1/C1.html",
- "<dl>\n" +
- "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
- "<dd>JDK1.0</dd>"
- },
- { "serialized-form.html",
- "<dl>\n" +
- "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
- "<dd>1.4</dd>"
- }
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestSinceTag tester = new TestSinceTag();
- tester.run(ARGS1, TEST, NO_TEST);
- tester.run(ARGS2, NO_TEST, TEST);
+ tester.runTests();
tester.printSummary();
}
+
+ @Test
+ void testSince() {
+ javadoc("-d", "out-since",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.FAILED); // TODO: investigate
+
+ checkSince(true);
+ }
+
+ @Test
+ void testNoSince() {
+ javadoc("-d", "out-nosince",
+ "-sourcepath", testSrc,
+ "-nosince",
+ "pkg1");
+ checkExit(Exit.FAILED); // TODO: investigate
+
+ checkSince(false);
+ }
+
+ void checkSince(boolean on) {
+ checkOutput("pkg1/C1.html", on,
+ "<dl>\n"
+ + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>JDK1.0</dd>");
+
+ checkOutput("serialized-form.html", on,
+ "<dl>\n"
+ + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>1.4</dd>");
+ }
}
--- a/langtools/test/com/sun/javadoc/testSingleQuotedLink/TestSingleQuotedLink.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSingleQuotedLink/TestSingleQuotedLink.java Fri May 23 09:05:24 2014 -0700
@@ -26,35 +26,32 @@
* @bug 6457406
* @summary Verify that a link in single quotes copied to the class-use page as is.
* @author Yuri Nesterenko
- * @library ../lib/
- * @build JavadocTester TestSingleQuotedLink
+ * @library ../lib
+ * @build JavadocTester
* @run main TestSingleQuotedLink
*/
public class TestSingleQuotedLink extends JavadocTester {
- // We are testing the redirection algorithm with a known scenario when a writer is not forced to ignore it: "-use".
- private static final String[][] TEST = {
- { "pkg1/class-use/C1.html",
- "<a href=\'http://download.oracle.com/javase/8/docs/technotes/guides/indexC2.html\'>"
- }
- };
- private static final String[][] NEGATED_TEST = {
- { "pkg1/class-use/C1.html",
- "pkg1/\'http://download.oracle.com/javase/8/docs/technotes/guides/indexC2.html\'>"
- }
- };
- private static final String[] ARGS =
- new String[]{
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1"
- };
+ public static void main(String... args) throws Exception {
+ TestSingleQuotedLink tester = new TestSingleQuotedLink();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestSingleQuotedLink tester = new TestSingleQuotedLink();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ @Test
+ void run() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-use",
+ "pkg1");
+ checkExit(Exit.OK);
+
+ // We are testing the redirection algorithm with a known scenario when a
+ // writer is not forced to ignore it: "-use".
+
+ checkOutput("pkg1/class-use/C1.html", true,
+ "<a href=\'http://download.oracle.com/javase/8/docs/technotes/guides/indexC2.html\'>");
+
+ checkOutput("pkg1/class-use/C1.html", false,
+ "pkg1/\'http://download.oracle.com/javase/8/docs/technotes/guides/indexC2.html\'>");
}
}
--- a/langtools/test/com/sun/javadoc/testSourceTab/TestSourceTab.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSourceTab/TestSourceTab.java Fri May 23 09:05:24 2014 -0700
@@ -27,9 +27,8 @@
* @summary Test to make sure that the source documentation is indented properly
* when -linksourcetab is used.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestSourceTab
* @run main TestSourceTab
*/
@@ -37,45 +36,39 @@
public class TestSourceTab extends JavadocTester {
- private static final String TMP_SRC_DIR = "tmpSrc";
- private static final String OUTPUT_DIR1 = OUTPUT_DIR + "-tabLengthEight";
- private static final String OUTPUT_DIR2 = OUTPUT_DIR + "-tabLengthFour";
-
- //Run Javadoc on a source file with that is indented with a single tab per line
- private static final String[] ARGS1 =
- new String[] {
- "-d", OUTPUT_DIR1, "-sourcepath", TMP_SRC_DIR,
- "-notimestamp", "-linksource", TMP_SRC_DIR + "/SingleTab/C.java"
- };
-
- //Run Javadoc on a source file with that is indented with a two tab per line
- //If we double the tabs and decrease the tab length by a half, the output should
- //be the same as the one generated above.
- private static final String[] ARGS2 =
- new String[] {
- "-d", OUTPUT_DIR2, "-sourcepath", TMP_SRC_DIR,
- "-notimestamp", "-sourcetab", "4", TMP_SRC_DIR + "/DoubleTab/C.java"
- };
-
- //Files to diff
- private static final String[] FILES_TO_DIFF = {
- "src-html/C.html",
- "C.html"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) throws IOException {
+ public static void main(String... args) throws Exception {
TestSourceTab tester = new TestSourceTab();
- tester.run(ARGS1, NO_TEST, NO_TEST);
- tester.run(ARGS2, NO_TEST, NO_TEST);
- tester.runDiffs(OUTPUT_DIR1, OUTPUT_DIR2, FILES_TO_DIFF);
+ tester.runTests();
}
- TestSourceTab() throws IOException {
- initTabs(new File(SRC_DIR), new File(TMP_SRC_DIR));
+ @Test
+ void test() throws Exception {
+ String tmpSrcDir = "tmpSrc";
+ String outdir1 = "out-tabLengthEight";
+ String outdir2 = "out-tabLengthFour";
+ initTabs(new File(testSrc), new File(tmpSrcDir));
+
+ // Run Javadoc on a source file with that is indented with a single tab per line
+ javadoc("-d", outdir1,
+ "-sourcepath", tmpSrcDir,
+ "-notimestamp",
+ "-linksource",
+ tmpSrcDir + "/SingleTab/C.java");
+ checkExit(Exit.OK);
+
+ // Run Javadoc on a source file with that is indented with a two tab per line
+ // If we double the tabs and decrease the tab length by a half, the output should
+ // be the same as the one generated above.
+ javadoc("-d", outdir2,
+ "-sourcepath", tmpSrcDir,
+ "-notimestamp",
+ "-sourcetab", "4",
+ tmpSrcDir + "/DoubleTab/C.java");
+ checkExit(Exit.OK);
+
+ diff(outdir1, outdir2,
+ "src-html/C.html",
+ "C.html");
}
void initTabs(File from, File to) throws IOException {
@@ -91,26 +84,20 @@
String read(File f) throws IOException {
StringBuilder sb = new StringBuilder();
- BufferedReader in = new BufferedReader(new FileReader(f));
- try {
+ try (BufferedReader in = new BufferedReader(new FileReader(f))) {
String line;
while ((line = in.readLine()) != null) {
sb.append(line);
- sb.append("\n");
+ sb.append(NL);
}
- } finally {
- in.close();
}
return sb.toString();
}
void write(File f, String s) throws IOException {
f.getParentFile().mkdirs();
- Writer out = new FileWriter(f);
- try {
+ try (Writer out = new FileWriter(f)) {
out.write(s);
- } finally {
- out.close();
}
}
}
--- a/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java Fri May 23 09:05:24 2014 -0700
@@ -26,132 +26,118 @@
* @bug 4494033 7028815 7052425 8007338 8023608 8008164 8016549
* @summary Run tests on doclet stylesheet.
* @author jamieh
- * @library ../lib/
- * @build JavadocTester TestStylesheet
+ * @library ../lib
+ * @build JavadocTester
* @run main TestStylesheet
*/
public class TestStylesheet extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestStylesheet tester = new TestStylesheet();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- //Input for string search tests.
- private static final String[][] TEST = {
- { "stylesheet.css",
- "/* Javadoc style sheet */"},
- { "stylesheet.css",
- "/*\n" +
- "Overall document style\n" +
- "*/"},
- { "stylesheet.css",
- "/*\n" +
- "Heading styles\n" +
- "*/"},
- { "stylesheet.css",
- "/*\n" +
- "Navigation bar styles\n" +
- "*/"},
- { "stylesheet.css",
- "body {\n" +
- " background-color:#ffffff;\n" +
- " color:#353833;\n" +
- " font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;\n" +
- " font-size:14px;\n" +
- " margin:0;\n" +
- "}"},
- { "stylesheet.css",
- "ul {\n" +
- " list-style-type:disc;\n" +
- "}"},
- { "stylesheet.css",
- ".overviewSummary caption, .memberSummary caption, .typeSummary caption,\n" +
- ".useSummary caption, .constantsSummary caption, .deprecatedSummary caption {\n" +
- " position:relative;\n" +
- " text-align:left;\n" +
- " background-repeat:no-repeat;\n" +
- " color:#253441;\n" +
- " font-weight:bold;\n" +
- " clear:none;\n" +
- " overflow:hidden;\n" +
- " padding:0px;\n" +
- " padding-top:10px;\n" +
- " padding-left:1px;\n" +
- " margin:0px;\n" +
- " white-space:pre;\n" +
- "}"},
- { "stylesheet.css",
- ".overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,\n" +
- ".useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {\n" +
- " white-space:nowrap;\n" +
- " padding-top:5px;\n" +
- " padding-left:12px;\n" +
- " padding-right:12px;\n" +
- " padding-bottom:7px;\n" +
- " display:inline-block;\n" +
- " float:left;\n" +
- " background-color:#F8981D;\n" +
- " border: none;\n" +
- " height:16px;\n" +
- "}"},
- { "stylesheet.css",
- ".memberSummary caption span.activeTableTab span {\n" +
- " white-space:nowrap;\n" +
- " padding-top:5px;\n" +
- " padding-left:12px;\n" +
- " padding-right:12px;\n" +
- " margin-right:3px;\n" +
- " display:inline-block;\n" +
- " float:left;\n" +
- " background-color:#F8981D;\n" +
- " height:16px;\n" +
- "}"},
- { "stylesheet.css",
- ".memberSummary caption span.tableTab span {\n" +
- " white-space:nowrap;\n" +
- " padding-top:5px;\n" +
- " padding-left:12px;\n" +
- " padding-right:12px;\n" +
- " margin-right:3px;\n" +
- " display:inline-block;\n" +
- " float:left;\n" +
- " background-color:#4D7A97;\n" +
- " height:16px;\n" +
- "}"},
- { "stylesheet.css",
- ".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {\n" +
- " padding-top:0px;\n" +
- " padding-left:0px;\n" +
- " padding-right:0px;\n" +
- " background-image:none;\n" +
- " float:none;\n" +
- " display:inline;\n" +
- "}"},
- { "stylesheet.css",
- "@import url('resources/fonts/dejavu.css');"},
+ // TODO: most of this test seems a bit silly, since javadoc is simply
+ // copying in the stylesheet from the source directory
+ checkOutput("stylesheet.css", true,
+ "/* Javadoc style sheet */",
+ "/*\n"
+ + "Overall document style\n"
+ + "*/",
+ "/*\n"
+ + "Heading styles\n"
+ + "*/",
+ "/*\n"
+ + "Navigation bar styles\n"
+ + "*/",
+ "body {\n"
+ + " background-color:#ffffff;\n"
+ + " color:#353833;\n"
+ + " font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;\n"
+ + " font-size:14px;\n"
+ + " margin:0;\n"
+ + "}",
+ "ul {\n"
+ + " list-style-type:disc;\n"
+ + "}",
+ ".overviewSummary caption, .memberSummary caption, .typeSummary caption,\n"
+ + ".useSummary caption, .constantsSummary caption, .deprecatedSummary caption {\n"
+ + " position:relative;\n"
+ + " text-align:left;\n"
+ + " background-repeat:no-repeat;\n"
+ + " color:#253441;\n"
+ + " font-weight:bold;\n"
+ + " clear:none;\n"
+ + " overflow:hidden;\n"
+ + " padding:0px;\n"
+ + " padding-top:10px;\n"
+ + " padding-left:1px;\n"
+ + " margin:0px;\n"
+ + " white-space:pre;\n"
+ + "}",
+ ".overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,\n"
+ + ".useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {\n"
+ + " white-space:nowrap;\n"
+ + " padding-top:5px;\n"
+ + " padding-left:12px;\n"
+ + " padding-right:12px;\n"
+ + " padding-bottom:7px;\n"
+ + " display:inline-block;\n"
+ + " float:left;\n"
+ + " background-color:#F8981D;\n"
+ + " border: none;\n"
+ + " height:16px;\n"
+ + "}",
+ ".memberSummary caption span.activeTableTab span {\n"
+ + " white-space:nowrap;\n"
+ + " padding-top:5px;\n"
+ + " padding-left:12px;\n"
+ + " padding-right:12px;\n"
+ + " margin-right:3px;\n"
+ + " display:inline-block;\n"
+ + " float:left;\n"
+ + " background-color:#F8981D;\n"
+ + " height:16px;\n"
+ + "}",
+ ".memberSummary caption span.tableTab span {\n"
+ + " white-space:nowrap;\n"
+ + " padding-top:5px;\n"
+ + " padding-left:12px;\n"
+ + " padding-right:12px;\n"
+ + " margin-right:3px;\n"
+ + " display:inline-block;\n"
+ + " float:left;\n"
+ + " background-color:#4D7A97;\n"
+ + " height:16px;\n"
+ + "}",
+ ".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {\n"
+ + " padding-top:0px;\n"
+ + " padding-left:0px;\n"
+ + " padding-right:0px;\n"
+ + " background-image:none;\n"
+ + " float:none;\n"
+ + " display:inline;\n"
+ + "}",
+ "@import url('resources/fonts/dejavu.css');");
+
// Test whether a link to the stylesheet file is inserted properly
// in the class documentation.
- { "pkg/A.html",
- "<link rel=\"stylesheet\" type=\"text/css\" " +
- "href=\"../stylesheet.css\" title=\"Style\">"}
- };
- private static final String[][] NEGATED_TEST = {
- { "stylesheet.css",
- "* {\n" +
- " margin:0;\n" +
- " padding:0;\n" +
- "}"}
- };
+ checkOutput("pkg/A.html", true,
+ "<link rel=\"stylesheet\" type=\"text/css\" "
+ + "href=\"../stylesheet.css\" title=\"Style\">");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestStylesheet tester = new TestStylesheet();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("stylesheet.css", false,
+ "* {\n"
+ + " margin:0;\n"
+ + " padding:0;\n"
+ + "}");
}
}
--- a/langtools/test/com/sun/javadoc/testSubTitle/TestSubTitle.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSubTitle/TestSubTitle.java Fri May 23 09:05:24 2014 -0700
@@ -26,44 +26,38 @@
* @bug 7010342
* @summary Test for correct sub title generation.
* @author Bhavesh Patel
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestSubTitle
* @run main TestSubTitle
*/
public class TestSubTitle extends JavadocTester {
- private static final String[][] TEST = {
- { "pkg/package-summary.html",
- "<div class=\"block\">This is the description of package pkg.</div>"
- },
- { "pkg/C.html",
- "<div class=\"subTitle\">pkg</div>"
- }
- };
- private static final String[][] NEG_TEST = {
- { "pkg/package-summary.html",
+ public static void main(String... args) throws Exception {
+ TestSubTitle tester = new TestSubTitle();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/package-summary.html", true,
+ "<div class=\"block\">This is the description of package pkg.</div>");
+
+ checkOutput("pkg/C.html", true,
+ "<div class=\"subTitle\">pkg</div>");
+
+ checkOutput("pkg/package-summary.html", false,
"<p class=\"subTitle\">\n" +
"<div class=\"block\">This is the " +
"description of package pkg.</div>\n" +
- "</p>"
- },
- { "pkg/C.html",
- "<p class=\"subTitle\">pkg</p>"
- }
- };
- private static final String[] ARGS = new String[]{
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ "</p>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestSubTitle tester = new TestSubTitle();
- tester.run(ARGS, TEST, NEG_TEST);
- tester.printSummary();
+ checkOutput("pkg/C.html", false,
+ "<p class=\"subTitle\">pkg</p>");
}
}
--- a/langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java Fri May 23 09:05:24 2014 -0700
@@ -28,31 +28,26 @@
* "Method Summary" heading should still show up since the class
* inherits methods.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestSummaryHeading
* @run main TestSummaryHeading
*/
public class TestSummaryHeading extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, SRC_DIR + "/C.java"
- };
+ public static void main(String... args) throws Exception {
+ TestSummaryHeading tester = new TestSummaryHeading();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "C.html", "<h3>Method Summary</h3>"}
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ testSrc("C.java"));
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestSummaryHeading tester = new TestSummaryHeading();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("C.html", true,
+ "<h3>Method Summary</h3>");
}
}
--- a/langtools/test/com/sun/javadoc/testSuperclassInSerialForm/TestSuperClassInSerialForm.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSuperclassInSerialForm/TestSuperClassInSerialForm.java Fri May 23 09:05:24 2014 -0700
@@ -27,30 +27,27 @@
* @summary Test to make sure link to superclass is generated for
* each class in serialized form page.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestSuperClassInSerialForm
* @run main TestSuperClassInSerialForm
*/
public class TestSuperClassInSerialForm extends JavadocTester {
- private static final String[][] TEST = {
- { "serialized-form.html",
- "<a href=\"pkg/SubClass.html\" title=\"class in pkg\">pkg.SubClass</a> extends <a href=\"pkg/SuperClass.html\" title=\"class in pkg\">SuperClass</a>"}
- };
-
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestSuperClassInSerialForm tester = new TestSuperClassInSerialForm();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestSuperClassInSerialForm tester = new TestSuperClassInSerialForm();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("serialized-form.html", true,
+ "<a href=\"pkg/SubClass.html\" title=\"class in pkg\">pkg.SubClass</a>"
+ + " extends <a href=\"pkg/SuperClass.html\" title=\"class in pkg\">SuperClass</a>");
}
}
--- a/langtools/test/com/sun/javadoc/testSupplementary/TestSupplementary.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSupplementary/TestSupplementary.java Fri May 23 09:05:24 2014 -0700
@@ -27,9 +27,8 @@
* @summary Test to make sure that "see" tag and "serialField" tag handle supplementary
* characters correctly. This test case needs to be run in en_US locale.
* @author Naoto Sato
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestSupplementary
* @run main TestSupplementary
*/
@@ -37,33 +36,33 @@
public class TestSupplementary extends JavadocTester {
- private static final String[][] TEST = {
- {WARNING_OUTPUT, "C.java:38: warning - Tag @see:illegal character: \"119040\" in \"C#method\ud834\udd00()"},
- {WARNING_OUTPUT, "C.java:44: warning - illegal character \ud801 in @serialField tag: field\ud801\ud801 int."},
- {WARNING_OUTPUT, "C.java:44: warning - illegal character \ud834\udd7b in @serialField tag: \ud834\udd7bfield int."},
- };
- private static final String[][] NEGATED_TEST = {
- {WARNING_OUTPUT, "C.java:14: warning - Tag @see:illegal character"},
- {WARNING_OUTPUT, "C.java:19: warning - Tag @see:illegal character"},
- {WARNING_OUTPUT, "C.java:24: warning - Tag @see:illegal character"},
- {WARNING_OUTPUT, "C.java:31: warning - illegal character"},
- };
- private static final String[] ARGS = new String[] {
- "-locale", "en_US", "-d", OUTPUT_DIR, SRC_DIR + "/C.java"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
Locale saveLocale = Locale.getDefault();
try {
TestSupplementary tester = new TestSupplementary();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ tester.runTests();
} finally {
Locale.setDefault(saveLocale);
}
}
+
+ @Test
+ void test() {
+ javadoc("-locale", "en_US",
+ "-d", "out",
+ testSrc("C.java"));
+ checkExit(Exit.FAILED);
+
+ checkOutput(Output.WARNING, true,
+ "C.java:38: warning - Tag @see:illegal character: \"119040\" in \"C#method\ud834\udd00()",
+ "C.java:44: warning - illegal character \ud801 in @serialField tag: field\ud801\ud801 int.",
+ "C.java:44: warning - illegal character \ud834\udd7b in @serialField tag: \ud834\udd7bfield int.");
+
+ // TODO: do we need to specify the file and line number in these messages?
+ checkOutput(Output.WARNING, false,
+ "C.java:14: warning - Tag @see:illegal character",
+ "C.java:19: warning - Tag @see:illegal character",
+ "C.java:24: warning - Tag @see:illegal character",
+ "C.java:31: warning - illegal character");
+ }
}
--- a/langtools/test/com/sun/javadoc/testTagHolderMethod/TestTagHolderMethod.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testTagHolderMethod/TestTagHolderMethod.java Fri May 23 09:05:24 2014 -0700
@@ -26,7 +26,7 @@
* @bug 4706525
* @summary Determine if the new Tag.holder() method works properly.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
* @build TestTagHolderMethod
* @run main TestTagHolderMethod
@@ -36,10 +36,6 @@
public class TestTagHolderMethod extends JavadocTester {
- public static final String[] ARGS = new String[] {
- "-docletpath", SRC_DIR, "-doclet", "TestTagHolderMethod", "-sourcepath",
- SRC_DIR, "pkg"};
-
/**
* Doclet entry point.
*/
@@ -55,14 +51,13 @@
}
private static void checkHolders(Doc[] holders) throws Exception {
- for (int i = 0; i < holders.length; i++) {
- Doc holder = holders[i];
+ for (Doc holder : holders) {
Tag[] tags = holder.tags();
- for (int j = 0; j < tags.length; j++) {
- if (! tags[j].holder().name().equals(holder.name())) {
+ for (Tag tag : tags) {
+ if (!tag.holder().name().equals(holder.name())) {
throw new Exception("The holder method does not return the correct Doc object.");
} else {
- System.out.println(tags[j].name() + " is held by " + holder.name());
+ System.out.println(tag.name() + " is held by " + holder.name());
}
}
}
@@ -71,9 +66,19 @@
/**
* The entry point of the test.
* @param args the array of command line arguments.
+ * @throws Exception if the test fails
*/
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
JavadocTester tester = new TestTagHolderMethod();
- tester.run(ARGS, new String[][]{}, new String[][]{});
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-docletpath", testSrc, // unlikely to be effective
+ "-doclet", "TestTagHolderMethod",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
}
}
--- a/langtools/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java Fri May 23 09:05:24 2014 -0700
@@ -26,46 +26,44 @@
* @bug 4496223 4496270 4618686 4720974 4812240 6253614 6253604
* @summary <DESC>
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestTagInheritence
* @run main TestTagInheritence
*/
+// TODO: Inheritence should be Inheritance! fix separately as noreg-trivial
public class TestTagInheritence extends JavadocTester {
- private static final String[] ARGS = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg",
- "firstSentence", "firstSentence2"
- };
+ public static void main(String... args) throws Exception {
+ TestTagInheritence tester = new TestTagInheritence();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- String[][] tests = new String[42][2];
+ @Test
+ void test() {
+ javadoc("-Xdoclint:none",
+ "-d", "out",
+ "-sourcepath", testSrc,
+ "pkg", "firstSentence", "firstSentence2");
+ checkExit(Exit.OK);
+
//Test bad inheritDoc tag warning.
- tests[0][0]= WARNING_OUTPUT;
- tests[0][1] = "warning - @inheritDoc used but testBadInheritDocTag() " +
- "does not override or implement any method.";
+ checkOutput(Output.WARNING, true,
+ "warning - @inheritDoc used but testBadInheritDocTag() "
+ + "does not override or implement any method.");
//Test valid usage of inheritDoc tag.
- for (int i = 1; i < tests.length-2; i++) {
- tests[i][0] = "pkg/TestTagInheritence.html";
- tests[i][1] = "Test " + i + " passes";
+ for (int i = 1; i < 40; i++) {
+ checkOutput("pkg/TestTagInheritence.html", true,
+ "Test " + i + " passes");
}
//First sentence test (6253614)
- tests[tests.length - 2][0] = "firstSentence/B.html";
- tests[tests.length - 2][1] = "<div class=\"block\">First sentence.</div>";
+ checkOutput("firstSentence/B.html", true,
+ "<div class=\"block\">First sentence.</div>");
//Another first sentence test (6253604)
- tests[tests.length - 1][0] = "firstSentence2/C.html";
- tests[tests.length - 1][1] = "<div class=\"block\">First sentence.</div>";
-
- TestTagInheritence tester = new TestTagInheritence();
- tester.run(ARGS, tests, NO_TEST);
- tester.printSummary();
+ checkOutput("firstSentence2/C.html", true,
+ "<div class=\"block\">First sentence.</div>");
}
}
--- a/langtools/test/com/sun/javadoc/testTagMisuse/TestTagMisuse.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testTagMisuse/TestTagMisuse.java Fri May 23 09:05:24 2014 -0700
@@ -25,31 +25,35 @@
* @test
* @summary Determine if proper warning messages are printed when know.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
* @build TestTagMisuse
* @run main TestTagMisuse
*/
public class TestTagMisuse extends JavadocTester {
- private static final String[][] TEST = {
- {WARNING_OUTPUT, "warning - Tag @param cannot be used in field documentation."},
- {WARNING_OUTPUT, "warning - Tag @throws cannot be used in field documentation."},
- {WARNING_OUTPUT, "warning - Tag @return cannot be used in constructor documentation."},
- {WARNING_OUTPUT, "warning - Tag @throws cannot be used in inline documentation."},
- };
- private static final String[] ARGS = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR, SRC_DIR + "/TestTagMisuse.java"
- };
-
/**
* The entry point of the test.
* @param args the array of command line arguments.
+ * @throws Exception if the test fails
*/
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestTagMisuse tester = new TestTagMisuse();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-Xdoclint:none",
+ "-d", "out",
+ testSrc("TestTagMisuse.java"));
+ checkExit(Exit.OK);
+
+ checkOutput(Output.WARNING, true,
+ "warning - Tag @param cannot be used in field documentation.",
+ "warning - Tag @throws cannot be used in field documentation.",
+ "warning - Tag @return cannot be used in constructor documentation.",
+ "warning - Tag @throws cannot be used in inline documentation.");
}
/**
--- a/langtools/test/com/sun/javadoc/testTagOutput/TestTagOutput.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testTagOutput/TestTagOutput.java Fri May 23 09:05:24 2014 -0700
@@ -28,36 +28,32 @@
* @bug 8026370 8026567
* @summary This test checks the generated tag output.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestTagOutput
+ * @library ../lib
+ * @build JavadocTester
* @run main TestTagOutput
*/
public class TestTagOutput extends JavadocTester {
- private static final String[][] TEST = {
- { "pkg1/DeprecatedTag.html",
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"},
- { "pkg1/DeprecatedTag.html",
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> " +
- "<span class=\"deprecationComment\">Do not use this.</span></div>"}};
-
- private static final String[][] NEGATED_TEST = {
- { "pkg1/DeprecatedTag.html",
- "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated." +
- "</span> <span class=\"deprecationComment\"></span></div>"}};
+ public static void main(String... args) throws Exception {
+ TestTagOutput tester = new TestTagOutput();
+ tester.runTests();
+ }
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"};
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestTagOutput tester = new TestTagOutput();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg1/DeprecatedTag.html", true,
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>",
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> " +
+ "<span class=\"deprecationComment\">Do not use this.</span></div>");
+
+ checkOutput("pkg1/DeprecatedTag.html", false,
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated." +
+ "</span> <span class=\"deprecationComment\"></span></div>");
}
}
--- a/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java Fri May 23 09:05:24 2014 -0700
@@ -29,49 +29,41 @@
* Run Javadoc on some sample source that uses {@inheritDoc}. Make
* sure that only the first sentence shows up in the summary table.
* @author jamieh
- * @library ../lib/
- * @build JavadocTester
- * @build TestTaglets
- * @build taglets.Foo
+ * @library ../lib
+ * @build JavadocTester taglets.Foo
* @run main TestTaglets
*/
public class TestTaglets extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS_4654308 = new String[] {
- "-d", "4654308", "-tagletpath", SRC_DIR, "-taglet", "taglets.Foo",
- "-sourcepath", SRC_DIR, SRC_DIR + "/C.java"
- };
+ public static void main(String... args) throws Exception {
+ TestTaglets tester = new TestTaglets();
+ tester.runTests();
+ }
- private static final String[] ARGS_4767038 = new String[] {
- "-d", "4767038", "-sourcepath", SRC_DIR, SRC_DIR + "/Parent.java",
- SRC_DIR + "/Child.java"
- };
-
- //Input for string search tests.
- private static final String[][] TEST_4654308 = new String[][] {
- { "C.html", "<span class=\"simpleTagLabel\">Foo:</span></dt>" +
- "<dd>my only method is <a href=\"C.html#method--\"><code>here" +
- "</code></a></dd></dl>"}
- };
+ @Test
+ void test_4654308() {
+ javadoc("-d", "out-4654308",
+ "-tagletpath", testSrc, // TODO: probably does no good
+ "-taglet", "taglets.Foo",
+ "-sourcepath", testSrc,
+ testSrc("C.java"));
+ checkExit(Exit.OK);
- private static final String[][] TEST_4767038 = new String[][] {
- { "Child.html",
- "This is the first sentence."}
- };
-
+ checkOutput("C.html", true,
+ "<span class=\"simpleTagLabel\">Foo:</span></dt>"
+ + "<dd>my only method is <a href=\"C.html#method--\"><code>here"
+ + "</code></a></dd></dl>");
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestTaglets tester = new TestTaglets();
- tester.run(ARGS_4654308, TEST_4654308, NO_TEST);
- tester.printSummary();
- tester = new TestTaglets();
- tester.run(ARGS_4767038, TEST_4767038, NO_TEST);
- tester.printSummary();
+ @Test
+ void test_4767038() {
+ javadoc("-d", "out-4767038",
+ "-sourcepath", testSrc,
+ testSrc("Parent.java"), testSrc("Child.java"));
+ checkExit(Exit.OK);
+
+ checkOutput("Child.html", true,
+ "This is the first sentence.");
}
}
--- a/langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java Fri May 23 09:05:24 2014 -0700
@@ -28,28 +28,25 @@
* not documented with a throws tag, we generate a link to it in the
* throws section. Make sure that the link is below a Throws heading.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestThrowsHead
* @run main TestThrowsHead
*/
public class TestThrowsHead extends JavadocTester {
- private static final String[][] TEST = {
- { "C.html", "<dt><span class=\"throwsLabel\">Throws:</span>"}
- };
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, SRC_DIR + "/C.java"
- };
+ public static void main(String... args) throws Exception {
+ TestThrowsHead tester = new TestThrowsHead();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestThrowsHead tester = new TestThrowsHead();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ testSrc("C.java"));
+ checkExit(Exit.OK);
+
+ checkOutput("C.html", true,
+ "<dt><span class=\"throwsLabel\">Throws:</span>");
}
}
--- a/langtools/test/com/sun/javadoc/testThrowsInheritence/TestThrowsTagInheritence.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testThrowsInheritence/TestThrowsTagInheritence.java Fri May 23 09:05:24 2014 -0700
@@ -28,36 +28,35 @@
* override the throws tags in interface. This test also verifies that throws tags are inherited properly
* the case where the name of one exception is not fully qualified.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestThrowsTagInheritence
* @run main TestThrowsTagInheritence
*/
+// TODO: should be TestThrowsInheritance!
public class TestThrowsTagInheritence extends JavadocTester {
- private static final String[][] TEST = {
- //The class should not inherit the tag from the interface.
- { "Foo.html", "Test 1 passes."}
- };
- private static final String[][] NEGATED_TEST = {
- //The class should not inherit the tag from the interface.
- { "C.html", "Test 1 fails."}
+ public static void main(String... args) throws Exception {
+ TestThrowsTagInheritence tester = new TestThrowsTagInheritence();
+ tester.runTests();
+ }
- };
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, SRC_DIR + "/C.java",
- SRC_DIR + "/I.java", SRC_DIR + "/Foo.java",
- SRC_DIR + "/Iface.java"
- };
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ testSrc("C.java"),
+ testSrc("I.java"),
+ testSrc("Foo.java"),
+ testSrc("Iface.java"));
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestThrowsTagInheritence tester = new TestThrowsTagInheritence();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ // The class should not inherit the tag from the interface.
+ checkOutput("Foo.html", true,
+ "Test 1 passes.");
+
+ //The class should not inherit the tag from the interface.
+ checkOutput("C.html", false,
+ "Test 1 fails.");
}
}
--- a/langtools/test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java Fri May 23 09:05:24 2014 -0700
@@ -27,22 +27,26 @@
* @summary Test to make sure that exceptions always show up in the
* correct order.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestThrowsTag
* @run main TestThrowsTag
*/
public class TestThrowsTag extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestThrowsTag tester = new TestThrowsTag();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/C.html",
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.FAILED); // TODO: investigate why failed
+
+ checkOutput("pkg/C.html", true,
"<dd><code><a href=\"../pkg/T1.html\" title=\"class in pkg\">T1</a></code> - the first throws tag.</dd>\n" +
"<dd><code><a href=\"../pkg/T2.html\" title=\"class in pkg\">T2</a></code> - the second throws tag.</dd>\n" +
"<dd><code><a href=\"../pkg/T3.html\" title=\"class in pkg\">T3</a></code> - the third throws tag.</dd>\n" +
@@ -51,16 +55,6 @@
"<dd><code><a href=\"../pkg/T6.html\" title=\"class in pkg\">T6</a></code> - the second inherited throws tag.</dd>\n" +
"<dd><code><a href=\"../pkg/T7.html\" title=\"class in pkg\">T7</a></code> - the third inherited throws tag.</dd>\n" +
"<dd><code><a href=\"../pkg/T8.html\" title=\"class in pkg\">T8</a></code> - the fourth inherited throws tag.</dd>"
- },
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestThrowsTag tester = new TestThrowsTag();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ );
}
}
--- a/langtools/test/com/sun/javadoc/testTitleInHref/TestTitleInHref.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testTitleInHref/TestTitleInHref.java Fri May 23 09:05:24 2014 -0700
@@ -26,42 +26,35 @@
* @bug 4714257
* @summary Test to make sure that the title attribute shows up in links.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestTitleInHref
* @run main TestTitleInHref
*/
public class TestTitleInHref extends JavadocTester {
- private static final String[][] TEST = {
- //Test to make sure that the title shows up in a class link.
- { "pkg/Links.html",
- "<a href=\"../pkg/Class.html\" title=\"class in pkg\">"},
-
- //Test to make sure that the title shows up in an interface link.
- { "pkg/Links.html",
- "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">"},
-
- //Test to make sure that the title shows up in cross link shows up
- { "pkg/Links.html",
- "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" title=\"class or interface in java.io\"><code>This is a cross link to class File</code></a>"},
-
- };
+ public static void main(String... args) throws Exception {
+ TestTitleInHref tester = new TestTitleInHref();
+ tester.runTests();
+ }
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api",
- SRC_DIR, "pkg"
- };
+ @Test
+ void test() {
+ String uri = "http://java.sun.com/j2se/1.4/docs/api";
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-linkoffline", uri, testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestTitleInHref tester = new TestTitleInHref();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/Links.html", true,
+ //Test to make sure that the title shows up in a class link.
+ "<a href=\"../pkg/Class.html\" title=\"class in pkg\">",
+ //Test to make sure that the title shows up in an interface link.
+ "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">",
+ //Test to make sure that the title shows up in cross link shows up
+ "<a href=\"" + uri + "/java/io/File.html?is-external=true\" "
+ + "title=\"class or interface in java.io\">"
+ + "<code>This is a cross link to class File</code></a>");
}
}
--- a/langtools/test/com/sun/javadoc/testTopOption/TestTopOption.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testTopOption/TestTopOption.java Fri May 23 09:05:24 2014 -0700
@@ -26,55 +26,44 @@
* @bug 6227616
* @summary Test the new -top option.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestTopOption
* @run main TestTopOption
*/
public class TestTopOption extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-overview", "SRC_DIR + '/' + overview.html", "-use", "-top",
- "TOP TEXT", "-d", OUTPUT_DIR, "-sourcepath",
- SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestTopOption tester = new TestTopOption();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/AnnotationType.html",
- "TOP TEXT"},
- { "pkg/class-use/AnnotationType.html",
- "TOP TEXT"},
-
- { "pkg/Cl.html",
- "TOP TEXT"},
- { "pkg/class-use/Cl.html",
- "TOP TEXT"},
+ @Test
+ void test() {
+ javadoc("-overview", testSrc("overview.html"),
+ "-use",
+ "-top", "TOP TEXT",
+ "-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
- { "pkg/package-summary.html",
- "TOP TEXT"},
- { "pkg/package-use.html",
- "TOP TEXT"},
+ checkTopText(
+ "pkg/AnnotationType.html",
+ "pkg/class-use/AnnotationType.html",
+ "pkg/Cl.html",
+ "pkg/class-use/Cl.html",
+ "pkg/package-summary.html",
+ "pkg/package-use.html",
+ "overview-summary.html",
+ "overview-tree.html",
+ "constant-values.html",
+ "help-doc.html");
+ }
- { "overview-summary.html",
- "TOP TEXT"},
- { "overview-tree.html",
- "TOP TEXT"},
- { "constant-values.html",
- "TOP TEXT"},
- { "help-doc.html",
- "TOP TEXT"},
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestTopOption tester = new TestTopOption();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ void checkTopText(String... files) {
+ for (String file : files) {
+ checkOutput(file, true, "TOP TEXT");
+ }
}
}
--- a/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Fri May 23 09:05:24 2014 -0700
@@ -26,360 +26,327 @@
* @bug 8005091 8009686 8025633 8026567
* @summary Make sure that type annotations are displayed correctly
* @author Bhavesh Patel
- * @library ../lib/
+ * @library ../lib
* @ignore
- * @build JavadocTester TestTypeAnnotations
+ * @build JavadocTester
* @run main TestTypeAnnotations
*/
public class TestTypeAnnotations extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-private", "typeannos"
- };
+ public static void main(String... args) throws Exception {
+ TestTypeAnnotations tester = new TestTypeAnnotations();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-private",
+ "typeannos");
+ checkExit(Exit.OK);
+
// Test for type annotations on Class Extends (ClassExtends.java).
- { "typeannos/MyClass.html",
- "extends <a href=\"../typeannos/ClassExtA.html\" title=\"annotation " +
- "in typeannos\">@ClassExtA</a> <a href=\"../typeannos/ParameterizedClass.html\" " +
- "title=\"class in typeannos\">ParameterizedClass</a><<a href=\"" +
- "../typeannos/ClassExtB.html\" title=\"annotation in typeannos\">" +
- "@ClassExtB</a> java.lang.String>"
- },
- { "typeannos/MyClass.html",
- "implements <a href=\"../typeannos/ClassExtB.html\" title=\"" +
- "annotation in typeannos\">@ClassExtB</a> java.lang.CharSequence, " +
- "<a href=\"../typeannos/ClassExtA.html\" title=\"annotation in " +
- "typeannos\">@ClassExtA</a> <a href=\"../typeannos/ParameterizedInterface.html\" " +
- "title=\"interface in typeannos\">ParameterizedInterface</a><" +
- "<a href=\"../typeannos/ClassExtB.html\" title=\"annotation in " +
- "typeannos\">@ClassExtB</a> java.lang.String></pre>"
- },
- { "typeannos/MyInterface.html",
- "extends <a href=\"../typeannos/ClassExtA.html\" title=\"annotation " +
- "in typeannos\">@ClassExtA</a> <a href=\"../typeannos/" +
- "ParameterizedInterface.html\" title=\"interface in typeannos\">" +
- "ParameterizedInterface</a><<a href=\"../typeannos/ClassExtA.html\" " +
- "title=\"annotation in typeannos\">@ClassExtA</a> java.lang.String>, " +
- "<a href=\"../typeannos/ClassExtB.html\" title=\"annotation in " +
- "typeannos\">@ClassExtB</a> java.lang.CharSequence</pre>"
- },
+ checkOutput("typeannos/MyClass.html", true,
+ "extends <a href=\"../typeannos/ClassExtA.html\" title=\"annotation "
+ + "in typeannos\">@ClassExtA</a> <a href=\"../typeannos/ParameterizedClass.html\" "
+ + "title=\"class in typeannos\">ParameterizedClass</a><<a href=\""
+ + "../typeannos/ClassExtB.html\" title=\"annotation in typeannos\">"
+ + "@ClassExtB</a> java.lang.String>",
+
+ "implements <a href=\"../typeannos/ClassExtB.html\" title=\""
+ + "annotation in typeannos\">@ClassExtB</a> java.lang.CharSequence, "
+ + "<a href=\"../typeannos/ClassExtA.html\" title=\"annotation in "
+ + "typeannos\">@ClassExtA</a> <a href=\"../typeannos/ParameterizedInterface.html\" "
+ + "title=\"interface in typeannos\">ParameterizedInterface</a><"
+ + "<a href=\"../typeannos/ClassExtB.html\" title=\"annotation in "
+ + "typeannos\">@ClassExtB</a> java.lang.String></pre>");
+
+ checkOutput("typeannos/MyInterface.html", true,
+ "extends <a href=\"../typeannos/ClassExtA.html\" title=\"annotation "
+ + "in typeannos\">@ClassExtA</a> <a href=\"../typeannos/"
+ + "ParameterizedInterface.html\" title=\"interface in typeannos\">"
+ + "ParameterizedInterface</a><<a href=\"../typeannos/ClassExtA.html\" "
+ + "title=\"annotation in typeannos\">@ClassExtA</a> java.lang.String>, "
+ + "<a href=\"../typeannos/ClassExtB.html\" title=\"annotation in "
+ + "typeannos\">@ClassExtB</a> java.lang.CharSequence</pre>");
// Test for type annotations on Class Parameters (ClassParameters.java).
- { "typeannos/ExtendsBound.html",
- "class <span class=\"typeNameLabel\">ExtendsBound<K extends <a " +
- "href=\"../typeannos/ClassParamA.html\" title=\"annotation in " +
- "typeannos\">@ClassParamA</a> java.lang.String></span>"
- },
- { "typeannos/ExtendsGeneric.html",
- "<pre>class <span class=\"typeNameLabel\">ExtendsGeneric<K extends " +
- "<a href=\"../typeannos/ClassParamA.html\" title=\"annotation in " +
- "typeannos\">@ClassParamA</a> <a href=\"../typeannos/Unannotated.html\" " +
- "title=\"class in typeannos\">Unannotated</a><<a href=\"" +
- "../typeannos/ClassParamB.html\" title=\"annotation in typeannos\">" +
- "@ClassParamB</a> java.lang.String>></span>"
- },
- { "typeannos/TwoBounds.html",
- "<pre>class <span class=\"typeNameLabel\">TwoBounds<K extends <a href=\"" +
- "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" +
- "@ClassParamA</a> java.lang.String,V extends <a href=\"../typeannos/" +
- "ClassParamB.html\" title=\"annotation in typeannos\">@ClassParamB" +
- "</a> java.lang.String></span>"
- },
- { "typeannos/Complex1.html",
- "class <span class=\"typeNameLabel\">Complex1<K extends <a href=\"../" +
- "typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" +
- "@ClassParamA</a> java.lang.String & java.lang.Runnable></span>"
- },
- { "typeannos/Complex2.html",
- "class <span class=\"typeNameLabel\">Complex2<K extends java.lang." +
- "String & <a href=\"../typeannos/ClassParamB.html\" title=\"" +
- "annotation in typeannos\">@ClassParamB</a> java.lang.Runnable></span>"
- },
- { "typeannos/ComplexBoth.html",
- "class <span class=\"typeNameLabel\">ComplexBoth<K extends <a href=\"" +
- "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\"" +
- ">@ClassParamA</a> java.lang.String & <a href=\"../typeannos/" +
- "ClassParamA.html\" title=\"annotation in typeannos\">@ClassParamA" +
- "</a> java.lang.Runnable></span>"
- },
+ checkOutput("typeannos/ExtendsBound.html", true,
+ "class <span class=\"typeNameLabel\">ExtendsBound<K extends <a "
+ + "href=\"../typeannos/ClassParamA.html\" title=\"annotation in "
+ + "typeannos\">@ClassParamA</a> java.lang.String></span>");
+
+ checkOutput("typeannos/ExtendsGeneric.html", true,
+ "<pre>class <span class=\"typeNameLabel\">ExtendsGeneric<K extends "
+ + "<a href=\"../typeannos/ClassParamA.html\" title=\"annotation in "
+ + "typeannos\">@ClassParamA</a> <a href=\"../typeannos/Unannotated.html\" "
+ + "title=\"class in typeannos\">Unannotated</a><<a href=\""
+ + "../typeannos/ClassParamB.html\" title=\"annotation in typeannos\">"
+ + "@ClassParamB</a> java.lang.String>></span>");
+
+ checkOutput("typeannos/TwoBounds.html", true,
+ "<pre>class <span class=\"typeNameLabel\">TwoBounds<K extends <a href=\""
+ + "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\">"
+ + "@ClassParamA</a> java.lang.String,V extends <a href=\"../typeannos/"
+ + "ClassParamB.html\" title=\"annotation in typeannos\">@ClassParamB"
+ + "</a> java.lang.String></span>");
+
+ checkOutput("typeannos/Complex1.html", true,
+ "class <span class=\"typeNameLabel\">Complex1<K extends <a href=\"../"
+ + "typeannos/ClassParamA.html\" title=\"annotation in typeannos\">"
+ + "@ClassParamA</a> java.lang.String & java.lang.Runnable></span>");
+
+ checkOutput("typeannos/Complex2.html", true,
+ "class <span class=\"typeNameLabel\">Complex2<K extends java.lang."
+ + "String & <a href=\"../typeannos/ClassParamB.html\" title=\""
+ + "annotation in typeannos\">@ClassParamB</a> java.lang.Runnable></span>");
+
+ checkOutput("typeannos/ComplexBoth.html", true,
+ "class <span class=\"typeNameLabel\">ComplexBoth<K extends <a href=\""
+ + "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\""
+ + ">@ClassParamA</a> java.lang.String & <a href=\"../typeannos/"
+ + "ClassParamA.html\" title=\"annotation in typeannos\">@ClassParamA"
+ + "</a> java.lang.Runnable></span>");
// Test for type annotations on fields (Fields.java).
- { "typeannos/DefaultScope.html",
- "<pre><a href=\"../typeannos/Parameterized.html\" title=\"class in " +
- "typeannos\">Parameterized</a><<a href=\"../typeannos/FldA.html\" " +
- "title=\"annotation in typeannos\">@FldA</a> java.lang.String,<a " +
- "href=\"../typeannos/FldB.html\" title=\"annotation in typeannos\">" +
- "@FldB</a> java.lang.String> bothTypeArgs</pre>"
- },
- { "typeannos/DefaultScope.html",
- "<pre><a href=\"../typeannos/FldA.html\" title=\"annotation in " +
- "typeannos\">@FldA</a> java.lang.String <a href=\"../typeannos/" +
- "FldB.html\" title=\"annotation in typeannos\">@FldB</a> [] " +
- "array1Deep</pre>"
- },
- { "typeannos/DefaultScope.html",
- "<pre>java.lang.String[] <a href=\"../typeannos/FldB.html\" " +
- "title=\"annotation in typeannos\">@FldB</a> [] array2SecondOld</pre>"
- },
- { "typeannos/DefaultScope.html",
- "<pre><a href=\"../typeannos/FldD.html\" title=\"annotation in " +
- "typeannos\">@FldD</a> java.lang.String <a href=\"../typeannos/" +
- "FldC.html\" title=\"annotation in typeannos\">@FldC</a> <a href=\"" +
- "../typeannos/FldA.html\" title=\"annotation in typeannos\">@FldA" +
- "</a> [] <a href=\"../typeannos/FldC.html\" title=\"annotation in " +
- "typeannos\">@FldC</a> <a href=\"../typeannos/FldB.html\" title=\"" +
- "annotation in typeannos\">@FldB</a> [] array2Deep</pre>"
- },
- { "typeannos/ModifiedScoped.html",
- "<pre>public final <a href=\"../typeannos/Parameterized.html\" " +
- "title=\"class in typeannos\">Parameterized</a><<a href=\"../" +
- "typeannos/FldA.html\" title=\"annotation in typeannos\">@FldA</a> " +
- "<a href=\"../typeannos/Parameterized.html\" title=\"class in " +
- "typeannos\">Parameterized</a><<a href=\"../typeannos/FldA.html\" " +
- "title=\"annotation in typeannos\">@FldA</a> java.lang.String,<a " +
- "href=\"../typeannos/FldB.html\" title=\"annotation in typeannos\">" +
- "@FldB</a> java.lang.String>,<a href=\"../typeannos/FldB.html\" " +
- "title=\"annotation in typeannos\">@FldB</a> java.lang.String> " +
- "nestedParameterized</pre>"
- },
- { "typeannos/ModifiedScoped.html",
- "<pre>public final <a href=\"../typeannos/FldA.html\" " +
- "title=\"annotation in typeannos\">@FldA</a> java.lang.String[][] " +
- "array2</pre>"
- },
+ checkOutput("typeannos/DefaultScope.html", true,
+ "<pre><a href=\"../typeannos/Parameterized.html\" title=\"class in "
+ + "typeannos\">Parameterized</a><<a href=\"../typeannos/FldA.html\" "
+ + "title=\"annotation in typeannos\">@FldA</a> java.lang.String,<a "
+ + "href=\"../typeannos/FldB.html\" title=\"annotation in typeannos\">"
+ + "@FldB</a> java.lang.String> bothTypeArgs</pre>",
+
+ "<pre><a href=\"../typeannos/FldA.html\" title=\"annotation in "
+ + "typeannos\">@FldA</a> java.lang.String <a href=\"../typeannos/"
+ + "FldB.html\" title=\"annotation in typeannos\">@FldB</a> [] "
+ + "array1Deep</pre>",
+
+ "<pre>java.lang.String[] <a href=\"../typeannos/FldB.html\" "
+ + "title=\"annotation in typeannos\">@FldB</a> [] array2SecondOld</pre>",
+
+ "<pre><a href=\"../typeannos/FldD.html\" title=\"annotation in "
+ + "typeannos\">@FldD</a> java.lang.String <a href=\"../typeannos/"
+ + "FldC.html\" title=\"annotation in typeannos\">@FldC</a> <a href=\""
+ + "../typeannos/FldA.html\" title=\"annotation in typeannos\">@FldA"
+ + "</a> [] <a href=\"../typeannos/FldC.html\" title=\"annotation in "
+ + "typeannos\">@FldC</a> <a href=\"../typeannos/FldB.html\" title=\""
+ + "annotation in typeannos\">@FldB</a> [] array2Deep</pre>");
+
+ checkOutput("typeannos/ModifiedScoped.html", true,
+ "<pre>public final <a href=\"../typeannos/Parameterized.html\" "
+ + "title=\"class in typeannos\">Parameterized</a><<a href=\"../"
+ + "typeannos/FldA.html\" title=\"annotation in typeannos\">@FldA</a> "
+ + "<a href=\"../typeannos/Parameterized.html\" title=\"class in "
+ + "typeannos\">Parameterized</a><<a href=\"../typeannos/FldA.html\" "
+ + "title=\"annotation in typeannos\">@FldA</a> java.lang.String,<a "
+ + "href=\"../typeannos/FldB.html\" title=\"annotation in typeannos\">"
+ + "@FldB</a> java.lang.String>,<a href=\"../typeannos/FldB.html\" "
+ + "title=\"annotation in typeannos\">@FldB</a> java.lang.String> "
+ + "nestedParameterized</pre>",
+
+ "<pre>public final <a href=\"../typeannos/FldA.html\" "
+ + "title=\"annotation in typeannos\">@FldA</a> java.lang.String[][] "
+ + "array2</pre>");
// Test for type annotations on method return types (MethodReturnType.java).
- { "typeannos/MtdDefaultScope.html",
- "<pre>public <T> <a href=\"../typeannos/MRtnA.html\" " +
- "title=\"annotation in typeannos\">@MRtnA</a> java.lang.String" +
- " method()</pre>"
- },
- { "typeannos/MtdDefaultScope.html",
- "<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in " +
- "typeannos\">@MRtnA</a> java.lang.String <a href=\"../typeannos/" +
- "MRtnA.html\" title=\"annotation in typeannos\">@MRtnA</a> [] <a " +
- "href=\"../typeannos/MRtnB.html\" title=\"annotation in typeannos\">" +
- "@MRtnB</a> [] array2Deep()</pre>"
- },
- { "typeannos/MtdDefaultScope.html",
- "<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in " +
- "typeannos\">@MRtnA</a> java.lang.String[][] array2()</pre>"
- },
- { "typeannos/MtdModifiedScoped.html",
- "<pre>public final <a href=\"../typeannos/MtdParameterized.html\" " +
- "title=\"class in typeannos\">MtdParameterized</a><<a href=\"../" +
- "typeannos/MRtnA.html\" title=\"annotation in typeannos\">@MRtnA</a> " +
- "<a href=\"../typeannos/MtdParameterized.html\" title=\"class in " +
- "typeannos\">MtdParameterized</a><<a href=\"../typeannos/MRtnA." +
- "html\" title=\"annotation in typeannos\">@MRtnA</a> java.lang." +
- "String,<a href=\"../typeannos/MRtnB.html\" title=\"annotation in " +
- "typeannos\">@MRtnB</a> java.lang.String>,<a href=\"../typeannos/" +
- "MRtnB.html\" title=\"annotation in typeannos\">@MRtnB</a> java." +
- "lang.String> nestedMtdParameterized()</pre>"
- },
+ checkOutput("typeannos/MtdDefaultScope.html", true,
+ "<pre>public <T> <a href=\"../typeannos/MRtnA.html\" "
+ + "title=\"annotation in typeannos\">@MRtnA</a> java.lang.String"
+ + " method()</pre>",
+
+ "<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in "
+ + "typeannos\">@MRtnA</a> java.lang.String <a href=\"../typeannos/"
+ + "MRtnA.html\" title=\"annotation in typeannos\">@MRtnA</a> [] <a "
+ + "href=\"../typeannos/MRtnB.html\" title=\"annotation in typeannos\">"
+ + "@MRtnB</a> [] array2Deep()</pre>",
+
+ "<pre><a href=\"../typeannos/MRtnA.html\" title=\"annotation in "
+ + "typeannos\">@MRtnA</a> java.lang.String[][] array2()</pre>");
+
+ checkOutput("typeannos/MtdModifiedScoped.html", true,
+ "<pre>public final <a href=\"../typeannos/MtdParameterized.html\" "
+ + "title=\"class in typeannos\">MtdParameterized</a><<a href=\"../"
+ + "typeannos/MRtnA.html\" title=\"annotation in typeannos\">@MRtnA</a> "
+ + "<a href=\"../typeannos/MtdParameterized.html\" title=\"class in "
+ + "typeannos\">MtdParameterized</a><<a href=\"../typeannos/MRtnA."
+ + "html\" title=\"annotation in typeannos\">@MRtnA</a> java.lang."
+ + "String,<a href=\"../typeannos/MRtnB.html\" title=\"annotation in "
+ + "typeannos\">@MRtnB</a> java.lang.String>,<a href=\"../typeannos/"
+ + "MRtnB.html\" title=\"annotation in typeannos\">@MRtnB</a> java."
+ + "lang.String> nestedMtdParameterized()</pre>");
// Test for type annotations on method type parameters (MethodTypeParameters.java).
- { "typeannos/UnscopedUnmodified.html",
- "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\"" +
- "annotation in typeannos\">@MTyParamA</a> java.lang.String>" +
- " void methodExtends()</pre>"
- },
- { "typeannos/UnscopedUnmodified.html",
- "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\"" +
- "annotation in typeannos\">@MTyParamA</a> <a href=\"../typeannos/" +
- "MtdTyParameterized.html\" title=\"class in typeannos\">" +
- "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" " +
- "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String" +
- ">> void nestedExtends()</pre>"
- },
- { "typeannos/PublicModifiedMethods.html",
- "<pre>public final <K extends <a href=\"../typeannos/" +
- "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " +
- "java.lang.String> void methodExtends()</pre>"
- },
- { "typeannos/PublicModifiedMethods.html",
- "<pre>public final <K extends <a href=\"../typeannos/" +
- "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " +
- "java.lang.String,V extends <a href=\"../typeannos/MTyParamA.html\" " +
- "title=\"annotation in typeannos\">@MTyParamA</a> <a href=\"../" +
- "typeannos/MtdTyParameterized.html\" title=\"class in typeannos\">" +
- "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" " +
- "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String" +
- ">> void dual()</pre>"
- },
+ checkOutput("typeannos/UnscopedUnmodified.html", true,
+ "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\""
+ + "annotation in typeannos\">@MTyParamA</a> java.lang.String>"
+ + " void methodExtends()</pre>",
+
+ "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\""
+ + "annotation in typeannos\">@MTyParamA</a> <a href=\"../typeannos/"
+ + "MtdTyParameterized.html\" title=\"class in typeannos\">"
+ + "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" "
+ + "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String"
+ + ">> void nestedExtends()</pre>");
+
+ checkOutput("typeannos/PublicModifiedMethods.html", true,
+ "<pre>public final <K extends <a href=\"../typeannos/"
+ + "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> "
+ + "java.lang.String> void methodExtends()</pre>",
+
+ "<pre>public final <K extends <a href=\"../typeannos/"
+ + "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> "
+ + "java.lang.String,V extends <a href=\"../typeannos/MTyParamA.html\" "
+ + "title=\"annotation in typeannos\">@MTyParamA</a> <a href=\"../"
+ + "typeannos/MtdTyParameterized.html\" title=\"class in typeannos\">"
+ + "MtdTyParameterized</a><<a href=\"../typeannos/MTyParamB.html\" "
+ + "title=\"annotation in typeannos\">@MTyParamB</a> java.lang.String"
+ + ">> void dual()</pre>");
// Test for type annotations on parameters (Parameters.java).
- { "typeannos/Parameters.html",
- "<pre>void unannotated(<a href=\"../typeannos/" +
- "ParaParameterized.html\" title=\"class in typeannos\">" +
- "ParaParameterized</a><java.lang.String,java.lang.String>" +
- " a)</pre>"
- },
- { "typeannos/Parameters.html",
- "<pre>void nestedParaParameterized(<a href=\"../typeannos/" +
- "ParaParameterized.html\" title=\"class in typeannos\">" +
- "ParaParameterized</a><<a href=\"../typeannos/ParamA.html\" " +
- "title=\"annotation in typeannos\">@ParamA</a> <a href=\"../" +
- "typeannos/ParaParameterized.html\" title=\"class in typeannos\">" +
- "ParaParameterized</a><<a href=\"../typeannos/ParamA.html\" " +
- "title=\"annotation in typeannos\">@ParamA</a> java.lang.String," +
- "<a href=\"../typeannos/ParamB.html\" title=\"annotation in " +
- "typeannos\">@ParamB</a> java.lang.String>,<a href=\"../" +
- "typeannos/ParamB.html\" title=\"annotation in typeannos\">@ParamB" +
- "</a> java.lang.String> a)</pre>"
- },
- { "typeannos/Parameters.html",
- "<pre>void array2Deep(<a href=\"../typeannos/ParamA.html\" " +
- "title=\"annotation in typeannos\">@ParamA</a> java.lang.String " +
- "<a href=\"../typeannos/ParamA.html\" title=\"annotation in " +
- "typeannos\">@ParamA</a> [] <a href=\"../typeannos/ParamB.html\" " +
- "title=\"annotation in typeannos\">@ParamB</a> [] a)</pre>"
- },
+ checkOutput("typeannos/Parameters.html", true,
+ "<pre>void unannotated(<a href=\"../typeannos/"
+ + "ParaParameterized.html\" title=\"class in typeannos\">"
+ + "ParaParameterized</a><java.lang.String,java.lang.String>"
+ + " a)</pre>",
+
+ "<pre>void nestedParaParameterized(<a href=\"../typeannos/"
+ + "ParaParameterized.html\" title=\"class in typeannos\">"
+ + "ParaParameterized</a><<a href=\"../typeannos/ParamA.html\" "
+ + "title=\"annotation in typeannos\">@ParamA</a> <a href=\"../"
+ + "typeannos/ParaParameterized.html\" title=\"class in typeannos\">"
+ + "ParaParameterized</a><<a href=\"../typeannos/ParamA.html\" "
+ + "title=\"annotation in typeannos\">@ParamA</a> java.lang.String,"
+ + "<a href=\"../typeannos/ParamB.html\" title=\"annotation in "
+ + "typeannos\">@ParamB</a> java.lang.String>,<a href=\"../"
+ + "typeannos/ParamB.html\" title=\"annotation in typeannos\">@ParamB"
+ + "</a> java.lang.String> a)</pre>",
+
+ "<pre>void array2Deep(<a href=\"../typeannos/ParamA.html\" "
+ + "title=\"annotation in typeannos\">@ParamA</a> java.lang.String "
+ + "<a href=\"../typeannos/ParamA.html\" title=\"annotation in "
+ + "typeannos\">@ParamA</a> [] <a href=\"../typeannos/ParamB.html\" "
+ + "title=\"annotation in typeannos\">@ParamB</a> [] a)</pre>");
// Test for type annotations on throws (Throws.java).
- { "typeannos/ThrDefaultUnmodified.html",
- "<pre>void oneException()\n" +
- " throws <a href=\"../typeannos/ThrA.html\" title=\"" +
- "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
- },
- { "typeannos/ThrDefaultUnmodified.html",
- "<pre>void twoExceptions()\n" +
- " throws <a href=\"../typeannos/ThrA.html\" title=\"" +
- "annotation in typeannos\">@ThrA</a> java.lang.RuntimeException,\n" +
- " <a href=\"../typeannos/ThrA.html\" title=\"" +
- "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
- },
- { "typeannos/ThrPublicModified.html",
- "<pre>public final void oneException(java.lang.String a)\n" +
- " throws <a href=\"../typeannos/ThrA.html\" " +
- "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
- },
- { "typeannos/ThrPublicModified.html",
- "<pre>public final void twoExceptions(java.lang.String a)\n" +
- " throws <a href=\"../typeannos/ThrA.html\" " +
- "title=\"annotation in typeannos\">@ThrA</a> java.lang.RuntimeException,\n" +
- " <a href=\"../typeannos/ThrA.html\" " +
- "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
- },
- { "typeannos/ThrWithValue.html",
- "<pre>void oneException()\n" +
- " throws <a href=\"../typeannos/ThrB.html\" title=\"" +
- "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
- "ThrB.html#value--\">value</a>=\"m\") java.lang.Exception</pre>"
- },
- { "typeannos/ThrWithValue.html",
- "<pre>void twoExceptions()\n" +
- " throws <a href=\"../typeannos/ThrB.html\" title=\"" +
- "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
- "ThrB.html#value--\">value</a>=\"m\") java.lang.RuntimeException,\n" +
- " <a href=\"../typeannos/ThrA.html\" title=\"" +
- "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
- },
+ checkOutput("typeannos/ThrDefaultUnmodified.html", true,
+ "<pre>void oneException()\n"
+ + " throws <a href=\"../typeannos/ThrA.html\" title=\""
+ + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>",
+
+ "<pre>void twoExceptions()\n"
+ + " throws <a href=\"../typeannos/ThrA.html\" title=\""
+ + "annotation in typeannos\">@ThrA</a> java.lang.RuntimeException,\n"
+ + " <a href=\"../typeannos/ThrA.html\" title=\""
+ + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>");
+
+ checkOutput("typeannos/ThrPublicModified.html", true,
+ "<pre>public final void oneException(java.lang.String a)\n"
+ + " throws <a href=\"../typeannos/ThrA.html\" "
+ + "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>",
+
+ "<pre>public final void twoExceptions(java.lang.String a)\n"
+ + " throws <a href=\"../typeannos/ThrA.html\" "
+ + "title=\"annotation in typeannos\">@ThrA</a> java.lang.RuntimeException,\n"
+ + " <a href=\"../typeannos/ThrA.html\" "
+ + "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>");
+
+ checkOutput("typeannos/ThrWithValue.html", true,
+ "<pre>void oneException()\n"
+ + " throws <a href=\"../typeannos/ThrB.html\" title=\""
+ + "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/"
+ + "ThrB.html#value--\">value</a>=\"m\") java.lang.Exception</pre>",
+
+ "<pre>void twoExceptions()\n"
+ + " throws <a href=\"../typeannos/ThrB.html\" title=\""
+ + "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/"
+ + "ThrB.html#value--\">value</a>=\"m\") java.lang.RuntimeException,\n"
+ + " <a href=\"../typeannos/ThrA.html\" title=\""
+ + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>");
// Test for type annotations on type parameters (TypeParameters.java).
- { "typeannos/TestMethods.html",
- "<pre><K,V extends <a href=\"../typeannos/TyParaA.html\" title=\"" +
- "annotation in typeannos\">@TyParaA</a> java.lang.String> " +
- "void secondAnnotated()</pre>"
- },
+ checkOutput("typeannos/TestMethods.html", true,
+ "<pre><K,V extends <a href=\"../typeannos/TyParaA.html\" title=\""
+ + "annotation in typeannos\">@TyParaA</a> java.lang.String> "
+ + "void secondAnnotated()</pre>");
// Test for type annotations on wildcard type (Wildcards.java).
- { "typeannos/BoundTest.html",
- "<pre>void wcExtends(<a href=\"../typeannos/MyList.html\" " +
- "title=\"class in typeannos\">MyList</a><? extends <a href=\"" +
- "../typeannos/WldA.html\" title=\"annotation in typeannos\">@WldA" +
- "</a> java.lang.String> l)</pre>"
- },
- { "typeannos/BoundTest.html",
- "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " +
- "typeannos\">MyList</a><? super <a href=\"../typeannos/WldA.html\" " +
- "title=\"annotation in typeannos\">@WldA</a> java.lang.String>" +
- " returnWcSuper()</pre>"
- },
- { "typeannos/BoundWithValue.html",
- "<pre>void wcSuper(<a href=\"../typeannos/MyList.html\" title=\"" +
- "class in typeannos\">MyList</a><? super <a href=\"../typeannos/" +
- "WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"" +
- "../typeannos/WldB.html#value--\">value</a>=\"m\") java.lang." +
- "String> l)</pre>"
- },
- { "typeannos/BoundWithValue.html",
- "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " +
- "typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB." +
- "html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../" +
- "typeannos/WldB.html#value--\">value</a>=\"m\") java.lang.String" +
- "> returnWcExtends()</pre>"
- },
+ checkOutput("typeannos/BoundTest.html", true,
+ "<pre>void wcExtends(<a href=\"../typeannos/MyList.html\" "
+ + "title=\"class in typeannos\">MyList</a><? extends <a href=\""
+ + "../typeannos/WldA.html\" title=\"annotation in typeannos\">@WldA"
+ + "</a> java.lang.String> l)</pre>",
+
+ "<pre><a href=\"../typeannos/MyList.html\" title=\"class in "
+ + "typeannos\">MyList</a><? super <a href=\"../typeannos/WldA.html\" "
+ + "title=\"annotation in typeannos\">@WldA</a> java.lang.String>"
+ + " returnWcSuper()</pre>");
+
+ checkOutput("typeannos/BoundWithValue.html", true,
+ "<pre>void wcSuper(<a href=\"../typeannos/MyList.html\" title=\""
+ + "class in typeannos\">MyList</a><? super <a href=\"../typeannos/"
+ + "WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\""
+ + "../typeannos/WldB.html#value--\">value</a>=\"m\") java.lang."
+ + "String> l)</pre>",
+
+ "<pre><a href=\"../typeannos/MyList.html\" title=\"class in "
+ + "typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB."
+ + "html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../"
+ + "typeannos/WldB.html#value--\">value</a>=\"m\") java.lang.String"
+ + "> returnWcExtends()</pre>");
// Test for receiver annotations (Receivers.java).
- { "typeannos/DefaultUnmodified.html",
- "<pre>void withException(<a href=\"../typeannos/RcvrA.html\" " +
- "title=\"annotation in typeannos\">@RcvrA</a> " +
- "DefaultUnmodified this)\n" +
- " throws java." +
- "lang.Exception</pre>"
- },
- { "typeannos/DefaultUnmodified.html",
- "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrA." +
- "html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../" +
- "typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB" +
- "</a>(<a href=\"../typeannos/RcvrB.html#value--\">value</a>=\"m\")" +
- " DefaultUnmodified this)</pre>"
- },
- { "typeannos/DefaultUnmodified.html",
- "<pre><T extends java.lang.Runnable> void accept(" +
- "<a href=\"../typeannos/RcvrA.html\" title=\"annotation in " +
- "typeannos\">@RcvrA</a> DefaultUnmodified this,\n" +
- " T r)\n" +
- " throws java.lang.Exception</pre>"
- },
- { "typeannos/PublicModified.html",
- "<pre>public final java.lang.String nonVoid(<a href=\"" +
- "../typeannos/RcvrA.html\" title=\"annotation in typeannos\">" +
- "@RcvrA</a> PublicModified this)</pre>"
- },
- { "typeannos/PublicModified.html",
- "<pre>public final <T extends java.lang.Runnable> " +
- "void accept(<a href=\"../typeannos/RcvrA.html\" title=\"" +
- "annotation in typeannos\">@RcvrA</a> PublicModified this,\n" +
- " T r)\n" +
- " throws java.lang.Exception</pre>"
- },
- { "typeannos/WithValue.html",
- "<pre><T extends java.lang.Runnable> void accept(" +
- "<a href=\"../typeannos/RcvrB.html\" title=\"annotation in " +
- "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value--\">" +
- "value</a>=\"m\") WithValue this,\n" +
- " T r)\n" +
- " throws java.lang.Exception</pre>"
- },
- { "typeannos/WithFinal.html",
- "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrB." +
- "html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../" +
- "typeannos/RcvrB.html#value--\">value</a>=\"m\") WithFinal" +
- " this)</pre>"
- },
- { "typeannos/WithBody.html",
- "<pre>void field(<a href=\"../typeannos/RcvrA.html\" title=\"" +
- "annotation in typeannos\">@RcvrA</a> WithBody this)</pre>"
- },
- { "typeannos/Generic2.html",
- "<pre>void test2(<a href=\"../typeannos/RcvrA.html\" title=\"" +
- "annotation in typeannos\">@RcvrA</a> Generic2<X> this)</pre>"
- }
- };
+ checkOutput("typeannos/DefaultUnmodified.html", true,
+ "<pre>void withException(<a href=\"../typeannos/RcvrA.html\" "
+ + "title=\"annotation in typeannos\">@RcvrA</a> "
+ + "DefaultUnmodified this)\n"
+ + " throws java."
+ + "lang.Exception</pre>",
+
+ "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrA."
+ + "html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../"
+ + "typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB"
+ + "</a>(<a href=\"../typeannos/RcvrB.html#value--\">value</a>=\"m\")"
+ + " DefaultUnmodified this)</pre>",
+
+ "<pre><T extends java.lang.Runnable> void accept("
+ + "<a href=\"../typeannos/RcvrA.html\" title=\"annotation in "
+ + "typeannos\">@RcvrA</a> DefaultUnmodified this,\n"
+ + " T r)\n"
+ + " throws java.lang.Exception</pre>");
+
+ checkOutput("typeannos/PublicModified.html", true,
+ "<pre>public final java.lang.String nonVoid(<a href=\""
+ + "../typeannos/RcvrA.html\" title=\"annotation in typeannos\">"
+ + "@RcvrA</a> PublicModified this)</pre>",
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestTypeAnnotations tester = new TestTypeAnnotations();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ "<pre>public final <T extends java.lang.Runnable> "
+ + "void accept(<a href=\"../typeannos/RcvrA.html\" title=\""
+ + "annotation in typeannos\">@RcvrA</a> PublicModified this,\n"
+ + " T r)\n"
+ + " throws java.lang.Exception</pre>");
+
+ checkOutput("typeannos/WithValue.html", true,
+ "<pre><T extends java.lang.Runnable> void accept("
+ + "<a href=\"../typeannos/RcvrB.html\" title=\"annotation in "
+ + "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value--\">"
+ + "value</a>=\"m\") WithValue this,\n"
+ + " T r)\n"
+ + " throws java.lang.Exception</pre>");
+
+ checkOutput("typeannos/WithFinal.html", true,
+ "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrB."
+ + "html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../"
+ + "typeannos/RcvrB.html#value--\">value</a>=\"m\") WithFinal"
+ + " this)</pre>");
+
+ checkOutput("typeannos/WithBody.html", true,
+ "<pre>void field(<a href=\"../typeannos/RcvrA.html\" title=\""
+ + "annotation in typeannos\">@RcvrA</a> WithBody this)</pre>");
+
+ checkOutput("typeannos/Generic2.html", true,
+ "<pre>void test2(<a href=\"../typeannos/RcvrA.html\" title=\""
+ + "annotation in typeannos\">@RcvrA</a> Generic2<X> this)</pre>");
}
}
--- a/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java Fri May 23 09:05:24 2014 -0700
@@ -30,66 +30,61 @@
* class-use pages. The class/annotation pages should check for type
* parameter links in the class/annotation signature section when -linksource is set.
* @author jamieh
- * @library ../lib/
- * @build JavadocTester TestTypeParameters
+ * @library ../lib
+ * @build JavadocTester
* @run main TestTypeParameters
*/
public class TestTypeParameters extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS1 = new String[]{
- "-d", OUTPUT_DIR + "-1", "-use", "-sourcepath", SRC_DIR,
- "pkg"
- };
- private static final String[] ARGS2 = new String[]{
- "-d", OUTPUT_DIR + "-2", "-linksource", "-sourcepath", SRC_DIR,
- "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestTypeParameters tester = new TestTypeParameters();
+ tester.runTests();
+ }
+
+ @Test
+ void test1() {
+ javadoc("-d", "out-1",
+ "-use",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/C.html", true,
+ "<td class=\"colFirst\"><code><W extends java.lang.String,V extends "
+ + "java.util.List><br>java.lang.Object</code></td>",
+ "<code><T> java.lang.Object</code>");
+
+ checkOutput("pkg/package-summary.html", true,
+ "C</a><E extends <a href=\"../pkg/Parent.html\" "
+ + "title=\"class in pkg\">Parent</a>>");
- //Input for string search tests.
- private static final String[][] TEST1 = {
- { "pkg/C.html",
- "<td class=\"colFirst\"><code><W extends java.lang.String,V extends " +
- "java.util.List><br>java.lang.Object</code></td>"
- },
- { "pkg/C.html",
- "<code><T> java.lang.Object</code>"
- },
- { "pkg/package-summary.html",
- "C</a><E extends <a href=\"../pkg/Parent.html\" " +
- "title=\"class in pkg\">Parent</a>>"
- },
- { "pkg/class-use/Foo4.html",
- "<a href=\"../../pkg/ClassUseTest3.html\" title=\"class in pkg\">" +
- "ClassUseTest3</a><T extends <a href=\"../../pkg/ParamTest2.html\" " +
- "title=\"class in pkg\">ParamTest2</a><java.util.List<? extends " +
- "<a href=\"../../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>>>>"
- },
- //Nested type parameters
- { "pkg/C.html",
- "<a name=\"formatDetails-java.util.Collection-java.util.Collection-\">\n" +
- "<!-- -->\n" +
- "</a>"
- },
- };
- private static final String[][] TEST2 = {
- { "pkg/ClassUseTest3.html",
+ checkOutput("pkg/class-use/Foo4.html", true,
+ "<a href=\"../../pkg/ClassUseTest3.html\" title=\"class in pkg\">"
+ + "ClassUseTest3</a><T extends <a href=\"../../pkg/ParamTest2.html\" "
+ + "title=\"class in pkg\">ParamTest2</a><java.util.List<? extends "
+ + "<a href=\"../../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>>>>");
+
+ // Nested type parameters
+ checkOutput("pkg/C.html", true,
+ "<a name=\"formatDetails-java.util.Collection-java.util.Collection-\">\n"
+ + "<!-- -->\n"
+ + "</a>");
+ }
+
+
+ @Test
+ void test2() {
+ javadoc("-d", "out-2",
+ "-linksource",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/ClassUseTest3.html", true,
"public class <a href=\"../src-html/pkg/ClassUseTest3.html#line.28\">" +
"ClassUseTest3</a><T extends <a href=\"../pkg/ParamTest2.html\" " +
"title=\"class in pkg\">ParamTest2</a><java.util.List<? extends " +
- "<a href=\"../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>>>>"
- }
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestTypeParameters tester = new TestTypeParameters();
- tester.run(ARGS1, TEST1, NO_TEST);
- tester.run(ARGS2, TEST2, NO_TEST);
- tester.printSummary();
+ "<a href=\"../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>>>>");
}
}
--- a/langtools/test/com/sun/javadoc/testUnnamedPackage/TestUnnamedPackage.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testUnnamedPackage/TestUnnamedPackage.java Fri May 23 09:05:24 2014 -0700
@@ -27,49 +27,40 @@
* @summary Reference unnamed package as "Unnamed", not empty string.
* Generate a package summary for the unnamed package.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestUnnamedPackage
* @run main TestUnnamedPackage
*/
public class TestUnnamedPackage extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, SRC_DIR + "/C.java"
- };
+ public static void main(String... args) throws Exception {
+ TestUnnamedPackage tester = new TestUnnamedPackage();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ testSrc("C.java"));
+ checkExit(Exit.OK);
- //Input for string search tests.
- private static final String[][] TEST = {
- { "package-summary.html",
- "<h1 title=\"Package\" class=\"title\">Package <Unnamed></h1>"
- },
- { "package-summary.html",
- "This is a package comment for the unnamed package."
- },
- { "package-summary.html",
- "This is a class in the unnamed package."
- },
- { "package-tree.html",
- "<h1 class=\"title\">Hierarchy For Package <Unnamed></h1>"
- },
- { "index-all.html",
- "title=\"class in <Unnamed>\""
- },
- { "C.html", "<a href=\"package-summary.html\">"}
- };
- private static final String[][] NEGATED_TEST = {
- {ERROR_OUTPUT, "BadSource"},
- };
+ checkOutput("package-summary.html", true,
+ "<h1 title=\"Package\" class=\"title\">Package <Unnamed></h1>",
+ "This is a package comment for the unnamed package.",
+ "This is a class in the unnamed package.");
+
+ checkOutput("package-tree.html", true,
+ "<h1 class=\"title\">Hierarchy For Package <Unnamed></h1>");
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestUnnamedPackage tester = new TestUnnamedPackage();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("index-all.html", true,
+ "title=\"class in <Unnamed>\"");
+
+ checkOutput("C.html", true,
+ "<a href=\"package-summary.html\">");
+
+ checkOutput(Output.ERROR, false,
+ "BadSource");
}
}
--- a/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java Fri May 23 09:05:24 2014 -0700
@@ -26,100 +26,76 @@
* @bug 4496290 4985072 7006178 7068595 8016328
* @summary A simple test to determine if -use works.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestUseOption
* @run main TestUseOption
*/
public class TestUseOption extends JavadocTester {
- //Input for string search tests.
- private static final String[] TEST2 = {
- "Field in C1.",
- "Field in C2.",
- "Field in C4.",
- "Field in C5.",
- "Field in C6.",
- "Field in C7.",
- "Field in C8.",
- "Method in C1.",
- "Method in C2.",
- "Method in C4.",
- "Method in C5.",
- "Method in C6.",
- "Method in C7.",
- "Method in C8.",
- };
+ public static void main(String... args) throws Exception {
+ TestUseOption tester = new TestUseOption();
+ tester.runTests();
+ }
- private static final String[][] TEST3 = {
- { "class-use/UsedInC.html",
- "Uses of <a href=\"../UsedInC.html\" title=\"class in <Unnamed>\">" +
- "UsedInC</a> in <a href=\"../package-summary.html\"><Unnamed></a>"
- },
- { "package-use.html",
- "<td class=\"colOne\">" +
- "<a href=\"class-use/UsedInC.html#%3CUnnamed%3E\">UsedInC</a> </td>"
- }
- };
+ @Test
+ void test1() {
+ javadoc("-d", "out-1",
+ "-sourcepath", testSrc,
+ "-use",
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
- private static final String[][] TEST4 = {
- { "pkg2/class-use/C3.html",
- "<a href=\"../../index.html?pkg2/class-use/C3.html\" target=\"_top\">" +
- "Frames</a></li>"
+ // Eight tests for class use.
+ for (int i = 1; i <= 8; i++) {
+ checkOutput("pkg1/class-use/C1.html", true,
+ "Test " + i + " passes");
}
- };
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
- };
-
- private static final String[] ARGS2 = new String[] {
- "-d", OUTPUT_DIR+"-2", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
- };
+ // Three more tests for package use.
+ for (int i = 1; i <= 3; i++) {
+ checkOutput("pkg1/package-use.html", true,
+ "Test " + i + " passes");
+ }
- private static final String[] ARGS3 = new String[] {
- "-d", OUTPUT_DIR + "-3", "-sourcepath", SRC_DIR, "-use",
- SRC_DIR + "/C.java", SRC_DIR + "/UsedInC.java"
- };
-
- private static final String[] ARGS4 = new String[] {
- "-d", OUTPUT_DIR + "-4", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
- };
+ checkOrder("pkg1/class-use/UsedClass.html",
+ "Field in C1.",
+ "Field in C2.",
+ "Field in C4.",
+ "Field in C5.",
+ "Field in C6.",
+ "Field in C7.",
+ "Field in C8.",
+ "Method in C1.",
+ "Method in C2.",
+ "Method in C4.",
+ "Method in C5.",
+ "Method in C6.",
+ "Method in C7.",
+ "Method in C8."
+ );
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) throws Exception {
- String[][] tests = new String[11][2];
- //Eight tests for class use.
- for (int i = 0; i < 8; i++) {
- tests[i][0] = "pkg1/class-use/C1.html";
- tests[i][1] = "Test " + (i + 1) + " passes";
- }
- //Three more tests for package use.
- for (int i = 8, j = 1; i < tests.length; i++, j++) {
- tests[i][0] = "pkg1/package-use.html";
- tests[i][1] = "Test " + j + " passes";
- }
- TestUseOption tester = new TestUseOption();
- tester.run(ARGS, tests, NO_TEST);
- tester.printSummary();
- tester.run(ARGS2, NO_TEST, NO_TEST);
- String usePageContents = tester.readFileToString("pkg1/class-use/UsedClass.html");
- int prevIndex = -1;
- int currentIndex = -1;
- for (int i = 0; i < TEST2.length; i++) {
- currentIndex = usePageContents.indexOf(TEST2[i]);
- System.err.println(TEST2[i] + " at index " + currentIndex);
- if (currentIndex < prevIndex)
- throw new Exception(TEST2[i] + " is in the wrong order.");
- prevIndex = currentIndex;
- }
- tester.printSummary();
- tester.run(ARGS3, TEST3, NO_TEST);
- tester.run(ARGS4, TEST4, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg2/class-use/C3.html", true,
+ "<a href=\"../../index.html?pkg2/class-use/C3.html\" target=\"_top\">"
+ + "Frames</a></li>"
+ );
+ }
+
+ @Test
+ void test2() {
+ javadoc("-d", "out-2",
+ "-sourcepath", testSrc,
+ "-use",
+ testSrc("C.java"), testSrc("UsedInC.java"));
+ checkExit(Exit.OK);
+
+ checkOutput("class-use/UsedInC.html", true,
+ "Uses of <a href=\"../UsedInC.html\" title=\"class in <Unnamed>\">"
+ + "UsedInC</a> in <a href=\"../package-summary.html\"><Unnamed></a>"
+ );
+ checkOutput("package-use.html", true,
+ "<td class=\"colOne\">"
+ + "<a href=\"class-use/UsedInC.html#%3CUnnamed%3E\">UsedInC</a> </td>"
+ );
}
}
--- a/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java Fri May 23 09:05:24 2014 -0700
@@ -27,141 +27,114 @@
* @summary This test ensures that the value tag works in all
* use cases. The explainations for each test case are written below.
* @author jamieh
- * @library ../lib/
- * @build JavadocTester TestValueTag
+ * @library ../lib
+ * @build JavadocTester
* @run main TestValueTag
*/
public class TestValueTag extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-tag",
- "todo", "pkg1", "pkg2"
- };
-
- private static final String[] ARGS1 =
- new String[] {
- "-Xdoclint:none",
- "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "-tag",
- "todo", "pkg1", "pkg2"
- };
-
- //Input for string search tests.
- private static final String[][] TEST = {
- //Base case: using @value on a constant.
- { "pkg1/Class1.html",
- "Result: \"Test 1 passes\""},
- //Retrieve value of constant in same class.
- { "pkg1/Class1.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</a>"},
- { "pkg1/Class1.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</a>"},
- { "pkg1/Class1.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</a>"},
- { "pkg1/Class1.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</a>"},
- { "pkg1/Class1.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</a>"},
- //Retrieve value of constant in different class.
- { "pkg1/Class2.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>"},
- { "pkg1/Class2.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>"},
- { "pkg1/Class2.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>"},
- { "pkg1/Class2.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>"},
- { "pkg1/Class2.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>"},
- //Retrieve value of constant in different package
- { "pkg1/Class2.html",
- "Result: <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>"},
- { "pkg1/Class2.html",
- "Result: <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>"},
- { "pkg1/Class2.html",
- "Result: <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>"},
- { "pkg1/Class2.html",
- "Result: <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>"},
- { "pkg1/Class2.html",
- "Result: <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"},
- //Retrieve value of constant from a package page
- { "pkg2/package-summary.html",
- "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"},
- //Test @value tag used with custom tag.
- { "pkg1/CustomTagUsage.html",
- "<dt><span class=\"simpleTagLabel\">Todo:</span></dt>\n" +
- "<dd>the value of this constant is 55.</dd>"},
- //Test @value errors printed dues to invalid use or when used with
- //non-constant or with bad references.
- {ERROR_OUTPUT,"error: value does not refer to a constant\n" +
- " * Result: {@value TEST_12_ERROR}"
- },
- {ERROR_OUTPUT,"error: {@value} not allowed here\n" +
- " * Result: {@value}"
- },
- {ERROR_OUTPUT,"error: value does not refer to a constant\n" +
- " * Result: {@value NULL}"
- },
- {ERROR_OUTPUT,"error: {@value} not allowed here\n" +
- " * Invalid (null): {@value}"
- },
- {ERROR_OUTPUT,"error: {@value} not allowed here\n" +
- " * Invalid (non-constant field): {@value}"
- },
- {ERROR_OUTPUT,"error: value does not refer to a constant\n" +
- " * Here is a bad value reference: {@value UnknownClass#unknownConstant}"
- },
- {ERROR_OUTPUT,"error: reference not found\n" +
- " * Here is a bad value reference: {@value UnknownClass#unknownConstant}"
- },
- {ERROR_OUTPUT,"error: {@value} not allowed here\n" +
- " * @todo the value of this constant is {@value}"
- }
- };
- private static final String[][] TEST1 = {
- //Test @value warning printed when used with non-constant.
- {WARNING_OUTPUT,"warning - @value tag (which references nonConstant) " +
- "can only be used in constants."
- },
- {WARNING_OUTPUT,"warning - @value tag (which references NULL) " +
- "can only be used in constants."
- },
- {WARNING_OUTPUT,"warning - @value tag (which references TEST_12_ERROR) " +
- "can only be used in constants."
- },
- //Test warning printed for bad reference.
- {WARNING_OUTPUT,"warning - UnknownClass#unknownConstant (referenced by " +
- "@value tag) is an unknown reference."
- },
- //Test warning printed for invalid use of @value.
- {WARNING_OUTPUT,"warning - @value tag cannot be used here."
- }
- };
- private static final String[][] NEGATED_TEST = {
- //Base case: using @value on a constant.
- { "pkg1/Class1.html",
- "Result: <a href=\"../pkg1/Class1.html#TEST_12_ERROR\">\"Test 12 " +
- "generates an error message\"</a>"},
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestValueTag tester = new TestValueTag();
- tester.run(ARGS, TEST, NEGATED_TEST);
- checkForException(tester);
- tester.run(ARGS1, TEST1, NO_TEST);
- checkForException(tester);
- tester.printSummary();
+ tester.runTests();
}
- public static void checkForException(TestValueTag tester) {
- if (tester.getErrorOutput().contains("DocletAbortException")) {
- throw new AssertionError("javadoc threw DocletAbortException");
- }
+ @Test
+ void test1() {
+ javadoc("-d", "out1",
+ "-sourcepath", testSrc,
+ "-tag", "todo",
+ "pkg1", "pkg2");
+ checkExit(Exit.FAILED);
+
+ checkOutput("pkg1/Class1.html", true,
+ // Base case: using @value on a constant.
+ "Result: \"Test 1 passes\"",
+ // Retrieve value of constant in same class.
+ "Result: <a href=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</a>",
+ "Result: <a href=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</a>",
+ "Result: <a href=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</a>",
+ "Result: <a href=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</a>",
+ "Result: <a href=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</a>");
+
+ checkOutput("pkg1/Class2.html", true,
+ // Retrieve value of constant in different class.
+ "Result: <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>",
+ "Result: <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>",
+ "Result: <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>",
+ "Result: <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>",
+ "Result: <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>",
+ // Retrieve value of constant in different package
+ "Result: <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>",
+ "Result: <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>",
+ "Result: <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>",
+ "Result: <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>",
+ "Result: <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>");
+
+ checkOutput("pkg2/package-summary.html", true,
+ // Retrieve value of constant from a package page
+ "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>");
+
+ checkOutput("pkg1/CustomTagUsage.html", true,
+ // Test @value tag used with custom tag.
+ "<dt><span class=\"simpleTagLabel\">Todo:</span></dt>\n" +
+ "<dd>the value of this constant is 55.</dd>");
+
+ checkOutput(Output.ERROR, true,
+ // Test @value errors printed due to invalid use or when used with
+ // non-constant or with bad references.
+ "error: value does not refer to a constant\n"
+ + " * Result: {@value TEST_12_ERROR}",
+ "error: {@value} not allowed here\n"
+ + " * Result: {@value}",
+ "error: value does not refer to a constant\n"
+ + " * Result: {@value NULL}",
+ "error: {@value} not allowed here\n"
+ + " * Invalid (null): {@value}",
+ "error: {@value} not allowed here\n"
+ + " * Invalid (non-constant field): {@value}",
+ "error: value does not refer to a constant\n"
+ + " * Here is a bad value reference: {@value UnknownClass#unknownConstant}",
+ "error: reference not found\n"
+ + " * Here is a bad value reference: {@value UnknownClass#unknownConstant}",
+ "error: {@value} not allowed here\n"
+ + " * @todo the value of this constant is {@value}"
+ );
+
+ checkOutput("pkg1/Class1.html", false,
+ //Base case: using @value on a constant.
+ "Result: <a href=\"../pkg1/Class1.html#TEST_12_ERROR\">\"Test 12 "
+ + "generates an error message\"</a>");
+
+ checkForException();
+ }
+
+ @Test()
+ void test2() {
+ javadoc("-Xdoclint:none",
+ "-d", "out2",
+ "-sourcepath", testSrc,
+ "-tag", "todo",
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
+ checkOutput(Output.WARNING, true,
+ //Test @value warning printed when used with non-constant.
+ "warning - @value tag (which references nonConstant) "
+ + "can only be used in constants.",
+ "warning - @value tag (which references NULL) "
+ + "can only be used in constants.",
+ "warning - @value tag (which references TEST_12_ERROR) "
+ + "can only be used in constants.",
+ //Test warning printed for bad reference.
+ "warning - UnknownClass#unknownConstant (referenced by "
+ + "@value tag) is an unknown reference.",
+ //Test warning printed for invalid use of @value.
+ "warning - @value tag cannot be used here."
+ );
+ checkForException();
+ }
+
+ void checkForException() {
+ checkOutput(Output.STDERR, false, "DocletAbortException");
}
}
--- a/langtools/test/com/sun/javadoc/testWarnBadParamNames/TestWarnBadParamNames.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testWarnBadParamNames/TestWarnBadParamNames.java Fri May 23 09:05:24 2014 -0700
@@ -24,33 +24,31 @@
/*
* @test
* @bug 4693440
- * @summary Test to make sure that warning is printed when bad paramenter
+ * @summary Test to make sure that warning is printed when bad parameter
* name is used with param.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestWarnBadParamNames
* @run main TestWarnBadParamNames
*/
public class TestWarnBadParamNames extends JavadocTester {
- private static final String[][] TEST = {
- {WARNING_OUTPUT, "warning - @param argument \"int\" is not a parameter name."},
- {WARNING_OUTPUT, "warning - @param argument \"IDontExist\" is not a parameter name."},
- {WARNING_OUTPUT, "warning - Parameter \"arg\" is documented more than once."},
- };
- private static final String[] ARGS = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR, SRC_DIR + "/C.java"
- };
+ public static void main(String... args) throws Exception {
+ TestWarnBadParamNames tester = new TestWarnBadParamNames();
+ tester.runTests();
+ }
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestWarnBadParamNames tester = new TestWarnBadParamNames();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ @Test
+ void test() {
+ javadoc("-Xdoclint:none",
+ "-d", "out",
+ testSrc("C.java"));
+ checkExit(Exit.OK);
+
+ checkOutput(Output.WARNING, true,
+ "warning - @param argument \"int\" is not a parameter name.",
+ "warning - @param argument \"IDontExist\" is not a parameter name.",
+ "warning - Parameter \"arg\" is documented more than once.");
}
}
--- a/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java Fri May 23 09:05:24 2014 -0700
@@ -30,55 +30,50 @@
* a "link unresolved" warning.
* Make sure error message starts with "error -".
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestWarnings
* @run main TestWarnings
*/
public class TestWarnings extends JavadocTester {
-
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestWarnings tester = new TestWarnings();
+ tester.runTests();
+ }
- private static final String[] ARGS2 = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-private", "-sourcepath", SRC_DIR,
- "pkg"
- };
+ @Test
+ void testDefault() {
+ javadoc("-Xdoclint:none",
+ "-d", "out-default",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.FAILED); // TODO: investigate; suspect bad input HTML
- //Input for string search tests.
- private static final String[][] TEST = {
- {WARNING_OUTPUT,
- "X.java:11: warning - Missing closing '}' character for inline tag"},
- {ERROR_OUTPUT,
- "package.html: error - Body tag missing from HTML"},
+ checkOutput(Output.WARNING, true,
+ "X.java:11: warning - Missing closing '}' character for inline tag");
+ checkOutput(Output.ERROR, true,
+ "package.html: error - Body tag missing from HTML");
- };
- private static final String[][] NEGATED_TEST = {
- { "pkg/X.html", "can't find m()"},
- { "pkg/X.html", "can't find X()"},
- { "pkg/X.html", "can't find f"},
- };
+ checkOutput("pkg/X.html", false,
+ "can't find m()");
+ checkOutput("pkg/X.html", false,
+ "can't find X()");
+ checkOutput("pkg/X.html", false,
+ "can't find f");
+ }
- private static final String[][] TEST2 = {
- { "pkg/X.html",
- "<a href=\"../pkg/X.html#m--\"><code>m()</code></a><br/>"},
- { "pkg/X.html",
- "<a href=\"../pkg/X.html#X--\"><code>X()</code></a><br/>"},
- { "pkg/X.html",
- "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>"},
- };
+ @Test
+ void testPrivate() {
+ javadoc("-Xdoclint:none",
+ "-d", "out-private",
+ "-private",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.FAILED); // TODO: investigate; suspect bad input HTML
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestWarnings tester = new TestWarnings();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.run(ARGS2, TEST2, NO_TEST);
- tester.printSummary();
+ checkOutput("pkg/X.html", true,
+ "<a href=\"../pkg/X.html#m--\"><code>m()</code></a><br/>",
+ "<a href=\"../pkg/X.html#X--\"><code>X()</code></a><br/>",
+ "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>");
}
}
--- a/langtools/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java Fri May 23 09:05:24 2014 -0700
@@ -26,180 +26,192 @@
* @bug 8016675 8026736
* @summary Test for window title.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestWindowTitle
+ * @library ../lib
+ * @build JavadocTester
* @run main TestWindowTitle
*/
-
public class TestWindowTitle extends JavadocTester {
- //Window title with JavaScript special characters.
- private static final String TITLE_JS_CHARS =
- "Testing \"Window 'Title'\" with a \\ backslash and a / " +
- "forward slash and a \u00e8 unicode char also a tab and also a " +
- "\t special character another \u0002 unicode)";
- private static final String[] ARGS_JS_CHARS = new String[]{
- "-d", OUTPUT_DIR + "-1", "-windowtitle", TITLE_JS_CHARS, "-sourcepath", SRC_DIR, "p1", "p2"
- };
- private static final String[][] TEST_JS_CHARS = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" " +
- "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char " +
- "also a tab and also a \\t special character another \\u0002 unicode))\";"
- },
- };
- private static final String[][] NEG_TEST_JS_CHARS = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing \"Window \'Title\'\" " +
- "with a \\ backslash and a / forward slash and a \u00E8 unicode char " +
- "also a tab and also a \t special character another \u0002 unicode))\";"
- }
- };
-
- //Window title with a script tag.
- private static final String TITLE_SCRIPT_TAG =
- "Testing script tag in title </title><script>alert(\"Should not pop up\")</script>.";
- private static final String[] ARGS_SCRIPT_TAG = new String[]{
- "-d", OUTPUT_DIR + "-2", "-windowtitle", TITLE_SCRIPT_TAG, "-sourcepath", SRC_DIR, "p1", "p2"
- };
- private static final String[][] TEST_SCRIPT_TAG = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing script tag in title alert" +
- "(\\\"Should not pop up\\\").)\";"
- },
- { "p2/C2.html",
- "parent.document.title=\"C2 (Testing script tag in title alert" +
- "(\\\"Should not pop up\\\").)\";"
- }
- };
- private static final String[][] NEG_TEST_SCRIPT_TAG = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing script tag in title </title><script>" +
- "alert(\\\"Should not pop up\\\")</script>.)\";"
- },
- { "p2/C2.html",
- "parent.document.title=\"C2 (Testing script tag in title </title><script>" +
- "alert(\\\"Should not pop up\\\")</script>.)\";"
- }
- };
-
- //Window title with other HTML tags.
- private static final String TITLE_HTML_TAGS =
- "Testing another <p>HTML</p> tag. Another <h1>tag</h1>. A " +
- "<span id=\"testTag\">tag with attributes</span>. <script and </p are not tags.";
- private static final String[] ARGS_HTML_TAGS = new String[]{
- "-d", OUTPUT_DIR + "-3", "-windowtitle", TITLE_HTML_TAGS,
- "-sourcepath", SRC_DIR,
- "p1", "p2"
- };
- private static final String[][] TEST_HTML_TAGS = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing another HTML tag. Another tag. A " +
- "tag with attributes. <script and </p are not tags.)\";"
- }
- };
- private static final String[][] NEG_TEST_HTML_TAGS = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing another <p>HTML</p> tag. Another " +
- "<h1>tag</h1>. A <span id=\"testTag\">tag with attributes</span>. <script and " +
- "</p are not tags.)\";"
- }
- };
-
- //Window title using entities.
- private static final String TITLE_HTML_ENTITIES =
- "Testing entities <script>alert(\"Should not pop up\")</script>.";
- private static final String[] ARGS_HTML_ENTITIES = new String[]{
- "-d", OUTPUT_DIR + "-4", "-windowtitle", TITLE_HTML_ENTITIES,
- "-sourcepath", SRC_DIR,
- "p1", "p2"
- };
- private static final String[][] TEST_HTML_ENTITIES = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing entities <script>alert(\\\"Should " +
- "not pop up\\\")</script>.)\";"
- }
- };
- private static final String[][] NEG_TEST_HTML_ENTITIES = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing entities alert(\\\"Should not pop up\\\").)\";"
- }
- };
-
- //Window title with just empty HTML tags.
- private static final String TITLE_EMPTY_TAGS =
- "</title><script></script>";
- private static final String[] ARGS_EMPTY_TAGS = new String[]{
- "-d", OUTPUT_DIR + "-5", "-windowtitle", TITLE_EMPTY_TAGS, "-sourcepath", SRC_DIR, "p1", "p2"
- };
- private static final String[][] TEST_EMPTY_TAGS = {
- { "overview-summary.html",
- "parent.document.title=\"Overview\";"
- }
- };
- private static final String[][] NEG_TEST_EMPTY_TAGS = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (</title><script></script>)\";"
- }
- };
-
- //Window title with unicode characters.
- private static final String TITLE_UNICODE_CHARS =
- "Testing unicode \u003cscript\u003ealert(\"Should not pop up\")\u003c/script\u003e.";
- private static final String[] ARGS_UNICODE_CHARS = new String[]{
- "-d", OUTPUT_DIR + "-6", "-windowtitle", TITLE_UNICODE_CHARS, "-sourcepath", SRC_DIR, "p1", "p2"
- };
- private static final String[][] TEST_UNICODE_CHARS = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing unicode alert(\\\"Should " +
- "not pop up\\\").)\";"
- }
- };
- private static final String[][] NEG_TEST_UNICODE_CHARS = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing unicode <script>alert(\\\"Should not pop up\\\")" +
- "</script>.)\";"
- }
- };
-
- //An empty window title.
- private static final String TITLE_EMPTY =
- "";
- private static final String[] ARGS_EMPTY_TITLE = new String[]{
- "-d", OUTPUT_DIR + "-7", "-windowtitle", TITLE_EMPTY, "-sourcepath", SRC_DIR, "p1", "p2"
- };
- private static final String[][] TEST_EMPTY = {
- { "overview-summary.html",
- "parent.document.title=\"Overview\";"
- }
- };
-
- //Test doctitle.
- private static final String[] ARGS_DOCTITLE = new String[]{
- "-d", OUTPUT_DIR + "-8", "-doctitle", TITLE_JS_CHARS, "-sourcepath", SRC_DIR, "p1", "p2"
- };
- private static final String[][] NEG_TEST_DOCTITLE = {
- { "overview-summary.html",
- "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" " +
- "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char " +
- "also a tab and also a \\t special character another \\u0002 unicode)\";"
- },
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestWindowTitle tester = new TestWindowTitle();
- tester.run(ARGS_JS_CHARS, TEST_JS_CHARS, NEG_TEST_JS_CHARS);
- tester.run(ARGS_SCRIPT_TAG, TEST_SCRIPT_TAG, NEG_TEST_SCRIPT_TAG);
- tester.run(ARGS_HTML_TAGS, TEST_HTML_TAGS, NEG_TEST_HTML_TAGS);
- tester.run(ARGS_HTML_ENTITIES, TEST_HTML_ENTITIES, NEG_TEST_HTML_ENTITIES);
- tester.run(ARGS_EMPTY_TAGS, TEST_EMPTY_TAGS, NEG_TEST_EMPTY_TAGS);
- tester.run(ARGS_UNICODE_CHARS, TEST_UNICODE_CHARS, NEG_TEST_UNICODE_CHARS);
- tester.run(ARGS_EMPTY_TITLE, TEST_EMPTY, NO_TEST);
- tester.run(ARGS_DOCTITLE, NO_TEST, NEG_TEST_DOCTITLE);
+ tester.runTests();
tester.printSummary();
}
+
+ @Test
+ void testJavaScriptChars() {
+ // Window title with JavaScript special characters.
+ String title = "Testing \"Window 'Title'\" with a \\ backslash and a / "
+ + "forward slash and a \u00e8 unicode char also a tab and also a "
+ + "\t special character another \u0002 unicode)";
+
+ javadoc("-d", "out-js-chars",
+ "-windowtitle", title,
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
+
+ checkOutput("overview-summary.html", true,
+ "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" "
+ + "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char "
+ + "also a tab and also a \\t special character another \\u0002 unicode))\";"
+ );
+
+ checkOutput("overview-summary.html", false,
+ "parent.document.title=\"Overview (Testing \"Window \'Title\'\" "
+ + "with a \\ backslash and a / forward slash and a \u00E8 unicode char "
+ + "also a tab and also a \t special character another \u0002 unicode))\";"
+ );
+ }
+
+ @Test
+ void testScriptTag() {
+ // Window title with a script tag.
+ String title = "Testing script tag in title </title><script>alert(\"Should not pop up\")</script>.";
+
+ javadoc("-d", "out-script",
+ "-windowtitle", title,
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
+
+ checkOutput("overview-summary.html", true,
+ "parent.document.title=\"Overview (Testing script tag in title alert"
+ + "(\\\"Should not pop up\\\").)\";"
+ );
+
+ checkOutput("p2/C2.html", true,
+ "parent.document.title=\"C2 (Testing script tag in title alert"
+ + "(\\\"Should not pop up\\\").)\";"
+ );
+
+ checkOutput("overview-summary.html", false,
+ "parent.document.title=\"Overview (Testing script tag in title </title><script>"
+ + "alert(\\\"Should not pop up\\\")</script>.)\";"
+ );
+
+ checkOutput("p2/C2.html", false,
+ "parent.document.title=\"C2 (Testing script tag in title </title><script>"
+ + "alert(\\\"Should not pop up\\\")</script>.)\";"
+ );
+ }
+
+ @Test
+ void testHtmlTags() {
+ // Window title with other HTML tags.
+ String title = "Testing another <p>HTML</p> tag. Another <h1>tag</h1>. A "
+ + "<span id=\"testTag\">tag with attributes</span>. <script and </p are not tags.";
+
+ javadoc("-d", "out-html-tags",
+ "-windowtitle", title,
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
+
+ checkOutput("overview-summary.html", true,
+ "parent.document.title=\"Overview (Testing another HTML tag. Another tag. A "
+ + "tag with attributes. <script and </p are not tags.)\";"
+ );
+
+ checkOutput("overview-summary.html", false,
+ "parent.document.title=\"Overview (Testing another <p>HTML</p> tag. Another "
+ + "<h1>tag</h1>. A <span id=\"testTag\">tag with attributes</span>. <script and "
+ + "</p are not tags.)\";"
+ );
+ }
+
+ @Test
+ void testHtmlEntities() {
+ // Window title using entities.
+ String title = "Testing entities <script>alert(\"Should not pop up\")</script>.";
+
+ javadoc("-d", "out-html-entities",
+ "-windowtitle", title,
+ "-sourcepath", testSrc,
+ "p1", "p2");
+
+ checkOutput("overview-summary.html", true,
+ "parent.document.title=\"Overview (Testing entities <script>alert(\\\"Should "
+ + "not pop up\\\")</script>.)\";"
+ );
+
+ checkOutput("overview-summary.html", false,
+ "parent.document.title=\"Overview (Testing entities alert(\\\"Should not pop up\\\").)\";"
+ );
+ }
+
+ @Test
+ void testEmptyTags() {
+ // Window title with just empty HTML tags.
+ String title = "</title><script></script>";
+
+ javadoc("-d", "out-empty-tags",
+ "-windowtitle", title,
+ "-sourcepath", testSrc,
+ "p1", "p2");
+
+ checkOutput("overview-summary.html", true,
+ "parent.document.title=\"Overview\";"
+ );
+
+ checkOutput("overview-summary.html", false,
+ "parent.document.title=\"Overview (</title><script></script>)\";"
+ );
+ }
+
+ @Test
+ void testUnicode() {
+ //Window title with unicode characters.
+ String title = "Testing unicode \u003cscript\u003ealert(\"Should not pop up\")\u003c/script\u003e.";
+
+ javadoc("-d", "out-unicode",
+ "-windowtitle", title,
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
+
+ checkOutput("overview-summary.html", true,
+ "parent.document.title=\"Overview (Testing unicode alert(\\\"Should "
+ + "not pop up\\\").)\";"
+ );
+
+ checkOutput("overview-summary.html", false,
+ "parent.document.title=\"Overview (Testing unicode <script>alert(\\\"Should not pop up\\\")"
+ + "</script>.)\";"
+ );
+ }
+
+ @Test
+ void testEmpty() {
+ // An empty window title.
+ String title = "";
+ javadoc("-d", "out-empty",
+ "-windowtitle", title,
+ "-sourcepath", testSrc, "p1", "p2");
+ checkExit(Exit.OK);
+
+ checkOutput("overview-summary.html", true,
+ "parent.document.title=\"Overview\";"
+ );
+ }
+
+ @Test
+ void testDocTitle() {
+ // Window title with JavaScript special characters, specified with -doctitle
+ String title = "Testing \"Window 'Title'\" with a \\ backslash and a / "
+ + "forward slash and a \u00e8 unicode char also a tab and also a "
+ + "\t special character another \u0002 unicode)";
+
+ javadoc("-d", "out-doctitle",
+ "-doctitle", title,
+ "-sourcepath", testSrc,
+ "p1", "p2");
+ checkExit(Exit.OK);
+
+ checkOutput("overview-summary.html", false,
+ "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" "
+ + "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char "
+ + "also a tab and also a \\t special character another \\u0002 unicode)\";"
+ );
+ }
}
--- a/langtools/test/com/sun/javadoc/testXOption/TestXOption.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testXOption/TestXOption.java Fri May 23 09:05:24 2014 -0700
@@ -25,43 +25,48 @@
* @test
* @bug 8007687
* @summary Make sure that the -X option works properly.
- * @library ../lib/
- * @build JavadocTester TestXOption
+ * @library ../lib
+ * @build JavadocTester
* @run main TestXOption
*/
public class TestXOption extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-X",
- SRC_DIR + "/TestXOption.java"
- };
+ public static void main(String... args) throws Exception {
+ TestXOption tester = new TestXOption();
+ tester.runTests();
+ }
- private static final String[] ARGS2 = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- SRC_DIR + "/TestXOption.java"
- };
+ @Test
+ void testWithOption() {
+ javadoc("-d", "out1",
+ "-sourcepath", testSrc,
+ "-X",
+ testSrc("TestXOption.java"));
+ checkExit(Exit.OK);
+ checkOutput(true);
+ }
- private static final String[][] TEST = {
- {NOTICE_OUTPUT, "-Xmaxerrs "},
- {NOTICE_OUTPUT, "-Xmaxwarns "},
- {STANDARD_OUTPUT, "-Xdocrootparent "},
- {STANDARD_OUTPUT, "-Xdoclint "},
- {STANDARD_OUTPUT, "-Xdoclint:"},
- };
+ @Test
+ void testWithoutOption() {
+ javadoc("-d", "out2",
+ "-sourcepath", testSrc,
+ testSrc("TestXOption.java"));
+ checkExit(Exit.OK);
+ checkOutput(false);
+ }
- //The help option should not crash the doclet.
- private static final int EXPECTED_EXIT_CODE = 0;
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestXOption tester = new TestXOption();
- int actualExitCode = tester.run(ARGS, TEST, NO_TEST);
- tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
- tester.printSummary();
+ private void checkOutput(boolean expectFound) {
+ // TODO: It's an ugly hidden side-effect of the current doclet API
+ // that the -X output from the tool and the -X output from the doclet
+ // come out on different streams!
+ // When we clean up the doclet API, this should be rationalized.
+ checkOutput(Output.NOTICE, expectFound,
+ "-Xmaxerrs ",
+ "-Xmaxwarns ");
+ checkOutput(Output.STDOUT, expectFound,
+ "-Xdocrootparent ",
+ "-Xdoclint ",
+ "-Xdoclint:");
}
}
--- a/langtools/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java Fri May 23 09:05:24 2014 -0700
@@ -27,91 +27,84 @@
* @summary Smoke test for ensuring that annotations are emitted to javadoc
*
* @author Mahmood Ali <mali>
- * @library ../../lib/
+ * @library ../../lib
* @ignore
* @build JavadocTester
- * @build TestSmoke
* @run main TestSmoke
*/
public class TestSmoke extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-private", "-sourcepath", SRC_DIR, "pkg"
- };
+ public static void main(String... args) throws Exception {
+ TestSmoke tester = new TestSmoke();
+ tester.runTests();
+ }
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/T0x1C.html", "@DA"},
- { "pkg/T0x1D.html", "@DA"},
- { "pkg/T0x0D.html", "@DA"},
- { "pkg/T0x06.html", "@DA"},
- { "pkg/T0x0B.html", "@DA"},
- { "pkg/T0x0F.html", "@DA"},
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-private",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/T0x1C.html", true, "@DA");
+ checkOutput("pkg/T0x1D.html", true, "@DA");
+ checkOutput("pkg/T0x0D.html", true, "@DA");
+ checkOutput("pkg/T0x06.html", true, "@DA");
+ checkOutput("pkg/T0x0B.html", true, "@DA");
+ checkOutput("pkg/T0x0F.html", true, "@DA");
/* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
- { "pkg/T0x20.html", "@DA"},
+ checkOutput("pkg/T0x20.html", true, "@DA");
*/
/* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
- { "pkg/T0x20A.html", "@DTPA"},
+ checkOutput("pkg/T0x20A.html", true, "@DTPA");
*/
/* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
- { "pkg/T0x20B.html", "@DA"},
+ checkOutput("pkg/T0x20B.html", true, "@DA");
*/
/* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
- { "pkg/T0x22.html", "@DA"},
+ checkOutput("pkg/T0x22.html", true, "@DA");
*/
/* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
- { "pkg/T0x22A.html", "@DTPA"},
+ checkOutput("pkg/T0x22A.html", true, "@DTPA");
*/
/* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java
- { "pkg/T0x22B.html", "@DA"},
+ checkOutput("pkg/T0x22B.html", true, "@DA");
*/
- { "pkg/T0x10.html", "@DA"},
- { "pkg/T0x10A.html", "@DA"},
- { "pkg/T0x12.html", "@DA"},
- { "pkg/T0x11.html", "@DA"},
- { "pkg/T0x13.html", "@DA"},
- { "pkg/T0x15.html", "@DA"},
- { "pkg/T0x14.html", "@DA"},
- { "pkg/T0x16.html", "@DA"}
- };
+ checkOutput("pkg/T0x10.html", true, "@DA");
+ checkOutput("pkg/T0x10A.html", true, "@DA");
+ checkOutput("pkg/T0x12.html", true, "@DA");
+ checkOutput("pkg/T0x11.html", true, "@DA");
+ checkOutput("pkg/T0x13.html", true, "@DA");
+ checkOutput("pkg/T0x15.html", true, "@DA");
+ checkOutput("pkg/T0x14.html", true, "@DA");
+ checkOutput("pkg/T0x16.html", true, "@DA");
- private static final String[][] NEGATED_TEST = {
- { "pkg/T0x1C.html", "@A"},
- { "pkg/T0x1D.html", "@A"},
- { "pkg/T0x00.html", "@A"},
- { "pkg/T0x01.html", "@A"},
- { "pkg/T0x02.html", "@A"},
- { "pkg/T0x04.html", "@A"},
- { "pkg/T0x08.html", "@A"},
- { "pkg/T0x0D.html", "@A"},
- { "pkg/T0x06.html", "@A"},
- { "pkg/T0x0B.html", "@A"},
- { "pkg/T0x0F.html", "@A"},
- { "pkg/T0x20.html", "@A"},
- { "pkg/T0x20A.html", "@A"},
- { "pkg/T0x20B.html", "@A"},
- { "pkg/T0x22.html", "@A"},
- { "pkg/T0x22A.html", "@A"},
- { "pkg/T0x22B.html", "@A"},
- { "pkg/T0x10.html", "@A"},
- { "pkg/T0x10A.html", "@A"},
- { "pkg/T0x12.html", "@A"},
- { "pkg/T0x11.html", "@A"},
- { "pkg/T0x13.html", "@A"},
- { "pkg/T0x15.html", "@A"},
- { "pkg/T0x14.html", "@A"},
- { "pkg/T0x16.html", "@A"}
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestSmoke tester = new TestSmoke();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ checkOutput("pkg/T0x1C.html", false, "@A");
+ checkOutput("pkg/T0x1D.html", false, "@A");
+ checkOutput("pkg/T0x00.html", false, "@A");
+ checkOutput("pkg/T0x01.html", false, "@A");
+ checkOutput("pkg/T0x02.html", false, "@A");
+ checkOutput("pkg/T0x04.html", false, "@A");
+ checkOutput("pkg/T0x08.html", false, "@A");
+ checkOutput("pkg/T0x0D.html", false, "@A");
+ checkOutput("pkg/T0x06.html", false, "@A");
+ checkOutput("pkg/T0x0B.html", false, "@A");
+ checkOutput("pkg/T0x0F.html", false, "@A");
+ checkOutput("pkg/T0x20.html", false, "@A");
+ checkOutput("pkg/T0x20A.html", false, "@A");
+ checkOutput("pkg/T0x20B.html", false, "@A");
+ checkOutput("pkg/T0x22.html", false, "@A");
+ checkOutput("pkg/T0x22A.html", false, "@A");
+ checkOutput("pkg/T0x22B.html", false, "@A");
+ checkOutput("pkg/T0x10.html", false, "@A");
+ checkOutput("pkg/T0x10A.html", false, "@A");
+ checkOutput("pkg/T0x12.html", false, "@A");
+ checkOutput("pkg/T0x11.html", false, "@A");
+ checkOutput("pkg/T0x13.html", false, "@A");
+ checkOutput("pkg/T0x15.html", false, "@A");
+ checkOutput("pkg/T0x14.html", false, "@A");
+ checkOutput("pkg/T0x16.html", false, "@A");
}
}
--- a/langtools/test/tools/javac/T8029569/VarargsAmbiguityCrashTest.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/T8029569/VarargsAmbiguityCrashTest.java Fri May 23 09:05:24 2014 -0700
@@ -1,30 +1,8 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 8029569
+ * @test /nodynamiccopyright/
+ * @bug 8029569 8037379
* @summary internal javac cast exception when resolving varargs ambiguity
+ * fix for JDK-8029569 doesn't cover all possible cases
* @compile/fail/ref=VarargsAmbiguityCrashTest.out -XDrawDiagnostics VarargsAmbiguityCrashTest.java
*/
--- a/langtools/test/tools/javac/T8029569/VarargsAmbiguityCrashTest.out Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/T8029569/VarargsAmbiguityCrashTest.out Fri May 23 09:05:24 2014 -0700
@@ -1,2 +1,2 @@
-VarargsAmbiguityCrashTest.java:33:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(java.lang.Exception...), VarargsAmbiguityCrashTest, kindname.method, m2(java.lang.Long,java.lang.Exception...), VarargsAmbiguityCrashTest
+VarargsAmbiguityCrashTest.java:11:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(java.lang.Exception...), VarargsAmbiguityCrashTest, kindname.method, m2(java.lang.Long,java.lang.Exception...), VarargsAmbiguityCrashTest
1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java Fri May 23 09:05:24 2014 -0700
@@ -42,7 +42,7 @@
public class Driver {
- private static final PrintStream out = System.out;
+ private static final PrintStream out = System.err;
public static void main(String[] args) throws Exception {
if (args.length == 0 || args.length > 1)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/taskListeners/EventsBalancedTest.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8040822
+ * @summary Check that all TaskEvents are balanced.
+ */
+
+import java.io.*;
+import java.net.URI;
+import java.util.*;
+import java.util.Map.Entry;
+
+import javax.tools.*;
+
+import com.sun.source.util.*;
+import com.sun.source.util.TaskEvent.Kind;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.comp.CompileStates.CompileState;
+
+public class EventsBalancedTest {
+ JavacTool tool = (JavacTool) ToolProvider.getSystemJavaCompiler();
+ StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+
+ public static void main(String... args) throws IOException {
+ new EventsBalancedTest().test();
+ }
+
+ void test() throws IOException {
+ TestSource a = new TestSource("B", "class B extends A { }");
+ TestSource b = new TestSource("A", "abstract class A { }");
+
+ test(null, Arrays.asList(a, b));
+ test(null, Arrays.asList(b, a));
+ test(Arrays.asList("-XD-relax"), Arrays.asList(a, b));
+ test(Arrays.asList("-XD-relax"), Arrays.asList(b, a));
+
+ for (CompileState stop : CompileState.values()) {
+ test(Arrays.asList("-XDshouldStopPolicyIfNoError=" + stop,
+ "-XDshouldStopPolicyIfError=" + stop),
+ Arrays.asList(a, b));
+ test(Arrays.asList("-XDshouldStopPolicyIfNoError=" + stop,
+ "-XDshouldStopPolicyIfError=" + stop),
+ Arrays.asList(b, a));
+ }
+ }
+
+ void test(Iterable<String> options, Iterable<JavaFileObject> files) throws IOException {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ TestListener listener = new TestListener();
+ JavacTask task = tool.getTask(pw, fm, null, options, null, files);
+
+ task.setTaskListener(listener);
+
+ task.call();
+
+ for (Entry<Kind, Integer> e : listener.kind2Count.entrySet()) {
+ if (e.getValue() != null && e.getValue() != 0) {
+ throw new IllegalStateException("Not balanced event: " + e.getKey());
+ }
+ }
+ }
+
+ static class TestListener implements TaskListener {
+ final Map<Kind, Integer> kind2Count = new HashMap<>();
+
+ int get(Kind k) {
+ Integer count = kind2Count.get(k);
+
+ if (count == null)
+ kind2Count.put(k, count = 0);
+
+ return count;
+ }
+
+ @Override
+ public void started(TaskEvent e) {
+ kind2Count.put(e.getKind(), get(e.getKind()) + 1);
+ }
+
+ @Override
+ public void finished(TaskEvent e) {
+ int count = get(e.getKind());
+
+ if (count <= 0)
+ throw new IllegalStateException("count<=0 for: " + e.getKind());
+
+ kind2Count.put(e.getKind(), count - 1);
+ }
+
+ }
+ static class TestSource extends SimpleJavaFileObject {
+ final String content;
+ public TestSource(String fileName, String content) {
+ super(URI.create("myfo:/" + fileName + ".java"), JavaFileObject.Kind.SOURCE);
+ this.content = content;
+ }
+
+ @Override
+ public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+ return content;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/T8028503/PrimitiveTypeInBoundForMethodRefTest.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8028503
+ * @summary javac, for method references a primitive type can be added as a bound
+ * @compile PrimitiveTypeInBoundForMethodRefTest.java
+ */
+
+class PrimitiveTypeInBoundForMethodRefTest {
+
+ interface Mapper<T, U> {
+ U map(T t);
+ }
+
+ static <U> Iterable<U> map(Mapper<String, U> mapper) {
+ return null;
+ }
+
+ static void test() {
+ Iterable<Integer> map = map(PrimitiveTypeInBoundForMethodRefTest::length);
+ }
+
+ public static <T> int length(String s) {
+ return 0;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/IntersectionSubVar.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8042656
+ * @summary Subtyping for intersection types containing type variables
+ * @compile IntersectionSubVar.java
+ */
+
+class IntersectionSubVar {
+
+ interface Box<T> {
+ void set(T arg);
+ T get();
+ }
+
+ <I> Box<I> glb(Box<? super I> arg1, Box<? super I> arg2) {
+ return null;
+ }
+
+ <E extends Cloneable> void takeBox(Box<? super E> box) {}
+
+ <T> void test(Box<T> arg1, Box<Cloneable> arg2, Box<? super T> arg3) {
+ T t = glb(arg1, arg2).get(); // assign T&Cloneable to T
+ takeBox(arg3); // inference tests Box<CAP> <: Box<? super CAP&Cloneable>
+ }
+
+}
--- a/langtools/test/tools/javac/lambda/MethodReference42.out Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/lambda/MethodReference42.out Fri May 23 09:05:24 2014 -0700
@@ -1,4 +1,4 @@
-MethodReference42.java:38:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference42.SAM1, @811, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number))
-MethodReference42.java:40:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference42.SAM3, @855, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number))
+MethodReference42.java:38:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference42.SAM1, @811, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)))
+MethodReference42.java:40:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference42.SAM3, @855, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number)))
MethodReference42.java:41:9: compiler.err.ref.ambiguous: m4, kindname.method, m4(MethodReference42.SAM2), MethodReference42, kindname.method, m4(MethodReference42.SAM3), MethodReference42
3 errors
--- a/langtools/test/tools/javac/lambda/MethodReference44.out Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/lambda/MethodReference44.out Fri May 23 09:05:24 2014 -0700
@@ -1,4 +1,4 @@
-MethodReference44.java:40:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference44.SAM1, @864, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number))
-MethodReference44.java:42:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference44.SAM3, @932, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number))
+MethodReference44.java:40:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference44.SAM1, @864, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)))
+MethodReference44.java:42:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference44.SAM3, @932, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number)))
MethodReference44.java:43:9: compiler.err.ref.ambiguous: g4, kindname.method, g4(MethodReference44.SAM2), MethodReference44, kindname.method, g4(MethodReference44.SAM3), MethodReference44
3 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific10.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8034223
+ * @summary Structural most-specific logic for lambdas, method refs, parens, and conditionals
+ * @compile MostSpecific10.java
+ */
+class MostSpecific10 {
+
+ interface GetInt {
+ int get();
+ }
+
+ interface GetInteger {
+ Integer get();
+ }
+
+ void m(GetInt getter) {}
+ void m(GetInteger getter) {}
+
+ void test(boolean cond) {
+ m(() -> 23);
+ m("abc"::length);
+ m(( () -> 23 ));
+ m(( "abc"::length ));
+ m(cond ? () -> 23 : "abc"::length);
+ m(( cond ? () -> 23 : "abc"::length ));
+ m(cond ? (() -> 23) : ("abc"::length) );
+ m(( cond ? () -> 23 : cond ? ("abc"::length) : (() -> 23) ));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific11.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8034223
+ * @summary Return type Object is not more specific than return type String
+ * @compile MostSpecific11.java
+ */
+class MostSpecific11 {
+
+ interface I { Object run(); }
+ interface J { String run(); }
+
+ void m(I arg) {}
+ void m(J arg) {}
+
+ void test() {
+ m(() -> { throw new RuntimeException(); });
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific12.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8034223
+ * @summary Most-specific testing with inference variables in function parameter types
+ * @compile/fail/ref=MostSpecific12.out -XDrawDiagnostics MostSpecific12.java
+ */
+class MostSpecific12 {
+
+ interface I<T> { void take(T arg1, String arg2); }
+ interface J<T> { void take(String arg1, T arg2); }
+ interface K { void take(String arg1, String arg2); }
+
+ <T> void m1(I<T> arg) {}
+ void m1(K arg) {}
+
+ <T> void m2(J<T> arg) {}
+ <T> void m2(K arg) {}
+
+ <T> void m3(I<T> arg) {}
+ <T> void m3(J<T> arg) {}
+
+ void test() {
+ m1((String s1, String s2) -> {}); // ok
+ m2((String s1, String s2) -> {}); // ok
+ m3((String s1, String s2) -> {}); // error
+
+ m1(this::referencedMethod); // ok
+ m2(this::referencedMethod); // ok
+ m3(this::referencedMethod); // error
+
+ m1(String::compareTo); // ok
+ m2(String::compareTo); // ok
+ m3(String::compareTo); // error
+ }
+
+ void referencedMethod(String s1, String s2) {}
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific12.out Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,4 @@
+MostSpecific12.java:25:9: compiler.err.ref.ambiguous: m3, kindname.method, <T>m3(MostSpecific12.I<T>), MostSpecific12, kindname.method, <T>m3(MostSpecific12.J<T>), MostSpecific12
+MostSpecific12.java:29:9: compiler.err.ref.ambiguous: m3, kindname.method, <T>m3(MostSpecific12.I<T>), MostSpecific12, kindname.method, <T>m3(MostSpecific12.J<T>), MostSpecific12
+MostSpecific12.java:33:9: compiler.err.ref.ambiguous: m3, kindname.method, <T>m3(MostSpecific12.I<T>), MostSpecific12, kindname.method, <T>m3(MostSpecific12.J<T>), MostSpecific12
+3 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific13.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8034223
+ * @summary Most-specific testing with inference variables in function parameter types
+ * @compile/fail/ref=MostSpecific13.out -XDrawDiagnostics MostSpecific13.java
+ */
+class MostSpecific13 {
+
+ interface UnaryOp<T> { T apply(T arg); }
+ interface IntegerToNumber { Number apply(Integer arg); }
+
+ <T> void m(UnaryOp<T> f) {}
+ void m(IntegerToNumber f) {}
+
+ void test() {
+ m((Integer i) -> i); // error
+ m(this::id); // error
+ }
+
+ Integer id(Integer arg) { return arg; }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific13.out Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,3 @@
+MostSpecific13.java:16:9: compiler.err.ref.ambiguous: m, kindname.method, <T>m(MostSpecific13.UnaryOp<T>), MostSpecific13, kindname.method, m(MostSpecific13.IntegerToNumber), MostSpecific13
+MostSpecific13.java:17:9: compiler.err.ref.ambiguous: m, kindname.method, <T>m(MostSpecific13.UnaryOp<T>), MostSpecific13, kindname.method, m(MostSpecific13.IntegerToNumber), MostSpecific13
+2 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific14.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,33 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8034223
+ * @summary Most-specific testing for nested functional interface types
+ * @compile/fail/ref=MostSpecific14.out -XDrawDiagnostics MostSpecific14.java
+ */
+class MostSpecific14 {
+ interface ToNumber { Number get(); }
+ interface ToToNumber { ToNumber get(); }
+ interface Factory<T> { T get(); }
+
+ void m1(Factory<Factory<Object>> f) {}
+ void m1(ToToNumber f) {}
+
+ void m2(Factory<Factory<Number>> f) {}
+ void m2(ToToNumber f) {}
+
+ void m3(Factory<Factory<Integer>> f) {}
+ void m3(ToToNumber f) {}
+
+
+ void test() {
+ m1(() -> () -> 23); // ok: choose ToToNumber
+ m2(() -> () -> 23); // error: ambiguous
+ m3(() -> () -> 23); // ok: choose Factory<Factory<Integer>>
+
+ m1(() -> this::getInteger); // ok: choose ToToNumber
+ m2(() -> this::getInteger); // error: ambiguous
+ m3(() -> this::getInteger); // ok: choose Factory<Factory<Integer>>
+ }
+
+ Integer getInteger() { return 23; }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific14.out Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,3 @@
+MostSpecific14.java:24:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(MostSpecific14.Factory<MostSpecific14.Factory<java.lang.Number>>), MostSpecific14, kindname.method, m2(MostSpecific14.ToToNumber), MostSpecific14
+MostSpecific14.java:28:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(MostSpecific14.Factory<MostSpecific14.Factory<java.lang.Number>>), MostSpecific14, kindname.method, m2(MostSpecific14.ToToNumber), MostSpecific14
+2 errors
--- a/langtools/test/tools/javac/lambda/TargetType16.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/lambda/TargetType16.java Fri May 23 09:05:24 2014 -0700
@@ -1,9 +1,9 @@
/*
* @test /nodynamiccopyright/
- * @bug 8003280
+ * @bug 8003280 8034223
* @summary Add lambda tests
* Check void-compatibility in strict vs. loose conversion contexts
- * @compile/fail/ref=TargetType16.out -XDrawDiagnostics TargetType16.java
+ * @compile TargetType16.java
*/
class TargetType16 {
@@ -20,6 +20,6 @@
static <T> void m(SAM2<T> s2) { }
public static void main(String[] args) {
- m(() -> { throw new AssertionError(); }); //ambiguous
+ m(() -> { throw new AssertionError(); }); // prefer SAM2
}
}
--- a/langtools/test/tools/javac/lambda/TargetType16.out Tue May 13 10:29:12 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-TargetType16.java:23:9: compiler.err.ref.ambiguous: m, kindname.method, m(TargetType16.SAM1), TargetType16, kindname.method, <T>m(TargetType16.SAM2<T>), TargetType16
-1 error
--- a/langtools/test/tools/javac/lambda/TargetType23.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/lambda/TargetType23.java Fri May 23 09:05:24 2014 -0700
@@ -31,7 +31,12 @@
void call(Sam2 s) { }
<Z> void call(Sam3<Z> s) { }
+ void call2(Sam0 s) { }
+ void call2(Sam2 s) { }
+ <Z> void call2(Sam3<Z> s) { }
+
void test() {
- call(()-> { throw new RuntimeException(); }); //ambiguous - both call(Sam0), call(Sam2), call(Sam3) match
+ call(()-> { throw new RuntimeException(); }); // ambiguous - call(Sam1) vs. call(Sam2)
+ call2(()-> { throw new RuntimeException(); }); // ok
}
}
--- a/langtools/test/tools/javac/lambda/TargetType23.out Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/lambda/TargetType23.out Fri May 23 09:05:24 2014 -0700
@@ -1,2 +1,2 @@
-TargetType23.java:35:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType23.Sam2), TargetType23, kindname.method, <Z>call(TargetType23.Sam3<Z>), TargetType23
+TargetType23.java:39:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType23.Sam1), TargetType23, kindname.method, call(TargetType23.Sam2), TargetType23
1 error
--- a/langtools/test/tools/javac/options/xprefer/XPreferTest.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/options/xprefer/XPreferTest.java Fri May 23 09:05:24 2014 -0700
@@ -26,6 +26,7 @@
* @summary Tests which path is used to represent an implicit type given
* various xprefer arguments and multiple .class / .java files involved.
* @bug 8028196
+ * @ignore 8042839 XPreferTest fails on Windows
*/
import java.io.File;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/resolve/AmbiguityErrorTest.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8041663
+ */
+
+public class AmbiguityErrorTest {
+
+ public interface A { }
+
+ public interface B extends A { }
+
+ public interface C {
+ A m(B strategy);
+ }
+
+ public interface D {
+ A m(A strategy);
+ A m(B strategy);
+ }
+
+ public interface T1 extends C, D { }
+ public interface T2 extends D, C { }
+
+ int count;
+
+ class T1Impl implements T1, T2 {
+ public A m(B strategy) {
+ count++;
+ return null;
+ }
+ public A m(A strategy) {
+ throw new AssertionError("Should not get here.");
+ }
+ }
+
+ public static void main(String... args) {
+ new AmbiguityErrorTest().test();
+ }
+
+ void test() {
+ T1 t1 = new T1Impl();
+ T2 t2 = new T1Impl();
+ final B b = new B() { };
+ t1.m(b);
+ t2.m(b);
+
+ if (count != 2) {
+ throw new IllegalStateException("Did not call the methods properly");
+ }
+ }
+
+}
--- a/langtools/test/tools/javac/resolve/ResolveHarness.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/resolve/ResolveHarness.java Fri May 23 09:05:24 2014 -0700
@@ -23,8 +23,8 @@
/*
* @test
- * @bug 7098660 8014649
- * @summary Write better overload resolution/inference tests
+ * @bug 7098660 8014649 8034223
+ * @summary Test harness for overload resolution/inference tests
* @library /tools/javac/lib
* @build JavacTestingAbstractProcessor ResolveHarness
* @run main ResolveHarness
--- a/langtools/test/tools/javac/resolve/tests/PrimitiveOverReferenceVarargsAmbiguous.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/resolve/tests/PrimitiveOverReferenceVarargsAmbiguous.java Fri May 23 09:05:24 2014 -0700
@@ -23,44 +23,44 @@
@TraceResolve(keys={"compiler.err.ref.ambiguous"})
class PrimitiveOverReferenceVarargsAmbiguous {
- @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_byte(byte... b) {}
- @Candidate(applicable=Phase.VARARGS)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_byte(Byte... b) {}
- @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_short(short... s) {}
- @Candidate(applicable=Phase.VARARGS)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_short(Short... s) {}
- @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_int(int... i) {}
- @Candidate(applicable=Phase.VARARGS)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_int(Integer... i) {}
- @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_long(long... l) {}
- @Candidate(applicable=Phase.VARARGS)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_long(Long... l) {}
- @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_float(float... f) {}
- @Candidate(applicable=Phase.VARARGS)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_float(Float... f) {}
- @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_double(double... d) {}
- @Candidate(applicable=Phase.VARARGS)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_double(Double... d) {}
- @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_char(char... c) {}
- @Candidate(applicable=Phase.VARARGS)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_char(Character... c) {}
- @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_bool(boolean... z) {}
- @Candidate(applicable=Phase.VARARGS)
+ @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
static void m_bool(Boolean... z) {}
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/resolve/tests/PrimitiveVsReferenceSamePhase.java Fri May 23 09:05:24 2014 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+@TraceResolve(keys={"compiler.err.ref.ambiguous"})
+class PrimitiveVsReferenceSamePhase {
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_byte(Byte b1, byte b2) {}
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_byte(Byte b1, Byte b2) {}
+
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_short(Short s1, short s2) {}
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_short(Short s1, Short s2) {}
+
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_int(Integer i1, int i2) {}
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_int(Integer i1, Integer i2) {}
+
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_long(Long l1, long l2) {}
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_long(Long l1, Long l2) {}
+
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_float(Float f1, float f2) {}
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_float(Float f1, Float f2) {}
+
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_double(Double d1, double d2) {}
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_double(Double d1, Double d2) {}
+
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_char(Character c1, char c2) {}
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_char(Character c1, Character c2) {}
+
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_bool(Boolean z1, boolean z2) {}
+ @Candidate(applicable=Phase.BOX, mostSpecific=false)
+ static void m_bool(Boolean z1, Boolean z2) {}
+
+ {
+ m_byte((byte)0, (byte)0);
+ m_short((short)0, (short)0);
+ m_int(0, 0);
+ m_long(0L, 0L);
+ m_float(0.0f, 0.0f);
+ m_double(0.0, 0.0);
+ m_char('?', '?');
+ m_bool(false, false);
+ }
+}
--- a/langtools/test/tools/javac/types/TypeHarness.java Tue May 13 10:29:12 2014 -0700
+++ b/langtools/test/tools/javac/types/TypeHarness.java Fri May 23 09:05:24 2014 -0700
@@ -255,7 +255,8 @@
public ClassType Class(long flags, Type... typeArgs) {
ClassSymbol csym = new ClassSymbol(flags, syntheticName(), predef.noSymbol);
- csym.type = new ClassType(Type.noType, List.from(typeArgs), csym);
+ csym.type = new ClassType(Type.noType, List.from(typeArgs), csym,
+ Type.noAnnotations);
((ClassType)csym.type).supertype_field = predef.objectType;
return (ClassType)csym.type;
}
@@ -301,7 +302,7 @@
}
public ArrayType Array(Type elemType) {
- return new ArrayType(elemType, predef.arrayClass);
+ return new ArrayType(elemType, predef.arrayClass, Type.noAnnotations);
}
public TypeVar TypeVariable() {
@@ -310,16 +311,16 @@
public TypeVar TypeVariable(Type bound) {
TypeSymbol tvsym = new TypeVariableSymbol(0, syntheticName(), null, predef.noSymbol);
- tvsym.type = new TypeVar(tvsym, bound, null);
+ tvsym.type = new TypeVar(tvsym, bound, null, Type.noAnnotations);
return (TypeVar)tvsym.type;
}
public WildcardType Wildcard(BoundKind bk, Type bound) {
- return new WildcardType(bound, bk, predef.boundClass);
+ return new WildcardType(bound, bk, predef.boundClass, Type.noAnnotations);
}
public CapturedType CapturedVariable(Type upper, Type lower) {
- return new CapturedType(syntheticName(), predef.noSymbol, upper, lower, null);
+ return new CapturedType(syntheticName(), predef.noSymbol, upper, lower, null, Type.noAnnotations);
}
public ClassType Intersection(Type classBound, Type... intfBounds) {
--- a/nashorn/.hgtags Tue May 13 10:29:12 2014 -0700
+++ b/nashorn/.hgtags Fri May 23 09:05:24 2014 -0700
@@ -246,3 +246,4 @@
0eaa55c7abe5d96023a4b38a326f411209c43f49 jdk9-b10
4d60c3292e14aac90dc3b8232496ba4af4254cc3 jdk9-b11
282e9a675e079cc84dbfaa4c10050f08397faab0 jdk9-b12
+be4580ae56e2ef0ce521d3f840753eaa83cacf33 jdk9-b13
--- a/nashorn/make/build.xml Tue May 13 10:29:12 2014 -0700
+++ b/nashorn/make/build.xml Fri May 23 09:05:24 2014 -0700
@@ -279,6 +279,10 @@
<target name="generate-policy-file" depends="prepare">
<echo file="${build.dir}/nashorn.policy">
+grant codeBase "file:/${toString:nashorn.ext.path}/nashorn.jar" {
+ permission java.security.AllPermission;
+};
+
grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" {
permission java.security.AllPermission;
};