Lines 54-61
Link Here
|
54 |
} |
54 |
} |
55 |
|
55 |
|
56 |
private void buildFields() { |
56 |
private void buildFields() { |
|
|
57 |
SourceTypeBinding sourceType = referenceContext.binding; |
57 |
if (referenceContext.fields == null) { |
58 |
if (referenceContext.fields == null) { |
58 |
referenceContext.binding.setFields(Binding.NO_FIELDS); |
59 |
sourceType.setFields(Binding.NO_FIELDS); |
59 |
return; |
60 |
return; |
60 |
} |
61 |
} |
61 |
// count the number of fields vs. initializers |
62 |
// count the number of fields vs. initializers |
Lines 78-87
Link Here
|
78 |
for (int i = 0; i < size; i++) { |
79 |
for (int i = 0; i < size; i++) { |
79 |
FieldDeclaration field = fields[i]; |
80 |
FieldDeclaration field = fields[i]; |
80 |
if (field.getKind() == AbstractVariableDeclaration.INITIALIZER) { |
81 |
if (field.getKind() == AbstractVariableDeclaration.INITIALIZER) { |
81 |
if (referenceContext.binding.isInterface()) |
82 |
if (sourceType.isInterface()) |
82 |
problemReporter().interfaceCannotHaveInitializers(referenceContext.binding, field); |
83 |
problemReporter().interfaceCannotHaveInitializers(sourceType, field); |
83 |
} else { |
84 |
} else { |
84 |
FieldBinding fieldBinding = new FieldBinding(field, null, field.modifiers | ExtraCompilerModifiers.AccUnresolved, referenceContext.binding); |
85 |
FieldBinding fieldBinding = new FieldBinding(field, null, field.modifiers | ExtraCompilerModifiers.AccUnresolved, sourceType); |
85 |
fieldBinding.id = count; |
86 |
fieldBinding.id = count; |
86 |
// field's type will be resolved when needed for top level types |
87 |
// field's type will be resolved when needed for top level types |
87 |
checkAndSetModifiersForField(fieldBinding, field); |
88 |
checkAndSetModifiersForField(fieldBinding, field); |
Lines 93-106
Link Here
|
93 |
for (int f = 0; f < i; f++) { |
94 |
for (int f = 0; f < i; f++) { |
94 |
FieldDeclaration previousField = fields[f]; |
95 |
FieldDeclaration previousField = fields[f]; |
95 |
if (previousField.binding == previousBinding) { |
96 |
if (previousField.binding == previousBinding) { |
96 |
problemReporter().duplicateFieldInType(referenceContext.binding, previousField); |
97 |
problemReporter().duplicateFieldInType(sourceType, previousField); |
97 |
previousField.binding = null; |
98 |
previousField.binding = null; |
98 |
break; |
99 |
break; |
99 |
} |
100 |
} |
100 |
} |
101 |
} |
101 |
} |
102 |
} |
102 |
knownFieldNames.put(field.name, null); // ensure that the duplicate field is found & removed |
103 |
knownFieldNames.put(field.name, null); // ensure that the duplicate field is found & removed |
103 |
problemReporter().duplicateFieldInType(referenceContext.binding, field); |
104 |
problemReporter().duplicateFieldInType(sourceType, field); |
104 |
field.binding = null; |
105 |
field.binding = null; |
105 |
} else { |
106 |
} else { |
106 |
knownFieldNames.put(field.name, fieldBinding); |
107 |
knownFieldNames.put(field.name, fieldBinding); |
Lines 126-132
Link Here
|
126 |
} |
127 |
} |
127 |
if (count != fieldBindings.length) |
128 |
if (count != fieldBindings.length) |
128 |
System.arraycopy(fieldBindings, 0, fieldBindings = new FieldBinding[count], 0, count); |
129 |
System.arraycopy(fieldBindings, 0, fieldBindings = new FieldBinding[count], 0, count); |
129 |
referenceContext.binding.setFields(fieldBindings); |
130 |
sourceType.tagBits &= ~(TagBits.AreFieldsSorted|TagBits.AreFieldsComplete); // in case some static imports reached already into this type |
|
|
131 |
sourceType.setFields(fieldBindings); |
130 |
} |
132 |
} |
131 |
|
133 |
|
132 |
void buildFieldsAndMethods() { |
134 |
void buildFieldsAndMethods() { |
Lines 290-296
Link Here
|
290 |
} |
292 |
} |
291 |
if (count != methodBindings.length) |
293 |
if (count != methodBindings.length) |
292 |
System.arraycopy(methodBindings, 0, methodBindings = new MethodBinding[count], 0, count); |
294 |
System.arraycopy(methodBindings, 0, methodBindings = new MethodBinding[count], 0, count); |
293 |
sourceType.tagBits &= ~TagBits.AreMethodsSorted; // in case some static imports reached already into this type |
295 |
sourceType.tagBits &= ~(TagBits.AreMethodsSorted|TagBits.AreMethodsComplete); // in case some static imports reached already into this type |
294 |
sourceType.setMethods(methodBindings); |
296 |
sourceType.setMethods(methodBindings); |
295 |
} |
297 |
} |
296 |
|
298 |
|