com.sun.tdk.signaturetest
Class SigTest

java.lang.Object
  extended by com.sun.tdk.signaturetest.Result
      extended by com.sun.tdk.signaturetest.SigTest
All Implemented Interfaces:
Log, PluginAPI
Direct Known Subclasses:
Merge, Setup, SignatureTest

public abstract class SigTest
extends Result
implements PluginAPI, Log

This class represents core part of the signature tests. It provides tools for parsing core parameters and defining core attributes of the classes such as accessibility and appurtenance to the required packages.

This class parses the following options core for signature tests:

-Package <package>
-PackageWithoutSubpackages <package>
-Exclude <package_or_class_name>
-Classpath <path>
-APIversion <version>
-static
-ClassCacheSize <number>
-AllPublic


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.tdk.signaturetest.plugin.PluginAPI
PluginAPI.InjectionPoint
 
Field Summary
static java.lang.String ALLPUBLIC_OPTION
           
protected  java.lang.String apiVersion
          Version of the product being tested.
static java.lang.String APIVERSION_OPTION
           
static java.lang.String BACKWARD_ALT_OPTION
           
static java.lang.String BACKWARD_OPTION
           
protected  int cacheSize
          BinaryClassDescrLoader may cache up to cacheSize classes being loaded.
static java.lang.String CLASSCACHESIZE_OPTION
           
protected  ClasspathImpl classpath
          Descriptions for all classes found at the specified classpath.
static java.lang.String CLASSPATH_OPTION
           
protected  java.lang.String classpathStr
          List of directories and/or zip-files containing the packages to be checked.
static boolean debug
           
static java.lang.String DEBUG_OPTION
           
static int DefaultCacheSize
           
static java.lang.String ERRORALL_OPTION
           
protected static ErrorFormatter errorManager
          Collector for error messages, or null if log is not required.
protected  java.util.Set errorMessages
           
protected  int errors
          number of the errors.
static java.lang.String EXCLUDE_OPTION
           
protected  PackageGroup excludedPackages
          List of names of packages to be ignored along with subpackages.
static java.lang.String EXTENSIBLE_INTERFACES_OPTION
           
static java.lang.String FILENAME_OPTION
           
static java.lang.String FORMATHUMAN_ALT_OPTION
           
static java.lang.String FORMATHUMAN_OPTION
           
static java.lang.String FORMATPLAIN_OPTION
           
static java.lang.String HELP_OPTION
           
static boolean isConstantValuesTracked
           
protected  boolean isStatic
           
static boolean isTigerFeaturesTracked
           
protected  ThrowsNormalizer normalizer
           
static java.lang.String OUT_OPTION
           
static java.lang.String PACKAGE_OPTION
           
protected  PackageGroup packages
          List of names of packages to be checked along with subpackages.
static java.lang.String PLUGIN_OPTION
           
protected  Plugin pluginClass
           
protected  PackageGroup purePackages
          List of names of packages to be checked excluding subpackages.
static java.lang.String QUESTIONMARK
           
protected  boolean reportWarningAsError
           
protected  java.lang.String sigFileName
           
protected  java.lang.String sigFileNameList
           
static java.lang.String STATIC_OPTION
           
protected  ClassHierarchy testableHierarchy
           
protected  MemberCollectionBuilder testableMCBuilder
          Either static or reflections-based class descriptions finder.
protected  java.lang.String testURL
           
static java.lang.String TESTURL_OPTION
           
protected  int trackMode
          Either equals to ALL_PUBLIC, or not.
static java.lang.String VERBOSE_OPTION
           
static java.lang.String VERSION_OPTION
           
static java.lang.String WITHOUTSUBPACKAGES_OPTION
           
static java.lang.String XNOTIGER_OPTION
           
static java.lang.String XVERBOSE_OPTION
           
 
Fields inherited from class com.sun.tdk.signaturetest.Result
NO_EXIT
 
Fields inherited from interface com.sun.tdk.signaturetest.plugin.PluginAPI
AFTER_BUILD_MEMBERS, AFTER_CLASS_CORRECTOR, BEFORE_TEST, CLASS_CORRECTOR, IS_CLASS_ACCESSIBLE, ON_CLASS_LOAD
 
Constructor Summary
SigTest()
           
 
Method Summary
 void addFormat(Format format, boolean useByDefault)
           
protected  boolean addInherited()
           
protected  void decodeCommonOptions(java.lang.String optionName, java.lang.String[] args)
           
protected  ClassDescriptionLoader getClassDescrLoader()
           
protected abstract  java.lang.String getComponentName()
           
 Context getContext()
           
protected  FileManager getFileManager()
           
 Filter getFilter(PluginAPI.InjectionPoint injectionPoint)
           
 java.io.PrintWriter getLog()
           
 int getNumErrors()
           
 int getNumWarnings()
           
 Transformer getTransformer(PluginAPI.InjectionPoint injectionPoint)
           
 void initErrors()
           
protected  boolean isPackageMember(java.lang.String name)
          Check if the given class name belongs to some of the packages marked to be tested.
protected  ClassDescription load(java.lang.String name)
           
protected  Plugin loadPlugin(java.lang.String pluginClassName)
           
protected  AnnotationItem[] normalizeArrayParaemeters(AnnotationItem[] annotations, java.util.Set exclusions)
           
 void printErrors()
           
protected  AnnotationItem[] removeUndocumentedAnnotations(AnnotationItem[] annotations, ClassHierarchy h)
           
 void setClassDescrLoader(ClassDescriptionLoader loader)
           
 void setFilter(PluginAPI.InjectionPoint injectionPoint, Filter filter)
           
 void setFormat(Format format)
           
protected  void setLog(java.io.PrintWriter w)
           
 void setTransformer(PluginAPI.InjectionPoint injectionPoint, Transformer transformer)
           
protected  void setupProblem(java.lang.String msg)
          prints error.
 void storeError(java.lang.String s, java.util.logging.Logger utilLogger)
           
 void storeWarning(java.lang.String s, java.util.logging.Logger utilLogger)
           
protected abstract  void usage()
           
 boolean useErasurator()
           
 
Methods inherited from class com.sun.tdk.signaturetest.Result
error, exit, failed, getReason, isPassed, notrun, passed, passed, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALLPUBLIC_OPTION

public static final java.lang.String ALLPUBLIC_OPTION
See Also:
Constant Field Values

CLASSPATH_OPTION

public static final java.lang.String CLASSPATH_OPTION
See Also:
Constant Field Values

PACKAGE_OPTION

public static final java.lang.String PACKAGE_OPTION
See Also:
Constant Field Values

WITHOUTSUBPACKAGES_OPTION

public static final java.lang.String WITHOUTSUBPACKAGES_OPTION
See Also:
Constant Field Values

EXCLUDE_OPTION

public static final java.lang.String EXCLUDE_OPTION
See Also:
Constant Field Values

STATIC_OPTION

public static final java.lang.String STATIC_OPTION
See Also:
Constant Field Values

APIVERSION_OPTION

public static final java.lang.String APIVERSION_OPTION
See Also:
Constant Field Values

VERSION_OPTION

public static final java.lang.String VERSION_OPTION
See Also:
Constant Field Values

DEBUG_OPTION

public static final java.lang.String DEBUG_OPTION
See Also:
Constant Field Values

HELP_OPTION

public static final java.lang.String HELP_OPTION
See Also:
Constant Field Values

QUESTIONMARK

public static final java.lang.String QUESTIONMARK
See Also:
Constant Field Values

CLASSCACHESIZE_OPTION

public static final java.lang.String CLASSCACHESIZE_OPTION
See Also:
Constant Field Values

VERBOSE_OPTION

public static final java.lang.String VERBOSE_OPTION
See Also:
Constant Field Values

XVERBOSE_OPTION

public static final java.lang.String XVERBOSE_OPTION
See Also:
Constant Field Values

XNOTIGER_OPTION

public static final java.lang.String XNOTIGER_OPTION
See Also:
Constant Field Values

OUT_OPTION

public static final java.lang.String OUT_OPTION
See Also:
Constant Field Values

FORMATPLAIN_OPTION

public static final java.lang.String FORMATPLAIN_OPTION
See Also:
Constant Field Values

FORMATHUMAN_OPTION

public static final java.lang.String FORMATHUMAN_OPTION
See Also:
Constant Field Values

FORMATHUMAN_ALT_OPTION

public static final java.lang.String FORMATHUMAN_ALT_OPTION
See Also:
Constant Field Values

BACKWARD_OPTION

public static final java.lang.String BACKWARD_OPTION
See Also:
Constant Field Values

BACKWARD_ALT_OPTION

public static final java.lang.String BACKWARD_ALT_OPTION
See Also:
Constant Field Values

EXTENSIBLE_INTERFACES_OPTION

public static final java.lang.String EXTENSIBLE_INTERFACES_OPTION
See Also:
Constant Field Values

FILENAME_OPTION

public static final java.lang.String FILENAME_OPTION
See Also:
Constant Field Values

TESTURL_OPTION

public static final java.lang.String TESTURL_OPTION
See Also:
Constant Field Values

PLUGIN_OPTION

public static final java.lang.String PLUGIN_OPTION
See Also:
Constant Field Values

ERRORALL_OPTION

public static final java.lang.String ERRORALL_OPTION
See Also:
Constant Field Values

testURL

protected java.lang.String testURL

sigFileNameList

protected java.lang.String sigFileNameList

sigFileName

protected java.lang.String sigFileName

trackMode

protected int trackMode
Either equals to ALL_PUBLIC, or not.


packages

protected PackageGroup packages
List of names of packages to be checked along with subpackages.


purePackages

protected PackageGroup purePackages
List of names of packages to be checked excluding subpackages.


excludedPackages

protected PackageGroup excludedPackages
List of names of packages to be ignored along with subpackages.


classpathStr

protected java.lang.String classpathStr
List of directories and/or zip-files containing the packages to be checked.

See Also:
File.pathSeparator

errorManager

protected static ErrorFormatter errorManager
Collector for error messages, or null if log is not required.


apiVersion

protected java.lang.String apiVersion
Version of the product being tested.


testableMCBuilder

protected MemberCollectionBuilder testableMCBuilder
Either static or reflections-based class descriptions finder.

See Also:
isStatic

normalizer

protected ThrowsNormalizer normalizer

isStatic

protected boolean isStatic

isConstantValuesTracked

public static boolean isConstantValuesTracked

DefaultCacheSize

public static final int DefaultCacheSize
See Also:
Constant Field Values

cacheSize

protected int cacheSize
BinaryClassDescrLoader may cache up to cacheSize classes being loaded.


debug

public static boolean debug

classpath

protected ClasspathImpl classpath
Descriptions for all classes found at the specified classpath.


isTigerFeaturesTracked

public static boolean isTigerFeaturesTracked

pluginClass

protected Plugin pluginClass

testableHierarchy

protected ClassHierarchy testableHierarchy

errorMessages

protected java.util.Set errorMessages

reportWarningAsError

protected boolean reportWarningAsError

errors

protected int errors
number of the errors.

Constructor Detail

SigTest

public SigTest()
Method Detail

initErrors

public void initErrors()

storeError

public void storeError(java.lang.String s,
                       java.util.logging.Logger utilLogger)
Specified by:
storeError in interface Log

storeWarning

public void storeWarning(java.lang.String s,
                         java.util.logging.Logger utilLogger)
Specified by:
storeWarning in interface Log

printErrors

public void printErrors()

setupProblem

protected void setupProblem(java.lang.String msg)
prints error.


setLog

protected void setLog(java.io.PrintWriter w)

getLog

public java.io.PrintWriter getLog()

decodeCommonOptions

protected void decodeCommonOptions(java.lang.String optionName,
                                   java.lang.String[] args)
                            throws CommandLineParserException
Throws:
CommandLineParserException

getNumErrors

public int getNumErrors()
Returns:
number of errors found during Setup or Test run if any

getNumWarnings

public int getNumWarnings()
Returns:
number of warnings found during Setup or Test run if any

isPackageMember

protected boolean isPackageMember(java.lang.String name)
Check if the given class name belongs to some of the packages marked to be tested.

See Also:
packages, purePackages, excludedPackages

setClassDescrLoader

public void setClassDescrLoader(ClassDescriptionLoader loader)
Specified by:
setClassDescrLoader in interface PluginAPI

getClassDescrLoader

protected ClassDescriptionLoader getClassDescrLoader()

load

protected ClassDescription load(java.lang.String name)

useErasurator

public boolean useErasurator()

usage

protected abstract void usage()

getComponentName

protected abstract java.lang.String getComponentName()

loadPlugin

protected Plugin loadPlugin(java.lang.String pluginClassName)

getFilter

public Filter getFilter(PluginAPI.InjectionPoint injectionPoint)
Specified by:
getFilter in interface PluginAPI

setFilter

public void setFilter(PluginAPI.InjectionPoint injectionPoint,
                      Filter filter)
Specified by:
setFilter in interface PluginAPI

getTransformer

public Transformer getTransformer(PluginAPI.InjectionPoint injectionPoint)
Specified by:
getTransformer in interface PluginAPI

setTransformer

public void setTransformer(PluginAPI.InjectionPoint injectionPoint,
                           Transformer transformer)
Specified by:
setTransformer in interface PluginAPI

addInherited

protected boolean addInherited()

getContext

public Context getContext()
Specified by:
getContext in interface PluginAPI

addFormat

public void addFormat(Format format,
                      boolean useByDefault)
Specified by:
addFormat in interface PluginAPI

setFormat

public void setFormat(Format format)
Specified by:
setFormat in interface PluginAPI

removeUndocumentedAnnotations

protected AnnotationItem[] removeUndocumentedAnnotations(AnnotationItem[] annotations,
                                                         ClassHierarchy h)

normalizeArrayParaemeters

protected AnnotationItem[] normalizeArrayParaemeters(AnnotationItem[] annotations,
                                                     java.util.Set exclusions)

getFileManager

protected FileManager getFileManager()