Skip to content

Commit 00aab5d

Browse files
committed
Remove deprecated constructor (OK as code has not been released)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/branches/avalon-implementation@539920 13f79535-47bb-0310-9956-ffa450edef68
1 parent 8fc39d0 commit 00aab5d

1 file changed

Lines changed: 22 additions & 33 deletions

File tree

src/java/org/apache/commons/cli/avalon/CLOptionDescriptor.java

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,15 @@ public CLOptionDescriptor( final String name,
5959
final int id,
6060
final String description )
6161
{
62-
this( name, flags, id, description,
63-
((flags & CLOptionDescriptor.DUPLICATES_ALLOWED) > 0)
64-
? new int[0] : new int[]{id} );
62+
63+
checkFlags(flags);
64+
65+
m_id = id;
66+
m_name = name;
67+
m_flags = flags;
68+
m_description = description;
69+
m_incompatible = ((flags & DUPLICATES_ALLOWED) > 0)
70+
? new int[0] : new int[] { id };
6571
}
6672

6773
/**
@@ -71,21 +77,30 @@ public CLOptionDescriptor( final String name,
7177
* @param flags the flags
7278
* @param id the id/character option
7379
* @param description description of option usage
74-
* @param incompatible an array listing the ids of all incompatible options
75-
* @deprecated use the version with the array of CLOptionDescriptor's
80+
* @param incompatible an array listing the descriptors of all incompatible options
7681
*/
7782
public CLOptionDescriptor( final String name,
7883
final int flags,
7984
final int id,
8085
final String description,
81-
final int[] incompatible )
86+
final CLOptionDescriptor[] incompatible )
8287
{
88+
89+
checkFlags(flags);
90+
8391
m_id = id;
8492
m_name = name;
8593
m_flags = flags;
8694
m_description = description;
87-
m_incompatible = incompatible;
8895

96+
m_incompatible = new int[incompatible.length];
97+
for (int i = 0; i < incompatible.length; i++) {
98+
m_incompatible[i] = incompatible[i].getId();
99+
}
100+
}
101+
102+
// helper method - check for invalid flag combinations
103+
private void checkFlags(final int flags) {
89104
int modeCount = 0;
90105
if( (ARGUMENT_REQUIRED & flags) == ARGUMENT_REQUIRED )
91106
{
@@ -116,32 +131,6 @@ else if( 1 != modeCount )
116131
}
117132
}
118133

119-
/**
120-
* Constructor.
121-
*
122-
* @param name the name/long option
123-
* @param flags the flags
124-
* @param id the id/character option
125-
* @param description description of option usage
126-
*/
127-
public CLOptionDescriptor( final String name,
128-
final int flags,
129-
final int id,
130-
final String description,
131-
final CLOptionDescriptor[] incompatible )
132-
{
133-
m_id = id;
134-
m_name = name;
135-
m_flags = flags;
136-
m_description = description;
137-
138-
m_incompatible = new int[incompatible.length];
139-
for( int i = 0; i < incompatible.length; i++ )
140-
{
141-
m_incompatible[i] = incompatible[i].getId();
142-
}
143-
}
144-
145134
/**
146135
* Get the array of incompatible option ids.
147136
*

0 commit comments

Comments
 (0)