Skip to content

Commit

Permalink
refactor: Drop guava annotations and create annotation helper (#3389)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotMyFault authored Dec 29, 2021
1 parent 9f4af88 commit 3eb485e
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
*/
package com.plotsquared.core.plot.comment;

import com.google.common.annotations.Beta;
import com.google.inject.TypeLiteral;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
Expand All @@ -44,7 +43,6 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

@Beta
public class CommentManager {

public static final HashMap<String, CommentInbox> inboxes = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.plotsquared.core.configuration.caption.CaptionUtility;
import com.plotsquared.core.util.AnnotationHelper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.ApiStatus;

import java.util.Collection;
import java.util.HashMap;
Expand Down Expand Up @@ -349,7 +349,7 @@ public void addUnknownFlag(final String flagName, final String value) {
*
* @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() {
return () -> GlobalFlagContainer.getInstance().unsubscribe(unknownsRef);
}
Expand Down
62 changes: 62 additions & 0 deletions Core/src/main/java/com/plotsquared/core/util/AnnotationHelper.java
Original file line number Diff line number Diff line change
@@ -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 "";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.ApiStatus;

import java.util.ArrayList;
import java.util.List;
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 {

private final EventBus eventBus = new EventBus("PlotSquaredEvents");
Expand Down

0 comments on commit 3eb485e

Please sign in to comment.