Skip to content

Commit

Permalink
Restrict constraint for field setting since field is always set on ow…
Browse files Browse the repository at this point in the history
…n instance.
  • Loading branch information
raphw committed Jul 27, 2021
1 parent 520339d commit 9a3e7e2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3138,7 +3138,7 @@ protected Explicit(FieldDescription fieldDescription) {
public TerminationHandler make(TypeDescription instrumentedType) {
if (!fieldDescription.isStatic() && !instrumentedType.isAssignableTo(fieldDescription.getDeclaringType().asErasure())) {
throw new IllegalStateException("Cannot set " + fieldDescription + " from " + instrumentedType);
} else if (!fieldDescription.isAccessibleTo(instrumentedType)) {
} else if (!fieldDescription.isVisibleTo(instrumentedType)) {
throw new IllegalStateException("Cannot access " + fieldDescription + " from " + instrumentedType);
}
return new FieldSetting(fieldDescription);
Expand Down Expand Up @@ -3171,7 +3171,7 @@ protected Implicit(ElementMatcher<? super FieldDescription> matcher) {
public TerminationHandler make(TypeDescription instrumentedType) {
TypeDefinition current = instrumentedType;
do {
FieldList<?> candidates = current.getDeclaredFields().filter(isAccessibleTo(instrumentedType).and(matcher));
FieldList<?> candidates = current.getDeclaredFields().filter(isVisibleTo(instrumentedType).and(matcher));
if (candidates.size() == 1) {
return new FieldSetting(candidates.getOnly());
} else if (candidates.size() == 2) {
Expand Down

0 comments on commit 9a3e7e2

Please sign in to comment.