author | bpb |
Mon, 04 Nov 2019 11:05:10 -0800 | |
changeset 58919 | 1d1f9c43138f |
parent 57974 | 1262b3ddd7e4 |
permissions | -rw-r--r-- |
12892 | 1 |
#! /bin/sh |
2 |
# |
|
57974
1262b3ddd7e4
8230373: Use java.io.Serial in generated exception types
darcy
parents:
47216
diff
changeset
|
3 |
# Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. |
12892 | 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 |
||
29 |
SPEC=$1 |
|
30 |
DST=$2 |
|
31 |
||
32 |
gen() { |
|
33 |
ID=$1 |
|
34 |
WHAT=$2 |
|
20547 | 35 |
SVUID=$3 |
12892 | 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 |
||
20547 | 46 |
cat >>$out <<__END__ |
12892 | 47 |
|
48 |
// -- This file was mechanically generated: Do not edit! -- // |
|
49 |
||
50 |
package $PACKAGE; |
|
51 |
||
52 |
||
53 |
/**$WHAT |
|
54 |
* |
|
55 |
* @since $SINCE |
|
56 |
*/ |
|
57 |
||
58 |
public `if [ ${ABSTRACT:-0} = 1 ]; |
|
59 |
then echo 'abstract '; fi`class $ID |
|
60 |
extends ${SUPER} |
|
61 |
{ |
|
62 |
||
57974
1262b3ddd7e4
8230373: Use java.io.Serial in generated exception types
darcy
parents:
47216
diff
changeset
|
63 |
@java.io.Serial |
12892 | 64 |
private static final long serialVersionUID = $SVUID; |
65 |
__END__ |
|
66 |
||
67 |
if [ $ARG_ID ]; then |
|
68 |
||
69 |
cat >>$out <<__END__ |
|
70 |
||
71 |
private $ARG_TYPE $ARG_ID; |
|
72 |
||
73 |
/** |
|
18164 | 74 |
* Constructs an instance of this class. |
12892 | 75 |
* |
76 |
* @param $ARG_ID |
|
77 |
* The $ARG_PHRASE |
|
78 |
*/ |
|
79 |
public $ID($ARG_TYPE $ARG_ID) { |
|
80 |
super(String.valueOf($ARG_ID)); |
|
81 |
this.$ARG_ID = $ARG_ID; |
|
82 |
} |
|
83 |
||
84 |
/** |
|
18164 | 85 |
* Retrieves the $ARG_PHRASE. |
12892 | 86 |
* |
87 |
* @return The $ARG_PHRASE |
|
88 |
*/ |
|
89 |
public $ARG_TYPE get$ARG_PROP() { |
|
90 |
return $ARG_ID; |
|
91 |
} |
|
92 |
||
93 |
} |
|
94 |
__END__ |
|
95 |
||
96 |
else |
|
97 |
||
98 |
cat >>$out <<__END__ |
|
99 |
||
100 |
/** |
|
101 |
* Constructs an instance of this class. |
|
102 |
*/ |
|
103 |
public $ID() { } |
|
104 |
||
105 |
} |
|
106 |
__END__ |
|
107 |
||
108 |
fi |
|
109 |
} |
|
110 |
||
111 |
. $SPEC |