From 04eada12abd73d350e5d78bc0975644fe9e89d0d Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Sat, 6 Apr 2024 13:02:19 +0200 Subject: [PATCH] refactor: Replaced stream usage with loops for Java 1.7 compatibility (!) --- gradle.properties | 2 +- .../cheneer/command/CommandMultiSubclass.java | 27 ++++++++++--------- .../sourceforge/plantuml/version/Version.java | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/gradle.properties b/gradle.properties index 4b0a74673..9e4a36534 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ # Warning, "version" should be the same in gradle.properties and Version.java # Any idea anyone how to magically synchronize those :-) ? -version = 1.2024.4beta6 +version = 1.2024.4beta7 org.gradle.workers.max = 3 \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandMultiSubclass.java b/src/net/sourceforge/plantuml/cheneer/command/CommandMultiSubclass.java index 5a8a2519b..446afb1cd 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandMultiSubclass.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandMultiSubclass.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml.cheneer.command; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -84,15 +85,19 @@ public class CommandMultiSubclass extends SingleLineCommand2 { throws NoSuchColorException { final String superclass = diagram.cleanId(arg.get("SUPERCLASS", 0)); final String subclasses = arg.get("SUBCLASSES", 0); - final List subclassIds = Arrays.stream(subclasses.split(",")) - .map(String::trim) - .map(diagram::cleanId) - .collect(Collectors.toList()); + + final List subclassIds = new ArrayList(); + + for (String subclass : subclasses.split(",")) + subclassIds.add(diagram.cleanId(subclass.trim())); + final boolean isDouble = arg.get("PARTICIPATION", 0).equals("="); final String symbol = arg.get("SYMBOL", 0); - final Quark centerQuark = diagram.quarkInContext(false, superclass + "/" + symbol + subclasses + "/center"); - final Entity centerEntity = diagram.reallyCreateLeaf(centerQuark, Display.create(symbol), LeafType.CHEN_CIRCLE, null); + final Quark centerQuark = diagram.quarkInContext(false, + superclass + "/" + symbol + subclasses + "/center"); + final Entity centerEntity = diagram.reallyCreateLeaf(centerQuark, Display.create(symbol), LeafType.CHEN_CIRCLE, + null); final Quark superclassQuark = diagram.quarkInContext(true, superclass); final Entity superclassEntity = superclassQuark.getData(); @@ -108,9 +113,7 @@ public class CommandMultiSubclass extends SingleLineCommand2 { linkType = linkType.withMiddleSuperset(); } final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), superclassEntity, - centerEntity, - linkType, - LinkArg.build(Display.NULL, 2)); + centerEntity, linkType, LinkArg.build(Display.NULL, 2)); link.setPortMembers(diagram.getPortId(superclassEntity.getName()), diagram.getPortId(centerEntity.getName())); diagram.addLink(link); @@ -125,10 +128,8 @@ public class CommandMultiSubclass extends SingleLineCommand2 { if (!symbol.equals("U")) { subclassLinkType = subclassLinkType.withMiddleSuperset(); } - final Link subclassLink = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), centerEntity, - subclassEntity, - subclassLinkType, - LinkArg.build(Display.NULL, 3)); + final Link subclassLink = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), + centerEntity, subclassEntity, subclassLinkType, LinkArg.build(Display.NULL, 3)); diagram.addLink(subclassLink); } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 700fba39c..5be548980 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -46,7 +46,7 @@ public class Version { // Warning, "version" should be the same in gradle.properties and Version.java // Any idea anyone how to magically synchronize those :-) ? - private static final String version = "1.2024.4beta6"; + private static final String version = "1.2024.4beta7"; public static String versionString() { return version;