From 7680d51b0928a31c7d370d4a92c872f0fb104df4 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Fri, 3 Jan 2025 12:44:53 +0100 Subject: [PATCH 1/2] Rename .java to .kt Signed-off-by: Marcel Hibbe --- app/src/test/java/android/util/{Log.java => Log.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app/src/test/java/android/util/{Log.java => Log.kt} (100%) diff --git a/app/src/test/java/android/util/Log.java b/app/src/test/java/android/util/Log.kt similarity index 100% rename from app/src/test/java/android/util/Log.java rename to app/src/test/java/android/util/Log.kt From 3874751fcb58c78eb107799c70a10de88b5391aa Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Fri, 3 Jan 2025 12:44:56 +0100 Subject: [PATCH 2/2] convert Log class to kotlin @JvmStatic is necessary to keep the static behavior of the method calls Signed-off-by: Marcel Hibbe --- app/src/test/java/android/util/Log.kt | 47 +++++++++++++++------------ 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/app/src/test/java/android/util/Log.kt b/app/src/test/java/android/util/Log.kt index 7090f73cd..eee2147ad 100644 --- a/app/src/test/java/android/util/Log.kt +++ b/app/src/test/java/android/util/Log.kt @@ -4,48 +4,55 @@ * SPDX-FileCopyrightText: 2024 Daniel Calviño Sánchez * SPDX-License-Identifier: GPL-3.0-or-later */ -package android.util; +package android.util /** * Dummy implementation of android.util.Log to be used in unit tests. - *

+ * + * * The Android Gradle plugin provides a library with the APIs of the Android framework that throws an exception if any * of them are called. This class is loaded before that library and therefore becomes the implementation used during the * tests, simply printing the messages to the system console. */ -public class Log { +object Log { - public static int d(String tag, String msg) { - System.out.println("DEBUG: " + tag + ": " + msg); + @JvmStatic + fun d(tag: String, msg: String): Int { + println("DEBUG: $tag: $msg") - return 1; + return 1 } - public static int e(String tag, String msg) { - System.out.println("ERROR: " + tag + ": " + msg); + @JvmStatic + fun e(tag: String, msg: String): Int { + println("ERROR: $tag: $msg") - return 1; + return 1 } - public static int i(String tag, String msg) { - System.out.println("INFO: " + tag + ": " + msg); + @JvmStatic + fun i(tag: String, msg: String): Int { + println("INFO: $tag: $msg") - return 1; + return 1 } - public static boolean isLoggable(String tag, int level) { - return true; + @JvmStatic + fun isLoggable(tag: String?, level: Int): Boolean { + return true } - public static int v(String tag, String msg) { - System.out.println("VERBOSE: " + tag + ": " + msg); + @JvmStatic + fun v(tag: String, msg: String): Int { + println("VERBOSE: $tag: $msg") - return 1; + return 1 } - public static int w(String tag, String msg) { - System.out.println("WARN: " + tag + ": " + msg); + @JvmStatic + fun w(tag: String, msg: String): Int { + println("WARN: $tag: $msg") - return 1; + return 1 } }