mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Fix for 188625, NullPointerException in TranslationUnit.getScannerInfo().
This commit is contained in:
parent
df6b91eb37
commit
61c043fc3a
3 changed files with 13 additions and 11 deletions
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
|||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
||||
import org.eclipse.cdt.internal.core.model.APathEntry;
|
||||
import org.eclipse.cdt.internal.core.model.BatchOperation;
|
||||
|
@ -1221,15 +1222,15 @@ public class CoreModel {
|
|||
|
||||
/**
|
||||
* The method returns whether scanner information for a resource is empty or not.
|
||||
* <p>
|
||||
* Although this looks like IScannerInfoProvider method, eventually this interface
|
||||
* will be deprecated and the service will be moved to CoreModel.
|
||||
* </p>
|
||||
* If <code>null</code> is supplied the method returns <code>true</code>.
|
||||
*
|
||||
* @param resource
|
||||
* @since 3.0
|
||||
*/
|
||||
public static boolean isScannerInformationEmpty(IResource resource) {
|
||||
if (resource == null) {
|
||||
return true;
|
||||
}
|
||||
IProject project = resource.getProject();
|
||||
CProjectDescriptionManager mngr = CProjectDescriptionManager.getInstance();
|
||||
ICProjectDescription des = mngr.getProjectDescription(project, false);
|
||||
|
@ -1245,19 +1246,19 @@ public class CoreModel {
|
|||
lSetting = null;
|
||||
}
|
||||
if(lSetting != null){
|
||||
ICLanguageSettingEntry[] entries = lSetting.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH);
|
||||
ICLanguageSettingEntry[] entries = lSetting.getSettingEntries(ICSettingEntry.INCLUDE_PATH);
|
||||
if(entries.length != 0)
|
||||
return false;
|
||||
|
||||
entries = lSetting.getSettingEntries(ICLanguageSettingEntry.MACRO);
|
||||
entries = lSetting.getSettingEntries(ICSettingEntry.MACRO);
|
||||
if(entries.length != 0)
|
||||
return false;
|
||||
|
||||
entries = lSetting.getSettingEntries(ICLanguageSettingEntry.INCLUDE_FILE);
|
||||
entries = lSetting.getSettingEntries(ICSettingEntry.INCLUDE_FILE);
|
||||
if(entries.length != 0)
|
||||
return false;
|
||||
|
||||
entries = lSetting.getSettingEntries(ICLanguageSettingEntry.MACRO_FILE);
|
||||
entries = lSetting.getSettingEntries(ICSettingEntry.MACRO_FILE);
|
||||
if(entries.length != 0)
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -828,14 +828,14 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
IResource resource = getResource();
|
||||
ICProject project = getCProject();
|
||||
IProject rproject = project.getProject();
|
||||
IResource infoResource = resource != null ? resource : rproject;
|
||||
|
||||
if (!force && CoreModel.isScannerInformationEmpty(resource)) {
|
||||
if (!force && CoreModel.isScannerInformationEmpty(infoResource)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(rproject);
|
||||
if (provider != null) {
|
||||
IResource infoResource = resource != null ? resource : rproject;
|
||||
IScannerInfo scanInfo = provider.getScannerInformation(infoResource);
|
||||
if (scanInfo != null)
|
||||
return scanInfo;
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -48,7 +49,7 @@ class PDOMFullIndexerTask extends PDOMIndexerTask {
|
|||
private final static Object SKIP= new Object();
|
||||
private final static Object REQUIRED_IF_CONFIG_CHANGED= new Object();
|
||||
|
||||
private List fChanged = new ArrayList();
|
||||
private List fChanged = new LinkedList();
|
||||
private List fRemoved = new ArrayList();
|
||||
private IWritableIndex fIndex = null;
|
||||
private Map filePathsToParse = new HashMap/*<IIndexFileLocation, Object>*/();
|
||||
|
|
Loading…
Add table
Reference in a new issue