@@ -25,6 +25,7 @@ public class MyCache {
2525 private final LRUMap <Integer , Set <Object >> _eventOrderWarnings ;
2626 private final LRUMap <Integer , Set <Object >> _uncheckedStateUpdateWarnings ;
2727 private final LRUMap <Integer , Set <Object >> _uncheckedExternalInfluenceWarnings ;
28+ private final LRUMap <Integer , Set <Object >> _timestampDependencyWarnings ;
2829 public final LRUMap <Statement , Set <String >> _eventsExitPoints ;
2930
3031 /**
@@ -55,6 +56,7 @@ private MyCache() {
5556 this ._uncheckedStateUpdateWarnings = new LRUMap <Integer , Set <Object >>(1000 );
5657 this ._uncheckedExternalInfluenceWarnings = new LRUMap <Integer , Set <Object >>(1000 );
5758 this ._eventsExitPoints = new LRUMap <Statement , Set <String >>(2000 );
59+ this ._timestampDependencyWarnings = new LRUMap <Integer , Set <Object >>(1000 );
5860 }
5961
6062 /**
@@ -387,4 +389,38 @@ public int getTxOriginWarnings(Integer key) {
387389 return (_txOriginWarnings .get (key ) != null ) ? _txOriginWarnings .get (key ).size () : 0 ;
388390 }
389391 }
392+
393+ /**
394+ * Adds a timestamp dependency warning for the specified key. If no warnings
395+ * are associated with the key, a new set is created and the warning is
396+ * added to it. This method is thread-safe.
397+ *
398+ * @param key the key identifying the smart contract or entity for which
399+ * the warning applies
400+ * @param warning the warning object to be added
401+ */
402+ public void addTimestampDependencyWarning (Integer key , Object warning ) {
403+ synchronized (_timestampDependencyWarnings ) {
404+ _timestampDependencyWarnings
405+ .computeIfAbsent (key , k -> Collections .synchronizedSet (new HashSet <>()))
406+ .add (warning );
407+ }
408+ }
409+
410+ /**
411+ * Retrieves the number of timestamp dependency warnings associated with the
412+ * specified key. If no warnings are associated with the key, the method
413+ * returns 0. This method is thread-safe.
414+ *
415+ * @param key the key identifying the smart contract or entity whose
416+ * warnings are to be retrieved
417+ *
418+ * @return the number of warnings associated with the key, or 0 if none
419+ * exist
420+ */
421+ public int getTimestampDependencyWarnings (Integer key ) {
422+ synchronized (_timestampDependencyWarnings ) {
423+ return (_timestampDependencyWarnings .get (key ) != null ) ? _timestampDependencyWarnings .get (key ).size () : 0 ;
424+ }
425+ }
390426}
0 commit comments