DEADSOFTWARE

Remove guava
authorfredboy <fredboy@protonmail.com>
Wed, 22 May 2024 13:03:32 +0000 (20:03 +0700)
committerfredboy <fredboy@protonmail.com>
Wed, 22 May 2024 13:03:32 +0000 (20:03 +0700)
21 files changed:
core/build.gradle
core/src/ru/deadsoftware/cavedroid/CaveGame.java
core/src/ru/deadsoftware/cavedroid/MainConfig.java
core/src/ru/deadsoftware/cavedroid/game/GameModule.java
core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java
core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java
core/src/ru/deadsoftware/cavedroid/game/GameScreen.java
core/src/ru/deadsoftware/cavedroid/game/mobs/Mob.java
core/src/ru/deadsoftware/cavedroid/game/mobs/package-info.java [deleted file]
core/src/ru/deadsoftware/cavedroid/game/mobs/player/Player.java
core/src/ru/deadsoftware/cavedroid/game/objects/container/Container.kt
core/src/ru/deadsoftware/cavedroid/game/objects/package-info.java [deleted file]
core/src/ru/deadsoftware/cavedroid/game/package-info.java [deleted file]
core/src/ru/deadsoftware/cavedroid/game/world/GameWorld.java
core/src/ru/deadsoftware/cavedroid/game/world/GameWorldGenerator.kt
core/src/ru/deadsoftware/cavedroid/menu/objects/package-info.java [deleted file]
core/src/ru/deadsoftware/cavedroid/menu/package-info.java [deleted file]
core/src/ru/deadsoftware/cavedroid/menu/submenus/package-info.java [deleted file]
core/src/ru/deadsoftware/cavedroid/misc/annotations/NonnullByDefault.java [deleted file]
core/src/ru/deadsoftware/cavedroid/misc/package-info.java [deleted file]
core/src/ru/deadsoftware/cavedroid/package-info.java [deleted file]

index ac46757aece221bb9eea06e31a2a7c99b5d44c08..bd932c35eec2bad922d71a23a6bb5e46ef337863 100644 (file)
@@ -17,7 +17,6 @@ dependencies {
     ksp "ru.fredboy:automultibind-ksp:1.0.0"
 
     api "com.badlogicgames.gdx:gdx:$gdxVersion"
-    api "com.google.guava:guava:$guavaVersion-android"
     api "com.google.dagger:dagger:$daggerVersion"
     implementation 'org.jetbrains:annotations:23.1.0'
     implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
index 9ca34b8e0507a5a42523accf769469847185661a..219f5b4a90f57c5c829e08aa1b893d7d2152a121 100644 (file)
@@ -3,14 +3,12 @@ package ru.deadsoftware.cavedroid;
 import com.badlogic.gdx.Application;
 import com.badlogic.gdx.Game;
 import com.badlogic.gdx.Gdx;
-import com.badlogic.gdx.Graphics;
+import org.jetbrains.annotations.Nullable;
 import ru.deadsoftware.cavedroid.game.GameScreen;
 import ru.deadsoftware.cavedroid.misc.Assets;
 import ru.deadsoftware.cavedroid.misc.utils.AssetLoader;
 import ru.deadsoftware.cavedroid.prefs.PreferencesStore;
 
-import javax.annotation.Nullable;
-
 public class CaveGame extends Game {
 
     private static final String TAG = "CaveGame";
index 3ffb506285028aada2dd994cc104f772fc4ff59d..61cef0a3c858b356da7cdc7a6f850da6d86b2b02 100644 (file)
@@ -1,11 +1,10 @@
 package ru.deadsoftware.cavedroid;
 
+import org.jetbrains.annotations.Nullable;
 import ru.deadsoftware.cavedroid.game.GameUiWindow;
 import ru.deadsoftware.cavedroid.game.input.Joystick;
 import ru.deadsoftware.cavedroid.prefs.PreferencesStore;
 
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import java.util.HashMap;
@@ -15,16 +14,16 @@ public class MainConfig {
 
     private final HashMap<String, String> mPreferencesCache = new HashMap<>();
 
-    @CheckForNull
+    @Nullable
     private FullscreenToggleListener mFullscreenToggleListener = null;
 
     private final CaveGame mCaveGame;
     private final PreferencesStore mPreferencesStore;
 
-    @CheckForNull
+    @Nullable
     private MainComponent mMainComponent;
 
-    @CheckForNull
+    @Nullable
     private Joystick mJoystick;
 
     private GameUiWindow mGameUiWindow;
@@ -127,16 +126,16 @@ public class MainConfig {
         mAssetsPackPath = assetsPackPath;
     }
 
-    @CheckForNull
+    @Nullable
     public Joystick getJoystick() {
         return mJoystick;
     }
 
-    public void setJoystick(@CheckForNull Joystick joystick) {
+    public void setJoystick(@Nullable Joystick joystick) {
         mJoystick = joystick;
     }
 
-    @CheckForNull
+    @Nullable
     public String getPreference(String key) {
         if (mPreferencesCache.containsKey(key)) {
             return mPreferencesCache.get(key);
index 29aac7df7e0f42be5364e1df21a5327fe3888697..6c71d78c4fe7441f8ab3df12617ca2f013bf8019 100644 (file)
@@ -2,6 +2,7 @@ package ru.deadsoftware.cavedroid.game;
 
 import dagger.Module;
 import dagger.Provides;
+import org.jetbrains.annotations.Nullable;
 import ru.deadsoftware.cavedroid.MainConfig;
 import ru.deadsoftware.cavedroid.game.mobs.MobsController;
 import ru.deadsoftware.cavedroid.game.model.block.Block;
@@ -12,12 +13,10 @@ import ru.deadsoftware.cavedroid.game.save.GameSaveLoader;
 import ru.deadsoftware.cavedroid.game.ui.TooltipManager;
 import ru.deadsoftware.cavedroid.game.world.GameWorld;
 
-import javax.annotation.CheckForNull;
-
 @Module
 public class GameModule {
 
-    @CheckForNull
+    @Nullable
     private static GameSaveData data;
 
     public static boolean loaded = false;
index cece8e2c625ebe9e8823f9a5b347f063e5485e4b..406ee346b461859f3d436d82ab8f155cf286c8ee 100644 (file)
@@ -4,6 +4,7 @@ import com.badlogic.gdx.math.Intersector;
 import com.badlogic.gdx.math.MathUtils;
 import com.badlogic.gdx.math.Rectangle;
 import com.badlogic.gdx.math.Vector2;
+import org.jetbrains.annotations.Nullable;
 import ru.deadsoftware.cavedroid.MainConfig;
 import ru.deadsoftware.cavedroid.game.mobs.Mob;
 import ru.deadsoftware.cavedroid.game.mobs.MobsController;
@@ -14,7 +15,6 @@ import ru.deadsoftware.cavedroid.game.objects.drop.Drop;
 import ru.deadsoftware.cavedroid.game.objects.drop.DropController;
 import ru.deadsoftware.cavedroid.game.world.GameWorld;
 
-import javax.annotation.CheckForNull;
 import javax.inject.Inject;
 import java.util.Iterator;
 
@@ -68,7 +68,7 @@ public class GamePhysics {
     /**
      * @return colliding rect or null if no collision
      */
-    @CheckForNull
+    @Nullable
     private Rectangle checkColl(Rectangle rect) {
         int minX = (int) ((rect.x + rect.width / 2) / 16) - 4;
         int minY = (int) ((rect.y + rect.height / 2) / 16) - 4;
@@ -115,7 +115,7 @@ public class GamePhysics {
     /**
      * @return Rectangle representing magneting target for this drop
      */
-    @CheckForNull
+    @Nullable
     private Rectangle getShiftedMagnetingPlayerRect(Drop drop) {
         final Player player = mMobsController.getPlayer();
 
@@ -185,7 +185,7 @@ public class GamePhysics {
             return;
         }
 
-        @CheckForNull Rectangle collidingRect = checkColl(mob);
+        @Nullable Rectangle collidingRect = checkColl(mob);
 
         if (collidingRect != null) {
             if (mob.canJump() && !mob.isFlyMode() && collidingRect.y >= mob.y + mob.height - 8) {
@@ -225,7 +225,7 @@ public class GamePhysics {
     }
 
     private void mobYColl(Mob mob) {
-        @CheckForNull final Rectangle collidingRect = checkColl(mob);
+        @Nullable final Rectangle collidingRect = checkColl(mob);
         if (collidingRect != null) {
             int d = -1;
 
index 93dc8b95f233bd1abb8ac5e01c9efbece0498a30..e063e09af073cb21899d389e6613f7fae6bdcf34 100644 (file)
@@ -8,6 +8,7 @@ import com.badlogic.gdx.math.Rectangle;
 import com.badlogic.gdx.math.Vector2;
 import com.badlogic.gdx.utils.ObjectMap;
 import com.badlogic.gdx.utils.TimeUtils;
+import org.jetbrains.annotations.Nullable;
 import ru.deadsoftware.cavedroid.MainConfig;
 import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler;
 import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler;
@@ -30,7 +31,6 @@ import ru.deadsoftware.cavedroid.misc.Renderer;
 import ru.deadsoftware.cavedroid.misc.utils.MeasureUnitsUtilsKt;
 import ru.deadsoftware.cavedroid.misc.utils.RenderingUtilsKt;
 
-import javax.annotation.CheckForNull;
 import javax.inject.Inject;
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -223,7 +223,7 @@ public class GameRenderer extends Renderer {
         }
     }
 
-    private boolean handleMouseAction(@CheckForNull  MouseInputAction action) {
+    private boolean handleMouseAction(@Nullable MouseInputAction action) {
         if (action == null) {
             return false;
         }
@@ -243,7 +243,7 @@ public class GameRenderer extends Renderer {
     }
 
     private boolean onMouseActionEvent(int mouseX, int mouseY, int button, boolean touchUp, int pointer) {
-        @CheckForNull MouseInputAction action = mMouseInputActionMapper
+        @Nullable MouseInputAction action = mMouseInputActionMapper
                 .map((float) mouseX, (float) mouseY, getCameraViewport(), button, touchUp, pointer);
         return handleMouseAction(action);
     }
@@ -322,20 +322,20 @@ public class GameRenderer extends Renderer {
             return false;
         }
 
-        @CheckForNull MouseInputAction action =
+        @Nullable MouseInputAction action =
                 mMouseInputActionMapper.mapDragged(screenX, screenY, getCameraViewport(), pointer);
         return handleMouseAction(action);
     }
 
     @Override
     public boolean scrolled(float amountX, float amountY) {
-        @CheckForNull MouseInputAction action = mMouseInputActionMapper
+        @Nullable MouseInputAction action = mMouseInputActionMapper
                 .mapScrolled(Gdx.input.getX(), Gdx.input.getY(), amountX, amountY, getCameraViewport());
         return handleMouseAction(action);
     }
 
     private boolean handleKeyboardAction(int keycode, boolean isKeyDown) {
-        @CheckForNull final KeyboardInputAction action = mKeyboardInputActionMapper
+        @Nullable final KeyboardInputAction action = mKeyboardInputActionMapper
                 .map(keycode, isKeyDown);
 
         if (action == null) {
index 749d7d4055beeee9964e8f52cb7466188b093a1e..d7546e98ad60758261240dfbd661425e92f90bc6 100644 (file)
@@ -1,10 +1,9 @@
 package ru.deadsoftware.cavedroid.game;
 
-import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.Screen;
+import org.jetbrains.annotations.Nullable;
 import ru.deadsoftware.cavedroid.MainConfig;
 
-import javax.annotation.CheckForNull;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 
@@ -13,9 +12,9 @@ public class GameScreen implements Screen {
 
     private final MainConfig mMainConfig;
 
-    @CheckForNull
+    @Nullable
     private GameProc mGameProc;
-    @CheckForNull
+    @Nullable
     private GameItemsHolder mGameItemsHolder;
 
     @Inject
index 5d18755c590feb3ebbf9df3071cc96a32da8fa66..3ee37d37e626914cef7b41e55c151c42ec743c3b 100644 (file)
@@ -7,13 +7,13 @@ import com.badlogic.gdx.math.MathUtils;
 import com.badlogic.gdx.math.Rectangle;
 import com.badlogic.gdx.math.Vector2;
 import com.badlogic.gdx.utils.Timer;
+import org.jetbrains.annotations.Nullable;
 import ru.deadsoftware.cavedroid.game.GameItemsHolder;
 import ru.deadsoftware.cavedroid.game.model.dto.SaveDataDto;
 import ru.deadsoftware.cavedroid.game.model.item.InventoryItem;
 import ru.deadsoftware.cavedroid.game.world.GameWorld;
 import ru.deadsoftware.cavedroid.misc.Saveable;
 
-import javax.annotation.CheckForNull;
 import java.util.Collections;
 import java.util.List;
 
@@ -84,7 +84,9 @@ public abstract class Mob extends Rectangle implements  Saveable {
     protected int mHealth;
 
     private boolean mTakingDamage = false;
-    @CheckForNull private ResetTakeDamageTask mResetTakeDamageTask = null;
+
+    @Nullable
+    private ResetTakeDamageTask mResetTakeDamageTask = null;
 
     /**
      * @param x          in pixels
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/package-info.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/package-info.java
deleted file mode 100644 (file)
index e76bf1b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.game.mobs;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
index f454b0c4d05a978e3a88d4387710d7535905e718..9aa503f917a1daec0fa0d92482d7bf377b06cb32 100644 (file)
@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 import com.badlogic.gdx.math.MathUtils;
 import com.badlogic.gdx.math.Vector2;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 import ru.deadsoftware.cavedroid.game.GameItemsHolder;
 import ru.deadsoftware.cavedroid.game.mobs.Mob;
 import ru.deadsoftware.cavedroid.game.mobs.MobsController;
@@ -20,8 +21,6 @@ import ru.deadsoftware.cavedroid.misc.Assets;
 import ru.deadsoftware.cavedroid.misc.utils.SpriteOrigin;
 import ru.deadsoftware.cavedroid.misc.utils.SpriteUtilsKt;
 
-import javax.annotation.CheckForNull;
-
 public class Player extends Mob {
 
     private static final int SAVE_DATA_VERSION = 1;
@@ -48,7 +47,7 @@ public class Player extends Mob {
     public int cursorX = 0;
     public int cursorY = 0;
 
-    @CheckForNull
+    @Nullable
     private Vector2 spawnPoint = null;
 
     public ControlMode controlMode = ControlMode.WALK;
@@ -231,7 +230,7 @@ public class Player extends Mob {
 
         final Block foregroundBlock = gameWorld.getForeMap(cursorX, cursorY);
         final Block backgroundBlock = gameWorld.getBackMap(cursorX, cursorY);
-        @CheckForNull final Block target;
+        @Nullable final Block target;
 
         if (checkBlockCanBeHit(foregroundBlock)) {
             target = foregroundBlock;
index 624f5d0c16865c17984ced324d48d99576624782..3938ef70142d5b593347f4c02a820adc3f1b3775 100644 (file)
@@ -4,7 +4,6 @@ import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.model.dto.SaveDataDto
 import ru.deadsoftware.cavedroid.game.model.item.InventoryItem
 import ru.deadsoftware.cavedroid.misc.Saveable
-import javax.annotation.OverridingMethodsMustInvokeSuper
 
 abstract class Container @JvmOverloads constructor(
     val size: Int,
@@ -18,7 +17,6 @@ abstract class Container @JvmOverloads constructor(
 
     val items get() = _items.asList() as MutableList<InventoryItem>
 
-    @OverridingMethodsMustInvokeSuper
     open fun initItems(gameItemsHolder: GameItemsHolder) {
         _items.forEach { it.init(gameItemsHolder) }
     }
diff --git a/core/src/ru/deadsoftware/cavedroid/game/objects/package-info.java b/core/src/ru/deadsoftware/cavedroid/game/objects/package-info.java
deleted file mode 100644 (file)
index c5856a0..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.game.objects;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/package-info.java b/core/src/ru/deadsoftware/cavedroid/game/package-info.java
deleted file mode 100644 (file)
index 6290746..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.game;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
index 05a7d5f0f6aa14802eb11fc7b05dcd8b96ba95a4..b53e0a628e23f4e466bc5ea08492aecbe1c243eb 100644 (file)
@@ -2,6 +2,7 @@ package ru.deadsoftware.cavedroid.game.world;
 
 import com.badlogic.gdx.math.MathUtils;
 import kotlin.Pair;
+import org.jetbrains.annotations.Nullable;
 import ru.deadsoftware.cavedroid.game.GameItemsHolder;
 import ru.deadsoftware.cavedroid.game.GameScope;
 import ru.deadsoftware.cavedroid.game.mobs.MobsController;
@@ -16,7 +17,6 @@ import ru.deadsoftware.cavedroid.game.objects.container.Furnace;
 import ru.deadsoftware.cavedroid.game.objects.container.ContainerController;
 import ru.deadsoftware.cavedroid.misc.utils.MeasureUnitsUtilsKt;
 
-import javax.annotation.CheckForNull;
 import javax.inject.Inject;
 
 @GameScope
@@ -42,8 +42,8 @@ public class GameWorld {
                      MobsController mobsController,
                      GameItemsHolder gameItemsHolder,
                      ContainerController containerController,
-                     @CheckForNull Block[][] foreMap,
-                     @CheckForNull Block[][] backMap) {
+                     @Nullable Block[][] foreMap,
+                     @Nullable Block[][] backMap) {
         mDropController = dropController;
         mMobsController = mobsController;
         mGameItemsHolder = gameItemsHolder;
@@ -273,24 +273,24 @@ public class GameWorld {
         placeToBackground(x, y, mGameItemsHolder.getFallbackBlock());
     }
 
-    @CheckForNull
+    @Nullable
     private Container getContainerAt(int x, int y, int z) {
         return mContainerController.getContainer(transformX(x), y, z);
     }
 
-    @CheckForNull
+    @Nullable
     public Container getForegroundContainer(int x, int y) {
         return getContainerAt(x, y, FOREGROUND_Z);
     }
 
-    @CheckForNull
+    @Nullable
     public Container getBackgroundContainer(int x, int y) {
         return getContainerAt(x, y, BACKGROUND_Z);
     }
 
-    @CheckForNull
+    @Nullable
     public Furnace getForegroundFurnace(int x, int y) {
-        @CheckForNull
+        @Nullable
         final Container container = getForegroundContainer(x, y);
 
         if (container instanceof Furnace) {
@@ -300,9 +300,9 @@ public class GameWorld {
         return null;
     }
 
-    @CheckForNull
+    @Nullable
     public Furnace getBackgroundFurnace(int x, int y) {
-        @CheckForNull
+        @Nullable
         final Container container = getBackgroundContainer(x, y);
 
         if (container instanceof Furnace) {
index 004a56b01a945ec581dd084a5e26c390da3de190..9562f08b192462e95b1704b5e73a36fd20f395a4 100644 (file)
@@ -1,12 +1,12 @@
 package ru.deadsoftware.cavedroid.game.world
 
-import com.google.common.primitives.Ints.min
 import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.model.block.Block
 import ru.deadsoftware.cavedroid.game.model.world.Biome
 import ru.deadsoftware.cavedroid.game.model.world.generator.WorldGeneratorConfig
 import kotlin.math.abs
 import kotlin.math.max
+import kotlin.math.min
 import kotlin.random.Random
 
 class GameWorldGenerator(
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/objects/package-info.java b/core/src/ru/deadsoftware/cavedroid/menu/objects/package-info.java
deleted file mode 100644 (file)
index b132187..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.menu.objects;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/package-info.java b/core/src/ru/deadsoftware/cavedroid/menu/package-info.java
deleted file mode 100644 (file)
index 304c211..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.menu;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/menu/submenus/package-info.java b/core/src/ru/deadsoftware/cavedroid/menu/submenus/package-info.java
deleted file mode 100644 (file)
index 6c28493..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.menu.submenus;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/annotations/NonnullByDefault.java b/core/src/ru/deadsoftware/cavedroid/misc/annotations/NonnullByDefault.java
deleted file mode 100644 (file)
index bee4070..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-package ru.deadsoftware.cavedroid.misc.annotations;
-
-import javax.annotation.Nonnull;
-import javax.annotation.meta.TypeQualifierDefault;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import static java.lang.annotation.ElementType.*;
-
-@Nonnull
-@TypeQualifierDefault({METHOD, FIELD, PARAMETER})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface NonnullByDefault {
-}
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/package-info.java b/core/src/ru/deadsoftware/cavedroid/misc/package-info.java
deleted file mode 100644 (file)
index acdf3e1..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid.misc;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/package-info.java b/core/src/ru/deadsoftware/cavedroid/package-info.java
deleted file mode 100644 (file)
index a566cb5..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-@NonnullByDefault
-package ru.deadsoftware.cavedroid;
-
-import ru.deadsoftware.cavedroid.misc.annotations.NonnullByDefault;
\ No newline at end of file