|
1 | 1 | /* |
2 | | - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2013, 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 |
@@ -288,7 +288,12 @@ protected void maybeEagerlyResolve(int cpi, int bytecode) { |
288 | 288 | try { |
289 | 289 | super.maybeEagerlyResolve(cpi, bytecode); |
290 | 290 | } catch (UnresolvedElementException e) { |
291 | | - if (e.getCause() instanceof LambdaConversionException || e.getCause() instanceof LinkageError || e.getCause() instanceof IllegalAccessError) { |
| 291 | + Throwable cause = e.getCause(); |
| 292 | + if (cause instanceof NoClassDefFoundError && linkAtBuildTime && LinkAtBuildTimeSupport.failFast()) { |
| 293 | + String message = "Error during parsing of method " + method.format("%H.%n(%P)") + ". " + |
| 294 | + LinkAtBuildTimeSupport.singleton().errorMessageFor(method.getDeclaringClass()); |
| 295 | + throw new UnresolvedElementException(message, cause); |
| 296 | + } else if (cause instanceof LambdaConversionException || cause instanceof LinkageError) { |
292 | 297 | /* |
293 | 298 | * Ignore LinkageError, LambdaConversionException or IllegalAccessError if |
294 | 299 | * thrown from eager resolution attempt. This is usually followed by a call to |
@@ -1084,7 +1089,7 @@ private Object loadConstantDynamic(int cpi, int opcode) { |
1084 | 1089 | * Therefore, we cannot just treat it as "safe at build time". The class |
1085 | 1090 | * initialization is also completely useless because the invoking class must be |
1086 | 1091 | * already initialized by the time the boostrap method is executed. |
1087 | | - * |
| 1092 | + * |
1088 | 1093 | * We replicate the implementation of the bootstrap method here without doing |
1089 | 1094 | * the class initialization. |
1090 | 1095 | */ |
|
0 commit comments