refactor: Drop guava annotations and create annotation helper (#3389)

This commit is contained in:
Alex 2021-12-29 16:18:19 +01:00 committed by GitHub
parent 9f4af889f7
commit 3eb485e900
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 6 deletions

View File

@ -25,7 +25,6 @@
*/ */
package com.plotsquared.core.plot.comment; package com.plotsquared.core.plot.comment;
import com.google.common.annotations.Beta;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption; import com.plotsquared.core.configuration.caption.StaticCaption;
@ -44,7 +43,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@Beta
public class CommentManager { public class CommentManager {
public static final HashMap<String, CommentInbox> inboxes = new HashMap<>(); public static final HashMap<String, CommentInbox> inboxes = new HashMap<>();

View File

@ -28,11 +28,11 @@ package com.plotsquared.core.plot.flag;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.plotsquared.core.configuration.caption.CaptionUtility; import com.plotsquared.core.configuration.caption.CaptionUtility;
import com.plotsquared.core.util.AnnotationHelper;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.ApiStatus;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -349,7 +349,7 @@ public class FlagContainer {
* *
* @return a new Runnable that cleans up once the FlagContainer isn't needed anymore. * @return a new Runnable that cleans up once the FlagContainer isn't needed anymore.
*/ */
@ApiStatus.Internal @AnnotationHelper.ApiDescription(info = "This method should not be considered as public or API.")
public Runnable createCleanupHook() { public Runnable createCleanupHook() {
return () -> GlobalFlagContainer.getInstance().unsubscribe(unknownsRef); return () -> GlobalFlagContainer.getInstance().unsubscribe(unknownsRef);
} }

View File

@ -0,0 +1,62 @@
/*
* _____ _ _ _____ _
* | __ \| | | | / ____| | |
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
* | |
* |_|
* PlotSquared plot management system for Minecraft
* Copyright (C) 2021 IntellectualSites
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.core.util;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.MODULE;
import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.RECORD_COMPONENT;
import static java.lang.annotation.ElementType.TYPE;
/**
* @since 6.3.0
*/
@AnnotationHelper.ApiDescription(info = "An internal class for custom annotations." +
"This is in no form part of the API and is subject to change at any time.")
public final class AnnotationHelper {
private AnnotationHelper() {
}
@Documented
@Retention(RetentionPolicy.CLASS)
@Target(value = {METHOD, PACKAGE, MODULE, RECORD_COMPONENT, TYPE})
public @interface ApiDescription {
/**
* Returns additional information how to use a class for the API
*
* @return the version string
* @since 6.3.0
*/
String info() default "";
}
}

View File

@ -83,13 +83,13 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.ApiStatus;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ApiStatus.Internal @AnnotationHelper.ApiDescription(info = "This is an internal class used by PlotSquared to dispatch events." +
"This is in no form part of the API and is subject to change at any time.")
public class EventDispatcher { public class EventDispatcher {
private final EventBus eventBus = new EventBus("PlotSquaredEvents"); private final EventBus eventBus = new EventBus("PlotSquaredEvents");