Class GenericResolutionTransformation

java.lang.Object
recoder.kit.Transformation
recoder.kit.TwoPassTransformation
de.uka.ilkd.key.util.removegenerics.GenericResolutionTransformation
Direct Known Subclasses:
ResolveMemberReference, ResolveTypeReference

public class GenericResolutionTransformation extends recoder.kit.TwoPassTransformation
This is the base class to all transformations used in the generics removal process.

It allows 2 things: 1) calculating the target type of a type (which is the type when type variables are no longer) and 2) to print out debug info.

String creation is a little tedious in recoder so toString(Object) does a lot of it.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static boolean
     

    Fields inherited from class recoder.kit.Transformation

    EQUIVALENCE, IDENTITY, NO_PROBLEM
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    GenericResolutionTransformation(recoder.CrossReferenceServiceConfiguration sc)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    debugOut(String msg, Object... arg)
    if the global debug flag DEBUG_OUTPUT is set to true print out a message.
    protected recoder.abstraction.Type
    targetType(recoder.abstraction.Type t)
    get the type of the reference that it will have in a generic-free environment.
    static String
    toString(Object object)
    convert an object to a String.

    Methods inherited from class recoder.kit.TwoPassTransformation

    analyze, execute, transform

    Methods inherited from class recoder.kit.Transformation

    attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attach, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsArgument, attachAsBody, attachAsCondition, attachAsGuard, attachAsInitializer, attachAsLabel, attachAsMessage, attachAsPrefix, attachAsPrefix, attachAsPrefix, attachAsPrefix, attachAsUpdate, detach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttach, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsArgument, doAttachAsBody, doAttachAsCondition, doAttachAsGuard, doAttachAsInitializer, doAttachAsLabel, doAttachAsMessage, doAttachAsPrefix, doAttachAsPrefix, doAttachAsPrefix, doAttachAsPrefix, doAttachAsUpdate, doDetach, doReplace, getChangeHistory, getCrossReferenceSourceInfo, getNameInfo, getProblemReport, getProgramFactory, getServiceConfiguration, getSourceFileRepository, getSourceInfo, isVisible, replace, rollback, setProblemReport, setServiceConfiguration, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEBUG_OUTPUT

      public static boolean DEBUG_OUTPUT
  • Constructor Details

    • GenericResolutionTransformation

      public GenericResolutionTransformation()
    • GenericResolutionTransformation

      public GenericResolutionTransformation(recoder.CrossReferenceServiceConfiguration sc)
  • Method Details

    • targetType

      protected recoder.abstraction.Type targetType(recoder.abstraction.Type t)
      get the type of the reference that it will have in a generic-free environment. If the expression once had type V for some (unbound) type variable it will then have java.lang.Object etc.
      Parameters:
      t - the type to be resolved
      Returns:
      the coresponding type in the generic-free environment
    • debugOut

      public static void debugOut(String msg, Object... arg)
      if the global debug flag DEBUG_OUTPUT is set to true print out a message.

      First the message-head is printed followed by a ':', followed by a ;-separated list of the arguments. Each argument is converted to a string using the toString(Object).

      Parameters:
      msg - the message's head
      arg - 0 or more objects that will be expanded to a ;-separated list after the message
    • toString

      public static String toString(Object object)
      convert an object to a String.

      For some classes Object.toString() is lame, so that the following classes are caught here:

      • MethodDeclaration
      • NamedModelElement
      • Collection - which handle each element with toString
      • Anything else will be transoformed using Object.toString().
      Parameters:
      object - the object to be transformed, may be null
      Returns:
      a String representing the object.