private void checkInterface ( Node n , FunctionType functionType ) { // Interface must extend only interfaces for ( ObjectType extInterface : functionType . getExtendedInterfaces ( ) ) { if ( extInterface . getConstructor ( ) != null && ! extInterface . getConstructor ( ) . isInterface ( ) ) { compiler . report ( JSError . make ( n , CONFLICTING_EXTENDED_TYPE , "interface" , getBestFunctionName ( n ) ) ) ; } } // Check whether the extended interfaces have any conflicts if ( functionType . getExtendedInterfacesCount ( ) > 1 ) { // Only check when extending more than one interfaces HashMap < String , ObjectType > properties = new HashMap <> ( ) ; LinkedHashMap < String , ObjectType > currentProperties = new LinkedHashMap <> ( ) ; for ( ObjectType interfaceType : functionType . getExtendedInterfaces ( ) ) { currentProperties . clear ( ) ; checkInterfaceConflictProperties ( n , getBestFunctionName ( n ) , properties , currentProperties , interfaceType ) ; properties . putAll ( currentProperties ) ; } } List < FunctionType > loopPath = functionType . checkExtendsLoop ( ) ; if ( loopPath != null ) { String strPath = "" ; for ( int i = 0 ; i < loopPath . size ( ) - 1 ; i ++ ) { strPath += loopPath . get ( i ) . getDisplayName ( ) + " -> " ; } strPath += Iterables . getLast ( loopPath ) . getDisplayName ( ) ; compiler . report ( JSError . make ( n , INTERFACE_EXTENDS_LOOP , loopPath . get ( 0 ) . getDisplayName ( ) , strPath ) ) ; } }
Checks an interface which may be either an ES5 - style FUNCTION node or a CLASS node .