< prev index next >
src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
Print this page
*** 951,961 ****
* @throws IllegalStateException
* If the dependence on the module has already been declared
*/
public Builder requires(Set<Requires.Modifier> mods, String mn) {
if (name.equals(mn))
! throw new IllegalArgumentException("Dependence on self");
if (requires.containsKey(mn))
throw new IllegalStateException("Dependence upon " + mn
+ " already declared");
requires.put(mn, new Requires(mods, mn)); // checks mn
return this;
--- 951,961 ----
* @throws IllegalStateException
* If the dependence on the module has already been declared
*/
public Builder requires(Set<Requires.Modifier> mods, String mn) {
if (name.equals(mn))
! throw new IllegalArgumentException("Dependence on self: " + mn);
if (requires.containsKey(mn))
throw new IllegalStateException("Dependence upon " + mn
+ " already declared");
requires.put(mn, new Requires(mods, mn)); // checks mn
return this;
*** 1271,1281 ****
*
* @see Version#parse(String)
*/
public Builder version(String v) {
if (version != null)
! throw new IllegalStateException("module version already set");
version = Version.parse(v);
return this;
}
/**
--- 1271,1282 ----
*
* @see Version#parse(String)
*/
public Builder version(String v) {
if (version != null)
! throw new IllegalStateException(
! "module version already set: " + version);
version = Version.parse(v);
return this;
}
/**
*** 1291,1301 ****
* @throws IllegalStateException
* If the module main class is already set
*/
public Builder mainClass(String mc) {
if (mainClass != null)
! throw new IllegalStateException("main class already set");
mainClass = requireJavaIdentifier("main class name", mc);
return this;
}
/**
--- 1292,1303 ----
* @throws IllegalStateException
* If the module main class is already set
*/
public Builder mainClass(String mc) {
if (mainClass != null)
! throw new IllegalStateException(
! "main class already set: " + mainClass);
mainClass = requireJavaIdentifier("main class name", mc);
return this;
}
/**
*** 1311,1321 ****
* @throws IllegalStateException
* If the operating system name is already set
*/
public Builder osName(String name) {
if (osName != null)
! throw new IllegalStateException("OS name already set");
if (name == null || name.isEmpty())
throw new IllegalArgumentException("OS name is null or empty");
osName = name;
return this;
}
--- 1313,1324 ----
* @throws IllegalStateException
* If the operating system name is already set
*/
public Builder osName(String name) {
if (osName != null)
! throw new IllegalStateException(
! "OS name already set: " + osName);
if (name == null || name.isEmpty())
throw new IllegalArgumentException("OS name is null or empty");
osName = name;
return this;
}
*** 1333,1343 ****
* @throws IllegalStateException
* If the operating system architecture is already set
*/
public Builder osArch(String arch) {
if (osArch != null)
! throw new IllegalStateException("OS arch already set");
if (arch == null || arch.isEmpty())
throw new IllegalArgumentException("OS arch is null or empty");
osArch = arch;
return this;
}
--- 1336,1347 ----
* @throws IllegalStateException
* If the operating system architecture is already set
*/
public Builder osArch(String arch) {
if (osArch != null)
! throw new IllegalStateException(
! "OS arch already set: " + osArch);
if (arch == null || arch.isEmpty())
throw new IllegalArgumentException("OS arch is null or empty");
osArch = arch;
return this;
}
*** 1355,1365 ****
* @throws IllegalStateException
* If the operating system version is already set
*/
public Builder osVersion(String version) {
if (osVersion != null)
! throw new IllegalStateException("OS version already set");
if (version == null || version.isEmpty())
throw new IllegalArgumentException("OS version is null or empty");
osVersion = version;
return this;
}
--- 1359,1370 ----
* @throws IllegalStateException
* If the operating system version is already set
*/
public Builder osVersion(String version) {
if (osVersion != null)
! throw new IllegalStateException(
! "OS version already set: " + osVersion);
if (version == null || version.isEmpty())
throw new IllegalArgumentException("OS version is null or empty");
osVersion = version;
return this;
}
< prev index next >