Community
Participate
Working Groups
Taking out from Bug 548476. To find the impact of fix for Bug 548476 on JDT UI Tests.
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)
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.
Reopening this bug to discuss the other impacts on JDT UI as a result of fix for Bug 548476.
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.
(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.
(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.
(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.
*** Bug 544242 has been marked as a duplicate of this bug. ***
(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
(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.