Buggy code:
public final class JavaConventions { private static final char fgDot = '.' ; private static final Scanner SCANNER = new Scanner ( ) ; private JavaConventions ( ) { } private static int indexOfEnclosingPath ( IPath checkedPath , IPath [ ] paths , int pathCount ) { } private static int indexOfMatchingPath ( IPath checkedPath , IPath [ ] paths , int pathCount ) { } private static int indexOfNestedPath ( IPath checkedPath , IPath [ ] paths , int pathCount ) { } public static boolean isOverlappingRoots ( IPath rootPath1 , IPath rootPath2 ) { } private static synchronized char [ ] scannedIdentifier ( String id ) { } public static IStatus validateCompilationUnitName ( String name ) { } public static IStatus validateClassFileName ( String name ) { } public static IStatus validateFieldName ( String name ) { } public static IStatus validateIdentifier ( String id ) { } public static IStatus validateImportDeclaration ( String name ) { } public static IStatus validateJavaTypeName ( String name ) { } public static IStatus validateMethodName ( String name ) { } public static IStatus validatePackageName ( String name ) { } public static IJavaModelStatus validateClasspath ( IJavaProject javaProject , IClasspathEntry [ ] rawClasspath , IPath projectOutputLocation ) { IProject project = javaProject . getProject ( ) ; IPath projectPath = project . getFullPath ( ) ; if ( projectOutputLocation == null ) { return new JavaModelStatus ( IJavaModelStatusConstants . NULL_PATH ) ; } if ( projectOutputLocation . isAbsolute ( ) ) { if ( ! ( projectPath . isPrefixOf ( projectOutputLocation ) ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . PATH_OUTSIDE_PROJECT , javaProject , projectOutputLocation . toString ( ) ) ; } } else { return new JavaModelStatus ( IJavaModelStatusConstants . RELATIVE_PATH , projectOutputLocation ) ; } boolean hasSource = false ; boolean hasLibFolder = false ; if ( rawClasspath == null ) return JavaModelStatus . VERIFIED_OK ; IClasspathEntry [ ] classpath ; try { <START_BUG> classpath = ( ( JavaProject ) ( javaProject ) ) . getResolvedClasspath ( rawClasspath , true , false ) ; <END_BUG> } catch ( JavaModelException e ) { return e . getJavaModelStatus ( ) ; } int length = classpath . length ; int outputCount = 1 ; IPath [ ] outputLocations = new IPath [ length + 1 ] ; boolean [ ] allowNestingInOutputLocations = new boolean [ length + 1 ] ; outputLocations [ 0 ] = projectOutputLocation ; IPath potentialNestedOutput = null ; int sourceEntryCount = 0 ; for ( int i = 0 ; i < length ; i ++ ) { IClasspathEntry resolvedEntry = classpath [ i ] ; switch ( resolvedEntry . getEntryKind ( ) ) { case IClasspathEntry . CPE_SOURCE : sourceEntryCount ++ ; if ( ( ( ( resolvedEntry . getExclusionPatterns ( ) ) != null ) && ( ( resolvedEntry . getExclusionPatterns ( ) . length ) > 0 ) ) && ( JavaCore . DISABLED . equals ( javaProject . getOption ( JavaCore . CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS , true ) ) ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . DISABLED_CP_EXCLUSION_PATTERNS , resolvedEntry . getPath ( ) ) ; } IPath customOutput ; if ( ( customOutput = resolvedEntry . getOutputLocation ( ) ) != null ) { if ( JavaCore . DISABLED . equals ( javaProject . getOption ( JavaCore . CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS , true ) ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . DISABLED_CP_MULTIPLE_OUTPUT_LOCATIONS , resolvedEntry . getPath ( ) ) ; } if ( customOutput . isAbsolute ( ) ) { if ( ! ( javaProject . getPath ( ) . isPrefixOf ( customOutput ) ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . PATH_OUTSIDE_PROJECT , javaProject , customOutput . toString ( ) ) ; } } else { return new JavaModelStatus ( IJavaModelStatusConstants . RELATIVE_PATH , customOutput ) ; } int index ; if ( ( index = JavaConventions . indexOfMatchingPath ( customOutput , outputLocations , outputCount ) ) != ( - 1 ) ) { continue ; } if ( ( index = JavaConventions . indexOfEnclosingPath ( customOutput , outputLocations , outputCount ) ) != ( - 1 ) ) { if ( index == 0 ) { if ( potentialNestedOutput == null ) potentialNestedOutput = customOutput ; } else { return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH , Util . bind ( "classpath.cannotNestOutputInOutput" , customOutput . makeRelative ( ) . toString ( ) , outputLocations [ index ] . makeRelative ( ) . toString ( ) ) ) ; } } outputLocations [ ( outputCount ++ ) ] = resolvedEntry . getOutputLocation ( ) ; } } } if ( ( potentialNestedOutput != null ) && ( sourceEntryCount > ( outputCount - 1 ) ) ) { return new JavaModelStatus ( IJavaModelStatusConstants . INVALID_CLASSPATH , Util . bind ( "classpath.cannotNestOutputInOutput" , potentialNestedOutput . makeRelative ( ) . toString ( ) , outputLocations [ 0 ] . makeRelative ( ) . toString ( ) ) ) ; } for ( int i = 0 ; i < length ; i ++ ) { IClasspathEntry resolvedEntry = classpath [ i ] ; int index ; switch ( resolvedEntry . getEntryKind ( ) ) { case IClasspathEntry . CPE_SOURCE : hasSource = true ; if ( ( index = JavaConventions . indexOfMatchingPath ( resolvedEntry . getPath ( ) , outputLocations , outputCount ) ) != ( - 1 ) ) { allowNestingInOutputLocations [ index ] = true ; } break ; case IClasspathEntry . CPE_LIBRARY : hasLibFolder |= ! ( org . eclipse . jdt . internal . compiler . util . Util . isArchiveFileName ( resolvedEntry . getPath ( ) . lastSegment ( ) ) ) ; if ( ( index = JavaConventions . indexOfMatchingPath ( resolvedEntry . getPath ( ) , outputLocations , outputCount ) ) != ( - 1 ) ) { allowNestingInOutputLocations [ index ] = true ; } break ; } }

Fix:
classpath = ( ( JavaProject ) ( javaProject ) ) . getResolvedClasspath ( rawClasspath , null , true , false ) ;