1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.apkcheck;
18 
19 import java.io.StringReader;
20 
21 /**
22  * Class containing "built-in" API description entries.
23  *
24  * There are some bugs in the API description file that we can't work around
25  * (notably some ambiguity with generic types).  The easiest way to cope
26  * is to supply the correct definitions in an add-on file.  Rather than
27  * cart around an extra file, we bake them in here.
28  */
29 public class Builtin {
Builtin()30     private Builtin() {}
31 
32     private static final String BUILTIN =
33         "<api>\n" +
34         " <package name=\"java.util\">\n" +
35         "  <class name=\"EnumSet\"\n" +
36         "   extends=\"java.util.AbstractSet\">\n" +
37         "   <method name=\"of\" return=\"java.util.EnumSet\">\n" +
38         "    <parameter name=\"e\" type=\"java.lang.Enum\"/>\n" +
39         "   </method>\n" +
40         "   <method name=\"of\" return=\"java.util.EnumSet\">\n" +
41         "    <parameter name=\"e1\" type=\"java.lang.Enum\"/>\n" +
42         "    <parameter name=\"e2\" type=\"java.lang.Enum\"/>\n" +
43         "   </method>\n" +
44         "   <method name=\"of\" return=\"java.util.EnumSet\">\n" +
45         "    <parameter name=\"e1\" type=\"java.lang.Enum\"/>\n" +
46         "    <parameter name=\"e2\" type=\"java.lang.Enum\"/>\n" +
47         "    <parameter name=\"e3\" type=\"java.lang.Enum\"/>\n" +
48         "   </method>\n" +
49         "   <method name=\"of\" return=\"java.util.EnumSet\">\n" +
50         "    <parameter name=\"e1\" type=\"java.lang.Enum\"/>\n" +
51         "    <parameter name=\"e2\" type=\"java.lang.Enum\"/>\n" +
52         "    <parameter name=\"e3\" type=\"java.lang.Enum\"/>\n" +
53         "    <parameter name=\"e4\" type=\"java.lang.Enum\"/>\n" +
54         "   </method>\n" +
55         "   <method name=\"of\" return=\"java.util.EnumSet\">\n" +
56         "    <parameter name=\"e1\" type=\"java.lang.Enum\"/>\n" +
57         "    <parameter name=\"e2\" type=\"java.lang.Enum\"/>\n" +
58         "    <parameter name=\"e3\" type=\"java.lang.Enum\"/>\n" +
59         "    <parameter name=\"e4\" type=\"java.lang.Enum\"/>\n" +
60         "    <parameter name=\"e5\" type=\"java.lang.Enum\"/>\n" +
61         "   </method>\n" +
62         "  </class>\n" +
63 
64         " </package>\n" +
65         " <package name=\"android.os\">\n" +
66 
67         "  <class name=\"RemoteCallbackList\"\n" +
68         "   extends=\"java.lang.Object\">\n" +
69         "   <method name=\"register\" return=\"boolean\">\n" +
70         "    <parameter name=\"callback\" type=\"android.os.IInterface\"/>\n" +
71         "   </method>\n" +
72         "   <method name=\"unregister\" return=\"boolean\">\n" +
73         "    <parameter name=\"callback\" type=\"android.os.IInterface\"/>\n" +
74         "   </method>\n" +
75         "  </class>\n" +
76 
77         "  <class name=\"AsyncTask\"\n" +
78         "   extends=\"java.lang.Object\">\n" +
79         "   <method name=\"onPostExecute\" return=\"void\">\n" +
80         "    <parameter name=\"result\" type=\"java.lang.Object\"/>\n" +
81         "   </method>\n" +
82         "   <method name=\"onProgressUpdate\" return=\"void\">\n" +
83         "    <parameter name=\"values\" type=\"java.lang.Object[]\"/>\n" +
84         "   </method>\n" +
85         "   <method name=\"execute\" return=\"android.os.AsyncTask\">\n" +
86         "    <parameter name=\"params\" type=\"java.lang.Object[]\"/>\n" +
87         "   </method>\n" +
88         "  </class>\n" +
89 
90         " </package>\n" +
91         " <package name=\"android.widget\">\n" +
92 
93         "  <class name=\"AutoCompleteTextView\"\n" +
94         "   extends=\"android.widget.EditText\">\n" +
95         "   <method name=\"setAdapter\" return=\"void\">\n" +
96         "    <parameter name=\"adapter\" type=\"android.widget.ListAdapter\"/>\n" +
97         "   </method>\n" +
98         "  </class>\n" +
99 
100         " </package>\n" +
101         "</api>\n"
102         ;
103 
104     /**
105      * Returns the built-in definition "file".
106      */
getReader()107     public static StringReader getReader() {
108         return new StringReader(BUILTIN);
109     }
110 }
111 
112