| Summary: | [compare] "Ignore White Space" should not affect Java strings | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Pawel Pogorzelski <pawel.pogorzelski1> |
| Component: | Compare | Assignee: | Platform-Compare-Inbox <platform-compare-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel_megert, lisa.woodring, markus.kell.r, redstun, shanh, tomasz.zarna |
| Version: | 3.5 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
|
Description
Pawel Pogorzelski
This is in JDT. Back to Compare: we return different content from org.eclipse.jdt.internal.ui.compare.JavaStructureCreator.getContents(Object, boolean) but compare fails to mark them in the compare viewer. *** Bug 38178 has been marked as a duplicate of this bug. *** If performing a CVS compare, would it be best to simply use the CVS flags (-bt)?
It appears to me like the compare should:
* If there is a set of whitespace elements (1 or more), ignore any changes to that set. So, multiple spaces changed to 1 are ignored. And a single space changed to multiple would also be ignored.
* However, removing or adding the presence of whitespace should be detected.
For example:
* 'new Object()' --changed-to--> 'newObject()'
should be flagged, but is currently ignored
* 'Object.CONSTANT_VAL' --changed-to--> 'Object.CONSTANT_ VAL'
should be flagged, but is currently ignored
* 'foo() {}' --changed-to--> 'foo() {}'
ignored
* 'foo() {}' --changed-to--> 'foo(){}'
would be flagged as a change (would be an annoying side-effect, but accurate
unless you expand the feature to be Java aware)
(In reply to comment #4) > If performing a CVS compare, would it be best to simply use the CVS flags > (-bt)? This would change nothing in handling string values which is why this bug was reported in the first place. (In reply to comment #5) > (In reply to comment #4) > > If performing a CVS compare, would it be best to simply use the CVS flags > > (-bt)? > > This would change nothing in handling string values which is why this bug was > reported in the first place. Maybe you should give an example then... public static final String CONSTANT = "foobar"; public static final String CONSTANT = "foo bar"; would be flagged by CVS. However, if this is what you mean: public static final String CONSTANT = "foo bar"; public static final String CONSTANT = "foo bar"; would not be flagged. Using the CVS flags (-bt) would be a lot better than the current behavior. (In reply to comment #6) I meant your second example. Regarding -bt flag - I'm not sure we want to show different results depending on the location of the resource (local vs. CVS). Tomasz, what do you think about it? We should present same results no matter if we're comparing against remote (e.g. CVS) or local variant. At the same time, I can imagine a situation when compare editor shows different changes depending on type of comparison being done (i.e. Text Compare vs Java Compare). AFAIK, this can be achieved by implementing ITokenComparator and and overriding the TextMergeViewer.createTokenComparator factory method. This already happens for Java files, see JavaTokenComparator and JaveMergeViewer.createTokenComparator, so I guess tweaking the comparator could do the job. However, I don't have much experience in this particular area so I might have missed something. I was just hit by this bug when I try to create patch for https://bugs.eclipse.org/bugs/show_bug.cgi?id=321092 The change from "//" to "// " is ignored with compare preference "ignore white space" enabled. This is wrong. At least here we should recognize that previous there's no space in the String, but now we have at lease one space, it's the difference between HAVE and HAVENOT, not just a change of space amount. 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. |