Bug 550631 - Unexpected runtime error while computing a text hover
Summary: Unexpected runtime error while computing a text hover
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.13   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.13 RC2   Edit
Assignee: Simeon Andreev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 550629
Blocks:
  Show dependency tree
 
Reported: 2019-09-01 06:22 EDT by Ed Willink CLA
Modified: 2019-09-04 05:03 EDT (History)
3 users (show)

See Also:
sarika.sinha: review+


Attachments
Zipped log files (362.38 KB, application/x-zip-compressed)
2019-09-01 06:22 EDT, Ed Willink CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2019-09-01 06:22:28 EDT
Created attachment 279739 [details]
Zipped log files

In 2019-09'M2' I get a repeatable CCE, when hovering over field declarations or references in a dirty /org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtr2qvts/RelationAnalysis.java to which an additional method had been added.

I have seen the problem before. Once it is occurring it appears to affect all field declarations or references hovers in new and old edits. Even on fields in a class file such as java.lang.HashMap.

java.lang.ClassCastException: org.eclipse.jdt.internal.debug.core.model.JDIPrimitiveValue cannot be cast to org.eclipse.jdt.internal.debug.core.model.JDIObjectValue
	at org.eclipse.jdt.internal.debug.core.model.JDIObjectValue.getField(JDIObjectValue.java:310)
	at org.eclipse.jdt.internal.debug.ui.JavaDebugHover.getHoverInfo2(JavaDebugHover.java:378)
	at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:167)
	at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:133)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:89)
	at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:169)

Attached log files might suggest what caused JDT to switch to broken mode.
Comment 1 Andrey Loskutov CLA 2019-09-01 07:05:28 EDT
My bad, coming from the fix for bug 317045.

Fix is trivial (check what we have before cast), but I'm offline for a week.

Simeon, could you please check this? 

The code change is 
https://git.eclipse.org/r/#/c/147724/3/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIObjectValue.java

I think we can make it into RC2.
Comment 2 Ed Willink CLA 2019-09-01 13:35:30 EDT
(In reply to Andrey Loskutov from comment #1)
> My bad, coming from the fix for bug 317045.

The Bugzilla de-duplication indicates that "Unexpected runtime error while computing a text hover" is a pretty frequent bug.

Isn't about time that this "bad" was caught by a JUnit test?
Comment 3 Andrey Loskutov CLA 2019-09-01 14:08:43 EDT
(In reply to Ed Willink from comment #2)
> (In reply to Andrey Loskutov from comment #1)
> > My bad, coming from the fix for bug 317045.
> 
> The Bugzilla de-duplication indicates that "Unexpected runtime error while
> computing a text hover" is a pretty frequent bug.

This is probably just because it is catched at a higher location in code where different errors are reported. Ths stach shows clearly that this is a recent regression. 

> Isn't about time that this "bad" was caught by a JUnit test?

As you can see, my patch had a test. Just the test did only test for few use cases with fields of *reference* types, and I've missed to test primitive types too. Generally speaking, a design issue in Java to have two different kinds of types, but they plan to fix this at some point in the future.
Comment 4 Sarika Sinha CLA 2019-09-02 01:39:57 EDT
@Simeon,
Please add the Gerrit to fix and add me as the reviewer for RC2.
Comment 5 Eclipse Genie CLA 2019-09-02 03:00:53 EDT
New Gerrit change created: https://git.eclipse.org/r/148695
Comment 6 Simeon Andreev CLA 2019-09-02 03:04:46 EDT
Hi Ed,

can you test with this change? https://git.eclipse.org/r/#/c/148695/

Unfortunately I don't have org.eclipse.qvtd.compiler/ and so can't verify. I tried to adjust the test from Andrey but I don't know how to cause a synthetic member of primitive type, so I don't run into the ClassCastException.

Best regards and thanks,
Simeon
Comment 7 Ed Willink CLA 2019-09-02 07:18:17 EDT
(In reply to Simeon Andreev from comment #6)
> can you test with this change? https://git.eclipse.org/r/#/c/148695/

I can test an I-build.

> Unfortunately I don't have org.eclipse.qvtd.compiler/ and so can't verify.

I only put in this kind of detail in case I have to go back and produce a better repro.

(In reply to Ed Willink from comment #0)
> I have seen the problem before. Once it is occurring it appears to affect
> all field declarations or references hovers in new and old edits. Even on
> fields in a class file such as java.lang.HashMap.

I think you have HashMap. It seemed to be a bug on all fields; the only uncertainty is whether it happens all the time or only after some sequence of edit/debug/run/check-out/...

Given that you seem to have a trivial cast fix, it would seem that it should happen all the time.
Comment 9 Sarika Sinha CLA 2019-09-02 08:02:16 EDT
+1 for RC2.

@Simeon,
Please create a bug to investigate for Primitive value for 4.14.

@Ed,
Please test in the next I Build.
Comment 10 Simeon Andreev CLA 2019-09-02 08:03:42 EDT
(In reply to Sarika Sinha from comment #9)
> @Simeon,
> Please create a bug to investigate for Primitive value for 4.14.


I believe you mean fix bug 317045 but for primitive values?
Comment 11 Sarika Sinha CLA 2019-09-02 13:27:49 EDT
(In reply to Simeon Andreev from comment #10)
> (In reply to Sarika Sinha from comment #9)
> > @Simeon,
> > Please create a bug to investigate for Primitive value for 4.14.
> 
> 
> I believe you mean fix bug 317045 but for primitive values?
Yes, Based on Andrey's remarks in Gerrit.

We, already have a build with this fix.
http://download.eclipse.org/eclipse/downloads/drops4/I20190902-0805/
Comment 12 Simeon Andreev CLA 2019-09-03 02:55:25 EDT
I've opened: bug 550675
Comment 13 Ed Willink CLA 2019-09-04 04:22:07 EDT
(In reply to Sarika Sinha from comment #9)
> @Ed,
> Please test in the next I Build.

Unfortunately, Bug 550629, downloading an I-build is no longer practical.

May have to wait for RC2.
Comment 14 Ed Willink CLA 2019-09-04 04:54:39 EDT
(In reply to Ed Willink from comment #13)
> (In reply to Sarika Sinha from comment #9)
> > @Ed,
> > Please test in the next I Build.
> 
> Unfortunately, Bug 550629, downloading an I-build is no longer practical.

Found that my final attempt to download eclipse-SDK-I20190902-1800-win32-x86_64.zip had eventually completed after I had given up. Fix seems good.
Comment 15 Sarika Sinha CLA 2019-09-04 05:03:11 EDT
Thanks !