private boolean handleOverridesAndConflicts ( JvmOperation operation , Multimap < String , AbstractResolvedOperation > processedOperations ) { String simpleName = operation . getSimpleName ( ) ; if ( ! processedOperations . containsKey ( simpleName ) ) { return true ; } List < AbstractResolvedOperation > conflictingOperations = null ; for ( AbstractResolvedOperation candidate : processedOperations . get ( simpleName ) ) { OverrideTester overrideTester = candidate . getOverrideTester ( ) ; IOverrideCheckResult checkResult = overrideTester . isSubsignature ( candidate , operation , false ) ; if ( checkResult . getDetails ( ) . contains ( OverrideCheckDetails . DEFAULT_IMPL_CONFLICT ) ) { // The current operation conflicts with the candidate if ( conflictingOperations == null ) conflictingOperations = Lists . newLinkedList ( ) ; conflictingOperations . add ( candidate ) ; } else if ( checkResult . isOverridingOrImplementing ( ) ) { return false ; } } if ( conflictingOperations != null ) { if ( conflictingOperations . size ( ) == 1 && conflictingOperations . get ( 0 ) instanceof ConflictingDefaultOperation ) { // The current operation contributes to the already existing conflict ConflictingDefaultOperation conflictingDefaultOperation = ( ConflictingDefaultOperation ) conflictingOperations . get ( 0 ) ; boolean isOverridden = false ; for ( IResolvedOperation conflictingOp : conflictingDefaultOperation . getConflictingOperations ( ) ) { if ( conflictingOp . getResolvedDeclarator ( ) . isSubtypeOf ( operation . getDeclaringType ( ) ) ) { isOverridden = true ; break ; } } if ( ! isOverridden ) conflictingDefaultOperation . getConflictingOperations ( ) . add ( createResolvedOperation ( operation ) ) ; return false ; } // A new conflict of default implementations was found if ( operation . isAbstract ( ) ) { ConflictingDefaultOperation resolvedOperation = createConflictingOperation ( conflictingOperations . get ( 0 ) . getDeclaration ( ) ) ; resolvedOperation . getConflictingOperations ( ) . add ( createResolvedOperation ( operation ) ) ; for ( AbstractResolvedOperation conflictingOp : conflictingOperations ) { processedOperations . remove ( simpleName , conflictingOp ) ; if ( conflictingOp . getDeclaration ( ) != resolvedOperation . getDeclaration ( ) ) { resolvedOperation . getConflictingOperations ( ) . add ( conflictingOp ) ; } } processedOperations . put ( simpleName , resolvedOperation ) ; } else { ConflictingDefaultOperation resolvedOperation = createConflictingOperation ( operation ) ; for ( AbstractResolvedOperation conflictingOp : conflictingOperations ) { processedOperations . remove ( simpleName , conflictingOp ) ; resolvedOperation . getConflictingOperations ( ) . add ( conflictingOp ) ; } processedOperations . put ( simpleName , resolvedOperation ) ; } return false ; } return true ; }
When the inherited operations are computed for Java 8 we have to check for conflicting default interface method implementations .