1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Defensive coding.

This commit is contained in:
Sergey Prigogin 2013-03-15 15:47:06 -07:00
parent 20d1ecd441
commit 16ce2c1630

View file

@ -103,6 +103,8 @@ public class IncludeOrganizer {
/** Initializes an include prototype for a new include */ /** Initializes an include prototype for a new include */
IncludePrototype(IPath header, IncludeInfo includeInfo, IncludeGroupStyle style) { IncludePrototype(IPath header, IncludeInfo includeInfo, IncludeGroupStyle style) {
if (includeInfo == null)
throw new NullPointerException();
this.header = header; this.header = header;
this.includeInfo = includeInfo; this.includeInfo = includeInfo;
this.style = style; this.style = style;
@ -115,6 +117,8 @@ public class IncludeOrganizer {
*/ */
IncludePrototype(IASTPreprocessorIncludeStatement include, IPath header, IncludePrototype(IASTPreprocessorIncludeStatement include, IPath header,
IncludeInfo includeInfo, IncludeGroupStyle style) { IncludeInfo includeInfo, IncludeGroupStyle style) {
if (includeInfo == null)
throw new NullPointerException();
this.existingInclude = include; this.existingInclude = include;
this.header = header; this.header = header;
this.includeInfo = includeInfo; this.includeInfo = includeInfo;
@ -146,10 +150,6 @@ public class IncludeOrganizer {
return header.equals(other.header); // includeInfo is ignored if header is not null return header.equals(other.header); // includeInfo is ignored if header is not null
if (other.header != null) if (other.header != null)
return false; return false;
if (includeInfo == null) {
if (other.includeInfo != null)
return false;
}
return includeInfo.equals(other.includeInfo); return includeInfo.equals(other.includeInfo);
} }