mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 06:45:43 +02:00
Deprecate and remove use of method now in JVM (Object.equals)
Change-Id: Iec34f0f8388d7d76ce63f88cfc7d16534e5a7d84
This commit is contained in:
parent
125afa92dc
commit
cfc3278454
13 changed files with 43 additions and 27 deletions
|
@ -13,6 +13,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.settings.model;
|
package org.eclipse.cdt.core.settings.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -156,11 +158,11 @@ public final class CLibraryFileEntry extends ACPathEntry implements ICLibraryFil
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean sourceAttachmentSettingsEqual(CLibraryFileEntry otherEntry) {
|
private boolean sourceAttachmentSettingsEqual(CLibraryFileEntry otherEntry) {
|
||||||
if (!CDataUtil.objectsEqual(fSourceAttachmentPath, otherEntry.fSourceAttachmentPath))
|
if (!Objects.equals(fSourceAttachmentPath, otherEntry.fSourceAttachmentPath))
|
||||||
return false;
|
return false;
|
||||||
if (!CDataUtil.objectsEqual(fSourceAttachmentRootPath, otherEntry.fSourceAttachmentRootPath))
|
if (!Objects.equals(fSourceAttachmentRootPath, otherEntry.fSourceAttachmentRootPath))
|
||||||
return false;
|
return false;
|
||||||
if (!CDataUtil.objectsEqual(fSourceAttachmentPrefixMapping, otherEntry.fSourceAttachmentPrefixMapping))
|
if (!Objects.equals(fSourceAttachmentPrefixMapping, otherEntry.fSourceAttachmentPrefixMapping))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
package org.eclipse.cdt.core.settings.model.extension.impl;
|
package org.eclipse.cdt.core.settings.model.extension.impl;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.envvar.IEnvironmentContributor;
|
import org.eclipse.cdt.core.envvar.IEnvironmentContributor;
|
||||||
import org.eclipse.cdt.core.settings.model.ICOutputEntry;
|
import org.eclipse.cdt.core.settings.model.ICOutputEntry;
|
||||||
|
@ -80,7 +81,7 @@ public class CDefaultBuildData extends CBuildData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBuilderCWD(IPath path) {
|
public void setBuilderCWD(IPath path) {
|
||||||
if (CDataUtil.objectsEqual(path, fCWD))
|
if (Objects.equals(path, fCWD))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fCWD = path;
|
fCWD = path;
|
||||||
|
|
|
@ -15,6 +15,7 @@ package org.eclipse.cdt.core.settings.model.extension.impl;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor;
|
||||||
import org.eclipse.cdt.core.settings.model.CConfigurationStatus;
|
import org.eclipse.cdt.core.settings.model.CConfigurationStatus;
|
||||||
|
@ -192,7 +193,7 @@ public class CDefaultConfigurationData extends CConfigurationData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
if (CDataUtil.objectsEqual(description, fDescription))
|
if (Objects.equals(description, fDescription))
|
||||||
return;
|
return;
|
||||||
fDescription = description;
|
fDescription = description;
|
||||||
|
|
||||||
|
@ -238,7 +239,7 @@ public class CDefaultConfigurationData extends CConfigurationData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
if (CDataUtil.objectsEqual(name, fName))
|
if (Objects.equals(name, fName))
|
||||||
return;
|
return;
|
||||||
fName = name;
|
fName = name;
|
||||||
setModified(true);
|
setModified(true);
|
||||||
|
|
|
@ -15,6 +15,7 @@ package org.eclipse.cdt.core.settings.model.extension.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CFolderData;
|
import org.eclipse.cdt.core.settings.model.extension.CFolderData;
|
||||||
|
@ -92,7 +93,7 @@ public class CDefaultFolderData extends CFolderData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPath(IPath path) {
|
public void setPath(IPath path) {
|
||||||
if (CDataUtil.objectsEqual(path, fPath))
|
if (Objects.equals(path, fPath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fPath = path;
|
fPath = path;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
package org.eclipse.cdt.core.settings.model.extension.impl;
|
package org.eclipse.cdt.core.settings.model.extension.impl;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||||
|
@ -132,7 +133,7 @@ public class CDefaultLanguageData extends CLanguageData {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLanguageId(String id) {
|
public void setLanguageId(String id) {
|
||||||
if (CDataUtil.objectsEqual(id, fLanguageId))
|
if (Objects.equals(id, fLanguageId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fLanguageId = id;
|
fLanguageId = id;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
@ -107,10 +108,12 @@ public class CDataUtil {
|
||||||
suffix;
|
suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link Object#equals(Object)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static boolean objectsEqual(Object o1, Object o2) {
|
public static boolean objectsEqual(Object o1, Object o2) {
|
||||||
if (o1 == null)
|
return Objects.equals(o1, o2);
|
||||||
return o2 == null;
|
|
||||||
return o1.equals(o2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String arrayToString(String[] array, String separator) {
|
public static String arrayToString(String[] array, String separator) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -370,7 +371,7 @@ public class CConfigurationSpecSettings implements ICSettingsStorage, ILanguageS
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
if (isReadOnly())
|
if (isReadOnly())
|
||||||
throw ExceptionFactory.createIsReadOnlyException();
|
throw ExceptionFactory.createIsReadOnlyException();
|
||||||
if (!CDataUtil.objectsEqual(fName, name)) {
|
if (!Objects.equals(fName, name)) {
|
||||||
fName = name;
|
fName = name;
|
||||||
fIsModified = true;
|
fIsModified = true;
|
||||||
}
|
}
|
||||||
|
@ -383,7 +384,7 @@ public class CConfigurationSpecSettings implements ICSettingsStorage, ILanguageS
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
if (isReadOnly())
|
if (isReadOnly())
|
||||||
throw ExceptionFactory.createIsReadOnlyException();
|
throw ExceptionFactory.createIsReadOnlyException();
|
||||||
if (!CDataUtil.objectsEqual(fId, id)) {
|
if (!Objects.equals(fId, id)) {
|
||||||
fId = id;
|
fId = id;
|
||||||
fIsModified = true;
|
fIsModified = true;
|
||||||
}
|
}
|
||||||
|
@ -392,7 +393,7 @@ public class CConfigurationSpecSettings implements ICSettingsStorage, ILanguageS
|
||||||
void setBuildSystemId(String id) {
|
void setBuildSystemId(String id) {
|
||||||
if (isReadOnly())
|
if (isReadOnly())
|
||||||
throw ExceptionFactory.createIsReadOnlyException();
|
throw ExceptionFactory.createIsReadOnlyException();
|
||||||
if (!CDataUtil.objectsEqual(fBuildSystemId, id)) {
|
if (!Objects.equals(fBuildSystemId, id)) {
|
||||||
fBuildSystemId = id;
|
fBuildSystemId = id;
|
||||||
fIsModified = true;
|
fIsModified = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
||||||
|
@ -1404,7 +1405,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
CConfigurationSpecSettings oldSettings = ((IInternalCCfgInfo) oldCfg).getSpecSettings();
|
CConfigurationSpecSettings oldSettings = ((IInternalCCfgInfo) oldCfg).getSpecSettings();
|
||||||
String newId = newSettings.getCOwnerId();
|
String newId = newSettings.getCOwnerId();
|
||||||
String oldId = oldSettings.getCOwnerId();
|
String oldId = oldSettings.getCOwnerId();
|
||||||
if (!CDataUtil.objectsEqual(newId, oldId))
|
if (!Objects.equals(newId, oldId))
|
||||||
flags |= ICDescriptionDelta.OWNER;
|
flags |= ICDescriptionDelta.OWNER;
|
||||||
|
|
||||||
Map<String, CConfigExtensionReference[]> newMap = newSettings.getExtensionMapCopy();
|
Map<String, CConfigExtensionReference[]> newMap = newSettings.getExtensionMapCopy();
|
||||||
|
@ -1505,7 +1506,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
delta.addChangeFlags(ICDescriptionDelta.NAME);
|
delta.addChangeFlags(ICDescriptionDelta.NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CDataUtil.objectsEqual(newCfg.getDescription(), oldCfg.getDescription())) {
|
if (!Objects.equals(newCfg.getDescription(), oldCfg.getDescription())) {
|
||||||
delta.addChangeFlags(ICDescriptionDelta.DESCRIPTION);
|
delta.addChangeFlags(ICDescriptionDelta.DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1808,7 +1809,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
CProjectDescriptionDelta delta = new CProjectDescriptionDelta(newLs, oldLs);
|
CProjectDescriptionDelta delta = new CProjectDescriptionDelta(newLs, oldLs);
|
||||||
|
|
||||||
if (delta.getDeltaKind() == ICDescriptionDelta.CHANGED) {
|
if (delta.getDeltaKind() == ICDescriptionDelta.CHANGED) {
|
||||||
if (!CDataUtil.objectsEqual(newLs.getLanguageId(), oldLs.getLanguageId()))
|
if (!Objects.equals(newLs.getLanguageId(), oldLs.getLanguageId()))
|
||||||
delta.addChangeFlags(ICDescriptionDelta.LANGUAGE_ID);
|
delta.addChangeFlags(ICDescriptionDelta.LANGUAGE_ID);
|
||||||
|
|
||||||
int kinds[] = KindBasedStore.getLanguageEntryKinds();
|
int kinds[] = KindBasedStore.getLanguageEntryKinds();
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.text.MessageFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.AbstractCExtension;
|
import org.eclipse.cdt.core.AbstractCExtension;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -206,7 +207,7 @@ final public class CConfigBasedDescriptor implements ICDescriptor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExtensionData(String key, String value) throws CoreException {
|
public void setExtensionData(String key, String value) throws CoreException {
|
||||||
if (!CDataUtil.objectsEqual(fCfgExtRef.getExtensionData(key), value)) {
|
if (!Objects.equals(fCfgExtRef.getExtensionData(key), value)) {
|
||||||
fIsDirty = true;
|
fIsDirty = true;
|
||||||
fCfgExtRef.setExtensionData(key, value);
|
fCfgExtRef.setExtensionData(key, value);
|
||||||
checkApply();
|
checkApply();
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
package org.eclipse.cdt.internal.core.cdtvariables;
|
package org.eclipse.cdt.internal.core.cdtvariables;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
||||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
||||||
|
@ -188,7 +189,7 @@ public class CdtVariableManager implements ICdtVariableManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean variablesEqual(ICdtVariable var1, ICdtVariable var2) {
|
private static boolean variablesEqual(ICdtVariable var1, ICdtVariable var2) {
|
||||||
if (CDataUtil.objectsEqual(var1, var2))
|
if (Objects.equals(var1, var2))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (var1 == null || var2 == null)
|
if (var1 == null || var2 == null)
|
||||||
|
@ -207,7 +208,7 @@ public class CdtVariableManager implements ICdtVariableManager {
|
||||||
if (!Arrays.equals(v1, v2))
|
if (!Arrays.equals(v1, v2))
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!CDataUtil.objectsEqual(var1.getStringValue(), var2.getStringValue()))
|
if (!Objects.equals(var1.getStringValue(), var2.getStringValue()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (CdtVariableException e) {
|
} catch (CdtVariableException e) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
@ -292,7 +293,7 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
if (fVar == otherVar)
|
if (fVar == otherVar)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!CDataUtil.objectsEqual(fVar.getName(), otherVar.getName()))
|
if (!Objects.equals(fVar.getName(), otherVar.getName()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (fNameOnly)
|
if (fNameOnly)
|
||||||
|
@ -310,7 +311,7 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if (!CDataUtil.objectsEqual(fVar.getStringValue(), otherVar.getStringValue()))
|
if (!Objects.equals(fVar.getStringValue(), otherVar.getStringValue()))
|
||||||
return false;
|
return false;
|
||||||
} catch (CdtVariableException e) {
|
} catch (CdtVariableException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
|
|
|
@ -19,6 +19,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||||
|
@ -251,8 +252,8 @@ public class Cygwin {
|
||||||
String envCygwinHomeValue = varCygwinHome != null ? varCygwinHome.getValue() : null;
|
String envCygwinHomeValue = varCygwinHome != null ? varCygwinHome.getValue() : null;
|
||||||
|
|
||||||
// isCygwinLocationCached is used to figure fact of caching when all cached objects are null
|
// isCygwinLocationCached is used to figure fact of caching when all cached objects are null
|
||||||
if (isCygwinLocationCached && CDataUtil.objectsEqual(envPathValue, envPathValueCached)
|
if (isCygwinLocationCached && Objects.equals(envPathValue, envPathValueCached)
|
||||||
&& CDataUtil.objectsEqual(envCygwinHomeValue, envCygwinHomeValueCached)) {
|
&& Objects.equals(envCygwinHomeValue, envCygwinHomeValueCached)) {
|
||||||
return cygwinLocation;
|
return cygwinLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ package org.eclipse.cdt.internal.core;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
|
@ -298,8 +299,8 @@ public class MinGW {
|
||||||
|
|
||||||
// isMinGWLocationCached is used to figure fact of caching when all
|
// isMinGWLocationCached is used to figure fact of caching when all
|
||||||
// cached objects are null
|
// cached objects are null
|
||||||
if (isMinGWLocationCached && CDataUtil.objectsEqual(envPathValue, envPathValueCached)
|
if (isMinGWLocationCached && Objects.equals(envPathValue, envPathValueCached)
|
||||||
&& CDataUtil.objectsEqual(envMinGWHomeValue, envMinGWHomeValueCached)) {
|
&& Objects.equals(envMinGWHomeValue, envMinGWHomeValueCached)) {
|
||||||
return minGWLocation;
|
return minGWLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +338,7 @@ public class MinGW {
|
||||||
|
|
||||||
// isMSysLocationCached is used to figure whether it was cached when all
|
// isMSysLocationCached is used to figure whether it was cached when all
|
||||||
// cached objects are null
|
// cached objects are null
|
||||||
if (isMSysLocationCached && CDataUtil.objectsEqual(envMinGWHomeValue, envMinGWHomeValueCached_msys)) {
|
if (isMSysLocationCached && Objects.equals(envMinGWHomeValue, envMinGWHomeValueCached_msys)) {
|
||||||
return mSysLocation;
|
return mSysLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue