• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2#
3# Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5#
6# This code is free software; you can redistribute it and/or modify it
7# under the terms of the GNU General Public License version 2 only, as
8# published by the Free Software Foundation.  Oracle designates this
9# particular file as subject to the "Classpath" exception as provided
10# by Oracle in the LICENSE file that accompanied this code.
11#
12# This code is distributed in the hope that it will be useful, but WITHOUT
13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15# version 2 for more details (a copy is included in the LICENSE file that
16# accompanied this code).
17#
18# You should have received a copy of the GNU General Public License version
19# 2 along with this work; if not, write to the Free Software Foundation,
20# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21#
22# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23# or visit www.oracle.com if you need additional information or have any
24# questions.
25#
26
27# Generate exception classes
28
29SPEC=$1
30DST=$2
31
32gen() {
33  ID=$1
34  WHAT=$2
35  SVUID=$3
36  ARG_TYPE=$4
37  ARG_ID=$5
38  ARG_PROP=$6
39  ARG_PHRASE=$7
40  ARG_PARAM="$ARG_TYPE$ $ARG_ID"
41  echo '-->' $DST/$ID.java
42  out=$DST/${ID}.java
43
44  $SH ${SCRIPTS}/addNotices.sh "$COPYRIGHT_YEARS" > $out
45
46  cat >>$out <<__END__
47
48// -- This file was mechanically generated: Do not edit! -- //
49
50package $PACKAGE;
51
52
53/**$WHAT
54 *
55 * @since $SINCE
56 */
57
58public `if [ ${ABSTRACT:-0} = 1 ];
59        then echo 'abstract '; fi`class $ID
60    extends ${SUPER}
61{
62
63    @java.io.Serial
64    private static final long serialVersionUID = $SVUID;
65__END__
66
67  if [ $ARG_ID ]; then
68
69    cat >>$out <<__END__
70
71    /**
72     * The $ARG_PHRASE.
73     */
74    private $ARG_TYPE $ARG_ID;
75
76    /**
77     * Constructs an instance of this class.
78     *
79     * @param  $ARG_ID
80     *         The $ARG_PHRASE
81     */
82    public $ID($ARG_TYPE $ARG_ID) {
83        super(String.valueOf($ARG_ID));
84	this.$ARG_ID = $ARG_ID;
85    }
86
87    /**
88     * Retrieves the $ARG_PHRASE.
89     *
90     * @return  The $ARG_PHRASE
91     */
92    public $ARG_TYPE get$ARG_PROP() {
93        return $ARG_ID;
94    }
95
96}
97__END__
98
99  else
100
101    cat >>$out <<__END__
102
103    /**
104     * Constructs an instance of this class.
105     */
106    public $ID() { }
107
108}
109__END__
110
111  fi
112}
113
114. $SPEC
115