Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 549882 - Impact of "withdrawing Java12-preview-version of switch expressions to fix completion" on JDT UI
Summary: Impact of "withdrawing Java12-preview-version of switch expressions to fix co...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.12   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.13 M3   Edit
Assignee: Kalyan Prasad Tatavarthi CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-08 07:51 EDT by Kalyan Prasad Tatavarthi CLA
Modified: 2019-08-14 12:31 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kalyan Prasad Tatavarthi CLA 2019-08-08 07:51:53 EDT
Taking out from Bug 548476.

To find the impact of fix for Bug 548476 on JDT UI Tests.
Comment 1 Kalyan Prasad Tatavarthi CLA 2019-08-08 07:54:19 EDT
testEnablePreviewsAndOpenCompilerPropertiesProposals test in QuickFixTest12 fails in the nightly builds with the below error.

Wrong number of problems, is: 7, expected: 3 Pb(1103) Switch Expressions is a preview feature and disabled by default. Use --enable-preview to enable[82 ,404] Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[97 ,117] Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[97 ,117] Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[97 ,117] Pb(232) Syntax error on token ""Weekend day"", delete this token[126 ,138] Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[143 ,191] Pb(19) Type mismatch: cannot convert from Object to String[417 ,421]

junit.framework.AssertionFailedError: Wrong number of problems, is: 7, expected: 3
Pb(1103) Switch Expressions is a preview feature and disabled by default. Use --enable-preview to enable[82 ,404]
Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[97 ,117]
Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[97 ,117]
Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[97 ,117]
Pb(232) Syntax error on token ""Weekend day"", delete this token[126 ,138]
Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[143 ,191]
Pb(19) Type mismatch: cannot convert from Object to String[417 ,421]

at junit.framework.Assert.fail(Assert.java:57)
at junit.framework.Assert.assertTrue(Assert.java:22)
at junit.framework.TestCase.assertTrue(TestCase.java:192)
at org.eclipse.jdt.ui.tests.quickfix.QuickFixTest.assertNumberOfProblems(QuickFixTest.java:307)
at org.eclipse.jdt.ui.tests.quickfix.QuickFixTest.collectCorrections(QuickFixTest.java:281)
at org.eclipse.jdt.ui.tests.quickfix.QuickFixTest.collectCorrections(QuickFixTest.java:276)
at org.eclipse.jdt.ui.tests.quickfix.QuickFixTest12.testEnablePreviewsAndOpenCompilerPropertiesProposals(QuickFixTest12.java:125)
Comment 2 Kalyan Prasad Tatavarthi CLA 2019-08-08 07:56:52 EDT
New Gerrit change created: https://git.eclipse.org/r/147252

Gerrit change https://git.eclipse.org/r/147252 was merged to [master].
Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=7b38bdc12f6a2b8c3f3a532fd0cfb5a082987e6a

Change have been released. The change is based on the fix made in Bug 548476.
To be verified in the next I-build.
Comment 3 Kalyan Prasad Tatavarthi CLA 2019-08-09 01:56:54 EDT
Reopening this bug to discuss the other impacts on JDT UI as a result of fix for Bug 548476.
Comment 4 Kalyan Prasad Tatavarthi CLA 2019-08-09 02:05:58 EDT
One important point of discussion with Manoj was that for the test case 
testEnablePreviewsAndOpenCompilerPropertiesProposals test in QuickFixTest12

in 4.12 only 3 errors were reported, but with the changes in bug 548476, now 7 errors are reported of which 5 error are for preview feature being disabled.

1) Pb(1103) Switch Expressions is a preview feature and disabled by default. Use --enable-preview to enable[82 ,404]
2) Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[97 ,117]
3) Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[97 ,117]
4) Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[97 ,117]
5) Pb(1103) Multi constant case is a preview feature and disabled by default. Use --enable-preview to enable[143 ,191]

I was of the opinion that out of the above 5 errors only 1 error should be reported as the other 4 errors (2 to 5) are reported on elements part of the Switch Expression on which a similar Error (1) has already been reported.

Manoj, Dani and others, please give your opinion on this.
Comment 5 Noopur Gupta CLA 2019-08-09 03:04:46 EDT
(In reply to Kalyan Prasad Tatavarthi from comment #4)
> I was of the opinion that out of the above 5 errors only 1 error should be
> reported as the other 4 errors (2 to 5) are reported on elements part of the
> Switch Expression on which a similar Error (1) has already been reported.
Sounds correct.

Kalyan, please analyze the impact on other preview features and the UI tooling like quick fixes, etc., if any, so that we can discuss it based on the impact.
Comment 6 Manoj N Palat CLA 2019-08-09 05:51:28 EDT
(In reply to Kalyan Prasad Tatavarthi from comment #4)
> One important point of discussion with Manoj was that for the test case > I was of the opinion that out of the above 5 errors only 1 error should be
> reported as the other 4 errors (2 to 5) are reported on elements part of the
> Switch Expression on which a similar Error (1) has already been reported.
> 
> Manoj, Dani and others, please give your opinion on this.
@Kalyan: Here is my take on this:
There are two parts two this – First part is about the two different errors – whether they can be clubbed. The two errors in question are the ones listed below:
> 1) Pb(1103) Switch Expressions is a preview feature and disabled by default.
> Use --enable-preview to enable[82 ,404]
> 2) Pb(1103) Multi constant case is a preview feature and disabled by
> default. Use --enable-preview to enable[97 ,117]
These are actually two different preview features – Switch Expression is a preview feature and multi-constant case label is another preview feature. In fact, multi-constant case labels are allowed in Switch Statements as well and hence they are not tied to Switch Expressions. Hence these should be reported independent of each other and should not be clubbed.

Next, let us look at the second part, about clubbing of errors of case statements..ie,  the clubbing of errors 2-5 into one.
> 2) Pb(1103) Multi constant case is a preview feature and disabled by
> default. Use --enable-preview to enable[97 ,117]
> 3) Pb(1103) Multi constant case is a preview feature and disabled by
> default. Use --enable-preview to enable[97 ,117]
> 4) Pb(1103) Multi constant case is a preview feature and disabled by
> default. Use --enable-preview to enable[97 ,117]
> 5) Pb(1103) Multi constant case is a preview feature and disabled by
> default. Use --enable-preview to enable[143 ,191]
These are independent lines and the compiler reports errors on each of these. A parallel can be drawn to the way, unused imports are reported, for eg, if you have two unused imports, say,
import java.util.List;
import java.util.function.BiConsumer;

the compiler reports errors on both the lines.
Description	Resource	Path	Location	Type
The import java.util.function.BiConsumer is never used	X.java	/tEST2/src	line 2	Java Problem
The import java.util.List is never used	X.java	/tEST2/src	line 1	Java Problem

However, the quick fix gives the following option:
	Remove unused import
o	Fix 2 problems of the same category in the file.
Similarly, in this case also, the compiler should report the error in each of the lines and the quick fix can club these two together provide a single window of correction to the user.
Comment 7 Noopur Gupta CLA 2019-08-09 06:01:48 EDT
(In reply to Noopur Gupta from comment #5)
> (In reply to Kalyan Prasad Tatavarthi from comment #4)
> > I was of the opinion that out of the above 5 errors only 1 error should be
> > reported as the other 4 errors (2 to 5) are reported on elements part of the
> > Switch Expression on which a similar Error (1) has already been reported.
> Sounds correct.

See bug 544242 also.

> Kalyan, please analyze the impact on other preview features and the UI
> tooling like quick fixes, etc., if any, so that we can discuss it based on
> the impact.
Comment 8 Jay Arthanareeswaran CLA 2019-08-09 06:25:59 EDT
*** Bug 544242 has been marked as a duplicate of this bug. ***
Comment 9 Dani Megert CLA 2019-08-12 12:11:37 EDT
(In reply to Jay Arthanareeswaran from comment #8)
> *** Bug 544242 has been marked as a duplicate of this bug. ***
Make sure to fix this as per bug 544242 comment 2.(In reply to Noopur Gupta from comment #5)
> (In reply to Kalyan Prasad Tatavarthi from comment #4)
> > I was of the opinion that out of the above 5 errors only 1 error should be
> > reported as the other 4 errors (2 to 5) are reported on elements part of the
> > Switch Expression on which a similar Error (1) has already been reported.
> Sounds correct.
> 
> Kalyan, please analyze the impact on other preview features and the UI
> tooling like quick fixes, etc., if any, so that we can discuss it based on
> the impact.
+1
Comment 10 Kalyan Prasad Tatavarthi CLA 2019-08-14 12:31:45 EDT
(In reply to Noopur Gupta from comment #5)

> Kalyan, please analyze the impact on other preview features and the UI
> tooling like quick fixes, etc., if any, so that we can discuss it based on
> the impact.


I have not found any other impact on preview features. Bug 544242 handles the issue in Comment 4. So, Resolving this bug.