Lines 621-660
Link Here
|
621 |
fieldBinding.modifiers = modifiers; |
621 |
fieldBinding.modifiers = modifiers; |
622 |
} |
622 |
} |
623 |
|
623 |
|
624 |
public void checkParameterizedSuperTypeCollisions() { |
624 |
/** |
625 |
// check for parameterized interface collisions (when different parameterizations occur) |
625 |
* Check for super type collisions (both superinterfaces and type variables). |
|
|
626 |
* @return the list of non-colliding superinterfaces |
627 |
*/ |
628 |
public ReferenceBinding[] computeNonCollidingSuperInterfaces() { |
626 |
SourceTypeBinding sourceType = referenceContext.binding; |
629 |
SourceTypeBinding sourceType = referenceContext.binding; |
627 |
ReferenceBinding[] interfaces = sourceType.superInterfaces; |
630 |
if (compilerOptions().sourceLevel < ClassFileConstants.JDK1_5) return sourceType.superInterfaces; |
628 |
int count = interfaces.length; |
631 |
ReferenceBinding[] nonCollidingSuperInterfaces = sourceType.superInterfaces; // lazy allocation of clone if problem is discovered |
|
|
632 |
int count = nonCollidingSuperInterfaces.length; |
629 |
Map invocations = new HashMap(2); |
633 |
Map invocations = new HashMap(2); |
630 |
ReferenceBinding itsSuperclass = sourceType.isInterface() ? null : sourceType.superclass; |
634 |
ReferenceBinding itsSuperclass = sourceType.isInterface() ? null : sourceType.superclass; |
|
|
635 |
|
636 |
// check for parameterized interface collisions (when different parameterizations occur) |
631 |
nextInterface: for (int i = 0, length = count; i < length; i++) { |
637 |
nextInterface: for (int i = 0, length = count; i < length; i++) { |
632 |
ReferenceBinding one = interfaces[i]; |
638 |
ReferenceBinding one = nonCollidingSuperInterfaces[i]; |
633 |
if (one == null) continue nextInterface; |
639 |
if (one == null) continue nextInterface; |
634 |
if (itsSuperclass != null && hasErasedCandidatesCollisions(itsSuperclass, one, invocations, sourceType, referenceContext)) { |
640 |
if (itsSuperclass != null && hasErasedCandidatesCollisions(itsSuperclass, one, invocations, sourceType, referenceContext)) { |
635 |
interfaces[i] = null; |
641 |
if (nonCollidingSuperInterfaces == sourceType.superInterfaces) { // lazy cloning |
|
|
642 |
System.arraycopy(sourceType.superInterfaces, 0, nonCollidingSuperInterfaces = new ReferenceBinding[count], 0, count); |
643 |
} |
644 |
nonCollidingSuperInterfaces[i] = null; |
636 |
count--; |
645 |
count--; |
637 |
continue nextInterface; |
646 |
continue nextInterface; |
638 |
} |
647 |
} |
639 |
nextOtherInterface: for (int j = 0; j < i; j++) { |
648 |
nextOtherInterface: for (int j = 0; j < i; j++) { |
640 |
ReferenceBinding two = interfaces[j]; |
649 |
ReferenceBinding two = nonCollidingSuperInterfaces[j]; |
641 |
if (two == null) continue nextOtherInterface; |
650 |
if (two == null) continue nextOtherInterface; |
642 |
if (hasErasedCandidatesCollisions(one, two, invocations, sourceType, referenceContext)) { |
651 |
if (hasErasedCandidatesCollisions(one, two, invocations, sourceType, referenceContext)) { |
643 |
interfaces[i] = null; |
652 |
if (nonCollidingSuperInterfaces == sourceType.superInterfaces) { // lazy cloning |
|
|
653 |
System.arraycopy(sourceType.superInterfaces, 0, nonCollidingSuperInterfaces = new ReferenceBinding[count], 0, count); |
654 |
} |
655 |
nonCollidingSuperInterfaces[i] = null; |
644 |
count--; |
656 |
count--; |
645 |
continue nextInterface; |
657 |
continue nextInterface; |
646 |
} |
658 |
} |
647 |
} |
659 |
} |
648 |
} |
660 |
} |
649 |
if (count < interfaces.length) { |
661 |
if (count < nonCollidingSuperInterfaces.length) { |
650 |
if (count == 0) { |
662 |
if (count == 0) { |
651 |
sourceType.superInterfaces = Binding.NO_SUPERINTERFACES; |
663 |
nonCollidingSuperInterfaces = Binding.NO_SUPERINTERFACES; |
652 |
} else { |
664 |
} else { |
653 |
ReferenceBinding[] newInterfaceBindings = new ReferenceBinding[count]; |
665 |
ReferenceBinding[] newInterfaceBindings = new ReferenceBinding[count]; |
654 |
for (int i = 0, j = 0, l = interfaces.length; i < l; i++) |
666 |
for (int i = 0, j = 0, l = nonCollidingSuperInterfaces.length; i < l; i++) |
655 |
if (interfaces[i] != null) |
667 |
if (nonCollidingSuperInterfaces[i] != null) |
656 |
newInterfaceBindings[j++] = interfaces[i]; |
668 |
newInterfaceBindings[j++] = nonCollidingSuperInterfaces[i]; |
657 |
sourceType.superInterfaces = newInterfaceBindings; |
669 |
nonCollidingSuperInterfaces = newInterfaceBindings; |
658 |
} |
670 |
} |
659 |
} |
671 |
} |
660 |
|
672 |
|
Lines 683-693
Link Here
|
683 |
} |
695 |
} |
684 |
} |
696 |
} |
685 |
} |
697 |
} |
686 |
|
698 |
return nonCollidingSuperInterfaces; |
687 |
ReferenceBinding[] memberTypes = referenceContext.binding.memberTypes; |
|
|
688 |
if (memberTypes != null && memberTypes != Binding.NO_MEMBER_TYPES) |
689 |
for (int i = 0, size = memberTypes.length; i < size; i++) |
690 |
((SourceTypeBinding) memberTypes[i]).scope.checkParameterizedSuperTypeCollisions(); |
691 |
} |
699 |
} |
692 |
|
700 |
|
693 |
private void checkForInheritedMemberTypes(SourceTypeBinding sourceType) { |
701 |
private void checkForInheritedMemberTypes(SourceTypeBinding sourceType) { |