> The bootstrap methods in java.lang.runtime do not have explicit requirements 
> for the lookup; they largely ignored it until they suddenly start using the 
> lookups.
> 
> Currently, the unprivileged lookup behavior is as follows:
> 1. `ObjectMethods.bootstrap` for `equals` and `hashCode` may fail with 
> `IllegalAccessException` if the lookup is used to generate hidden classes; it 
> may be ignored if no hidden class is needed.
> 2. `ObjectMethods.bootstrap` for `toString` fails with a `RuntimeException` 
> caused by a `StringConcatException`.
> 3. `SwitchBootstraps` methods fail with `IllegalArgumentException` caused by 
> `IllegalAccessException`.
> 
> In contrast, `LambdaMetafactory` and `StringConcatFactory` throw their own 
> types of exceptions.
> 
> In this patch, I decided to make all these java.lang.runtime BSMs throw 
> `IllegalArgumentException` without a cause for any unprivileged lookup that 
> cannot support bytecode generation. Future BSMs should also reject 
> unprivileged lookup eagerly to allow implementations to have bytecode 
> generation freedom. The `IllegalArgumentException` is consistent with other 
> consistency checks done by these BSMs.

Chen Liang has updated the pull request incrementally with one additional 
commit since the last revision:

  Omitted

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/30067/files
  - new: https://git.openjdk.org/jdk/pull/30067/files/cdc789ca..7fa096a4

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=30067&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=30067&range=02-03

  Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/30067.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/30067/head:pull/30067

PR: https://git.openjdk.org/jdk/pull/30067

Reply via email to