Merge "Tighten up ahat public API."
diff --git a/tools/ahat/Android.mk b/tools/ahat/Android.mk
index 1b8a8c5..a9a0492 100644
--- a/tools/ahat/Android.mk
+++ b/tools/ahat/Android.mk
@@ -35,6 +35,47 @@
LOCAL_COMPATIBILITY_SUITE := general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
+AHAT_JAR := $(LOCAL_BUILT_MODULE)
+AHAT_API := $(intermediates.COMMON)/ahat_api.txt
+AHAT_REMOVED_API := $(intermediates.COMMON)/ahat_removed_api.txt
+
+# --- api check for ahat.jar ----------
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := $(call all-java-files-under, src/main)
+LOCAL_IS_HOST_MODULE := true
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+LOCAL_MODULE := ahat
+LOCAL_DROIDDOC_OPTIONS := \
+ -stubpackages com.android.ahat:com.android.ahat.* \
+ -api $(AHAT_API) \
+ -removedApi $(AHAT_REMOVED_API)
+LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := external/doclava/res/assets/templates-sdk
+include $(BUILD_DROIDDOC)
+$(AHAT_API): $(full_target)
+
+$(eval $(call check-api, \
+ ahat-check-api, \
+ $(LOCAL_PATH)/etc/ahat_api.txt, \
+ $(AHAT_API), \
+ $(LOCAL_PATH)/etc/ahat_removed_api.txt, \
+ $(AHAT_REMOVED_API), \
+ -error 2 -error 3 -error 4 -error 5 -error 6 -error 7 -error 8 -error 9 -error 10 -error 11 \
+ -error 12 -error 13 -error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 \
+ -error 21 -error 23 -error 24 -error 25 -error 26 -error 27, \
+ cat $(LOCAL_PATH)/etc/ahat_api_msg.txt, \
+ $(AHAT_JAR),))
+
+.PHONY: ahat-update-api
+ahat-update-api: PRIVATE_AHAT_API := $(AHAT_API)
+ahat-update-api: PRIVATE_AHAT_REMOVED_API := $(AHAT_REMOVED_API)
+ahat-update-api: PRIVATE_AHAT_ETC_API := $(LOCAL_PATH)/etc/ahat_api.txt
+ahat-update-api: PRIVATE_AHAT_ETC_REMOVED_API := $(LOCAL_PATH)/etc/ahat_removed_api.txt
+ahat-update-api: ahat-docs
+ @echo Copying ahat_api.txt
+ cp $(PRIVATE_AHAT_API) $(PRIVATE_AHAT_ETC_API)
+ @echo Copying ahat_removed_api.txt
+ cp $(PRIVATE_AHAT_REMOVED_API) $(PRIVATE_AHAT_ETC_REMOVED_API)
# --- ahat script ----------------
include $(CLEAR_VARS)
@@ -129,6 +170,9 @@
endif # linux
# Clean up local variables.
+AHAT_JAR :=
+AHAT_API :=
+AHAT_REMOVED_API :=
AHAT_TEST_JAR :=
AHAT_TEST_DUMP_JAR :=
AHAT_TEST_DUMP_HPROF :=
diff --git a/tools/ahat/etc/ahat_api.txt b/tools/ahat/etc/ahat_api.txt
new file mode 100644
index 0000000..7920ada
--- /dev/null
+++ b/tools/ahat/etc/ahat_api.txt
@@ -0,0 +1,327 @@
+package com.android.ahat {
+
+ public class Main {
+ method public static void main(java.lang.String[]);
+ }
+
+}
+
+package com.android.ahat.dominators {
+
+ public class DominatorsComputation {
+ ctor public DominatorsComputation();
+ method public static void computeDominators(com.android.ahat.dominators.DominatorsComputation.Node);
+ }
+
+ public static abstract interface DominatorsComputation.Node {
+ method public abstract java.lang.Object getDominatorsComputationState();
+ method public abstract java.lang.Iterable<? extends com.android.ahat.dominators.DominatorsComputation.Node> getReferencesForDominators();
+ method public abstract void setDominator(com.android.ahat.dominators.DominatorsComputation.Node);
+ method public abstract void setDominatorsComputationState(java.lang.Object);
+ }
+
+}
+
+package com.android.ahat.heapdump {
+
+ public class AhatArrayInstance extends com.android.ahat.heapdump.AhatInstance {
+ method public int getLength();
+ method public com.android.ahat.heapdump.Value getValue(int);
+ method public java.util.List<com.android.ahat.heapdump.Value> getValues();
+ method public java.lang.String toString();
+ }
+
+ public class AhatClassInstance extends com.android.ahat.heapdump.AhatInstance {
+ method public java.lang.Iterable<com.android.ahat.heapdump.FieldValue> getInstanceFields();
+ method public java.lang.String toString();
+ }
+
+ public class AhatClassObj extends com.android.ahat.heapdump.AhatInstance {
+ method public com.android.ahat.heapdump.AhatInstance getClassLoader();
+ method public com.android.ahat.heapdump.Field[] getInstanceFields();
+ method public long getInstanceSize();
+ method public java.lang.String getName();
+ method public java.util.List<com.android.ahat.heapdump.FieldValue> getStaticFieldValues();
+ method public com.android.ahat.heapdump.AhatClassObj getSuperClassObj();
+ method public java.lang.String toString();
+ }
+
+ public class AhatHeap implements com.android.ahat.heapdump.Diffable {
+ method public com.android.ahat.heapdump.AhatHeap getBaseline();
+ method public java.lang.String getName();
+ method public com.android.ahat.heapdump.Size getSize();
+ method public boolean isPlaceHolder();
+ }
+
+ public abstract class AhatInstance implements com.android.ahat.heapdump.Diffable com.android.ahat.dominators.DominatorsComputation.Node {
+ method public com.android.ahat.heapdump.AhatArrayInstance asArrayInstance();
+ method public java.awt.image.BufferedImage asBitmap();
+ method public com.android.ahat.heapdump.AhatClassInstance asClassInstance();
+ method public com.android.ahat.heapdump.AhatClassObj asClassObj();
+ method public java.lang.String asString(int);
+ method public java.lang.String asString();
+ method public com.android.ahat.heapdump.AhatInstance getAssociatedBitmapInstance();
+ method public com.android.ahat.heapdump.AhatInstance getBaseline();
+ method public java.lang.String getClassName();
+ method public com.android.ahat.heapdump.AhatClassObj getClassObj();
+ method public java.lang.String getDexCacheLocation(int);
+ method public java.util.List<com.android.ahat.heapdump.AhatInstance> getDominated();
+ method public java.lang.Object getDominatorsComputationState();
+ method public com.android.ahat.heapdump.Value getField(java.lang.String);
+ method public java.util.List<com.android.ahat.heapdump.AhatInstance> getHardReverseReferences();
+ method public com.android.ahat.heapdump.AhatHeap getHeap();
+ method public long getId();
+ method public com.android.ahat.heapdump.AhatInstance getImmediateDominator();
+ method public java.util.List<com.android.ahat.heapdump.PathElement> getPathFromGcRoot();
+ method public com.android.ahat.heapdump.AhatInstance getRefField(java.lang.String);
+ method public java.lang.Iterable<? extends com.android.ahat.dominators.DominatorsComputation.Node> getReferencesForDominators();
+ method public com.android.ahat.heapdump.AhatInstance getReferent();
+ method public com.android.ahat.heapdump.Size getRetainedSize(com.android.ahat.heapdump.AhatHeap);
+ method public java.util.Collection<com.android.ahat.heapdump.RootType> getRootTypes();
+ method public com.android.ahat.heapdump.Site getSite();
+ method public com.android.ahat.heapdump.Size getSize();
+ method public java.util.List<com.android.ahat.heapdump.AhatInstance> getSoftReverseReferences();
+ method public com.android.ahat.heapdump.Size getTotalRetainedSize();
+ method public boolean isArrayInstance();
+ method public boolean isClassInstance();
+ method public boolean isClassObj();
+ method public boolean isPlaceHolder();
+ method public boolean isRoot();
+ method public boolean isStronglyReachable();
+ method public boolean isUnreachable();
+ method public boolean isWeaklyReachable();
+ method public void setDominator(com.android.ahat.dominators.DominatorsComputation.Node);
+ method public void setDominatorsComputationState(java.lang.Object);
+ method public abstract java.lang.String toString();
+ }
+
+ public class AhatSnapshot implements com.android.ahat.heapdump.Diffable {
+ method public com.android.ahat.heapdump.AhatClassObj findClassObj(long);
+ method public com.android.ahat.heapdump.AhatInstance findInstance(long);
+ method public com.android.ahat.heapdump.AhatSnapshot getBaseline();
+ method public com.android.ahat.heapdump.AhatHeap getHeap(java.lang.String);
+ method public java.util.List<com.android.ahat.heapdump.AhatHeap> getHeaps();
+ method public com.android.ahat.heapdump.Site getRootSite();
+ method public java.util.List<com.android.ahat.heapdump.AhatInstance> getRooted();
+ method public com.android.ahat.heapdump.Site getSite(long);
+ method public boolean isDiffed();
+ method public boolean isPlaceHolder();
+ }
+
+ public class Diff {
+ ctor public Diff();
+ method public static void snapshots(com.android.ahat.heapdump.AhatSnapshot, com.android.ahat.heapdump.AhatSnapshot);
+ }
+
+ public class DiffFields {
+ ctor public DiffFields();
+ method public static java.util.List<com.android.ahat.heapdump.DiffedFieldValue> diff(java.lang.Iterable<com.android.ahat.heapdump.FieldValue>, java.lang.Iterable<com.android.ahat.heapdump.FieldValue>);
+ }
+
+ public abstract interface Diffable<T> {
+ method public abstract T getBaseline();
+ method public abstract boolean isPlaceHolder();
+ }
+
+ public class DiffedFieldValue {
+ method public static com.android.ahat.heapdump.DiffedFieldValue added(com.android.ahat.heapdump.FieldValue);
+ method public static com.android.ahat.heapdump.DiffedFieldValue deleted(com.android.ahat.heapdump.FieldValue);
+ method public static com.android.ahat.heapdump.DiffedFieldValue matched(com.android.ahat.heapdump.FieldValue, com.android.ahat.heapdump.FieldValue);
+ field public final com.android.ahat.heapdump.Value baseline;
+ field public final com.android.ahat.heapdump.Value current;
+ field public final java.lang.String name;
+ field public final com.android.ahat.heapdump.DiffedFieldValue.Status status;
+ field public final com.android.ahat.heapdump.Type type;
+ }
+
+ public static final class DiffedFieldValue.Status extends java.lang.Enum {
+ method public static com.android.ahat.heapdump.DiffedFieldValue.Status valueOf(java.lang.String);
+ method public static final com.android.ahat.heapdump.DiffedFieldValue.Status[] values();
+ enum_constant public static final com.android.ahat.heapdump.DiffedFieldValue.Status ADDED;
+ enum_constant public static final com.android.ahat.heapdump.DiffedFieldValue.Status DELETED;
+ enum_constant public static final com.android.ahat.heapdump.DiffedFieldValue.Status MATCHED;
+ }
+
+ public class Field {
+ ctor public Field(java.lang.String, com.android.ahat.heapdump.Type);
+ field public final java.lang.String name;
+ field public final com.android.ahat.heapdump.Type type;
+ }
+
+ public class FieldValue {
+ ctor public FieldValue(java.lang.String, com.android.ahat.heapdump.Type, com.android.ahat.heapdump.Value);
+ field public final java.lang.String name;
+ field public final com.android.ahat.heapdump.Type type;
+ field public final com.android.ahat.heapdump.Value value;
+ }
+
+ public class HprofFormatException extends java.lang.Exception {
+ }
+
+ public class Parser {
+ ctor public Parser();
+ method public static com.android.ahat.heapdump.AhatSnapshot parseHeapDump(java.io.File, com.android.ahat.proguard.ProguardMap) throws com.android.ahat.heapdump.HprofFormatException, java.io.IOException;
+ method public static com.android.ahat.heapdump.AhatSnapshot parseHeapDump(java.nio.ByteBuffer, com.android.ahat.proguard.ProguardMap) throws com.android.ahat.heapdump.HprofFormatException, java.io.IOException;
+ }
+
+ public class PathElement implements com.android.ahat.heapdump.Diffable {
+ ctor public PathElement(com.android.ahat.heapdump.AhatInstance, java.lang.String);
+ method public com.android.ahat.heapdump.PathElement getBaseline();
+ method public boolean isPlaceHolder();
+ field public final java.lang.String field;
+ field public final com.android.ahat.heapdump.AhatInstance instance;
+ field public boolean isDominator;
+ }
+
+ public final class RootType extends java.lang.Enum {
+ method public static com.android.ahat.heapdump.RootType valueOf(java.lang.String);
+ method public static final com.android.ahat.heapdump.RootType[] values();
+ enum_constant public static final com.android.ahat.heapdump.RootType DEBUGGER;
+ enum_constant public static final com.android.ahat.heapdump.RootType FINALIZING;
+ enum_constant public static final com.android.ahat.heapdump.RootType INTERNED_STRING;
+ enum_constant public static final com.android.ahat.heapdump.RootType JAVA_FRAME;
+ enum_constant public static final com.android.ahat.heapdump.RootType JNI_GLOBAL;
+ enum_constant public static final com.android.ahat.heapdump.RootType JNI_LOCAL;
+ enum_constant public static final com.android.ahat.heapdump.RootType JNI_MONITOR;
+ enum_constant public static final com.android.ahat.heapdump.RootType MONITOR;
+ enum_constant public static final com.android.ahat.heapdump.RootType NATIVE_STACK;
+ enum_constant public static final com.android.ahat.heapdump.RootType STICKY_CLASS;
+ enum_constant public static final com.android.ahat.heapdump.RootType THREAD;
+ enum_constant public static final com.android.ahat.heapdump.RootType THREAD_BLOCK;
+ enum_constant public static final com.android.ahat.heapdump.RootType UNKNOWN;
+ enum_constant public static final com.android.ahat.heapdump.RootType VM_INTERNAL;
+ }
+
+ public class Site implements com.android.ahat.heapdump.Diffable {
+ method public com.android.ahat.heapdump.Site findSite(long);
+ method public com.android.ahat.heapdump.Site getBaseline();
+ method public java.util.List<com.android.ahat.heapdump.Site> getChildren();
+ method public java.lang.String getFilename();
+ method public long getId();
+ method public int getLineNumber();
+ method public java.lang.String getMethodName();
+ method public void getObjects(java.lang.String, java.lang.String, java.util.Collection<com.android.ahat.heapdump.AhatInstance>);
+ method public java.util.List<com.android.ahat.heapdump.Site.ObjectsInfo> getObjectsInfos();
+ method public com.android.ahat.heapdump.Site getParent();
+ method public java.lang.String getSignature();
+ method public com.android.ahat.heapdump.Size getSize(com.android.ahat.heapdump.AhatHeap);
+ method public com.android.ahat.heapdump.Size getTotalSize();
+ method public boolean isPlaceHolder();
+ }
+
+ public static class Site.ObjectsInfo implements com.android.ahat.heapdump.Diffable {
+ ctor public Site.ObjectsInfo(com.android.ahat.heapdump.AhatHeap, com.android.ahat.heapdump.AhatClassObj);
+ method public com.android.ahat.heapdump.Site.ObjectsInfo getBaseline();
+ method public java.lang.String getClassName();
+ method public boolean isPlaceHolder();
+ method public void setBaseline(com.android.ahat.heapdump.Site.ObjectsInfo);
+ field public com.android.ahat.heapdump.AhatClassObj classObj;
+ field public com.android.ahat.heapdump.AhatHeap heap;
+ field public com.android.ahat.heapdump.Size numBytes;
+ field public long numInstances;
+ }
+
+ public class Size {
+ ctor public Size(long, long);
+ method public long getJavaSize();
+ method public long getRegisteredNativeSize();
+ method public long getSize();
+ method public boolean isZero();
+ method public com.android.ahat.heapdump.Size plus(com.android.ahat.heapdump.Size);
+ method public com.android.ahat.heapdump.Size plusRegisteredNativeSize(long);
+ field public static com.android.ahat.heapdump.Size ZERO;
+ }
+
+ public class Sort {
+ ctor public Sort();
+ method public static java.util.Comparator<com.android.ahat.heapdump.AhatInstance> defaultInstanceCompare(com.android.ahat.heapdump.AhatSnapshot);
+ method public static java.util.Comparator<com.android.ahat.heapdump.Site> defaultSiteCompare(com.android.ahat.heapdump.AhatSnapshot);
+ field public static final java.util.Comparator<com.android.ahat.heapdump.FieldValue> FIELD_VALUE_BY_NAME;
+ field public static final java.util.Comparator<com.android.ahat.heapdump.FieldValue> FIELD_VALUE_BY_TYPE;
+ field public static final java.util.Comparator<com.android.ahat.heapdump.AhatInstance> INSTANCE_BY_TOTAL_RETAINED_SIZE;
+ field public static final java.util.Comparator<com.android.ahat.heapdump.Site.ObjectsInfo> OBJECTS_INFO_BY_CLASS_NAME;
+ field public static final java.util.Comparator<com.android.ahat.heapdump.Site.ObjectsInfo> OBJECTS_INFO_BY_HEAP_NAME;
+ field public static final java.util.Comparator<com.android.ahat.heapdump.Site.ObjectsInfo> OBJECTS_INFO_BY_SIZE;
+ field public static final java.util.Comparator<com.android.ahat.heapdump.Site> SITE_BY_TOTAL_SIZE;
+ field public static final java.util.Comparator<com.android.ahat.heapdump.Size> SIZE_BY_SIZE;
+ }
+
+ public static class Sort.InstanceByHeapRetainedSize implements java.util.Comparator {
+ ctor public Sort.InstanceByHeapRetainedSize(com.android.ahat.heapdump.AhatHeap);
+ method public int compare(com.android.ahat.heapdump.AhatInstance, com.android.ahat.heapdump.AhatInstance);
+ }
+
+ public static class Sort.SiteByHeapSize implements java.util.Comparator {
+ ctor public Sort.SiteByHeapSize(com.android.ahat.heapdump.AhatHeap);
+ method public int compare(com.android.ahat.heapdump.Site, com.android.ahat.heapdump.Site);
+ }
+
+ public static class Sort.WithPriority<T> implements java.util.Comparator {
+ ctor public Sort.WithPriority(java.util.Comparator<T>...);
+ ctor public Sort.WithPriority(java.util.List<java.util.Comparator<T>>);
+ method public int compare(T, T);
+ }
+
+ public final class Type extends java.lang.Enum {
+ method public static com.android.ahat.heapdump.Type valueOf(java.lang.String);
+ method public static final com.android.ahat.heapdump.Type[] values();
+ enum_constant public static final com.android.ahat.heapdump.Type BOOLEAN;
+ enum_constant public static final com.android.ahat.heapdump.Type BYTE;
+ enum_constant public static final com.android.ahat.heapdump.Type CHAR;
+ enum_constant public static final com.android.ahat.heapdump.Type DOUBLE;
+ enum_constant public static final com.android.ahat.heapdump.Type FLOAT;
+ enum_constant public static final com.android.ahat.heapdump.Type INT;
+ enum_constant public static final com.android.ahat.heapdump.Type LONG;
+ enum_constant public static final com.android.ahat.heapdump.Type OBJECT;
+ enum_constant public static final com.android.ahat.heapdump.Type SHORT;
+ field public final java.lang.String name;
+ }
+
+ public abstract class Value {
+ ctor public Value();
+ method public com.android.ahat.heapdump.AhatInstance asAhatInstance();
+ method public java.lang.Byte asByte();
+ method public java.lang.Character asChar();
+ method public java.lang.Integer asInteger();
+ method public java.lang.Long asLong();
+ method public abstract boolean equals(java.lang.Object);
+ method public com.android.ahat.heapdump.Value getBaseline();
+ method public static com.android.ahat.heapdump.Value getBaseline(com.android.ahat.heapdump.Value);
+ method public static com.android.ahat.heapdump.Type getType(com.android.ahat.heapdump.Value);
+ method public boolean isAhatInstance();
+ method public boolean isInteger();
+ method public boolean isLong();
+ method public static com.android.ahat.heapdump.Value pack(com.android.ahat.heapdump.AhatInstance);
+ method public static com.android.ahat.heapdump.Value pack(boolean);
+ method public static com.android.ahat.heapdump.Value pack(char);
+ method public static com.android.ahat.heapdump.Value pack(float);
+ method public static com.android.ahat.heapdump.Value pack(double);
+ method public static com.android.ahat.heapdump.Value pack(byte);
+ method public static com.android.ahat.heapdump.Value pack(short);
+ method public static com.android.ahat.heapdump.Value pack(int);
+ method public static com.android.ahat.heapdump.Value pack(long);
+ method public abstract java.lang.String toString();
+ }
+
+}
+
+package com.android.ahat.proguard {
+
+ public class ProguardMap {
+ ctor public ProguardMap();
+ method public java.lang.String getClassName(java.lang.String);
+ method public java.lang.String getFieldName(java.lang.String, java.lang.String);
+ method public com.android.ahat.proguard.ProguardMap.Frame getFrame(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int);
+ method public void readFromFile(java.io.File) throws java.io.FileNotFoundException, java.io.IOException, java.text.ParseException;
+ method public void readFromReader(java.io.Reader) throws java.io.IOException, java.text.ParseException;
+ }
+
+ public static class ProguardMap.Frame {
+ field public final java.lang.String filename;
+ field public final int line;
+ field public final java.lang.String method;
+ field public final java.lang.String signature;
+ }
+
+}
+
diff --git a/tools/ahat/etc/ahat_api_msg.txt b/tools/ahat/etc/ahat_api_msg.txt
new file mode 100644
index 0000000..d0d0468
--- /dev/null
+++ b/tools/ahat/etc/ahat_api_msg.txt
@@ -0,0 +1,5 @@
+The public API for ahat.jar has changed.
+
+Please verify whether this change to the API is intentional and
+whether it may break any current users of the API. If the API change
+is intentional, run 'm ahat-update-api' to update the recorded API.
diff --git a/tools/ahat/etc/ahat_removed_api.txt b/tools/ahat/etc/ahat_removed_api.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/ahat/etc/ahat_removed_api.txt
diff --git a/tools/ahat/src/main/com/android/ahat/HtmlDoc.java b/tools/ahat/src/main/com/android/ahat/HtmlDoc.java
index 5a22fc7..d5106dc 100644
--- a/tools/ahat/src/main/com/android/ahat/HtmlDoc.java
+++ b/tools/ahat/src/main/com/android/ahat/HtmlDoc.java
@@ -23,7 +23,7 @@
/**
* An Html implementation of Doc.
*/
-public class HtmlDoc implements Doc {
+class HtmlDoc implements Doc {
private PrintStream ps;
private Column[] mCurrentTableColumns;
diff --git a/tools/ahat/src/main/com/android/ahat/HtmlEscaper.java b/tools/ahat/src/main/com/android/ahat/HtmlEscaper.java
index 75a6827..06ffca2 100644
--- a/tools/ahat/src/main/com/android/ahat/HtmlEscaper.java
+++ b/tools/ahat/src/main/com/android/ahat/HtmlEscaper.java
@@ -16,7 +16,7 @@
package com.android.ahat;
-public class HtmlEscaper {
+class HtmlEscaper {
/**
* Escape html characters in the input string.
*/
diff --git a/tools/ahat/src/main/com/android/ahat/Main.java b/tools/ahat/src/main/com/android/ahat/Main.java
index a0fbf77..048573e 100644
--- a/tools/ahat/src/main/com/android/ahat/Main.java
+++ b/tools/ahat/src/main/com/android/ahat/Main.java
@@ -31,8 +31,10 @@
import java.util.concurrent.Executors;
public class Main {
+ private Main() {
+ }
- public static void help(PrintStream out) {
+ private static void help(PrintStream out) {
out.println("java -jar ahat.jar [OPTIONS] FILE");
out.println(" Launch an http server for viewing the given Android heap dump FILE.");
out.println("");
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/AhatArrayInstance.java b/tools/ahat/src/main/com/android/ahat/heapdump/AhatArrayInstance.java
index 50a4805..ccdd6e4 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/AhatArrayInstance.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/AhatArrayInstance.java
@@ -34,7 +34,7 @@
private byte[] mByteArray; // null if not a byte array.
private char[] mCharArray; // null if not a char array.
- public AhatArrayInstance(long id) {
+ AhatArrayInstance(long id) {
super(id);
}
@@ -176,7 +176,7 @@
}
@Override
- protected long getExtraJavaSize() {
+ long getExtraJavaSize() {
int length = getLength();
if (length == 0) {
return 0;
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/AhatClassInstance.java b/tools/ahat/src/main/com/android/ahat/heapdump/AhatClassInstance.java
index 94efa50..cb9d959 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/AhatClassInstance.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/AhatClassInstance.java
@@ -27,7 +27,7 @@
// the field types and names to save memory.
private Value[] mFields;
- public AhatClassInstance(long id) {
+ AhatClassInstance(long id) {
super(id);
}
@@ -36,7 +36,7 @@
}
@Override
- protected long getExtraJavaSize() {
+ long getExtraJavaSize() {
return 0;
}
@@ -244,7 +244,7 @@
}
@Override
- public RegisteredNativeAllocation asRegisteredNativeAllocation() {
+ RegisteredNativeAllocation asRegisteredNativeAllocation() {
if (!isInstanceOfClass("sun.misc.Cleaner")) {
return null;
}
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/AhatClassObj.java b/tools/ahat/src/main/com/android/ahat/heapdump/AhatClassObj.java
index be0f713..3babf76 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/AhatClassObj.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/AhatClassObj.java
@@ -29,7 +29,7 @@
private long mStaticFieldsSize;
private long mInstanceSize;
- public AhatClassObj(long id, String className) {
+ AhatClassObj(long id, String className) {
super(id);
mClassName = className;
}
@@ -50,7 +50,7 @@
}
@Override
- protected long getExtraJavaSize() {
+ long getExtraJavaSize() {
return mStaticFieldsSize;
}
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/AhatField.java b/tools/ahat/src/main/com/android/ahat/heapdump/AhatField.java
deleted file mode 100644
index a25ee28..0000000
--- a/tools/ahat/src/main/com/android/ahat/heapdump/AhatField.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.ahat.heapdump;
-
-public class AhatField {
- private final String mName;
- private final String mType;
-
- public AhatField(String name, String type) {
- mName = name;
- mType = type;
- }
-
- /**
- * Returns the name of the field.
- */
- public String getName() {
- return mName;
- }
-
- /**
- * Returns a description of the type of the field.
- */
- public String getType() {
- return mType;
- }
-}
-
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/AhatInstance.java b/tools/ahat/src/main/com/android/ahat/heapdump/AhatInstance.java
index 1a3d127..a9f819f 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/AhatInstance.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/AhatInstance.java
@@ -64,7 +64,7 @@
// 2. During dominators computation, to store the dominators computation state.
private Object mTemporaryUserData;
- public AhatInstance(long id) {
+ AhatInstance(long id) {
mId = id;
mBaseline = this;
}
@@ -101,7 +101,7 @@
* For example, class objects will have extra size for static fields and
* array objects will have extra size for the array elements.
*/
- protected abstract long getExtraJavaSize();
+ abstract long getExtraJavaSize();
/**
* Returns the number of bytes belonging to the given heap that this instance
@@ -388,7 +388,7 @@
return null;
}
- public static class RegisteredNativeAllocation {
+ static class RegisteredNativeAllocation {
public AhatInstance referent;
public long size;
};
@@ -397,7 +397,7 @@
* Return the registered native allocation that this instance represents, if
* any. This is relevant for instances of sun.misc.Cleaner.
*/
- public RegisteredNativeAllocation asRegisteredNativeAllocation() {
+ RegisteredNativeAllocation asRegisteredNativeAllocation() {
return null;
}
@@ -451,7 +451,7 @@
return null;
}
- public void setBaseline(AhatInstance baseline) {
+ void setBaseline(AhatInstance baseline) {
mBaseline = baseline;
}
@@ -470,11 +470,11 @@
return new AhatPlaceHolderInstance(this);
}
- public void setTemporaryUserData(Object state) {
+ void setTemporaryUserData(Object state) {
mTemporaryUserData = state;
}
- public Object getTemporaryUserData() {
+ Object getTemporaryUserData() {
return mTemporaryUserData;
}
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/AhatPlaceHolderClassObj.java b/tools/ahat/src/main/com/android/ahat/heapdump/AhatPlaceHolderClassObj.java
index 07f5b50..b8cdbdd 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/AhatPlaceHolderClassObj.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/AhatPlaceHolderClassObj.java
@@ -22,7 +22,7 @@
*
* This should be created through a call to newPlaceHolder();
*/
-public class AhatPlaceHolderClassObj extends AhatClassObj {
+class AhatPlaceHolderClassObj extends AhatClassObj {
AhatPlaceHolderClassObj(AhatClassObj baseline) {
super(-1, baseline.getClassName());
setBaseline(baseline);
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/AhatPlaceHolderInstance.java b/tools/ahat/src/main/com/android/ahat/heapdump/AhatPlaceHolderInstance.java
index 8849403..d656425 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/AhatPlaceHolderInstance.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/AhatPlaceHolderInstance.java
@@ -25,7 +25,7 @@
*
* This should be created through a call to AhatInstance.newPlaceHolder();
*/
-public class AhatPlaceHolderInstance extends AhatInstance {
+class AhatPlaceHolderInstance extends AhatInstance {
AhatPlaceHolderInstance(AhatInstance baseline) {
super(-1);
setBaseline(baseline);
@@ -36,7 +36,7 @@
return Size.ZERO;
}
- @Override protected long getExtraJavaSize() {
+ @Override long getExtraJavaSize() {
return 0;
}
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/AhatSnapshot.java b/tools/ahat/src/main/com/android/ahat/heapdump/AhatSnapshot.java
index 945966c..59ce5d1 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/AhatSnapshot.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/AhatSnapshot.java
@@ -122,7 +122,7 @@
return site == null ? mRootSite : site;
}
- public void setBaseline(AhatSnapshot baseline) {
+ void setBaseline(AhatSnapshot baseline) {
mBaseline = baseline;
}
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/HprofFormatException.java b/tools/ahat/src/main/com/android/ahat/heapdump/HprofFormatException.java
index 0e128cd..256a3b4 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/HprofFormatException.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/HprofFormatException.java
@@ -17,11 +17,11 @@
package com.android.ahat.heapdump;
public class HprofFormatException extends Exception {
- public HprofFormatException(String msg) {
+ HprofFormatException(String msg) {
super(msg);
}
- public HprofFormatException(String msg, Exception cause) {
+ HprofFormatException(String msg, Exception cause) {
super(msg, cause);
}
}
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/Parser.java b/tools/ahat/src/main/com/android/ahat/heapdump/Parser.java
index 756b7d2..d7b1dd7 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/Parser.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/Parser.java
@@ -630,7 +630,7 @@
}
@Override
- protected Type getType() {
+ Type getType() {
return Type.OBJECT;
}
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/Reference.java b/tools/ahat/src/main/com/android/ahat/heapdump/Reference.java
index 980f278..f1340bd 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/Reference.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/Reference.java
@@ -23,7 +23,7 @@
* 'strong' is true if this is a strong reference, false if it is a
* weak/soft/other reference.
*/
-public class Reference {
+class Reference {
public final AhatInstance src;
public final String field;
public final AhatInstance ref;
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/RootType.java b/tools/ahat/src/main/com/android/ahat/heapdump/RootType.java
index af552ea..734f889 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/RootType.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/RootType.java
@@ -32,7 +32,7 @@
JNI_MONITOR (1 << 12),
FINALIZING (1 << 13);
- public final int mask;
+ final int mask;
RootType(int mask) {
this.mask = mask;
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/Site.java b/tools/ahat/src/main/com/android/ahat/heapdump/Site.java
index 523550a..4978d52 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/Site.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/Site.java
@@ -103,7 +103,7 @@
/**
* Construct a root site.
*/
- public Site(String name) {
+ Site(String name) {
this(null, name, "", "", 0);
}
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/SuperRoot.java b/tools/ahat/src/main/com/android/ahat/heapdump/SuperRoot.java
index 5210e31..b01cfff 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/SuperRoot.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/SuperRoot.java
@@ -21,20 +21,20 @@
import java.util.ArrayList;
import java.util.List;
-public class SuperRoot extends AhatInstance implements DominatorsComputation.Node {
+class SuperRoot extends AhatInstance implements DominatorsComputation.Node {
private List<AhatInstance> mRoots = new ArrayList<AhatInstance>();
private Object mDominatorsComputationState;
- public SuperRoot() {
+ SuperRoot() {
super(0);
}
- public void addRoot(AhatInstance root) {
+ void addRoot(AhatInstance root) {
mRoots.add(root);
}
@Override
- protected long getExtraJavaSize() {
+ long getExtraJavaSize() {
return 0;
}
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/Type.java b/tools/ahat/src/main/com/android/ahat/heapdump/Type.java
index 726bc47..4024961 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/Type.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/Type.java
@@ -28,7 +28,7 @@
LONG("long", 8);
public final String name;
- public final int size;
+ final int size;
Type(String name, int size) {
this.name = name;
diff --git a/tools/ahat/src/main/com/android/ahat/heapdump/Value.java b/tools/ahat/src/main/com/android/ahat/heapdump/Value.java
index 01fd250..eea4277 100644
--- a/tools/ahat/src/main/com/android/ahat/heapdump/Value.java
+++ b/tools/ahat/src/main/com/android/ahat/heapdump/Value.java
@@ -67,7 +67,7 @@
/**
* Return the type of the given value.
*/
- protected abstract Type getType();
+ abstract Type getType();
/**
* Returns true if the Value is an AhatInstance, as opposed to a Java
@@ -153,7 +153,7 @@
}
@Override
- protected Type getType() {
+ Type getType() {
return Type.BOOLEAN;
}
@@ -184,7 +184,7 @@
}
@Override
- protected Type getType() {
+ Type getType() {
return Type.BYTE;
}
@@ -215,7 +215,7 @@
}
@Override
- protected Type getType() {
+ Type getType() {
return Type.CHAR;
}
@@ -241,7 +241,7 @@
}
@Override
- protected Type getType() {
+ Type getType() {
return Type.DOUBLE;
}
@@ -267,7 +267,7 @@
}
@Override
- protected Type getType() {
+ Type getType() {
return Type.FLOAT;
}
@@ -304,7 +304,7 @@
}
@Override
- protected Type getType() {
+ Type getType() {
return Type.OBJECT;
}
@@ -345,7 +345,7 @@
}
@Override
- protected Type getType() {
+ Type getType() {
return Type.INT;
}
@@ -381,7 +381,7 @@
}
@Override
- protected Type getType() {
+ Type getType() {
return Type.LONG;
}
@@ -407,7 +407,7 @@
}
@Override
- protected Type getType() {
+ Type getType() {
return Type.SHORT;
}
diff --git a/tools/ahat/src/main/com/android/ahat/proguard/ProguardMap.java b/tools/ahat/src/main/com/android/ahat/proguard/ProguardMap.java
index 50c110a..131bbf3 100644
--- a/tools/ahat/src/main/com/android/ahat/proguard/ProguardMap.java
+++ b/tools/ahat/src/main/com/android/ahat/proguard/ProguardMap.java
@@ -101,7 +101,7 @@
private Map<String, ClassData> mClassesFromObfuscatedName = new HashMap<String, ClassData>();
public static class Frame {
- public Frame(String method, String signature, String filename, int line) {
+ Frame(String method, String signature, String filename, int line) {
this.method = method;
this.signature = signature;
this.filename = filename;