Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 86096 Details for
Bug 97332
[compiler] Add support for classpath specified in manifest file inside a jar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
writing tests (wip)
patch_97332_04_writing_tests.txt (text/plain), 26.22 KB, created by
Maxime Daniel
on 2008-01-03 09:15:37 EST
(
hide
)
Description:
writing tests (wip)
Filename:
MIME Type:
Creator:
Maxime Daniel
Created:
2008-01-03 09:15:37 EST
Size:
26.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v >retrieving revision 1.141 >diff -u -r1.141 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 3 Jan 2008 08:34:13 -0000 1.141 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 3 Jan 2008 14:13:28 -0000 >@@ -53,6 +53,183 @@ > return buildUniqueComplianceTestSuite(testClass(), ClassFileConstants.JDK1_5); > } > >+protected void tearDown() throws Exception { >+ disposeCascadedJars(); >+ super.tearDown(); >+} >+ >+// PREMATURE find a way to build the jars once for the whole suite >+private boolean cascadedJarsCreated; >+private String cascadedJarsDirectoryPath; >+private void createCascadedJars() { >+ if (!this.cascadedJarsCreated) { >+ this.cascadedJarsDirectoryPath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(); >+ if (!this.cascadedJarsDirectoryPath.endsWith(File.separator)) { >+ this.cascadedJarsDirectoryPath = this.cascadedJarsDirectoryPath + File.separator; >+ } >+ try { >+ Util.createJar( >+ new String[] { >+ "p/A.java", >+ "package p;\n" + >+ "public class A {\n" + >+ "}", >+ }, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Created-By: Eclipse JDT Test Harness\n" + >+ "Class-Path: lib2.jar\n", >+ }, >+ this.cascadedJarsDirectoryPath + "lib1.jar", >+ JavaCore.VERSION_1_4); >+ Util.createJar( >+ new String[] { >+ "p/B.java", >+ "package p;\n" + >+ "public class B {\n" + >+ "}", >+ "p/R.java", >+ "package p;\n" + >+ "public class R {\n" + >+ " public static final int R2 = 2;\n" + >+ "}", >+ }, >+ this.cascadedJarsDirectoryPath + "lib2.jar", >+ JavaCore.VERSION_1_4); >+ Util.createJar( >+ new String[] { >+ "p/C.java", >+ "package p;\n" + >+ "public class C {\n" + >+ "}", >+ "p/R.java", >+ "package p;\n" + >+ "public class R {\n" + >+ " public static final int R3 = 3;\n" + >+ "}", >+ }, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Created-By: Eclipse JDT Test Harness\n" + >+ "Class-Path: lib4.jar\n", >+ }, >+ this.cascadedJarsDirectoryPath + "lib3.jar", >+ JavaCore.VERSION_1_4); >+ Util.createJar( >+ new String[] { >+ "p/D.java", >+ "package p;\n" + >+ "public class D {\n" + >+ "}", >+ }, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Created-By: Eclipse JDT Test Harness\n" + >+ "Class-Path: lib1.jar lib3.jar\n", >+ }, >+ this.cascadedJarsDirectoryPath + "lib4.jar", >+ JavaCore.VERSION_1_4); >+ Util.createJar( >+ new String[] { >+ "p/C.java", >+ "package p;\n" + >+ "public class C {\n" + >+ "}", >+ "p/R.java", >+ "package p;\n" + >+ "public class R {\n" + >+ " public static final int R3 = 3;\n" + >+ "}", >+ }, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Created-By: Eclipse JDT Test Harness\n" + >+ "Class-Path: s/lib6.jar\n", >+ }, >+ this.cascadedJarsDirectoryPath + "lib5.jar", >+ JavaCore.VERSION_1_4); >+ new File(this.cascadedJarsDirectoryPath + "s").mkdir(); >+ Util.createJar( >+ new String[] { >+ "p/D.java", >+ "package p;\n" + >+ "public class D {\n" + >+ "}", >+ }, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Created-By: Eclipse JDT Test Harness\n" + >+ "Class-Path: ../lib7.jar\n", >+ }, >+ this.cascadedJarsDirectoryPath + "s" + File.separator + "lib6.jar", >+ JavaCore.VERSION_1_4); >+ Util.createJar( >+ new String[] { >+ "p/A.java", >+ "package p;\n" + >+ "public class A {\n" + >+ "}", >+ }, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Created-By: Eclipse JDT Test Harness\n" + >+ "Class-Path: lib2.jar\n", >+ }, >+ this.cascadedJarsDirectoryPath + "lib7.jar", >+ JavaCore.VERSION_1_4); >+ Util.createJar( >+ new String[] { >+ "p/F.java", >+ "package p;\n" + >+ "public class F {\n" + >+ "}", >+ }, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Created-By: Eclipse JDT Test Harness\n" + >+ "Class-Path: " + this.cascadedJarsDirectoryPath + "lib3.jar lib1.jar\n", >+ }, >+ this.cascadedJarsDirectoryPath + "lib8.jar", >+ JavaCore.VERSION_1_4); >+ Util.createJar( >+ new String[] { >+ "p/G.java", >+ "package p;\n" + >+ "public class G {\n" + >+ "}", >+ }, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Created-By: Eclipse JDT Test Harness\n" + >+ "Class-Path: lib1.jar\n" + >+ "Class-Path: lib3.jar\n", >+ }, >+ this.cascadedJarsDirectoryPath + "lib9.jar", >+ JavaCore.VERSION_1_4); >+ this.cascadedJarsCreated = true; >+ } catch (IOException e) { >+ // ignore >+ } >+ } >+} >+private void disposeCascadedJars() { >+ if (this.cascadedJarsCreated) { >+ Util.delete(this.cascadedJarsDirectoryPath + "lib1.jar"); >+ Util.delete(this.cascadedJarsDirectoryPath + "lib2.jar"); >+ Util.delete(this.cascadedJarsDirectoryPath + "lib3.jar"); >+ Util.delete(this.cascadedJarsDirectoryPath + "lib4.jar"); >+ this.cascadedJarsCreated = false; >+ } >+} >+ > private String getLibraryClassesAsQuotedString() { > String[] paths = Util.getJavaClassLibs(); > StringBuffer buffer = new StringBuffer(); >@@ -7857,6 +8034,498 @@ > "invalid warning option: -warn:null,+unused. Must specify a warning token\n", > true); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// basic link: a jar only referenced in the manifest of the first one is found >+public void test216_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ " B b;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib2.jar\"" // WORK SIMULATED SO FAR >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// may want a specific option to mimick javac 1.4 >+// caveat: javac 1.5 with -source 1.4 and -target 1.4 still uses the links >+public void _test216_jar_ref_in_jar_suppress(){ >+ createCascadedJars(); >+ this.runNegativeTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ " B b;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar\"" >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -ignoreJarClassPath -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "----------\n" + >+ "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" + >+ " B b;\n" + >+ " ^\n" + >+ "B cannot be resolved to a type\n" + >+ "----------\n" + >+ "1 problem (1 error)", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// links are followed recursively, eliminating dupes >+public void test217_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ " B b;\n" + >+ " C c;\n" + >+ " D d;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib3.jar\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib4.jar\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib2.jar\"" // WORK SIMULATED SO FAR >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// at first level, this is depth first, masking tailing libs >+public void test218_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runNegativeTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " int i = R.R2;\n" + >+ " int j = R.R3;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib2.jar\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib3.jar\"" >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "----------\n" + >+ "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" + >+ " int j = R.R3;\n" + >+ " ^^^^\n" + >+ "R.R3 cannot be resolved\n" + >+ "----------\n" + >+ "1 problem (1 error)", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// using only links, we adopt a depth first algorithm >+public void test219_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runNegativeTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " int i = R.R2;\n" + >+ " int j = R.R3;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib4.jar\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib2.jar\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib3.jar\"" // WORK SIMULATED SO FAR >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "----------\n" + >+ "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" + >+ " int j = R.R3;\n" + >+ " ^^^^\n" + >+ "R.R3 cannot be resolved\n" + >+ "----------\n" + >+ "1 problem (1 error)", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// managing subdirectories and .. properly >+public void test220_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ " B b;\n" + >+ " C c;\n" + >+ " D d;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib5.jar\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "s" + File.separator + "lib6.jar\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib7.jar\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib2.jar\"" // WORK SIMULATED SO FAR >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// variant: the second jar on a line is found as well >+public void test221_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " C c;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib4.jar\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib3.jar\"" // WORK SIMULATED SO FAR >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// we eat up absolute links silently >+public void test222_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " F f;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib8.jar\"" >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// absolute links do not mask following relative links >+public void test223_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ " F f;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib8.jar\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar\"" // WORK SIMULATED SO FAR >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// absolute links are not followed >+public void test224_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runNegativeTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " C c;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib8.jar\"" >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "----------\n" + >+ "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" + >+ " C c;\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n" + >+ "1 problem (1 error)", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// we accept duplicate classpath lines in manifest and we follow the first line >+// WORK javac emits a warning - what do we want to do >+public void test225_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ " G g;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib9.jar\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar\"" // WORK SIMULATED SO FAR >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// we accept duplicate classpath lines in manifest and we follow the jars of the >+// second and following lines as well >+// WORK javac emits a warning - what do we want to do >+public void test226_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " C c;\n" + >+ " G g;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib9.jar\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib3.jar\"" // WORK SIMULATED SO FAR >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// bootclasspath does not get expanded >+// WORK would need taylored jars that can replace the runtime >+// if we manage to do this one, we should also track extensions >+public void _test227_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runNegativeTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ " C c;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -bootclasspath " + getLibraryClassesAsQuotedString() >+ + File.pathSeparator + "\"" + OUTPUT_DIR + File.separator + this.cascadedJarsDirectoryPath + "lib1.jar\"" >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "----------\n" + >+ "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 5)\n" + >+ " C c;\n" + >+ " ^\n" + >+ "C cannot be resolved to a type\n" + >+ "----------\n" + >+ "1 problem (1 error)", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// jar files reached indirectly bear the access rules of the entry that >+// references them >+public void test228_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib3.jar[~p/A]\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib4.jar[~p/A]\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar[~p/A]\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib2.jar[~p/A]\"" // WORK SIMULATED SO FAR >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "----------\n" + >+ "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" + >+ " A a;\n" + >+ " ^\n" + >+ "Discouraged access: The type A is not accessible due to restriction on classpath entry D:/workspaces/junit-workspace/lib1.jar\n" + >+ "----------\n" + >+ "1 problem (1 warning)", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// jar files reached indirectly bear the access rules of the entry that >+// references them - this hides the access rules of further instances of the >+// same jar on the classpath >+public void test229_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib3.jar[~p/A]\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib4.jar[~p/A]\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar[~p/A]\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib2.jar[~p/A]\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar[-p/A]\"" >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "----------\n" + >+ "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src/p/X.java (at line 4)\n" + >+ " A a;\n" + >+ " ^\n" + >+ "Discouraged access: The type A is not accessible due to restriction on classpath entry D:/workspaces/junit-workspace/lib1.jar\n" + >+ "----------\n" + >+ "1 problem (1 warning)", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// jar files reached indirectly bear the access rules of the entry that >+// references them - this hides the access rules of further instances of the >+// same jar on the classpath >+public void test230_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib3.jar[-DUMMY]\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib4.jar[-DUMMY]\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar[-DUMMY]\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib2.jar[-DUMMY]\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar[-p/A]\"" >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "", >+ true); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97332 - jars pointed by jars >+// jar files reached indirectly bear the access rules of the entry that >+// references them - this hides the access rules of further instances of the >+// same jar on the classpath, to the point of absorbing it if none is specified >+public void test231_jar_ref_in_jar(){ >+ createCascadedJars(); >+ this.runConformTest( >+ new String[] { >+ "src/p/X.java", >+ "package p;\n" + >+ "/** */\n" + >+ "public class X {\n" + >+ " A a;\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "src/p/X.java\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib3.jar\"" >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib4.jar\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib2.jar\"" // WORK SIMULATED SO FAR >+ + " -cp \"" + this.cascadedJarsDirectoryPath + "lib1.jar[-p/A]\"" >+ + " -sourcepath \"" + OUTPUT_DIR + File.separator + "src\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -proceedOnError -referenceInfo" >+ + " -d \"" + OUTPUT_DIR + File.separator + "bin\" ", >+ "", >+ "", >+ true); >+} > public static Class testClass() { > return BatchCompilerTest.class; > } >Index: src/org/eclipse/jdt/core/tests/util/Util.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java,v >retrieving revision 1.59 >diff -u -r1.59 Util.java >--- src/org/eclipse/jdt/core/tests/util/Util.java 22 Oct 2007 13:43:38 -0000 1.59 >+++ src/org/eclipse/jdt/core/tests/util/Util.java 3 Jan 2008 14:13:28 -0000 >@@ -312,13 +312,24 @@ > } > } > public static void createJar(String[] pathsAndContents, Map options, String jarPath) throws IOException { >+ createJar(pathsAndContents, null, options, jarPath); >+} >+public static void createJar(String[] pathsAndContents, String[] extraPathsAndContents, Map options, String jarPath) throws IOException { > String classesPath = getOutputDirectory() + File.separator + "classes"; > File classesDir = new File(classesPath); > flushDirectoryContent(classesDir); > compile(pathsAndContents, options, classesPath); >+ for (int i = 0, l = extraPathsAndContents == null ? 0 : extraPathsAndContents.length; i < l; /* inc in loop */) { >+ File outputFile = new File(classesPath, extraPathsAndContents[i++]); >+ outputFile.getParentFile().mkdirs(); >+ Util.writeToFile(extraPathsAndContents[i++], outputFile.getAbsolutePath()); >+ } > zip(classesDir, jarPath); > } >-public static void createJar(String[] pathsAndContents, String jarPath, String compliance) throws IOException { >+public static void createJar(String[] javaPathsAndContents, String jarPath, String compliance) throws IOException { >+ createJar(javaPathsAndContents, null, jarPath, compliance); >+} >+public static void createJar(String[] javaPathsAndContents, String[] extraPathsAndContents, String jarPath, String compliance) throws IOException { > Map options = new HashMap(); > options.put(CompilerOptions.OPTION_Compliance, compliance); > options.put(CompilerOptions.OPTION_Source, compliance); >@@ -331,7 +342,7 @@ > options.put(CompilerOptions.OPTION_ReportTypeParameterHiding, CompilerOptions.IGNORE); > options.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE); > options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE); >- createJar(pathsAndContents, options, jarPath); >+ createJar(javaPathsAndContents, extraPathsAndContents, options, jarPath); > } > public static void createSourceZip(String[] pathsAndContents, String zipPath) throws IOException { > String sourcesPath = getOutputDirectory() + File.separator + "sources";
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 97332
:
84932
|
85181
|
86096
|
86646
|
92916