Lines 178-191
Link Here
|
178 |
public IPath addProject(String projectName, String compliance){ |
178 |
public IPath addProject(String projectName, String compliance){ |
179 |
checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$ |
179 |
checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$ |
180 |
IProject project = createProject(projectName); |
180 |
IProject project = createProject(projectName); |
|
|
181 |
int requiredComplianceFlag = 0; |
182 |
String compilerVersion = null; |
181 |
if ("1.5".equals(compliance)) { |
183 |
if ("1.5".equals(compliance)) { |
182 |
if ((AbstractCompilerTest.getPossibleComplianceLevels() & AbstractCompilerTest.F_1_5) == 0) |
184 |
requiredComplianceFlag = AbstractCompilerTest.F_1_5; |
183 |
throw new RuntimeException("This test should run on top of a 1.5 JRE"); |
185 |
compilerVersion = CompilerOptions.VERSION_1_5; |
|
|
186 |
} |
187 |
else if ("1.6".equals(compliance)) { |
188 |
requiredComplianceFlag = AbstractCompilerTest.F_1_6; |
189 |
compilerVersion = CompilerOptions.VERSION_1_6; |
190 |
} |
191 |
else if ("1.7".equals(compliance)) { |
192 |
requiredComplianceFlag = AbstractCompilerTest.F_1_7; |
193 |
compilerVersion = CompilerOptions.VERSION_1_7; |
194 |
} |
195 |
else if (!"1.4".equals(compliance) && !"1.3".equals(compliance)) { |
196 |
throw new UnsupportedOperationException("Test framework doesn't support compliance level: " + compliance); |
197 |
} |
198 |
if (requiredComplianceFlag != 0) { |
199 |
if ((AbstractCompilerTest.getPossibleComplianceLevels() & requiredComplianceFlag) == 0) |
200 |
throw new RuntimeException("This test requires a " + compliance + " JRE"); |
184 |
IJavaProject javaProject = JavaCore.create(project); |
201 |
IJavaProject javaProject = JavaCore.create(project); |
185 |
Map options = new HashMap(); |
202 |
Map options = new HashMap(); |
186 |
options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); |
203 |
options.put(CompilerOptions.OPTION_Compliance, compilerVersion); |
187 |
options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); |
204 |
options.put(CompilerOptions.OPTION_Source, compilerVersion); |
188 |
options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); |
205 |
options.put(CompilerOptions.OPTION_TargetPlatform, compilerVersion); |
189 |
javaProject.setOptions(options); |
206 |
javaProject.setOptions(options); |
190 |
} |
207 |
} |
191 |
return project.getFullPath(); |
208 |
return project.getFullPath(); |