Changeset 12872 in josm for trunk/tools/japicc/modules/Internals/APIDump.pm
- Timestamp:
- 2017-09-17T15:47:18+02:00 (9 years ago)
- File:
-
- 1 edited
-
trunk/tools/japicc/modules/Internals/APIDump.pm (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/japicc/modules/Internals/APIDump.pm
r11682 r12872 135 135 136 136 my $ClassName = getFilename($ClassPath); 137 if($ClassName=~/\$\d/) { 137 if($ClassName=~/\$\d/ or $ClassName eq "module-info") { 138 138 next; 139 139 } 140 140 141 $ClassPath = cutPrefix($ClassPath, $ExtractPath); # javap decompiler accepts relative paths only 141 142 … … 220 221 } 221 222 222 sub simpleDecl($) 223 sub simpleDecl($$) 223 224 { 224 my $Line = $_[0];225 my ($Line, $LVer) = @_; 225 226 226 227 my %B = ( "<"=>0, ">"=>0 ); … … 287 288 { 288 289 if($Line=~s/([A-Za-z\d\?]+) extends \Q$R\E/$1/) { 289 $Tmpl{$1} = $R;290 $Tmpl{$1} = registerType($R, $LVer); 290 291 } 291 292 } … … 317 318 close(IN); 318 319 319 my (%TypeAttr, $CurrentMethod, $CurrentPackage, $CurrentClass) = (); 320 my (%TypeAttr, $CurrentMethod, $CurrentPackage, $CurrentClass, $CurrentClass_Short) = (); 320 321 my ($InParamTable, $InVarTypeTable, $InExceptionTable, $InCode) = (0, 0, 0, 0); 321 322 … … 488 489 # <KEYIN extends java.lang.Object ... 489 490 if($LINE=~/<[A-Z\d\?]+ /i) { 490 ($LINE, $TmplP) = simpleDecl($LINE); 491 ($LINE, $TmplP) = simpleDecl($LINE, $LVer); 491 492 } 492 493 } … … 628 629 } 629 630 $MethodAttr{"Class"} = registerType($TypeAttr{"Name"}, $LVer); 630 if($MethodAttr{"ShortName"}=~/\A(|(.+)\.)\Q$CurrentClass\E\Z/) 631 if($MethodAttr{"ShortName"}=~/\A(|(.+)\.)(\Q$CurrentClass\E|\Q$CurrentClass_Short\E)\Z/) 631 632 { 632 633 if($2) … … 688 689 and $LINE_N=~/(Signature|descriptor):\s*(.+?)\s*\Z/i) 689 690 { # create run-time unique name ( java/io/PrintStream.println (Ljava/lang/String;)V ) 691 my $SignParams = $2; 692 693 # Generic classes 694 my $ShortClass = $CurrentClass; 695 $ShortClass=~s/<.*>//g; 696 690 697 if($MethodAttr{"Constructor"}) { 691 $CurrentMethod = $ CurrentClass.".\"<init>\":".$2;698 $CurrentMethod = $ShortClass.".\"<init>\":".$SignParams; 692 699 } 693 700 else { 694 $CurrentMethod = $ CurrentClass.".".$MethodAttr{"ShortName"}.":".$2;701 $CurrentMethod = $ShortClass.".".$MethodAttr{"ShortName"}.":".$SignParams; 695 702 } 696 703 if(my $PackageName = getSFormat($CurrentPackage)) { … … 832 839 $CurrentPackage = ""; 833 840 } 841 834 842 if($CurrentClass=~s/#/./g) 835 843 { # javax.swing.text.GlyphView.GlyphPainter <=> GlyphView$GlyphPainter 836 844 $TypeAttr{"Name"}=~s/#/./g; 837 845 } 846 847 $CurrentClass_Short = $CurrentClass; 848 if(index($CurrentClass_Short, "<")!=-1) { 849 $CurrentClass_Short=~s/<.+>//g; 850 } 851 838 852 if($LINE=~/(\A|\s+)(public|protected|private)\s+/) { 839 853 $TypeAttr{"Access"} = $2; … … 885 899 $TypeAttr{"Static"} = 1; 886 900 } 901 902 if($TmplP) { 903 $TypeAttr{"GenericParam"} = $TmplP; 904 } 887 905 } 888 906 elsif(index($LINE, "Deprecated: true")!=-1 … … 919 937 chdir($In::Opt{"OrigDir"}); 920 938 939 if(my $Err = $?>>8) { 940 exitStatus("Error", "failed to run javap"); 941 } 942 921 943 if(not $NonEmpty) { 922 944 exitStatus("Error", "internal error in parser"); … … 961 983 $TypeInfo{$LVer}{$Tid}{"BaseType"} = $BaseTypeId; 962 984 $TypeInfo{$LVer}{$Tid}{"Type"} = "array"; 985 } 986 } 987 elsif($TName=~/(.+)\.\.\.\Z/) 988 { 989 if(my $BaseTypeId = registerType($1, $LVer)) 990 { 991 $TypeInfo{$LVer}{$Tid}{"BaseType"} = $BaseTypeId; 992 $TypeInfo{$LVer}{$Tid}{"Type"} = "variable-arity"; 963 993 } 964 994 }
Note:
See TracChangeset
for help on using the changeset viewer.
