Commit 3d53dc5
committed
Rethrow Error from @PostConstruct method instead of wrapping it in RuntimeException
PostConstructAdapterFactory rethrows a RuntimeException cause as-is but wraps
everything else. An Error thrown by the @PostConstruct method (AssertionError,
OutOfMemoryError, ...) is unchecked like RuntimeException and should propagate
as-is, not be smothered in a RuntimeException. Rethrow Error the same way.
Adds a regression test.1 parent 004e7a4 commit 3d53dc5
2 files changed
Lines changed: 23 additions & 0 deletions
File tree
- extras/src
- main/java/com/google/gson/typeadapters
- test/java/com/google/gson/typeadapters
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
98 | 119 | | |
99 | 120 | | |
100 | 121 | | |
| |||
0 commit comments