-
Bug
-
Resolution: Fixed
-
P5
-
8
JLS occasionally identifies errors that may occur at run time as a result of class file changes between compile time and run time (see, e.g., 15.12.4.3).
One unidentified case is the evaluation of a method reference (15.13.3): per the java.lang.invoke.LambdaMetafactory spec, various checks are performed at invokedynamic link time to validate the metafactory arguments. If one of these checks fails, a LambdaConversionException is thrown, which invokedynamic wraps in a BootstrapMethodError (a subtype of LinkageError).
Without enforcing too many details about the implementation, it would be appropriate for 15.13.3 to state that a LinkageError may occur due to inconsistencies between compile time and run time (in the referenced method, the functional interface, or the argument types of either).
Similarly, 15.27.4 could be updated to say something similar about lambda expression evaluation.
12.3.3 "Resolution of Symbolic References" would also need to say that an exception as precise as IllegalAccessError won't be possible for certain uses of fields (i.e. method reference expressions).
One unidentified case is the evaluation of a method reference (15.13.3): per the java.lang.invoke.LambdaMetafactory spec, various checks are performed at invokedynamic link time to validate the metafactory arguments. If one of these checks fails, a LambdaConversionException is thrown, which invokedynamic wraps in a BootstrapMethodError (a subtype of LinkageError).
Without enforcing too many details about the implementation, it would be appropriate for 15.13.3 to state that a LinkageError may occur due to inconsistencies between compile time and run time (in the referenced method, the functional interface, or the argument types of either).
Similarly, 15.27.4 could be updated to say something similar about lambda expression evaluation.
12.3.3 "Resolution of Symbolic References" would also need to say that an exception as precise as IllegalAccessError won't be possible for certain uses of fields (i.e. method reference expressions).