package nallar.patched.forge;

import java.util.concurrent.ConcurrentHashMap;

import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;

public abstract class PatchEvent extends Event {
	private static final ConcurrentHashMap<Class, Boolean> annotationMap = new ConcurrentHashMap<Class, Boolean>();

	@Override
	protected boolean hasAnnotation(Class annotation) {
		Class cls = this.getClass();
		Boolean cachedResult = annotationMap.get(cls);
		if (cachedResult != null) {
			return cachedResult;
		}
		Class searchClass = cls;
		while (searchClass != Event.class) {
			if (searchClass.isAnnotationPresent(Cancelable.class)) // Forge bug, not fixed. Buggy behaviour may be required for some mods.
			{
				annotationMap.put(cls, true);
				return true;
			}
			searchClass = searchClass.getSuperclass();
		}
		annotationMap.put(cls, false);
		return false;
	}
}

@@ -37,51 +37,54 @@
 ort 
-java.util.concurrent.ConcurrentHash
+nallar.collections.PartiallySynchronized
 Map;%0D%0A
-%0D%0A
 impo
@@ -238,30 +238,37 @@
 c final 
-ConcurrentHash
+PartiallySynchronized
 Map%3CClas
@@ -303,22 +303,29 @@
 new 
-ConcurrentHash
+PartiallySynchronized
 Map%3C
@@ -683,16 +683,22 @@
 ass)) //
+ TODO:
  Forge b

Use partially synchronized map in Event hasAnnotation cache.