Compare 2 objects in eclipse at runtime (when debugging)?

Is it possible to compare 2 objects using the Eclipse - Expressions tool, I am trying to debug a Java program. As much as I can, add both objects to the expressions and manually expand the object for comparison, I would like it to look like, select 2 objects (of the same type — a class, of course) and say “Compare”, and Eclipse analyzes how objects and highlights all the differences.

PS: I'm not lazy to do this manually, its just that the Object I'm dealing with is very complex, for example, it got 10 levels or arraylist objects :)

+3
source share
3 answers

, , - gson json- classpath. :

new Gson().gson.toJson(yourObject1)  

new Gson().gson.toJson(yourObject2)

json ouput, . , .

+3

, . equals "" , , , , . , Eclipse. .

Eclipse Inspect view , , . -.

, , .

http://www.howardism.org/Technical/Eclipse/Eclipse_Detail_Formatter.html

+1

Find "Browse" in the debug category. It is not open by default in the java debugging perspective. During a debugging session, you will be able to execute almost any arbitrary java-statements.

0
source

Source: https://habr.com/ru/post/1783941/


All Articles