Buggy code:
} else { return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH , Messages . bind ( Messages . classpath_cannotNestOutputInOutput , new String [ ] { customOutput . makeRelative ( ) . toString ( ) , outputLocations [ index ] . makeRelative ( ) . toString ( ) } ) ) ; } } } if ( sourceEntryCount <= ( outputCount - 1 ) ) { allowNestingInOutputLocations [ 0 ] = true ; } else if ( potentialNestedOutput != null ) { return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH , Messages . bind ( Messages . classpath_cannotNestOutputInOutput , new String [ ] { potentialNestedOutput . makeRelative ( ) . toString ( ) , outputLocations [ 0 ] . makeRelative ( ) . toString ( ) } ) ) ; } for ( int i = 0 ; i < length ; i ++ ) { IClasspathEntry resolvedEntry = classpath [ i ] ; IPath path = resolvedEntry . getPath ( ) ; int index ; switch ( resolvedEntry . getEntryKind ( ) ) { case IClasspathEntry . CPE_SOURCE : hasSource = true ; if ( ( index = Util . indexOfMatchingPath ( path , outputLocations , outputCount ) ) != ( - 1 ) ) { allowNestingInOutputLocations [ index ] = true ; } break ; case IClasspathEntry . CPE_LIBRARY : hasLibFolder |= ! ( org . eclipse . jdt . internal . compiler . util . Util . isArchiveFileName ( path . lastSegment ( ) ) ) ; if ( ( index = Util . indexOfMatchingPath ( path , outputLocations , outputCount ) ) != ( - 1 ) ) { allowNestingInOutputLocations [ index ] = true ; } break ; } } if ( ( ! hasSource ) && ( ! hasLibFolder ) ) { for ( int i = 0 ; i < outputCount ; i ++ ) allowNestingInOutputLocations [ i ] = true ; } HashSet pathes = new HashSet ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { IClasspathEntry entry = classpath [ i ] ; if ( entry == null ) continue ; IPath entryPath = entry . getPath ( ) ; int kind = entry . getEntryKind ( ) ; boolean isProjectRelative = projectName . equals ( entryPath . segment ( 0 ) ) ; String entryPathMsg = ( isProjectRelative ) ? entryPath . removeFirstSegments ( 1 ) . toString ( ) : entryPath . makeRelative ( ) . toString ( ) ; if ( ! ( pathes . add ( entryPath ) ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Messages . bind ( Messages . classpath_duplicateEntryPath , new String [ ] { entryPathMsg , projectName } ) ) ; } if ( entryPath . equals ( projectPath ) ) { if ( kind == ( IClasspathEntry . CPE_PROJECT ) ) { <START_BUG> return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_PATH , Messages . bind ( Messages . classpath_cannotReferToItself , new String [ ] { entryPath . makeRelative ( ) . toString ( ) } ) ) ; <END_BUG> } continue ; } if ( ( kind == ( IClasspathEntry . CPE_SOURCE ) ) || ( ( kind == ( IClasspathEntry . CPE_LIBRARY ) ) && ( ! ( org . eclipse . jdt . internal . compiler . util . Util . isArchiveFileName ( entryPath . lastSegment ( ) ) ) ) ) ) { for ( int j = 0 ; j < ( classpath . length ) ; j ++ ) { IClasspathEntry otherEntry = classpath [ j ] ; if ( otherEntry == null ) continue ; int otherKind = otherEntry . getEntryKind ( ) ; IPath otherPath = otherEntry . getPath ( ) ; if ( ( entry != otherEntry ) && ( ( otherKind == ( IClasspathEntry . CPE_SOURCE ) ) || ( ( otherKind == ( IClasspathEntry . CPE_LIBRARY ) ) && ( ! ( org . eclipse . jdt . internal . compiler . util . Util . isArchiveFileName ( otherPath . lastSegment ( ) ) ) ) ) ) ) { char [ ] [ ] inclusionPatterns ; char [ ] [ ] exclusionPatterns ; if ( ( ( otherPath . isPrefixOf ( entryPath ) ) && ( ! ( otherPath . equals ( entryPath ) ) ) ) && ( ! ( Util . isExcluded ( entryPath . append ( "*" ) , ( inclusionPatterns = ( ( ClasspathEntry ) ( otherEntry ) ) . fullInclusionPatternChars ( ) ) , ( exclusionPatterns = ( ( ClasspathEntry ) ( otherEntry ) ) . fullExclusionPatternChars ( ) ) , false ) ) ) ) { String exclusionPattern = entryPath . removeFirstSegments ( otherPath . segmentCount ( ) ) . segment ( 0 ) ; if ( Util . isExcluded ( entryPath , inclusionPatterns , exclusionPatterns , false ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH , Messages . bind ( Messages . classpath_mustEndWithSlash , new String [ ] { exclusionPattern , entryPath . makeRelative ( ) . toString ( ) } ) ) ; } else { if ( otherKind == ( IClasspathEntry . CPE_SOURCE ) ) { exclusionPattern += '//' ; return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH , Messages . bind ( Messages . classpath_cannotNestEntryInEntry , new String [ ] { entryPath . makeRelative ( ) . toString ( ) , otherEntry . getPath ( ) . makeRelative ( ) . toString ( ) , exclusionPattern } ) ) ; } else { return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH , Messages . bind ( Messages . classpath_cannotNestEntryInLibrary , new String [ ] { entryPath . makeRelative ( ) . toString ( ) , otherEntry . getPath ( ) . makeRelative ( ) . toString ( ) } ) ) ;

Fix:
return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_PATH , Messages . bind ( Messages . classpath_cannotReferToItself , entryPath . makeRelative ( ) . toString ( ) ) ) ;