|
17 | 17 | import java.util.List; |
18 | 18 | import java.util.Map; |
19 | 19 | import java.util.Objects; |
20 | | -import java.util.function.Function; |
21 | 20 |
|
22 | 21 | /** Stores different kind of data (arguments, locals, fields, exception) for a specific location */ |
23 | 22 | public class CapturedContext implements ValueReferenceResolver { |
@@ -134,12 +133,12 @@ public CapturedValue getMember(Object target, String memberName) { |
134 | 133 | } |
135 | 134 | } |
136 | 135 | } else { |
137 | | - Map<String, Function<Object, CapturedValue>> specialTypeAccess = |
| 136 | + Map<String, WellKnownClasses.SpecialFieldInfo> specialTypeAccess = |
138 | 137 | WellKnownClasses.getSpecialTypeAccess(target); |
139 | 138 | if (specialTypeAccess != null) { |
140 | | - Function<Object, CapturedValue> specialFieldAccess = specialTypeAccess.get(memberName); |
141 | | - if (specialFieldAccess != null) { |
142 | | - CapturedValue specialField = specialFieldAccess.apply(target); |
| 139 | + WellKnownClasses.SpecialFieldInfo specialFieldInfo = specialTypeAccess.get(memberName); |
| 140 | + if (specialFieldInfo != null) { |
| 141 | + CapturedValue specialField = specialFieldInfo.accessor.apply(target); |
143 | 142 | if (specialField != null && specialField.getName().equals(memberName)) { |
144 | 143 | return specialField; |
145 | 144 | } |
@@ -360,6 +359,14 @@ public Status getStatus(int probeIndex) { |
360 | 359 | return result; |
361 | 360 | } |
362 | 361 |
|
| 362 | + public void addError(ProbeImplementation probeImplementation, EvaluationError evaluationError) { |
| 363 | + Status status = |
| 364 | + statusByProbeId.computeIfAbsent( |
| 365 | + probeImplementation.getProbeId().getEncodedId(), |
| 366 | + key -> probeImplementation.createStatus()); |
| 367 | + status.addError(evaluationError); |
| 368 | + } |
| 369 | + |
363 | 370 | @Override |
364 | 371 | public boolean equals(Object o) { |
365 | 372 | if (this == o) return true; |
|
0 commit comments