< prev index next >

src/java.base/share/classes/java/lang/module/ModuleDescriptor.java

Print this page
rev 47483 : [mq]: XXXXXXX-double-trouble-2


1576          *         If the dependence on the module has already been declared
1577          *         or this builder is for an automatic module
1578          */
1579         public Builder requires(Requires req) {
1580             if (automatic)
1581                 throw new IllegalStateException("Automatic modules cannot declare"
1582                                                 + " dependences");
1583             String mn = req.name();
1584             if (name.equals(mn))
1585                 throw new IllegalArgumentException("Dependence on self");
1586             if (requires.containsKey(mn))
1587                 throw new IllegalStateException("Dependence upon " + mn
1588                                                 + " already declared");
1589             requires.put(mn, req);
1590             return this;
1591         }
1592 
1593         /**
1594          * Adds a dependence on a module with the given (and possibly empty)
1595          * set of modifiers. The dependence includes the version of the
1596          * module that that was recorded at compile-time.
1597          *
1598          * @param  ms
1599          *         The set of modifiers
1600          * @param  mn
1601          *         The module name
1602          * @param  compiledVersion
1603          *         The version of the module recorded at compile-time
1604          *
1605          * @return This builder
1606          *
1607          * @throws IllegalArgumentException
1608          *         If the module name is {@code null}, is not a legal module
1609          *         name, or is equal to the module name that this builder
1610          *         was initialized to build
1611          * @throws IllegalStateException
1612          *         If the dependence on the module has already been declared
1613          *         or this builder is for an automatic module
1614          */
1615         public Builder requires(Set<Requires.Modifier> ms,
1616                                 String mn,




1576          *         If the dependence on the module has already been declared
1577          *         or this builder is for an automatic module
1578          */
1579         public Builder requires(Requires req) {
1580             if (automatic)
1581                 throw new IllegalStateException("Automatic modules cannot declare"
1582                                                 + " dependences");
1583             String mn = req.name();
1584             if (name.equals(mn))
1585                 throw new IllegalArgumentException("Dependence on self");
1586             if (requires.containsKey(mn))
1587                 throw new IllegalStateException("Dependence upon " + mn
1588                                                 + " already declared");
1589             requires.put(mn, req);
1590             return this;
1591         }
1592 
1593         /**
1594          * Adds a dependence on a module with the given (and possibly empty)
1595          * set of modifiers. The dependence includes the version of the
1596          * module that was recorded at compile-time.
1597          *
1598          * @param  ms
1599          *         The set of modifiers
1600          * @param  mn
1601          *         The module name
1602          * @param  compiledVersion
1603          *         The version of the module recorded at compile-time
1604          *
1605          * @return This builder
1606          *
1607          * @throws IllegalArgumentException
1608          *         If the module name is {@code null}, is not a legal module
1609          *         name, or is equal to the module name that this builder
1610          *         was initialized to build
1611          * @throws IllegalStateException
1612          *         If the dependence on the module has already been declared
1613          *         or this builder is for an automatic module
1614          */
1615         public Builder requires(Set<Requires.Modifier> ms,
1616                                 String mn,


< prev index next >