Skip to content

Commit

Permalink
Don't use compiler options below 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveeclipse committed Jul 26, 2024
1 parent a21fac9 commit 2c2f157
Show file tree
Hide file tree
Showing 31 changed files with 434 additions and 601 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.eclipse.jdt.internal.core.manipulation.search.MethodExitsFinder;

import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jdt.ui.tests.core.rules.Java1d7ProjectTestSetup;
import org.eclipse.jdt.ui.tests.core.rules.Java1d8ProjectTestSetup;

import org.eclipse.jdt.internal.ui.JavaPlugin;

Expand All @@ -50,7 +50,7 @@
*/
public class MarkOccurrenceTest1d7 {
@Rule
public Java1d7ProjectTestSetup j7s= new Java1d7ProjectTestSetup();
public Java1d8ProjectTestSetup j7s= new Java1d8ProjectTestSetup();

private ASTParser fParser;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;

import org.eclipse.jdt.ui.tests.core.rules.Java1d7ProjectTestSetup;
import org.eclipse.jdt.ui.tests.core.rules.Java1d8ProjectTestSetup;

/**
* This class is used to run tests on Java Dolphin 1.7 .
*/
class Java1d7CompletionTestSetup extends Java1d7ProjectTestSetup {
class Java1d7CompletionTestSetup extends Java1d8ProjectTestSetup {
public IPackageFragment getTestPackage() throws CoreException {
IJavaProject project= getProject();
IPackageFragmentRoot root= project.getPackageFragmentRoot("src");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,14 @@ private void helperProjectsPrgTest(String[][] packageNames, String newPackageNam
assertNotNull(JavaProjectHelper.addRTJar(projectPrg));
IPackageFragmentRoot srcPrg= JavaProjectHelper.addSourceContainer(projectPrg, "srcPrg");
Map<String, String> optionsPrg= projectPrg.getOptions(false);
JavaProjectHelper.set15CompilerOptions(optionsPrg);
JavaProjectHelper.set18CompilerOptions(optionsPrg);
projectPrg.setOptions(optionsPrg);

projectTest= JavaProjectHelper.createJavaProject("RenamePack2", "bin");
assertNotNull(JavaProjectHelper.addRTJar(projectTest));
IPackageFragmentRoot srcTest= JavaProjectHelper.addSourceContainer(projectTest, "srcTest");
Map<String, String> optionsTest= projectTest.getOptions(false);
JavaProjectHelper.set15CompilerOptions(optionsTest);
JavaProjectHelper.set18CompilerOptions(optionsTest);
projectTest.setOptions(optionsTest);

JavaProjectHelper.addRequiredProject(projectTest, projectPrg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,47 +356,6 @@ public static void set18CompilerOptions(IJavaProject project) {
project.setOptions(options);
}

/**
* Sets the compiler options to 1.7 for the given project.
* @param project the java project
*/
public static void set17CompilerOptions(IJavaProject project) {
Map<String, String> options= project.getOptions(false);
JavaProjectHelper.set17CompilerOptions(options);
project.setOptions(options);
}

/**
* Sets the compiler options to 1.6 for the given project.
* @param project the java project
*/
public static void set16CompilerOptions(IJavaProject project) {
Map<String, String> options= project.getOptions(false);
JavaProjectHelper.set16CompilerOptions(options);
project.setOptions(options);
}

/**
* Sets the compiler options to 1.5 for the given project.
* @param project the java project
*/
public static void set15CompilerOptions(IJavaProject project) {
Map<String, String> options= project.getOptions(false);
JavaProjectHelper.set15CompilerOptions(options);
project.setOptions(options);
}

/**
* Sets the compiler options to 1.4 for the given project.
* @param project the java project
*/
public static void set14CompilerOptions(IJavaProject project) {
Map<String, String> options= project.getOptions(false);
JavaProjectHelper.set14CompilerOptions(options);
project.setOptions(options);
}


/**
* Sets the compiler options to 9.
*
Expand Down Expand Up @@ -508,46 +467,6 @@ public static void setLatestCompilerOptions(IJavaProject project) {
project.setOptions(options);
}

/**
* Sets the compiler options to 1.7
* @param options The compiler options to configure
*/
public static void set17CompilerOptions(Map<String, String> options) {
JavaCore.setComplianceOptions(JavaCore.VERSION_1_7, options);
}

/**
* Sets the compiler options to 1.6
* @param options The compiler options to configure
*/
public static void set16CompilerOptions(Map<String, String> options) {
JavaCore.setComplianceOptions(JavaCore.VERSION_1_6, options);
}

/**
* Sets the compiler options to 1.5
* @param options The compiler options to configure
*/
public static void set15CompilerOptions(Map<String, String> options) {
JavaCore.setComplianceOptions(JavaCore.VERSION_1_5, options);
}

/**
* Sets the compiler options to 1.4
* @param options The compiler options to configure
*/
public static void set14CompilerOptions(Map<String, String> options) {
JavaCore.setComplianceOptions(JavaCore.VERSION_1_4, options);
}

/**
* Sets the compiler options to 1.3
* @param options The compiler options to configure
*/
public static void set13CompilerOptions(Map<String, String> options) {
JavaCore.setComplianceOptions(JavaCore.VERSION_1_3, options);
}

/**
* Removes an IJavaElement's resource. Retries if deletion failed (e.g. because the indexer
* still locks the file).
Expand Down Expand Up @@ -931,27 +850,27 @@ public static IPackageFragmentRoot addRTJar13(IJavaProject jproject) throws Core
IPath[] rtJarPath= findRtJar(RT_STUBS_13);

Map<String, String> options= jproject.getOptions(false);
JavaProjectHelper.set13CompilerOptions(options);
JavaProjectHelper.set18CompilerOptions(options);
jproject.setOptions(options);

return addLibrary(jproject, rtJarPath[0], rtJarPath[1], rtJarPath[2]);
}

public static IPackageFragmentRoot addRTJar15(IJavaProject jproject) throws CoreException, JavaModelException {
IPath[] rtJarPath= findRtJar(RT_STUBS_15);
set15CompilerOptions(jproject);
set18CompilerOptions(jproject);
return addLibrary(jproject, rtJarPath[0], rtJarPath[1], rtJarPath[2]);
}

public static IPackageFragmentRoot addRTJar16(IJavaProject jproject) throws CoreException {
IPath[] rtJarPath= findRtJar(RT_STUBS_16);
set16CompilerOptions(jproject);
set18CompilerOptions(jproject);
return addLibrary(jproject, rtJarPath[0], rtJarPath[1], rtJarPath[2]);
}

public static IPackageFragmentRoot addRTJar17(IJavaProject jproject) throws CoreException {
IPath[] rtJarPath= findRtJar(RT_STUBS_17);
set17CompilerOptions(jproject);
set18CompilerOptions(jproject);
return addLibrary(jproject, rtJarPath[0], rtJarPath[1], rtJarPath[2]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void initializeCodeGenerationOptions() {

public static void initializeProjectOptions(IJavaProject project) {
Map<String, String> options= new HashMap<>();
JavaProjectHelper.set15CompilerOptions(options);
JavaProjectHelper.set18CompilerOptions(options);
project.setOptions(options);
}

Expand Down
Loading

0 comments on commit 2c2f157

Please sign in to comment.