Skip to content

Commit 9e01da0

Browse files
committed
Remove test relying on Java 1.3 compilation options
- The (positive) test `testDestination_yes_cuFromRoot` could only work with compiler set to use 1.3 JLS. - The sibling (negative) test `testDestination_no_cuFromRoot` changed to use supported JLS version. See eclipse-jdt/eclipse.jdt.core#3883
1 parent 18d07f8 commit 9e01da0

File tree

1 file changed

+11
-61
lines changed
  • org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ccp

1 file changed

+11
-61
lines changed

org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ccp/MoveTest.java

Lines changed: 11 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,11 +1005,11 @@ public void testDestination_yes_cuToOtherPackageBug549674() throws Exception {
10051005

10061006
String str= """
10071007
package p;
1008-
1008+
10091009
import q.Class1;
10101010
import q.Class3;
10111011
import q.Class3.InnerClass3;
1012-
1012+
10131013
public class Class2 {
10141014
Class1 c;
10151015
Class3 c3;
@@ -1048,9 +1048,9 @@ public interface InnerClass3 {
10481048

10491049
String str3= """
10501050
package q;
1051-
1051+
10521052
import q.Class3.InnerClass3;
1053-
1053+
10541054
public class Class2 {
10551055
Class1 c;
10561056
Class3 c3;
@@ -1073,9 +1073,9 @@ public void testDestination_yes_cuToOtherPackageBug21008() throws Exception {
10731073

10741074
String str= """
10751075
package p;
1076-
1076+
10771077
import q.*;
1078-
1078+
10791079
public class Class2 {
10801080
Class1 c;
10811081
Class3 c3;
@@ -1114,7 +1114,7 @@ public interface InnerClass3 {
11141114

11151115
String str3= """
11161116
package q;
1117-
1117+
11181118
public class Class2 {
11191119
Class1 c;
11201120
Class3 c3;
@@ -1206,9 +1206,9 @@ public class Class1 {
12061206

12071207
String str2= """
12081208
package p2;
1209-
1209+
12101210
import p.Class1;
1211-
1211+
12121212
public class Class2 {
12131213
Class1 c;
12141214
}
@@ -1257,64 +1257,14 @@ public void testDestination_yes_cuToRoot() throws Exception {
12571257

12581258
}
12591259

1260-
@Test
1261-
public void testDestination_yes_cuFromRoot() throws Exception {
1262-
ParticipantTesting.reset();
1263-
1264-
//import statement with type from default package - only <= java 1.3
1265-
IJavaProject javaProject= getRoot().getJavaProject();
1266-
Map<String, String> originalOptions= javaProject.getOptions(false);
1267-
Map<String, String> newOptions= javaProject.getOptions(false);
1268-
newOptions.put(JavaCore.COMPILER_COMPLIANCE, "1.3");
1269-
newOptions.put(JavaCore.COMPILER_SOURCE, "1.3");
1270-
javaProject.setOptions(newOptions);
1271-
1272-
String oldD= "import org.test.Reference;public class Default {Reference ref;}";
1273-
String oldRef= "package org.test;import Default;public class Reference{Default d;}";
1274-
String newD= "package org;\nimport org.test.Reference;public class Default {Reference ref;}";
1275-
String newRef= "package org.test;import org.Default;public class Reference{Default d;}";
1276-
ICompilationUnit cuD= getRoot().getPackageFragment("").createCompilationUnit("Default.java", oldD, false, new NullProgressMonitor());
1277-
IPackageFragment orgTest= getRoot().createPackageFragment("org.test", false, new NullProgressMonitor());
1278-
ICompilationUnit cuRef= orgTest.createCompilationUnit("Reference.java", oldRef, false, new NullProgressMonitor());
1279-
IPackageFragment org= getRoot().getPackageFragment("org");
1280-
ICompilationUnit newCuD= org.getCompilationUnit(cuD.getElementName());
1281-
try{
1282-
IJavaElement[] javaElements= { cuD };
1283-
IResource[] resources= {};
1284-
String[] handles= ParticipantTesting.createHandles(new Object[] {cuD, cuD.getTypes()[0], cuD.getResource()});
1285-
JavaMoveProcessor ref= verifyEnabled(resources, javaElements, createReorgQueries());
1286-
1287-
verifyValidDestination(ref, org);
1288-
1289-
assertTrue("source file Default.java does not exist before moving", cuD.exists());
1290-
assertTrue("source file Reference.java does not exist before moving", cuRef.exists());
1291-
RefactoringStatus status= performRefactoring(ref, true);
1292-
assertNull(status);
1293-
assertFalse("source file Default.java exists after moving", cuD.exists());
1294-
assertTrue("new file Default.java does not exist after moving", newCuD.exists());
1295-
assertTrue("source file Reference.java does not exist after moving", cuRef.exists());
1296-
assertEqualLines("Default.java differs", newD, newCuD.getSource());
1297-
assertEqualLines("Reference.java differs", newRef, cuRef.getSource());
1298-
1299-
ParticipantTesting.testMove(
1300-
handles,
1301-
new MoveArguments[] {
1302-
new MoveArguments(org, ref.getUpdateReferences()),
1303-
new MoveArguments(org, ref.getUpdateReferences()),
1304-
new MoveArguments(org.getResource(), ref.getUpdateReferences())});
1305-
}finally{
1306-
javaProject.setOptions(originalOptions);
1307-
}
1308-
}
1309-
13101260
@Test
13111261
public void testDestination_no_cuFromRoot() throws Exception {
13121262
//import statement with type from default package - only <= java 1.3
13131263
IJavaProject javaProject= getRoot().getJavaProject();
13141264
Map<String, String> originalOptions= javaProject.getOptions(false);
13151265
Map<String, String> newOptions= javaProject.getOptions(false);
1316-
newOptions.put(JavaCore.COMPILER_COMPLIANCE, "1.4"); //will cause error (potential match)
1317-
newOptions.put(JavaCore.COMPILER_SOURCE, "1.4"); //will cause error (potential match)
1266+
newOptions.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8); //will cause error (potential match)
1267+
newOptions.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8); //will cause error (potential match)
13181268
javaProject.setOptions(newOptions);
13191269

13201270
String oldD= "import org.test.Reference;public class Default {Reference ref;}";

0 commit comments

Comments
 (0)