Skip to content

Commit 89f274e

Browse files
committed
Fix Clirr error wrt return type of Option#clone().
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1439565 13f79535-47bb-0310-9956-ffa450edef68
1 parent 7602e16 commit 89f274e

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/java/org/apache/commons/cli/DefaultParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ private void handleOption(Option option) throws ParseException
599599
// check the previous option before handling the next one
600600
checkRequiredArgs();
601601

602-
option = option.clone();
602+
option = (Option) option.clone();
603603

604604
updateRequiredOptions(option);
605605

src/main/java/org/apache/commons/cli/Option.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,11 @@ public int hashCode()
631631
* After calling this method, it is very likely you will want to call
632632
* clearValues().
633633
*
634-
* @throws RuntimeException
634+
* @return a clone of this Option instance
635+
* @throws RuntimeException if a {@link CloneNotSupportedException} has been thrown
636+
* by {@link super#clone()}
635637
*/
636-
public Option clone()
638+
public Object clone()
637639
{
638640
try
639641
{

src/main/java/org/apache/commons/cli/Parser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ protected void processOption(String arg, ListIterator<String> iter) throws Parse
380380
}
381381

382382
// get the option represented by arg
383-
Option opt = getOptions().getOption(arg).clone();
383+
Option opt = (Option) getOptions().getOption(arg).clone();
384384

385385
// update the required options and groups
386386
updateRequiredOptions(opt);

0 commit comments

Comments
 (0)