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 92463 Details for
Bug 216684
[batch][compiler] ecj behaves differently than javac wrt -sourcepath and -classpath options
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Test case
patch.txt (text/plain), 4.98 KB, created by
Maxime Daniel
on 2008-03-13 11:56:19 EDT
(
hide
)
Description:
Test case
Filename:
MIME Type:
Creator:
Maxime Daniel
Created:
2008-03-13 11:56:19 EDT
Size:
4.98 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.150 >diff -u -r1.150 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 5 Mar 2008 07:57:46 -0000 1.150 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 13 Mar 2008 15:55:25 -0000 >@@ -170,17 +170,19 @@ > if (!outputDirectory.isDirectory()) { > outputDirectory.mkdirs(); > } >- PrintWriter sourceFileWriter; >- for (int i = 0; i < testFiles.length; i += 2) { >- String fileName = OUTPUT_DIR + File.separator + testFiles[i]; >- File file = new File(fileName), innerOutputDirectory = file >- .getParentFile(); >- if (!innerOutputDirectory.isDirectory()) { >- innerOutputDirectory.mkdirs(); >+ if (testFiles != null) { >+ PrintWriter sourceFileWriter; >+ for (int i = 0; i < testFiles.length; i += 2) { >+ String fileName = OUTPUT_DIR + File.separator + testFiles[i]; >+ File file = new File(fileName), innerOutputDirectory = file >+ .getParentFile(); >+ if (!innerOutputDirectory.isDirectory()) { >+ innerOutputDirectory.mkdirs(); >+ } >+ sourceFileWriter = new PrintWriter(new FileOutputStream(file)); >+ sourceFileWriter.write(testFiles[i + 1]); >+ sourceFileWriter.close(); > } >- sourceFileWriter = new PrintWriter(new FileOutputStream(file)); >- sourceFileWriter.write(testFiles[i + 1]); >- sourceFileWriter.close(); > } > } catch (FileNotFoundException e) { > e.printStackTrace(); >@@ -230,11 +232,13 @@ > } > if (compileOK != shouldCompileOK || !compareOK) { > System.out.println(getClass().getName() + '#' + getName()); >- for (int i = 0; i < testFiles.length; i += 2) { >- System.out.print(testFiles[i]); >- System.out.println(" ["); >- System.out.println(testFiles[i + 1]); >- System.out.println("]"); >+ if (testFiles != null) { >+ for (int i = 0; i < testFiles.length; i += 2) { >+ System.out.print(testFiles[i]); >+ System.out.println(" ["); >+ System.out.println(testFiles[i + 1]); >+ System.out.println("]"); >+ } > } > } > if (compileOK != shouldCompileOK) >@@ -8350,4 +8354,68 @@ > "1 problem (1 warning)", > true); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=216684 >+// .java/.class files precedence depending on sourcepath >+public void testONLY_230_sourcepath_vs_classpath() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ "}\n", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "X.java\"" >+ + " -verbose -warn:unusedThrown -proc:none -d \"" + OUTPUT_DIR + "\"", >+ "[parsing ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" + >+ "[reading java/lang/Object.class]\n" + >+ "[analyzing ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" + >+ "[writing X.class - #1]\n" + >+ "[completed ---OUTPUT_DIR_PLACEHOLDER---/X.java - #1/1]\n" + >+ "[1 unit compiled]\n" + >+ "[1 .class file generated]\n", >+ "", >+ true); >+ // check that class file is newer than source file >+ assertTrue("class file not strictly newer than source file", >+ new File(OUTPUT_DIR + File.separator + "X.class").lastModified() > >+ new File(OUTPUT_DIR + File.separator + "X.java").lastModified()); >+ // compile with classpath only: X.class gets selected >+ this.runConformTest( >+ new String[] { >+ "Y.java", >+ "public class Y {\n" + >+ " X x;\n" + >+ "}\n", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "Y.java\"" >+ + " -classpath \"" + OUTPUT_DIR + "\"" >+ + " -verbose -warn:unusedThrown -proc:none -d \"" + OUTPUT_DIR + "\"", >+ "[parsing ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" + >+ "[reading java/lang/Object.class]\n" + >+ "[analyzing ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" + >+ "[reading X.class]\n" + >+ "[writing Y.class - #1]\n" + >+ "[completed ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" + >+ "[1 unit compiled]\n" + >+ "[1 .class file generated]\n", >+ "", >+ false); >+ // compile with sourcepath and classpath: since X.class is newer, it >+ // should be preferred >+ this.runConformTest( >+ null, >+ "\"" + OUTPUT_DIR + File.separator + "Y.java\"" >+ + " -classpath \"" + OUTPUT_DIR + "\"" >+ + " -sourcepath \"" + OUTPUT_DIR + "\"" >+ + " -verbose -warn:unusedThrown -proc:none -d \"" + OUTPUT_DIR + "\"", >+ "[parsing ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" + >+ "[reading java/lang/Object.class]\n" + >+ "[analyzing ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" + >+ "[reading X.class]\n" + >+ "[writing Y.class - #1]\n" + >+ "[completed ---OUTPUT_DIR_PLACEHOLDER---/Y.java - #1/1]\n" + >+ "[1 unit compiled]\n" + >+ "[1 .class file generated]\n", >+ "", >+ false); >+} > }
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 216684
:
87954
| 92463