2006-11-22 17:38:46 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (c) 2002 - 2006 IBM Corporation.
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* IBM Corporation - initial API and implementation
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
package com.ibm.wala.analysis.typeInference;
|
|
|
|
|
|
|
|
import com.ibm.wala.classLoader.IClass;
|
|
|
|
import com.ibm.wala.ipa.callgraph.ContextItem;
|
2007-07-06 22:08:13 +00:00
|
|
|
import com.ibm.wala.types.TypeReference;
|
2006-11-22 17:38:46 +00:00
|
|
|
|
|
|
|
/**
|
2007-07-09 15:50:13 +00:00
|
|
|
* Abstraction of a Java type. These are immutable.
|
2006-11-22 17:38:46 +00:00
|
|
|
*
|
2009-06-12 14:44:59 +00:00
|
|
|
* @see TypeInference
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
|
|
|
public abstract class TypeAbstraction implements ContextItem {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Canonical element representing TOP for a dataflow lattice
|
|
|
|
*/
|
|
|
|
public final static TypeAbstraction TOP = new TypeAbstraction() {
|
2007-05-30 15:16:05 +00:00
|
|
|
@Override
|
2006-11-22 17:38:46 +00:00
|
|
|
public TypeAbstraction meet(TypeAbstraction rhs) {
|
|
|
|
return rhs;
|
|
|
|
}
|
2007-06-06 20:15:37 +00:00
|
|
|
|
2007-05-30 15:16:05 +00:00
|
|
|
@Override
|
2006-11-22 17:38:46 +00:00
|
|
|
public String toString() {
|
2011-12-28 17:03:27 +00:00
|
|
|
return "WalaTypeAbstraction.TOP";
|
2006-11-22 17:38:46 +00:00
|
|
|
}
|
2007-06-06 20:15:37 +00:00
|
|
|
|
2007-05-30 15:16:05 +00:00
|
|
|
@Override
|
2006-11-22 17:38:46 +00:00
|
|
|
public int hashCode() {
|
|
|
|
return 17;
|
|
|
|
}
|
2007-06-06 20:15:37 +00:00
|
|
|
|
2007-05-30 15:16:05 +00:00
|
|
|
@Override
|
2006-11-22 17:38:46 +00:00
|
|
|
public boolean equals(Object other) {
|
|
|
|
return this == other;
|
|
|
|
}
|
2007-06-06 20:15:37 +00:00
|
|
|
|
2007-05-30 15:16:05 +00:00
|
|
|
@Override
|
2007-06-06 20:15:37 +00:00
|
|
|
public IClass getType() {
|
2006-11-22 17:38:46 +00:00
|
|
|
return null;
|
|
|
|
}
|
2007-06-06 20:15:37 +00:00
|
|
|
|
2007-06-01 14:06:13 +00:00
|
|
|
@Override
|
2007-06-06 20:15:37 +00:00
|
|
|
public TypeReference getTypeReference() {
|
2007-06-01 03:26:18 +00:00
|
|
|
return null;
|
|
|
|
}
|
2006-11-22 17:38:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
public abstract TypeAbstraction meet(TypeAbstraction rhs);
|
|
|
|
|
2007-05-30 15:16:05 +00:00
|
|
|
@Override
|
2006-11-22 17:38:46 +00:00
|
|
|
public abstract boolean equals(Object obj);
|
|
|
|
|
2007-05-30 15:16:05 +00:00
|
|
|
@Override
|
2006-11-22 17:38:46 +00:00
|
|
|
public abstract int hashCode();
|
|
|
|
|
2007-06-01 03:26:18 +00:00
|
|
|
/**
|
|
|
|
* A TypeReference representing the types of this abstraction
|
|
|
|
*/
|
|
|
|
public abstract TypeReference getTypeReference();
|
|
|
|
|
2006-11-22 17:38:46 +00:00
|
|
|
/**
|
|
|
|
* This is here for convenience; it makes sense for Point and Cone Dispatch.
|
|
|
|
* TODO: probably should get rid of it.
|
2007-08-21 02:46:01 +00:00
|
|
|
* @throws UnsupportedOperationException unconditionally
|
2006-11-22 17:38:46 +00:00
|
|
|
*/
|
2007-08-21 02:46:01 +00:00
|
|
|
public IClass getType() throws UnsupportedOperationException {
|
2007-08-20 20:16:43 +00:00
|
|
|
throw new UnsupportedOperationException("getType not implemented for " + getClass());
|
2006-11-22 17:38:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|