Lines 934-939
Link Here
|
934 |
return null; |
934 |
return null; |
935 |
} |
935 |
} |
936 |
|
936 |
|
|
|
937 |
public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) { |
938 |
return findField(receiverType, fieldName, invocationSite, needResolve, false); |
939 |
} |
937 |
// Internal use only |
940 |
// Internal use only |
938 |
/* Answer the field binding that corresponds to fieldName. |
941 |
/* Answer the field binding that corresponds to fieldName. |
939 |
Start the lookup at the receiverType. |
942 |
Start the lookup at the receiverType. |
Lines 941-950
Link Here
|
941 |
isSuperAccess(); this is used to determine if the discovered field is visible. |
944 |
isSuperAccess(); this is used to determine if the discovered field is visible. |
942 |
Only fields defined by the receiverType or its supertypes are answered; |
945 |
Only fields defined by the receiverType or its supertypes are answered; |
943 |
a field of an enclosing type will not be found using this API. |
946 |
a field of an enclosing type will not be found using this API. |
944 |
|
947 |
If the parameter invisibleFieldsOk is true, visibility checks have not been run on |
|
|
948 |
any returned fields. The caller needs to apply these checks as needed. Otherwise, |
945 |
If no visible field is discovered, null is answered. |
949 |
If no visible field is discovered, null is answered. |
946 |
*/ |
950 |
*/ |
947 |
public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) { |
951 |
public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve, boolean invisibleFieldsOk) { |
948 |
|
952 |
|
949 |
CompilationUnitScope unitScope = compilationUnitScope(); |
953 |
CompilationUnitScope unitScope = compilationUnitScope(); |
950 |
unitScope.recordTypeReference(receiverType); |
954 |
unitScope.recordTypeReference(receiverType); |
Lines 989-994
Link Here
|
989 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=316456 |
993 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=316456 |
990 |
boolean insideTypeAnnotations = this instanceof MethodScope && ((MethodScope) this).insideTypeAnnotation; |
994 |
boolean insideTypeAnnotations = this instanceof MethodScope && ((MethodScope) this).insideTypeAnnotation; |
991 |
if (field != null) { |
995 |
if (field != null) { |
|
|
996 |
if (invisibleFieldsOk) { |
997 |
return field; |
998 |
} |
992 |
if (invocationSite == null || insideTypeAnnotations |
999 |
if (invocationSite == null || insideTypeAnnotations |
993 |
? field.canBeSeenBy(getCurrentPackage()) |
1000 |
? field.canBeSeenBy(getCurrentPackage()) |
994 |
: field.canBeSeenBy(currentType, invocationSite, this)) |
1001 |
: field.canBeSeenBy(currentType, invocationSite, this)) |
Lines 1027-1032
Link Here
|
1027 |
currentType.initializeForStaticImports(); |
1034 |
currentType.initializeForStaticImports(); |
1028 |
currentType = (ReferenceBinding) currentType.capture(this, invocationSite == null ? 0 : invocationSite.sourceEnd()); |
1035 |
currentType = (ReferenceBinding) currentType.capture(this, invocationSite == null ? 0 : invocationSite.sourceEnd()); |
1029 |
if ((field = currentType.getField(fieldName, needResolve)) != null) { |
1036 |
if ((field = currentType.getField(fieldName, needResolve)) != null) { |
|
|
1037 |
if (invisibleFieldsOk) { |
1038 |
return field; |
1039 |
} |
1030 |
keepLooking = false; |
1040 |
keepLooking = false; |
1031 |
if (field.canBeSeenBy(receiverType, invocationSite, this)) { |
1041 |
if (field.canBeSeenBy(receiverType, invocationSite, this)) { |
1032 |
if (visibleField == null) |
1042 |
if (visibleField == null) |
Lines 1048-1053
Link Here
|
1048 |
unitScope.recordTypeReference(anInterface); |
1058 |
unitScope.recordTypeReference(anInterface); |
1049 |
// no need to capture rcv interface, since member field is going to be static anyway |
1059 |
// no need to capture rcv interface, since member field is going to be static anyway |
1050 |
if ((field = anInterface.getField(fieldName, true /*resolve*/)) != null) { |
1060 |
if ((field = anInterface.getField(fieldName, true /*resolve*/)) != null) { |
|
|
1061 |
if (invisibleFieldsOk) { |
1062 |
return field; |
1063 |
} |
1051 |
if (visibleField == null) { |
1064 |
if (visibleField == null) { |
1052 |
visibleField = field; |
1065 |
visibleField = field; |
1053 |
} else { |
1066 |
} else { |