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

Missing subtrees in case having Generic functions with type parameter as the return type #92

Open
pouryafard75 opened this issue Dec 15, 2023 · 13 comments
Labels
bug Something isn't working Tree related This is directly related to the tree generation.

Comments

@pouryafard75
Copy link
Owner

Case: pouryafard75/TestCases@58b8350

Due to the dependency to gumtree 3.0 jdt tree generator, the differences are not highlighted:
image

Surprisingly, 2.1 tree generator contains this information:
image

@pouryafard75 pouryafard75 added bug Something isn't working Tree related This is directly related to the tree generation. labels Dec 15, 2023
@tsantalis
Copy link

@pouryafard75
Is it possible to fix this issue on our side?

@pouryafard75
Copy link
Owner Author

@tsantalis It is possible, However this will make tools incompatible.

@tsantalis
Copy link

Can we make a PR to gumtree? but then they need to make a new maven release.
The incompatibility is not a problem, because we have 3.0.3 as compatible release.

@pouryafard75
Copy link
Owner Author

@tsantalis All the perfect diffs at the moment, work based on 3.0 tree structure.
I assume around 200 cases might need change if we change the structure!

@tsantalis
Copy link

@pouryafard75
Could we submit a PR resolving the issue opened at Gumtree repository, now that the issue has been checked by Jean-Rémy?

@pouryafard75
Copy link
Owner Author

@tsantalis
I did these two commits to resolve the issue:
fix: add typeArguments subtrees to the receiver of the method invocation for jdt
add test for typeArguments of the method invocation in jdt

I have also tested the diff to ensure the correctness:
image

@pouryafard75
Copy link
Owner Author

@tsantalis PR submitted GumTreeDiff/gumtree#327

@tsantalis
Copy link

@pouryafard75
SuperMethodInvocation has type arguments too. Can we update the PR to handle this case?

SuperMethodInvocation:
[ ClassName . ] super .
[ < Type { , Type } > ]
Identifier ( [ Expression { , Expression } ] )

@tsantalis
Copy link

@pouryafard75
ClassInstanceCreation has type arguments too.

ClassInstanceCreation:
[ Expression . ]
new [ < Type { , Type } > ]
Type ( [ Expression { , Expression } ] )
[ AnonymousClassDeclaration ]

@pouryafard75
Copy link
Owner Author

pouryafard75 commented Jan 19, 2024

@pouryafard75 SuperMethodInvocation has type arguments too. Can we update the PR to handle this case?

SuperMethodInvocation: [ ClassName . ] super . [ < Type { , Type } > ] Identifier ( [ Expression { , Expression } ] )

@tsantalis
super.<String>emptyList(); --->

    SuperMethodInvocation [35,60]
              SimpleType [42,48]
                      SimpleName: String [42,48]
              SimpleName: emptyList [49,58]

this.<String>emptyList(); --->

              MethodInvocation [35,59]
                        METHOD_INVOCATION_RECEIVER [35,39]
                            ThisExpression [35,39]
                            SimpleType [41,47]
                                SimpleName: String [41,47]
                        SimpleName: emptyList [48,57]

This is default GumTree 3.0 output, They dont override the visitor for these ASTNodes, Method invocation is the only one which has been overwritten.

@pouryafard75
Copy link
Owner Author

pouryafard75 commented Jan 19, 2024

ClassInstanceCreation

@tsantalis Can you give me an example for this here?

new A().<String>emptyList();-->

           MethodInvocation [35,62]
                        METHOD_INVOCATION_RECEIVER [35,42]
                            ClassInstanceCreation [35,42]
                                SimpleType [39,40]
                                    SimpleName: A [39,40]
                            SimpleType [44,50]
                                SimpleName: String [44,50]
                        SimpleName: emptyList [51,60]

If you meant this, its already supported.

@tsantalis
Copy link

new A().<String>emptyList()
This is a method invocation with class instance creation as receiver.

The case I am talking about looks like
new <Category> Payload(arg1, arg2)

@pouryafard75
Copy link
Owner Author

@tsantalis Thanks for the clarification.

new <Category> Payload(arg1, arg2); -->

           ClassInstanceCreation [35,69]
                        SimpleType [40,48]
                            SimpleName: Category [40,48]
                        SimpleType [50,57]
                            SimpleName: Payload [50,57]
                        SimpleName: arg1 [58,62]
                        SimpleName: arg2 [64,68]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Tree related This is directly related to the tree generation.
Projects
None yet
Development

No branches or pull requests

2 participants