|
Lines 10-15
Link Here
|
| 10 |
* Benjamin Muskalla <bmuskalla@innoopract.com> - [quick fix] Shouldn't offer "Add throws declaration" quickfix for overriding signature if result would conflict with overridden signature |
10 |
* Benjamin Muskalla <bmuskalla@innoopract.com> - [quick fix] Shouldn't offer "Add throws declaration" quickfix for overriding signature if result would conflict with overridden signature |
| 11 |
* Lukas Hanke <hanke@yatta.de> - Bug 241696 [quick fix] quickfix to iterate over a collection - https://bugs.eclipse.org/bugs/show_bug.cgi?id=241696 |
11 |
* Lukas Hanke <hanke@yatta.de> - Bug 241696 [quick fix] quickfix to iterate over a collection - https://bugs.eclipse.org/bugs/show_bug.cgi?id=241696 |
| 12 |
* Lukas Hanke <hanke@yatta.de> - Bug 430818 [1.8][quick fix] Quick fix for "for loop" is not shown for bare local variable/argument/field - https://bugs.eclipse.org/bugs/show_bug.cgi?id=430818 |
12 |
* Lukas Hanke <hanke@yatta.de> - Bug 430818 [1.8][quick fix] Quick fix for "for loop" is not shown for bare local variable/argument/field - https://bugs.eclipse.org/bugs/show_bug.cgi?id=430818 |
|
|
13 |
* Sandra Lions <sandra.lions-piron@oracle.com> - [quick fix] for qualified enum constants in switch-case labels - https://bugs.eclipse.org/bugs/90140 |
| 13 |
*******************************************************************************/ |
14 |
*******************************************************************************/ |
| 14 |
package org.eclipse.jdt.ui.tests.quickfix; |
15 |
package org.eclipse.jdt.ui.tests.quickfix; |
| 15 |
|
16 |
|
|
Lines 9173-9178
Link Here
|
| 9173 |
assertExpectedExistInProposals(proposals, expected); |
9174 |
assertExpectedExistInProposals(proposals, expected); |
| 9174 |
} |
9175 |
} |
| 9175 |
|
9176 |
|
|
|
9177 |
public void testReplaceWithUnqualifiedEnumConstant1() throws Exception { |
| 9178 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("pack", false, null); |
| 9179 |
StringBuffer buf= new StringBuffer(); |
| 9180 |
buf.append("package pack;\n"); |
| 9181 |
buf.append("public class E {\n"); |
| 9182 |
buf.append(" public enum color {black, white}\n"); |
| 9183 |
buf.append(" public void foo(color c) {\n"); |
| 9184 |
buf.append(" switch (c) {\n"); |
| 9185 |
buf.append(" case color.black:\n"); |
| 9186 |
buf.append(" System.out.println(\"Black\");\n"); |
| 9187 |
buf.append(" break;\n"); |
| 9188 |
buf.append(" }\n"); |
| 9189 |
buf.append(" }\n"); |
| 9190 |
buf.append("}\n"); |
| 9191 |
ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); |
| 9192 |
|
| 9193 |
CompilationUnit astRoot= getASTRoot(cu); |
| 9194 |
ArrayList proposals= collectCorrections(cu, astRoot, 2, 1); |
| 9195 |
|
| 9196 |
assertNumberOfProposals(proposals, 1); |
| 9197 |
assertCorrectLabels(proposals); |
| 9198 |
|
| 9199 |
CUCorrectionProposal proposal= (CUCorrectionProposal)proposals.get(0); |
| 9200 |
String preview= getPreviewContent(proposal); |
| 9201 |
|
| 9202 |
buf= new StringBuffer(); |
| 9203 |
buf.append("package pack;\n"); |
| 9204 |
buf.append("public class E {\n"); |
| 9205 |
buf.append(" public enum color {black, white}\n"); |
| 9206 |
buf.append(" public void foo(color c) {\n"); |
| 9207 |
buf.append(" switch (c) {\n"); |
| 9208 |
buf.append(" case black:\n"); |
| 9209 |
buf.append(" System.out.println(\"Black\");\n"); |
| 9210 |
buf.append(" break;\n"); |
| 9211 |
buf.append(" }\n"); |
| 9212 |
buf.append(" }\n"); |
| 9213 |
buf.append("}\n"); |
| 9214 |
assertEqualString(preview, buf.toString()); |
| 9215 |
String expected= buf.toString(); |
| 9216 |
assertExpectedExistInProposals(proposals, new String[] { expected }); |
| 9217 |
} |
| 9218 |
|
| 9219 |
public void testReplaceWithUnqualifiedEnumConstant2() throws Exception { |
| 9220 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("pack", false, null); |
| 9221 |
StringBuffer buf= new StringBuffer(); |
| 9222 |
buf.append("package pack;\n"); |
| 9223 |
buf.append("public class E {\n"); |
| 9224 |
buf.append(" public enum color {black, white}\n"); |
| 9225 |
buf.append(" public void foo(color c) {\n"); |
| 9226 |
buf.append(" switch (c) {\n"); |
| 9227 |
buf.append(" case (color.black):\n"); |
| 9228 |
buf.append(" System.out.println(\"Black\");\n"); |
| 9229 |
buf.append(" break;\n"); |
| 9230 |
buf.append(" }\n"); |
| 9231 |
buf.append(" }\n"); |
| 9232 |
buf.append("}\n"); |
| 9233 |
ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null); |
| 9234 |
|
| 9235 |
CompilationUnit astRoot= getASTRoot(cu); |
| 9236 |
ArrayList proposals= collectCorrections(cu, astRoot, 3, 2); |
| 9237 |
|
| 9238 |
assertNumberOfProposals(proposals, 1); |
| 9239 |
assertCorrectLabels(proposals); |
| 9240 |
|
| 9241 |
CUCorrectionProposal proposal= (CUCorrectionProposal)proposals.get(0); |
| 9242 |
String preview= getPreviewContent(proposal); |
| 9243 |
|
| 9244 |
buf= new StringBuffer(); |
| 9245 |
buf.append("package pack;\n"); |
| 9246 |
buf.append("public class E {\n"); |
| 9247 |
buf.append(" public enum color {black, white}\n"); |
| 9248 |
buf.append(" public void foo(color c) {\n"); |
| 9249 |
buf.append(" switch (c) {\n"); |
| 9250 |
buf.append(" case black:\n"); |
| 9251 |
buf.append(" System.out.println(\"Black\");\n"); |
| 9252 |
buf.append(" break;\n"); |
| 9253 |
buf.append(" }\n"); |
| 9254 |
buf.append(" }\n"); |
| 9255 |
buf.append("}\n"); |
| 9256 |
assertEqualString(preview, buf.toString()); |
| 9257 |
String expected= buf.toString(); |
| 9258 |
assertExpectedExistInProposals(proposals, new String[] { expected }); |
| 9259 |
} |
| 9260 |
|
| 9176 |
public void testCollectionsFieldMethodReplacement() throws Exception { |
9261 |
public void testCollectionsFieldMethodReplacement() throws Exception { |
| 9177 |
Hashtable options= JavaCore.getOptions(); |
9262 |
Hashtable options= JavaCore.getOptions(); |
| 9178 |
options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.WARNING); |
9263 |
options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.WARNING); |