You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by ho...@apache.org on 2008/07/13 20:13:55 UTC

svn commit: r676389 - /lucene/solr/trunk/src/dev-tools/stub-analysis-factory-maker.pl

Author: hossman
Date: Sun Jul 13 11:13:55 2008
New Revision: 676389

URL: http://svn.apache.org/viewvc?rev=676389&view=rev
Log:
make script more robust: classes w/o a constructor arg we're looking for, anonymous classes, better regex for restricting to java files

Modified:
    lucene/solr/trunk/src/dev-tools/stub-analysis-factory-maker.pl

Modified: lucene/solr/trunk/src/dev-tools/stub-analysis-factory-maker.pl
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/dev-tools/stub-analysis-factory-maker.pl?rev=676389&r1=676388&r2=676389&view=diff
==============================================================================
--- lucene/solr/trunk/src/dev-tools/stub-analysis-factory-maker.pl (original)
+++ lucene/solr/trunk/src/dev-tools/stub-analysis-factory-maker.pl Sun Jul 13 11:13:55 2008
@@ -46,7 +46,10 @@
 my %classes = ();
 while (<STDIN>) {
     chomp;
-    $classes{$_} = 1;
+    # skip anonymous classes
+    if (!/\$/) {
+	$classes{$_} = 1;
+    }
 }
 
 find({wanted => \&wanted,
@@ -58,7 +61,7 @@
 
     my $file = $File::Find::name;
     
-    return unless $file =~ m{/([^/]*)\.java};
+    return unless $file =~ m{/([^/]*)\.java$};
     my $class = $1;
     
     open(my $f, "<", $file) or die "can't open $file: $!";
@@ -81,6 +84,8 @@
     # only looking for certain classes
     return unless $classes{$fullname};
 
+    print STDERR "$file\n";
+
     my @imports = $data =~ m/import\s+.*;/g;
     
     if ($data =~ m{public \s+ ((?:\w+\s+)*) $class \s*\(\s* ([^\)]*) \) }sx) {
@@ -100,6 +105,9 @@
 			 ($k, $v)
 			 } split /\s*,\s*/, $argline;
 	
+	# wacky, doesn't use Reader or TokenStream ... skip (maybe a Sink?)
+	return unless defined $mainArgType;
+
 	my $type = ("Reader" eq $mainArgType) ? "Tokenizer" : "TokenFilter";
 
 	my $facClass = "${class}Factory";
@@ -119,8 +127,8 @@
 	}
 	if (1 < @orderedArgs) {
 	    # we need to init something, stub it out
-	    print $o "  public abstract void init(SolrConfig solrConfig, Map<String, String> args) {\n";
-	    print $o "    super.init(solrConfig, args);\n";
+	    print $o "  public abstract void init(Map<String, String> args) {\n";
+	    print $o "    super.init(args);\n";
 	    print $o "    // ABSTRACT BECAUSE IT'S A STUB .. FILL IT IN\n";
 	    print $o "  }\n";
 	}