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

Null check handling for Stack trace ambiguity #543 #544

Closed

Conversation

SougandhS
Copy link
Contributor

@SougandhS SougandhS commented Oct 21, 2024

What it does

Fix for #543

How to test

Author checklist

Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

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

  1. Commit message is wrong and doesn't explain the fix, see https://github.com/eclipse-jdt/.github/blob/main/CONTRIBUTING.md#commit-message-recommendations

  2. With this fix, instead of an error I get this dialog:
    image
    and of course this makes no sense, I don't want to create any brekpoints!
    This was before using method name to find unqualified Stacktraces in Java Stack Trace #498:
    image

  3. Clocking on ForkJoinTask in at java.base/java.util.concurrent.ForkJoinTask.reportExecutionException(ForkJoinTask.java:605) shows empty and meaningless error about opening something from clipboard (???):

image

while it was type selection dialog before :
image

@@ -208,6 +208,33 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
List<Object> matches = (List<Object>) source;
List<Object> exactMatchesFiltered = new ArrayList<>();
String originalHyperLink2 = originalHyperLink;
if (originalHyperLink2 == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Original code is unreadable, this makes it even more unreadable.

Ideally I would revert entire #498 PR as it adds non maintainable code, I simply can't read this huge nested method.

Also while playing with the PR I've noticed it makes use of OpenFromClipboardAction code for the cases where it obviously generated absolutely wrong class names like bin.org.eclipse.core.runtime.internal.adaptor - note the bin at beginning.

Java Model Exception: Error in Java Model (code 969): bin.org.eclipse.core.runtime.internal.adaptor [in /data/git/equinox/bundles/org.eclipse.osgi/bin] does not exist
	at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:556)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:234)
	at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:508)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:228)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:569)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:292)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:278)
	at org.eclipse.jdt.internal.core.BinaryType.getClassFileInfo(BinaryType.java:232)
	at org.eclipse.jdt.internal.core.BinaryType.getChildren(BinaryType.java:195)
	at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType(JavaElement.java:247)
	at org.eclipse.jdt.internal.core.BinaryType.getMethods(BinaryType.java:494)
	at org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink$3.runInUIThread(JavaStackTraceHyperlink.java:247)
  1. Please amend your commit and update commit message to match recommended style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure @iloveeclipse 👍

@iloveeclipse
Copy link
Member

Looking on the number of issues I've found above, I will now revert #498 PR as

  1. the code has multiple regressions
  2. The code in org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink.searchCompleted(Object, String, int, IStatus) is simply not maintainable.

I would recommend to rewrite #498.

iloveeclipse added a commit to iloveeclipse/eclipse.jdt.debug that referenced this pull request Oct 21, 2024
signature + code review changes + Additional changes"

This reverts commit 32fa010.

Added code is unmaintainable and has multiple regressions. It should
have never been merged "as is".

See eclipse-jdt#544
Fixes eclipse-jdt#543
@SougandhS
Copy link
Contributor Author

Looking on the number of issues I've found above, I will now revert #498 PR as

  1. the code has multiple regressions
  2. The code in org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink.searchCompleted(Object, String, int, IStatus) is simply not maintainable.

I would recommend to rewrite #498.

Will re-do this like you suggested.

iloveeclipse added a commit that referenced this pull request Oct 21, 2024
signature + code review changes + Additional changes"

This reverts commit 32fa010.

Added code is unmaintainable and has multiple regressions. It should
have never been merged "as is".

See #544
Fixes #543
@SougandhS
Copy link
Contributor Author

  1. Commit message is wrong and doesn't explain the fix, see https://github.com/eclipse-jdt/.github/blob/main/CONTRIBUTING.md#commit-message-recommendations
  2. With this fix, instead of an error I get this dialog:
    image
    and of course this makes no sense, I don't want to create any brekpoints!
    This was before using method name to find unqualified Stacktraces in Java Stack Trace #498:
    image
  3. Clocking on ForkJoinTask in at java.base/java.util.concurrent.ForkJoinTask.reportExecutionException(ForkJoinTask.java:605) shows empty and meaningless error about opening something from clipboard (???):

image

while it was type selection dialog before : image

Hi @iloveeclipse

Regarding 2.

It seems to be the default behaviour -> In master I get the same behaviour now too. If the generated source is not list and have only 1 binaryType and is of exception type then this implementation is called ->

org.eclipse.jdt.internal.debug.ui.console.JavaExceptionHyperLink.processSearchResult() instead of org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink.processSearchResult()

I reproduced the same now.
If I have only 1 BinaryType then control goes here
image
then ->
image

But If I have multiple BinaryType then openType is triggered
image

Shall I raise this as a new issue ?

@iloveeclipse
Copy link
Member

Shall I raise this as a new issue ?

I don't have IDE right now, but any bug you see in a plain SDK without any changes is a bug and should be reported. If you see "add breakpoint" dalog for clicking on "regular" stack trace line, instead of navigation to the right code, it is a bug.

@SougandhS
Copy link
Contributor Author

SougandhS commented Nov 14, 2024

Shall I raise this as a new issue ?

I don't have IDE right now, but any bug you see in a plain SDK without any changes is a bug and should be reported. If you see "add breakpoint" dalog for clicking on "regular" stack trace line, instead of navigation to the right code, it is a bug.

on regular stacktrace it is not going to any breakpoint creation.. its only for Exception traces . I see its a feature, but like you reported I dont feel its a good approach. can we provide some right click option for creating breakpoint option rather than directly showing this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants