What exactly does this do?
It controls what is in android.jar with which you are compiling.
If you have, say, compileSdkVersion 19 in your build.gradle file, what is actually happening is that $ANDROID_SDK/platforms/android-19/android.jar added to your compilation class path.
This JAR is created as part of the Android compilation. The classes of the Android framework are analyzed and a copy is created. This copy:
Resets all classes, methods, fields, etc., marked with @hide
Has empty implementations of all remaining methods (literally throw new RuntimeException("Stub!") , The last time I looked)
Saves JavaDoc comments for everything that remains
JavaDocs are built from this source tree (therefore, JavaDocs does not display hidden methods), and the SDK version of the JAR infrastructure is compiled from this source tree.
but you can use reflection to access them
This is because at runtime, the real JAR Framework is in your path to the runtime compiled from the real source for the infrastructure classes. It contains everything that was noted with @hide and was removed from the JAR compilation framework.
Can I still call some @hide methods (maybe only static)? And the application compiles and works just fine, as far as I can tell. I just get lint error
As Karakuri remarked, this probably looks like a compilation error. If I try your code in the compileSdkVersion 22 project, I get a compilation error. And when I go to run it, I get:
/tmp/MyApplication/app/src/main/java/com/commonsware/myapplication/MainActivity.java Error:(16, 23) error: cannot find symbol method isEmailAddress(String) Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. Information:BUILD FAILED
Now you can compile the methods previously noted by @hide because they were hidden in the later Android SDK, and your compileSdkVersion is at this API level or higher. Using these methods at API levels before they were officially added to the SDK was risky.
I don't care about the possibility of changing the API
You should, unless you create only one device in which you control the firmware, including all OS updates. And in this case, you are probably creating your own firmware, and so you can create your own JAR SDK structure from your Android fork, where you remove @hide from what you really want to use.
Also, if there was any way to disable lint in each case, it would be useful.
Based on what I see in the screenshot and on my PC, this is a compilation error from the IDE. You cannot disable compilation errors.