Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

review: fix: Fixing regression in CtQueryImpl caused by lambda names in Java 21 #5469

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

I-Al-Istannen
Copy link
Collaborator

Pull request title

@clyde Can you write a pull request description for this patch fixing a java 21 regression?

diff --git a/src/main/java/spoon/reflect/visitor/chain/CtQueryImpl.java b/src/main/java/spoon/reflect/visitor/chain/CtQueryImpl.java
index a7fd868a3..a995111df 100644
--- a/src/main/java/spoon/reflect/visitor/chain/CtQueryImpl.java
+++ b/src/main/java/spoon/reflect/visitor/chain/CtQueryImpl.java
@@ -377,7 +377,7 @@ public class CtQueryImpl implements CtQuery {
                protected void onCallbackSet(String stackClass, String stackMethodName, Class<?> callbackClass, String callbackMethod, int nrOfParams, int idxOfInputParam) {
                        this.cceStacktraceClass = stackClass;
                        this.cceStacktraceMethodName = stackMethodName;
-                       if (callbackClass.getName().contains("$$Lambda$")) {
+                       if (callbackClass.getName().contains("$$Lambda")) {
                                //lambda expressions does not provide runtime information about type of input parameter
                                //clear it now. We can detect input type from first ClassCastException
                                this.expectedClass = null;

Fixes a regression in Java 21 by updating the CtQueryImpl class. The patch corrects a condition that checks for lambda expressions, ensuring that the runtime information about the type of input parameter is accurately detected. This resolves issues caused by the lack of type information in lambda expressions.

@I-Al-Istannen I-Al-Istannen self-assigned this Sep 25, 2023
@I-Al-Istannen I-Al-Istannen changed the title review: fix: Fix a jdk 21 regression as lambdas were renamed review: fix: Fixing regression in CtQueryImpl caused by lambda names in Java 21 Sep 25, 2023
Copy link
Collaborator

@SirYwell SirYwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fabulous!

Copy link
Collaborator

@MartinWitt MartinWitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class always hurts to look at. But lets merge

@MartinWitt MartinWitt merged commit ac76933 into INRIA:master Sep 27, 2023
@I-Al-Istannen I-Al-Istannen deleted the fix/jdk21-regression branch September 27, 2023 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants