ECJ bug for inner class method reference deserialization ?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

ECJ bug for inner class method reference deserialization ?

Laurent Almeras

Hi,

I search some insight to confirm an issue with ECJ.

I create a minimal use-case (two classes, ~20 lines) here : https://github.com/igloo-project/issue-lambda-serialization

The issue I encounter is that if I use method reference notation (ClassName::new) as a Supplier<ClassName>, this lambda triggers a deserialization issue. If I use an inlined expression - () -> new ClassName() - it works as expected. This error is triggered only if code is compiled by Eclipse. The same code, launched with mvn clean test or mvn clean exec:java does not trigger an error.

The not-expected stacktrace is :

Exception in thread "main" java.io.IOException: unexpected exception type
    at java.base/java.io.ObjectStreamClass.throwMiscException(ObjectStreamClass.java:1641)
    at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1271)
    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2153)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)
    at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2412)
    at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2306)
    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2144)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:464)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
    at lambda.MySerializer.serializeAndDeserialize(MySerializer.java:33)
    at lambda.MySerializer.main(MySerializer.java:17)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.base/java.lang.invoke.SerializedLambda.readResolve(SerializedLambda.java:237)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1265)
    ... 10 more
Caused by: java.lang.BootstrapMethodError: bootstrap method initialization exception
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:194)
    at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)
    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:258)
    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:248)
    at lambda.MyOuterClass.$deserializeLambda$(MyOuterClass.java:1)
    ... 20 more
Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of parameters for static method newInvokeSpecial lambda.MyOuterClass$MyInnerClass.<init>:(MyOuterClass)void; 0 captured parameters, 0 functional interface method parameters, 1 implementation parameters
    at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:214)
    at java.base/java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:503)
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:138)
    ... 24 more

This commit contains all the remaining information about the issue (commands, class names, ...) : https://github.com/igloo-project/issue-lambda-serialization/commit/7b18c2d48833e7e1507115dd778ca1c3f40fd035

I do not find any bug that matches this issue in Eclipse Bugzilla (https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=__open__&content=LambdaConversionException&no_redirect=1&order=Importance&query_format=specific returns 4 other bugs ; the only one that could be linked from my opinion is https://bugs.eclipse.org/bugs/show_bug.cgi?id=565787, but it is not serialization-related).

Anyone can confirm my issue with my minimal test-case ? Where this issue should be created ? Product JDT, Component Core ?


Thanks for you insight,


--
Laurent Almeras



_______________________________________________
jdt-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev
Reply | Threaded
Open this post in threaded view
|

Re: ECJ bug for inner class method reference deserialization ?

Manoj Palat-2
Hi,
Can you please file a bug under JDT, ie https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT - the component is Core. One of us will take a look.

Regards,
Manoj

-----[hidden email] wrote: -----
To: [hidden email]
From: Laurent Almeras
Sent by: [hidden email]
Date: 08/17/2020 10:08PM
Subject: [EXTERNAL] [jdt-dev] ECJ bug for inner class method reference deserialization ?

Hi,
I search some insight to confirm an issue with ECJ.
I create a minimal use-case (two classes, ~20 lines) here : https://github.com/igloo-project/issue-lambda-serialization
The issue I encounter is that if I use method reference notation (ClassName::new) as a Supplier<ClassName>, this lambda triggers a deserialization issue. If I use an inlined expression - () -> new ClassName() - it works as expected. This error is triggered only if code is compiled by Eclipse. The same code, launched with mvn clean test or mvn clean exec:java does not trigger an error.
The not-expected stacktrace is :
Exception in thread "main" java.io.IOException: unexpected exception type
    at java.base/java.io.ObjectStreamClass.throwMiscException(ObjectStreamClass.java:1641)
    at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1271)
    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2153)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)
    at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2412)
    at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2306)
    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2144)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:464)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
    at lambda.MySerializer.serializeAndDeserialize(MySerializer.java:33)
    at lambda.MySerializer.main(MySerializer.java:17)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.base/java.lang.invoke.SerializedLambda.readResolve(SerializedLambda.java:237)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1265)
    ... 10 more
Caused by: java.lang.BootstrapMethodError: bootstrap method initialization exception
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:194)
    at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)
    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:258)
    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:248)
    at lambda.MyOuterClass.$deserializeLambda$(MyOuterClass.java:1)
    ... 20 more
Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of parameters for static method newInvokeSpecial lambda.MyOuterClass$MyInnerClass.<init>:(MyOuterClass)void; 0 captured parameters, 0 functional interface method parameters, 1 implementation parameters
    at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:214)
    at java.base/java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:503)
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:138)
    ... 24 more

This commit contains all the remaining information about the issue (commands, class names, ...) : https://github.com/igloo-project/issue-lambda-serialization/commit/7b18c2d48833e7e1507115dd778ca1c3f40fd035
I do not find any bug that matches this issue in Eclipse Bugzilla (https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=__open__&content=LambdaConversionException&no_redirect=1&order=Importance&query_format=specific returns 4 other bugs ; the only one that could be linked from my opinion is https://bugs.eclipse.org/bugs/show_bug.cgi?id=565787, but it is not serialization-related).
Anyone can confirm my issue with my minimal test-case ? Where this issue should be created ? Product JDT, Component Core ?


Thanks for you insight,


--
Laurent Almeras




_______________________________________________
jdt-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev

_______________________________________________
jdt-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev
Reply | Threaded
Open this post in threaded view
|

Re: ECJ bug for inner class method reference deserialization ?

Manoj Palat-2
@Laurent: I was able to reproduce the issue with the code you pointed to. Thanks!
ecj emits newInvokeSpecial()[const - 8] in bootstrap as is evident from your report as well as from the generated class files while javac sticks to InvokeSpecial. Though this itself is not an issue, need to probe further to figure out the missed param for invoke.

Regards,
Manoj



-----[hidden email] wrote: -----
To: "Eclipse JDT general developers list." <[hidden email]>
From: "Manoj Palat"
Sent by: [hidden email]
Date: 08/18/2020 10:11AM
Subject: [EXTERNAL] Re: [jdt-dev] ECJ bug for inner class method reference deserialization ?

Hi,
Can you please file a bug under JDT, ie https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT - the component is Core. One of us will take a look.

Regards,
Manoj

-----[hidden email] wrote: -----
To: [hidden email]
From: Laurent Almeras
Sent by: [hidden email]
Date: 08/17/2020 10:08PM
Subject: [EXTERNAL] [jdt-dev] ECJ bug for inner class method reference deserialization ?

Hi,
I search some insight to confirm an issue with ECJ.
I create a minimal use-case (two classes, ~20 lines) here : https://github.com/igloo-project/issue-lambda-serialization 
The issue I encounter is that if I use method reference notation (ClassName::new) as a Supplier<ClassName>, this lambda triggers a deserialization issue. If I use an inlined expression - () -> new ClassName() - it works as expected. This error is triggered only if code is compiled by Eclipse. The same code, launched with mvn clean test or mvn clean exec:java does not trigger an error.
The not-expected stacktrace is :
Exception in thread "main" java.io.IOException: unexpected exception type
    at java.base/java.io.ObjectStreamClass.throwMiscException(ObjectStreamClass.java:1641)
    at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1271)
    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2153)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)
    at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2412)
    at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2306)
    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2144)
    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:464)
    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
    at lambda.MySerializer.serializeAndDeserialize(MySerializer.java:33)
    at lambda.MySerializer.main(MySerializer.java:17)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.base/java.lang.invoke.SerializedLambda.readResolve(SerializedLambda.java:237)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1265)
    ... 10 more
Caused by: java.lang.BootstrapMethodError: bootstrap method initialization exception
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:194)
    at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)
    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:258)
    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:248)
    at lambda.MyOuterClass.$deserializeLambda$(MyOuterClass.java:1)
    ... 20 more
Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of parameters for static method newInvokeSpecial lambda.MyOuterClass$MyInnerClass.<init>:(MyOuterClass)void; 0 captured parameters, 0 functional interface method parameters, 1 implementation parameters
    at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:214)
    at java.base/java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:503)
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:138)
    ... 24 more

This commit contains all the remaining information about the issue (commands, class names, ...) : https://github.com/igloo-project/issue-lambda-serialization/commit/7b18c2d48833e7e1507115dd778ca1c3f40fd035 
I do not find any bug that matches this issue in Eclipse Bugzilla (https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=__open__&content=LambdaConversionException&no_redirect=1&order=Importance&query_format=specific returns 4 other bugs ; the only one that could be linked from my opinion is https://bugs.eclipse.org/bugs/show_bug.cgi?id=565787, but it is not serialization-related).
Anyone can confirm my issue with my minimal test-case ? Where this issue should be created ? Product JDT, Component Core ?


Thanks for you insight,


--
Laurent Almeras




_______________________________________________
jdt-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev

_______________________________________________
jdt-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev


_______________________________________________
jdt-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev
Reply | Threaded
Open this post in threaded view
|

Re: ECJ bug for inner class method reference deserialization ?

Gayan Perera
Hi Manoj,

I came across with the same issue in one my projects as well. Is there any plan to fix this in next 4.18 release ?

Best regards,
Gayan

On Tue, 18 Aug 2020 at 13:13, Manoj Palat <[hidden email]> wrote:
@Laurent: I was able to reproduce the issue with the code you pointed to. Thanks!

ecj emits newInvokeSpecial()[const - 8] in bootstrap as is evident from your report as well as from the generated class files while javac sticks to InvokeSpecial. Though this itself is not an issue, need to probe further to figure out the missed param for invoke.



Regards,

Manoj







-----[hidden email] wrote: -----

To: "Eclipse JDT general developers list." <[hidden email]>

From: "Manoj Palat"

Sent by: [hidden email]

Date: 08/18/2020 10:11AM

Subject: [EXTERNAL] Re: [jdt-dev] ECJ bug for inner class method reference deserialization ?



Hi,

Can you please file a bug under JDT, ie https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT - the component is Core. One of us will take a look.



Regards,

Manoj



-----[hidden email] wrote: -----

To: [hidden email]

From: Laurent Almeras

Sent by: [hidden email]

Date: 08/17/2020 10:08PM

Subject: [EXTERNAL] [jdt-dev] ECJ bug for inner class method reference deserialization ?



Hi,

I search some insight to confirm an issue with ECJ.

I create a minimal use-case (two classes, ~20 lines) here : https://github.com/igloo-project/issue-lambda-serialization

The issue I encounter is that if I use method reference notation (ClassName::new) as a Supplier<ClassName>, this lambda triggers a deserialization issue. If I use an inlined expression - () -> new ClassName() - it works as expected. This error is triggered only if code is compiled by Eclipse. The same code, launched with mvn clean test or mvn clean exec:java does not trigger an error.

The not-expected stacktrace is :

Exception in thread "main" java.io.IOException: unexpected exception type

    at java.base/java.io.ObjectStreamClass.throwMiscException(ObjectStreamClass.java:1641)

    at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1271)

    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2153)

    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)

    at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2412)

    at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2306)

    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2144)

    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)

    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:464)

    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)

    at lambda.MySerializer.serializeAndDeserialize(MySerializer.java:33)

    at lambda.MySerializer.main(MySerializer.java:17)

Caused by: java.lang.reflect.InvocationTargetException

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.base/java.lang.reflect.Method.invoke(Method.java:566)

    at java.base/java.lang.invoke.SerializedLambda.readResolve(SerializedLambda.java:237)

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.base/java.lang.reflect.Method.invoke(Method.java:566)

    at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1265)

    ... 10 more

Caused by: java.lang.BootstrapMethodError: bootstrap method initialization exception

    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:194)

    at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)

    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:258)

    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:248)

    at lambda.MyOuterClass.$deserializeLambda$(MyOuterClass.java:1)

    ... 20 more

Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of parameters for static method newInvokeSpecial lambda.MyOuterClass$MyInnerClass.<init>:(MyOuterClass)void; 0 captured parameters, 0 functional interface method parameters, 1 implementation parameters

    at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:214)

    at java.base/java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:503)

    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:138)

    ... 24 more



This commit contains all the remaining information about the issue (commands, class names, ...) : https://github.com/igloo-project/issue-lambda-serialization/commit/7b18c2d48833e7e1507115dd778ca1c3f40fd035

I do not find any bug that matches this issue in Eclipse Bugzilla (https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=__open__&content=LambdaConversionException&no_redirect=1&order=Importance&query_format=specific returns 4 other bugs ; the only one that could be linked from my opinion is https://bugs.eclipse.org/bugs/show_bug.cgi?id=565787, but it is not serialization-related).

Anyone can confirm my issue with my minimal test-case ? Where this issue should be created ? Product JDT, Component Core ?





Thanks for you insight,





--

Laurent Almeras









_______________________________________________

jdt-dev mailing list

[hidden email]

To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev



_______________________________________________

jdt-dev mailing list

[hidden email]

To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev





_______________________________________________

jdt-dev mailing list

[hidden email]

To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev


_______________________________________________
jdt-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev
Reply | Threaded
Open this post in threaded view
|

Re: ECJ bug for inner class method reference deserialization ?

Manoj Palat-2
Hi Gayan,
yes, that's the plan.

Regards,
Manoj

-----[hidden email] wrote: -----
To: "Eclipse JDT general developers list." <[hidden email]>
From: Gayan Perera
Sent by: [hidden email]
Date: 09/04/2020 02:18PM
Subject: [EXTERNAL] Re: [jdt-dev] ECJ bug for inner class method reference deserialization ?

Hi Manoj,

I came across with the same issue in one my projects as well. Is there any plan to fix this in next 4.18 release ?

Best regards,
Gayan

On Tue, 18 Aug 2020 at 13:13, Manoj Palat <[hidden email]> wrote:
@Laurent: I was able to reproduce the issue with the code you pointed to. Thanks!

ecj emits newInvokeSpecial()[const - 8] in bootstrap as is evident from your report as well as from the generated class files while javac sticks to InvokeSpecial. Though this itself is not an issue, need to probe further to figure out the missed param for invoke.



Regards,

Manoj







-----[hidden email] wrote: -----

To: "Eclipse JDT general developers list." <[hidden email]>

From: "Manoj Palat"

Sent by: [hidden email]

Date: 08/18/2020 10:11AM

Subject: [EXTERNAL] Re: [jdt-dev] ECJ bug for inner class method reference deserialization ?



Hi,

Can you please file a bug under JDT, ie https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT - the component is Core. One of us will take a look.



Regards,

Manoj



-----[hidden email] wrote: -----

To: [hidden email]

From: Laurent Almeras

Sent by: [hidden email]

Date: 08/17/2020 10:08PM

Subject: [EXTERNAL] [jdt-dev] ECJ bug for inner class method reference deserialization ?



Hi,

I search some insight to confirm an issue with ECJ.

I create a minimal use-case (two classes, ~20 lines) here : https://github.com/igloo-project/issue-lambda-serialization

The issue I encounter is that if I use method reference notation (ClassName::new) as a Supplier<ClassName>, this lambda triggers a deserialization issue. If I use an inlined expression - () -> new ClassName() - it works as expected. This error is triggered only if code is compiled by Eclipse. The same code, launched with mvn clean test or mvn clean exec:java does not trigger an error.

The not-expected stacktrace is :

Exception in thread "main" java.io.IOException: unexpected exception type

    at java.base/java.io.ObjectStreamClass.throwMiscException(ObjectStreamClass.java:1641)

    at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1271)

    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2153)

    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)

    at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2412)

    at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2306)

    at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2144)

    at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1646)

    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:464)

    at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)

    at lambda.MySerializer.serializeAndDeserialize(MySerializer.java:33)

    at lambda.MySerializer.main(MySerializer.java:17)

Caused by: java.lang.reflect.InvocationTargetException

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.base/java.lang.reflect.Method.invoke(Method.java:566)

    at java.base/java.lang.invoke.SerializedLambda.readResolve(SerializedLambda.java:237)

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.base/java.lang.reflect.Method.invoke(Method.java:566)

    at java.base/java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1265)

    ... 10 more

Caused by: java.lang.BootstrapMethodError: bootstrap method initialization exception

    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:194)

    at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)

    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:258)

    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:248)

    at lambda.MyOuterClass.$deserializeLambda$(MyOuterClass.java:1)

    ... 20 more

Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of parameters for static method newInvokeSpecial lambda.MyOuterClass$MyInnerClass.<init>:(MyOuterClass)void; 0 captured parameters, 0 functional interface method parameters, 1 implementation parameters

    at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:214)

    at java.base/java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:503)

    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:138)

    ... 24 more



This commit contains all the remaining information about the issue (commands, class names, ...) : https://github.com/igloo-project/issue-lambda-serialization/commit/7b18c2d48833e7e1507115dd778ca1c3f40fd035

I do not find any bug that matches this issue in Eclipse Bugzilla (https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=__open__&content=LambdaConversionException&no_redirect=1&order=Importance&query_format=specific returns 4 other bugs ; the only one that could be linked from my opinion is https://bugs.eclipse.org/bugs/show_bug.cgi?id=565787, but it is not serialization-related).

Anyone can confirm my issue with my minimal test-case ? Where this issue should be created ? Product JDT, Component Core ?





Thanks for you insight,





--

Laurent Almeras









_______________________________________________

jdt-dev mailing list

[hidden email]

To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev



_______________________________________________

jdt-dev mailing list

[hidden email]

To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev





_______________________________________________

jdt-dev mailing list

[hidden email]

To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev


_______________________________________________
jdt-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev

_______________________________________________
jdt-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev