@@ -119,13 +119,21 @@ public Java8DocScraper (string dir)
119
119
ShouldAlterArraySpec = true ;
120
120
ShouldEliminateGenericArguments = true ;
121
121
}
122
+
123
+ protected override string StripTagsFromParameters ( string value )
124
+ {
125
+ // Java8 javadoc contains possibly linked types with <a> tags, so remove all of them.
126
+ while ( value . IndexOf ( '<' ) >= 0 && value . IndexOf ( '>' ) > value . IndexOf ( '<' ) )
127
+ value = value . Substring ( 0 , value . IndexOf ( '<' ) ) + value . Substring ( value . IndexOf ( '>' ) + 1 ) ;
128
+ return value ;
129
+ }
122
130
}
123
131
124
132
public abstract class AndroidDocScraper : IAndroidDocScraper
125
133
{
126
134
readonly String pattern_head ;
127
135
readonly String reset_pattern_head ;
128
- readonly char [ ] parameter_pair_splitter ;
136
+ readonly string [ ] parameter_pair_splitter ;
129
137
readonly bool continuous_param_lines ;
130
138
readonly String open_method ;
131
139
readonly String param_sep ;
@@ -145,7 +153,7 @@ protected AndroidDocScraper (string dir, String patternHead, String resetPattern
145
153
146
154
pattern_head = patternHead ;
147
155
reset_pattern_head = resetPatternHead ;
148
- parameter_pair_splitter = ( parameterPairSplitter != null ? parameterPairSplitter : "\\ s+" ) . ToCharArray ( ) ;
156
+ parameter_pair_splitter = new string [ ] { ( parameterPairSplitter != null ? parameterPairSplitter : "\\ s+" ) } ;
149
157
continuous_param_lines = continuousParamLines ;
150
158
open_method = openMethod ;
151
159
param_sep = paramSep ;
@@ -178,6 +186,11 @@ protected virtual bool ShouldResetMatchBuffer (string text)
178
186
// I *know* this is a hack.
179
187
return reset_pattern_head == null || text . EndsWith ( ">" , StringComparison . Ordinal ) || ! continuous_param_lines && ! text . StartsWith ( reset_pattern_head , StringComparison . Ordinal ) ;
180
188
}
189
+
190
+ protected virtual string StripTagsFromParameters ( string value )
191
+ {
192
+ return value ;
193
+ }
181
194
182
195
public virtual String [ ] GetParameterNames ( string package , string type , string method , string [ ] ptypes , bool isVarArgs )
183
196
{
@@ -223,14 +236,14 @@ public virtual String[] GetParameterNames (string package, string type, string m
223
236
var matcher = pattern . Match ( text ) ;
224
237
if ( matcher . Success ) {
225
238
var plist = matcher . Groups [ 1 ] ;
226
- String [ ] parms = plist . Value . Split ( new string [ ] { ", " } , StringSplitOptions . RemoveEmptyEntries ) ;
239
+ String [ ] parms = StripTagsFromParameters ( plist . Value ) . Split ( new string [ ] { ", " } , StringSplitOptions . RemoveEmptyEntries ) ;
227
240
if ( parms . Length != ptypes . Length ) {
228
241
Log . Warning ( 1 , "failed matching {0} (expected {1} params, got {2} params)" , buffer , ptypes . Length , parms . Length ) ;
229
242
return null ;
230
243
}
231
244
String [ ] result = new String [ ptypes . Length ] ;
232
245
for ( int i = 0 ; i < ptypes . Length ; i ++ ) {
233
- String [ ] toks = parms [ i ] . Split ( parameter_pair_splitter ) ;
246
+ String [ ] toks = parms [ i ] . Split ( parameter_pair_splitter , StringSplitOptions . RemoveEmptyEntries ) ;
234
247
result [ i ] = toks [ toks . Length - 1 ] ;
235
248
}
236
249
return result ;
0 commit comments