import java.util.*;
import java.lang.*;
import java.lang.reflect.*;
import java.lang.annotation.*;

public class ReadForbidden {
	public static void main(String args[]) throws Exception {
		if (args.length == 0) {
			System.err.println("missing class argument");
			System.exit(-1);
		}

		String grep = "egrep '(java/lang/ClassLoader|java\\.lang\\.ClassLoader|java/lang/reflect|java\\.lang\\.reflect";
		String grep2 = "egrep -v '(";
		String sep = "";
		boolean hasNotForbidden = false;
		ClassLoader cl = ClassLoader.getSystemClassLoader();
		for (String tcln : args) {
			Class newClass = cl.loadClass(tcln);
			Forbidden forbidden = (Forbidden) newClass.getAnnotation(Forbidden.class);
			if (forbidden == null) continue;
			for (String s : forbidden.value()) {
				String escape = s.replaceAll("\\.", "\\\\.");
				grep += "|" + escape;
				escape = s.replaceAll("\\.", "/");
				grep += "|" + escape;
			}
			NotForbidden notforbidden = (NotForbidden) newClass.getAnnotation(NotForbidden.class);
			if (notforbidden == null) continue;
			for (String s : notforbidden.value()) {
				hasNotForbidden = true;
				String escape = s.replaceAll("\\.", "\\\\.");
				grep2 += sep + escape;
				sep = "|";
				escape = s.replaceAll("\\.", "/");
				grep2 += sep + escape;
			}
		}

		grep += ")'";
		grep2 += ")'";
		if(hasNotForbidden) {
			grep = grep2 + " | " + grep;
		}
		System.out.println(grep);
	}
}

@@ -805,78 +805,17 @@
 %22, %22
+(
 %5C%5C%5C%5C.
-%22);%0A%09%09%09%09grep += %22%7C%22 + escape;%0A%09%09%09%09escape = s.replaceAll(%22%5C%5C.%22, %22/
+%7C/)
 %22);%0A
@@ -1086,21 +1086,25 @@
 %22%5C%5C.%22, %22
+(
 %5C%5C%5C%5C.
+%7C/)
 %22);%0A%09%09%09%09
@@ -1145,74 +1145,8 @@
 %7C%22;%0A
-%09%09%09%09escape = s.replaceAll(%22%5C%5C.%22, %22/%22);%0A%09%09%09%09grep2 += sep + escape;%0A
 %09%09%09%7D

Fix for NotForbidden.