View | Details | Raw Unified | Return to bug 143259 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-7 / +14 lines)
Lines 28-33 Link Here
28
import org.eclipse.jdt.internal.compiler.impl.Constant;
28
import org.eclipse.jdt.internal.compiler.impl.Constant;
29
import org.eclipse.jdt.internal.compiler.util.Util;
29
import org.eclipse.jdt.internal.compiler.util.Util;
30
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
30
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
31
import org.eclipse.jdt.internal.compiler.util.SimpleSet;
31
32
32
public class SourceTypeBinding extends ReferenceBinding {
33
public class SourceTypeBinding extends ReferenceBinding {
33
	public ReferenceBinding superclass;
34
	public ReferenceBinding superclass;
Lines 590-596 Link Here
590
	if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
591
	if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
591
		return this.fields;	
592
		return this.fields;	
592
593
593
	int failed = 0;
594
	SimpleSet failedFields = null;
594
	try {
595
	try {
595
		// lazily sort fields
596
		// lazily sort fields
596
		if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {
597
		if ((this.tagBits & TagBits.AreFieldsSorted) == 0) {
Lines 598-620 Link Here
598
			if (length > 1)
599
			if (length > 1)
599
				ReferenceBinding.sortFields(this.fields, 0, length);
600
				ReferenceBinding.sortFields(this.fields, 0, length);
600
			this.tagBits |= TagBits.AreFieldsSorted;
601
			this.tagBits |= TagBits.AreFieldsSorted;
601
		}			
602
		}
602
		for (int i = 0, length = this.fields.length; i < length; i++) {
603
		for (int i = 0, length = this.fields.length; i < length; i++) {
603
			if (resolveTypeFor(this.fields[i]) == null) {
604
			if (resolveTypeFor(this.fields[i]) == null) {
604
				this.fields[i] = null;
605
				if (failedFields == null)
605
				failed++;
606
					failedFields = new SimpleSet(3);
607
				failedFields.add(this.fields[i]);
606
			}
608
			}
607
		}
609
		}
608
	} finally {
610
	} finally {
609
		if (failed > 0) {
611
		if (failedFields != null) {
610
			// ensure fields are consistent reqardless of the error
612
			// ensure fields are consistent reqardless of the error
611
			int newSize = this.fields.length - failed;
613
			// count how many fields should remain
614
			int newSize = 0;
615
			for (int i = 0, l = this.fields.length; i < l; i++) {
616
				if (!failedFields.includes(this.fields[i]))
617
					newSize++;
618
			}
612
			if (newSize == 0)
619
			if (newSize == 0)
613
				return this.fields = Binding.NO_FIELDS;
620
				return this.fields = Binding.NO_FIELDS;
614
621
615
			FieldBinding[] newFields = new FieldBinding[newSize];
622
			FieldBinding[] newFields = new FieldBinding[newSize];
616
			for (int i = 0, j = 0, length = this.fields.length; i < length; i++) {
623
			for (int i = 0, j = 0, length = this.fields.length; i < length; i++) {
617
				if (this.fields[i] != null)
624
				if (!failedFields.includes(this.fields[i]))
618
					newFields[j++] = this.fields[i];
625
					newFields[j++] = this.fields[i];
619
			}
626
			}
620
			this.fields = newFields;
627
			this.fields = newFields;

Return to bug 143259