1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Get rid of access to Assert which is an internal interface in the platform runtime.

This commit is contained in:
Doug Schaefer 2005-05-28 01:17:30 +00:00
parent 2e324713bd
commit 6232873fa7
2 changed files with 0 additions and 14 deletions

View file

@ -11,7 +11,6 @@
package org.eclipse.cdt.core.browser; package org.eclipse.cdt.core.browser;
import org.eclipse.cdt.core.CConventions; import org.eclipse.cdt.core.CConventions;
import org.eclipse.core.internal.runtime.Assert;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
public class QualifiedTypeName implements IQualifiedTypeName { public class QualifiedTypeName implements IQualifiedTypeName {
@ -28,22 +27,18 @@ public class QualifiedTypeName implements IQualifiedTypeName {
public static final QualifiedTypeName EMPTY = new QualifiedTypeName(); public static final QualifiedTypeName EMPTY = new QualifiedTypeName();
public QualifiedTypeName(IQualifiedTypeName typeName) { public QualifiedTypeName(IQualifiedTypeName typeName) {
Assert.isNotNull(typeName);
fSegments = typeName.segments(); fSegments = typeName.segments();
} }
public QualifiedTypeName(String qualifiedName) { public QualifiedTypeName(String qualifiedName) {
Assert.isNotNull(qualifiedName);
fSegments = createSegments(qualifiedName); fSegments = createSegments(qualifiedName);
} }
public QualifiedTypeName(String[] names) { public QualifiedTypeName(String[] names) {
Assert.isNotNull(names);
fSegments = createSegments(names); fSegments = createSegments(names);
} }
public QualifiedTypeName(String name, String[] enclosingNames) { public QualifiedTypeName(String name, String[] enclosingNames) {
Assert.isNotNull(name);
if (enclosingNames == null) if (enclosingNames == null)
fSegments = createSegments(name); fSegments = createSegments(name);
else else
@ -78,7 +73,6 @@ public class QualifiedTypeName implements IQualifiedTypeName {
lastIndex = qualifierIndex + QUALIFIER.length(); lastIndex = qualifierIndex + QUALIFIER.length();
qualifierIndex = qualifiedName.indexOf(QUALIFIER, lastIndex); qualifierIndex = qualifiedName.indexOf(QUALIFIER, lastIndex);
} }
Assert.isTrue(segmentCount == (maxSegments - 1));
// note: we allocate a new string rather than use the returned substring, // note: we allocate a new string rather than use the returned substring,
// otherwise we're holding a reference to the entire original string // otherwise we're holding a reference to the entire original string
segments[segmentCount] = new String(qualifiedName.substring(lastIndex)); segments[segmentCount] = new String(qualifiedName.substring(lastIndex));
@ -176,7 +170,6 @@ public class QualifiedTypeName implements IQualifiedTypeName {
} }
public int matchingFirstSegments(IQualifiedTypeName typeName) { public int matchingFirstSegments(IQualifiedTypeName typeName) {
Assert.isNotNull(typeName);
int max = Math.min(fSegments.length, typeName.segmentCount()); int max = Math.min(fSegments.length, typeName.segmentCount());
int count = 0; int count = 0;
for (int i = 0; i < max; ++i) { for (int i = 0; i < max; ++i) {
@ -189,7 +182,6 @@ public class QualifiedTypeName implements IQualifiedTypeName {
} }
public boolean isPrefixOf(IQualifiedTypeName typeName) { public boolean isPrefixOf(IQualifiedTypeName typeName) {
Assert.isNotNull(typeName);
if (fSegments.length == 0) if (fSegments.length == 0)
return true; return true;
@ -206,7 +198,6 @@ public class QualifiedTypeName implements IQualifiedTypeName {
} }
public IQualifiedTypeName append(String[] names) { public IQualifiedTypeName append(String[] names) {
Assert.isNotNull(names);
int length = fSegments.length; int length = fSegments.length;
int typeNameLength = names.length; int typeNameLength = names.length;
String[] newSegments = new String[length + typeNameLength]; String[] newSegments = new String[length + typeNameLength];
@ -218,7 +209,6 @@ public class QualifiedTypeName implements IQualifiedTypeName {
} }
public IQualifiedTypeName append(IQualifiedTypeName typeName) { public IQualifiedTypeName append(IQualifiedTypeName typeName) {
Assert.isNotNull(typeName);
int length = fSegments.length; int length = fSegments.length;
int typeNameLength = typeName.segmentCount(); int typeNameLength = typeName.segmentCount();
String[] newSegments = new String[length + typeNameLength]; String[] newSegments = new String[length + typeNameLength];
@ -232,7 +222,6 @@ public class QualifiedTypeName implements IQualifiedTypeName {
} }
public IQualifiedTypeName append(String qualifiedName) { public IQualifiedTypeName append(String qualifiedName) {
Assert.isNotNull(qualifiedName);
return append(createSegments(qualifiedName)); return append(createSegments(qualifiedName));
} }
@ -287,7 +276,6 @@ public class QualifiedTypeName implements IQualifiedTypeName {
} }
public boolean isValidSegment(String segment) { public boolean isValidSegment(String segment) {
Assert.isNotNull(segment);
if (segment.indexOf(QUALIFIER) != -1) if (segment.indexOf(QUALIFIER) != -1)
return false; return false;
// type name must follow C conventions // type name must follow C conventions

View file

@ -29,7 +29,6 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICElementDelta; import org.eclipse.cdt.core.model.ICElementDelta;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.core.internal.runtime.Assert;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.ISafeRunnable;
@ -216,7 +215,6 @@ public class TypeCacheManager implements ITypeCacheChangedListener {
} }
public synchronized ITypeCache getCache(IProject project) { public synchronized ITypeCache getCache(IProject project) {
Assert.isNotNull(project);
synchronized(fCacheMap) { synchronized(fCacheMap) {
ITypeCache cache = (ITypeCache) fCacheMap.get(project); ITypeCache cache = (ITypeCache) fCacheMap.get(project);
if (cache == null) { if (cache == null) {