diff options
66 files changed, 243 insertions, 141 deletions
diff --git a/build/tools.atree b/build/tools.atree index 30aaec1..39deb4b 100644 --- a/build/tools.atree +++ b/build/tools.atree @@ -128,6 +128,7 @@ framework/osgi.jar tools/lib/osgi.jar framework/swing-worker-1.1.jar tools/lib/swing-worker-1.1.jar prebuilts/tools/common/asm-tools/asm-4.0.jar tools/lib/asm-4.0.jar prebuilts/tools/common/asm-tools/asm-tree-4.0.jar tools/lib/asm-tree-4.0.jar +prebuilts/tools/common/guava-tools/guava-10.0.1.jar tools/lib/guava-10.0.1.jar # Proguard external/proguard/docs/license.html tools/proguard/license.html diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/.classpath b/eclipse/plugins/com.android.ide.eclipse.adt/.classpath index 7493662..55eb303 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/.classpath +++ b/eclipse/plugins/com.android.ide.eclipse.adt/.classpath @@ -26,5 +26,6 @@ <classpathentry combineaccessrules="false" kind="src" path="/ddmuilib"/> <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/asm-tools/asm-4.0.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/asm-tools/src.zip"/> <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/asm-tools/asm-tree-4.0.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/asm-tools/src.zip"/> + <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/guava-tools/guava-10.0.1.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/guava-tools/src.zip"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF index 58111cc..b0d1219 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF +++ b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF @@ -24,6 +24,7 @@ Bundle-ClassPath: ., libs/httpclient-4.1.1.jar, libs/asm-4.0.jar, libs/asm-tree-4.0.jar, + libs/guava-10.0.1.jar, libs/commons-logging-1.1.1.jar, libs/commons-codec-1.4.jar Bundle-Activator: com.android.ide.eclipse.adt.AdtPlugin diff --git a/eclipse/scripts/create_all_symlinks.sh b/eclipse/scripts/create_all_symlinks.sh index 1000143..c7548a2 100755 --- a/eclipse/scripts/create_all_symlinks.sh +++ b/eclipse/scripts/create_all_symlinks.sh @@ -64,6 +64,7 @@ ADT_PREBUILTS="\ prebuilt/common/kxml2/kxml2-2.3.0.jar \ prebuilts/tools/common/asm-tools/asm-4.0.jar \ prebuilts/tools/common/asm-tools/asm-tree-4.0.jar \ + prebuilts/tools/common/guava-tools/guava-10.0.1.jar \ prebuilt/common/commons-compress/commons-compress-1.0.jar \ prebuilt/common/http-client/httpclient-4.1.1.jar \ prebuilt/common/http-client/httpcore-4.1.jar \ diff --git a/lint/cli/.classpath b/lint/cli/.classpath index cd864d8..267ebe8 100644 --- a/lint/cli/.classpath +++ b/lint/cli/.classpath @@ -6,5 +6,6 @@ <classpathentry combineaccessrules="false" kind="src" path="/lint-checks"/> <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/asm-tools/asm-4.0.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/asm-tools/src.zip"/> <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/asm-tools/asm-tree-4.0.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/asm-tools/src.zip"/> + <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/guava-tools/guava-10.0.1.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/guava-tools/src.zip"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/lint/cli/Android.mk b/lint/cli/Android.mk index 63448d4..3aec3e2 100644 --- a/lint/cli/Android.mk +++ b/lint/cli/Android.mk @@ -14,7 +14,8 @@ LOCAL_JAVA_LIBRARIES := \ lint_checks LOCAL_STATIC_JAVA_LIBRARIES := \ asm-tools \ - asm-tree-tools + asm-tree-tools \ + guava-tools LOCAL_MODULE := lint LOCAL_MODULE_TAGS := optional diff --git a/lint/cli/etc/manifest.txt b/lint/cli/etc/manifest.txt index b75ca8a..a60c7ca 100644 --- a/lint/cli/etc/manifest.txt +++ b/lint/cli/etc/manifest.txt @@ -1,2 +1,2 @@ Main-Class: com.android.tools.lint.Main -Class-Path: lint_api.jar lint_checks.jar asm-4.0.jar asm-tree-4.0.jar +Class-Path: lint_api.jar lint_checks.jar asm-4.0.jar asm-tree-4.0.jar guava-10.0.1.jar diff --git a/lint/cli/src/com/android/tools/lint/HtmlReporter.java b/lint/cli/src/com/android/tools/lint/HtmlReporter.java index 8f9ed4d..258359c 100644 --- a/lint/cli/src/com/android/tools/lint/HtmlReporter.java +++ b/lint/cli/src/com/android/tools/lint/HtmlReporter.java @@ -22,10 +22,10 @@ import static com.android.tools.lint.detector.api.LintUtils.endsWith; import com.android.tools.lint.detector.api.Category; import com.android.tools.lint.detector.api.Issue; -import com.android.tools.lint.detector.api.LintUtils; import com.android.tools.lint.detector.api.Location; import com.android.tools.lint.detector.api.Position; import com.android.tools.lint.detector.api.Severity; +import com.google.common.io.Files; import java.io.BufferedWriter; import java.io.File; @@ -651,7 +651,7 @@ class HtmlReporter extends Reporter { File target = new File(resourceDir, base); try { - LintUtils.copyFile(file, target); + Files.copy(file, target); } catch (IOException e) { return null; } diff --git a/lint/libs/lint_api/.classpath b/lint/libs/lint_api/.classpath index 12d1046..742729e 100644 --- a/lint/libs/lint_api/.classpath +++ b/lint/libs/lint_api/.classpath @@ -5,5 +5,6 @@ <classpathentry combineaccessrules="false" kind="src" path="/common"/> <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/asm-tools/asm-4.0.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/asm-tools/src.zip"/> <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/asm-tools/asm-tree-4.0.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/asm-tools/src.zip"/> + <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/guava-tools/guava-10.0.1.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/guava-tools/src.zip"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/lint/libs/lint_api/Android.mk b/lint/libs/lint_api/Android.mk index b089ef1..0d3d7e9 100644 --- a/lint/libs/lint_api/Android.mk +++ b/lint/libs/lint_api/Android.mk @@ -23,7 +23,8 @@ LOCAL_JAVA_LIBRARIES := \ common LOCAL_STATIC_JAVA_LIBRARIES := \ asm-tools \ - asm-tree-tools + asm-tree-tools \ + guava-tools LOCAL_MODULE := lint_api LOCAL_MODULE_TAGS := optional diff --git a/lint/libs/lint_api/src/com/android/tools/lint/client/api/Configuration.java b/lint/libs/lint_api/src/com/android/tools/lint/client/api/Configuration.java index 2cf7598..461c438 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/client/api/Configuration.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/client/api/Configuration.java @@ -20,6 +20,7 @@ import com.android.tools.lint.detector.api.Context; import com.android.tools.lint.detector.api.Issue; import com.android.tools.lint.detector.api.Location; import com.android.tools.lint.detector.api.Severity; +import com.google.common.annotations.Beta; /** * Lint configuration for an Android project such as which specific rules to include, @@ -28,6 +29,7 @@ import com.android.tools.lint.detector.api.Severity; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public abstract class Configuration { /** * Checks whether this issue should be ignored because the user has already diff --git a/lint/libs/lint_api/src/com/android/tools/lint/client/api/DefaultConfiguration.java b/lint/libs/lint_api/src/com/android/tools/lint/client/api/DefaultConfiguration.java index 168e759..1f3d9e9 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/client/api/DefaultConfiguration.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/client/api/DefaultConfiguration.java @@ -21,6 +21,7 @@ import com.android.tools.lint.detector.api.Issue; import com.android.tools.lint.detector.api.Location; import com.android.tools.lint.detector.api.Project; import com.android.tools.lint.detector.api.Severity; +import com.google.common.annotations.Beta; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -50,11 +51,11 @@ import javax.xml.parsers.DocumentBuilderFactory; /** * Default implementation of a {@link Configuration} which reads and writes * configuration data into {@code lint.xml} in the project directory. - * * <p/> * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public class DefaultConfiguration extends Configuration { private final LintClient mClient; private static final String CONFIG_FILE_NAME = "lint.xml"; //$NON-NLS-1$ diff --git a/lint/libs/lint_api/src/com/android/tools/lint/client/api/DefaultSdkInfo.java b/lint/libs/lint_api/src/com/android/tools/lint/client/api/DefaultSdkInfo.java index 3274ee0..7ca3fab 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/client/api/DefaultSdkInfo.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/client/api/DefaultSdkInfo.java @@ -56,10 +56,18 @@ import static com.android.tools.lint.detector.api.LintConstants.VIEW_STUB; import static com.android.tools.lint.detector.api.LintConstants.VIEW_SWITCHER; import static com.android.tools.lint.detector.api.LintConstants.WIDGET_PKG_PREFIX; +import com.google.common.annotations.Beta; + import java.util.HashMap; import java.util.Map; -/** Default simple implementation of an {@link SdkInfo} */ +/** + * Default simple implementation of an {@link SdkInfo} + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> + */ +@Beta class DefaultSdkInfo extends SdkInfo { @Override public String getParentViewName(String name) { diff --git a/lint/libs/lint_api/src/com/android/tools/lint/client/api/IDomParser.java b/lint/libs/lint_api/src/com/android/tools/lint/client/api/IDomParser.java index 9c40bd8..743e0c5 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/client/api/IDomParser.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/client/api/IDomParser.java @@ -19,6 +19,7 @@ package com.android.tools.lint.client.api; import com.android.tools.lint.detector.api.Context; import com.android.tools.lint.detector.api.Location; import com.android.tools.lint.detector.api.XmlContext; +import com.google.common.annotations.Beta; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -30,6 +31,7 @@ import org.w3c.dom.Node; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public interface IDomParser { /** * Parse the file pointed to by the given context and return as a Document diff --git a/lint/libs/lint_api/src/com/android/tools/lint/client/api/IssueRegistry.java b/lint/libs/lint_api/src/com/android/tools/lint/client/api/IssueRegistry.java index 0c11ba9..3616b5e 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/client/api/IssueRegistry.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/client/api/IssueRegistry.java @@ -21,6 +21,7 @@ import com.android.tools.lint.detector.api.Detector; import com.android.tools.lint.detector.api.Issue; import com.android.tools.lint.detector.api.Scope; import com.android.tools.lint.detector.api.Severity; +import com.google.common.annotations.Beta; import java.util.ArrayList; import java.util.Collections; @@ -31,7 +32,12 @@ import java.util.List; import java.util.Map; import java.util.Set; -/** Registry which provides a list of checks to be performed on an Android project */ +/** Registry which provides a list of checks to be performed on an Android project + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> + */ +@Beta public abstract class IssueRegistry { private static List<Category> sCategories; private static Map<String, Issue> sIdToIssue; diff --git a/lint/libs/lint_api/src/com/android/tools/lint/client/api/Lint.java b/lint/libs/lint_api/src/com/android/tools/lint/client/api/Lint.java index 2a1d587..ec962b8 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/client/api/Lint.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/client/api/Lint.java @@ -33,6 +33,8 @@ import com.android.tools.lint.detector.api.ResourceXmlDetector; import com.android.tools.lint.detector.api.Scope; import com.android.tools.lint.detector.api.Severity; import com.android.tools.lint.detector.api.XmlContext; +import com.google.common.annotations.Beta; +import com.google.common.io.Files; import org.objectweb.asm.ClassReader; import org.objectweb.asm.tree.ClassNode; @@ -50,7 +52,13 @@ import java.util.List; import java.util.Map; import java.util.Set; -/** Analyzes Android projects and files */ +/** + * Analyzes Android projects and files + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> + */ +@Beta public class Lint { private static final String PROGUARD_CFG = "proguard.cfg"; //$NON-NLS-1$ private static final String ANDROID_MANIFEST_XML = "AndroidManifest.xml"; //$NON-NLS-1$ @@ -457,7 +465,7 @@ public class Lint { for (File file : classFiles) { try { - byte[] bytes = LintUtils.readBytes(file); + byte[] bytes = Files.toByteArray(file); if (bytes != null) { ClassReader reader = new ClassReader(bytes); ClassNode classNode = new ClassNode(); diff --git a/lint/libs/lint_api/src/com/android/tools/lint/client/api/LintClient.java b/lint/libs/lint_api/src/com/android/tools/lint/client/api/LintClient.java index db138c2..1f37553 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/client/api/LintClient.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/client/api/LintClient.java @@ -21,6 +21,7 @@ import com.android.tools.lint.detector.api.Detector; import com.android.tools.lint.detector.api.Issue; import com.android.tools.lint.detector.api.Location; import com.android.tools.lint.detector.api.Project; +import com.google.common.annotations.Beta; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -43,6 +44,7 @@ import javax.xml.parsers.DocumentBuilderFactory; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public abstract class LintClient { /** * Returns a configuration for use by the given project. The configuration diff --git a/lint/libs/lint_api/src/com/android/tools/lint/client/api/LintListener.java b/lint/libs/lint_api/src/com/android/tools/lint/client/api/LintListener.java index 6c5c049..cb5d6c9 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/client/api/LintListener.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/client/api/LintListener.java @@ -17,8 +17,15 @@ package com.android.tools.lint.client.api; import com.android.tools.lint.detector.api.Context; +import com.google.common.annotations.Beta; -/** Interface implemented by listeners to be notified of lint events */ +/** + * Interface implemented by listeners to be notified of lint events + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> + */ +@Beta public interface LintListener { /** The various types of events provided to lint listeners */ public enum EventType { diff --git a/lint/libs/lint_api/src/com/android/tools/lint/client/api/SdkInfo.java b/lint/libs/lint_api/src/com/android/tools/lint/client/api/SdkInfo.java index 6974f22..9da87a8 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/client/api/SdkInfo.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/client/api/SdkInfo.java @@ -16,7 +16,15 @@ package com.android.tools.lint.client.api; -/** Information about SDKs */ +import com.google.common.annotations.Beta; + +/** + * Information about SDKs + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> + */ +@Beta public abstract class SdkInfo { /** * Returns true if the given child view is the same class or a sub class of diff --git a/lint/libs/lint_api/src/com/android/tools/lint/client/api/XmlVisitor.java b/lint/libs/lint_api/src/com/android/tools/lint/client/api/XmlVisitor.java index ce0a03e..15fd123 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/client/api/XmlVisitor.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/client/api/XmlVisitor.java @@ -20,6 +20,7 @@ import com.android.tools.lint.detector.api.Detector; import com.android.tools.lint.detector.api.Detector.XmlScanner; import com.android.tools.lint.detector.api.LintUtils; import com.android.tools.lint.detector.api.XmlContext; +import com.google.common.annotations.Beta; import org.w3c.dom.Attr; import org.w3c.dom.Element; @@ -49,7 +50,11 @@ import java.util.RandomAccess; * </ol> * It also notifies all the detectors before and after the document is processed * such that they can do pre- and post-processing. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta class XmlVisitor { private final Map<String, List<Detector.XmlScanner>> mElementToCheck = new HashMap<String, List<Detector.XmlScanner>>(); diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Category.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Category.java index 88df665..6713a7f 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Category.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Category.java @@ -16,12 +16,15 @@ package com.android.tools.lint.detector.api; +import com.google.common.annotations.Beta; + /** * A category is a container for related issues. * <p/> * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public final class Category implements Comparable<Category> { private final String mName; private final String mExplanation; diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/ClassContext.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/ClassContext.java index f35889c..0fbb96c 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/ClassContext.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/ClassContext.java @@ -20,6 +20,7 @@ import static com.android.tools.lint.detector.api.LintConstants.DOT_CLASS; import static com.android.tools.lint.detector.api.LintConstants.DOT_JAVA; import com.android.tools.lint.client.api.LintClient; +import com.google.common.annotations.Beta; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.tree.ClassNode; @@ -34,6 +35,7 @@ import java.util.List; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public class ClassContext extends Context { private final File mBinDir; private ClassNode mClassNode; diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Context.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Context.java index 9bf9a79..d25dca2 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Context.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Context.java @@ -19,6 +19,7 @@ package com.android.tools.lint.detector.api; import com.android.tools.lint.client.api.Configuration; import com.android.tools.lint.client.api.LintClient; import com.android.tools.lint.client.api.SdkInfo; +import com.google.common.annotations.Beta; import java.io.File; import java.util.EnumSet; @@ -34,6 +35,7 @@ import java.util.concurrent.atomic.AtomicBoolean; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public class Context { /** * The file being checked. Note that this may not always be to a concrete diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/DefaultPosition.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/DefaultPosition.java index 6d7c6f3..fe5ada8 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/DefaultPosition.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/DefaultPosition.java @@ -16,7 +16,15 @@ package com.android.tools.lint.detector.api; -/** A simple offset-based position */ +import com.google.common.annotations.Beta; + +/** + * A simple offset-based position * + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> + */ +@Beta public class DefaultPosition extends Position { /** The line number (0-based where the first line is line 0) */ private final int mLine; diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Detector.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Detector.java index c502e11..2d86dce 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Detector.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Detector.java @@ -16,6 +16,8 @@ package com.android.tools.lint.detector.api; +import com.google.common.annotations.Beta; + import org.objectweb.asm.tree.ClassNode; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -42,6 +44,7 @@ import java.util.List; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public abstract class Detector { /** Specialized interface for detectors that scan Java source file parse trees */ public interface JavaScanner { diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Issue.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Issue.java index de5cde3..5c1dd48 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Issue.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Issue.java @@ -17,6 +17,7 @@ package com.android.tools.lint.detector.api; import com.android.tools.lint.client.api.Configuration; +import com.google.common.annotations.Beta; import java.util.EnumSet; @@ -33,6 +34,7 @@ import java.util.EnumSet; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public final class Issue implements Comparable<Issue> { private final String mId; private final String mDescription; diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LayoutDetector.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LayoutDetector.java index c18c762..c74b92a 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LayoutDetector.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LayoutDetector.java @@ -28,6 +28,7 @@ import static com.android.tools.lint.detector.api.LintConstants.VALUE_FILL_PAREN import static com.android.tools.lint.detector.api.LintConstants.VALUE_MATCH_PARENT; import com.android.resources.ResourceFolderType; +import com.google.common.annotations.Beta; import org.w3c.dom.Element; @@ -38,6 +39,7 @@ import org.w3c.dom.Element; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public abstract class LayoutDetector extends ResourceXmlDetector { @Override public boolean appliesTo(ResourceFolderType folderType) { diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LintConstants.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LintConstants.java index 268fd18..b0fbef6 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LintConstants.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LintConstants.java @@ -16,9 +16,15 @@ package com.android.tools.lint.detector.api; +import com.google.common.annotations.Beta; + /** * Constants used by the various detectors, defined in one place - */ + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> +*/ +@Beta @SuppressWarnings("javadoc") // Not documenting each and every obvious constant public class LintConstants { /** Namespace used in XML files for Android attributes */ diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LintUtils.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LintUtils.java index b7a97fc..55d1cf6 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LintUtils.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/LintUtils.java @@ -21,28 +21,24 @@ import static com.android.tools.lint.detector.api.LintConstants.DOT_XML; import com.android.resources.FolderTypeRelationship; import com.android.resources.ResourceFolderType; import com.android.resources.ResourceType; +import com.google.common.annotations.Beta; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; /** * Useful utility methods related to lint. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public class LintUtils { /** * Format a list of strings, and cut of the list at {@code maxItems} if the @@ -71,45 +67,6 @@ public class LintUtils { } /** - * Computes the set difference {@code a - b} - * - * @param a the set to subtract from - * @param b the set to subtract - * @return the elements that are in {@code a} but not in {@code b} - */ - public static Set<String> difference(Set<String> a, Set<String> b) { - HashSet<String> copy = new HashSet<String>(a); - copy.removeAll(b); - return copy; - } - - /** - * Computes the set intersection {@code a intersect b} - * - * @param a the first set to intersect - * @param b the second set to intersect - * @return the elements that are in {@code a} and in {@code b} - */ - public static Set<String> intersection(Set<String> a, Set<String> b) { - HashSet<String> intersection = new HashSet<String>(a); - intersection.retainAll(b); - return intersection; - } - - /** - * Computes the set union {@code a union b} - * - * @param a the first set to add - * @param b the second set to add - * @return the elements that are in {@code a} or in {@code b} - */ - public static Set<String> union(Set<String> a, Set<String> b) { - HashSet<String> union = new HashSet<String>(a); - union.addAll(b); - return union; - } - - /** * Determine if the given type corresponds to a resource that has a unique * file * @@ -192,68 +149,4 @@ public class LintUtils { return childCount; } - - /** - * Copies a file - * - * @param src the file to copy - * @param target the filename to write the file into - * @throws IOException if an I/O problem occurs - */ - public static void copyFile(File src, File target) throws IOException { - InputStream input = null; - OutputStream output = null; - try { - input = new BufferedInputStream(new FileInputStream(src)); - output = new BufferedOutputStream(new FileOutputStream(target)); - byte[] buffer = new byte[1024]; - while (true) { - int bytesRead = input.read(buffer); - if (bytesRead == -1) { - break; - } - output.write(buffer, 0, bytesRead); - } - } finally { - if (input != null) { - input.close(); - } - if (output != null) { - output.close(); - } - } - } - - /** - * Reads the file contents of the given file and returns it as a byte array. - * - * @param src the file to be read - * @return the contents of the file, or null - * @throws IOException if an I/O error occurs - */ - public static byte[] readBytes(File src) throws IOException { - InputStream input = null; - try { - int length = (int) src.length(); - if (length <= 0) { - return null; - } - byte[] buffer = new byte[length]; - input = new BufferedInputStream(new FileInputStream(src)); - int offset = 0; - while (offset < length) { - int n = input.read(buffer, offset, length - offset); - if (n == -1) { - break; - } - offset += n; - } - - return buffer; - } finally { - if (input != null) { - input.close(); - } - } - } } diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Location.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Location.java index 68e7c23..c49e2ac 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Location.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Location.java @@ -16,6 +16,8 @@ package com.android.tools.lint.detector.api; +import com.google.common.annotations.Beta; + import java.io.File; /** @@ -24,6 +26,7 @@ import java.io.File; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public class Location { private final File mFile; private final Position mStart; diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Position.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Position.java index e5c1a9a..6407cc9 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Position.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Position.java @@ -16,12 +16,15 @@ package com.android.tools.lint.detector.api; +import com.google.common.annotations.Beta; + /** * Information about a position in a file/document. * <p/> * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public abstract class Position { /** * Returns the line number (0-based where the first line is line 0) diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Project.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Project.java index 7bf2c2b..b5fab29 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Project.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Project.java @@ -17,13 +17,14 @@ package com.android.tools.lint.detector.api; import static com.android.tools.lint.detector.api.LintConstants.ANDROID_URI; -import static com.android.tools.lint.detector.api.LintConstants.ATTR_PACKAGE; import static com.android.tools.lint.detector.api.LintConstants.ATTR_MIN_SDK_VERSION; +import static com.android.tools.lint.detector.api.LintConstants.ATTR_PACKAGE; import static com.android.tools.lint.detector.api.LintConstants.ATTR_TARGET_SDK_VERSION; import static com.android.tools.lint.detector.api.LintConstants.TAG_USES_SDK; import com.android.tools.lint.client.api.Configuration; import com.android.tools.lint.client.api.LintClient; +import com.google.common.annotations.Beta; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -37,9 +38,10 @@ import java.util.List; * A project contains information about an Android project being scanned for * Lint errors. * <p> - * TODO: Accumulate more project info here, such as the project package name, - * the minimum and target SDK API levels, etc. + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public class Project { /** The associated tool */ private final LintClient mTool; diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/ResourceXmlDetector.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/ResourceXmlDetector.java index ca18fc3..0c941dd 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/ResourceXmlDetector.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/ResourceXmlDetector.java @@ -17,6 +17,7 @@ package com.android.tools.lint.detector.api; import com.android.resources.ResourceFolderType; +import com.google.common.annotations.Beta; import java.io.File; @@ -28,6 +29,7 @@ import java.io.File; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public abstract class ResourceXmlDetector extends Detector implements Detector.XmlScanner { @Override public boolean appliesTo(Context context, File file) { diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Scope.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Scope.java index 18a369c..e7198c5 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Scope.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Scope.java @@ -16,13 +16,19 @@ package com.android.tools.lint.detector.api; +import com.google.common.annotations.Beta; + import java.util.EnumSet; /** * The scope of a detector is the set of files a detector must consider when * performing its analysis. This can be used to determine when issues are * potentially obsolete, whether a detector should re-run on a file save, etc. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public enum Scope { /** * The analysis only considers a single XML resource file at a time. diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Severity.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Severity.java index 3161cd2..27840de 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Severity.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Severity.java @@ -16,12 +16,15 @@ package com.android.tools.lint.detector.api; +import com.google.common.annotations.Beta; + /** * Severity of an issue found by lint * <p/> * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public enum Severity { /** * Errors: Use sparingly because a warning marked as an error will be diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Speed.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Speed.java index 2f7f17a..79de400 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Speed.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/Speed.java @@ -16,7 +16,15 @@ package com.android.tools.lint.detector.api; -/** Enum which describes the different computation speeds of various detectors */ +import com.google.common.annotations.Beta; + +/** + * Enum which describes the different computation speeds of various detectors + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> + */ +@Beta public enum Speed { /** The detector can run very quickly */ FAST("Fast"), diff --git a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/XmlContext.java b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/XmlContext.java index 2c282ed..f456a63 100644 --- a/lint/libs/lint_api/src/com/android/tools/lint/detector/api/XmlContext.java +++ b/lint/libs/lint_api/src/com/android/tools/lint/detector/api/XmlContext.java @@ -18,6 +18,7 @@ package com.android.tools.lint.detector.api; import com.android.tools.lint.client.api.IDomParser; import com.android.tools.lint.client.api.LintClient; +import com.google.common.annotations.Beta; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -31,6 +32,7 @@ import java.util.EnumSet; * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> */ +@Beta public class XmlContext extends Context { /** The XML parser */ public IDomParser parser; diff --git a/lint/libs/lint_checks/.classpath b/lint/libs/lint_checks/.classpath index eab475b..7ccda94 100644 --- a/lint/libs/lint_checks/.classpath +++ b/lint/libs/lint_checks/.classpath @@ -7,5 +7,6 @@ <classpathentry combineaccessrules="false" kind="src" path="/AndroidPrefs"/> <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/asm-tools/asm-4.0.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/asm-tools/src.zip"/> <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/asm-tools/asm-tree-4.0.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/asm-tools/src.zip"/> + <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/guava-tools/guava-10.0.1.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/guava-tools/src.zip"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/lint/libs/lint_checks/Android.mk b/lint/libs/lint_checks/Android.mk index d51d3c8..9038199 100644 --- a/lint/libs/lint_checks/Android.mk +++ b/lint/libs/lint_checks/Android.mk @@ -16,7 +16,8 @@ LOCAL_JAVA_LIBRARIES := \ lint_api LOCAL_STATIC_JAVA_LIBRARIES := \ asm-tools \ - asm-tree-tools + asm-tree-tools \ + guava-tools LOCAL_MODULE := lint_checks LOCAL_MODULE_TAGS := optional diff --git a/lint/libs/lint_checks/src/com/android/tools/lint/checks/IconDetector.java b/lint/libs/lint_checks/src/com/android/tools/lint/checks/IconDetector.java index 1717225..5f7adcb 100644 --- a/lint/libs/lint_checks/src/com/android/tools/lint/checks/IconDetector.java +++ b/lint/libs/lint_checks/src/com/android/tools/lint/checks/IconDetector.java @@ -32,9 +32,7 @@ import static com.android.tools.lint.detector.api.LintConstants.DRAWABLE_RESOURC import static com.android.tools.lint.detector.api.LintConstants.DRAWABLE_XHDPI; import static com.android.tools.lint.detector.api.LintConstants.RES_FOLDER; import static com.android.tools.lint.detector.api.LintConstants.TAG_APPLICATION; -import static com.android.tools.lint.detector.api.LintUtils.difference; import static com.android.tools.lint.detector.api.LintUtils.endsWith; -import static com.android.tools.lint.detector.api.LintUtils.intersection; import com.android.tools.lint.detector.api.Category; import com.android.tools.lint.detector.api.Context; @@ -46,6 +44,8 @@ import com.android.tools.lint.detector.api.Scope; import com.android.tools.lint.detector.api.Severity; import com.android.tools.lint.detector.api.Speed; import com.android.tools.lint.detector.api.XmlContext; +import com.google.common.collect.Sets; +import com.google.common.io.Files; import org.w3c.dom.Element; @@ -413,7 +413,7 @@ public class IconDetector extends Detector implements Detector.XmlScanner { byte[] bits = fileContents.get(file); if (bits == null) { try { - bits = LintUtils.readBytes(file); + bits = Files.toByteArray(file); fileContents.put(file, bits); } catch (IOException e) { context.log(e, null); @@ -764,7 +764,7 @@ public class IconDetector extends Detector implements Detector.XmlScanner { String folderName = folder.getName(); if (!isNoDpiFolder(folder)) { assert DENSITY_PATTERN.matcher(folderName).matches(); - Set<String> overlap = intersection(noDpiNames, entry.getValue()); + Set<String> overlap = Sets.intersection(noDpiNames, entry.getValue()); inBoth.addAll(overlap); for (String name : overlap) { files.add(new File(folder, name)); @@ -812,7 +812,7 @@ public class IconDetector extends Detector implements Detector.XmlScanner { Set<String> names = entry.getValue(); if (names.size() != allNames.size()) { List<String> delta = - new ArrayList<String>(difference(allNames, names)); + new ArrayList<String>(Sets.difference(allNames, names)); Collections.sort(delta); String foundIn = ""; if (delta.size() == 1) { diff --git a/lint/libs/lint_checks/src/com/android/tools/lint/checks/TranslationDetector.java b/lint/libs/lint_checks/src/com/android/tools/lint/checks/TranslationDetector.java index 24fb653..b07039f 100644 --- a/lint/libs/lint_checks/src/com/android/tools/lint/checks/TranslationDetector.java +++ b/lint/libs/lint_checks/src/com/android/tools/lint/checks/TranslationDetector.java @@ -36,6 +36,7 @@ import com.android.tools.lint.detector.api.Scope; import com.android.tools.lint.detector.api.Severity; import com.android.tools.lint.detector.api.Speed; import com.android.tools.lint.detector.api.XmlContext; +import com.google.common.collect.Sets; import org.w3c.dom.Attr; import org.w3c.dom.Element; @@ -308,7 +309,7 @@ public class TranslationDetector extends ResourceXmlDetector { // defined in other languages, so there's no problem. if (stringCount != strings.size()) { if (reportMissing) { - Set<String> difference = LintUtils.difference(defaultStrings, strings); + Set<String> difference = Sets.difference(defaultStrings, strings); if (difference.size() > 0) { List<String> sorted = new ArrayList<String>(difference); Collections.sort(sorted); @@ -320,7 +321,7 @@ public class TranslationDetector extends ResourceXmlDetector { } if (reportExtra) { - Set<String> difference = LintUtils.difference(strings, defaultStrings); + Set<String> difference = Sets.difference(strings, defaultStrings); if (difference.size() > 0) { List<String> sorted = new ArrayList<String>(difference); Collections.sort(sorted); diff --git a/rule_api/.classpath b/rule_api/.classpath index f9c91e7..5dea91c 100644 --- a/rule_api/.classpath +++ b/rule_api/.classpath @@ -3,5 +3,6 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/common"/> + <classpathentry kind="var" path="ANDROID_OUT_FRAMEWORK/guava-tools.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/guava-tools/src.zip"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/rule_api/Android.mk b/rule_api/Android.mk index 6f5d034..269cadd 100644 --- a/rule_api/Android.mk +++ b/rule_api/Android.mk @@ -20,7 +20,8 @@ LOCAL_SRC_FILES := $(call all-java-files-under,src) LOCAL_JAVA_RESOURCE_DIRS := src LOCAL_JAVA_LIBRARIES := \ - common + common \ + guava-tools LOCAL_MODULE := rule_api LOCAL_MODULE_TAGS := optional diff --git a/rule_api/src/com/android/ide/common/api/AbstractViewRule.java b/rule_api/src/com/android/ide/common/api/AbstractViewRule.java index aa0a7fc..e915e2c 100644 --- a/rule_api/src/com/android/ide/common/api/AbstractViewRule.java +++ b/rule_api/src/com/android/ide/common/api/AbstractViewRule.java @@ -15,13 +15,19 @@ */ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + import java.util.List; /** * Default implementation of an {@link IViewRule}. This is a convenience * implementation which makes it easier to supply designtime behavior for a * custom view and just override the methods you are interested in. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public class AbstractViewRule implements IViewRule { public boolean onInitialize(String fqcn, IClientRulesEngine engine) { return true; diff --git a/rule_api/src/com/android/ide/common/api/DrawingStyle.java b/rule_api/src/com/android/ide/common/api/DrawingStyle.java index 199608e..0712a21 100644 --- a/rule_api/src/com/android/ide/common/api/DrawingStyle.java +++ b/rule_api/src/com/android/ide/common/api/DrawingStyle.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Drawing styles are used to distinguish the visual appearance of selection, * hovers, anchors, etc. Each style may have different colors, line thickness, @@ -25,6 +27,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public enum DrawingStyle { /** * The style used to draw the selected views diff --git a/rule_api/src/com/android/ide/common/api/DropFeedback.java b/rule_api/src/com/android/ide/common/api/DropFeedback.java index 4be9c9e..4a526e5 100755 --- a/rule_api/src/com/android/ide/common/api/DropFeedback.java +++ b/rule_api/src/com/android/ide/common/api/DropFeedback.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Structure returned by onDropEnter/Move and passed to over onDropXyz methods. * <p> @@ -23,6 +25,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public class DropFeedback { /** * User data that the rule can use in any way it wants to carry state from one diff --git a/rule_api/src/com/android/ide/common/api/IAttributeInfo.java b/rule_api/src/com/android/ide/common/api/IAttributeInfo.java index da1bc9e..3dcb241 100755 --- a/rule_api/src/com/android/ide/common/api/IAttributeInfo.java +++ b/rule_api/src/com/android/ide/common/api/IAttributeInfo.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Information about an attribute as gathered from the attrs.xml file where * the attribute was declared. This must include a format (string, reference, float, etc.), @@ -25,6 +27,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IAttributeInfo { /** An attribute format, e.g. string, reference, float, etc. */ diff --git a/rule_api/src/com/android/ide/common/api/IClientRulesEngine.java b/rule_api/src/com/android/ide/common/api/IClientRulesEngine.java index 68d7bac..490ef0c 100755 --- a/rule_api/src/com/android/ide/common/api/IClientRulesEngine.java +++ b/rule_api/src/com/android/ide/common/api/IClientRulesEngine.java @@ -18,6 +18,7 @@ package com.android.ide.common.api; import com.android.annotations.Nullable; +import com.google.common.annotations.Beta; import java.util.Collection; import java.util.Map; @@ -30,6 +31,7 @@ import java.util.Map; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IClientRulesEngine { /** diff --git a/rule_api/src/com/android/ide/common/api/IColor.java b/rule_api/src/com/android/ide/common/api/IColor.java index f75d30a..26122a5 100755 --- a/rule_api/src/com/android/ide/common/api/IColor.java +++ b/rule_api/src/com/android/ide/common/api/IColor.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A color, to be used with {@link IGraphics} draw operations. * <p> @@ -23,6 +25,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IColor { // pass } diff --git a/rule_api/src/com/android/ide/common/api/IDragElement.java b/rule_api/src/com/android/ide/common/api/IDragElement.java index a5e339a..e03b718 100755 --- a/rule_api/src/com/android/ide/common/api/IDragElement.java +++ b/rule_api/src/com/android/ide/common/api/IDragElement.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Represents an XML element with a name, attributes and inner elements. * <p/> @@ -26,6 +28,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IDragElement { /** diff --git a/rule_api/src/com/android/ide/common/api/IFeedbackPainter.java b/rule_api/src/com/android/ide/common/api/IFeedbackPainter.java index 7478f6b..d6e256d 100644 --- a/rule_api/src/com/android/ide/common/api/IFeedbackPainter.java +++ b/rule_api/src/com/android/ide/common/api/IFeedbackPainter.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A feedback painter paints drop feedback during a drag & drop operation. * <p> @@ -23,6 +25,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IFeedbackPainter { /** * Paints feedback for the given target node into the given graphics context. diff --git a/rule_api/src/com/android/ide/common/api/IGraphics.java b/rule_api/src/com/android/ide/common/api/IGraphics.java index 0ee2ef2..cb1cac5 100755 --- a/rule_api/src/com/android/ide/common/api/IGraphics.java +++ b/rule_api/src/com/android/ide/common/api/IGraphics.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + import java.util.List; /** @@ -30,6 +32,7 @@ import java.util.List; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IGraphics { /** diff --git a/rule_api/src/com/android/ide/common/api/IMenuCallback.java b/rule_api/src/com/android/ide/common/api/IMenuCallback.java index 80f77b8..6c55222 100644 --- a/rule_api/src/com/android/ide/common/api/IMenuCallback.java +++ b/rule_api/src/com/android/ide/common/api/IMenuCallback.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + import java.util.List; /** @@ -28,6 +30,7 @@ import java.util.List; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface IMenuCallback { /** * Performs the actual work promised by the {@link RuleAction}. diff --git a/rule_api/src/com/android/ide/common/api/INode.java b/rule_api/src/com/android/ide/common/api/INode.java index b4cb638..7c60d82 100755 --- a/rule_api/src/com/android/ide/common/api/INode.java +++ b/rule_api/src/com/android/ide/common/api/INode.java @@ -18,6 +18,7 @@ package com.android.ide.common.api; import com.android.ide.common.api.IDragElement.IDragAttribute; +import com.google.common.annotations.Beta; import java.util.List; @@ -39,6 +40,7 @@ import java.util.List; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface INode { /** diff --git a/rule_api/src/com/android/ide/common/api/INodeHandler.java b/rule_api/src/com/android/ide/common/api/INodeHandler.java index e261395..8a9b504 100644 --- a/rule_api/src/com/android/ide/common/api/INodeHandler.java +++ b/rule_api/src/com/android/ide/common/api/INodeHandler.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A node handler is a callback which operates on a Node, such as for example * the implementation of an XML editing operation via @@ -25,6 +27,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public interface INodeHandler { /** * Operates on the given node. diff --git a/rule_api/src/com/android/ide/common/api/IValidator.java b/rule_api/src/com/android/ide/common/api/IValidator.java index 6ef44cd..29f43d5 100644 --- a/rule_api/src/com/android/ide/common/api/IValidator.java +++ b/rule_api/src/com/android/ide/common/api/IValidator.java @@ -16,14 +16,16 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * An IValidator can validate strings and return custom messages if validation * fails. * <p> * <b>NOTE: This is not a public or final API; if you rely on this be prepared * to adjust your code for the next tools release.</b> - * </p> */ +@Beta public interface IValidator { /** * Validates the given input string, and return null if the text is valid, diff --git a/rule_api/src/com/android/ide/common/api/IViewMetadata.java b/rule_api/src/com/android/ide/common/api/IViewMetadata.java index 8646764..190a497 100644 --- a/rule_api/src/com/android/ide/common/api/IViewMetadata.java +++ b/rule_api/src/com/android/ide/common/api/IViewMetadata.java @@ -16,13 +16,19 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + import java.util.List; /** * Metadata about a particular view. The metadata for a View can be found by asking the * {@link IClientRulesEngine} for the metadata for a given class via * {@link IClientRulesEngine#getMetadata}. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public interface IViewMetadata { /** * Returns the display name views of this type (a name suitable to display to the diff --git a/rule_api/src/com/android/ide/common/api/InsertType.java b/rule_api/src/com/android/ide/common/api/InsertType.java index 806b2bb..26538ae 100644 --- a/rule_api/src/com/android/ide/common/api/InsertType.java +++ b/rule_api/src/com/android/ide/common/api/InsertType.java @@ -16,10 +16,16 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * An enumerated type of different insertion events, such as an insertion from a * copy/paste operation or as the first half of a move operation. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public enum InsertType { /** The view is newly created (by for example a palette drag) */ CREATE, diff --git a/rule_api/src/com/android/ide/common/api/MarginType.java b/rule_api/src/com/android/ide/common/api/MarginType.java index d3a27a4..188f85c 100644 --- a/rule_api/src/com/android/ide/common/api/MarginType.java +++ b/rule_api/src/com/android/ide/common/api/MarginType.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A {@link MarginType} indicates whether a {@link Segment} corresponds to the visual edge @@ -29,7 +31,11 @@ package com.android.ide.common.api; * will be offset by the margin on the target node. Therefore, we have to add <b>both</b> * edges (the bounds of the target node with and without edges) and check for matches on * each edge depending on the constraint being considered. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public enum MarginType { /** * This margin type is used for nodes that have margins, and this segment includes the diff --git a/rule_api/src/com/android/ide/common/api/Margins.java b/rule_api/src/com/android/ide/common/api/Margins.java index 40f44ce..969d068 100644 --- a/rule_api/src/com/android/ide/common/api/Margins.java +++ b/rule_api/src/com/android/ide/common/api/Margins.java @@ -16,11 +16,17 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Set of margins - distances to outer left, top, right and bottom edges. These objects * can be used for both actual <b>margins</b> as well as insets - and in general any * deltas to the bounds of a rectangle. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public class Margins { /** The left margin */ public final int left; diff --git a/rule_api/src/com/android/ide/common/api/Point.java b/rule_api/src/com/android/ide/common/api/Point.java index 67c41d3..199701a 100755 --- a/rule_api/src/com/android/ide/common/api/Point.java +++ b/rule_api/src/com/android/ide/common/api/Point.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * Mutable point. @@ -24,6 +26,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public class Point { public int x, y; diff --git a/rule_api/src/com/android/ide/common/api/Rect.java b/rule_api/src/com/android/ide/common/api/Rect.java index f3922e2..0ae7a74 100755 --- a/rule_api/src/com/android/ide/common/api/Rect.java +++ b/rule_api/src/com/android/ide/common/api/Rect.java @@ -16,6 +16,8 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** @@ -30,6 +32,7 @@ package com.android.ide.common.api; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public class Rect { public int x, y, w, h; diff --git a/rule_api/src/com/android/ide/common/api/ResizePolicy.java b/rule_api/src/com/android/ide/common/api/ResizePolicy.java index 05ad81c..3383cd0 100644 --- a/rule_api/src/com/android/ide/common/api/ResizePolicy.java +++ b/rule_api/src/com/android/ide/common/api/ResizePolicy.java @@ -15,10 +15,16 @@ */ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A {@link ResizePolicy} records state for whether a widget is resizable, and if so, in * which directions + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public class ResizePolicy { private static final int NONE = 0; private static final int LEFT_EDGE = 1; diff --git a/rule_api/src/com/android/ide/common/api/RuleAction.java b/rule_api/src/com/android/ide/common/api/RuleAction.java index 2ebab36..71a6ac9 100755 --- a/rule_api/src/com/android/ide/common/api/RuleAction.java +++ b/rule_api/src/com/android/ide/common/api/RuleAction.java @@ -17,6 +17,7 @@ package com.android.ide.common.api; import com.android.util.Pair; +import com.google.common.annotations.Beta; import java.net.URL; import java.util.ArrayList; @@ -42,6 +43,7 @@ import java.util.regex.Pattern; * to adjust your code for the next tools release.</b> * </p> */ +@Beta public class RuleAction implements Comparable<RuleAction> { /** * Character used to split multiple checked choices. diff --git a/rule_api/src/com/android/ide/common/api/Segment.java b/rule_api/src/com/android/ide/common/api/Segment.java index 9668b54..681fd14 100644 --- a/rule_api/src/com/android/ide/common/api/Segment.java +++ b/rule_api/src/com/android/ide/common/api/Segment.java @@ -16,11 +16,17 @@ package com.android.ide.common.api; +import com.google.common.annotations.Beta; + /** * A segment is a straight horizontal or vertical line between two points, typically an * edge of a node but also possibly some internal segment like a baseline or a center * line, and it can be offset by a margin from the node's visible bounds. + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> */ +@Beta public class Segment { /** For horizontal lines, the y coordinate; for vertical lines the x */ public final int at; diff --git a/rule_api/src/com/android/ide/common/api/SegmentType.java b/rule_api/src/com/android/ide/common/api/SegmentType.java index a21247d..191d753 100644 --- a/rule_api/src/com/android/ide/common/api/SegmentType.java +++ b/rule_api/src/com/android/ide/common/api/SegmentType.java @@ -16,7 +16,14 @@ package com.android.ide.common.api; -/** A segment type describes the different roles or positions a segment can have in a node */ +import com.google.common.annotations.Beta; + +/** A segment type describes the different roles or positions a segment can have in a node + * <p> + * <b>NOTE: This is not a public or final API; if you rely on this be prepared + * to adjust your code for the next tools release.</b> + */ +@Beta public enum SegmentType { LEFT, TOP, RIGHT, BOTTOM, BASELINE, CENTER_VERTICAL, CENTER_HORIZONTAL, UNKNOWN; |