Skip to content

Commit 5ff94c7

Browse files
committed
Fix clirr errors by adding old method signatures and deprecating them.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1440310 13f79535-47bb-0310-9956-ffa450edef68
1 parent 321a9d7 commit 5ff94c7

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public class Option implements Cloneable, Serializable
6969
private int numberOfArgs = UNINITIALIZED;
7070

7171
/** the type of this Option */
72-
private Class type = String.class;
72+
private Class<?> type = String.class;
7373

7474
/** the list of argument values **/
7575
private List<String> values = new ArrayList<String>();
@@ -188,6 +188,21 @@ public Object getType()
188188
return type;
189189
}
190190

191+
/**
192+
* Sets the type of this Option.
193+
* <p>
194+
* <b>Note:</b> this method is kept for binary compatibility and the
195+
* input type is supposed to be a {@link Class} object.
196+
*
197+
* @param type the type of this Option
198+
* @deprecated since 1.3, use {@link #setType(Class)} instead
199+
*/
200+
@Deprecated
201+
public void setType(Object type)
202+
{
203+
setType((Class) type);
204+
}
205+
191206
/**
192207
* Sets the type of this Option.
193208
*

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,23 @@ public static OptionBuilder hasOptionalArgs(int numArgs)
280280
return instance;
281281
}
282282

283+
/**
284+
* The next Option created will have a value that will be an instance
285+
* of <code>type</code>.
286+
* <p>
287+
* <b>Note:</b> this method is kept for binary compatibility and the
288+
* input type is supposed to be a {@link Class} object.
289+
*
290+
* @param newType the type of the Options argument value
291+
* @return the OptionBuilder instance
292+
* @deprecated since 1.3, use {@link #withType(Class)} instead
293+
*/
294+
@Deprecated
295+
public static OptionBuilder withType(Object newType)
296+
{
297+
return withType((Class) newType);
298+
}
299+
283300
/**
284301
* The next Option created will have a value that will be an instance
285302
* of <code>type</code>.

0 commit comments

Comments
 (0)