View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   https://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.bcel.data;
21  
22  // Due to the way try finally is implemented in the standard java compiler
23  // from Oracle, this class generates a huge (>32767 code bytes) <init> method.
24  // Verified with javac versions 1.8.0_261, 11.0.10 and 17.0.1.
25  final class LargeMethod {
26      {
27          @SuppressWarnings("unused")
28          int a;
29          try {
30              a = 0;
31          } finally {
32              try {
33                  a = 0;
34              } finally {
35                  try {
36                      a = 0;
37                  } finally {
38                      try {
39                          a = 0;
40                      } finally {
41                          try {
42                              a = 0;
43                          } finally {
44                              try {
45                                  a = 0;
46                              } finally {
47                                  try {
48                                      a = 0;
49                                  } finally {
50                                      try {
51                                          a = 0;
52                                      } finally {
53                                          try {
54                                              a = 0;
55                                          } finally {
56                                              try {
57                                                  a = 0;
58                                              } finally {
59                                                  try {
60                                                      a = 0;
61                                                  } finally {
62                                                      try {
63                                                          a = 0;
64                                                      } finally {
65                                                          a = 0;
66                                                      }
67                                                  }
68                                              }
69                                          }
70                                      }
71                                  }
72                              }
73                          }
74                      }
75                  }
76              }
77          }
78      }
79  }