import java.util.regex.*;

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
	}

}

@@ -702,10 +702,133 @@
 bug%0A%09%7D%0A%0A
+%09// this is OK; we shouldn't report a warning here%0A%09String passwordMasking(String s) %7B%0A%09%09return s.replaceAll(%22.%22, %22x%22);%0A%09%7D%0A
 %7D%0A

add false positive case for RE_POSSIBLE_UNINTENDED_PATTERN