In Method: | checkInterfaceConflictProperties(NodeTraversal, Node, String, HashMap, HashMap, ObjectType) |
Code with Misuse: |
class TypeCheck {
/**
* Check whether there's any property conflict for for a particular super
* interface
* @param t The node traversal object that supplies context
* @param n The node being visited
* @param functionName The function name being checked
* @param properties The property names in the super interfaces that have
* been visited
* @param currentProperties The property names in the super interface
* that have been visited
* @param interfaceType The super interface that is being visited
*/
private void checkInterfaceConflictProperties(NodeTraversal t, Node n,
String functionName, HashMap<String, ObjectType> properties,
HashMap<String, ObjectType> currentProperties,
ObjectType interfaceType) {
Set<String> currentPropertyNames =
interfaceType.getImplicitPrototype().getOwnPropertyNames();
for (String name : currentPropertyNames) {
ObjectType oType = properties.get(name);
if (oType != null) {
if (!interfaceType.getPropertyType(name).isEquivalentTo(
oType.getPropertyType(name))) {
compiler.report(
t.makeError(n, INCOMPATIBLE_EXTENDED_PROPERTY_TYPE,
functionName, name, oType.toString(),
interfaceType.toString()));
}
}
currentProperties.put(name, interfaceType);
}
for (ObjectType iType : interfaceType.getCtorExtendedInterfaces()) {
checkInterfaceConflictProperties(t, n, functionName, properties,
currentProperties, iType);
}
}
}
|