import java.util.regex.Pattern;

class BadRegEx {

	boolean f(String s) {
		return s.matches("][");
	}

	String g(String s) {
		return s.replaceAll("][", "xx");
	}

	String h(String s) {
		return s.replaceFirst("][", "xx");
	}

	void x(String s) throws Exception {
		Pattern.matches("][", s);
	}

	Pattern y(String s) throws Exception {
		return Pattern.compile("][", Pattern.CASE_INSENSITIVE);
	}

	Pattern z(String s) {
		return Pattern.compile("][");
	}

	Pattern literalOne(String s) throws Exception {
		return Pattern.compile("][", Pattern.LITERAL); // not a bug
	}

	Pattern literalTwo(String s) throws Exception {
		return Pattern.compile("][", Pattern.CASE_INSENSITIVE | Pattern.LITERAL); // not a bug
	}

	// this is OK; we shouldn't report a warning here
	String passwordMasking(String s) {
		return s.replaceAll(".", "x");
	}
}

@@ -831,10 +831,246 @@
 x%22);%0A%09%7D%0A
+%09%0A%09  private StringBuilder allStatesPost;%0A%0A%09Pattern test() %7B%0A%09%09 String statesPost = allStatesPost.append(%22).*$%22).toString();%0A%09%09   %0A%09 return  Pattern.compile(statesPost,%0A%09%09          Pattern.CASE_INSENSITIVE %7C Pattern.UNICODE_CASE );%0A%09%7D%09%0A
 %7D%0A

add test case