aboutsummaryrefslogtreecommitdiffstats
path: root/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/apicheck/ApiTargetTest.java.txt
blob: 8626858c1fc38ced1bb7d43e61bf96217b15c604 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package test.pkg;

import org.w3c.dom.DOMErrorHandler;

import android.annotation.TargetApi;

// Test using the @TargetApi annotation to temporarily override
// the required API levels
@SuppressWarnings("unused")
public class ApiTargetTest {
	public void test1() {
		// No annotation: should generate warning if manifest SDK < 8
		Class<?> clz = DOMErrorHandler.class; // API 8
	}

	// Temporarily setting method min sdk to 12
	@TargetApi(12)
	public void test2() {
		Class<?> clz = DOMErrorHandler.class; // API 8
	}

	// Temporarily setting method min sdk to 14
	@TargetApi(4)
	public void test3() {
		Class<?> clz = DOMErrorHandler.class; // API 8
	}

	// Temporarily setting class min sdk to 12
	@TargetApi(value=11)
	public static class LocalClass {
		public void test4() {
			Class<?> clz = DOMErrorHandler.class; // API 8
		}

		// Overriding class min sdk: this should generate
		// an API warning again
		@TargetApi(7)
		public void test5() {
			Class<?> clz = DOMErrorHandler.class; // API 8
		}
	}
}