Buggy code:
public static IClasspathEntry newVariableEntry ( IPath variablePath , IPath variableSourceAttachmentPath , IPath sourceAttachmentRootPath ) { } public static IClasspathEntry newVariableEntry ( IPath variablePath , IPath variableSourceAttachmentPath , IPath variableSourceAttachmentRootPath , boolean isExported ) { } public static void removeClasspathVariable ( String variableName ) { } public static void removeClasspathVariable ( String variableName , IProgressMonitor monitor ) { } public static void removeElementChangedListener ( IElementChangedListener listener ) { } public static void run ( IWorkspaceRunnable action , IProgressMonitor monitor ) throws CoreException { } public static void setClasspathContainer ( IPath containerPath , final IJavaProject [ ] affectedProjects , IClasspathContainer [ ] respectiveContainers , IProgressMonitor monitor ) throws JavaModelException { } public static void setClasspathVariable ( String variableName , IPath path ) throws JavaModelException { } public static void setClasspathVariable ( String variableName , IPath path , IProgressMonitor monitor ) throws JavaModelException { } public static void setClasspathVariables ( String [ ] variableNames , IPath [ ] paths , IProgressMonitor monitor ) throws JavaModelException { } public void setInitializationData ( IConfigurationElement cfig , String propertyName , Object data ) throws CoreException { } public static void setOptions ( Hashtable newOptions ) { } public void shutdown ( ) { } private void startIndexing ( ) { } public void startup ( ) { } private static void updateVariableValues ( String [ ] variableNames , IPath [ ] variablePaths , IProgressMonitor monitor ) throws JavaModelException { if ( ( monitor != null ) && ( monitor . isCanceled ( ) ) ) return ; int varLength = variableNames . length ; final HashMap affectedProjects = new HashMap ( 5 ) ; JavaModelManager manager = JavaModelManager . getJavaModelManager ( ) ; IJavaModel model = manager . getJavaModel ( ) ; int discardCount = 0 ; for ( int i = 0 ; i < varLength ; i ++ ) { IPath oldPath = ( ( IPath ) ( JavaModelManager . variableGet ( variableNames [ i ] ) ) ) ; if ( oldPath == ( VariableInitializationInProgress ) ) oldPath = null ; if ( ( oldPath != null ) && ( oldPath . equals ( variablePaths [ i ] ) ) ) { variableNames [ i ] = null ; discardCount ++ ; } } if ( discardCount > 0 ) { if ( discardCount == varLength ) return ; int changedLength = varLength - discardCount ; String [ ] changedVariableNames = new String [ changedLength ] ; IPath [ ] changedVariablePaths = new IPath [ changedLength ] ; for ( int i = 0 , index = 0 ; i < varLength ; i ++ ) { if ( ( variableNames [ i ] ) != null ) { changedVariableNames [ index ] = variableNames [ i ] ; changedVariablePaths [ index ] = variablePaths [ i ] ; index ++ ; } } variableNames = changedVariableNames ; variablePaths = changedVariablePaths ; varLength = changedLength ; } if ( ( monitor != null ) && ( monitor . isCanceled ( ) ) ) return ; if ( model != null ) { IJavaProject [ ] projects = model . getJavaProjects ( ) ; nextProject : for ( int i = 0 , projectLength = projects . length ; i < projectLength ; i ++ ) { IJavaProject project = projects [ i ] ; IClasspathEntry [ ] classpath = project . getRawClasspath ( ) ; for ( int j = 0 , cpLength = classpath . length ; j < cpLength ; j ++ ) { IClasspathEntry entry = classpath [ j ] ; for ( int k = 0 ; k < varLength ; k ++ ) { String variableName = variableNames [ k ] ; if ( ( entry . getEntryKind ( ) ) == ( IClasspathEntry . CPE_VARIABLE ) ) { if ( variableName . equals ( entry . getPath ( ) . segment ( 0 ) ) ) { affectedProjects . put ( project , ( ( JavaProject ) ( project ) ) . getResolvedClasspath ( true ) ) ; continue nextProject ; } IPath sourcePath ; IPath sourceRootPath ; if ( ( ( ( sourcePath = entry . getSourceAttachmentPath ( ) ) != null ) && ( variableName . equals ( sourcePath . segment ( 0 ) ) ) ) || ( ( ( sourceRootPath = entry . getSourceAttachmentRootPath ( ) ) != null ) && ( variableName . equals ( sourceRootPath . segment ( 0 ) ) ) ) ) { affectedProjects . put ( project , ( ( JavaProject ) ( project ) ) . getResolvedClasspath ( true ) ) ; continue nextProject ; } } } } } } for ( int i = 0 ; i < varLength ; i ++ ) { IPath path = variablePaths [ i ] ; JavaModelManager . variablePut ( variableNames [ i ] , path ) ; } if ( ! ( affectedProjects . isEmpty ( ) ) ) { try { JavaCore . run ( new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor monitor ) throws CoreException { Iterator projectsToUpdate = affectedProjects . keySet ( ) . iterator ( ) ; while ( projectsToUpdate . hasNext ( ) ) { if ( ( monitor != null ) && ( monitor . isCanceled ( ) ) ) return ; JavaProject project = ( ( JavaProject ) ( projectsToUpdate . next ( ) ) ) ; <START_BUG> project . setRawClasspath ( project . getRawClasspath ( ) , ReuseOutputLocation , monitor , ( ! ( JavaModelManager . isResourceTreeLocked ( ) ) ) , ( ( IClasspathEntry [ ] ) ( affectedProjects . get ( project ) ) ) , false , false ) ; <END_BUG> } } } , monitor ) ; } catch ( CoreException e ) { if ( e instanceof JavaModelException ) { throw ( ( JavaModelException ) ( e ) ) ; } else { throw new JavaModelException ( e ) ; } } } } }

Fix:
project . setRawClasspath ( project . getRawClasspath ( ) , ReuseOutputLocation , null , ( ! ( JavaModelManager . isResourceTreeLocked ( ) ) ) , ( ( IClasspathEntry [ ] ) ( affectedProjects . get ( project ) ) ) , false , false ) ;