diff --git a/javatools/src/main/java/org/xvm/tool/flag/Flag.java b/javatools/src/main/java/org/xvm/tool/flag/Flag.java index 855c8ca68..53903b3b5 100644 --- a/javatools/src/main/java/org/xvm/tool/flag/Flag.java +++ b/javatools/src/main/java/org/xvm/tool/flag/Flag.java @@ -137,7 +137,11 @@ public boolean isPassThru() */ public String getPassThruName() { - return passThruName == null || passThruName.isBlank() ? name : passThruName; + if (passThru) + { + return passThruName == null || passThruName.isBlank() ? name : passThruName; + } + return null; } /** diff --git a/javatools/src/test/java/org/xvm/tool/flag/FlagTest.java b/javatools/src/test/java/org/xvm/tool/flag/FlagTest.java index 0a1ff0f29..69c7a56cd 100644 --- a/javatools/src/test/java/org/xvm/tool/flag/FlagTest.java +++ b/javatools/src/test/java/org/xvm/tool/flag/FlagTest.java @@ -104,10 +104,9 @@ public void shouldPassThruCreateFlag() BooleanValue noOptValue = new BooleanValue(); boolean hidden = false; boolean passThru = true; - String passThruName = null; Flag flag = new Flag<>(name, shortcut, usage, value, dfltValue, noOptValue, - hidden, passThru, passThruName); + hidden, passThru, null); assertThat(flag.getName(), is(name)); assertThat(flag.hasShorthand(), is(true)); @@ -118,7 +117,7 @@ public void shouldPassThruCreateFlag() assertThat(flag.getNoArgDefault(), is(sameInstance(noOptValue))); assertThat(flag.isHidden(), is(hidden)); assertThat(flag.isPassThru(), is(passThru)); - assertThat(flag.getPassThruName(), is(passThruName)); + assertThat(flag.getPassThruName(), is(name)); } @Test