com.ibm.wala.cast.java.translator.polyglot
Class PolyglotIdentityMapper

java.lang.Object
  extended by com.ibm.wala.cast.java.translator.polyglot.PolyglotIdentityMapper
All Implemented Interfaces:
PolyglotJava2CAstTranslator.IdentityMapper<polyglot.types.Type,polyglot.types.CodeInstance,polyglot.types.FieldInstance>

public class PolyglotIdentityMapper
extends java.lang.Object
implements PolyglotJava2CAstTranslator.IdentityMapper<polyglot.types.Type,polyglot.types.CodeInstance,polyglot.types.FieldInstance>

Class responsible for mapping Polyglot type system objects representing types, methods and fields to the corresponding WALA TypeReferences, MethodReferences and FieldReferences. Used during translation and by clients to help correlate WALA analysis results to the various AST nodes.


Field Summary
protected  java.util.Map<polyglot.types.ClassType,polyglot.types.CodeInstance> fLocalTypeMap
          Map from Polyglot local ClassTypes to their enclosing methods.
 
Constructor Summary
PolyglotIdentityMapper(ClassLoaderReference clr, polyglot.types.TypeSystem ts)
           
 
Method Summary
 java.lang.String anonLocalTypeToTypeID(polyglot.types.ClassType ctype)
           
 java.lang.String composeDOMOTypeDescriptor(polyglot.types.ClassType ctype)
           
 java.lang.String composeDOMOTypeName(polyglot.types.ClassType ctype)
           
 FieldReference getFieldRef(polyglot.types.FieldInstance field)
           
 MethodReference getMethodRef(polyglot.types.CodeInstance method)
           
 TypeReference getTypeRef(polyglot.types.Type type)
           
 void mapLocalAnonTypeToMethod(polyglot.types.ClassType anonLocalType, polyglot.types.CodeInstance owningProc)
           
 java.lang.String typeToTypeID(polyglot.types.Type type)
          Translates the given Polyglot type to a name suitable for use in a DOMO TypeReference (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fLocalTypeMap

protected java.util.Map<polyglot.types.ClassType,polyglot.types.CodeInstance> fLocalTypeMap
Map from Polyglot local ClassTypes to their enclosing methods. Used by localTypeToTypeID().
Needed since Polyglot doesn't provide this information. (It doesn't need to, since it doesn't need to generate unambiguous names for such entities -- it hands the source off to javac to generate bytecode. It probably also wouldn't want to, since that would create back-pointers from Type objects in the TypeSystem to AST's.)

Constructor Detail

PolyglotIdentityMapper

public PolyglotIdentityMapper(ClassLoaderReference clr,
                              polyglot.types.TypeSystem ts)
Method Detail

getFieldRef

public FieldReference getFieldRef(polyglot.types.FieldInstance field)
Specified by:
getFieldRef in interface PolyglotJava2CAstTranslator.IdentityMapper<polyglot.types.Type,polyglot.types.CodeInstance,polyglot.types.FieldInstance>

getTypeRef

public TypeReference getTypeRef(polyglot.types.Type type)
Specified by:
getTypeRef in interface PolyglotJava2CAstTranslator.IdentityMapper<polyglot.types.Type,polyglot.types.CodeInstance,polyglot.types.FieldInstance>

getMethodRef

public MethodReference getMethodRef(polyglot.types.CodeInstance method)
Specified by:
getMethodRef in interface PolyglotJava2CAstTranslator.IdentityMapper<polyglot.types.Type,polyglot.types.CodeInstance,polyglot.types.FieldInstance>

mapLocalAnonTypeToMethod

public void mapLocalAnonTypeToMethod(polyglot.types.ClassType anonLocalType,
                                     polyglot.types.CodeInstance owningProc)

typeToTypeID

public java.lang.String typeToTypeID(polyglot.types.Type type)
Translates the given Polyglot type to a name suitable for use in a DOMO TypeReference (i.e. a bytecode-compliant type name).


anonLocalTypeToTypeID

public java.lang.String anonLocalTypeToTypeID(polyglot.types.ClassType ctype)

composeDOMOTypeDescriptor

public java.lang.String composeDOMOTypeDescriptor(polyglot.types.ClassType ctype)

composeDOMOTypeName

public java.lang.String composeDOMOTypeName(polyglot.types.ClassType ctype)