|
Lines 18-23
Link Here
|
| 18 |
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; |
18 |
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; |
| 19 |
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; |
19 |
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; |
| 20 |
import org.eclipse.jdt.internal.compiler.lookup.TagBits; |
20 |
import org.eclipse.jdt.internal.compiler.lookup.TagBits; |
|
|
21 |
import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; |
| 21 |
|
22 |
|
| 22 |
/** |
23 |
/** |
| 23 |
* Record initialization status during definite assignment analysis |
24 |
* Record initialization status during definite assignment analysis |
|
Lines 82-88
Link Here
|
| 82 |
// arrays which have the same size |
83 |
// arrays which have the same size |
| 83 |
|
84 |
|
| 84 |
public int maxFieldCount; // limit between fields and locals |
85 |
public int maxFieldCount; // limit between fields and locals |
| 85 |
|
|
|
| 86 |
// Constants |
86 |
// Constants |
| 87 |
public static final int BitCacheSize = 64; // 64 bits in a long. |
87 |
public static final int BitCacheSize = 64; // 64 bits in a long. |
| 88 |
public int[] nullStatusChangedInAssert; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=303448 |
88 |
public int[] nullStatusChangedInAssert; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=303448 |
|
Lines 515-527
Link Here
|
| 515 |
return this; |
515 |
return this; |
| 516 |
} |
516 |
} |
| 517 |
|
517 |
|
| 518 |
final public boolean cannotBeDefinitelyNullOrNonNull(LocalVariableBinding local) { |
518 |
final public boolean cannotBeDefinitelyNullOrNonNull(VariableBinding local) { |
| 519 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
519 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
| 520 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
520 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
| 521 |
return false; |
521 |
return false; |
| 522 |
} |
522 |
} |
| 523 |
int position; |
523 |
int position; |
| 524 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
524 |
if (local instanceof FieldBinding) { |
|
|
525 |
position = local.id; |
| 526 |
} else { |
| 527 |
position = local.id + this.maxFieldCount; |
| 528 |
} |
| 529 |
if (position < BitCacheSize) { |
| 525 |
// use bits |
530 |
// use bits |
| 526 |
return ( |
531 |
return ( |
| 527 |
(~this.nullBit1 |
532 |
(~this.nullBit1 |
|
Lines 546-558
Link Here
|
| 546 |
& (1L << (position % BitCacheSize))) != 0; |
551 |
& (1L << (position % BitCacheSize))) != 0; |
| 547 |
} |
552 |
} |
| 548 |
|
553 |
|
| 549 |
final public boolean cannotBeNull(LocalVariableBinding local) { |
554 |
final public boolean cannotBeNull(VariableBinding local) { |
| 550 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
555 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
| 551 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
556 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
| 552 |
return false; |
557 |
return false; |
| 553 |
} |
558 |
} |
| 554 |
int position; |
559 |
int position; |
| 555 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
560 |
if (local instanceof FieldBinding) { |
|
|
561 |
position = local.id; |
| 562 |
} else { |
| 563 |
position = local.id + this.maxFieldCount; |
| 564 |
} |
| 565 |
if (position < BitCacheSize) { |
| 556 |
// use bits |
566 |
// use bits |
| 557 |
return (this.nullBit1 & this.nullBit3 |
567 |
return (this.nullBit1 & this.nullBit3 |
| 558 |
& ((this.nullBit2 & this.nullBit4) | ~this.nullBit2) |
568 |
& ((this.nullBit2 & this.nullBit4) | ~this.nullBit2) |
|
Lines 573-585
Link Here
|
| 573 |
& (1L << (position % BitCacheSize))) != 0; |
583 |
& (1L << (position % BitCacheSize))) != 0; |
| 574 |
} |
584 |
} |
| 575 |
|
585 |
|
| 576 |
final public boolean canOnlyBeNull(LocalVariableBinding local) { |
586 |
final public boolean canOnlyBeNull(VariableBinding local) { |
| 577 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
587 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
| 578 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
588 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
| 579 |
return false; |
589 |
return false; |
| 580 |
} |
590 |
} |
| 581 |
int position; |
591 |
int position; |
| 582 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
592 |
if (local instanceof FieldBinding) { |
|
|
593 |
position = local.id; |
| 594 |
} else { |
| 595 |
position = local.id + this.maxFieldCount; |
| 596 |
} |
| 597 |
if (position < BitCacheSize) { |
| 583 |
// use bits |
598 |
// use bits |
| 584 |
return (this.nullBit1 & this.nullBit2 |
599 |
return (this.nullBit1 & this.nullBit2 |
| 585 |
& (~this.nullBit3 | ~this.nullBit4) |
600 |
& (~this.nullBit3 | ~this.nullBit4) |
|
Lines 745-751
Link Here
|
| 745 |
return isDefinitelyAssigned(local.id + this.maxFieldCount); |
760 |
return isDefinitelyAssigned(local.id + this.maxFieldCount); |
| 746 |
} |
761 |
} |
| 747 |
|
762 |
|
| 748 |
final public boolean isDefinitelyNonNull(LocalVariableBinding local) { |
763 |
final public boolean isDefinitelyNonNull(VariableBinding local) { |
|
|
764 |
if (local instanceof FieldBinding && (this.tagBits & NULL_FLAG_MASK) == 0) { |
| 765 |
// no local yet in scope. Came here because of a field being queried for non null |
| 766 |
// will only happen for final fields, since they are assigned in a constructor or static block |
| 767 |
// and we may currently be in some other method |
| 768 |
this.tagBits |= NULL_FLAG_MASK; |
| 769 |
} |
| 749 |
// do not want to complain in unreachable code |
770 |
// do not want to complain in unreachable code |
| 750 |
if ((this.tagBits & UNREACHABLE) != 0 || |
771 |
if ((this.tagBits & UNREACHABLE) != 0 || |
| 751 |
(this.tagBits & NULL_FLAG_MASK) == 0) { |
772 |
(this.tagBits & NULL_FLAG_MASK) == 0) { |
|
Lines 755-761
Link Here
|
| 755 |
local.constant() != Constant.NotAConstant) { // String instances |
776 |
local.constant() != Constant.NotAConstant) { // String instances |
| 756 |
return true; |
777 |
return true; |
| 757 |
} |
778 |
} |
| 758 |
int position = local.id + this.maxFieldCount; |
779 |
int position; |
|
|
780 |
if (local instanceof FieldBinding) { |
| 781 |
if (local.isFinal() && ((FieldBinding)local).isStatic()) { |
| 782 |
// static final field's null status may not be in the flow info |
| 783 |
return (((FieldBinding) local).getNullStatusForStaticFinalField() == FlowInfo.NON_NULL); |
| 784 |
} |
| 785 |
position = local.id; |
| 786 |
} else { |
| 787 |
position = local.id + this.maxFieldCount; |
| 788 |
} |
| 759 |
if (position < BitCacheSize) { // use bits |
789 |
if (position < BitCacheSize) { // use bits |
| 760 |
return ((this.nullBit1 & this.nullBit3 & (~this.nullBit2 | this.nullBit4)) |
790 |
return ((this.nullBit1 & this.nullBit3 & (~this.nullBit2 | this.nullBit4)) |
| 761 |
& (1L << position)) != 0; |
791 |
& (1L << position)) != 0; |
|
Lines 774-787
Link Here
|
| 774 |
& (1L << (position % BitCacheSize))) != 0; |
804 |
& (1L << (position % BitCacheSize))) != 0; |
| 775 |
} |
805 |
} |
| 776 |
|
806 |
|
| 777 |
final public boolean isDefinitelyNull(LocalVariableBinding local) { |
807 |
final public boolean isDefinitelyNull(VariableBinding local) { |
|
|
808 |
if (local instanceof FieldBinding && (this.tagBits & NULL_FLAG_MASK) == 0) { |
| 809 |
// no local yet in scope. Came here because of a field being queried for non null |
| 810 |
// will only happen for final fields, since they are assigned in a constructor or static block |
| 811 |
// and we may currently be in some other method |
| 812 |
this.tagBits |= NULL_FLAG_MASK; |
| 813 |
} |
| 778 |
// do not want to complain in unreachable code |
814 |
// do not want to complain in unreachable code |
| 779 |
if ((this.tagBits & UNREACHABLE) != 0 || |
815 |
if ((this.tagBits & UNREACHABLE) != 0 || |
| 780 |
(this.tagBits & NULL_FLAG_MASK) == 0 || |
816 |
(this.tagBits & NULL_FLAG_MASK) == 0 || |
| 781 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
817 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
| 782 |
return false; |
818 |
return false; |
| 783 |
} |
819 |
} |
| 784 |
int position = local.id + this.maxFieldCount; |
820 |
int position; |
|
|
821 |
if (local instanceof FieldBinding) { |
| 822 |
if (local.isFinal() && ((FieldBinding)local).isStatic()) { |
| 823 |
// static final field's null status may not be in the flow info |
| 824 |
return (((FieldBinding) local).getNullStatusForStaticFinalField() == FlowInfo.NULL); |
| 825 |
} |
| 826 |
position = local.id; |
| 827 |
} else { |
| 828 |
position = local.id + this.maxFieldCount; |
| 829 |
} |
| 785 |
if (position < BitCacheSize) { // use bits |
830 |
if (position < BitCacheSize) { // use bits |
| 786 |
return ((this.nullBit1 & this.nullBit2 |
831 |
return ((this.nullBit1 & this.nullBit2 |
| 787 |
& (~this.nullBit3 | ~this.nullBit4)) |
832 |
& (~this.nullBit3 | ~this.nullBit4)) |
|
Lines 801-813
Link Here
|
| 801 |
& (1L << (position % BitCacheSize))) != 0; |
846 |
& (1L << (position % BitCacheSize))) != 0; |
| 802 |
} |
847 |
} |
| 803 |
|
848 |
|
| 804 |
final public boolean isDefinitelyUnknown(LocalVariableBinding local) { |
849 |
final public boolean isDefinitelyUnknown(VariableBinding local) { |
| 805 |
// do not want to complain in unreachable code |
850 |
// do not want to complain in unreachable code |
| 806 |
if ((this.tagBits & UNREACHABLE) != 0 || |
851 |
if ((this.tagBits & UNREACHABLE) != 0 || |
| 807 |
(this.tagBits & NULL_FLAG_MASK) == 0) { |
852 |
(this.tagBits & NULL_FLAG_MASK) == 0) { |
| 808 |
return false; |
853 |
return false; |
| 809 |
} |
854 |
} |
| 810 |
int position = local.id + this.maxFieldCount; |
855 |
int position; |
|
|
856 |
if (local instanceof FieldBinding) { |
| 857 |
position = local.id; |
| 858 |
} else { |
| 859 |
position = local.id + this.maxFieldCount; |
| 860 |
} |
| 811 |
if (position < BitCacheSize) { // use bits |
861 |
if (position < BitCacheSize) { // use bits |
| 812 |
return ((this.nullBit1 & this.nullBit4 |
862 |
return ((this.nullBit1 & this.nullBit4 |
| 813 |
& ~this.nullBit2 & ~this.nullBit3) & (1L << position)) != 0; |
863 |
& ~this.nullBit2 & ~this.nullBit3) & (1L << position)) != 0; |
|
Lines 860-872
Link Here
|
| 860 |
return isPotentiallyAssigned(local.id + this.maxFieldCount); |
910 |
return isPotentiallyAssigned(local.id + this.maxFieldCount); |
| 861 |
} |
911 |
} |
| 862 |
|
912 |
|
| 863 |
final public boolean isPotentiallyNonNull(LocalVariableBinding local) { |
913 |
final public boolean isPotentiallyNonNull(VariableBinding local) { |
| 864 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
914 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
| 865 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
915 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
| 866 |
return false; |
916 |
return false; |
| 867 |
} |
917 |
} |
| 868 |
int position; |
918 |
int position; |
| 869 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
919 |
if (local instanceof FieldBinding) { |
|
|
920 |
position = local.id; |
| 921 |
} else { |
| 922 |
position = local.id + this.maxFieldCount; |
| 923 |
} |
| 924 |
if (position < BitCacheSize) { |
| 870 |
// use bits |
925 |
// use bits |
| 871 |
return ((this.nullBit3 & (~this.nullBit1 | ~this.nullBit2)) |
926 |
return ((this.nullBit3 & (~this.nullBit1 | ~this.nullBit2)) |
| 872 |
& (1L << position)) != 0; |
927 |
& (1L << position)) != 0; |
|
Lines 885-897
Link Here
|
| 885 |
& (1L << (position % BitCacheSize))) != 0; |
940 |
& (1L << (position % BitCacheSize))) != 0; |
| 886 |
} |
941 |
} |
| 887 |
|
942 |
|
| 888 |
final public boolean isPotentiallyNull(LocalVariableBinding local) { |
943 |
final public boolean isPotentiallyNull(VariableBinding local) { |
| 889 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
944 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
| 890 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
945 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
| 891 |
return false; |
946 |
return false; |
| 892 |
} |
947 |
} |
| 893 |
int position; |
948 |
int position; |
| 894 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
949 |
if (local instanceof FieldBinding) { |
|
|
950 |
if (local.isFinal() && ((FieldBinding)local).isStatic()) { |
| 951 |
// static final field's null status may not be in the flow info |
| 952 |
return (((FieldBinding) local).getNullStatusForStaticFinalField() == FlowInfo.POTENTIALLY_NULL); |
| 953 |
} |
| 954 |
position = local.id; |
| 955 |
} else { |
| 956 |
position = local.id + this.maxFieldCount; |
| 957 |
} |
| 958 |
if (position < BitCacheSize) { |
| 895 |
// use bits |
959 |
// use bits |
| 896 |
return ((this.nullBit2 & (~this.nullBit1 | ~this.nullBit3)) |
960 |
return ((this.nullBit2 & (~this.nullBit1 | ~this.nullBit3)) |
| 897 |
& (1L << position)) != 0; |
961 |
& (1L << position)) != 0; |
|
Lines 910-922
Link Here
|
| 910 |
& (1L << (position % BitCacheSize))) != 0; |
974 |
& (1L << (position % BitCacheSize))) != 0; |
| 911 |
} |
975 |
} |
| 912 |
|
976 |
|
| 913 |
final public boolean isPotentiallyUnknown(LocalVariableBinding local) { |
977 |
final public boolean isPotentiallyUnknown(VariableBinding local) { |
| 914 |
// do not want to complain in unreachable code |
978 |
// do not want to complain in unreachable code |
| 915 |
if ((this.tagBits & UNREACHABLE) != 0 || |
979 |
if ((this.tagBits & UNREACHABLE) != 0 || |
| 916 |
(this.tagBits & NULL_FLAG_MASK) == 0) { |
980 |
(this.tagBits & NULL_FLAG_MASK) == 0) { |
| 917 |
return false; |
981 |
return false; |
| 918 |
} |
982 |
} |
| 919 |
int position = local.id + this.maxFieldCount; |
983 |
int position; |
|
|
984 |
if (local instanceof FieldBinding) { |
| 985 |
position = local.id; |
| 986 |
} else { |
| 987 |
position = local.id + this.maxFieldCount; |
| 988 |
} |
| 920 |
if (position < BitCacheSize) { // use bits |
989 |
if (position < BitCacheSize) { // use bits |
| 921 |
return (this.nullBit4 |
990 |
return (this.nullBit4 |
| 922 |
& (~this.nullBit1 | ~this.nullBit2 & ~this.nullBit3) |
991 |
& (~this.nullBit1 | ~this.nullBit2 & ~this.nullBit3) |
|
Lines 937-949
Link Here
|
| 937 |
& (1L << (position % BitCacheSize))) != 0; |
1006 |
& (1L << (position % BitCacheSize))) != 0; |
| 938 |
} |
1007 |
} |
| 939 |
|
1008 |
|
| 940 |
final public boolean isProtectedNonNull(LocalVariableBinding local) { |
1009 |
final public boolean isProtectedNonNull(VariableBinding local) { |
| 941 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
1010 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
| 942 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
1011 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
| 943 |
return false; |
1012 |
return false; |
| 944 |
} |
1013 |
} |
| 945 |
int position; |
1014 |
int position; |
| 946 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
1015 |
if (local instanceof FieldBinding) { |
|
|
1016 |
position = local.id; |
| 1017 |
} else { |
| 1018 |
position = local.id + this.maxFieldCount; |
| 1019 |
} |
| 1020 |
if (position < BitCacheSize) { |
| 947 |
// use bits |
1021 |
// use bits |
| 948 |
return (this.nullBit1 & this.nullBit3 & this.nullBit4 & (1L << position)) != 0; |
1022 |
return (this.nullBit1 & this.nullBit3 & this.nullBit4 & (1L << position)) != 0; |
| 949 |
} |
1023 |
} |
|
Lines 962-974
Link Here
|
| 962 |
& (1L << (position % BitCacheSize))) != 0; |
1036 |
& (1L << (position % BitCacheSize))) != 0; |
| 963 |
} |
1037 |
} |
| 964 |
|
1038 |
|
| 965 |
final public boolean isProtectedNull(LocalVariableBinding local) { |
1039 |
final public boolean isProtectedNull(VariableBinding local) { |
| 966 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
1040 |
if ((this.tagBits & NULL_FLAG_MASK) == 0 || |
| 967 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
1041 |
(local.type.tagBits & TagBits.IsBaseType) != 0) { |
| 968 |
return false; |
1042 |
return false; |
| 969 |
} |
1043 |
} |
| 970 |
int position; |
1044 |
int position; |
| 971 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
1045 |
if (local instanceof FieldBinding) { |
|
|
1046 |
position = local.id; |
| 1047 |
} else { |
| 1048 |
position = local.id + this.maxFieldCount; |
| 1049 |
} |
| 1050 |
if (position < BitCacheSize) { |
| 972 |
// use bits |
1051 |
// use bits |
| 973 |
return (this.nullBit1 & this.nullBit2 |
1052 |
return (this.nullBit1 & this.nullBit2 |
| 974 |
& (this.nullBit3 ^ this.nullBit4) |
1053 |
& (this.nullBit3 ^ this.nullBit4) |
|
Lines 996-1015
Link Here
|
| 996 |
* @return <code>true</code> if the check passes (does not return |
1075 |
* @return <code>true</code> if the check passes (does not return |
| 997 |
* if the check fails) |
1076 |
* if the check fails) |
| 998 |
*/ |
1077 |
*/ |
| 999 |
private static boolean isTrue(boolean expression, String message) { |
1078 |
protected static boolean isTrue(boolean expression, String message) { |
| 1000 |
if (!expression) |
1079 |
if (!expression) |
| 1001 |
throw new AssertionFailedException("assertion failed: " + message); //$NON-NLS-1$ |
1080 |
throw new AssertionFailedException("assertion failed: " + message); //$NON-NLS-1$ |
| 1002 |
return expression; |
1081 |
return expression; |
| 1003 |
} |
1082 |
} |
| 1004 |
public void markAsComparedEqualToNonNull(LocalVariableBinding local) { |
1083 |
public void markAsComparedEqualToNonNull(VariableBinding local) { |
| 1005 |
// protected from non-object locals in calling methods |
1084 |
// protected from non-object locals in calling methods |
| 1006 |
if (this != DEAD_END) { |
1085 |
if (this != DEAD_END) { |
| 1007 |
this.tagBits |= NULL_FLAG_MASK; |
1086 |
this.tagBits |= NULL_FLAG_MASK; |
| 1008 |
int position; |
1087 |
int position; |
|
|
1088 |
if (local instanceof FieldBinding) { |
| 1089 |
this.markNullStatus(local, FlowInfo.POTENTIALLY_NON_NULL); |
| 1090 |
return; |
| 1091 |
} else { |
| 1092 |
position = local.id + this.maxFieldCount; |
| 1093 |
} |
| 1009 |
long mask; |
1094 |
long mask; |
| 1010 |
long a1, a2, a3, a4, na2; |
1095 |
long a1, a2, a3, a4, na2; |
| 1011 |
// position is zero-based |
1096 |
// position is zero-based |
| 1012 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
1097 |
if (position < BitCacheSize) { |
| 1013 |
// use bits |
1098 |
// use bits |
| 1014 |
if (((mask = 1L << position) |
1099 |
if (((mask = 1L << position) |
| 1015 |
& (a1 = this.nullBit1) |
1100 |
& (a1 = this.nullBit1) |
|
Lines 1098-1111
Link Here
|
| 1098 |
} |
1183 |
} |
| 1099 |
} |
1184 |
} |
| 1100 |
|
1185 |
|
| 1101 |
public void markAsComparedEqualToNull(LocalVariableBinding local) { |
1186 |
public void markAsComparedEqualToNull(VariableBinding local) { |
| 1102 |
// protected from non-object locals in calling methods |
1187 |
// protected from non-object locals in calling methods |
| 1103 |
if (this != DEAD_END) { |
1188 |
if (this != DEAD_END) { |
| 1104 |
this.tagBits |= NULL_FLAG_MASK; |
1189 |
this.tagBits |= NULL_FLAG_MASK; |
| 1105 |
int position; |
1190 |
int position; |
| 1106 |
long mask; |
1191 |
long mask; |
| 1107 |
// position is zero-based |
1192 |
// position is zero-based |
| 1108 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
1193 |
if (local instanceof FieldBinding) { |
|
|
1194 |
this.markNullStatus(local, FlowInfo.POTENTIALLY_NULL); |
| 1195 |
return; |
| 1196 |
} else { |
| 1197 |
position = local.id + this.maxFieldCount; |
| 1198 |
} |
| 1199 |
if (position < BitCacheSize) { |
| 1109 |
// use bits |
1200 |
// use bits |
| 1110 |
if (((mask = 1L << position) & this.nullBit1) != 0) { |
1201 |
if (((mask = 1L << position) & this.nullBit1) != 0) { |
| 1111 |
if ((mask |
1202 |
if ((mask |
|
Lines 1236-1249
Link Here
|
| 1236 |
markAsDefinitelyAssigned(local.id + this.maxFieldCount); |
1327 |
markAsDefinitelyAssigned(local.id + this.maxFieldCount); |
| 1237 |
} |
1328 |
} |
| 1238 |
|
1329 |
|
| 1239 |
public void markAsDefinitelyNonNull(LocalVariableBinding local) { |
1330 |
public void markAsDefinitelyNonNull(VariableBinding local) { |
| 1240 |
// protected from non-object locals in calling methods |
1331 |
// protected from non-object locals in calling methods |
| 1241 |
if (this != DEAD_END) { |
1332 |
if (this != DEAD_END) { |
| 1242 |
this.tagBits |= NULL_FLAG_MASK; |
1333 |
this.tagBits |= NULL_FLAG_MASK; |
| 1243 |
long mask; |
1334 |
long mask; |
| 1244 |
int position; |
1335 |
int position; |
|
|
1336 |
if (local instanceof FieldBinding) { |
| 1337 |
this.markNullStatus(local, FlowInfo.POTENTIALLY_NON_NULL); |
| 1338 |
return; |
| 1339 |
} else { |
| 1340 |
position = local.id + this.maxFieldCount; |
| 1341 |
} |
| 1245 |
// position is zero-based |
1342 |
// position is zero-based |
| 1246 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { // use bits |
1343 |
if (position < BitCacheSize) { // use bits |
| 1247 |
// set assigned non null |
1344 |
// set assigned non null |
| 1248 |
this.nullBit1 |= (mask = 1L << position); |
1345 |
this.nullBit1 |= (mask = 1L << position); |
| 1249 |
this.nullBit3 |= mask; |
1346 |
this.nullBit3 |= mask; |
|
Lines 1258-1265
Link Here
|
| 1258 |
} |
1355 |
} |
| 1259 |
else { |
1356 |
else { |
| 1260 |
// use extra vector |
1357 |
// use extra vector |
| 1261 |
int vectorIndex ; |
1358 |
int vectorIndex = (position / BitCacheSize) - 1; |
| 1262 |
this.extra[2][vectorIndex = (position / BitCacheSize) - 1] |
1359 |
if (this.extra == null) { |
|
|
1360 |
int length = vectorIndex + 1; |
| 1361 |
this.extra = new long[extraLength][]; |
| 1362 |
for (int j = 0; j < extraLength; j++) { |
| 1363 |
this.extra[j] = new long[length]; |
| 1364 |
} |
| 1365 |
} |
| 1366 |
else { |
| 1367 |
int oldLength; // might need to grow the arrays |
| 1368 |
if (vectorIndex >= (oldLength = this.extra[0].length)) { |
| 1369 |
for (int j = 0; j < extraLength; j++) { |
| 1370 |
System.arraycopy(this.extra[j], 0, |
| 1371 |
(this.extra[j] = new long[vectorIndex + 1]), 0, |
| 1372 |
oldLength); |
| 1373 |
} |
| 1374 |
} |
| 1375 |
} |
| 1376 |
this.extra[2][vectorIndex] |
| 1263 |
|= (mask = 1L << (position % BitCacheSize)); |
1377 |
|= (mask = 1L << (position % BitCacheSize)); |
| 1264 |
this.extra[4][vectorIndex] |= mask; |
1378 |
this.extra[4][vectorIndex] |= mask; |
| 1265 |
this.extra[3][vectorIndex] &= (mask = ~mask); |
1379 |
this.extra[3][vectorIndex] &= (mask = ~mask); |
|
Lines 1273-1286
Link Here
|
| 1273 |
} |
1387 |
} |
| 1274 |
} |
1388 |
} |
| 1275 |
|
1389 |
|
| 1276 |
public void markAsDefinitelyNull(LocalVariableBinding local) { |
1390 |
public void markAsDefinitelyNull(VariableBinding local) { |
| 1277 |
// protected from non-object locals in calling methods |
1391 |
// protected from non-object locals in calling methods |
| 1278 |
if (this != DEAD_END) { |
1392 |
if (this != DEAD_END) { |
| 1279 |
this.tagBits |= NULL_FLAG_MASK; |
1393 |
this.tagBits |= NULL_FLAG_MASK; |
| 1280 |
long mask; |
1394 |
long mask; |
| 1281 |
int position; |
1395 |
int position; |
|
|
1396 |
if (local instanceof FieldBinding) { |
| 1397 |
this.markNullStatus(local, FlowInfo.POTENTIALLY_NULL); |
| 1398 |
return; |
| 1399 |
} else { |
| 1400 |
position = local.id + this.maxFieldCount; |
| 1401 |
} |
| 1282 |
// position is zero-based |
1402 |
// position is zero-based |
| 1283 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { // use bits |
1403 |
if (position < BitCacheSize) { // use bits |
| 1284 |
// mark assigned null |
1404 |
// mark assigned null |
| 1285 |
this.nullBit1 |= (mask = 1L << position); |
1405 |
this.nullBit1 |= (mask = 1L << position); |
| 1286 |
this.nullBit2 |= mask; |
1406 |
this.nullBit2 |= mask; |
|
Lines 1295-1302
Link Here
|
| 1295 |
} |
1415 |
} |
| 1296 |
else { |
1416 |
else { |
| 1297 |
// use extra vector |
1417 |
// use extra vector |
| 1298 |
int vectorIndex ; |
1418 |
int vectorIndex = (position / BitCacheSize) - 1; |
| 1299 |
this.extra[2][vectorIndex = (position / BitCacheSize) - 1] |
1419 |
if (this.extra == null) { |
|
|
1420 |
int length = vectorIndex + 1; |
| 1421 |
this.extra = new long[extraLength][]; |
| 1422 |
for (int j = 0; j < extraLength; j++) { |
| 1423 |
this.extra[j] = new long[length]; |
| 1424 |
} |
| 1425 |
} |
| 1426 |
else { |
| 1427 |
int oldLength; // might need to grow the arrays |
| 1428 |
if (vectorIndex >= (oldLength = this.extra[0].length)) { |
| 1429 |
for (int j = 0; j < extraLength; j++) { |
| 1430 |
System.arraycopy(this.extra[j], 0, |
| 1431 |
(this.extra[j] = new long[vectorIndex + 1]), 0, |
| 1432 |
oldLength); |
| 1433 |
} |
| 1434 |
} |
| 1435 |
} |
| 1436 |
this.extra[2][vectorIndex] |
| 1300 |
|= (mask = 1L << (position % BitCacheSize)); |
1437 |
|= (mask = 1L << (position % BitCacheSize)); |
| 1301 |
this.extra[3][vectorIndex] |= mask; |
1438 |
this.extra[3][vectorIndex] |= mask; |
| 1302 |
this.extra[4][vectorIndex] &= (mask = ~mask); |
1439 |
this.extra[4][vectorIndex] &= (mask = ~mask); |
|
Lines 1316-1329
Link Here
|
| 1316 |
*/ |
1453 |
*/ |
| 1317 |
// PREMATURE may try to get closer to markAsDefinitelyAssigned, but not |
1454 |
// PREMATURE may try to get closer to markAsDefinitelyAssigned, but not |
| 1318 |
// obvious |
1455 |
// obvious |
| 1319 |
public void markAsDefinitelyUnknown(LocalVariableBinding local) { |
1456 |
public void markAsDefinitelyUnknown(VariableBinding local) { |
| 1320 |
// protected from non-object locals in calling methods |
1457 |
// protected from non-object locals in calling methods |
| 1321 |
if (this != DEAD_END) { |
1458 |
if (this != DEAD_END) { |
| 1322 |
this.tagBits |= NULL_FLAG_MASK; |
1459 |
this.tagBits |= NULL_FLAG_MASK; |
| 1323 |
long mask; |
1460 |
long mask; |
| 1324 |
int position; |
1461 |
int position; |
|
|
1462 |
if (local instanceof FieldBinding) { |
| 1463 |
position = local.id; |
| 1464 |
} else { |
| 1465 |
position = local.id + this.maxFieldCount; |
| 1466 |
} |
| 1325 |
// position is zero-based |
1467 |
// position is zero-based |
| 1326 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
1468 |
if (position < BitCacheSize) { |
| 1327 |
// use bits |
1469 |
// use bits |
| 1328 |
// mark assigned null |
1470 |
// mark assigned null |
| 1329 |
this.nullBit1 |= (mask = 1L << position); |
1471 |
this.nullBit1 |= (mask = 1L << position); |
|
Lines 1339-1346
Link Here
|
| 1339 |
} |
1481 |
} |
| 1340 |
else { |
1482 |
else { |
| 1341 |
// use extra vector |
1483 |
// use extra vector |
| 1342 |
int vectorIndex ; |
1484 |
int vectorIndex = (position / BitCacheSize) - 1; |
| 1343 |
this.extra[2][vectorIndex = (position / BitCacheSize) - 1] |
1485 |
if (this.extra == null) { |
|
|
1486 |
int length = vectorIndex + 1; |
| 1487 |
this.extra = new long[extraLength][]; |
| 1488 |
for (int j = 0; j < extraLength; j++) { |
| 1489 |
this.extra[j] = new long[length]; |
| 1490 |
} |
| 1491 |
} |
| 1492 |
else { |
| 1493 |
int oldLength; // might need to grow the arrays |
| 1494 |
if (vectorIndex >= (oldLength = this.extra[0].length)) { |
| 1495 |
for (int j = 0; j < extraLength; j++) { |
| 1496 |
System.arraycopy(this.extra[j], 0, |
| 1497 |
(this.extra[j] = new long[vectorIndex + 1]), 0, |
| 1498 |
oldLength); |
| 1499 |
} |
| 1500 |
} |
| 1501 |
} |
| 1502 |
this.extra[2][vectorIndex] |
| 1344 |
|= (mask = 1L << (position % BitCacheSize)); |
1503 |
|= (mask = 1L << (position % BitCacheSize)); |
| 1345 |
this.extra[5][vectorIndex] |= mask; |
1504 |
this.extra[5][vectorIndex] |= mask; |
| 1346 |
this.extra[3][vectorIndex] &= (mask = ~mask); |
1505 |
this.extra[3][vectorIndex] &= (mask = ~mask); |
|
Lines 1354-1365
Link Here
|
| 1354 |
} |
1513 |
} |
| 1355 |
} |
1514 |
} |
| 1356 |
|
1515 |
|
| 1357 |
public void resetNullInfo(LocalVariableBinding local) { |
1516 |
public void resetNullInfo(VariableBinding local) { |
| 1358 |
if (this != DEAD_END) { |
1517 |
if (this != DEAD_END) { |
| 1359 |
this.tagBits |= NULL_FLAG_MASK; |
1518 |
this.tagBits |= NULL_FLAG_MASK; |
| 1360 |
int position; |
1519 |
int position; |
| 1361 |
long mask; |
1520 |
long mask; |
| 1362 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
1521 |
if (local instanceof FieldBinding) { |
|
|
1522 |
position = local.id; |
| 1523 |
} else { |
| 1524 |
position = local.id + this.maxFieldCount; |
| 1525 |
} |
| 1526 |
if (position < BitCacheSize) { |
| 1363 |
// use bits |
1527 |
// use bits |
| 1364 |
this.nullBit1 &= (mask = ~(1L << position)); |
1528 |
this.nullBit1 &= (mask = ~(1L << position)); |
| 1365 |
this.nullBit2 &= mask; |
1529 |
this.nullBit2 &= mask; |
|
Lines 1367-1374
Link Here
|
| 1367 |
this.nullBit4 &= mask; |
1531 |
this.nullBit4 &= mask; |
| 1368 |
} else { |
1532 |
} else { |
| 1369 |
// use extra vector |
1533 |
// use extra vector |
| 1370 |
int vectorIndex ; |
1534 |
int vectorIndex = (position / BitCacheSize) - 1; |
| 1371 |
this.extra[2][vectorIndex = (position / BitCacheSize) - 1] |
1535 |
if (this.extra == null || vectorIndex >= this.extra[2].length) { |
|
|
1536 |
// Some field which hasnt yet been encountered in null analysis is getting its null info reset |
| 1537 |
return; |
| 1538 |
} |
| 1539 |
this.extra[2][vectorIndex] |
| 1372 |
&= (mask = ~(1L << (position % BitCacheSize))); |
1540 |
&= (mask = ~(1L << (position % BitCacheSize))); |
| 1373 |
this.extra[3][vectorIndex] &= mask; |
1541 |
this.extra[3][vectorIndex] &= mask; |
| 1374 |
this.extra[4][vectorIndex] &= mask; |
1542 |
this.extra[4][vectorIndex] &= mask; |
|
Lines 1377-1393
Link Here
|
| 1377 |
} |
1545 |
} |
| 1378 |
} |
1546 |
} |
| 1379 |
|
1547 |
|
|
|
1548 |
public void resetNullInfoForFields() { |
| 1549 |
if (this != DEAD_END) { |
| 1550 |
long mask; |
| 1551 |
if (this.maxFieldCount < BitCacheSize) { |
| 1552 |
// use bits |
| 1553 |
this.nullBit1 &= (mask = -1L << this.maxFieldCount); |
| 1554 |
this.nullBit2 &= mask; |
| 1555 |
this.nullBit3 &= mask; |
| 1556 |
this.nullBit4 &= mask; |
| 1557 |
} |
| 1558 |
else { |
| 1559 |
this.nullBit1 &= (mask = 0L); |
| 1560 |
this.nullBit2 &= mask; |
| 1561 |
this.nullBit3 &= mask; |
| 1562 |
this.nullBit4 &= mask; |
| 1563 |
if (this.extra != null){ |
| 1564 |
for (int position = BitCacheSize; position < this.maxFieldCount; position++) { |
| 1565 |
// use extra vector |
| 1566 |
int vectorIndex = (position / BitCacheSize) - 1; |
| 1567 |
if (vectorIndex >= this.extra[2].length) |
| 1568 |
break; // No null info about fields beyond this point in the extra vector |
| 1569 |
this.extra[2][vectorIndex] |
| 1570 |
&= (mask = ~(1L << (position % BitCacheSize))); |
| 1571 |
this.extra[3][vectorIndex] &= mask; |
| 1572 |
this.extra[4][vectorIndex] &= mask; |
| 1573 |
this.extra[5][vectorIndex] &= mask; |
| 1574 |
} |
| 1575 |
} |
| 1576 |
} |
| 1577 |
} |
| 1578 |
} |
| 1579 |
|
| 1380 |
/** |
1580 |
/** |
| 1381 |
* Mark a local as potentially having been assigned to an unknown value. |
1581 |
* Mark a local as potentially having been assigned to an unknown value. |
| 1382 |
* @param local the local to mark |
1582 |
* @param local the local to mark |
| 1383 |
*/ |
1583 |
*/ |
| 1384 |
public void markPotentiallyUnknownBit(LocalVariableBinding local) { |
1584 |
public void markPotentiallyUnknownBit(VariableBinding local) { |
| 1385 |
// protected from non-object locals in calling methods |
1585 |
// protected from non-object locals in calling methods |
| 1386 |
if (this != DEAD_END) { |
1586 |
if (this != DEAD_END) { |
| 1387 |
this.tagBits |= NULL_FLAG_MASK; |
1587 |
this.tagBits |= NULL_FLAG_MASK; |
| 1388 |
int position; |
1588 |
int position; |
| 1389 |
long mask; |
1589 |
long mask; |
| 1390 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
1590 |
if (local instanceof FieldBinding) { |
|
|
1591 |
position = local.id; |
| 1592 |
} else { |
| 1593 |
position = local.id + this.maxFieldCount; |
| 1594 |
} |
| 1595 |
if (position < BitCacheSize) { |
| 1391 |
// use bits |
1596 |
// use bits |
| 1392 |
mask = 1L << position; |
1597 |
mask = 1L << position; |
| 1393 |
isTrue((this.nullBit1 & mask) == 0, "Adding 'unknown' mark in unexpected state"); //$NON-NLS-1$ |
1598 |
isTrue((this.nullBit1 & mask) == 0, "Adding 'unknown' mark in unexpected state"); //$NON-NLS-1$ |
|
Lines 1399-1405
Link Here
|
| 1399 |
} |
1604 |
} |
| 1400 |
} else { |
1605 |
} else { |
| 1401 |
// use extra vector |
1606 |
// use extra vector |
| 1402 |
int vectorIndex = (position / BitCacheSize) - 1; |
1607 |
int vectorIndex = (position / BitCacheSize) - 1; |
|
|
1608 |
if (this.extra == null) { |
| 1609 |
int length = vectorIndex + 1; |
| 1610 |
this.extra = new long[extraLength][]; |
| 1611 |
for (int j = 0; j < extraLength; j++) { |
| 1612 |
this.extra[j] = new long[length]; |
| 1613 |
} |
| 1614 |
} |
| 1615 |
else { |
| 1616 |
int oldLength; // might need to grow the arrays |
| 1617 |
if (vectorIndex >= (oldLength = this.extra[0].length)) { |
| 1618 |
for (int j = 0; j < extraLength; j++) { |
| 1619 |
System.arraycopy(this.extra[j], 0, |
| 1620 |
(this.extra[j] = new long[vectorIndex + 1]), 0, |
| 1621 |
oldLength); |
| 1622 |
} |
| 1623 |
} |
| 1624 |
} |
| 1403 |
mask = 1L << (position % BitCacheSize); |
1625 |
mask = 1L << (position % BitCacheSize); |
| 1404 |
isTrue((this.extra[2][vectorIndex] & mask) == 0, "Adding 'unknown' mark in unexpected state"); //$NON-NLS-1$ |
1626 |
isTrue((this.extra[2][vectorIndex] & mask) == 0, "Adding 'unknown' mark in unexpected state"); //$NON-NLS-1$ |
| 1405 |
this.extra[5][vectorIndex] |= mask; |
1627 |
this.extra[5][vectorIndex] |= mask; |
|
Lines 1412-1423
Link Here
|
| 1412 |
} |
1634 |
} |
| 1413 |
} |
1635 |
} |
| 1414 |
|
1636 |
|
| 1415 |
public void markPotentiallyNullBit(LocalVariableBinding local) { |
1637 |
public void markPotentiallyNullBit(VariableBinding local) { |
| 1416 |
if (this != DEAD_END) { |
1638 |
if (this != DEAD_END) { |
| 1417 |
this.tagBits |= NULL_FLAG_MASK; |
1639 |
this.tagBits |= NULL_FLAG_MASK; |
| 1418 |
int position; |
1640 |
int position; |
| 1419 |
long mask; |
1641 |
long mask; |
| 1420 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
1642 |
if (local instanceof FieldBinding) { |
|
|
1643 |
position = local.id; |
| 1644 |
} else { |
| 1645 |
position = local.id + this.maxFieldCount; |
| 1646 |
} |
| 1647 |
if (position < BitCacheSize) { |
| 1421 |
// use bits |
1648 |
// use bits |
| 1422 |
mask = 1L << position; |
1649 |
mask = 1L << position; |
| 1423 |
isTrue((this.nullBit1 & mask) == 0, "Adding 'potentially null' mark in unexpected state"); //$NON-NLS-1$ |
1650 |
isTrue((this.nullBit1 & mask) == 0, "Adding 'potentially null' mark in unexpected state"); //$NON-NLS-1$ |
|
Lines 1429-1435
Link Here
|
| 1429 |
} |
1656 |
} |
| 1430 |
} else { |
1657 |
} else { |
| 1431 |
// use extra vector |
1658 |
// use extra vector |
| 1432 |
int vectorIndex = (position / BitCacheSize) - 1; |
1659 |
int vectorIndex = (position / BitCacheSize) - 1; |
|
|
1660 |
if (this.extra == null) { |
| 1661 |
int length = vectorIndex + 1; |
| 1662 |
this.extra = new long[extraLength][]; |
| 1663 |
for (int j = 0; j < extraLength; j++) { |
| 1664 |
this.extra[j] = new long[length]; |
| 1665 |
} |
| 1666 |
} |
| 1667 |
else { |
| 1668 |
int oldLength; // might need to grow the arrays |
| 1669 |
if (vectorIndex >= (oldLength = this.extra[0].length)) { |
| 1670 |
for (int j = 0; j < extraLength; j++) { |
| 1671 |
System.arraycopy(this.extra[j], 0, |
| 1672 |
(this.extra[j] = new long[vectorIndex + 1]), 0, |
| 1673 |
oldLength); |
| 1674 |
} |
| 1675 |
} |
| 1676 |
} |
| 1433 |
mask = 1L << (position % BitCacheSize); |
1677 |
mask = 1L << (position % BitCacheSize); |
| 1434 |
this.extra[3][vectorIndex] |= mask; |
1678 |
this.extra[3][vectorIndex] |= mask; |
| 1435 |
isTrue((this.extra[2][vectorIndex] & mask) == 0, "Adding 'potentially null' mark in unexpected state"); //$NON-NLS-1$ |
1679 |
isTrue((this.extra[2][vectorIndex] & mask) == 0, "Adding 'potentially null' mark in unexpected state"); //$NON-NLS-1$ |
|
Lines 1442-1453
Link Here
|
| 1442 |
} |
1686 |
} |
| 1443 |
} |
1687 |
} |
| 1444 |
|
1688 |
|
| 1445 |
public void markPotentiallyNonNullBit(LocalVariableBinding local) { |
1689 |
public void markPotentiallyNonNullBit(VariableBinding local) { |
| 1446 |
if (this != DEAD_END) { |
1690 |
if (this != DEAD_END) { |
| 1447 |
this.tagBits |= NULL_FLAG_MASK; |
1691 |
this.tagBits |= NULL_FLAG_MASK; |
| 1448 |
int position; |
1692 |
int position; |
| 1449 |
long mask; |
1693 |
long mask; |
| 1450 |
if ((position = local.id + this.maxFieldCount) < BitCacheSize) { |
1694 |
if (local instanceof FieldBinding) { |
|
|
1695 |
position = local.id; |
| 1696 |
} else { |
| 1697 |
position = local.id + this.maxFieldCount; |
| 1698 |
} |
| 1699 |
if (position < BitCacheSize) { |
| 1451 |
// use bits |
1700 |
// use bits |
| 1452 |
mask = 1L << position; |
1701 |
mask = 1L << position; |
| 1453 |
isTrue((this.nullBit1 & mask) == 0, "Adding 'potentially non-null' mark in unexpected state"); //$NON-NLS-1$ |
1702 |
isTrue((this.nullBit1 & mask) == 0, "Adding 'potentially non-null' mark in unexpected state"); //$NON-NLS-1$ |
|
Lines 1459-1465
Link Here
|
| 1459 |
} |
1708 |
} |
| 1460 |
} else { |
1709 |
} else { |
| 1461 |
// use extra vector |
1710 |
// use extra vector |
| 1462 |
int vectorIndex = (position / BitCacheSize) - 1; |
1711 |
int vectorIndex = (position / BitCacheSize) - 1; |
|
|
1712 |
if (this.extra == null) { |
| 1713 |
int length = vectorIndex + 1; |
| 1714 |
this.extra = new long[extraLength][]; |
| 1715 |
for (int j = 0; j < extraLength; j++) { |
| 1716 |
this.extra[j] = new long[length]; |
| 1717 |
} |
| 1718 |
} |
| 1719 |
else { |
| 1720 |
int oldLength; // might need to grow the arrays |
| 1721 |
if (vectorIndex >= (oldLength = this.extra[0].length)) { |
| 1722 |
for (int j = 0; j < extraLength; j++) { |
| 1723 |
System.arraycopy(this.extra[j], 0, |
| 1724 |
(this.extra[j] = new long[vectorIndex + 1]), 0, |
| 1725 |
oldLength); |
| 1726 |
} |
| 1727 |
} |
| 1728 |
} |
| 1463 |
mask = 1L << (position % BitCacheSize); |
1729 |
mask = 1L << (position % BitCacheSize); |
| 1464 |
isTrue((this.extra[2][vectorIndex] & mask) == 0, "Adding 'potentially non-null' mark in unexpected state"); //$NON-NLS-1$ |
1730 |
isTrue((this.extra[2][vectorIndex] & mask) == 0, "Adding 'potentially non-null' mark in unexpected state"); //$NON-NLS-1$ |
| 1465 |
this.extra[4][vectorIndex] |= mask; |
1731 |
this.extra[4][vectorIndex] |= mask; |
|
Lines 1951-1958
Link Here
|
| 1951 |
return this; |
2217 |
return this; |
| 1952 |
} |
2218 |
} |
| 1953 |
|
2219 |
|
| 1954 |
public void markedAsNullOrNonNullInAssertExpression(LocalVariableBinding local) { |
2220 |
public void markedAsNullOrNonNullInAssertExpression(VariableBinding binding) { |
| 1955 |
int position = local.id + this.maxFieldCount; |
2221 |
int position; |
|
|
2222 |
if (binding instanceof FieldBinding) { |
| 2223 |
position = binding.id; |
| 2224 |
} else { |
| 2225 |
position = binding.id + this.maxFieldCount; |
| 2226 |
} |
| 1956 |
int oldLength; |
2227 |
int oldLength; |
| 1957 |
if (this.nullStatusChangedInAssert == null) { |
2228 |
if (this.nullStatusChangedInAssert == null) { |
| 1958 |
this.nullStatusChangedInAssert = new int[position + 1]; |
2229 |
this.nullStatusChangedInAssert = new int[position + 1]; |
|
Lines 1965-1972
Link Here
|
| 1965 |
this.nullStatusChangedInAssert[position] = 1; |
2236 |
this.nullStatusChangedInAssert[position] = 1; |
| 1966 |
} |
2237 |
} |
| 1967 |
|
2238 |
|
| 1968 |
public boolean isMarkedAsNullOrNonNullInAssertExpression(LocalVariableBinding local) { |
2239 |
public boolean isMarkedAsNullOrNonNullInAssertExpression(VariableBinding binding) { |
| 1969 |
int position = local.id + this.maxFieldCount; |
2240 |
int position; |
|
|
2241 |
if (binding instanceof FieldBinding) { |
| 2242 |
position = binding.id; |
| 2243 |
} else { |
| 2244 |
position = binding.id + this.maxFieldCount; |
| 2245 |
} |
| 1970 |
if(this.nullStatusChangedInAssert == null || position >= this.nullStatusChangedInAssert.length) { |
2246 |
if(this.nullStatusChangedInAssert == null || position >= this.nullStatusChangedInAssert.length) { |
| 1971 |
return false; |
2247 |
return false; |
| 1972 |
} |
2248 |
} |