Commit 38b443b6 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

ProGuard: Move -checkdiscard for Log.* into @RemovableInRelease annotation

Strictly a refecator to cut down on number of explicit rules.

Change-Id: I3afad5ccd63d2347c69343df15014118780f512e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1711978
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarSam Maier <smaier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#679849}
parent be46bbc9
...@@ -87,6 +87,7 @@ public class Log { ...@@ -87,6 +87,7 @@ public class Log {
* Note: Has no effect on whether logs are sent or not. Use a method with * Note: Has no effect on whether logs are sent or not. Use a method with
* {@link RemovableInRelease} to log something in Debug builds only. * {@link RemovableInRelease} to log something in Debug builds only.
*/ */
@RemovableInRelease
public static boolean isLoggable(String tag, int level) { public static boolean isLoggable(String tag, int level) {
return android.util.Log.isLoggable(tag, level); return android.util.Log.isLoggable(tag, level);
} }
...@@ -105,6 +106,7 @@ public class Log { ...@@ -105,6 +106,7 @@ public class Log {
* @param args Arguments referenced by the format specifiers in the format string. If the last * @param args Arguments referenced by the format specifiers in the format string. If the last
* one is a {@link Throwable}, its trace will be printed. * one is a {@link Throwable}, its trace will be printed.
*/ */
@RemovableInRelease
private static void verbose(String tag, String messageTemplate, Object... args) { private static void verbose(String tag, String messageTemplate, Object... args) {
String message = formatLogWithStack(messageTemplate, args); String message = formatLogWithStack(messageTemplate, args);
Throwable tr = getThrowableToLog(args); Throwable tr = getThrowableToLog(args);
...@@ -190,6 +192,7 @@ public class Log { ...@@ -190,6 +192,7 @@ public class Log {
* @param args Arguments referenced by the format specifiers in the format string. If the last * @param args Arguments referenced by the format specifiers in the format string. If the last
* one is a {@link Throwable}, its trace will be printed. * one is a {@link Throwable}, its trace will be printed.
*/ */
@RemovableInRelease
private static void debug(String tag, String messageTemplate, Object... args) { private static void debug(String tag, String messageTemplate, Object... args) {
String message = formatLogWithStack(messageTemplate, args); String message = formatLogWithStack(messageTemplate, args);
Throwable tr = getThrowableToLog(args); Throwable tr = getThrowableToLog(args);
...@@ -362,6 +365,7 @@ public class Log { ...@@ -362,6 +365,7 @@ public class Log {
} }
/** Returns a string form of the origin of the log call, to be used as secondary tag.*/ /** Returns a string form of the origin of the log call, to be used as secondary tag.*/
@RemovableInRelease
private static String getCallOrigin() { private static String getCallOrigin() {
StackTraceElement[] st = Thread.currentThread().getStackTrace(); StackTraceElement[] st = Thread.currentThread().getStackTrace();
......
...@@ -48,13 +48,6 @@ ...@@ -48,13 +48,6 @@
static *** v(...); static *** v(...);
static *** isLoggable(...); static *** isLoggable(...);
} }
-checkdiscard class org.chromium.base.Log {
public static void d(...);
public static void v(...);
private static void debug(...);
private static void verbose(...);
private static String getCallOrigin(...);
}
# The following chart was created on July 20, 2016, to decide on 3 optimization # The following chart was created on July 20, 2016, to decide on 3 optimization
# passes for Chrome. # passes for Chrome.
......
...@@ -42,10 +42,15 @@ ...@@ -42,10 +42,15 @@
native <methods>; native <methods>;
} }
# Remove methods annotated with this if their return value is unused. # Remove methods with this annotation. Methods generally need to be void, or
# have unused return values in order to be removed. Compiles will fail if any
# such method was not able to be safely removed.
-assumenosideeffects class ** { -assumenosideeffects class ** {
@org.chromium.base.annotations.RemovableInRelease <methods>; @org.chromium.base.annotations.RemovableInRelease <methods>;
} }
-checkdiscard class ** {
@org.chromium.base.annotations.RemovableInRelease <methods>;
}
# Never inline classes or methods with this annotation, but allow shrinking and # Never inline classes or methods with this annotation, but allow shrinking and
# obfuscation. # obfuscation.
......
...@@ -137,13 +137,6 @@ ...@@ -137,13 +137,6 @@
static *** v(...); static *** v(...);
static *** isLoggable(...); static *** isLoggable(...);
} }
-checkdiscard class org.chromium.base.Log {
public static void d(...);
public static void v(...);
private static void debug(...);
private static void verbose(...);
private static String getCallOrigin(...);
}
# The following chart was created on July 20, 2016, to decide on 3 optimization # The following chart was created on July 20, 2016, to decide on 3 optimization
# passes for Chrome. # passes for Chrome.
...@@ -215,10 +208,15 @@ ...@@ -215,10 +208,15 @@
native <methods>; native <methods>;
} }
# Remove methods annotated with this if their return value is unused. # Remove methods with this annotation. Methods generally need to be void, or
# have unused return values in order to be removed. Compiles will fail if any
# such method was not able to be safely removed.
-assumenosideeffects class ** { -assumenosideeffects class ** {
@org.chromium.base.annotations.RemovableInRelease <methods>; @org.chromium.base.annotations.RemovableInRelease <methods>;
} }
-checkdiscard class ** {
@org.chromium.base.annotations.RemovableInRelease <methods>;
}
# Never inline classes or methods with this annotation, but allow shrinking and # Never inline classes or methods with this annotation, but allow shrinking and
# obfuscation. # obfuscation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment