Lines 47-53
Link Here
|
47 |
import org.eclipse.jdt.core.compiler.CharOperation; |
47 |
import org.eclipse.jdt.core.compiler.CharOperation; |
48 |
import org.eclipse.jdt.core.compiler.CompilationProgress; |
48 |
import org.eclipse.jdt.core.compiler.CompilationProgress; |
49 |
import org.eclipse.jdt.core.compiler.IProblem; |
49 |
import org.eclipse.jdt.core.compiler.IProblem; |
50 |
import org.eclipse.jdt.core.compiler.InvalidInputException; |
|
|
51 |
import org.eclipse.jdt.core.compiler.batch.BatchCompiler; |
50 |
import org.eclipse.jdt.core.compiler.batch.BatchCompiler; |
52 |
import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager; |
51 |
import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager; |
53 |
import org.eclipse.jdt.internal.compiler.ClassFile; |
52 |
import org.eclipse.jdt.internal.compiler.ClassFile; |
Lines 1138-1144
Link Here
|
1138 |
public void setEmacs() { |
1137 |
public void setEmacs() { |
1139 |
this.tagBits |= Logger.EMACS; |
1138 |
this.tagBits |= Logger.EMACS; |
1140 |
} |
1139 |
} |
1141 |
public void setLog(String logFileName) throws InvalidInputException { |
1140 |
public void setLog(String logFileName) { |
1142 |
final Date date = new Date(); |
1141 |
final Date date = new Date(); |
1143 |
final DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, Locale.getDefault()); |
1142 |
final DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, Locale.getDefault()); |
1144 |
try { |
1143 |
try { |
Lines 1167-1175
Link Here
|
1167 |
this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$ |
1166 |
this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$ |
1168 |
} |
1167 |
} |
1169 |
} catch (FileNotFoundException e) { |
1168 |
} catch (FileNotFoundException e) { |
1170 |
throw new InvalidInputException(this.main.bind("configure.cannotOpenLog", logFileName)); //$NON-NLS-1$ |
1169 |
throw new IllegalArgumentException(this.main.bind("configure.cannotOpenLog", logFileName)); //$NON-NLS-1$ |
1171 |
} catch (UnsupportedEncodingException e) { |
1170 |
} catch (UnsupportedEncodingException e) { |
1172 |
throw new InvalidInputException(this.main.bind("configure.cannotOpenLogInvalidEncoding", logFileName)); //$NON-NLS-1$ |
1171 |
throw new IllegalArgumentException(this.main.bind("configure.cannotOpenLogInvalidEncoding", logFileName)); //$NON-NLS-1$ |
1173 |
} |
1172 |
} |
1174 |
} |
1173 |
} |
1175 |
private void startLoggingExtraProblems(int count) { |
1174 |
private void startLoggingExtraProblems(int count) { |
Lines 1450-1456
Link Here
|
1450 |
protected void addNewEntry(ArrayList paths, String currentClasspathName, |
1449 |
protected void addNewEntry(ArrayList paths, String currentClasspathName, |
1451 |
ArrayList currentRuleSpecs, String customEncoding, |
1450 |
ArrayList currentRuleSpecs, String customEncoding, |
1452 |
String destPath, boolean isSourceOnly, |
1451 |
String destPath, boolean isSourceOnly, |
1453 |
boolean rejectDestinationPathOnJars) throws InvalidInputException { |
1452 |
boolean rejectDestinationPathOnJars) { |
1454 |
|
1453 |
|
1455 |
int rulesSpecsSize = currentRuleSpecs.size(); |
1454 |
int rulesSpecsSize = currentRuleSpecs.size(); |
1456 |
AccessRuleSet accessRuleSet = null; |
1455 |
AccessRuleSet accessRuleSet = null; |
Lines 1506-1512
Link Here
|
1506 |
} |
1505 |
} |
1507 |
if (rejectDestinationPathOnJars && destPath != null && |
1506 |
if (rejectDestinationPathOnJars && destPath != null && |
1508 |
Util.isPotentialZipArchive(currentClasspathName)) { |
1507 |
Util.isPotentialZipArchive(currentClasspathName)) { |
1509 |
throw new InvalidInputException( |
1508 |
throw new IllegalArgumentException( |
1510 |
this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$ |
1509 |
this.bind("configure.unexpectedDestinationPathEntryFile", //$NON-NLS-1$ |
1511 |
currentClasspathName)); |
1510 |
currentClasspathName)); |
1512 |
} |
1511 |
} |
Lines 1662-1668
Link Here
|
1662 |
this.logger.close(); |
1661 |
this.logger.close(); |
1663 |
System.exit(this.globalErrorsCount > 0 ? -1 : 0); |
1662 |
System.exit(this.globalErrorsCount > 0 ? -1 : 0); |
1664 |
} |
1663 |
} |
1665 |
} catch (InvalidInputException e) { |
1664 |
} catch (IllegalArgumentException e) { |
1666 |
this.logger.logException(e); |
1665 |
this.logger.logException(e); |
1667 |
if (this.systemExitWhenFinished) { |
1666 |
if (this.systemExitWhenFinished) { |
1668 |
this.logger.flush(); |
1667 |
this.logger.flush(); |
Lines 1692-1698
Link Here
|
1692 |
/* |
1691 |
/* |
1693 |
Decode the command line arguments |
1692 |
Decode the command line arguments |
1694 |
*/ |
1693 |
*/ |
1695 |
public void configure(String[] argv) throws InvalidInputException { |
1694 |
public void configure(String[] argv) { |
1696 |
|
1695 |
|
1697 |
if ((argv == null) || (argv.length == 0)) { |
1696 |
if ((argv == null) || (argv.length == 0)) { |
1698 |
printUsage(); |
1697 |
printUsage(); |
Lines 1774-1780
Link Here
|
1774 |
} |
1773 |
} |
1775 |
newArgs = tokenize(buffer.toString()); |
1774 |
newArgs = tokenize(buffer.toString()); |
1776 |
} catch(IOException e) { |
1775 |
} catch(IOException e) { |
1777 |
throw new InvalidInputException( |
1776 |
throw new IllegalArgumentException( |
1778 |
this.bind("configure.invalidexpansionargumentname", arg)); //$NON-NLS-1$ |
1777 |
this.bind("configure.invalidexpansionargumentname", arg)); //$NON-NLS-1$ |
1779 |
} |
1778 |
} |
1780 |
} |
1779 |
} |
Lines 1800-1806
Link Here
|
1800 |
while (++index < argCount) { |
1799 |
while (++index < argCount) { |
1801 |
|
1800 |
|
1802 |
if (customEncoding != null) { |
1801 |
if (customEncoding != null) { |
1803 |
throw new InvalidInputException( |
1802 |
throw new IllegalArgumentException( |
1804 |
this.bind("configure.unexpectedCustomEncoding", currentArg, customEncoding)); //$NON-NLS-1$ |
1803 |
this.bind("configure.unexpectedCustomEncoding", currentArg, customEncoding)); //$NON-NLS-1$ |
1805 |
} |
1804 |
} |
1806 |
|
1805 |
|
Lines 1809-1815
Link Here
|
1809 |
switch(mode) { |
1808 |
switch(mode) { |
1810 |
case DEFAULT : |
1809 |
case DEFAULT : |
1811 |
if (currentArg.startsWith("[")) { //$NON-NLS-1$ |
1810 |
if (currentArg.startsWith("[")) { //$NON-NLS-1$ |
1812 |
throw new InvalidInputException( |
1811 |
throw new IllegalArgumentException( |
1813 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
1812 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
1814 |
currentArg)); |
1813 |
currentArg)); |
1815 |
} |
1814 |
} |
Lines 1818-1824
Link Here
|
1818 |
// look for encoding specification |
1817 |
// look for encoding specification |
1819 |
int encodingStart = currentArg.indexOf('[') + 1; |
1818 |
int encodingStart = currentArg.indexOf('[') + 1; |
1820 |
if (encodingStart <= 1) { |
1819 |
if (encodingStart <= 1) { |
1821 |
throw new InvalidInputException( |
1820 |
throw new IllegalArgumentException( |
1822 |
this.bind("configure.unexpectedBracket", currentArg)); //$NON-NLS-1$ |
1821 |
this.bind("configure.unexpectedBracket", currentArg)); //$NON-NLS-1$ |
1823 |
} |
1822 |
} |
1824 |
int encodingEnd = currentArg.length() - 1; |
1823 |
int encodingEnd = currentArg.length() - 1; |
Lines 1828-1834
Link Here
|
1828 |
try { // ensure encoding is supported |
1827 |
try { // ensure encoding is supported |
1829 |
new InputStreamReader(new ByteArrayInputStream(new byte[0]), customEncoding); |
1828 |
new InputStreamReader(new ByteArrayInputStream(new byte[0]), customEncoding); |
1830 |
} catch (UnsupportedEncodingException e) { |
1829 |
} catch (UnsupportedEncodingException e) { |
1831 |
throw new InvalidInputException( |
1830 |
throw new IllegalArgumentException( |
1832 |
this.bind("configure.unsupportedEncoding", customEncoding)); //$NON-NLS-1$ |
1831 |
this.bind("configure.unsupportedEncoding", customEncoding)); //$NON-NLS-1$ |
1833 |
} |
1832 |
} |
1834 |
} |
1833 |
} |
Lines 1871-1891
Link Here
|
1871 |
} |
1870 |
} |
1872 |
if (currentArg.equals("-log")) { //$NON-NLS-1$ |
1871 |
if (currentArg.equals("-log")) { //$NON-NLS-1$ |
1873 |
if (this.log != null) |
1872 |
if (this.log != null) |
1874 |
throw new InvalidInputException( |
1873 |
throw new IllegalArgumentException( |
1875 |
this.bind("configure.duplicateLog", currentArg)); //$NON-NLS-1$ |
1874 |
this.bind("configure.duplicateLog", currentArg)); //$NON-NLS-1$ |
1876 |
mode = INSIDE_LOG; |
1875 |
mode = INSIDE_LOG; |
1877 |
continue; |
1876 |
continue; |
1878 |
} |
1877 |
} |
1879 |
if (currentArg.equals("-repeat")) { //$NON-NLS-1$ |
1878 |
if (currentArg.equals("-repeat")) { //$NON-NLS-1$ |
1880 |
if (this.maxRepetition > 0) |
1879 |
if (this.maxRepetition > 0) |
1881 |
throw new InvalidInputException( |
1880 |
throw new IllegalArgumentException( |
1882 |
this.bind("configure.duplicateRepeat", currentArg)); //$NON-NLS-1$ |
1881 |
this.bind("configure.duplicateRepeat", currentArg)); //$NON-NLS-1$ |
1883 |
mode = INSIDE_REPETITION; |
1882 |
mode = INSIDE_REPETITION; |
1884 |
continue; |
1883 |
continue; |
1885 |
} |
1884 |
} |
1886 |
if (currentArg.equals("-maxProblems")) { //$NON-NLS-1$ |
1885 |
if (currentArg.equals("-maxProblems")) { //$NON-NLS-1$ |
1887 |
if (this.maxProblems > 0) |
1886 |
if (this.maxProblems > 0) |
1888 |
throw new InvalidInputException( |
1887 |
throw new IllegalArgumentException( |
1889 |
this.bind("configure.duplicateMaxProblems", currentArg)); //$NON-NLS-1$ |
1888 |
this.bind("configure.duplicateMaxProblems", currentArg)); //$NON-NLS-1$ |
1890 |
mode = INSIDE_MAX_PROBLEMS; |
1889 |
mode = INSIDE_MAX_PROBLEMS; |
1891 |
continue; |
1890 |
continue; |
Lines 1900-1906
Link Here
|
1900 |
} |
1899 |
} |
1901 |
if (currentArg.equals("-1.3")) { //$NON-NLS-1$ |
1900 |
if (currentArg.equals("-1.3")) { //$NON-NLS-1$ |
1902 |
if (didSpecifyCompliance) { |
1901 |
if (didSpecifyCompliance) { |
1903 |
throw new InvalidInputException( |
1902 |
throw new IllegalArgumentException( |
1904 |
this.bind("configure.duplicateCompliance", currentArg));//$NON-NLS-1$ |
1903 |
this.bind("configure.duplicateCompliance", currentArg));//$NON-NLS-1$ |
1905 |
} |
1904 |
} |
1906 |
didSpecifyCompliance = true; |
1905 |
didSpecifyCompliance = true; |
Lines 1910-1916
Link Here
|
1910 |
} |
1909 |
} |
1911 |
if (currentArg.equals("-1.4")) { //$NON-NLS-1$ |
1910 |
if (currentArg.equals("-1.4")) { //$NON-NLS-1$ |
1912 |
if (didSpecifyCompliance) { |
1911 |
if (didSpecifyCompliance) { |
1913 |
throw new InvalidInputException( |
1912 |
throw new IllegalArgumentException( |
1914 |
this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ |
1913 |
this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ |
1915 |
} |
1914 |
} |
1916 |
didSpecifyCompliance = true; |
1915 |
didSpecifyCompliance = true; |
Lines 1920-1926
Link Here
|
1920 |
} |
1919 |
} |
1921 |
if (currentArg.equals("-1.5") || currentArg.equals("-5") || currentArg.equals("-5.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
1920 |
if (currentArg.equals("-1.5") || currentArg.equals("-5") || currentArg.equals("-5.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
1922 |
if (didSpecifyCompliance) { |
1921 |
if (didSpecifyCompliance) { |
1923 |
throw new InvalidInputException( |
1922 |
throw new IllegalArgumentException( |
1924 |
this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ |
1923 |
this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ |
1925 |
} |
1924 |
} |
1926 |
didSpecifyCompliance = true; |
1925 |
didSpecifyCompliance = true; |
Lines 1930-1936
Link Here
|
1930 |
} |
1929 |
} |
1931 |
if (currentArg.equals("-1.6") || currentArg.equals("-6") || currentArg.equals("-6.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
1930 |
if (currentArg.equals("-1.6") || currentArg.equals("-6") || currentArg.equals("-6.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
1932 |
if (didSpecifyCompliance) { |
1931 |
if (didSpecifyCompliance) { |
1933 |
throw new InvalidInputException( |
1932 |
throw new IllegalArgumentException( |
1934 |
this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ |
1933 |
this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ |
1935 |
} |
1934 |
} |
1936 |
didSpecifyCompliance = true; |
1935 |
didSpecifyCompliance = true; |
Lines 1940-1946
Link Here
|
1940 |
} |
1939 |
} |
1941 |
if (currentArg.equals("-1.7") || currentArg.equals("-7") || currentArg.equals("-7.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
1940 |
if (currentArg.equals("-1.7") || currentArg.equals("-7") || currentArg.equals("-7.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
1942 |
if (didSpecifyCompliance) { |
1941 |
if (didSpecifyCompliance) { |
1943 |
throw new InvalidInputException( |
1942 |
throw new IllegalArgumentException( |
1944 |
this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ |
1943 |
this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$ |
1945 |
} |
1944 |
} |
1946 |
didSpecifyCompliance = true; |
1945 |
didSpecifyCompliance = true; |
Lines 1956-1962
Link Here
|
1956 |
errorMessage.append(' '); |
1955 |
errorMessage.append(' '); |
1957 |
errorMessage.append(newCommandLineArgs[index + 1]); |
1956 |
errorMessage.append(newCommandLineArgs[index + 1]); |
1958 |
} |
1957 |
} |
1959 |
throw new InvalidInputException( |
1958 |
throw new IllegalArgumentException( |
1960 |
this.bind("configure.duplicateOutputPath", errorMessage.toString())); //$NON-NLS-1$ |
1959 |
this.bind("configure.duplicateOutputPath", errorMessage.toString())); //$NON-NLS-1$ |
1961 |
} |
1960 |
} |
1962 |
mode = INSIDE_DESTINATION_PATH; |
1961 |
mode = INSIDE_DESTINATION_PATH; |
Lines 1975-1981
Link Here
|
1975 |
errorMessage.append(' '); |
1974 |
errorMessage.append(' '); |
1976 |
errorMessage.append(newCommandLineArgs[index + 1]); |
1975 |
errorMessage.append(newCommandLineArgs[index + 1]); |
1977 |
} |
1976 |
} |
1978 |
throw new InvalidInputException( |
1977 |
throw new IllegalArgumentException( |
1979 |
this.bind("configure.duplicateBootClasspath", errorMessage.toString())); //$NON-NLS-1$ |
1978 |
this.bind("configure.duplicateBootClasspath", errorMessage.toString())); //$NON-NLS-1$ |
1980 |
} |
1979 |
} |
1981 |
mode = INSIDE_BOOTCLASSPATH_start; |
1980 |
mode = INSIDE_BOOTCLASSPATH_start; |
Lines 1989-1995
Link Here
|
1989 |
errorMessage.append(' '); |
1988 |
errorMessage.append(' '); |
1990 |
errorMessage.append(newCommandLineArgs[index + 1]); |
1989 |
errorMessage.append(newCommandLineArgs[index + 1]); |
1991 |
} |
1990 |
} |
1992 |
throw new InvalidInputException( |
1991 |
throw new IllegalArgumentException( |
1993 |
this.bind("configure.duplicateSourcepath", errorMessage.toString())); //$NON-NLS-1$ |
1992 |
this.bind("configure.duplicateSourcepath", errorMessage.toString())); //$NON-NLS-1$ |
1994 |
} |
1993 |
} |
1995 |
mode = INSIDE_SOURCE_PATH_start; |
1994 |
mode = INSIDE_SOURCE_PATH_start; |
Lines 2003-2009
Link Here
|
2003 |
errorMessage.append(' '); |
2002 |
errorMessage.append(' '); |
2004 |
errorMessage.append(newCommandLineArgs[index + 1]); |
2003 |
errorMessage.append(newCommandLineArgs[index + 1]); |
2005 |
} |
2004 |
} |
2006 |
throw new InvalidInputException( |
2005 |
throw new IllegalArgumentException( |
2007 |
this.bind("configure.duplicateExtDirs", errorMessage.toString())); //$NON-NLS-1$ |
2006 |
this.bind("configure.duplicateExtDirs", errorMessage.toString())); //$NON-NLS-1$ |
2008 |
} |
2007 |
} |
2009 |
mode = INSIDE_EXT_DIRS; |
2008 |
mode = INSIDE_EXT_DIRS; |
Lines 2017-2023
Link Here
|
2017 |
errorMessage.append(' '); |
2016 |
errorMessage.append(' '); |
2018 |
errorMessage.append(newCommandLineArgs[index + 1]); |
2017 |
errorMessage.append(newCommandLineArgs[index + 1]); |
2019 |
} |
2018 |
} |
2020 |
throw new InvalidInputException( |
2019 |
throw new IllegalArgumentException( |
2021 |
this.bind("configure.duplicateEndorsedDirs", errorMessage.toString())); //$NON-NLS-1$ |
2020 |
this.bind("configure.duplicateEndorsedDirs", errorMessage.toString())); //$NON-NLS-1$ |
2022 |
} |
2021 |
} |
2023 |
mode = INSIDE_ENDORSED_DIRS; |
2022 |
mode = INSIDE_ENDORSED_DIRS; |
Lines 2138-2150
Link Here
|
2138 |
CompilerOptions.OPTION_SourceFileAttribute, |
2137 |
CompilerOptions.OPTION_SourceFileAttribute, |
2139 |
CompilerOptions.GENERATE); |
2138 |
CompilerOptions.GENERATE); |
2140 |
} else { |
2139 |
} else { |
2141 |
throw new InvalidInputException( |
2140 |
throw new IllegalArgumentException( |
2142 |
this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$ |
2141 |
this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$ |
2143 |
} |
2142 |
} |
2144 |
} |
2143 |
} |
2145 |
continue; |
2144 |
continue; |
2146 |
} |
2145 |
} |
2147 |
throw new InvalidInputException( |
2146 |
throw new IllegalArgumentException( |
2148 |
this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$ |
2147 |
this.bind("configure.invalidDebugOption", debugOption)); //$NON-NLS-1$ |
2149 |
} |
2148 |
} |
2150 |
if (currentArg.startsWith("-nowarn")) { //$NON-NLS-1$ |
2149 |
if (currentArg.startsWith("-nowarn")) { //$NON-NLS-1$ |
Lines 2161-2167
Link Here
|
2161 |
continue; |
2160 |
continue; |
2162 |
} |
2161 |
} |
2163 |
if (length <= 6) { |
2162 |
if (length <= 6) { |
2164 |
throw new InvalidInputException( |
2163 |
throw new IllegalArgumentException( |
2165 |
this.bind("configure.invalidWarningConfiguration", warningOption)); //$NON-NLS-1$ |
2164 |
this.bind("configure.invalidWarningConfiguration", warningOption)); //$NON-NLS-1$ |
2166 |
} |
2165 |
} |
2167 |
int warnTokenStart; |
2166 |
int warnTokenStart; |
Lines 2218-2224
Link Here
|
2218 |
handleWarningToken(token, isEnabling); |
2217 |
handleWarningToken(token, isEnabling); |
2219 |
} |
2218 |
} |
2220 |
if (tokenCounter == 0) { |
2219 |
if (tokenCounter == 0) { |
2221 |
throw new InvalidInputException( |
2220 |
throw new IllegalArgumentException( |
2222 |
this.bind("configure.invalidWarningOption", currentArg)); //$NON-NLS-1$ |
2221 |
this.bind("configure.invalidWarningOption", currentArg)); //$NON-NLS-1$ |
2223 |
} |
2222 |
} |
2224 |
continue; |
2223 |
continue; |
Lines 2301-2307
Link Here
|
2301 |
break; |
2300 |
break; |
2302 |
case INSIDE_TARGET : |
2301 |
case INSIDE_TARGET : |
2303 |
if (this.didSpecifyTarget) { |
2302 |
if (this.didSpecifyTarget) { |
2304 |
throw new InvalidInputException( |
2303 |
throw new IllegalArgumentException( |
2305 |
this.bind("configure.duplicateTarget", currentArg));//$NON-NLS-1$ |
2304 |
this.bind("configure.duplicateTarget", currentArg));//$NON-NLS-1$ |
2306 |
} |
2305 |
} |
2307 |
this.didSpecifyTarget = true; |
2306 |
this.didSpecifyTarget = true; |
Lines 2325-2331
Link Here
|
2325 |
this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_CLDC1_1); |
2324 |
this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_CLDC1_1); |
2326 |
this.options.put(CompilerOptions.OPTION_InlineJsr, CompilerOptions.ENABLED); |
2325 |
this.options.put(CompilerOptions.OPTION_InlineJsr, CompilerOptions.ENABLED); |
2327 |
}else { |
2326 |
}else { |
2328 |
throw new InvalidInputException(this.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$ |
2327 |
throw new IllegalArgumentException(this.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$ |
2329 |
} |
2328 |
} |
2330 |
mode = DEFAULT; |
2329 |
mode = DEFAULT; |
2331 |
continue; |
2330 |
continue; |
Lines 2337-2346
Link Here
|
2337 |
try { |
2336 |
try { |
2338 |
this.maxRepetition = Integer.parseInt(currentArg); |
2337 |
this.maxRepetition = Integer.parseInt(currentArg); |
2339 |
if (this.maxRepetition <= 0) { |
2338 |
if (this.maxRepetition <= 0) { |
2340 |
throw new InvalidInputException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$ |
2339 |
throw new IllegalArgumentException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$ |
2341 |
} |
2340 |
} |
2342 |
} catch (NumberFormatException e) { |
2341 |
} catch (NumberFormatException e) { |
2343 |
throw new InvalidInputException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$ |
2342 |
throw new IllegalArgumentException(this.bind("configure.repetition", currentArg)); //$NON-NLS-1$ |
2344 |
} |
2343 |
} |
2345 |
mode = DEFAULT; |
2344 |
mode = DEFAULT; |
2346 |
continue; |
2345 |
continue; |
Lines 2348-2364
Link Here
|
2348 |
try { |
2347 |
try { |
2349 |
this.maxProblems = Integer.parseInt(currentArg); |
2348 |
this.maxProblems = Integer.parseInt(currentArg); |
2350 |
if (this.maxProblems <= 0) { |
2349 |
if (this.maxProblems <= 0) { |
2351 |
throw new InvalidInputException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$ |
2350 |
throw new IllegalArgumentException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$ |
2352 |
} |
2351 |
} |
2353 |
this.options.put(CompilerOptions.OPTION_MaxProblemPerUnit, currentArg); |
2352 |
this.options.put(CompilerOptions.OPTION_MaxProblemPerUnit, currentArg); |
2354 |
} catch (NumberFormatException e) { |
2353 |
} catch (NumberFormatException e) { |
2355 |
throw new InvalidInputException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$ |
2354 |
throw new IllegalArgumentException(this.bind("configure.maxProblems", currentArg)); //$NON-NLS-1$ |
2356 |
} |
2355 |
} |
2357 |
mode = DEFAULT; |
2356 |
mode = DEFAULT; |
2358 |
continue; |
2357 |
continue; |
2359 |
case INSIDE_SOURCE : |
2358 |
case INSIDE_SOURCE : |
2360 |
if (this.didSpecifySource) { |
2359 |
if (this.didSpecifySource) { |
2361 |
throw new InvalidInputException( |
2360 |
throw new IllegalArgumentException( |
2362 |
this.bind("configure.duplicateSource", currentArg));//$NON-NLS-1$ |
2361 |
this.bind("configure.duplicateSource", currentArg));//$NON-NLS-1$ |
2363 |
} |
2362 |
} |
2364 |
this.didSpecifySource = true; |
2363 |
this.didSpecifySource = true; |
Lines 2373-2391
Link Here
|
2373 |
} else if (currentArg.equals("1.7") || currentArg.equals("7") || currentArg.equals("7.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ |
2372 |
} else if (currentArg.equals("1.7") || currentArg.equals("7") || currentArg.equals("7.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ |
2374 |
this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); |
2373 |
this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7); |
2375 |
} else { |
2374 |
} else { |
2376 |
throw new InvalidInputException(this.bind("configure.source", currentArg)); //$NON-NLS-1$ |
2375 |
throw new IllegalArgumentException(this.bind("configure.source", currentArg)); //$NON-NLS-1$ |
2377 |
} |
2376 |
} |
2378 |
mode = DEFAULT; |
2377 |
mode = DEFAULT; |
2379 |
continue; |
2378 |
continue; |
2380 |
case INSIDE_DEFAULT_ENCODING : |
2379 |
case INSIDE_DEFAULT_ENCODING : |
2381 |
if (didSpecifyDefaultEncoding) { |
2380 |
if (didSpecifyDefaultEncoding) { |
2382 |
throw new InvalidInputException( |
2381 |
throw new IllegalArgumentException( |
2383 |
this.bind("configure.duplicateDefaultEncoding", currentArg)); //$NON-NLS-1$ |
2382 |
this.bind("configure.duplicateDefaultEncoding", currentArg)); //$NON-NLS-1$ |
2384 |
} |
2383 |
} |
2385 |
try { // ensure encoding is supported |
2384 |
try { // ensure encoding is supported |
2386 |
new InputStreamReader(new ByteArrayInputStream(new byte[0]), currentArg); |
2385 |
new InputStreamReader(new ByteArrayInputStream(new byte[0]), currentArg); |
2387 |
} catch (UnsupportedEncodingException e) { |
2386 |
} catch (UnsupportedEncodingException e) { |
2388 |
throw new InvalidInputException( |
2387 |
throw new IllegalArgumentException( |
2389 |
this.bind("configure.unsupportedEncoding", currentArg)); //$NON-NLS-1$ |
2388 |
this.bind("configure.unsupportedEncoding", currentArg)); //$NON-NLS-1$ |
2390 |
} |
2389 |
} |
2391 |
this.options.put(CompilerOptions.OPTION_Encoding, currentArg); |
2390 |
this.options.put(CompilerOptions.OPTION_Encoding, currentArg); |
Lines 2412-2418
Link Here
|
2412 |
continue; |
2411 |
continue; |
2413 |
case INSIDE_EXT_DIRS: |
2412 |
case INSIDE_EXT_DIRS: |
2414 |
if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$ |
2413 |
if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$ |
2415 |
throw new InvalidInputException( |
2414 |
throw new IllegalArgumentException( |
2416 |
this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$ |
2415 |
this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$ |
2417 |
"-extdir")); //$NON-NLS-1$ |
2416 |
"-extdir")); //$NON-NLS-1$ |
2418 |
} |
2417 |
} |
Lines 2424-2430
Link Here
|
2424 |
continue; |
2423 |
continue; |
2425 |
case INSIDE_ENDORSED_DIRS: |
2424 |
case INSIDE_ENDORSED_DIRS: |
2426 |
if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$ |
2425 |
if (currentArg.indexOf("[-d") != -1) { //$NON-NLS-1$ |
2427 |
throw new InvalidInputException( |
2426 |
throw new IllegalArgumentException( |
2428 |
this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$ |
2427 |
this.bind("configure.unexpectedDestinationPathEntry", //$NON-NLS-1$ |
2429 |
"-endorseddirs")); //$NON-NLS-1$ |
2428 |
"-endorseddirs")); //$NON-NLS-1$ |
2430 |
} tokenizer = new StringTokenizer(currentArg, File.pathSeparator, false); |
2429 |
} tokenizer = new StringTokenizer(currentArg, File.pathSeparator, false); |
Lines 2438-2444
Link Here
|
2438 |
customDestinationPath = currentArg.substring(0, |
2437 |
customDestinationPath = currentArg.substring(0, |
2439 |
currentArg.length() - 1); |
2438 |
currentArg.length() - 1); |
2440 |
} else { |
2439 |
} else { |
2441 |
throw new InvalidInputException( |
2440 |
throw new IllegalArgumentException( |
2442 |
this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ |
2441 |
this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ |
2443 |
"[-d " + currentArg)); //$NON-NLS-1$ |
2442 |
"[-d " + currentArg)); //$NON-NLS-1$ |
2444 |
} |
2443 |
} |
Lines 2491-2497
Link Here
|
2491 |
} |
2490 |
} |
2492 |
File dir = new File(currentSourceDirectory); |
2491 |
File dir = new File(currentSourceDirectory); |
2493 |
if (!dir.isDirectory()) { |
2492 |
if (!dir.isDirectory()) { |
2494 |
throw new InvalidInputException( |
2493 |
throw new IllegalArgumentException( |
2495 |
this.bind("configure.unrecognizedOption", currentSourceDirectory)); //$NON-NLS-1$ |
2494 |
this.bind("configure.unrecognizedOption", currentSourceDirectory)); //$NON-NLS-1$ |
2496 |
} |
2495 |
} |
2497 |
String[] result = FileFinder.find(dir, SuffixConstants.SUFFIX_STRING_JAVA); |
2496 |
String[] result = FileFinder.find(dir, SuffixConstants.SUFFIX_STRING_JAVA); |
Lines 2718-2725
Link Here
|
2718 |
/* |
2717 |
/* |
2719 |
* Build the set of compilation source units |
2718 |
* Build the set of compilation source units |
2720 |
*/ |
2719 |
*/ |
2721 |
public CompilationUnit[] getCompilationUnits() |
2720 |
public CompilationUnit[] getCompilationUnits() { |
2722 |
throws InvalidInputException { |
|
|
2723 |
int fileCount = this.filenames.length; |
2721 |
int fileCount = this.filenames.length; |
2724 |
CompilationUnit[] units = new CompilationUnit[fileCount]; |
2722 |
CompilationUnit[] units = new CompilationUnit[fileCount]; |
2725 |
HashtableOfObject knownFileNames = new HashtableOfObject(fileCount); |
2723 |
HashtableOfObject knownFileNames = new HashtableOfObject(fileCount); |
Lines 2731-2741
Link Here
|
2731 |
for (int i = 0; i < fileCount; i++) { |
2729 |
for (int i = 0; i < fileCount; i++) { |
2732 |
char[] charName = this.filenames[i].toCharArray(); |
2730 |
char[] charName = this.filenames[i].toCharArray(); |
2733 |
if (knownFileNames.get(charName) != null) |
2731 |
if (knownFileNames.get(charName) != null) |
2734 |
throw new InvalidInputException(this.bind("unit.more", this.filenames[i])); //$NON-NLS-1$ |
2732 |
throw new IllegalArgumentException(this.bind("unit.more", this.filenames[i])); //$NON-NLS-1$ |
2735 |
knownFileNames.put(charName, charName); |
2733 |
knownFileNames.put(charName, charName); |
2736 |
File file = new File(this.filenames[i]); |
2734 |
File file = new File(this.filenames[i]); |
2737 |
if (!file.exists()) |
2735 |
if (!file.exists()) |
2738 |
throw new InvalidInputException(this.bind("unit.missing", this.filenames[i])); //$NON-NLS-1$ |
2736 |
throw new IllegalArgumentException(this.bind("unit.missing", this.filenames[i])); //$NON-NLS-1$ |
2739 |
String encoding = this.encodings[i]; |
2737 |
String encoding = this.encodings[i]; |
2740 |
if (encoding == null) |
2738 |
if (encoding == null) |
2741 |
encoding = defaultEncoding; |
2739 |
encoding = defaultEncoding; |
Lines 2791-2797
Link Here
|
2791 |
/* |
2789 |
/* |
2792 |
* External API |
2790 |
* External API |
2793 |
*/ |
2791 |
*/ |
2794 |
protected ArrayList handleBootclasspath(ArrayList bootclasspaths, String customEncoding) throws InvalidInputException { |
2792 |
protected ArrayList handleBootclasspath(ArrayList bootclasspaths, String customEncoding) { |
2795 |
final int bootclasspathsSize = bootclasspaths == null ? 0 : bootclasspaths.size(); |
2793 |
final int bootclasspathsSize = bootclasspaths == null ? 0 : bootclasspaths.size(); |
2796 |
if (bootclasspathsSize != 0) { |
2794 |
if (bootclasspathsSize != 0) { |
2797 |
String[] paths = new String[bootclasspathsSize]; |
2795 |
String[] paths = new String[bootclasspathsSize]; |
Lines 2878-2884
Link Here
|
2878 |
/* |
2876 |
/* |
2879 |
* External API |
2877 |
* External API |
2880 |
*/ |
2878 |
*/ |
2881 |
protected ArrayList handleClasspath(ArrayList classpaths, String customEncoding) throws InvalidInputException { |
2879 |
protected ArrayList handleClasspath(ArrayList classpaths, String customEncoding) { |
2882 |
final int classpathsSize = classpaths == null ? 0 : classpaths.size(); |
2880 |
final int classpathsSize = classpaths == null ? 0 : classpaths.size(); |
2883 |
if (classpathsSize != 0) { |
2881 |
if (classpathsSize != 0) { |
2884 |
String[] paths = new String[classpathsSize]; |
2882 |
String[] paths = new String[classpathsSize]; |
Lines 3063-3069
Link Here
|
3063 |
* External API |
3061 |
* External API |
3064 |
* Handle a single warning token. |
3062 |
* Handle a single warning token. |
3065 |
*/ |
3063 |
*/ |
3066 |
protected void handleWarningToken(String token, boolean isEnabling) throws InvalidInputException { |
3064 |
protected void handleWarningToken(String token, boolean isEnabling) { |
3067 |
if (token.length() == 0) return; |
3065 |
if (token.length() == 0) return; |
3068 |
switch(token.charAt(0)) { |
3066 |
switch(token.charAt(0)) { |
3069 |
case 'a' : |
3067 |
case 'a' : |
Lines 3399-3405
Link Here
|
3399 |
taskTags = taskTags.replace('|',','); |
3397 |
taskTags = taskTags.replace('|',','); |
3400 |
} |
3398 |
} |
3401 |
if (taskTags.length() == 0){ |
3399 |
if (taskTags.length() == 0){ |
3402 |
throw new InvalidInputException(this.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$ |
3400 |
throw new IllegalArgumentException(this.bind("configure.invalidTaskTag", token)); //$NON-NLS-1$ |
3403 |
} |
3401 |
} |
3404 |
this.options.put( |
3402 |
this.options.put( |
3405 |
CompilerOptions.OPTION_TaskTags, |
3403 |
CompilerOptions.OPTION_TaskTags, |
Lines 3634-3640
Link Here
|
3634 |
/* |
3632 |
/* |
3635 |
* Low-level API performing the actual compilation |
3633 |
* Low-level API performing the actual compilation |
3636 |
*/ |
3634 |
*/ |
3637 |
public void performCompilation() throws InvalidInputException { |
3635 |
public void performCompilation() { |
3638 |
|
3636 |
|
3639 |
this.startTime = System.currentTimeMillis(); |
3637 |
this.startTime = System.currentTimeMillis(); |
3640 |
|
3638 |
|
Lines 3706-3712
Link Here
|
3706 |
})); |
3704 |
})); |
3707 |
this.logger.flush(); |
3705 |
this.logger.flush(); |
3708 |
} |
3706 |
} |
3709 |
private ReferenceBinding[] processClassNames(LookupEnvironment environment) throws InvalidInputException { |
3707 |
private ReferenceBinding[] processClassNames(LookupEnvironment environment) { |
3710 |
// check for .class file presence in case of apt processing |
3708 |
// check for .class file presence in case of apt processing |
3711 |
int length = this.classNames.length; |
3709 |
int length = this.classNames.length; |
3712 |
ReferenceBinding[] referenceBindings = new ReferenceBinding[length]; |
3710 |
ReferenceBinding[] referenceBindings = new ReferenceBinding[length]; |
Lines 3726-3732
Link Here
|
3726 |
referenceBindings[i] = type; |
3724 |
referenceBindings[i] = type; |
3727 |
} |
3725 |
} |
3728 |
} else { |
3726 |
} else { |
3729 |
throw new InvalidInputException( |
3727 |
throw new IllegalArgumentException( |
3730 |
this.bind("configure.invalidClassName", currentName));//$NON-NLS-1$ |
3728 |
this.bind("configure.invalidClassName", currentName));//$NON-NLS-1$ |
3731 |
} |
3729 |
} |
3732 |
} |
3730 |
} |
Lines 3737-3744
Link Here
|
3737 |
*/ |
3735 |
*/ |
3738 |
public void processPathEntries(final int defaultSize, final ArrayList paths, |
3736 |
public void processPathEntries(final int defaultSize, final ArrayList paths, |
3739 |
final String currentPath, String customEncoding, boolean isSourceOnly, |
3737 |
final String currentPath, String customEncoding, boolean isSourceOnly, |
3740 |
boolean rejectDestinationPathOnJars) |
3738 |
boolean rejectDestinationPathOnJars) { |
3741 |
throws InvalidInputException { |
|
|
3742 |
String currentClasspathName = null; |
3739 |
String currentClasspathName = null; |
3743 |
String currentDestinationPath = null; |
3740 |
String currentDestinationPath = null; |
3744 |
ArrayList currentRuleSpecs = new ArrayList(defaultSize); |
3741 |
ArrayList currentRuleSpecs = new ArrayList(defaultSize); |
Lines 3798-3804
Link Here
|
3798 |
state = rulesNeedAnotherRule; |
3795 |
state = rulesNeedAnotherRule; |
3799 |
break; |
3796 |
break; |
3800 |
case destinationPathReadyToClose: |
3797 |
case destinationPathReadyToClose: |
3801 |
throw new InvalidInputException( |
3798 |
throw new IllegalArgumentException( |
3802 |
this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ |
3799 |
this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ |
3803 |
currentPath)); |
3800 |
currentPath)); |
3804 |
case bracketClosed: |
3801 |
case bracketClosed: |
Lines 3855-3861
Link Here
|
3855 |
case rulesStart: |
3852 |
case rulesStart: |
3856 |
if (token.startsWith("-d ")) { //$NON-NLS-1$ |
3853 |
if (token.startsWith("-d ")) { //$NON-NLS-1$ |
3857 |
if (currentDestinationPath != null) { |
3854 |
if (currentDestinationPath != null) { |
3858 |
throw new InvalidInputException( |
3855 |
throw new IllegalArgumentException( |
3859 |
this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$ |
3856 |
this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$ |
3860 |
currentPath)); |
3857 |
currentPath)); |
3861 |
} |
3858 |
} |
Lines 3866-3872
Link Here
|
3866 |
//$FALL-THROUGH$ |
3863 |
//$FALL-THROUGH$ |
3867 |
case rulesNeedAnotherRule: |
3864 |
case rulesNeedAnotherRule: |
3868 |
if (currentDestinationPath != null) { |
3865 |
if (currentDestinationPath != null) { |
3869 |
throw new InvalidInputException( |
3866 |
throw new IllegalArgumentException( |
3870 |
this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$ |
3867 |
this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$ |
3871 |
currentPath)); |
3868 |
currentPath)); |
3872 |
} |
3869 |
} |
Lines 3918-3924
Link Here
|
3918 |
} |
3915 |
} |
3919 |
} |
3916 |
} |
3920 |
|
3917 |
|
3921 |
private int processPaths(String[] args, int index, String currentArg, ArrayList paths) throws InvalidInputException { |
3918 |
private int processPaths(String[] args, int index, String currentArg, ArrayList paths) { |
3922 |
int localIndex = index; |
3919 |
int localIndex = index; |
3923 |
int count = 0; |
3920 |
int count = 0; |
3924 |
for (int i = 0, max = currentArg.length(); i < max; i++) { |
3921 |
for (int i = 0, max = currentArg.length(); i < max; i++) { |
Lines 3934-3947
Link Here
|
3934 |
if (count == 0) { |
3931 |
if (count == 0) { |
3935 |
paths.add(currentArg); |
3932 |
paths.add(currentArg); |
3936 |
} else if (count > 1) { |
3933 |
} else if (count > 1) { |
3937 |
throw new InvalidInputException( |
3934 |
throw new IllegalArgumentException( |
3938 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
3935 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
3939 |
currentArg)); |
3936 |
currentArg)); |
3940 |
} else { |
3937 |
} else { |
3941 |
StringBuffer currentPath = new StringBuffer(currentArg); |
3938 |
StringBuffer currentPath = new StringBuffer(currentArg); |
3942 |
while (true) { |
3939 |
while (true) { |
3943 |
if (localIndex >= args.length) { |
3940 |
if (localIndex >= args.length) { |
3944 |
throw new InvalidInputException( |
3941 |
throw new IllegalArgumentException( |
3945 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
3942 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
3946 |
currentArg)); |
3943 |
currentArg)); |
3947 |
} |
3944 |
} |
Lines 3951-3957
Link Here
|
3951 |
switch(nextArg.charAt(i)) { |
3948 |
switch(nextArg.charAt(i)) { |
3952 |
case '[' : |
3949 |
case '[' : |
3953 |
if (count > 1) { |
3950 |
if (count > 1) { |
3954 |
throw new InvalidInputException( |
3951 |
throw new IllegalArgumentException( |
3955 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
3952 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
3956 |
nextArg)); |
3953 |
nextArg)); |
3957 |
} |
3954 |
} |
Lines 3968-3974
Link Here
|
3968 |
paths.add(currentPath.toString()); |
3965 |
paths.add(currentPath.toString()); |
3969 |
return localIndex - index; |
3966 |
return localIndex - index; |
3970 |
} else if (count < 0) { |
3967 |
} else if (count < 0) { |
3971 |
throw new InvalidInputException( |
3968 |
throw new IllegalArgumentException( |
3972 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
3969 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
3973 |
nextArg)); |
3970 |
nextArg)); |
3974 |
} else { |
3971 |
} else { |
Lines 3980-3986
Link Here
|
3980 |
} |
3977 |
} |
3981 |
return localIndex - index; |
3978 |
return localIndex - index; |
3982 |
} |
3979 |
} |
3983 |
private int processPaths(String[] args, int index, String currentArg, String[] paths) throws InvalidInputException { |
3980 |
private int processPaths(String[] args, int index, String currentArg, String[] paths) { |
3984 |
int localIndex = index; |
3981 |
int localIndex = index; |
3985 |
int count = 0; |
3982 |
int count = 0; |
3986 |
for (int i = 0, max = currentArg.length(); i < max; i++) { |
3983 |
for (int i = 0, max = currentArg.length(); i < max; i++) { |
Lines 4000-4006
Link Here
|
4000 |
while (true) { |
3997 |
while (true) { |
4001 |
localIndex++; |
3998 |
localIndex++; |
4002 |
if (localIndex >= args.length) { |
3999 |
if (localIndex >= args.length) { |
4003 |
throw new InvalidInputException( |
4000 |
throw new IllegalArgumentException( |
4004 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
4001 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
4005 |
currentArg)); |
4002 |
currentArg)); |
4006 |
} |
4003 |
} |
Lines 4009-4015
Link Here
|
4009 |
switch(nextArg.charAt(i)) { |
4006 |
switch(nextArg.charAt(i)) { |
4010 |
case '[' : |
4007 |
case '[' : |
4011 |
if (count > 1) { |
4008 |
if (count > 1) { |
4012 |
throw new InvalidInputException( |
4009 |
throw new IllegalArgumentException( |
4013 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
4010 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
4014 |
currentArg)); |
4011 |
currentArg)); |
4015 |
} |
4012 |
} |
Lines 4026-4032
Link Here
|
4026 |
paths[0] = currentPath.toString(); |
4023 |
paths[0] = currentPath.toString(); |
4027 |
return localIndex - index; |
4024 |
return localIndex - index; |
4028 |
} else if (count < 0) { |
4025 |
} else if (count < 0) { |
4029 |
throw new InvalidInputException( |
4026 |
throw new IllegalArgumentException( |
4030 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
4027 |
this.bind("configure.unexpectedBracket", //$NON-NLS-1$ |
4031 |
currentArg)); |
4028 |
currentArg)); |
4032 |
} else { |
4029 |
} else { |
Lines 4075-4081
Link Here
|
4075 |
ArrayList classpaths, |
4072 |
ArrayList classpaths, |
4076 |
ArrayList extdirsClasspaths, |
4073 |
ArrayList extdirsClasspaths, |
4077 |
ArrayList endorsedDirClasspaths, |
4074 |
ArrayList endorsedDirClasspaths, |
4078 |
String customEncoding) throws InvalidInputException { |
4075 |
String customEncoding) { |
4079 |
|
4076 |
|
4080 |
// process bootclasspath, classpath and sourcepaths |
4077 |
// process bootclasspath, classpath and sourcepaths |
4081 |
bootclasspaths = handleBootclasspath(bootclasspaths, customEncoding); |
4078 |
bootclasspaths = handleBootclasspath(bootclasspaths, customEncoding); |
Lines 4115-4121
Link Here
|
4115 |
classpaths.toArray(this.checkedClasspaths); |
4112 |
classpaths.toArray(this.checkedClasspaths); |
4116 |
this.logger.logClasspath(this.checkedClasspaths); |
4113 |
this.logger.logClasspath(this.checkedClasspaths); |
4117 |
} |
4114 |
} |
4118 |
protected void validateOptions(boolean didSpecifyCompliance) throws InvalidInputException { |
4115 |
protected void validateOptions(boolean didSpecifyCompliance) { |
4119 |
if (didSpecifyCompliance) { |
4116 |
if (didSpecifyCompliance) { |
4120 |
Object version = this.options.get(CompilerOptions.OPTION_Compliance); |
4117 |
Object version = this.options.get(CompilerOptions.OPTION_Compliance); |
4121 |
if (CompilerOptions.VERSION_1_3.equals(version)) { |
4118 |
if (CompilerOptions.VERSION_1_3.equals(version)) { |
Lines 4200-4218
Link Here
|
4200 |
if (sourceVersion.equals(CompilerOptions.VERSION_1_7) |
4197 |
if (sourceVersion.equals(CompilerOptions.VERSION_1_7) |
4201 |
&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_7) { |
4198 |
&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_7) { |
4202 |
// compliance must be 1.7 if source is 1.7 |
4199 |
// compliance must be 1.7 if source is 1.7 |
4203 |
throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_7)); //$NON-NLS-1$ |
4200 |
throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_7)); //$NON-NLS-1$ |
4204 |
} else if (sourceVersion.equals(CompilerOptions.VERSION_1_6) |
4201 |
} else if (sourceVersion.equals(CompilerOptions.VERSION_1_6) |
4205 |
&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_6) { |
4202 |
&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_6) { |
4206 |
// compliance must be 1.6 if source is 1.6 |
4203 |
// compliance must be 1.6 if source is 1.6 |
4207 |
throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$ |
4204 |
throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_6)); //$NON-NLS-1$ |
4208 |
} else if (sourceVersion.equals(CompilerOptions.VERSION_1_5) |
4205 |
} else if (sourceVersion.equals(CompilerOptions.VERSION_1_5) |
4209 |
&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_5) { |
4206 |
&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_5) { |
4210 |
// compliance must be 1.5 if source is 1.5 |
4207 |
// compliance must be 1.5 if source is 1.5 |
4211 |
throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$ |
4208 |
throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$ |
4212 |
} else if (sourceVersion.equals(CompilerOptions.VERSION_1_4) |
4209 |
} else if (sourceVersion.equals(CompilerOptions.VERSION_1_4) |
4213 |
&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_4) { |
4210 |
&& CompilerOptions.versionToJdkLevel(compliance) < ClassFileConstants.JDK1_4) { |
4214 |
// compliance must be 1.4 if source is 1.4 |
4211 |
// compliance must be 1.4 if source is 1.4 |
4215 |
throw new InvalidInputException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$ |
4212 |
throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$ |
4216 |
} |
4213 |
} |
4217 |
|
4214 |
|
4218 |
// check and set compliance/source/target compatibilities |
4215 |
// check and set compliance/source/target compatibilities |
Lines 4222-4260
Link Here
|
4222 |
if (CompilerOptions.VERSION_JSR14.equals(targetVersion)) { |
4219 |
if (CompilerOptions.VERSION_JSR14.equals(targetVersion)) { |
4223 |
// expecting source >= 1.5 |
4220 |
// expecting source >= 1.5 |
4224 |
if (CompilerOptions.versionToJdkLevel(sourceVersion) < ClassFileConstants.JDK1_5) { |
4221 |
if (CompilerOptions.versionToJdkLevel(sourceVersion) < ClassFileConstants.JDK1_5) { |
4225 |
throw new InvalidInputException(this.bind("configure.incompatibleTargetForGenericSource", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ |
4222 |
throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForGenericSource", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ |
4226 |
} |
4223 |
} |
4227 |
} else if (CompilerOptions.VERSION_CLDC1_1.equals(targetVersion)) { |
4224 |
} else if (CompilerOptions.VERSION_CLDC1_1.equals(targetVersion)) { |
4228 |
if (this.didSpecifySource && CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4) { |
4225 |
if (this.didSpecifySource && CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4) { |
4229 |
throw new InvalidInputException(this.bind("configure.incompatibleSourceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ |
4226 |
throw new IllegalArgumentException(this.bind("configure.incompatibleSourceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ |
4230 |
} |
4227 |
} |
4231 |
if (CompilerOptions.versionToJdkLevel(compliance) >= ClassFileConstants.JDK1_5) { |
4228 |
if (CompilerOptions.versionToJdkLevel(compliance) >= ClassFileConstants.JDK1_5) { |
4232 |
throw new InvalidInputException(this.bind("configure.incompatibleComplianceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ |
4229 |
throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForCldcTarget", (String) targetVersion, (String) sourceVersion)); //$NON-NLS-1$ |
4233 |
} |
4230 |
} |
4234 |
} else { |
4231 |
} else { |
4235 |
// target must be 1.7 if source is 1.7 |
4232 |
// target must be 1.7 if source is 1.7 |
4236 |
if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_7 |
4233 |
if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_7 |
4237 |
&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_7){ |
4234 |
&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_7){ |
4238 |
throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_7)); //$NON-NLS-1$ |
4235 |
throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_7)); //$NON-NLS-1$ |
4239 |
} |
4236 |
} |
4240 |
// target must be 1.6 if source is 1.6 |
4237 |
// target must be 1.6 if source is 1.6 |
4241 |
if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_6 |
4238 |
if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_6 |
4242 |
&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_6){ |
4239 |
&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_6){ |
4243 |
throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_6)); //$NON-NLS-1$ |
4240 |
throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_6)); //$NON-NLS-1$ |
4244 |
} |
4241 |
} |
4245 |
// target must be 1.5 if source is 1.5 |
4242 |
// target must be 1.5 if source is 1.5 |
4246 |
if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_5 |
4243 |
if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_5 |
4247 |
&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_5){ |
4244 |
&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_5){ |
4248 |
throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_5)); //$NON-NLS-1$ |
4245 |
throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_5)); //$NON-NLS-1$ |
4249 |
} |
4246 |
} |
4250 |
// target must be 1.4 if source is 1.4 |
4247 |
// target must be 1.4 if source is 1.4 |
4251 |
if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4 |
4248 |
if (CompilerOptions.versionToJdkLevel(sourceVersion) >= ClassFileConstants.JDK1_4 |
4252 |
&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_4){ |
4249 |
&& CompilerOptions.versionToJdkLevel(targetVersion) < ClassFileConstants.JDK1_4){ |
4253 |
throw new InvalidInputException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_4)); //$NON-NLS-1$ |
4250 |
throw new IllegalArgumentException(this.bind("configure.incompatibleTargetForSource", (String) targetVersion, CompilerOptions.VERSION_1_4)); //$NON-NLS-1$ |
4254 |
} |
4251 |
} |
4255 |
// target cannot be greater than compliance level |
4252 |
// target cannot be greater than compliance level |
4256 |
if (CompilerOptions.versionToJdkLevel(compliance) < CompilerOptions.versionToJdkLevel(targetVersion)){ |
4253 |
if (CompilerOptions.versionToJdkLevel(compliance) < CompilerOptions.versionToJdkLevel(targetVersion)){ |
4257 |
throw new InvalidInputException(this.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), (String) targetVersion)); //$NON-NLS-1$ |
4254 |
throw new IllegalArgumentException(this.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), (String) targetVersion)); //$NON-NLS-1$ |
4258 |
} |
4255 |
} |
4259 |
} |
4256 |
} |
4260 |
} |
4257 |
} |