Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package beust-jcommander for 
openSUSE:Factory checked in at 2024-05-21 18:36:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/beust-jcommander (Old)
 and      /work/SRC/openSUSE:Factory/.beust-jcommander.new.1880 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "beust-jcommander"

Tue May 21 18:36:16 2024 rev:5 rq:1175437 version:1.83

Changes:
--------
--- /work/SRC/openSUSE:Factory/beust-jcommander/beust-jcommander.changes        
2024-02-21 17:58:27.151720980 +0100
+++ 
/work/SRC/openSUSE:Factory/.beust-jcommander.new.1880/beust-jcommander.changes  
    2024-05-21 18:36:56.615487327 +0200
@@ -1,0 +2,16 @@
+Mon May 20 16:56:11 UTC 2024 - Fridrich Strba <[email protected]>
+
+- Update to version 1.83
+  * Fixes:
+    + Fixed Docs Timestamp
+    + Fixed: #563 - JCommander does not recognize command by alias.
+    + fixed: missing null check
+    + renamed IRule to IParametersValidator
+    + `@Parameters(rules = <? extends IRule>)`
+    + Unit Test for #532
+    + Fixed #532: @-syntax not working with command objects
+    + enable testng tests
+    + Fix regression with removed usage methods
+    + Add OSGi entries in MANIFEST.MF during jar creation
+
+-------------------------------------------------------------------

Old:
----
  jcommander-1.82.tar.xz

New:
----
  jcommander-1.83.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ beust-jcommander.spec ++++++
--- /var/tmp/diff_new_pack.1aOjc2/_old  2024-05-21 18:36:58.691563479 +0200
+++ /var/tmp/diff_new_pack.1aOjc2/_new  2024-05-21 18:36:58.695563626 +0200
@@ -16,14 +16,15 @@
 #
 
 
+%define __requires_exclude java-headless
 %global short_name jcommander
 Name:           beust-%{short_name}
-Version:        1.82
+Version:        1.83
 Release:        0
 Summary:        Java framework for parsing command line parameters
 License:        Apache-2.0
 Group:          Development/Libraries/Java
-URL:            http://jcommander.org/
+URL:            https://jcommander.org/
 Source0:        %{short_name}-%{version}.tar.xz
 # Adapted from earlier version that still shipped poms. It uses kobalt for 
building now
 Source1:        %{name}.pom
@@ -31,8 +32,8 @@
 Patch0:         0001-ParseValues-NullPointerException-patch.patch
 BuildRequires:  ant
 BuildRequires:  fdupes
-BuildRequires:  java-devel >= 1.8
-BuildRequires:  javapackages-local
+BuildRequires:  java-devel >= 9
+BuildRequires:  javapackages-local >= 6
 Requires:       java >= 1.8
 Obsoletes:      %{short_name} < %{version}-%{release}
 Provides:       %{short_name} = %{version}-%{release}

++++++ _service ++++++
--- /var/tmp/diff_new_pack.1aOjc2/_old  2024-05-21 18:36:58.871570081 +0200
+++ /var/tmp/diff_new_pack.1aOjc2/_new  2024-05-21 18:36:58.911571549 +0200
@@ -2,7 +2,7 @@
        <service name="tar_scm" mode="disabled">
                <param name="scm">git</param>
                <param 
name="url">https://github.com/cbeust/jcommander.git</param>
-               <param name="revision">1.82</param>
+               <param name="revision">1.83</param>
                <param name="versionformat">@PARENT_TAG@</param>
         <param name="exclude">**.jar</param>
         <param name="exclude">**.class</param>

++++++ beust-jcommander-build.xml ++++++
--- /var/tmp/diff_new_pack.1aOjc2/_old  2024-05-21 18:36:59.055576831 +0200
+++ /var/tmp/diff_new_pack.1aOjc2/_new  2024-05-21 18:36:59.071577418 +0200
@@ -23,7 +23,8 @@
   <property name="build.srcDir" value="src/main/java"/>
   <property name="build.resourceDir" value="src/main/resources"/>
   
-  <property name="compiler.source" value="1.8"/>
+  <property name="compiler.release" value="8"/>
+  <property name="compiler.source" value="1.${compiler.release}"/>
   <property name="compiler.target" value="${compiler.source}"/>
   
   <property name="reporting.outputDirectory" value="${build.dir}/site"/>
@@ -48,14 +49,30 @@
            debug="true" 
            optimize="false" 
            deprecation="true" 
-           target="${compiler.target}" 
+           release="${compiler.release}" 
            verbose="false" 
-           fork="false" 
-           source="${compiler.source}">
+           fork="false">
       <src>
         <pathelement location="${build.srcDir}"/>
       </src>
     </javac>
+    <javac destdir="${build.outputDir}" 
+           encoding="${project.build.sourceEncoding}" 
+           nowarn="false" 
+           debug="true" 
+           optimize="false" 
+           deprecation="true" 
+           release="9" 
+           verbose="false" 
+           fork="false">
+      <modulepath>
+        <pathelement location="${build.outputDir}"/>
+      </modulepath>
+      <src>
+        <pathelement location="."/>
+      </src>
+         <include name="**/module-info.java"/>
+    </javac>
   </target>
 
   <!-- ====================================================================== 
-->

++++++ jcommander-1.82.tar.xz -> jcommander-1.83.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jcommander-1.82/.github/workflows/publish-maven-central.yml 
new/jcommander-1.83/.github/workflows/publish-maven-central.yml
--- old/jcommander-1.82/.github/workflows/publish-maven-central.yml     
2022-01-11 05:29:49.000000000 +0100
+++ new/jcommander-1.83/.github/workflows/publish-maven-central.yml     
2023-08-23 18:24:28.000000000 +0200
@@ -35,5 +35,5 @@
 
     - name: Display next step
       run: |
-        echo "Now go to 
https://oss.sonatype.org/index.html#stagingRepositories, select the repo, Close 
it and then Release it"
+        echo "Now go to 
https://s01.oss.sonatype.org/index.html#stagingRepositories, select the repo, 
Close it and then Release it"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jcommander-1.82/build.gradle.kts 
new/jcommander-1.83/build.gradle.kts
--- old/jcommander-1.82/build.gradle.kts        2022-01-11 05:29:49.000000000 
+0100
+++ new/jcommander-1.83/build.gradle.kts        2023-08-23 18:24:28.000000000 
+0200
@@ -1,9 +1,9 @@
 
 
 object This {
-    val version = "1.82"
+    val version = "1.83"
     val artifactId = "jcommander"
-    val groupId = "com.beust"
+    val groupId = "org.jcommander"
     val description = "Command line parsing library for Java"
     val url = "https://jcommander.org";
     val scm = "github.com/cbeust/jcommander"
@@ -56,6 +56,22 @@
     `maven-publish`
     signing
     id("com.jfrog.bintray") version "1.8.3" // Don't use 1.8.4, crash when 
publishing
+    id("biz.aQute.bnd.builder") version "5.1.2"
+}
+
+tasks {
+    jar {
+        manifest {
+            attributes(
+                mapOf(
+                    "Bundle-Description" to "A Java library to parse command 
line options",
+                    "Bundle-License" to 
"http://www.apache.org/licenses/LICENSE-2.0.txt";,
+                    "Bundle-Name" to "com.beust.jcommander",
+                    "Export-Package" to 
"*;-split-package:=merge-first;-noimport:=true"
+                )
+            )
+        }
+    }
 }
 
 dependencies {
@@ -64,10 +80,14 @@
             .forEach { testImplementation(it) }
 }
 
+tasks.withType<Test> {
+     useTestNG()
+}
+
 //
 // Releases:
 // ./gradlew bintrayUpload (to JCenter)
-// ./gradlew publish (to Sonatype, then go to 
https://oss.sonatype.org/index.html#stagingRepositories to publish)
+// ./gradlew publish (to Sonatype, then go to 
https://s01.oss.sonatype.org/index.html#stagingRepositories to publish)
 // Make sure that ~/.gradle/gradle.properties:
 //     signing.keyId=XXXXXXXX
 //     signing.password=
@@ -154,8 +174,8 @@
         maven {
             name = "sonatype"
             url = if (This.version.contains("SNAPSHOT"))
-                
uri("https://oss.sonatype.org/content/repositories/snapshots/";) else
-                
uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/";)
+                
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/";) else
+                
uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/";)
             credentials {
                 username = project.findProperty("sonatypeUser")?.toString() ?: 
System.getenv("SONATYPE_USER")
                 password = 
project.findProperty("sonatypePassword")?.toString() ?: 
System.getenv("SONATYPE_PASSWORD")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jcommander-1.82/docs/index.adoc 
new/jcommander-1.83/docs/index.adoc
--- old/jcommander-1.82/docs/index.adoc 2022-01-11 05:29:49.000000000 +0100
+++ new/jcommander-1.83/docs/index.adoc 2023-08-23 18:24:28.000000000 +0200
@@ -502,7 +502,67 @@
 
 === Global parameter validation
 
-After parsing your parameters with JCommander, you might want to perform 
additional validation across these parameters, such as making sure that two 
mutually exclusive parameters are not both specified. Because of all the 
potential combinations involved in such validation, JCommander does not provide 
any annotation-based solution to perform this validation because such an 
approach would necessarily be very limited by the very nature of Java 
annotations. Instead, you should simply perform this validation in Java on all 
the arguments that JCommander just parsed.
+After parsing your parameters with JCommander, you might want to perform 
additional validation across these parameters, such as making sure that two 
mutually exclusive parameters are not both specified.
+
+[source,java]
+----
+/**
+ * Validate all parameters.
+ *
+ * @param parameters
+ *            Name-value-pairs of all parameters (e.g. "-host":"localhost").
+ *
+ * @throws ParameterException
+ *             Thrown if validation of the parameters fails.
+ */
+void validate(Map<String, Object> parameters) throws ParameterException;
+----
+
+Here is an example implementation that will make sure that the boolean options 
`--quiet` and `--verbose` are not enabled at the same time:
+
+[source,java]
+----
+public static class QuietAndVerboseAreMutualExclusive implements 
IParametersValidator {
+    @Override
+    public void validate(Map<String, Object> parameters) throws 
ParameterException {
+        if (parameters.get("--quiet") == TRUE && parameters.get("--verbose") 
== TRUE)
+            throw new ParameterException("--quiet and --verbose are mutually 
exclusive");
+    }
+}
+----
+
+Specify the name of a class implementing this interface in the 
`parametersValidators` attribute of your `@Parameters` annotations:
+
+[source,java]
+----
+@Parameters(parametersValidators = QuietAndVerboseAreMutualExclusive.class)
+class Flags {
+    @Parameter(names = "--quiet", description = "Do not output anything")
+    boolean quiet;
+
+    @Parameter(names = "--verbose", description = "Output detailed 
information")
+    boolean verbose;
+}
+----
+
+Attempting to enable `--quiet` and `--verbose` at the same time will cause a 
`ParameterException` to be thrown.
+
+Multiple validators may be specified:
+
+[source,java]
+----
+@Parameters(paremetersValidators = { QuietAndVerboseAreMutualExclusive.class, 
VerboseNeedsLevel.class })
+class Flags {
+    @Parameter(names = "--quiet", description = "Do not output anything")
+    boolean quiet;
+
+    @Parameter(names = "--verbose", description = "Output detailed 
information")
+    boolean verbose;
+
+    @Parameter(names = "--level", description = "Detail level of verbose 
information")
+    Integer level;
+}
+----
 
 
 == Main parameter
@@ -1076,14 +1136,14 @@
 
 [source,groovy]
 ----
-compile("com.beust:jcommander:1.71")
+compile("org.jcommander:jcommander:1.83")
 ----
 
 - Gradle
 
 [source,groovy]
 ----
-compile "com.beust:jcommander:1.71"
+compile "org.jcommander:jcommander:1.83"
 ----
 
 - Maven:
@@ -1091,9 +1151,9 @@
 [source,xml]
 ----
 <dependency>
-  <groupId>com.beust</groupId>
+  <groupId>org.jcommander</groupId>
   <artifactId>jcommander</artifactId>
-  <version>1.71</version>
+  <version>1.83</version>
 </dependency>
 ----
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jcommander-1.82/docs/index.html 
new/jcommander-1.83/docs/index.html
--- old/jcommander-1.82/docs/index.html 2022-01-11 05:29:49.000000000 +0100
+++ new/jcommander-1.83/docs/index.html 2023-08-23 18:24:28.000000000 +0200
@@ -2080,7 +2080,7 @@
 </div>
 <div class="listingblock">
 <div class="content">
-<pre class="prettyprint highlight"><code class="language-groovy" 
data-lang="groovy">compile("com.beust:jcommander:1.71")</code></pre>
+<pre class="prettyprint highlight"><code class="language-groovy" 
data-lang="groovy">compile("org.jcommander:jcommander:1.83")</code></pre>
 </div>
 </div>
 <div class="ulist">
@@ -2092,7 +2092,7 @@
 </div>
 <div class="listingblock">
 <div class="content">
-<pre class="prettyprint highlight"><code class="language-groovy" 
data-lang="groovy">compile "com.beust:jcommander:1.71"</code></pre>
+<pre class="prettyprint highlight"><code class="language-groovy" 
data-lang="groovy">compile "org.jcommander:jcommander:1.83"</code></pre>
 </div>
 </div>
 <div class="ulist">
@@ -2105,9 +2105,9 @@
 <div class="listingblock">
 <div class="content">
 <pre class="prettyprint highlight"><code class="language-xml" 
data-lang="xml">&lt;dependency&gt;
-  &lt;groupId&gt;com.beust&lt;/groupId&gt;
+  &lt;groupId&gt;org.jcommander&lt;/groupId&gt;
   &lt;artifactId&gt;jcommander&lt;/artifactId&gt;
-  &lt;version&gt;1.71&lt;/version&gt;
+  &lt;version&gt;1.83&lt;/version&gt;
 &lt;/dependency&gt;</code></pre>
 </div>
 </div>
@@ -2116,7 +2116,7 @@
 </div>
 <div id="footer">
 <div id="footer-text">
-Last updated 2017-10-19 11:25:51 PDT
+Last updated 2023-08-23 18:24:00 PDT
 </div>
 </div>
 <link rel="stylesheet" 
href="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css";>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jcommander-1.82/release new/jcommander-1.83/release
--- old/jcommander-1.82/release 2022-01-11 05:29:49.000000000 +0100
+++ new/jcommander-1.83/release 2023-08-23 18:24:28.000000000 +0200
@@ -1,4 +1,4 @@
-# UI : https://oss.sonatype.org/index.html
+# UI : https://s01.oss.sonatype.org/index.html
 # Wiki: 
https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
 #
 # deploy without tagging: mvn deploy -DperformRelease
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jcommander-1.82/src/main/java/com/beust/jcommander/IParametersValidator.java
 
new/jcommander-1.83/src/main/java/com/beust/jcommander/IParametersValidator.java
--- 
old/jcommander-1.82/src/main/java/com/beust/jcommander/IParametersValidator.java
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/jcommander-1.83/src/main/java/com/beust/jcommander/IParametersValidator.java
    2023-08-23 18:24:28.000000000 +0200
@@ -0,0 +1,18 @@
+package com.beust.jcommander;
+
+import java.util.Map;
+
+public interface IParametersValidator {
+
+    /**
+     * Validate all parameters.
+     *
+     * @param parameters
+     *            Name-value-pairs of all parameters (e.g. 
"-host":"localhost").
+     *
+     * @throws ParameterException
+     *             Thrown if validation of the parameters fails.
+     */
+    void validate(Map<String, Object> parameters) throws ParameterException;
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jcommander-1.82/src/main/java/com/beust/jcommander/JCommander.java 
new/jcommander-1.83/src/main/java/com/beust/jcommander/JCommander.java
--- old/jcommander-1.82/src/main/java/com/beust/jcommander/JCommander.java      
2022-01-11 05:29:49.000000000 +0100
+++ new/jcommander-1.83/src/main/java/com/beust/jcommander/JCommander.java      
2023-08-23 18:24:28.000000000 +0200
@@ -128,6 +128,11 @@
     private Map<Parameterized, ParameterDescription> requiredFields = 
Maps.newHashMap();
 
     /**
+     * A set of all the parameters validators to be applied.
+     */
+    private Set<IParametersValidator> parametersValidators = Sets.newHashSet();
+
+    /**
      * A map of all the parameterized fields/methods.
      */
     private Map<Parameterized, ParameterDescription> fields = 
Maps.newHashMap();
@@ -377,7 +382,8 @@
     }
 
     /**
-     * Make sure that all the required parameters have received a value.
+     * Make sure that all the required parameters have received a value and 
that
+     * all provided parameters have a value compliant to all given rules.
      */
     private void validateOptions() {
         // No validation if we found a help parameter
@@ -419,6 +425,15 @@
 
             }
         }
+
+        Map<String, Object> nameValuePairs = Maps.newHashMap();
+        for (ParameterDescription pd : fields.values()) {
+            nameValuePairs.put(pd.getLongestName(), pd.getValue());
+        }
+
+        for (IParametersValidator parametersValidator : parametersValidators) {
+            parametersValidator.validate(nameValuePairs);
+        }
     }
 
     private static String pluralize(int quantity, String singular, String 
plural) {
@@ -522,6 +537,9 @@
         for (IKey key : commands.keySet()) {
             if (matchArg(arg, key)) return true;
         }
+        for (IKey key : aliasMap.keySet()) {
+            if (matchArg(arg, key)) return true;
+        }
 
         return false;
     }
@@ -570,7 +588,7 @@
             while ((line = bufRead.readLine()) != null) {
                 // Allow empty lines and # comments in these at files
                 if (line.length() > 0 && !line.trim().startsWith("#")) {
-                    result.add(line);
+                    result.addAll(Arrays.asList(line.split("\\s")));
                 }
             }
         } catch (IOException e) {
@@ -605,6 +623,19 @@
     private void addDescription(Object object) {
         Class<?> cls = object.getClass();
 
+        Parameters parameters = cls.getAnnotation(Parameters.class);
+        if (parameters != null) {
+            Class<? extends IParametersValidator>[] parametersValidatorClasses 
= parameters.parametersValidators();
+                for (Class<? extends IParametersValidator> 
parametersValidatorClass : parametersValidatorClasses) {
+                try {
+                    IParametersValidator parametersValidator = 
parametersValidatorClass.getDeclaredConstructor().newInstance();
+                    parametersValidators.add(parametersValidator);
+                } catch (ReflectiveOperationException e) {
+                    throw new ParameterException("Cannot instantiate rule: " + 
parametersValidatorClass, e);
+                }
+            }
+        }
+
         List<Parameterized> parameterizeds = 
parameterizedParser.parseArg(object);
         for (Parameterized parameterized : parameterizeds) {
             WrappedParameter wp = parameterized.getWrappedParameter();
@@ -1030,6 +1061,41 @@
         usageFormatter.usage(sb);
         getConsole().println(sb.toString());
     }
+    
+    /**
+     * Display the usage for this command.
+     */
+    public void usage(String commandName) {
+        StringBuilder sb = new StringBuilder();
+        usageFormatter.usage(commandName, sb);
+        getConsole().println(sb.toString());
+    }
+
+    /**
+     * Store the help for the command in the passed string builder.
+     */
+    public void usage(String commandName, StringBuilder out) {
+        usageFormatter.usage(commandName, out, "");
+    }
+
+    /**
+     * Store the help for the command in the passed string builder, indenting
+     * every line with "indent".
+     */
+    public void usage(String commandName, StringBuilder out, String indent) {
+        usageFormatter.usage(commandName, out, indent);
+    }
+    
+    /**
+     * Store the help in the passed string builder.
+     */
+    public void usage(StringBuilder out) {
+        usageFormatter.usage(out, "");
+    }
+
+    public void usage(StringBuilder out, String indent) {
+        usageFormatter.usage(out, indent);
+    }
 
     /**
      * Sets the usage formatter.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jcommander-1.82/src/main/java/com/beust/jcommander/ParameterDescription.java
 
new/jcommander-1.83/src/main/java/com/beust/jcommander/ParameterDescription.java
--- 
old/jcommander-1.82/src/main/java/com/beust/jcommander/ParameterDescription.java
    2022-01-11 05:29:49.000000000 +0100
+++ 
new/jcommander-1.83/src/main/java/com/beust/jcommander/ParameterDescription.java
    2023-08-23 18:24:28.000000000 +0200
@@ -280,9 +280,17 @@
     }
     if (! isDefault) assigned = true;
 
+    this.value = finalValue;
+
     return finalValue;
   }
 
+  private Object value;
+
+  Object getValue() {
+         return value;
+  }
+
   private Object handleSubParameters(String value, int currentIndex, Class<?> 
type,
       List<SubParameterIndex> subParameters) {
     Object finalValue;// Yes, assign each following argument to the 
corresponding field of that object
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jcommander-1.82/src/main/java/com/beust/jcommander/Parameters.java 
new/jcommander-1.83/src/main/java/com/beust/jcommander/Parameters.java
--- old/jcommander-1.82/src/main/java/com/beust/jcommander/Parameters.java      
2022-01-11 05:29:49.000000000 +0100
+++ new/jcommander-1.83/src/main/java/com/beust/jcommander/Parameters.java      
2023-08-23 18:24:28.000000000 +0200
@@ -65,4 +65,10 @@
    * If true, this command won't appear in the usage().
    */
   boolean hidden() default false;
+
+  /**
+   * Validate the value for all parameters.
+   */
+  Class<? extends IParametersValidator>[] parametersValidators() default {};
+
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jcommander-1.82/src/test/java/com/beust/jcommander/JCommanderTest.java 
new/jcommander-1.83/src/test/java/com/beust/jcommander/JCommanderTest.java
--- old/jcommander-1.82/src/test/java/com/beust/jcommander/JCommanderTest.java  
2022-01-11 05:29:49.000000000 +0100
+++ new/jcommander-1.83/src/test/java/com/beust/jcommander/JCommanderTest.java  
2023-08-23 18:24:28.000000000 +0200
@@ -570,6 +570,20 @@
         
Assert.assertEquals(ArgMultiNameValidator.MultiNameValidator.parsedName, 
paramName);
     }
 
+    @Test
+    public void atFileCanContainNameAndValueInSameLine() throws IOException {
+        File f = File.createTempFile("JCommander", null);
+        f.deleteOnExit();
+        FileWriter fw = new FileWriter(f);
+        fw.write("-verbose 2\n");
+        fw.write("-groups g\n");
+        fw.close();
+        Args1 args1 = new Args1();
+        JCommander.newBuilder().addObject(args1).build().parse("@" + 
f.getAbsolutePath());
+        Assert.assertEquals(args1.verbose.intValue(), 2);
+        Assert.assertEquals(args1.groups, "g");
+    }
+
     public void atFileCanContainEmptyLines() throws IOException {
         File f = File.createTempFile("JCommander", null);
         f.deleteOnExit();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/jcommander-1.82/src/test/java/com/beust/jcommander/ParametersRulesTest.java 
new/jcommander-1.83/src/test/java/com/beust/jcommander/ParametersRulesTest.java
--- 
old/jcommander-1.82/src/test/java/com/beust/jcommander/ParametersRulesTest.java 
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/jcommander-1.83/src/test/java/com/beust/jcommander/ParametersRulesTest.java 
    2023-08-23 18:24:28.000000000 +0200
@@ -0,0 +1,35 @@
+package com.beust.jcommander;
+
+import static java.lang.Boolean.TRUE;
+
+import java.util.Map;
+
+import org.testng.annotations.Test;
+
+public class ParametersRulesTest {
+
+    @Parameters(parametersValidators = QuietAndVerboseAreMutualExclusive.class)
+    class Flags {
+        @Parameter(names = "--quiet", description = "Do not output anything")
+        boolean quiet;
+
+        @Parameter(names = "--verbose", description = "Output detailed 
information")
+        boolean verbose;
+    }
+
+    public static class QuietAndVerboseAreMutualExclusive implements 
IParametersValidator {
+        @Override
+        public void validate(Map<String, Object> parameters) throws 
ParameterException {
+            if (parameters.get("--quiet") == TRUE && 
parameters.get("--verbose") == TRUE)
+                throw new ParameterException("--quiet and --verbose are 
mutually exclusive");
+        }
+    }
+
+    @Test(expectedExceptions = ParameterException.class,
+          expectedExceptionsMessageRegExp = "--quiet and --verbose are 
mutually exclusive")
+    public void testParameters() throws Exception {
+        Object o = new Flags();
+        JCommander.newBuilder().addObject(o).build().parse("--quiet", 
"--verbose");
+    }
+
+}

Reply via email to