diff options
author | Jayaprakash Arthanareeswaran | 2014-02-27 06:08:10 +0000 |
---|---|---|
committer | Jayaprakash Arthanareeswaran | 2014-03-03 09:54:12 +0000 |
commit | ca289ff4e9317024e3c3a344a3b266fd883ffd1d (patch) | |
tree | caee6e8a1a6bd78549cc4d9275db6895d761c6d4 /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java | |
parent | dd553f51c8fdba7f7ecd5462a90bf9788c5c48c2 (diff) | |
download | eclipse.jdt.core-ca289ff4e9317024e3c3a344a3b266fd883ffd1d.tar.gz eclipse.jdt.core-ca289ff4e9317024e3c3a344a3b266fd883ffd1d.tar.xz eclipse.jdt.core-ca289ff4e9317024e3c3a344a3b266fd883ffd1d.zip |
Bug 419351 - org.eclipse.jdt.internal.compiler.batch.Main mixes up JVM
and endorsed libraries in classpath ordering
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java')
-rw-r--r-- | org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java index dcf25e0a87..f7d91466f0 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13996,4 +13996,53 @@ public void test408038e() { "1 problem (1 warning)\n", true); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=419351 +public void testBug419351() { + String backup = System.getProperty("java.endorsed.dirs"); + String currentWorkingDirectoryPath = System.getProperty("user.dir"); + if (currentWorkingDirectoryPath == null) { + fail("BatchCompilerTest#testBug419351 could not access the current working directory " + currentWorkingDirectoryPath); + } else if (!new File(currentWorkingDirectoryPath).isDirectory()) { + fail("BatchCompilerTest#testBug419351 current working directory is not a directory " + currentWorkingDirectoryPath); + } + String endorsedPath = currentWorkingDirectoryPath + File.separator + "endorsed"; + new File(endorsedPath).mkdir(); + String lib1Path = endorsedPath + File.separator + "lib1.jar"; + try { + System.setProperty("java.endorsed.dirs", endorsedPath); + Util.createJar( + new String[] { + "java/lang/String.java", + "package java.lang;\n" + + "public class String {\n" + + " public String(java.lang.Object obj) {}\n" + + "}\n" + }, + null, + lib1Path, + JavaCore.VERSION_1_5); + this.runConformTest( + new String[] { + "src/X.java", + "public class X {\n" + + " public void foo(Object obj) {\n" + + " java.lang.String str = new java.lang.String(obj);\n" + + " }\n" + + "}\n", + }, + "\"" + OUTPUT_DIR + File.separator + "src/X.java\"" + + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" + + " -1.4 -nowarn" + + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", + "", + "", + true); + } catch (IOException e) { + System.err.println("BatchCompilerTest#testBug419351 could not write to current working directory " + currentWorkingDirectoryPath); + } finally { + System.setProperty("java.endorsed.dirs", backup); + new File(endorsedPath).delete(); + new File(lib1Path).delete(); + } +} } |