@@ -60,16 +60,33 @@ public Java7DocScraper (File dir) throws IOException {
6060 }
6161}
6262
63+ class Java8DocScraper extends AndroidDocScraper {
64+ static final String pattern_head_javadoc = "<td class=\" colLast\" ><code><span class=\" memberNameLink\" ><a href=\" [./]*" ; // I'm not sure how path could be specified... (./ , ../ , or even /)
65+ static final String reset_pattern_head_javadoc = "<td><code>" ;
66+ static final String parameter_pair_splitter_javadoc = " " ;
67+
68+ public Java8DocScraper (File dir ) throws IOException {
69+ super (dir , pattern_head_javadoc , reset_pattern_head_javadoc , parameter_pair_splitter_javadoc , true , "-" , "-" , "-" );
70+ }
71+ }
72+
6373public abstract class AndroidDocScraper implements IDocScraper {
6474
6575 final String pattern_head ;
6676 final String reset_pattern_head ;
6777 final String parameter_pair_splitter ;
78+ final String open_method ;
79+ final String param_sep ;
80+ final String close_method ;
6881 final boolean continuous_param_lines ;
6982
7083 File root ;
7184
7285 protected AndroidDocScraper (File dir , String patternHead , String resetPatternHead , String parameterPairSplitter , boolean continuousParamLines ) throws IOException {
86+ this (dir , patternHead , resetPatternHead , parameterPairSplitter , continuousParamLines , "\\ (\\ Q" , ", " , "\\ E\\ )" );
87+ }
88+
89+ protected AndroidDocScraper (File dir , String patternHead , String resetPatternHead , String parameterPairSplitter , boolean continuousParamLines , String openMethod , String paramSep , String closeMethod ) throws IOException {
7390
7491 if (dir == null )
7592 throw new IllegalArgumentException ();
@@ -78,6 +95,9 @@ protected AndroidDocScraper (File dir, String patternHead, String resetPatternHe
7895 reset_pattern_head = resetPatternHead ;
7996 parameter_pair_splitter = parameterPairSplitter != null ? parameterPairSplitter : "\\ s+" ;
8097 continuous_param_lines = continuousParamLines ;
98+ open_method = openMethod ;
99+ param_sep = paramSep ;
100+ close_method = closeMethod ;
81101
82102 if (!dir .exists ())
83103 throw new FileNotFoundException (dir .getAbsolutePath ());
@@ -106,10 +126,10 @@ public String[] getParameterNames (ClassNode asm, String name, Type[] ptypes, bo
106126 buffer .append (path );
107127 buffer .append ("#" );
108128 buffer .append (name );
109- buffer .append (" \\ ( \\ Q" );
129+ buffer .append (open_method );
110130 for (int i = 0 ; i < ptypes .length ; i ++) {
111131 if (i != 0 )
112- buffer .append (", " );
132+ buffer .append (param_sep );
113133 String type = JavaClass .getGenericTypeName (ptypes [i ]);
114134 if (isVarArgs && i == ptypes .length - 1 )
115135 type = type .replace ("[]" , "..." );
@@ -120,7 +140,8 @@ public String[] getParameterNames (ClassNode asm, String name, Type[] ptypes, bo
120140 // type = type.substring (0, type.indexOf ('<'));
121141 buffer .append (type );
122142 }
123- buffer .append ("\\ E\\ )\" .*\\ ((.*)\\ )" );
143+ buffer .append (close_method );
144+ buffer .append ("\" .*\\ ((.*)\\ )" );
124145 Pattern pattern = Pattern .compile (buffer .toString ());
125146
126147 try {
@@ -147,7 +168,7 @@ public String[] getParameterNames (ClassNode asm, String name, Type[] ptypes, bo
147168 }
148169 stream .close ();
149170 return result ;
150- }
171+ } else System . err . println ( "NOT MATCHING '" + buffer . toString () + "', INPUT: " + text );
151172 // sometimes we get incomplete tag, so cache it until it gets complete or matched.
152173 // I *know* this is a hack.
153174 if (reset_pattern_head == null || text .endsWith (">" ) || !continuous_param_lines && !text .startsWith (reset_pattern_head ))
0 commit comments