Changeset 13595 in josm for trunk/tools/japicc/modules/Internals
- Timestamp:
- 2018-04-02T23:20:00+02:00 (7 years ago)
- Location:
- trunk/tools/japicc/modules/Internals
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/japicc/modules/Internals/APIDump.pm
r12872 r13595 2 2 # A module to create API dump from disassembled code 3 3 # 4 # Copyright (C) 2016-201 7Andrey Ponomarenko's ABI Laboratory4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 11 12 # 12 # This programis distributed in the hope that it will be useful,13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNUGeneral Public License for more details.15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 16 17 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; … … 110 112 { # 1, 2 - library, 0 - client 111 113 my ($LVer, $Path) = @_; 112 113 114 $Path = getAbsPath($Path); 114 my $JarCmd = getCmdPath("jar"); 115 if(not $JarCmd) { 116 exitStatus("Not_Found", "can't find \"jar\" command"); 117 } 115 116 my $ExtractCmd = undef; 117 118 if($Path=~/\.jar\Z/) 119 { 120 $ExtractCmd = getCmdPath("jar"); 121 if(not $ExtractCmd) { 122 exitStatus("Not_Found", "can't find \"jar\" command"); 123 } 124 $ExtractCmd .= " -xf \"$Path\""; 125 } 126 elsif($Path=~/\.jmod\Z/) 127 { 128 $ExtractCmd = getCmdPath("jmod"); 129 if(not $ExtractCmd) { 130 exitStatus("Not_Found", "can't find \"jmod\" command"); 131 } 132 $ExtractCmd .= " extract \"$Path\""; 133 } 134 else { 135 exitStatus("Error", "unknown format of \'$Path\'"); 136 } 137 118 138 my $ExtractPath = join_P($In::Opt{"Tmp"}, $ExtractCounter); 119 139 if(-d $ExtractPath) { … … 121 141 } 122 142 mkpath($ExtractPath); 143 123 144 chdir($ExtractPath); 124 system($ JarCmd." -xf \"$Path\"");145 system($ExtractCmd); 125 146 if($?) { 126 147 exitStatus("Error", "can't extract \'$Path\'"); 127 148 } 128 149 chdir($In::Opt{"OrigDir"}); 150 129 151 my @Classes = (); 130 152 foreach my $ClassPath (cmdFind($ExtractPath, "", "*\\.class")) … … 177 199 { 178 200 foreach my $SubArchive (cmdFind($ExtractPath, "", "*\\.jar")) 201 { # recursive step 202 readArchive($LVer, $SubArchive); 203 } 204 205 foreach my $SubArchive (cmdFind($ExtractPath, "", "*\\.jmod")) 179 206 { # recursive step 180 207 readArchive($LVer, $SubArchive); … … 305 332 306 333 my $TmpDir = $In::Opt{"Tmp"}; 334 my $DumpFile = undef; 335 336 if(defined $In::Opt{"Debug"}) 337 { 338 if(my $DebugDir = getDebugDir($LVer)) 339 { 340 mkpath($DebugDir); 341 $DumpFile = $DebugDir."/class-dump.txt"; 342 } 343 } 307 344 308 345 # ! private info should be processed … … 315 352 316 353 chdir($TmpDir."/".$ExtractCounter); 354 355 my ($Err, $ErrMsg) = (); 356 317 357 my $Pid = open3(*IN, *OUT, *ERR, @Cmd); 358 ($Err, $ErrMsg) = ($?, $!); 359 318 360 close(IN); 361 close(ERR); 362 363 chdir($In::Opt{"OrigDir"}); 364 365 if($Err==-1 and $Err>>8 and $ErrMsg) { 366 exitStatus("Error", "failed to run javap (".$ErrMsg.")"); 367 } 319 368 320 369 my (%TypeAttr, $CurrentMethod, $CurrentPackage, $CurrentClass, $CurrentClass_Short) = (); … … 324 373 my $InAnnotations_Class = undef; 325 374 my $InAnnotations_Method = undef; 326 my % AnnotationName = ();375 my %ConstantTypeName = (); 327 376 my %AnnotationNum = (); # support for Java 7 377 my %ConstantName = (); 328 378 329 379 my ($ParamPos, $FieldPos) = (0, 0); … … 331 381 332 382 my $DContent = ""; 333 my $Debug = (defined $In::Opt{"Debug"});334 383 335 384 while($Run) … … 343 392 } 344 393 345 if( $Debug) {394 if(defined $In::Opt{"Debug"}) { 346 395 $DContent .= $LINE; 347 396 } … … 463 512 $AName=~s/\//./g; 464 513 465 $ AnnotationName{$CNum} = $AName;514 $ConstantTypeName{$CNum} = $AName; 466 515 467 516 if(defined $AnnotationNum{$CNum}) … … 471 520 } 472 521 delete($AnnotationNum{$CNum}); 522 } 523 } 524 elsif($LINE=~/=\s*(Utf8|Integer|Long|Float|Double)\s+(.*?)\Z/) 525 { 526 if($1 eq "Utf8") { 527 $ConstantName{$CNum} = "\"".$2."\""; 528 } 529 else { 530 $ConstantName{$CNum} = $2; 473 531 } 474 532 } … … 557 615 if($LINE=~/\A\s*\d+\:\s*#(\d+)/) 558 616 { 559 if(my $AName = $ AnnotationName{$1})617 if(my $AName = $ConstantTypeName{$1}) 560 618 { 561 619 if($InAnnotations_Class) { … … 678 736 my $LINE_N = <OUT>; 679 737 680 if( $Debug) {738 if(defined $In::Opt{"Debug"}) { 681 739 $DContent .= $LINE_N; 682 740 } … … 758 816 759 817 my $LINE_NP = <OUT>; 760 if( $Debug) {818 if(defined $In::Opt{"Debug"}) { 761 819 $DContent .= $LINE_NP; 762 820 } … … 773 831 774 832 $LINE_NP = <OUT>; 775 if( $Debug) {833 if(defined $In::Opt{"Debug"}) { 776 834 $DContent .= $LINE_NP; 777 835 } … … 780 838 { # flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ANNOTATION 781 839 $LINE_NP = <OUT>; 782 if( $Debug) {840 if(defined $In::Opt{"Debug"}) { 783 841 $DContent .= $LINE_NP; 784 842 } … … 821 879 822 880 %TypeAttr = ("Type"=>$2, "Name"=>$3); # reset previous class 823 % AnnotationName = (); # reset annotations of the class881 %ConstantTypeName = (); # reset annotations of the class 824 882 %AnnotationNum = (); # support for Java 7 883 %ConstantName = (); 825 884 $InAnnotations_Class = 1; 826 885 … … 923 982 $InAnnotations = undef; 924 983 } 984 elsif($CurrentMethod and index($LINE, "default_value")!=-1) 985 { 986 if($LINE=~/default_value:\s*[sISJBFDCZ]#(\d+)/) 987 { 988 if(defined $ConstantName{$1}) { 989 $MethodInfo{$LVer}{$MName_Mid{$CurrentMethod}}{"Default"} = $ConstantName{$1}; 990 } 991 } 992 elsif($LINE=~/default_value:\s*e#(\d+)\.#(\d+)/) 993 { 994 my ($ET, $EV) = ($1, $2); 995 if(defined $ConstantTypeName{$ET} and defined $ConstantName{$EV}) 996 { 997 $ET = $ConstantTypeName{$ET}; 998 $EV = $ConstantName{$EV}; 999 $EV=~s/\"//g; 1000 $MethodInfo{$LVer}{$MName_Mid{$CurrentMethod}}{"Default"} = $ET.".".$EV; 1001 } 1002 } 1003 elsif($LINE=~/default_value:\s*\[(.*)\]/) 1004 { 1005 my $Arr = $1; 1006 if($Arr) 1007 { 1008 my @ArrU = (); 1009 foreach my $ArrP (split(/\s*,\s*/, $Arr)) 1010 { 1011 if($ArrP=~/[sISJBFDCZ]#(\d+)/) { 1012 push(@ArrU, $ConstantName{$1}); 1013 } 1014 } 1015 $MethodInfo{$LVer}{$MName_Mid{$CurrentMethod}}{"Default"} = "{".join(",", @ArrU)."}"; 1016 } 1017 else { 1018 $MethodInfo{$LVer}{$MName_Mid{$CurrentMethod}}{"Default"} = "{}"; 1019 } 1020 } 1021 } 925 1022 else 926 1023 { … … 935 1032 936 1033 waitpid($Pid, 0); 937 chdir($In::Opt{"OrigDir"}); 938 939 if(my $Err = $?>>8) { 940 exitStatus("Error", "failed to run javap"); 941 } 1034 close(OUT); 942 1035 943 1036 if(not $NonEmpty) { … … 945 1038 } 946 1039 947 if( $Debug) {948 appendFile( getDebugDir($LVer)."/class-dump.txt", $DContent);1040 if(defined $In::Opt{"Debug"}) { 1041 appendFile($DumpFile, $DContent); 949 1042 } 950 1043 } -
trunk/tools/japicc/modules/Internals/Basic.pm
r12872 r13595 2 2 # A module with simple functions 3 3 # 4 # Copyright (C) 2016-201 7Andrey Ponomarenko's ABI Laboratory4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 11 # 12 # This program is distributed in the hope that it will be useful, 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 12 # 13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 17 # 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; -
trunk/tools/japicc/modules/Internals/Descriptor.pm
r11682 r13595 2 2 # A module to handle XML descriptors 3 3 # 4 # Copyright (C) 2016 Andrey Ponomarenko's ABI Laboratory 4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 11 12 # 12 # This programis distributed in the hope that it will be useful,13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNUGeneral Public License for more details.15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 16 17 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; … … 29 31 } 30 32 31 if(-d $Path or $Path=~/\. jar\Z/)33 if(-d $Path or $Path=~/\.(jar|jmod)\Z/) 32 34 { 33 35 return " -
trunk/tools/japicc/modules/Internals/Filter.pm
r12872 r13595 2 2 # A module to filter API symbols 3 3 # 4 # Copyright (C) 2016-201 7Andrey Ponomarenko's ABI Laboratory4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 11 # 12 # This program is distributed in the hope that it will be useful, 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 12 # 13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 17 # 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; … … 89 91 90 92 return 1; 93 } 94 95 sub nonImplClass($) 96 { 97 my $Class = $_[0]; 98 99 if(defined $In::Opt{"NonImplAll"}) { 100 return 1; 101 } 102 103 if(defined $In::Opt{"NonImplClassesList"}) 104 { # user defined classes 105 if(defined $In::Opt{"NonImplClasses"}{$Class->{"Name"}}) { 106 return 1; 107 } 108 } 109 110 return 0; 91 111 } 92 112 -
trunk/tools/japicc/modules/Internals/Input.pm
r11682 r13595 2 2 # A module to handle input data 3 3 # 4 # Copyright (C) 2016 Andrey Ponomarenko's ABI Laboratory 4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 11 12 # 12 # This programis distributed in the hope that it will be useful,13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNUGeneral Public License for more details.15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 16 17 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 package In; -
trunk/tools/japicc/modules/Internals/Logging.pm
r11682 r13595 2 2 # A module for logging 3 3 # 4 # Copyright (C) 2016-201 7Andrey Ponomarenko's ABI Laboratory4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 11 12 # 12 # This programis distributed in the hope that it will be useful,13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNUGeneral Public License for more details.15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 16 17 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; … … 47 49 my ($Code, $Msg) = @_; 48 50 print STDERR "ERROR: ". $Msg."\n"; 51 if(my $Orig = $In::Opt{"OrigDir"}) { 52 chdir($Orig); 53 } 49 54 exit($ERROR_CODE{$Code}); 50 55 } -
trunk/tools/japicc/modules/Internals/Mangling.pm
r11682 r13595 2 2 # A module to unmangle symbols 3 3 # 4 # Copyright (C) 2016 Andrey Ponomarenko's ABI Laboratory 4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 11 12 # 12 # This programis distributed in the hope that it will be useful,13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNUGeneral Public License for more details.15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 16 17 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; … … 66 68 $CurParam = "short"; 67 69 } 68 elsif($Symbol eq "S") {69 $CurParam = "short";70 }71 70 elsif($Symbol eq "I") { 72 71 $CurParam = "int"; … … 80 79 elsif($Symbol eq "D") { 81 80 $CurParam = "double"; 81 } 82 elsif($Symbol eq "Z") { 83 $CurParam = "boolean"; 82 84 } 83 85 else { -
trunk/tools/japicc/modules/Internals/Path.pm
r11682 r13595 2 2 # A module with functions to handle paths 3 3 # 4 # Copyright (C) 2017 Andrey Ponomarenko's ABI Laboratory 4 # Copyright (C) 2017-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 11 12 # 12 # This programis distributed in the hope that it will be useful,13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNUGeneral Public License for more details.15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 16 17 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; -
trunk/tools/japicc/modules/Internals/RegTests.pm
r12872 r13595 2 2 # A module with regression test suite 3 3 # 4 # Copyright (C) 2016-201 7Andrey Ponomarenko's ABI Laboratory4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 11 12 # 12 # This programis distributed in the hope that it will be useful,13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNUGeneral Public License for more details.15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 16 17 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; … … 384 386 }"); 385 387 388 # Added vararg parameter 389 writeFile($Path_v1."/AddedVarargParam.java", 390 "package $PackageName; 391 public class AddedVarargParam { 392 public void method(Integer x, String... y) { } 393 }"); 394 writeFile($Path_v2."/AddedVarargParam.java", 395 "package $PackageName; 396 public class AddedVarargParam { 397 public void method(Integer x, String... y) { } 398 }"); 399 400 writeFile($TestsPath."/Test_AddedVarargParam.java", 401 "import $PackageName.*; 402 public class Test_AddedVarargParam 403 { 404 public static void main(String[] args) { 405 AddedVarargParam X = new AddedVarargParam(); 406 X.method(0); 407 } 408 }"); 409 386 410 # Removed_Annotation 387 411 writeFile($Path_v1."/RemovedAnnotation.java", … … 402 426 }"); 403 427 428 # Changed Annotation 429 writeFile($Path_v1."/ChangedAnnotation.java", 430 "package $PackageName; 431 432 enum MyEnum { 433 SUNDAY, MONDAY 434 } 435 436 public \@interface ChangedAnnotation { 437 String value(); 438 String datatype() default \"Str\"; 439 int num1() default 1; 440 String[] values() default {\"Alice\", \"Bob\", \"Cindy\"}; 441 int[] nums() default {1, 2, 3}; 442 String safe_change() default \"Str\"; 443 MyEnum day() default MyEnum.SUNDAY; 444 short num2() default 1; 445 long num3() default 1; 446 byte num4() default 1; 447 float num5() default 1.5f; 448 double num6() default 1.5; 449 boolean bit() default true; 450 char ch() default 'A'; 451 }"); 452 453 writeFile($Path_v2."/ChangedAnnotation.java", 454 "package $PackageName; 455 456 enum MyEnum { 457 SUNDAY, MONDAY 458 } 459 460 public \@interface ChangedAnnotation { 461 String value() default \"Str\"; 462 String datatype(); 463 int[] values(); 464 int[] nums() default {1, 2}; 465 int[] new_default_param() default {1, 2}; 466 int[] new_param(); 467 String[] safe_change() default {\"Str\"}; 468 MyEnum day() default MyEnum.MONDAY; 469 }"); 470 471 writeFile($TestsPath."/Test_ChangedAnnotation.java", 472 "import $PackageName.*; 473 public class Test_ChangedAnnotation { 474 public static void main(String[] args) { 475 testMethod(); 476 } 477 478 \@ChangedAnnotation(value=\"Val\") 479 static void testMethod() { 480 } 481 }"); 482 404 483 # Beta Annotation 405 484 writeFile($Path_v1."/Beta.java", … … 752 831 "package $PackageName; 753 832 public class ChangedFinalFieldValue { 754 public final int field = 1; 833 enum MyEnum { 834 ONE, TWO 835 } 836 public final int field1 = 1; 755 837 public final String field2 = \" \"; 838 public final MyEnum field3 = MyEnum.ONE; 756 839 }"); 757 840 writeFile($Path_v2."/ChangedFinalFieldValue.java", 758 841 "package $PackageName; 759 842 public class ChangedFinalFieldValue { 760 public final int field = 2; 843 enum MyEnum { 844 ONE, TWO 845 } 846 public final int field1 = 2; 761 847 public final String field2 = \"newValue\"; 848 public final MyEnum field3 = MyEnum.TWO; 762 849 }"); 763 850 … … 1920 2007 $Cmd .= " -old-style"; 1921 2008 } 2009 if(my $JdkPath = $In::Opt{"JdkPath"}) { 2010 $Cmd .= " -jdk-path \"$JdkPath\""; 2011 } 1922 2012 1923 2013 my $TmpDir = $In::Opt{"Tmp"}; -
trunk/tools/japicc/modules/Internals/SysFiles.pm
r12872 r13595 2 2 # A module to find system files 3 3 # 4 # Copyright (C) 2016-201 7Andrey Ponomarenko's ABI Laboratory4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 11 # 12 # This program is distributed in the hope that it will be useful, 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 12 # 13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 17 # 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; … … 225 227 } 226 228 229 sub getArchivePaths($$) 230 { 231 my ($Dest, $LVer) = @_; 232 if(-f $Dest) { 233 return ($Dest); 234 } 235 elsif(-d $Dest) 236 { 237 $Dest=~s/[\/\\]+\Z//g; 238 next if(not $Dest); 239 240 my @Archives = (); 241 foreach my $Path (cmdFind($Dest, "", "*\\.jar")) 242 { 243 next if(ignorePath($Path, $Dest)); 244 push(@Archives, realpath_F($Path)); 245 } 246 foreach my $Path (cmdFind($Dest, "", "*\\.jmod")) 247 { 248 next if(ignorePath($Path, $Dest)); 249 push(@Archives, realpath_F($Path)); 250 } 251 return @Archives; 252 } 253 return (); 254 } 255 227 256 return 1; -
trunk/tools/japicc/modules/Internals/TypeAttr.pm
r12872 r13595 2 2 # A module to handle type attributes 3 3 # 4 # Copyright (C) 2016 Andrey Ponomarenko's ABI Laboratory 4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 11 12 # 12 # This programis distributed in the hope that it will be useful,13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNUGeneral Public License for more details.15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 16 17 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; -
trunk/tools/japicc/modules/Internals/Utils.pm
r12872 r13595 2 2 # A module with basic functions 3 3 # 4 # Copyright (C) 2016-201 7Andrey Ponomarenko's ABI Laboratory4 # Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory 5 5 # 6 6 # Written by Andrey Ponomarenko 7 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License or the GNU Lesser 10 # General Public License as published by the Free Software Foundation. 11 # 12 # This program is distributed in the hope that it will be useful, 8 # This library is free software; you can redistribute it and/or 9 # modify it under the terms of the GNU Lesser General Public 10 # License as published by the Free Software Foundation; either 11 # version 2.1 of the License, or (at your option) any later version. 12 # 13 # This library is distributed in the hope that it will be useful, 13 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # and the GNU Lesser General Public License along with this program. 19 # If not, see <http://www.gnu.org/licenses/>. 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # Lesser General Public License for more details. 17 # 18 # You should have received a copy of the GNU Lesser General Public 19 # License along with this library; if not, write to the Free Software 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 # MA 02110-1301 USA. 20 22 ########################################################################### 21 23 use strict; … … 189 191 push(@AbsPaths, $Path); 190 192 } 193 194 @AbsPaths = sort(@AbsPaths); 195 191 196 return @AbsPaths; 192 197 } … … 223 228 @Files = grep { /$Name/ } @Files; 224 229 } 230 231 @Files = sort(@Files); 232 225 233 return @Files; 226 234 }
Note:
See TracChangeset
for help on using the changeset viewer.