Bug 551252 - Detail Formatters - Cannot output Boolean objects to its string representation
Summary: Detail Formatters - Cannot output Boolean objects to its string representation
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.13   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-19 10:20 EDT by Taro Kyo CLA
Modified: 2023-09-05 02:11 EDT (History)
1 user (show)

See Also:


Attachments
Screenshot of the detail formatter failing to parse Boolean object values. (107.75 KB, image/png)
2019-09-19 10:20 EDT, Taro Kyo CLA
no flags Details
String + Boolean.toString(boolean) (141.68 KB, image/png)
2019-09-19 11:16 EDT, Taro Kyo CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Taro Kyo CLA 2019-09-19 10:20:28 EDT
Created attachment 279934 [details]
Screenshot of the detail formatter failing to parse Boolean object values.

Unsure if Detail Formatters support "java.lang.*" by default in its classpath lookup, where "*" can be String, Boolean, Double, etc. If by default, Detail Formatters do not even support "java.lang.*", then I would request that this detail be explained somewhere where it can be seen while editing Detail Formatters.

Attempting to display a boolean value in its string representation works fine for primitives, but if we were to use Boolean objects and attempt to output its values in string representation, it will fail with the following error:

Detail formatter error: Evaluations must contain either an expression or a block of well-formed statements

Here's the following Detail Formatter for Booleans:

return Boolean.toString(this.booleanValue());

I was told by others that the Detail Formatter works like lambda functions, and we can omit the "return" keyword. But after modifying the code, it doesn't change nor resolve the issue:

Boolean.toString(this.booleanValue());

I am unsure what else to fix the detail formatter code, so may I also request for some insights as to how to go about fixing this?
Comment 1 Taro Kyo CLA 2019-09-19 11:16:51 EDT
Created attachment 279936 [details]
String + Boolean.toString(boolean)
Comment 2 Taro Kyo CLA 2019-09-19 11:17:54 EDT
I'm now not sure if semi-colons are needed. I posted a new screenshot.
Comment 3 Sarika Sinha CLA 2019-09-20 01:57:32 EDT
(In reply to Taro Kyo from comment #0)
> 
> I was told by others that the Detail Formatter works like lambda functions,
> and we can omit the "return" keyword. But after modifying the code, it
> doesn't change nor resolve the issue:
> 
> Boolean.toString(this.booleanValue());
> 
> I am unsure what else to fix the detail formatter code, so may I also
> request for some insights as to how to go about fixing this?

I am not aware that DetailedFormatter works like Lambda functions. Can you point to the document?
Comment 4 Taro Kyo CLA 2019-09-20 08:25:48 EDT
This is where I can only find all official information about Detail Formatters:

https://help.eclipse.org/2019-09/index.jsp

Because there aren't a lot of information as to what it can support, it's rumored around online that it can work as if it's written for lambda expressions.

We don't really know too well about this. For example, do we need to write a full-on class object extending some Objects we want to inspect and override methods in order to show what we wanted to inspect? Do we need to write it out in C-style in Java code, where it's just global static methods everywhere? 

Or we need to explicitly say which of the packages/classes we need to use via importing them in the Detail Formatter?


The only clue we know of is that it needs Java code.

Hence, I'm stumbling along, trying to figure out how to inspect Boolean and Double objects (not the primitive boolean and double data types, but the bigger objects).
Comment 6 Sarika Sinha CLA 2019-09-23 02:40:46 EDT
Ok, In that sense you can see it is like a a little bit of lambda but not actually that(this came much before Java Lambda support).

You can google or use some of these links to understand formatters better:
https://www.eclipsezone.com/eclipse/forums/t88390.html
https://www.vogella.com/tutorials/EclipseDebugging/article.html#controlling-the-display-of-the-variables-with-detail-formatter
Comment 7 Taro Kyo CLA 2019-09-24 09:44:02 EDT
Reading the articles isn't too much useful, as the main issue (Displaying Boolean / Double object values as Strings) weren't addressed in both of the articles.

I'll continue to do a bit of research on my side, but it would be really nice to have some official clarifications in the Eclipse documentation.
Comment 8 Eclipse Genie CLA 2021-09-14 03:08:23 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 9 Eclipse Genie CLA 2023-09-05 02:11:01 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.