@@ -426,7 +426,7 @@ private static Method moduleMethod(final Object module, final String name, final
426426
427427 // find method with identical name and arity
428428 final IntList arities = new IntList ();
429- final HashMap <String , ArrayList <Method >> allMethods = methods (module .getClass ());
429+ final HashMap <String , ArrayList <Method >> allMethods = methods (module .getClass (), info );
430430 final ArrayList <Method > candidates = candidates (allMethods , name , types , arity , arities , true );
431431 final int cs = candidates .size ();
432432 if (cs == 0 ) {
@@ -475,23 +475,31 @@ static QueryException noMember(final String name, final String[] types, final in
475475 /**
476476 * Returns a map with all relevant methods for a class.
477477 * @param clazz class
478+ * @param info input info (can be {@code null})
478479 * @return methods
480+ * @throws QueryException query exception
479481 */
480- static HashMap <String , ArrayList <Method >> methods (final Class <?> clazz ) {
482+ static HashMap <String , ArrayList <Method >> methods (final Class <?> clazz , final InputInfo info )
483+ throws QueryException {
481484 final HashSet <String > names = new HashSet <>();
482485 final HashMap <String , ArrayList <Method >> list = new HashMap <>();
483- for (final boolean bridge : new boolean [] { false , true }) {
484- for (final Method method : clazz .getMethods ()) {
485- if (bridge == method .isBridge ()) {
486- final StringBuilder id = new StringBuilder ().append (method .getName ()).append ('-' );
487- for (final Class <?> type : method .getParameterTypes ()) {
488- id .append (type .getName ()).append ('-' );
489- }
490- if (names .add (id .toString ())) {
491- list .computeIfAbsent (method .getName (), n -> new ArrayList <>(1 )).add (method );
486+ try {
487+ for (final boolean bridge : new boolean [] { false , true }) {
488+ for (final Method method : clazz .getMethods ()) {
489+ if (bridge == method .isBridge ()) {
490+ final StringBuilder id = new StringBuilder ().append (method .getName ()).append ('-' );
491+ for (final Class <?> type : method .getParameterTypes ()) {
492+ id .append (type .getName ()).append ('-' );
493+ }
494+ if (names .add (id .toString ())) {
495+ list .computeIfAbsent (method .getName (), n -> new ArrayList <>(1 )).add (method );
496+ }
492497 }
493498 }
494499 }
500+ } catch (final LinkageError err ) {
501+ // referenced class could not be linked (e.g. temporarily unavailable during a rebuild)
502+ throw JAVAINIT_X_X .get (info , Util .className (err ), err );
495503 }
496504 return list ;
497505 }
0 commit comments