View | Details | Raw Unified | Return to bug 88364 | Differences between
and this patch

Collapse All | Expand All

(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-13 / +113 lines)
Lines 1199-1209 Link Here
1199
		final int InsideDefaultEncoding = 64;
1199
		final int InsideDefaultEncoding = 64;
1200
		final int InsideBootClasspath = 128;
1200
		final int InsideBootClasspath = 128;
1201
		final int InsideMaxProblems = 256;
1201
		final int InsideMaxProblems = 256;
1202
		final int InsideExtDirs = 512;
1202
		final int Default = 0;
1203
		final int Default = 0;
1203
		String[] bootclasspaths = null;
1204
		String[] bootclasspaths = null;
1205
		String[] extdirs = null;
1206
		String[] extlibs = null;
1204
		int DEFAULT_SIZE_CLASSPATH = 4;
1207
		int DEFAULT_SIZE_CLASSPATH = 4;
1205
		int pathCount = 0;
1208
		int pathCount = 0;
1206
		int bootclasspathCount = 0;
1209
		int bootclasspathCount = 0;
1210
		int extdirsCount = 0;
1211
		int extlibsCount = 0;
1207
		int index = -1, filesCount = 0, argCount = argv.length;
1212
		int index = -1, filesCount = 0, argCount = argv.length;
1208
		int mode = Default;
1213
		int mode = Default;
1209
		this.repetitions = 0;
1214
		this.repetitions = 0;
Lines 1454-1459 Link Here
1454
				this.produceRefInfo = true;
1459
				this.produceRefInfo = true;
1455
				continue;
1460
				continue;
1456
			}
1461
			}
1462
			if (currentArg.equals("-extdirs")) {//$NON-NLS-1$
1463
				if (extdirsCount > 0)
1464
					throw new InvalidInputException(
1465
						Main.bind("configure.duplicateExtDirs", currentArg)); //$NON-NLS-1$
1466
				extdirs = new String[DEFAULT_SIZE_CLASSPATH];
1467
				mode = InsideExtDirs;
1468
				continue;
1469
			}
1457
			if (currentArg.equals("-inlineJSR")) { //$NON-NLS-1$
1470
			if (currentArg.equals("-inlineJSR")) { //$NON-NLS-1$
1458
			    mode = Default;
1471
			    mode = Default;
1459
				this.options.put(
1472
				this.options.put(
Lines 1837-1842 Link Here
1837
				useEnableJavadoc = true;
1850
				useEnableJavadoc = true;
1838
				continue;
1851
				continue;
1839
			}
1852
			}
1853
			if (mode == InsideExtDirs) {
1854
				StringTokenizer tokenizer = new StringTokenizer(currentArg, File.pathSeparator);
1855
				while (tokenizer.hasMoreTokens()) {
1856
					int length;
1857
					if ((length = extdirs.length) <= extdirsCount) {
1858
						System.arraycopy(
1859
							extdirs,
1860
							0,
1861
							(extdirs = new String[length * 2]),
1862
							0,
1863
							length);
1864
					}
1865
					extdirs[extdirsCount++] = tokenizer.nextToken();
1866
				}
1867
				mode = Default;
1868
				continue;
1869
			}
1840
			if (mode == TargetSetting) {
1870
			if (mode == TargetSetting) {
1841
				if (didSpecifyTarget) {
1871
				if (didSpecifyTarget) {
1842
					throw new InvalidInputException(
1872
					throw new InvalidInputException(
Lines 2058-2063 Link Here
2058
			this.classpaths[pathCount++] = System.getProperty("user.dir");//$NON-NLS-1$
2088
			this.classpaths[pathCount++] = System.getProperty("user.dir");//$NON-NLS-1$
2059
		}
2089
		}
2060
		
2090
		
2091
		if (extdirsCount == 0) {
2092
			String extdirsStr = System.getProperty("java.ext.dirs"); //$NON-NLS-1$
2093
2094
			extdirs = new String[DEFAULT_SIZE_CLASSPATH];
2095
			StringTokenizer tokenizer = new StringTokenizer(extdirsStr, File.pathSeparator);
2096
			while (tokenizer.hasMoreTokens()) {
2097
				int length;
2098
				if ((length = extdirs.length) <= extdirsCount) {
2099
					System.arraycopy(
2100
						extdirs,
2101
						0,
2102
						(extdirs = new String[length * 2]),
2103
						0,
2104
						length);
2105
				}
2106
				extdirs[extdirsCount++] = tokenizer.nextToken();
2107
			}
2108
		}
2109
2110
		// at this point extdirs contains all the extension
2111
		// directories parsed out into individual strings, and
2112
		// extdirsCount stores the total number of extensions
2113
		// directories.
2114
2115
		if (extdirsCount != 0 && extlibsCount == 0) {
2116
			File[][] systemLibrariesJars = getLibrariesFiles(extdirs, extdirsCount);
2117
			if (systemLibrariesJars != null) {
2118
				int length = getLength(systemLibrariesJars);
2119
				extlibs = new String[length];
2120
				for (int i = 0, max = systemLibrariesJars.length; i < max; i++) {
2121
					File[] current = systemLibrariesJars[i];
2122
					if (current != null) {
2123
						for (int j = 0, max2 = current.length; j < max2; j++) {
2124
							extlibs[extlibsCount++] = current[j].getAbsolutePath();
2125
						}
2126
					}
2127
				}
2128
			}
2129
		}
2130
2131
		// at this point extlibs contains all the extension
2132
		// libraries parsed out into individual strings, and
2133
		// extlibsCount stores the total number of extensions
2134
		// libraries.
2135
		
2061
		if (bootclasspathCount == 0) {
2136
		if (bootclasspathCount == 0) {
2062
			/* no bootclasspath specified
2137
			/* no bootclasspath specified
2063
			 * we can try to retrieve the default librairies of the VM used to run
2138
			 * we can try to retrieve the default librairies of the VM used to run
Lines 2080-2086 Link Here
2080
					try {
2155
					try {
2081
						javaHomeFile = new File(javaHomeFile.getCanonicalPath());
2156
						javaHomeFile = new File(javaHomeFile.getCanonicalPath());
2082
						// add all jars in the lib subdirectory
2157
						// add all jars in the lib subdirectory
2083
						File[] directoriesToCheck = new File[] { new File(javaHomeFile, "lib"), new File(javaHomeFile, "lib/ext")};//$NON-NLS-1$//$NON-NLS-2$
2158
						File[] directoriesToCheck = new File[] { new File(javaHomeFile, "lib") };//$NON-NLS-1$
2084
						File[][] systemLibrariesJars = getLibrariesFiles(directoriesToCheck);
2159
						File[][] systemLibrariesJars = getLibrariesFiles(directoriesToCheck);
2085
						if (systemLibrariesJars != null) {
2160
						if (systemLibrariesJars != null) {
2086
							int length = getLength(systemLibrariesJars);
2161
							int length = getLength(systemLibrariesJars);
Lines 2101-2106 Link Here
2101
		 	 }
2176
		 	 }
2102
		}
2177
		}
2103
2178
2179
		// at this point bootclasspaths contains all the
2180
		// bootclasspath entries and bootclasspathCount
2181
		// contains the total number of bootclasspath entries.
2182
		
2104
		if (this.classpaths == null) {
2183
		if (this.classpaths == null) {
2105
			this.classpaths = new String[0];
2184
			this.classpaths = new String[0];
2106
		}
2185
		}
Lines 2108-2115 Link Here
2108
		 * We put the bootclasspath at the beginning of the classpath entries
2187
		 * We put the bootclasspath at the beginning of the classpath entries
2109
		 */
2188
		 */
2110
		String[] newclasspaths = null;
2189
		String[] newclasspaths = null;
2111
		if ((pathCount + bootclasspathCount) != this.classpaths.length) {
2190
		if ((pathCount + bootclasspathCount + extlibsCount) != this.classpaths.length) {
2112
			newclasspaths = new String[pathCount + bootclasspathCount];
2191
			newclasspaths = new String[pathCount + bootclasspathCount + extlibsCount];
2113
		} else {
2192
		} else {
2114
			newclasspaths = this.classpaths;
2193
			newclasspaths = this.classpaths;
2115
		}
2194
		}
Lines 2117-2123 Link Here
2117
			this.classpaths,
2196
			this.classpaths,
2118
			0,
2197
			0,
2119
			newclasspaths,
2198
			newclasspaths,
2120
			bootclasspathCount,
2199
			bootclasspathCount + extlibsCount,
2121
			pathCount);
2200
			pathCount);
2122
2201
2123
		if (bootclasspathCount != 0) {
2202
		if (bootclasspathCount != 0) {
Lines 2128-2133 Link Here
2128
				0,
2207
				0,
2129
				bootclasspathCount);
2208
				bootclasspathCount);
2130
		}
2209
		}
2210
		if (extlibsCount != 0) {
2211
			System.arraycopy(
2212
				 extlibs,
2213
				 0,
2214
				 newclasspaths,
2215
				 bootclasspathCount,
2216
				 extlibsCount);
2217
		}
2131
		this.classpaths = newclasspaths;
2218
		this.classpaths = newclasspaths;
2132
		for (int i = 0, max = this.classpaths.length; i < max; i++) {
2219
		for (int i = 0, max = this.classpaths.length; i < max; i++) {
2133
			File file = new File(this.classpaths[i]);
2220
			File file = new File(this.classpaths[i]);
Lines 2315-2330 Link Here
2315
		return units;
2402
		return units;
2316
	}
2403
	}
2317
	
2404
	
2318
	private File[][] getLibrariesFiles(File[] files) {
2405
	private FilenameFilter filter = new FilenameFilter() {
2319
		FilenameFilter filter = new FilenameFilter() {
2406
		public boolean accept(File dir, String name) {
2320
			public boolean accept(File dir, String name) {
2407
			String lowerCaseName = name.toLowerCase();
2321
				String lowerCaseName = name.toLowerCase();
2408
			if (lowerCaseName.endsWith(SUFFIX_STRING_jar) || lowerCaseName.endsWith(SUFFIX_STRING_zip)) {
2322
				if (lowerCaseName.endsWith(SUFFIX_STRING_jar) || lowerCaseName.endsWith(SUFFIX_STRING_zip)) {
2409
				return true;
2323
					return true;
2324
				}
2325
				return false;
2326
			}
2410
			}
2327
		};
2411
			return false;
2412
		}
2413
	};
2414
	
2415
	private File[][] getLibrariesFiles(File[] files) {
2328
		final int filesLength = files.length;
2416
		final int filesLength = files.length;
2329
		File[][] result = new File[filesLength][];
2417
		File[][] result = new File[filesLength][];
2330
		for (int i = 0; i < filesLength; i++) {
2418
		for (int i = 0; i < filesLength; i++) {
Lines 2336-2341 Link Here
2336
		return result;
2424
		return result;
2337
	}
2425
	}
2338
	
2426
	
2427
	private File[][] getLibrariesFiles(String[] files, int numFiles) {
2428
		final int filesLength = numFiles;
2429
		File[][] result = new File[filesLength][];
2430
		for (int i = 0; i < filesLength; i++) {
2431
			File currentFile = new File(files[i]);
2432
			if (currentFile.exists() && currentFile.isDirectory()) {
2433
				result[i] = currentFile.listFiles(filter);
2434
			}
2435
		}
2436
		return result;
2437
	}
2438
	
2339
	private int getLength(File[][] libraries) {
2439
	private int getLength(File[][] libraries) {
2340
		int sum = 0;
2440
		int sum = 0;
2341
		if (libraries != null) {
2441
		if (libraries != null) {
(-)batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (+3 lines)
Lines 49-54 Link Here
49
configure.source = source level should be comprised in between ''1.3'' and ''1.5'' (or ''5'' or ''5.0''): {0}
49
configure.source = source level should be comprised in between ''1.3'' and ''1.5'' (or ''5'' or ''5.0''): {0}
50
configure.duplicateOutputPath = duplicate output path specification: {0}
50
configure.duplicateOutputPath = duplicate output path specification: {0}
51
configure.duplicateBootClasspath = duplicate bootclasspath specification: {0}
51
configure.duplicateBootClasspath = duplicate bootclasspath specification: {0}
52
configure.duplicateExtDirs = duplicate extdirs specification: {0}
52
configure.invalidDebugOption = invalid debug option: {0}
53
configure.invalidDebugOption = invalid debug option: {0}
53
configure.invalidWarningConfiguration = invalid warning configuration: {0}
54
configure.invalidWarningConfiguration = invalid warning configuration: {0}
54
configure.invalidWarning = invalid warning: {0}
55
configure.invalidWarning = invalid warning: {0}
Lines 95-100 Link Here
95
\                       specify location for application classes and sources\n\
96
\                       specify location for application classes and sources\n\
96
\    -bootclasspath <directories and zip/jar files separated by {0}>\n\
97
\    -bootclasspath <directories and zip/jar files separated by {0}>\n\
97
\                       specify location for system classes\n\
98
\                       specify location for system classes\n\
99
\    -extdirs <directories separated by {0}>\n\
100
\                       specify location for extension zip/jar files\n\
98
\    -d <dir>           destination directory (if omitted, no directory is created)\n\
101
\    -d <dir>           destination directory (if omitted, no directory is created)\n\
99
\    -d none            generate no .class files\n\
102
\    -d none            generate no .class files\n\
100
\    -encoding <enc>    specify custom encoding for all sources. Each file/directory can override it\n\
103
\    -encoding <enc>    specify custom encoding for all sources. Each file/directory can override it\n\

Return to bug 88364