-
Bug
-
Resolution: Fixed
-
P4
-
8, 11, 17, 22, 23, 24
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
In the JLS, chapter §7.7.1 Module Declaration - Dependences [1], the spec does not mention anything regarding multiple appearances of the requires modifiers (transitive and static), however javac errs if static is declared multiple times, and if transitive is declared twice or more, the second time the token is consumed as a module name, despite the syntax descriptor indicating any amount of {RequiresModifier} instances.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Save the included test case source in a module-info.java
Attempt to compile with a simple `javac module-info.java` invocation
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A compiled module-info.class file
ACTUAL -
module-info.java:2: error: repeated modifier
requires static static java.sql;
^
module-info.java:3: error: ';' expected
requires transitive transitive java.desktop;
^
module-info.java:3: error: module directive keyword or '}' expected
requires transitive transitive java.desktop;
^
3 errors
---------- BEGIN SOURCE ----------
module test {
requires static static java.sql;
requires transitive transitive java.desktop;
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Avoid repeating transitive/static modifiers in a requires directive
FREQUENCY : always
In the JLS, chapter §7.7.1 Module Declaration - Dependences [1], the spec does not mention anything regarding multiple appearances of the requires modifiers (transitive and static), however javac errs if static is declared multiple times, and if transitive is declared twice or more, the second time the token is consumed as a module name, despite the syntax descriptor indicating any amount of {RequiresModifier} instances.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Save the included test case source in a module-info.java
Attempt to compile with a simple `javac module-info.java` invocation
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A compiled module-info.class file
ACTUAL -
module-info.java:2: error: repeated modifier
requires static static java.sql;
^
module-info.java:3: error: ';' expected
requires transitive transitive java.desktop;
^
module-info.java:3: error: module directive keyword or '}' expected
requires transitive transitive java.desktop;
^
3 errors
---------- BEGIN SOURCE ----------
module test {
requires static static java.sql;
requires transitive transitive java.desktop;
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Avoid repeating transitive/static modifiers in a requires directive
FREQUENCY : always
- relates to
-
JDK-8345058 Javac issues different error messages for the modifiers of the requires directive
- Resolved