|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
@@ -83,17 +83,28 @@ public ClassFileImpl withOptions(Option... options) {
|
83 | 83 | var chro = classHierarchyResolverOption;
|
84 | 84 | var amo = attributeMapperOption;
|
85 | 85 | for (var o : options) {
|
86 |
| - switch (o) { |
87 |
| - case StackMapsOption oo -> smo = oo; |
88 |
| - case DebugElementsOption oo -> deo = oo; |
89 |
| - case LineNumbersOption oo -> lno = oo; |
90 |
| - case AttributesProcessingOption oo -> apo = oo; |
91 |
| - case ConstantPoolSharingOption oo -> cpso = oo; |
92 |
| - case ShortJumpsOption oo -> sjo = oo; |
93 |
| - case DeadCodeOption oo -> dco = oo; |
94 |
| - case DeadLabelsOption oo -> dlo = oo; |
95 |
| - case ClassHierarchyResolverOption oo -> chro = oo; |
96 |
| - case AttributeMapperOption oo -> amo = oo; |
| 86 | + if (o instanceof StackMapsOption oo) { |
| 87 | + smo = oo; |
| 88 | + } else if (o instanceof DebugElementsOption oo) { |
| 89 | + deo = oo; |
| 90 | + } else if (o instanceof LineNumbersOption oo) { |
| 91 | + lno = oo; |
| 92 | + } else if (o instanceof AttributesProcessingOption oo) { |
| 93 | + apo = oo; |
| 94 | + } else if (o instanceof ConstantPoolSharingOption oo) { |
| 95 | + cpso = oo; |
| 96 | + } else if (o instanceof ShortJumpsOption oo) { |
| 97 | + sjo = oo; |
| 98 | + } else if (o instanceof DeadCodeOption oo) { |
| 99 | + dco = oo; |
| 100 | + } else if (o instanceof DeadLabelsOption oo) { |
| 101 | + dlo = oo; |
| 102 | + } else if (o instanceof ClassHierarchyResolverOption oo) { |
| 103 | + chro = oo; |
| 104 | + } else if (o instanceof AttributeMapperOption oo) { |
| 105 | + amo = oo; |
| 106 | + } else { // null or unknown Option type |
| 107 | + throw new IllegalArgumentException("Invalid option: " + o); |
97 | 108 | }
|
98 | 109 | }
|
99 | 110 | return new ClassFileImpl(smo, deo, lno, apo, cpso, sjo, dco, dlo, chro, amo);
|
|
0 commit comments