Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] ConcurrentModification Exception

No, this is done many times per project life cycle.

Alex Chapiro wrote:
I don't understand from your description, do you do this work just once per project life cycle. If yes, I think that the simplectt way is to add your own nature and implement all the code in nature service class (which implements IProjectNature interface for your nature) method configure(). And there are another options where to store specific project information as well (you can use project storage for example).

Alex


Subs wrote:
I'd like to try and do this when the projects are loaded by CDT, but I couldn't find a way to do it. I have stored my own information in the .cproject file (using IStorage), so I need to read it out and perform my additional checks. I used earlyStartup as that enabled me to get in 'early' (before the user had chance to do anything) although I have noticed that if there are a lot of projects, than it can take up to a minute for my plugin to load it's information from all projects.

If there was another way to do this, I'd be happy.

Thanks,

Alex Chapiro wrote:




Can I do all these with natures?

No, sorry. You can detect C, C++ or Java project using natures, but you cannot use them to collect other information. If project is already built, you can check its type(lib/exec/static lib) using binary parser. Of course this is bad method. CProjectDescription should do this work but this "extra feature" - workspace modification I'd consider as a bug. Besides that I think that a bad factor is the fact that CProjectDescriptionManager has 3600 lines of java code! (In this case it is not a workspace modification problem. Actually, the problem is that they use ScannerConfigProfileManager.getInstance().getProfileIds(context) return without any synchronization - bug) Try to use any synchronization method to avoid collision. startup doesn't seem to me the best place for that. Would it be possible to
do it after plugin initialization, it'd be better.
Also, I'm not looking to update any resource, just find out what it's 'type' is. So is there a non-modifying way of getting this info?

Thanks,

Alex Chapiro wrote:
I'd just check project natures. It much more simple and does not update any resource.


Regards,
Alex


Subs wrote:
Hi,

In my plugin I am trying to determine if a project is a makefile project (if it is, I do some special processing). I am doing this during my plugins earlyStartup() method. When doing this, I am occasionally getting a ConcurrentModificationException. See trace below:

I have tried 2 different methods to detect a makefile project, but both result in the same problem.

Method 1:
ICProjectDescription projectDesc = CoreModel.getDefault().getProjectDescription(project, false);
if (projectDesc == null)
    return false;
IConfiguration cfg = ManagedBuildManager.
    getConfigurationForDescription(projectDesc
        .getDefaultSettingConfiguration());
if (cfg == null)
    return false;
return (!cfg.getBuilder().isManagedBuildOn());

Method 2:
private static boolean isProjectType(IProject project, String type) { IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
        if (info != null) {
IManagedProject managedProject = info.getManagedProject();
            if (managedProject != null) {
IProjectType projectType = managedProject.getProjectType();
                IBuildPropertyValue property = null;
                if (projectType != null) {
                    property = projectType.getBuildArtefactType();
                    if (property != null) {
                        String artifactName = property.getId();
                        if (type != null)
                            return type.equals(artifactName);
                    }
                } else {
                    if (type == null)
                        return true;
                }
            }
        }
        return false;
    }

Is there a way I can do this without getting the Exception?

null:
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
      at java.util.AbstractList$Itr.next(Unknown Source)
at org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2$BuildProperty.load(ScannerConfigInfoFactory2.java:818) at org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2$BuildProperty.<init>(ScannerConfigInfoFactory2.java:759) at org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2$ScannerConfigInfoSet.load(ScannerConfigInfoFactory2.java:117) at org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2$ScannerConfigInfoSet.<init>(ScannerConfigInfoFactory2.java:93) at org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigInfoFactory2.createInfoSet(ScannerConfigInfoFactory2.java:1332) at org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(ScannerConfigProfileManager.java:219) at org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigInfoFactory2$CfgInfo.getContainer(CfgScannerConfigInfoFactory2.java:107) at org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigInfoFactory2$CfgInfo.createMap(CfgScannerConfigInfoFactory2.java:128) at org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigInfoFactory2$CfgInfo.getInfo(CfgScannerConfigInfoFactory2.java:75) at org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.getContextInfo(CfgDiscoveredPathManager.java:417) at org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.getContextInfo(CfgDiscoveredPathManager.java:402) at org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.getDiscoveredInfo(CfgDiscoveredPathManager.java:160) at org.eclipse.cdt.managedbuilder.internal.dataprovider.ProfileInfoProvider.getEntryValues(ProfileInfoProvider.java:65) at org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildEntryStorage.getDiscoveredEntries(BuildEntryStorage.java:188) at org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildEntryStorage.putEntriesToLevel(BuildEntryStorage.java:181) at org.eclipse.cdt.core.settings.model.util.AbstractEntryStorage.initCache(AbstractEntryStorage.java:71) at org.eclipse.cdt.core.settings.model.util.AbstractEntryStorage.getEntries(AbstractEntryStorage.java:34) at org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildLanguageData.getEntries(BuildLanguageData.java:140) at org.eclipse.cdt.core.settings.model.extension.impl.CDefaultLanguageData.getEntriesToCopy(CDefaultLanguageData.java:97) at org.eclipse.cdt.core.settings.model.extension.impl.CDefaultLanguageData.createStore(CDefaultLanguageData.java:89) at org.eclipse.cdt.core.settings.model.extension.impl.CDefaultLanguageData.copySettingsFrom(CDefaultLanguageData.java:82) at org.eclipse.cdt.internal.core.settings.model.CLanguageSettingCache.copySettingsFrom(CLanguageSettingCache.java:47) at org.eclipse.cdt.internal.core.settings.model.CLanguageSettingCache.<init>(CLanguageSettingCache.java:37) at org.eclipse.cdt.internal.core.settings.model.CFolderDescriptionCache.copyLanguageData(CFolderDescriptionCache.java:71) at org.eclipse.cdt.core.settings.model.extension.impl.CDefaultFolderData.copyDataFrom(CDefaultFolderData.java:56) at org.eclipse.cdt.internal.core.settings.model.CFolderDescriptionCache.<init>(CFolderDescriptionCache.java:38) at org.eclipse.cdt.internal.core.settings.model.CConfigurationDescriptionCache.copyFolderData(CConfigurationDescriptionCache.java:190) at org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationData.copySettingsFrom(CDefaultConfigurationData.java:113) at org.eclipse.cdt.internal.core.settings.model.CConfigurationDescriptionCache.loadData(CConfigurationDescriptionCache.java:99) at org.eclipse.cdt.internal.core.settings.model.CProjectDescription.loadDatas(CProjectDescription.java:194) at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.loadProjectDescription(CProjectDescriptionManager.java:1034) at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.getProjectDescription(CProjectDescriptionManager.java:540) at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.getProjectDescription(CProjectDescriptionManager.java:516) at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.getProjectDescription(CProjectDescriptionManager.java:508) at org.eclipse.cdt.core.model.CoreModel.getProjectDescription(CoreModel.java:1409) at com.crt.utils.general.ProjectUtils.isMakeProject(ProjectUtils.java:40) at com.crt.config.database.TargetConfig.loadTargetConfig(TargetConfig.java:453) at com.crt.config.database.TargetConfigManager.earlyStartup(TargetConfigManager.java:127) at org.eclipse.ui.internal.EarlyStartupRunnable.runEarlyStartup(EarlyStartupRunnable.java:87) at org.eclipse.ui.internal.EarlyStartupRunnable.run(EarlyStartupRunnable.java:66)
      at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.ui.internal.Workbench$54.run(Workbench.java:2190)
      at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)




_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev





_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev





_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



--
Subs


Back to the top