From 5f27261cb16a628f0179c1656a5458d612c56980 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 2 May 2020 00:52:12 -0400 Subject: [PATCH] Cleanup of cleanup --- .../mindustry/annotations/Annotations.java | 8 --- .../mutate/MultilineProcessor.java | 59 ------------------- 2 files changed, 67 deletions(-) delete mode 100644 annotations/src/main/java/mindustry/annotations/mutate/MultilineProcessor.java diff --git a/annotations/src/main/java/mindustry/annotations/Annotations.java b/annotations/src/main/java/mindustry/annotations/Annotations.java index d5308f9d55..38b48a25a7 100644 --- a/annotations/src/main/java/mindustry/annotations/Annotations.java +++ b/annotations/src/main/java/mindustry/annotations/Annotations.java @@ -87,14 +87,6 @@ public class Annotations{ //endregion //region misc. utility - @Target(ElementType.FIELD) - @Retention(RetentionPolicy.SOURCE) - public @interface Multiline { - boolean trim() default true; - boolean merge() default false; - char mergeChar() default ' '; - } - @Target(ElementType.TYPE) @Retention(RetentionPolicy.SOURCE) public @interface StyleDefaults{ diff --git a/annotations/src/main/java/mindustry/annotations/mutate/MultilineProcessor.java b/annotations/src/main/java/mindustry/annotations/mutate/MultilineProcessor.java deleted file mode 100644 index 6233580512..0000000000 --- a/annotations/src/main/java/mindustry/annotations/mutate/MultilineProcessor.java +++ /dev/null @@ -1,59 +0,0 @@ -package mindustry.annotations.mutate; - -import com.sun.tools.javac.tree.JCTree.*; -import mindustry.annotations.Annotations.*; -import mindustry.annotations.*; - -import javax.annotation.processing.*; -import javax.lang.model.element.*; -import java.io.*; -import java.util.*; - -//currently unused -@SupportedAnnotationTypes({"mindustry.annotations.Annotations.Multiline"}) -public final class MultilineProcessor extends BaseProcessor{ - - @Override - public void process(RoundEnvironment env){ - Set fields = env.getElementsAnnotatedWith(Multiline.class); - for(Element field : fields){ - String docComment = elementUtils.getDocComment(field); - if(null != docComment){ - JCVariableDecl fieldNode = (JCVariableDecl)elementUtils.getTree(field); - fieldNode.init = maker.Literal(toString(docComment, field.getAnnotation(Multiline.class))); - } - } - } - - static String toString(String value, Multiline annotation){ - if(!annotation.merge() && !annotation.trim()){ - return value; - } - - String crnl = System.getProperty("line.separator"); - try{ - BufferedReader reader = new BufferedReader(new StringReader(value)); - StringBuilder buf = new StringBuilder(); - String line = reader.readLine(); - while(line != null){ - if(annotation.trim()){ - line = line.trim(); - } - if(annotation.merge() && buf.length() > 0){ - if(annotation.mergeChar() != '\0'){ - buf.append(annotation.mergeChar()); - } - } - buf.append(line); - if(!annotation.merge()){ - buf.append(crnl); - } - - line = reader.readLine(); - } - return buf.toString(); - }catch(IOException ex){ - throw new RuntimeException("checked exceptions are disgusting", ex); - } - } -} \ No newline at end of file