Re: RFR: 8330467: NoClassDefFoundError when lambda is in a hidden class [v2]

2024-04-17 Thread Adam Sotona
On Wed, 17 Apr 2024 15:39:11 GMT, Paul Sandoz  wrote:

>> Adam Sotona has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   applied suggested changes
>
> test/jdk/java/lang/invoke/defineHiddenClass/src/Lambda.java line 28:
> 
>> 26: public class Lambda implements HiddenTest {
>> 27:  public void test() {
>> 28:  Function f = o -> o.toString();
> 
> Recommend you retain the existing method reference e.g.:
> 
>  Function fmref = Object::toString;
>  Function flexp = o -> o.toString();
>  String s = fmref.apply(this) + flexp.apply(this);
>  ...
> 
> Or split them out into two tests (easier to debug if case fails).

I've split the tests, thanks!

-

PR Review Comment: https://git.openjdk.org/jdk/pull/18810#discussion_r1569099751


Re: RFR: 8330467: NoClassDefFoundError when lambda is in a hidden class [v2]

2024-04-17 Thread Paul Sandoz
On Wed, 17 Apr 2024 12:51:55 GMT, Adam Sotona  wrote:

>> Current implementation of `LambdaMetafactory` does not allow to use lambdas 
>> in hidden classes. Invocation throws `NoClassDefFoundError` instead.
>> 
>> This patch includes lambda implementation in a hidden class under the 
>> special handling of `useImplMethodHandle`.
>> The patch also fixes `j/l/i/defineHiddenClass/BasicTest::testLambda` to 
>> correctly cover this test case.
>> 
>> Please review.
>> 
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   applied suggested changes

test/jdk/java/lang/invoke/defineHiddenClass/src/Lambda.java line 28:

> 26: public class Lambda implements HiddenTest {
> 27:  public void test() {
> 28:  Function f = o -> o.toString();

Recommend you retain the existing method reference e.g.:

 Function fmref = Object::toString;
 Function flexp = o -> o.toString();
 String s = fmref.apply(this) + flexp.apply(this);
 ...

Or split them out into two tests (easier to debug if case fails).

-

PR Review Comment: https://git.openjdk.org/jdk/pull/18810#discussion_r1569060714


Re: RFR: 8330467: NoClassDefFoundError when lambda is in a hidden class [v2]

2024-04-17 Thread Chen Liang
On Wed, 17 Apr 2024 10:58:59 GMT, Jorn Vernee  wrote:

> Do we also need to check if the parameters or return type are hidden classes?

I think this is already failing and will continue to fail. Don't think we need 
special error messages for this case.

-

PR Comment: https://git.openjdk.org/jdk/pull/18810#issuecomment-2061260710


Re: RFR: 8330467: NoClassDefFoundError when lambda is in a hidden class [v2]

2024-04-17 Thread Adam Sotona
> Current implementation of `LambdaMetafactory` does not allow to use lambdas 
> in hidden classes. Invocation throws `NoClassDefFoundError` instead.
> 
> This patch includes lambda implementation in a hidden class under the special 
> handling of `useImplMethodHandle`.
> The patch also fixes `j/l/i/defineHiddenClass/BasicTest::testLambda` to 
> correctly cover this test case.
> 
> Please review.
> 
> Thanks,
> Adam

Adam Sotona has updated the pull request incrementally with one additional 
commit since the last revision:

  applied suggested changes

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/18810/files
  - new: https://git.openjdk.org/jdk/pull/18810/files/4a53389d..c637ab90

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk=18810=01
 - incr: https://webrevs.openjdk.org/?repo=jdk=18810=00-01

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

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