Java Code Examples for com.google.javascript.rhino.jstype.ObjectType#getPropertyNames()

The following examples show how to use com.google.javascript.rhino.jstype.ObjectType#getPropertyNames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Nopol2017_0051_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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.getPropertyNames();
  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);
  }
}
 
Example 2
Source File: Nopol2017_0051_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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.getPropertyNames();
  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);
  }
}
 
Example 3
Source File: Closure_69_TypeCheck_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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.getPropertyNames();
  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);
  }
}
 
Example 4
Source File: Closure_69_TypeCheck_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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.getPropertyNames();
  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);
  }
}
 
Example 5
Source File: Closure_66_TypeCheck_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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.getPropertyNames();
  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);
  }
}
 
Example 6
Source File: Closure_66_TypeCheck_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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.getPropertyNames();
  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);
  }
}
 
Example 7
Source File: Closure_11_TypeCheck_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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.getPropertyNames();
  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);
  }
}
 
Example 8
Source File: Closure_11_TypeCheck_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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.getPropertyNames();
  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);
  }
}