Bug 216707 - [compare] Toggle comment causes noisy diff in Compare editor
Summary: [compare] Toggle comment causes noisy diff in Compare editor
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.3 M1   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-27 15:58 EST by Holger CLA
Modified: 2012-07-09 11:44 EDT (History)
6 users (show)

See Also:


Attachments
A screenshot of the cluttered diff (50.62 KB, image/jpeg)
2008-01-27 15:58 EST, Holger CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Holger CLA 2008-01-27 15:58:47 EST
Created attachment 87979 [details]
A screenshot of the cluttered diff

Build ID: I20071213-1700

Steps To Reproduce:
1. Toggle the comment of a block of code
2. Compare the two versions

More information:
The diff-view is cluttered with a lot of "different" braces and some "changed" constants whose name includes an underscore.

Expected:
Since not a even the spaces/tabs are changed, the only thing to highlight in gray are the comment-markers // on each line.
Comment 1 Tomasz Zarna CLA 2008-01-29 08:33:56 EST
TokenComparator for Java classes is provided by JDT team. Moving to JDT/UI to comment in the first place.
Comment 2 Dani Megert CLA 2010-07-28 06:25:19 EDT
Indeed. Still an issue in 3.6.
Comment 3 Holger Klene CLA 2012-07-08 09:50:39 EDT
Documentation for preference:
"General>Compare/Patch>Text compare>Disable capping when comparing large documents"

---

The capping mechanism is used to speed up finding differences in large files. In case where the capping happens the result can either be correct or it can display too many changes, but it never misses any change. Turn this option on, if you prefer a precise result in favour of possibly longer calculation time.

---

Sadly that option does not remedy this bug.
Comment 4 Markus Keller CLA 2012-07-09 11:44:33 EDT
With the fix for bug 78063, we started to dive into comments and string literals.

The problem is that the JavaTokenComparator considers '(' and ')' as separate tokens, but the basic text TokenComparator considers them as one word (a sequence of uncategorized characters).

So, we have a tradeoff between considering line-commented text as commented Java code or as basic text.

I changed the implementation to consider line-comments as Java code and removed the workaround for bug 183224:

http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=33046c38677f637e123e1adedf36dc0b454a85c9