Lines 15-21
Link Here
|
15 |
import java.io.FileOutputStream; |
15 |
import java.io.FileOutputStream; |
16 |
import java.io.IOException; |
16 |
import java.io.IOException; |
17 |
import java.util.ArrayList; |
17 |
import java.util.ArrayList; |
|
|
18 |
import java.util.Arrays; |
18 |
import java.util.Collections; |
19 |
import java.util.Collections; |
|
|
20 |
import java.util.Comparator; |
21 |
import java.util.HashSet; |
19 |
import java.util.Set; |
22 |
import java.util.Set; |
20 |
import java.util.StringTokenizer; |
23 |
import java.util.StringTokenizer; |
21 |
|
24 |
|
Lines 106-115
Link Here
|
106 |
public byte[] header; |
109 |
public byte[] header; |
107 |
// that collection contains all the remaining bytes of the .class file |
110 |
// that collection contains all the remaining bytes of the .class file |
108 |
public int headerOffset; |
111 |
public int headerOffset; |
109 |
public ReferenceBinding[] innerClassesBindings; |
112 |
public Set innerClassesBindings; |
110 |
public int methodCount; |
113 |
public int methodCount; |
111 |
public int methodCountOffset; |
114 |
public int methodCountOffset; |
112 |
public int numberOfInnerClasses; |
|
|
113 |
// pool managment |
115 |
// pool managment |
114 |
public boolean isShared = false; |
116 |
public boolean isShared = false; |
115 |
// used to generate private access methods |
117 |
// used to generate private access methods |
Lines 256-264
Link Here
|
256 |
// TODO (olivier) handle cases where a field cannot be generated (name too long) |
258 |
// TODO (olivier) handle cases where a field cannot be generated (name too long) |
257 |
// TODO (olivier) handle too many methods |
259 |
// TODO (olivier) handle too many methods |
258 |
// inner attributes |
260 |
// inner attributes |
259 |
if (typeBinding.isMemberType()) |
261 |
if (typeBinding.isNestedType()) { |
260 |
classFile.recordEnclosingTypeAttributes(typeBinding); |
262 |
classFile.recordInnerClasses(typeBinding); |
261 |
|
263 |
} |
|
|
264 |
|
262 |
// add its fields |
265 |
// add its fields |
263 |
FieldBinding[] fields = typeBinding.fields(); |
266 |
FieldBinding[] fields = typeBinding.fields(); |
264 |
if ((fields != null) && (fields != Binding.NO_FIELDS)) { |
267 |
if ((fields != null) && (fields != Binding.NO_FIELDS)) { |
Lines 312-318
Link Here
|
312 |
for (int i = 0, max = typeDeclaration.memberTypes.length; i < max; i++) { |
315 |
for (int i = 0, max = typeDeclaration.memberTypes.length; i < max; i++) { |
313 |
TypeDeclaration memberType = typeDeclaration.memberTypes[i]; |
316 |
TypeDeclaration memberType = typeDeclaration.memberTypes[i]; |
314 |
if (memberType.binding != null) { |
317 |
if (memberType.binding != null) { |
315 |
classFile.recordNestedMemberAttribute(memberType.binding); |
|
|
316 |
ClassFile.createProblemType(memberType, unitResult); |
318 |
ClassFile.createProblemType(memberType, unitResult); |
317 |
} |
319 |
} |
318 |
} |
320 |
} |
Lines 496-560
Link Here
|
496 |
contents[contentsOffset++] = 0; |
498 |
contents[contentsOffset++] = 0; |
497 |
attributeNumber++; |
499 |
attributeNumber++; |
498 |
} |
500 |
} |
499 |
// Inner class attribute |
|
|
500 |
if (numberOfInnerClasses != 0) { |
501 |
// Generate the inner class attribute |
502 |
int exSize = 8 * numberOfInnerClasses + 8; |
503 |
if (exSize + contentsOffset >= this.contents.length) { |
504 |
resizeContents(exSize); |
505 |
} |
506 |
// Now we now the size of the attribute and the number of entries |
507 |
// attribute name |
508 |
int attributeNameIndex = |
509 |
constantPool.literalIndex(AttributeNamesConstants.InnerClassName); |
510 |
contents[contentsOffset++] = (byte) (attributeNameIndex >> 8); |
511 |
contents[contentsOffset++] = (byte) attributeNameIndex; |
512 |
int value = (numberOfInnerClasses << 3) + 2; |
513 |
contents[contentsOffset++] = (byte) (value >> 24); |
514 |
contents[contentsOffset++] = (byte) (value >> 16); |
515 |
contents[contentsOffset++] = (byte) (value >> 8); |
516 |
contents[contentsOffset++] = (byte) value; |
517 |
contents[contentsOffset++] = (byte) (numberOfInnerClasses >> 8); |
518 |
contents[contentsOffset++] = (byte) numberOfInnerClasses; |
519 |
for (int i = 0; i < numberOfInnerClasses; i++) { |
520 |
ReferenceBinding innerClass = innerClassesBindings[i]; |
521 |
int accessFlags = innerClass.getAccessFlags(); |
522 |
int innerClassIndex = constantPool.literalIndexForType(innerClass.constantPoolName()); |
523 |
// inner class index |
524 |
contents[contentsOffset++] = (byte) (innerClassIndex >> 8); |
525 |
contents[contentsOffset++] = (byte) innerClassIndex; |
526 |
// outer class index: anonymous and local have no outer class index |
527 |
if (innerClass.isMemberType()) { |
528 |
// member or member of local |
529 |
int outerClassIndex = constantPool.literalIndexForType(innerClass.enclosingType().constantPoolName()); |
530 |
contents[contentsOffset++] = (byte) (outerClassIndex >> 8); |
531 |
contents[contentsOffset++] = (byte) outerClassIndex; |
532 |
} else { |
533 |
// equals to 0 if the innerClass is not a member type |
534 |
contents[contentsOffset++] = 0; |
535 |
contents[contentsOffset++] = 0; |
536 |
} |
537 |
// name index |
538 |
if (!innerClass.isAnonymousType()) { |
539 |
int nameIndex = constantPool.literalIndex(innerClass.sourceName()); |
540 |
contents[contentsOffset++] = (byte) (nameIndex >> 8); |
541 |
contents[contentsOffset++] = (byte) nameIndex; |
542 |
} else { |
543 |
// equals to 0 if the innerClass is an anonymous type |
544 |
contents[contentsOffset++] = 0; |
545 |
contents[contentsOffset++] = 0; |
546 |
} |
547 |
// access flag |
548 |
if (innerClass.isAnonymousType()) { |
549 |
accessFlags &= ~ClassFileConstants.AccFinal; |
550 |
} else if (innerClass.isMemberType() && innerClass.isInterface()) { |
551 |
accessFlags |= ClassFileConstants.AccStatic; // implicitely static |
552 |
} |
553 |
contents[contentsOffset++] = (byte) (accessFlags >> 8); |
554 |
contents[contentsOffset++] = (byte) accessFlags; |
555 |
} |
556 |
attributeNumber++; |
557 |
} |
558 |
// add signature attribute |
501 |
// add signature attribute |
559 |
char[] genericSignature = referenceBinding.genericSignature(); |
502 |
char[] genericSignature = referenceBinding.genericSignature(); |
560 |
if (genericSignature != null) { |
503 |
if (genericSignature != null) { |
Lines 603-609
Link Here
|
603 |
if (this.referenceBinding instanceof LocalTypeBinding) { |
546 |
if (this.referenceBinding instanceof LocalTypeBinding) { |
604 |
MethodBinding methodBinding = ((LocalTypeBinding) this.referenceBinding).enclosingMethod; |
547 |
MethodBinding methodBinding = ((LocalTypeBinding) this.referenceBinding).enclosingMethod; |
605 |
if (methodBinding != null) { |
548 |
if (methodBinding != null) { |
606 |
int enclosingMethodIndex = constantPool.literalIndexForNameAndType(methodBinding.selector, methodBinding.signature()); |
549 |
int enclosingMethodIndex = constantPool.literalIndexForNameAndType(methodBinding.selector, methodBinding.signature(this)); |
607 |
methodIndexByte1 = (byte) (enclosingMethodIndex >> 8); |
550 |
methodIndexByte1 = (byte) (enclosingMethodIndex >> 8); |
608 |
methodIndexByte2 = (byte) enclosingMethodIndex; |
551 |
methodIndexByte2 = (byte) enclosingMethodIndex; |
609 |
} |
552 |
} |
Lines 638-643
Link Here
|
638 |
contents[contentsOffset++] = 0; |
581 |
contents[contentsOffset++] = 0; |
639 |
attributeNumber++; |
582 |
attributeNumber++; |
640 |
} |
583 |
} |
|
|
584 |
// Inner class attribute |
585 |
int numberOfInnerClasses = this.innerClassesBindings == null ? 0 : this.innerClassesBindings.size(); |
586 |
if (numberOfInnerClasses != 0) { |
587 |
ReferenceBinding[] innerClasses = new ReferenceBinding[numberOfInnerClasses]; |
588 |
this.innerClassesBindings.toArray(innerClasses); |
589 |
Arrays.sort(innerClasses, new Comparator() { |
590 |
public int compare(Object o1, Object o2) { |
591 |
TypeBinding binding1 = (TypeBinding) o1; |
592 |
TypeBinding binding2 = (TypeBinding) o2; |
593 |
return CharOperation.compareTo(binding1.constantPoolName(), binding2.constantPoolName()); |
594 |
} |
595 |
}); |
596 |
// Generate the inner class attribute |
597 |
int exSize = 8 * numberOfInnerClasses + 8; |
598 |
if (exSize + contentsOffset >= this.contents.length) { |
599 |
resizeContents(exSize); |
600 |
} |
601 |
// Now we now the size of the attribute and the number of entries |
602 |
// attribute name |
603 |
int attributeNameIndex = |
604 |
constantPool.literalIndex(AttributeNamesConstants.InnerClassName); |
605 |
contents[contentsOffset++] = (byte) (attributeNameIndex >> 8); |
606 |
contents[contentsOffset++] = (byte) attributeNameIndex; |
607 |
int value = (numberOfInnerClasses << 3) + 2; |
608 |
contents[contentsOffset++] = (byte) (value >> 24); |
609 |
contents[contentsOffset++] = (byte) (value >> 16); |
610 |
contents[contentsOffset++] = (byte) (value >> 8); |
611 |
contents[contentsOffset++] = (byte) value; |
612 |
contents[contentsOffset++] = (byte) (numberOfInnerClasses >> 8); |
613 |
contents[contentsOffset++] = (byte) numberOfInnerClasses; |
614 |
for (int i = 0; i < numberOfInnerClasses; i++) { |
615 |
ReferenceBinding innerClass = innerClasses[i]; |
616 |
int accessFlags = innerClass.getAccessFlags(); |
617 |
int innerClassIndex = constantPool.literalIndexForType(innerClass.constantPoolName()); |
618 |
// inner class index |
619 |
contents[contentsOffset++] = (byte) (innerClassIndex >> 8); |
620 |
contents[contentsOffset++] = (byte) innerClassIndex; |
621 |
// outer class index: anonymous and local have no outer class index |
622 |
if (innerClass.isMemberType()) { |
623 |
// member or member of local |
624 |
int outerClassIndex = constantPool.literalIndexForType(innerClass.enclosingType().constantPoolName()); |
625 |
contents[contentsOffset++] = (byte) (outerClassIndex >> 8); |
626 |
contents[contentsOffset++] = (byte) outerClassIndex; |
627 |
} else { |
628 |
// equals to 0 if the innerClass is not a member type |
629 |
contents[contentsOffset++] = 0; |
630 |
contents[contentsOffset++] = 0; |
631 |
} |
632 |
// name index |
633 |
if (!innerClass.isAnonymousType()) { |
634 |
int nameIndex = constantPool.literalIndex(innerClass.sourceName()); |
635 |
contents[contentsOffset++] = (byte) (nameIndex >> 8); |
636 |
contents[contentsOffset++] = (byte) nameIndex; |
637 |
} else { |
638 |
// equals to 0 if the innerClass is an anonymous type |
639 |
contents[contentsOffset++] = 0; |
640 |
contents[contentsOffset++] = 0; |
641 |
} |
642 |
// access flag |
643 |
if (innerClass.isAnonymousType()) { |
644 |
accessFlags &= ~ClassFileConstants.AccFinal; |
645 |
} else if (innerClass.isMemberType() && innerClass.isInterface()) { |
646 |
accessFlags |= ClassFileConstants.AccStatic; // implicitely static |
647 |
} |
648 |
contents[contentsOffset++] = (byte) (accessFlags >> 8); |
649 |
contents[contentsOffset++] = (byte) accessFlags; |
650 |
} |
651 |
attributeNumber++; |
652 |
} |
641 |
// update the number of attributes |
653 |
// update the number of attributes |
642 |
if (attributeOffset + 2 >= this.contents.length) { |
654 |
if (attributeOffset + 2 >= this.contents.length) { |
643 |
resizeContents(2); |
655 |
resizeContents(2); |
Lines 840-846
Link Here
|
840 |
contents[contentsOffset++] = (byte) (nameIndex >> 8); |
852 |
contents[contentsOffset++] = (byte) (nameIndex >> 8); |
841 |
contents[contentsOffset++] = (byte) nameIndex; |
853 |
contents[contentsOffset++] = (byte) nameIndex; |
842 |
// Then the descriptorIndex |
854 |
// Then the descriptorIndex |
843 |
int descriptorIndex = constantPool.literalIndex(fieldBinding.type.signature()); |
855 |
int descriptorIndex = constantPool.literalIndex(fieldBinding.type); |
844 |
contents[contentsOffset++] = (byte) (descriptorIndex >> 8); |
856 |
contents[contentsOffset++] = (byte) (descriptorIndex >> 8); |
845 |
contents[contentsOffset++] = (byte) descriptorIndex; |
857 |
contents[contentsOffset++] = (byte) descriptorIndex; |
846 |
int fieldAttributeOffset = contentsOffset; |
858 |
int fieldAttributeOffset = contentsOffset; |
Lines 896-926
Link Here
|
896 |
} |
908 |
} |
897 |
} |
909 |
} |
898 |
} |
910 |
} |
899 |
|
|
|
900 |
/** |
901 |
* INTERNAL USE-ONLY |
902 |
* This methods stores the bindings for each inner class. They will be used to know which entries |
903 |
* have to be generated for the inner classes attributes. |
904 |
* @param refBinding org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding |
905 |
*/ |
906 |
private void addInnerClasses(ReferenceBinding refBinding) { |
907 |
// check first if that reference binding is there |
908 |
for (int i = 0; i < numberOfInnerClasses; i++) { |
909 |
if (innerClassesBindings[i] == refBinding) |
910 |
return; |
911 |
} |
912 |
int length = innerClassesBindings.length; |
913 |
if (numberOfInnerClasses == length) { |
914 |
System.arraycopy( |
915 |
innerClassesBindings, |
916 |
0, |
917 |
innerClassesBindings = new ReferenceBinding[length * 2], |
918 |
0, |
919 |
length); |
920 |
} |
921 |
innerClassesBindings[numberOfInnerClasses++] = refBinding; |
922 |
} |
923 |
|
924 |
private void addMissingAbstractProblemMethod(MethodDeclaration methodDeclaration, MethodBinding methodBinding, CategorizedProblem problem, CompilationResult compilationResult) { |
911 |
private void addMissingAbstractProblemMethod(MethodDeclaration methodDeclaration, MethodBinding methodBinding, CategorizedProblem problem, CompilationResult compilationResult) { |
925 |
// always clear the strictfp/native/abstract bit for a problem method |
912 |
// always clear the strictfp/native/abstract bit for a problem method |
926 |
generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); |
913 |
generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); |
Lines 1532-1538
Link Here
|
1532 |
/* represents ClassNotFoundException, see class literal access*/ |
1519 |
/* represents ClassNotFoundException, see class literal access*/ |
1533 |
nameIndex = constantPool.literalIndexForType(ConstantPool.JavaLangClassNotFoundExceptionConstantPoolName); |
1520 |
nameIndex = constantPool.literalIndexForType(ConstantPool.JavaLangClassNotFoundExceptionConstantPoolName); |
1534 |
} else { |
1521 |
} else { |
1535 |
nameIndex = constantPool.literalIndexForType(exceptionLabel.exceptionType.constantPoolName()); |
1522 |
nameIndex = constantPool.literalIndexForType(exceptionLabel.exceptionType); |
1536 |
} |
1523 |
} |
1537 |
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); |
1524 |
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); |
1538 |
this.contents[localContentsOffset++] = (byte) nameIndex; |
1525 |
this.contents[localContentsOffset++] = (byte) nameIndex; |
Lines 2212-2218
Link Here
|
2212 |
/* represents denote ClassNotFoundException, see class literal access*/ |
2199 |
/* represents denote ClassNotFoundException, see class literal access*/ |
2213 |
nameIndex = constantPool.literalIndexForType(ConstantPool.JavaLangClassNotFoundExceptionConstantPoolName); |
2200 |
nameIndex = constantPool.literalIndexForType(ConstantPool.JavaLangClassNotFoundExceptionConstantPoolName); |
2214 |
} else { |
2201 |
} else { |
2215 |
nameIndex = constantPool.literalIndexForType(exceptionLabel.exceptionType.constantPoolName()); |
2202 |
nameIndex = constantPool.literalIndexForType(exceptionLabel.exceptionType); |
2216 |
} |
2203 |
} |
2217 |
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); |
2204 |
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); |
2218 |
this.contents[localContentsOffset++] = (byte) nameIndex; |
2205 |
this.contents[localContentsOffset++] = (byte) nameIndex; |
Lines 4407-4413
Link Here
|
4407 |
nameIndex = constantPool.literalIndexForType(ConstantPool.JavaLangNoSuchFieldErrorConstantPoolName); |
4394 |
nameIndex = constantPool.literalIndexForType(ConstantPool.JavaLangNoSuchFieldErrorConstantPoolName); |
4408 |
break; |
4395 |
break; |
4409 |
default: |
4396 |
default: |
4410 |
nameIndex = constantPool.literalIndexForType(exceptionLabel.exceptionType.constantPoolName()); |
4397 |
nameIndex = constantPool.literalIndexForType(exceptionLabel.exceptionType); |
4411 |
} |
4398 |
} |
4412 |
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); |
4399 |
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); |
4413 |
this.contents[localContentsOffset++] = (byte) nameIndex; |
4400 |
this.contents[localContentsOffset++] = (byte) nameIndex; |
Lines 5330-5336
Link Here
|
5330 |
contents[contentsOffset++] = (byte) (length >> 8); |
5317 |
contents[contentsOffset++] = (byte) (length >> 8); |
5331 |
contents[contentsOffset++] = (byte) length; |
5318 |
contents[contentsOffset++] = (byte) length; |
5332 |
for (int i = 0; i < length; i++) { |
5319 |
for (int i = 0; i < length; i++) { |
5333 |
int exceptionIndex = constantPool.literalIndexForType(thrownsExceptions[i].constantPoolName()); |
5320 |
int exceptionIndex = constantPool.literalIndexForType(thrownsExceptions[i]); |
5334 |
contents[contentsOffset++] = (byte) (exceptionIndex >> 8); |
5321 |
contents[contentsOffset++] = (byte) (exceptionIndex >> 8); |
5335 |
contents[contentsOffset++] = (byte) exceptionIndex; |
5322 |
contents[contentsOffset++] = (byte) exceptionIndex; |
5336 |
} |
5323 |
} |
Lines 5457-5463
Link Here
|
5457 |
int nameIndex = constantPool.literalIndex(methodBinding.selector); |
5444 |
int nameIndex = constantPool.literalIndex(methodBinding.selector); |
5458 |
contents[contentsOffset++] = (byte) (nameIndex >> 8); |
5445 |
contents[contentsOffset++] = (byte) (nameIndex >> 8); |
5459 |
contents[contentsOffset++] = (byte) nameIndex; |
5446 |
contents[contentsOffset++] = (byte) nameIndex; |
5460 |
int descriptorIndex = constantPool.literalIndex(methodBinding.signature()); |
5447 |
int descriptorIndex = constantPool.literalIndex(methodBinding.signature(this)); |
5461 |
contents[contentsOffset++] = (byte) (descriptorIndex >> 8); |
5448 |
contents[contentsOffset++] = (byte) (descriptorIndex >> 8); |
5462 |
contents[contentsOffset++] = (byte) descriptorIndex; |
5449 |
contents[contentsOffset++] = (byte) descriptorIndex; |
5463 |
} |
5450 |
} |
Lines 5832-5838
Link Here
|
5832 |
// now we continue to generate the bytes inside the contents array |
5819 |
// now we continue to generate the bytes inside the contents array |
5833 |
contents[contentsOffset++] = (byte) (accessFlags >> 8); |
5820 |
contents[contentsOffset++] = (byte) (accessFlags >> 8); |
5834 |
contents[contentsOffset++] = (byte) accessFlags; |
5821 |
contents[contentsOffset++] = (byte) accessFlags; |
5835 |
int classNameIndex = constantPool.literalIndexForType(aType.constantPoolName()); |
5822 |
int classNameIndex = constantPool.literalIndexForType(aType); |
5836 |
contents[contentsOffset++] = (byte) (classNameIndex >> 8); |
5823 |
contents[contentsOffset++] = (byte) (classNameIndex >> 8); |
5837 |
contents[contentsOffset++] = (byte) classNameIndex; |
5824 |
contents[contentsOffset++] = (byte) classNameIndex; |
5838 |
int superclassNameIndex; |
5825 |
int superclassNameIndex; |
Lines 5840-5846
Link Here
|
5840 |
superclassNameIndex = constantPool.literalIndexForType(ConstantPool.JavaLangObjectConstantPoolName); |
5827 |
superclassNameIndex = constantPool.literalIndexForType(ConstantPool.JavaLangObjectConstantPoolName); |
5841 |
} else { |
5828 |
} else { |
5842 |
superclassNameIndex = |
5829 |
superclassNameIndex = |
5843 |
(aType.superclass == null ? 0 : constantPool.literalIndexForType(aType.superclass.constantPoolName())); |
5830 |
(aType.superclass == null ? 0 : constantPool.literalIndexForType(aType.superclass)); |
5844 |
} |
5831 |
} |
5845 |
contents[contentsOffset++] = (byte) (superclassNameIndex >> 8); |
5832 |
contents[contentsOffset++] = (byte) (superclassNameIndex >> 8); |
5846 |
contents[contentsOffset++] = (byte) superclassNameIndex; |
5833 |
contents[contentsOffset++] = (byte) superclassNameIndex; |
Lines 5849-5859
Link Here
|
5849 |
contents[contentsOffset++] = (byte) (interfacesCount >> 8); |
5836 |
contents[contentsOffset++] = (byte) (interfacesCount >> 8); |
5850 |
contents[contentsOffset++] = (byte) interfacesCount; |
5837 |
contents[contentsOffset++] = (byte) interfacesCount; |
5851 |
for (int i = 0; i < interfacesCount; i++) { |
5838 |
for (int i = 0; i < interfacesCount; i++) { |
5852 |
int interfaceIndex = constantPool.literalIndexForType(superInterfacesBinding[i].constantPoolName()); |
5839 |
int interfaceIndex = constantPool.literalIndexForType(superInterfacesBinding[i]); |
5853 |
contents[contentsOffset++] = (byte) (interfaceIndex >> 8); |
5840 |
contents[contentsOffset++] = (byte) (interfaceIndex >> 8); |
5854 |
contents[contentsOffset++] = (byte) interfaceIndex; |
5841 |
contents[contentsOffset++] = (byte) interfaceIndex; |
5855 |
} |
5842 |
} |
5856 |
innerClassesBindings = new ReferenceBinding[INNER_CLASSES_SIZE]; |
|
|
5857 |
this.creatingProblemType = createProblemType; |
5843 |
this.creatingProblemType = createProblemType; |
5858 |
|
5844 |
|
5859 |
// retrieve the enclosing one guaranteed to be the one matching the propagated flow info |
5845 |
// retrieve the enclosing one guaranteed to be the one matching the propagated flow info |
Lines 5904-5981
Link Here
|
5904 |
return current; |
5890 |
return current; |
5905 |
} |
5891 |
} |
5906 |
|
5892 |
|
5907 |
/** |
5893 |
public void recordInnerClasses(TypeBinding binding) { |
5908 |
* INTERNAL USE-ONLY |
5894 |
if (this.innerClassesBindings == null) { |
5909 |
* This is used to store a new inner class. It checks that the binding @binding doesn't already exist inside the |
5895 |
this.innerClassesBindings = new HashSet(INNER_CLASSES_SIZE); |
5910 |
* collection of inner classes. Add all the necessary classes in the right order to fit to the specifications. |
5896 |
} |
5911 |
* |
5897 |
ReferenceBinding innerClass = (ReferenceBinding) binding; |
5912 |
* @param binding org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding |
5898 |
this.innerClassesBindings.add(innerClass.erasure()); |
5913 |
*/ |
5899 |
ReferenceBinding enclosingType = innerClass.enclosingType(); |
5914 |
public void recordEnclosingTypeAttributes(ReferenceBinding binding) { |
5900 |
while (enclosingType != null |
5915 |
// add all the enclosing types |
5901 |
&& enclosingType.isNestedType()) { |
5916 |
ReferenceBinding enclosingType = referenceBinding.enclosingType(); |
5902 |
this.innerClassesBindings.add(enclosingType.erasure()); |
5917 |
int depth = 0; |
|
|
5918 |
while (enclosingType != null) { |
5919 |
depth++; |
5920 |
enclosingType = enclosingType.enclosingType(); |
5921 |
} |
5922 |
enclosingType = referenceBinding; |
5923 |
ReferenceBinding enclosingTypes[]; |
5924 |
if (depth >= 2) { |
5925 |
enclosingTypes = new ReferenceBinding[depth]; |
5926 |
for (int i = depth - 1; i >= 0; i--) { |
5927 |
enclosingTypes[i] = enclosingType; |
5928 |
enclosingType = enclosingType.enclosingType(); |
5929 |
} |
5930 |
for (int i = 0; i < depth; i++) { |
5931 |
addInnerClasses(enclosingTypes[i]); |
5932 |
} |
5933 |
} else { |
5934 |
addInnerClasses(referenceBinding); |
5935 |
} |
5936 |
} |
5937 |
|
5938 |
/** |
5939 |
* INTERNAL USE-ONLY |
5940 |
* This is used to store a new inner class. It checks that the binding @binding doesn't already exist inside the |
5941 |
* collection of inner classes. Add all the necessary classes in the right order to fit to the specifications. |
5942 |
* |
5943 |
* @param binding org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding |
5944 |
*/ |
5945 |
public void recordNestedLocalAttribute(ReferenceBinding binding) { |
5946 |
// add all the enclosing types |
5947 |
ReferenceBinding enclosingType = referenceBinding.enclosingType(); |
5948 |
int depth = 0; |
5949 |
while (enclosingType != null) { |
5950 |
depth++; |
5951 |
enclosingType = enclosingType.enclosingType(); |
5903 |
enclosingType = enclosingType.enclosingType(); |
5952 |
} |
5904 |
} |
5953 |
enclosingType = referenceBinding; |
|
|
5954 |
ReferenceBinding enclosingTypes[]; |
5955 |
if (depth >= 2) { |
5956 |
enclosingTypes = new ReferenceBinding[depth]; |
5957 |
for (int i = depth - 1; i >= 0; i--) { |
5958 |
enclosingTypes[i] = enclosingType; |
5959 |
enclosingType = enclosingType.enclosingType(); |
5960 |
} |
5961 |
for (int i = 0; i < depth; i++) |
5962 |
addInnerClasses(enclosingTypes[i]); |
5963 |
} else { |
5964 |
addInnerClasses(binding); |
5965 |
} |
5966 |
} |
5905 |
} |
5967 |
|
5906 |
|
5968 |
/** |
|
|
5969 |
* INTERNAL USE-ONLY |
5970 |
* This is used to store a new inner class. It checks that the binding @binding doesn't already exist inside the |
5971 |
* collection of inner classes. Add all the necessary classes in the right order to fit to the specifications. |
5972 |
* |
5973 |
* @param binding org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding |
5974 |
*/ |
5975 |
public void recordNestedMemberAttribute(ReferenceBinding binding) { |
5976 |
addInnerClasses(binding); |
5977 |
} |
5978 |
|
5979 |
public void reset(SourceTypeBinding typeBinding) { |
5907 |
public void reset(SourceTypeBinding typeBinding) { |
5980 |
// the code stream is reinitialized for each method |
5908 |
// the code stream is reinitialized for each method |
5981 |
final CompilerOptions options = typeBinding.scope.compilerOptions(); |
5909 |
final CompilerOptions options = typeBinding.scope.compilerOptions(); |
Lines 5995-6001
Link Here
|
5995 |
this.headerOffset = 0; |
5923 |
this.headerOffset = 0; |
5996 |
this.methodCount = 0; |
5924 |
this.methodCount = 0; |
5997 |
this.methodCountOffset = 0; |
5925 |
this.methodCountOffset = 0; |
5998 |
this.numberOfInnerClasses = 0; |
5926 |
if (this.innerClassesBindings != null) { |
|
|
5927 |
this.innerClassesBindings.clear(); |
5928 |
} |
5999 |
} |
5929 |
} |
6000 |
|
5930 |
|
6001 |
/** |
5931 |
/** |