Changeset 13595 in josm for trunk/tools/japicc


Ignore:
Timestamp:
2018-04-02T23:20:00+02:00 (23 months ago)
Author:
Don-vip
Message:

tools update: Groovy 2.4.15, PMD 6.2.0, JAPICC 2.4

Location:
trunk/tools/japicc
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/japicc/japi-compliance-checker.pl

    r12872 r13595  
    11#!/usr/bin/perl
    2 ###########################################################################
    3 # Java API Compliance Checker (JAPICC) 2.3
     2#########################################################################
     3# Java API Compliance Checker (JAPICC) 2.4
    44# A tool for checking backward compatibility of a Java library API
    55#
    66# Written by Andrey Ponomarenko
    77#
    8 # Copyright (C) 2011-2017 Andrey Ponomarenko's ABI Laboratory
     8# Copyright (C) 2011-2018 Andrey Ponomarenko's ABI Laboratory
    99#
    1010# PLATFORMS
     
    1515# ============
    1616#  Linux, FreeBSD, Mac OS X
    17 #    - JDK or OpenJDK - development files (javap, javac)
     17#    - JDK or OpenJDK - development files (javap, javac, jar, jmod)
    1818#    - Perl 5 (5.8 or newer)
    1919#
    2020#  MS Windows
    21 #    - JDK or OpenJDK (javap, javac)
     21#    - JDK or OpenJDK (javap, javac, jar, jmod)
    2222#    - Active Perl 5 (5.8 or newer)
    2323#
    24 # This program is free software: you can redistribute it and/or modify
    25 # it under the terms of the GNU General Public License or the GNU Lesser
    26 # General Public License as published by the Free Software Foundation.
     24# This library is free software; you can redistribute it and/or
     25# modify it under the terms of the GNU Lesser General Public
     26# License as published by the Free Software Foundation; either
     27# version 2.1 of the License, or (at your option) any later version.
    2728#
    28 # This program is distributed in the hope that it will be useful,
     29# This library is distributed in the hope that it will be useful,
    2930# but WITHOUT ANY WARRANTY; without even the implied warranty of
    30 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    31 # GNU General Public License for more details.
     31# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     32# Lesser General Public License for more details.
    3233#
    33 # You should have received a copy of the GNU General Public License
    34 # and the GNU Lesser General Public License along with this program.
    35 # If not, see <http://www.gnu.org/licenses/>.
    36 ###########################################################################
     34# You should have received a copy of the GNU Lesser General Public
     35# License along with this library; if not, write to the Free Software
     36# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
     37# MA  02110-1301  USA.
     38#########################################################################
    3739use Getopt::Long;
    3840Getopt::Long::Configure ("posix_default", "no_ignore_case", "permute");
     
    4345use Data::Dumper;
    4446
    45 my $TOOL_VERSION = "2.3";
    46 my $API_DUMP_VERSION = "2.2";
     47my $TOOL_VERSION = "2.4";
     48my $API_DUMP_VERSION = "2.4";
    4749my $API_DUMP_VERSION_MIN = "2.2";
    4850
     
    7880my $ShortUsage = "Java API Compliance Checker (JAPICC) $TOOL_VERSION
    7981A tool for checking backward compatibility of a Java library API
    80 Copyright (C) 2017 Andrey Ponomarenko's ABI Laboratory
    81 License: GNU LGPL or GNU GPL
     82Copyright (C) 2018 Andrey Ponomarenko's ABI Laboratory
     83License: LGPLv2.1+
    8284
    8385Usage: $CmdName [options]
    84 Example: $CmdName OLD.jar NEW.jar
     86Example:
     87 $CmdName OLD.jar NEW.jar
     88 $CmdName OLD.jmod NEW.jmod
    8589
    8690More info: $CmdName --help";
     
    110114  "skip-internal-types=s" => \$In::Opt{"SkipInternalTypes"},
    111115  "dump|dump-api=s" => \$In::Opt{"DumpAPI"},
     116  "check-annotations!" => \$In::Opt{"CheckAnnotations"},
    112117  "check-packages=s" => \$In::Opt{"CheckPackages"},
    113118  "classes-list=s" => \$In::Opt{"ClassListPath"},
     
    117122  "skip-classes=s" => \$In::Opt{"SkipClassesList"},
    118123  "skip-packages=s" => \$In::Opt{"SkipPackagesList"},
     124  "non-impl=s" => \$In::Opt{"NonImplClassesList"},
     125  "non-impl-all!" => \$In::Opt{"NonImplAll"},
    119126  "short" => \$In::Opt{"ShortMode"},
    120127  "dump-path=s" => \$In::Opt{"OutputDumpPath"},
     
    189196
    190197  This tool is free software: you can redistribute it and/or modify it
    191   under the terms of the GNU LGPL or GNU GPL.
     198  under the terms of the GNU LGPL.
    192199
    193200USAGE:
    194201  $CmdName [options]
    195202
    196 EXAMPLE 1:
     203EXAMPLE (1):
    197204  $CmdName OLD.jar NEW.jar
    198205
    199 EXAMPLE 2:
     206EXAMPLE (2):
     207  $CmdName OLD.jmod NEW.jmod
     208
     209EXAMPLE (3):
    200210  $CmdName -lib NAME -old OLD.xml -new NEW.xml
    201211  OLD.xml and NEW.xml are XML-descriptors:
     
    206216   
    207217    <archives>
    208         /path1/to/JAR(s)/
    209         /path2/to/JAR(s)/
     218        /path1/to/JAR(s) OR JMOD(s)/
     219        /path2/to/JAR(s) OR JMOD(s)/
    210220        ...
    211221    </archives>
     
    229239      It may be one of the following:
    230240     
    231          1. Java archive (*.jar)
     241         1. Java archive (*.jar or *.jmod)
    232242         2. XML-descriptor (VERSION.xml file):
    233243
     
    237247             
    238248              <archives>
    239                   /path1/to/JAR(s)/
    240                   /path2/to/JAR(s)/
     249                  /path1/to/JAR(s) OR JMOD(s)/
     250                  /path2/to/JAR(s) OR JMOD(s)/
    241251                   ...
    242252              </archives>
     
    246256         3. API dump generated by -dump option
    247257
    248       If you are using *.jar as a descriptor then you should
    249       specify version numbers with -v1 and -v2 options too.
    250       If version numbers are not specified then the tool will
    251       try to detect them automatically.
     258      If you are using *.jar or *.jmod as a descriptor then
     259      you should specify version numbers with -v1 and -v2
     260      options too. If version numbers are not specified then
     261      the tool will try to detect them automatically.
    252262
    253263  -new|-d2 PATH
     
    304314      for debugging the tool. PATH is the path to the Java archive or
    305315      XML descriptor of the library.
     316 
     317  -check-annotations
     318      Check for changes in annotations like in any other interfaces.
    306319 
    307320  -check-packages PATTERN
     
    325338     
    326339  -skip-classes PATH
    327       This option allows to specify a file with a list
    328       of classes that should not be checked.
    329      
     340      List of classes that should not be checked.
     341 
    330342  -skip-packages PATH
    331       This option allows to specify a file with a list
    332       of packages that should not be checked.
    333      
     343      List of packages that should not be checked.
     344 
     345  -non-impl PATH
     346      List of interfaces that should not be implemented by users.
     347 
     348  -non-impl-all
     349      All interfaces should not be implemented by users.
     350 
    334351  -short
    335352      Do not list added/removed methods.
     
    805822                }
    806823            }
     824           
     825            if(defined $Class1->{"Annotation"})
     826            {
     827                my %AnnParam = ();
     828                foreach my $VN (1, 2)
     829                {
     830                    foreach my $Method (keys(%{$Class_Methods{$VN}{$ClassName}}))
     831                    {
     832                        my $MInfo = $MethodInfo{$VN}{$Method};
     833                        $AnnParam{$VN}{$MInfo->{"ShortName"}} = {"Default"=>$MInfo->{"Default"}, "Return"=>getTypeName($MInfo->{"Return"}, $VN)};
     834                    }
     835                }
     836                foreach my $AParam (sort keys(%{$AnnParam{1}}))
     837                {
     838                    my $R1 = $AnnParam{1}{$AParam}{"Return"};
     839                    my $D1 = $AnnParam{1}{$AParam}{"Default"};
     840                   
     841                    if(defined $AnnParam{2}{$AParam})
     842                    {
     843                        my $R2 = $AnnParam{2}{$AParam}{"Return"};
     844                        my $D2 = $AnnParam{2}{$AParam}{"Default"};
     845                       
     846                        if($R1 ne $R2)
     847                        {
     848                            if($R1 eq "java.lang.String" and $R2 eq "java.lang.String[]")
     849                            {
     850                                %{$CompatProblems{".client_method"}{"Annotation_Element_Changed_Type_Safe"}{$AParam}} = (
     851                                    "Type_Name"=>$ClassName,
     852                                    "Old_Value"=>$R1,
     853                                    "New_Value"=>$R2,
     854                                    "Target"=>$AParam);
     855                            }
     856                            else
     857                            {
     858                                %{$CompatProblems{".client_method"}{"Annotation_Element_Changed_Type"}{$AParam}} = (
     859                                    "Type_Name"=>$ClassName,
     860                                    "Old_Value"=>$R1,
     861                                    "New_Value"=>$R2,
     862                                    "Target"=>$AParam);
     863                            }
     864                        }
     865                       
     866                        if(defined $D1 and not defined $D2)
     867                        {
     868                            %{$CompatProblems{".client_method"}{"Annotation_Element_Removed_Default_Value"}{$AParam}} = (
     869                                "Type_Name"=>$ClassName,
     870                                "Old_Value"=>$D1,
     871                                "Target"=>$AParam);
     872                        }
     873                        elsif(not defined $D1 and defined $D2)
     874                        {
     875                            %{$CompatProblems{".client_method"}{"Annotation_Element_Added_Default_Value"}{$AParam}} = (
     876                                "Type_Name"=>$ClassName,
     877                                "New_Value"=>$D2,
     878                                "Target"=>$AParam);
     879                        }
     880                        elsif($D1 ne $D2)
     881                        {
     882                            %{$CompatProblems{".client_method"}{"Annotation_Element_Changed_Default_Value"}{$AParam}} = (
     883                                "Type_Name"=>$ClassName,
     884                                "Old_Value"=>$D1,
     885                                "New_Value"=>$D2,
     886                                "Target"=>$AParam);
     887                        }
     888                    }
     889                    else
     890                    {
     891                        if(defined $D1)
     892                        {
     893                            %{$CompatProblems{".client_method"}{"Removed_Annotation_Default_Element"}{$AParam}} = (
     894                                "Type_Name"=>$ClassName,
     895                                "Elem_Type"=>$R1,
     896                                "Old_Value"=>$D1,
     897                                "Target"=>$AParam);
     898                        }
     899                        else
     900                        {
     901                            %{$CompatProblems{".client_method"}{"Removed_Annotation_NonDefault_Element"}{$AParam}} = (
     902                                "Type_Name"=>$ClassName,
     903                                "Elem_Type"=>$R1,
     904                                "Target"=>$AParam);
     905                        }
     906                    }
     907                }
     908               
     909                foreach my $AParam (sort keys(%{$AnnParam{2}}))
     910                {
     911                    if(not defined $AnnParam{1}{$AParam})
     912                    {
     913                        my $R2 = $AnnParam{2}{$AParam}{"Return"};
     914                       
     915                        if(defined $AnnParam{2}{$AParam}{"Default"})
     916                        {
     917                            my $D2 = $AnnParam{2}{$AParam}{"Default"};
     918                            %{$CompatProblems{".client_method"}{"Added_Annotation_Default_Element"}{$AParam}} = (
     919                                "Type_Name"=>$ClassName,
     920                                "Elem_Type"=>$R2,
     921                                "New_Value"=>$D2,
     922                                "Target"=>$AParam);
     923                        }
     924                        else
     925                        {
     926                            %{$CompatProblems{".client_method"}{"Added_Annotation_NonDefault_Element"}{$AParam}} = (
     927                                "Type_Name"=>$ClassName,
     928                                "Elem_Type"=>$R2,
     929                                "Target"=>$AParam);
     930                        }
     931                    }
     932                }
     933            }
    807934        }
    808935        else
     
    10511178        else
    10521179        {
    1053             if(my @InvokedBy = sort keys(%{$MethodUsed{2}{$AddedMethod}}))
     1180            if(nonImplClass(\%Type1))
     1181            {
     1182                %{$SubProblems{"NonImpl_Interface_Added_Abstract_Method"}{getSFormat($AddedMethod)}} = (
     1183                    "Type_Name"=>$Type1{"Name"},
     1184                    "Type_Type"=>$Type1{"Type"},
     1185                    "Target"=>$AddedMethod);
     1186            }
     1187            elsif(my @InvokedBy = sort keys(%{$MethodUsed{2}{$AddedMethod}}))
    10541188            {
    10551189                %{$SubProblems{"Interface_Added_Abstract_Method_Invoked_By_Others"}{getSFormat($AddedMethod)}} = (
     
    17541888       
    17551889        my $ClassId1 = $MethodInfo{1}{$Method}{"Class"};
    1756         my $Class1_Name = getTypeName($ClassId1, 1);
    1757         my $Class1_Type = getTypeType($ClassId1, 1);
     1890        my $Class1 = getType($ClassId1, 1);
     1891       
     1892        if(not defined $In::Opt{"CheckAnnotations"} and $Class1->{"Annotation"}) {
     1893            next;
     1894        }
     1895       
     1896        my $Class1_Name = $Class1->{"Name"};
     1897        my $Class1_Type = $Class1->{"Type"};
    17581898       
    17591899        $CheckedTypes{$Class1_Name} = 1;
     
    25202660    foreach my $Method (sort keys(%CompatProblems))
    25212661    {
    2522         foreach my $Kind (keys(%{$CompatProblems{$Method}}))
     2662        foreach my $Kind (sort keys(%{$CompatProblems{$Method}}))
    25232663        {
    25242664            if(not defined $CompatRules{"Binary"}{$Kind} and not defined $CompatRules{"Source"}{$Kind})
     
    25272667                { # only one warning
    25282668                    printMsg("WARNING", "unknown rule \"$Kind\" (\"$Level\")");
    2529                     $UnknownRules{$Level}{$Kind}=1;
     2669                    $UnknownRules{$Level}{$Kind} = 1;
    25302670                }
    25312671            }
     
    26942834    $Checked_Archives_Link = "<a href='#Checked_Archives' style='color:Blue;'>".keys(%{$LibArchives{1}})."</a>" if(keys(%{$LibArchives{1}})>0);
    26952835   
    2696     $TestResults .= "<tr><th>Total JARs</th><td>$Checked_Archives_Link</td></tr>\n";
     2836    $TestResults .= "<tr><th>Total Java Modules</th><td>$Checked_Archives_Link</td></tr>\n";
    26972837    $TestResults .= "<tr><th>Total Methods / Classes</th><td>".keys(%CheckedMethods)." / ".keys(%CheckedTypes)."</td></tr>\n";
    26982838   
     
    33633503{
    33643504    my ($Name, $Html, $LVer) = @_;
    3365     my $TType = $TypeInfo{$LVer}{$TName_Tid{$LVer}{$Name}}{"Type"};
     3505    my $TInfo = $TypeInfo{$LVer}{$TName_Tid{$LVer}{$Name}};
     3506    my $TType = $TInfo->{"Type"};
     3507   
     3508    if($TInfo->{"Annotation"}) {
     3509        $TType = '@'.$TType;
     3510    }
     3511   
    33663512    if($Html) {
    33673513        $Name = "<span class='ttype'>".$TType."</span> ".specChars($Name);
     
    38944040    $Head .= "<head>\n";
    38954041    $Head .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
     4042    $Head .= "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />\n";
    38964043    $Head .= "<meta name=\"keywords\" content=\"$Keywords\" />\n";
    38974044    $Head .= "<meta name=\"description\" content=\"$Description\" />\n";
     
    39734120           
    39744121            my $Class = getType($MethodInfo{2}{$Method}{"Class"}, 2);
     4122           
     4123            if(not defined $In::Opt{"CheckAnnotations"} and $Class->{"Annotation"}) {
     4124                next;
     4125            }
    39754126           
    39764127            $CheckedTypes{$Class->{"Name"}} = 1;
     
    40484199            my $Class = getType($MethodInfo{1}{$Method}{"Class"}, 1);
    40494200           
     4201            if(not defined $In::Opt{"CheckAnnotations"} and $Class->{"Annotation"}) {
     4202                next;
     4203            }
     4204           
    40504205            $CheckedTypes{$Class->{"Name"}} = 1;
    40514206            $CheckedMethods{$Method} = 1;
     
    40794234}
    40804235
    4081 sub getArchivePaths($$)
    4082 {
    4083     my ($Dest, $LVer) = @_;
    4084     if(-f $Dest) {
    4085         return ($Dest);
    4086     }
    4087     elsif(-d $Dest)
    4088     {
    4089         $Dest=~s/[\/\\]+\Z//g;
    4090         next if(not $Dest);
    4091        
    4092         my @Archives = ();
    4093         foreach my $Path (cmdFind($Dest, "", "*\\.jar"))
    4094         {
    4095             next if(ignorePath($Path, $Dest));
    4096             push(@Archives, realpath_F($Path));
    4097         }
    4098         return @Archives;
    4099     }
    4100     return ();
    4101 }
    4102 
    41034236sub isCyclical($$) {
    41044237    return (grep {$_ eq $_[1]} @{$_[0]});
     
    42064339    }
    42074340   
    4208     if($Path!~/\.jar\Z/i) {
     4341    if($Path!~/\.(jar|jmod)\Z/i) {
    42094342        return;
    42104343    }
     
    42124345    my $Ver = undef;
    42134346   
    4214     if(not defined $Ver) {
    4215         $Ver = getManifestVersion(getAbsPath($Path));
     4347    if($Path=~/\.jar\Z/i)
     4348    {
     4349        if(not defined $Ver) {
     4350            $Ver = getManifestVersion(getAbsPath($Path));
     4351        }
    42164352    }
    42174353   
     
    48755011    if(defined $In::Opt{"ShowVersion"})
    48765012    {
    4877         printMsg("INFO", "Java API Compliance Checker (JAPICC) $TOOL_VERSION\nCopyright (C) 2017 Andrey Ponomarenko's ABI Laboratory\nLicense: LGPL or GPL <http://www.gnu.org/licenses/>\nThis program is free software: you can redistribute it and/or modify it.\n\nWritten by Andrey Ponomarenko.");
     5013        printMsg("INFO", "Java API Compliance Checker (JAPICC) $TOOL_VERSION\nCopyright (C) 2018 Andrey Ponomarenko's ABI Laboratory\nLicense: LGPLv2.1+ <http://www.gnu.org/licenses/>\nThis program is free software: you can redistribute it and/or modify it.\n\nWritten by Andrey Ponomarenko.");
    48785014        exit(0);
    48795015    }
     
    49115047        if($In::Opt{"DumpAPI"})
    49125048        {
    4913             if($In::Opt{"DumpAPI"}=~/\.jar\Z/)
     5049            if($In::Opt{"DumpAPI"}=~/\.(jar|jmod)\Z/)
    49145050            { # short usage
    49155051                my ($Name, $Version) = getPkgVersion(getFilename($In::Opt{"DumpAPI"}));
     
    49255061        else
    49265062        {
    4927             if($In::Desc{1}{"Path"}=~/\.jar\Z/ and $In::Desc{2}{"Path"}=~/\.jar\Z/)
     5063            if($In::Desc{1}{"Path"}=~/\.(jar|jmod)\Z/ and $In::Desc{2}{"Path"}=~/\.(jar|jmod)\Z/)
    49285064            { # short usage
    49295065                my ($Name1, $Version1) = getPkgVersion(getFilename($In::Desc{1}{"Path"}));
     
    49995135        }
    50005136    }
     5137    if(my $NonImplClassesList = $In::Opt{"NonImplClassesList"})
     5138    {
     5139        if(not -f $NonImplClassesList) {
     5140            exitStatus("Access_Error", "can't access file \'$NonImplClassesList\'");
     5141        }
     5142        foreach my $Class (split(/\n/, readFile($NonImplClassesList)))
     5143        {
     5144            $Class=~s/\//./g;
     5145            $In::Opt{"NonImplClasses"}{$Class} = 1;
     5146        }
     5147    }
    50015148    if(my $SkipPackagesList = $In::Opt{"SkipPackagesList"})
    50025149    {
  • trunk/tools/japicc/modules/Internals/APIDump.pm

    r12872 r13595  
    22# A module to create API dump from disassembled code
    33#
    4 # Copyright (C) 2016-2017 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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.
    1112#
    12 # This program is distributed in the hope that it will be useful,
     13# This library is distributed in the hope that it will be useful,
    1314# 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.
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16# Lesser General Public License for more details.
    1617#
    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.
    2022###########################################################################
    2123use strict;
     
    110112{ # 1, 2 - library, 0 - client
    111113    my ($LVer, $Path) = @_;
    112    
    113114    $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   
    118138    my $ExtractPath = join_P($In::Opt{"Tmp"}, $ExtractCounter);
    119139    if(-d $ExtractPath) {
     
    121141    }
    122142    mkpath($ExtractPath);
     143   
    123144    chdir($ExtractPath);
    124     system($JarCmd." -xf \"$Path\"");
     145    system($ExtractCmd);
    125146    if($?) {
    126147        exitStatus("Error", "can't extract \'$Path\'");
    127148    }
    128149    chdir($In::Opt{"OrigDir"});
     150   
    129151    my @Classes = ();
    130152    foreach my $ClassPath (cmdFind($ExtractPath, "", "*\\.class"))
     
    177199    {
    178200        foreach my $SubArchive (cmdFind($ExtractPath, "", "*\\.jar"))
     201        { # recursive step
     202            readArchive($LVer, $SubArchive);
     203        }
     204       
     205        foreach my $SubArchive (cmdFind($ExtractPath, "", "*\\.jmod"))
    179206        { # recursive step
    180207            readArchive($LVer, $SubArchive);
     
    305332   
    306333    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    }
    307344   
    308345    # ! private info should be processed
     
    315352   
    316353    chdir($TmpDir."/".$ExtractCounter);
     354   
     355    my ($Err, $ErrMsg) = ();
     356   
    317357    my $Pid = open3(*IN, *OUT, *ERR, @Cmd);
     358    ($Err, $ErrMsg) = ($?, $!);
     359   
    318360    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    }
    319368   
    320369    my (%TypeAttr, $CurrentMethod, $CurrentPackage, $CurrentClass, $CurrentClass_Short) = ();
     
    324373    my $InAnnotations_Class = undef;
    325374    my $InAnnotations_Method = undef;
    326     my %AnnotationName = ();
     375    my %ConstantTypeName = ();
    327376    my %AnnotationNum = (); # support for Java 7
     377    my %ConstantName = ();
    328378   
    329379    my ($ParamPos, $FieldPos) = (0, 0);
     
    331381   
    332382    my $DContent = "";
    333     my $Debug = (defined $In::Opt{"Debug"});
    334383   
    335384    while($Run)
     
    343392            }
    344393           
    345             if($Debug) {
     394            if(defined $In::Opt{"Debug"}) {
    346395                $DContent .= $LINE;
    347396            }
     
    463512                    $AName=~s/\//./g;
    464513                   
    465                     $AnnotationName{$CNum} = $AName;
     514                    $ConstantTypeName{$CNum} = $AName;
    466515                   
    467516                    if(defined $AnnotationNum{$CNum})
     
    471520                        }
    472521                        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;
    473531                    }
    474532                }
     
    557615                if($LINE=~/\A\s*\d+\:\s*#(\d+)/)
    558616                {
    559                     if(my $AName = $AnnotationName{$1})
     617                    if(my $AName = $ConstantTypeName{$1})
    560618                    {
    561619                        if($InAnnotations_Class) {
     
    678736            my $LINE_N = <OUT>;
    679737           
    680             if($Debug) {
     738            if(defined $In::Opt{"Debug"}) {
    681739                $DContent .= $LINE_N;
    682740            }
     
    758816           
    759817            my $LINE_NP = <OUT>;
    760             if($Debug) {
     818            if(defined $In::Opt{"Debug"}) {
    761819                $DContent .= $LINE_NP;
    762820            }
     
    773831           
    774832            $LINE_NP = <OUT>;
    775             if($Debug) {
     833            if(defined $In::Opt{"Debug"}) {
    776834                $DContent .= $LINE_NP;
    777835            }
     
    780838            { # flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL, ACC_ANNOTATION
    781839                $LINE_NP = <OUT>;
    782                 if($Debug) {
     840                if(defined $In::Opt{"Debug"}) {
    783841                    $DContent .= $LINE_NP;
    784842                }
     
    821879           
    822880            %TypeAttr = ("Type"=>$2, "Name"=>$3); # reset previous class
    823             %AnnotationName = (); # reset annotations of the class
     881            %ConstantTypeName = (); # reset annotations of the class
    824882            %AnnotationNum = (); # support for Java 7
     883            %ConstantName = ();
    825884            $InAnnotations_Class = 1;
    826885           
     
    923982            $InAnnotations = undef;
    924983        }
     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        }
    9251022        else
    9261023        {
     
    9351032   
    9361033    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);
    9421035   
    9431036    if(not $NonEmpty) {
     
    9451038    }
    9461039   
    947     if($Debug) {
    948         appendFile(getDebugDir($LVer)."/class-dump.txt", $DContent);
     1040    if(defined $In::Opt{"Debug"}) {
     1041        appendFile($DumpFile, $DContent);
    9491042    }
    9501043}
  • trunk/tools/japicc/modules/Internals/Basic.pm

    r12872 r13595  
    22# A module with simple functions
    33#
    4 # Copyright (C) 2016-2017 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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,
    1314# 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.
    2022###########################################################################
    2123use strict;
  • trunk/tools/japicc/modules/Internals/Descriptor.pm

    r11682 r13595  
    22# A module to handle XML descriptors
    33#
    4 # Copyright (C) 2016 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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.
    1112#
    12 # This program is distributed in the hope that it will be useful,
     13# This library is distributed in the hope that it will be useful,
    1314# 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.
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16# Lesser General Public License for more details.
    1617#
    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.
    2022###########################################################################
    2123use strict;
     
    2931    }
    3032   
    31     if(-d $Path or $Path=~/\.jar\Z/)
     33    if(-d $Path or $Path=~/\.(jar|jmod)\Z/)
    3234    {
    3335        return "
  • trunk/tools/japicc/modules/Internals/Filter.pm

    r12872 r13595  
    22# A module to filter API symbols
    33#
    4 # Copyright (C) 2016-2017 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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,
    1314# 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.
    2022###########################################################################
    2123use strict;
     
    8991   
    9092    return 1;
     93}
     94
     95sub 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;
    91111}
    92112
  • trunk/tools/japicc/modules/Internals/Input.pm

    r11682 r13595  
    22# A module to handle input data
    33#
    4 # Copyright (C) 2016 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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.
    1112#
    12 # This program is distributed in the hope that it will be useful,
     13# This library is distributed in the hope that it will be useful,
    1314# 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.
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16# Lesser General Public License for more details.
    1617#
    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.
    2022###########################################################################
    2123package In;
  • trunk/tools/japicc/modules/Internals/Logging.pm

    r11682 r13595  
    22# A module for logging
    33#
    4 # Copyright (C) 2016-2017 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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.
    1112#
    12 # This program is distributed in the hope that it will be useful,
     13# This library is distributed in the hope that it will be useful,
    1314# 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.
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16# Lesser General Public License for more details.
    1617#
    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.
    2022###########################################################################
    2123use strict;
     
    4749    my ($Code, $Msg) = @_;
    4850    print STDERR "ERROR: ". $Msg."\n";
     51    if(my $Orig = $In::Opt{"OrigDir"}) {
     52        chdir($Orig);
     53    }
    4954    exit($ERROR_CODE{$Code});
    5055}
  • trunk/tools/japicc/modules/Internals/Mangling.pm

    r11682 r13595  
    22# A module to unmangle symbols
    33#
    4 # Copyright (C) 2016 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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.
    1112#
    12 # This program is distributed in the hope that it will be useful,
     13# This library is distributed in the hope that it will be useful,
    1314# 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.
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16# Lesser General Public License for more details.
    1617#
    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.
    2022###########################################################################
    2123use strict;
     
    6668                    $CurParam = "short";
    6769                }
    68                 elsif($Symbol eq "S") {
    69                     $CurParam = "short";
    70                 }
    7170                elsif($Symbol eq "I") {
    7271                    $CurParam = "int";
     
    8079                elsif($Symbol eq "D") {
    8180                    $CurParam = "double";
     81                }
     82                elsif($Symbol eq "Z") {
     83                    $CurParam = "boolean";
    8284                }
    8385                else {
  • trunk/tools/japicc/modules/Internals/Path.pm

    r11682 r13595  
    22# A module with functions to handle paths
    33#
    4 # Copyright (C) 2017 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2017-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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.
    1112#
    12 # This program is distributed in the hope that it will be useful,
     13# This library is distributed in the hope that it will be useful,
    1314# 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.
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16# Lesser General Public License for more details.
    1617#
    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.
    2022###########################################################################
    2123use strict;
  • trunk/tools/japicc/modules/Internals/RegTests.pm

    r12872 r13595  
    22# A module with regression test suite
    33#
    4 # Copyright (C) 2016-2017 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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.
    1112#
    12 # This program is distributed in the hope that it will be useful,
     13# This library is distributed in the hope that it will be useful,
    1314# 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.
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16# Lesser General Public License for more details.
    1617#
    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.
    2022###########################################################################
    2123use strict;
     
    384386        }");
    385387       
     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       
    386410        # Removed_Annotation
    387411        writeFile($Path_v1."/RemovedAnnotation.java",
     
    402426        }");
    403427       
     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       
    404483        # Beta Annotation
    405484        writeFile($Path_v1."/Beta.java",
     
    752831    "package $PackageName;
    753832    public class ChangedFinalFieldValue {
    754         public final int field = 1;
     833        enum MyEnum {
     834            ONE, TWO
     835        }
     836        public final int    field1 = 1;
    755837        public final String field2 = \" \";
     838        public final MyEnum field3 = MyEnum.ONE;
    756839    }");
    757840    writeFile($Path_v2."/ChangedFinalFieldValue.java",
    758841    "package $PackageName;
    759842    public class ChangedFinalFieldValue {
    760         public final int field = 2;
     843        enum MyEnum {
     844            ONE, TWO
     845        }
     846        public final int    field1 = 2;
    761847        public final String field2 = \"newValue\";
     848        public final MyEnum field3 = MyEnum.TWO;
    762849    }");
    763850   
     
    19202007        $Cmd .= " -old-style";
    19212008    }
     2009    if(my $JdkPath = $In::Opt{"JdkPath"}) {
     2010        $Cmd .= " -jdk-path \"$JdkPath\"";
     2011    }
    19222012   
    19232013    my $TmpDir = $In::Opt{"Tmp"};
  • trunk/tools/japicc/modules/Internals/SysFiles.pm

    r12872 r13595  
    22# A module to find system files
    33#
    4 # Copyright (C) 2016-2017 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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,
    1314# 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.
    2022###########################################################################
    2123use strict;
     
    225227}
    226228
     229sub 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
    227256return 1;
  • trunk/tools/japicc/modules/Internals/TypeAttr.pm

    r12872 r13595  
    22# A module to handle type attributes
    33#
    4 # Copyright (C) 2016 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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.
    1112#
    12 # This program is distributed in the hope that it will be useful,
     13# This library is distributed in the hope that it will be useful,
    1314# 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.
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16# Lesser General Public License for more details.
    1617#
    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.
    2022###########################################################################
    2123use strict;
  • trunk/tools/japicc/modules/Internals/Utils.pm

    r12872 r13595  
    22# A module with basic functions
    33#
    4 # Copyright (C) 2016-2017 Andrey Ponomarenko's ABI Laboratory
     4# Copyright (C) 2016-2018 Andrey Ponomarenko's ABI Laboratory
    55#
    66# Written by Andrey Ponomarenko
    77#
    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,
    1314# 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.
    2022###########################################################################
    2123use strict;
     
    189191            push(@AbsPaths, $Path);
    190192        }
     193       
     194        @AbsPaths = sort(@AbsPaths);
     195       
    191196        return @AbsPaths;
    192197    }
     
    223228            @Files = grep { /$Name/ } @Files;
    224229        }
     230       
     231        @Files = sort(@Files);
     232       
    225233        return @Files;
    226234    }
  • trunk/tools/japicc/modules/RulesBin.xml

    r12872 r13595  
    491491    <effect>
    492492        A client program may be interrupted by **AbstractMethodError** exception. Added abstract method is called in 2nd library version by the method @invoked_by and may not be implemented by old clients.
     493    </effect>
     494</rule>
     495
     496<rule>
     497    <id>
     498        NonImpl_Interface_Added_Abstract_Method
     499    </id>
     500    <severity>
     501        Safe
     502    </severity>
     503    <kind>
     504        Types
     505    </kind>
     506    <change>
     507        Abstract method @target has been added to this interface.
     508    </change>
     509    <effect>
     510        No effect.
    493511    </effect>
    494512</rule>
     
    13631381</rule>
    13641382
     1383<rule>
     1384    <id>
     1385        Added_Annotation_Default_Element
     1386    </id>
     1387    <severity>
     1388        Safe
     1389    </severity>
     1390    <kind>
     1391        Types
     1392    </kind>
     1393    <change>
     1394        Element @target of type @elem_type with default value @new_value has been added to this annotation type.
     1395    </change>
     1396    <effect>
     1397        No effect.
     1398    </effect>
     1399</rule>
     1400
     1401<rule>
     1402    <id>
     1403        Added_Annotation_NonDefault_Element
     1404    </id>
     1405    <severity>
     1406        Safe
     1407    </severity>
     1408    <kind>
     1409        Types
     1410    </kind>
     1411    <change>
     1412        Element @target of type @elem_type without a default value has been added to this annotation type.
     1413    </change>
     1414    <effect>
     1415        No effect.
     1416    </effect>
     1417</rule>
     1418
     1419<rule>
     1420    <id>
     1421        Removed_Annotation_Default_Element
     1422    </id>
     1423    <severity>
     1424        Safe
     1425    </severity>
     1426    <kind>
     1427        Types
     1428    </kind>
     1429    <change>
     1430        Element @target of type @elem_type with default value @old_value has been removed from this annotation type.
     1431    </change>
     1432    <effect>
     1433        No effect.
     1434    </effect>
     1435</rule>
     1436
     1437<rule>
     1438    <id>
     1439        Removed_Annotation_NonDefault_Element
     1440    </id>
     1441    <severity>
     1442        Safe
     1443    </severity>
     1444    <kind>
     1445        Types
     1446    </kind>
     1447    <change>
     1448        Element @target of type @elem_type without a default value has been removed from this annotation type.
     1449    </change>
     1450    <effect>
     1451        No effect.
     1452    </effect>
     1453</rule>
     1454
     1455<rule>
     1456    <id>
     1457        Annotation_Element_Changed_Default_Value
     1458    </id>
     1459    <severity>
     1460        Safe
     1461    </severity>
     1462    <kind>
     1463        Types
     1464    </kind>
     1465    <change>
     1466        Changed default value of the element @target from @old_value to @new_value in this annotation type.
     1467    </change>
     1468    <effect>
     1469        No effect.
     1470    </effect>
     1471</rule>
     1472
     1473<rule>
     1474    <id>
     1475        Annotation_Element_Removed_Default_Value
     1476    </id>
     1477    <severity>
     1478        Safe
     1479    </severity>
     1480    <kind>
     1481        Types
     1482    </kind>
     1483    <change>
     1484        Removed default value @old_value from the element @target of this annotation type.
     1485    </change>
     1486    <effect>
     1487        No effect.
     1488    </effect>
     1489</rule>
     1490
     1491<rule>
     1492    <id>
     1493        Annotation_Element_Added_Default_Value
     1494    </id>
     1495    <severity>
     1496        Safe
     1497    </severity>
     1498    <kind>
     1499        Types
     1500    </kind>
     1501    <change>
     1502        Added default value @new_value for the element @target of this annotation type.
     1503    </change>
     1504    <effect>
     1505        No effect.
     1506    </effect>
     1507</rule>
     1508
     1509<rule>
     1510    <id>
     1511        Annotation_Element_Changed_Type
     1512    </id>
     1513    <severity>
     1514        Safe
     1515    </severity>
     1516    <kind>
     1517        Types
     1518    </kind>
     1519    <change>
     1520        Changed type of the element @target from @old_value to @new_value in this annotation type.
     1521    </change>
     1522    <effect>
     1523        No effect.
     1524    </effect>
     1525</rule>
     1526
     1527<rule>
     1528    <id>
     1529        Annotation_Element_Changed_Type_Safe
     1530    </id>
     1531    <severity>
     1532        Safe
     1533    </severity>
     1534    <kind>
     1535        Types
     1536    </kind>
     1537    <change>
     1538        Changed type of the element @target from @old_value to @new_value in this annotation type.
     1539    </change>
     1540    <effect>
     1541        No effect.
     1542    </effect>
     1543</rule>
     1544
    13651545</rules>
  • trunk/tools/japicc/modules/RulesSrc.xml

    r12872 r13595  
    442442<rule>
    443443    <id>
     444        NonImpl_Interface_Added_Abstract_Method
     445    </id>
     446    <severity>
     447        Safe
     448    </severity>
     449    <kind>
     450        Types
     451    </kind>
     452    <change>
     453        Abstract method @target has been added to this interface.
     454    </change>
     455    <effect>
     456        No effect. This interface is not meant to be implemented by users.
     457    </effect>
     458</rule>
     459
     460<rule>
     461    <id>
    444462        Class_Method_Became_Abstract
    445463    </id>
     
    12691287</rule>
    12701288
     1289<rule>
     1290    <id>
     1291        Added_Annotation_Default_Element
     1292    </id>
     1293    <severity>
     1294        Safe
     1295    </severity>
     1296    <kind>
     1297        Types
     1298    </kind>
     1299    <change>
     1300        Element @target of type @elem_type with default value @new_value has been added to this annotation type.
     1301    </change>
     1302    <effect>
     1303        No effect.
     1304    </effect>
     1305</rule>
     1306
     1307<rule>
     1308    <id>
     1309        Added_Annotation_NonDefault_Element
     1310    </id>
     1311    <severity>
     1312        High
     1313    </severity>
     1314    <kind>
     1315        Types
     1316    </kind>
     1317    <change>
     1318        Element @target of type @elem_type without a default value has been added to this annotation type.
     1319    </change>
     1320    <effect>
     1321        Recompilation of a client program may be terminated with the error message: annotation **@**@type_name is missing a default value for the element '@target'
     1322    </effect>
     1323</rule>
     1324
     1325<rule>
     1326    <id>
     1327        Removed_Annotation_Default_Element
     1328    </id>
     1329    <severity>
     1330        Medium
     1331    </severity>
     1332    <kind>
     1333        Types
     1334    </kind>
     1335    <change>
     1336        Element @target of type @elem_type with default value @old_value has been removed from this annotation type.
     1337    </change>
     1338    <effect>
     1339        Recompilation of a client program may be terminated with the error message: cannot find symbol **@**@type_name(@target=VAL)
     1340    </effect>
     1341</rule>
     1342
     1343<rule>
     1344    <id>
     1345        Removed_Annotation_NonDefault_Element
     1346    </id>
     1347    <severity>
     1348        High
     1349    </severity>
     1350    <kind>
     1351        Types
     1352    </kind>
     1353    <change>
     1354        Element @target of type @elem_type without a default value has been removed from this annotation type.
     1355    </change>
     1356    <effect>
     1357        Recompilation of a client program may be terminated with the error message: cannot find symbol **@**@type_name(@target=VAL)
     1358    </effect>
     1359</rule>
     1360
     1361<rule>
     1362    <id>
     1363        Annotation_Element_Changed_Default_Value
     1364    </id>
     1365    <severity>
     1366        Safe
     1367    </severity>
     1368    <kind>
     1369        Types
     1370    </kind>
     1371    <change>
     1372        Changed default value of the element @target from @old_value to @new_value in this annotation type.
     1373    </change>
     1374    <effect>
     1375        No effect.
     1376    </effect>
     1377</rule>
     1378
     1379<rule>
     1380    <id>
     1381        Annotation_Element_Removed_Default_Value
     1382    </id>
     1383    <severity>
     1384        Medium
     1385    </severity>
     1386    <kind>
     1387        Types
     1388    </kind>
     1389    <change>
     1390        Removed default value @old_value from the element @target of this annotation type.
     1391    </change>
     1392    <effect>
     1393        Recompilation of a client program may be terminated with the error message: annotation **@**@type_name is missing a default value for the element '@target'
     1394    </effect>
     1395</rule>
     1396
     1397<rule>
     1398    <id>
     1399        Annotation_Element_Added_Default_Value
     1400    </id>
     1401    <severity>
     1402        Safe
     1403    </severity>
     1404    <kind>
     1405        Types
     1406    </kind>
     1407    <change>
     1408        Added default value @new_value for the element @target of this annotation type.
     1409    </change>
     1410    <effect>
     1411        No effect.
     1412    </effect>
     1413</rule>
     1414
     1415<rule>
     1416    <id>
     1417        Annotation_Element_Changed_Type
     1418    </id>
     1419    <severity>
     1420        Medium
     1421    </severity>
     1422    <kind>
     1423        Types
     1424    </kind>
     1425    <change>
     1426        Changed type of the element @target from @old_value to @new_value in this annotation type.
     1427    </change>
     1428    <effect>
     1429        Recompilation of a client program may be terminated with the error message: incompatible types: @old_value cannot be converted to @new_value or annotation value not of an allowable type
     1430    </effect>
     1431</rule>
     1432
     1433<rule>
     1434    <id>
     1435        Annotation_Element_Changed_Type_Safe
     1436    </id>
     1437    <severity>
     1438        Safe
     1439    </severity>
     1440    <kind>
     1441        Types
     1442    </kind>
     1443    <change>
     1444        Changed type of the element @target from @old_value to @new_value in this annotation type.
     1445    </change>
     1446    <effect>
     1447        No effect.
     1448    </effect>
     1449</rule>
     1450
    12711451</rules>
Note: See TracChangeset for help on using the changeset viewer.