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

Detect cyclical class hierarchy and prevent infinite recursion when calculating all fields and methods of an object #725

Closed
datho7561 opened this issue Aug 26, 2022 · 0 comments · Fixed by #735
Assignees
Labels
bug Something isn't working qute
Milestone

Comments

@datho7561
Copy link
Contributor

Let's say we have the following classes:

  • ClassA which extends ClassC
  • ClassB which extends ClassA
  • ClassC which extends ClassB

JDT reports an error for this since it can't be compiled. If you make a Qute template that includes one of these classes as a parameter, then open up completion:

{@org.acme.ClassA objectA}
{objectA.|}

Then you won't ever get completion back, since qute-ls uses recursion in order to collect the fields and methods of the subtypes, and will be stuck cycling between the 3 types. I'd be nice to prevent the infinite recursion in this case.

@datho7561 datho7561 added bug Something isn't working qute labels Aug 26, 2022
@rgrunber rgrunber added this to the 0.13.0 milestone Aug 31, 2022
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Sep 1, 2022
If a cycle is detected,
don't return any of the properties or methods of the class.
Prevent ResolvedJavaTypeInfo from being fetched from qute.jdt multiple times.
This prevents completion from freezing when you try to complete the
properties and methods of an object whose class is part of an
inheritance cycle.

Closes redhat-developer#725

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Sep 1, 2022
If a cycle is detected,
don't return any of the properties or methods of the class.
Prevent ResolvedJavaTypeInfo from being fetched from qute.jdt multiple times.
This prevents completion from freezing when you try to complete the
properties and methods of an object whose class is part of an
inheritance cycle.

Closes redhat-developer#725

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Sep 7, 2022
If a cycle is detected,
don't return any of the properties or methods of the class.
Prevent ResolvedJavaTypeInfo from being fetched from qute.jdt multiple times.
This prevents completion from freezing when you try to complete the
properties and methods of an object whose class is part of an
inheritance cycle.

Closes redhat-developer#725

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Sep 7, 2022
If a cycle is detected,
don't return any of the properties or methods of the class.
Prevent ResolvedJavaTypeInfo from being fetched from qute.jdt multiple times.
This prevents completion from freezing when you try to complete the
properties and methods of an object whose class is part of an
inheritance cycle.

Closes redhat-developer#725

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Sep 7, 2022
If a cycle is detected,
don't return any of the properties or methods of the class.
Prevent ResolvedJavaTypeInfo from being fetched from qute.jdt multiple times.
This prevents completion from freezing when you try to complete the
properties and methods of an object whose class is part of an
inheritance cycle.

Closes redhat-developer#725

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Sep 7, 2022
Prevent types from being visited twice while collecting type
information.
This prevents validation, completion, and code actions from freezing
when working with objects of classes that have cyclic inheritance.

Closes redhat-developer#725

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Sep 7, 2022
Prevent types from being visited twice while collecting type
information.
This prevents validation, completion, and code actions from freezing
when working with objects of classes that have cyclic inheritance.

Closes redhat-developer#725

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Sep 8, 2022
Prevent types from being visited twice while collecting type
information.
This prevents validation, completion, and code actions from freezing
when working with objects of classes that have cyclic inheritance.

Closes redhat-developer#725

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to datho7561/quarkus-ls that referenced this issue Sep 8, 2022
Prevent types from being visited twice while collecting type
information.
This prevents validation, completion, and code actions from freezing
when working with objects of classes that have cyclic inheritance.

Closes redhat-developer#725

Signed-off-by: David Thompson <davthomp@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working qute
Projects
None yet
2 participants