re GNATS gcj/128 (weak error message when expecting final modifier)
authorJoerg Brunsmann <joerg.brunsmann@fernuni-hagen.de>
Mon, 17 Jan 2000 22:54:30 +0000 (22:54 +0000)
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>
Mon, 17 Jan 2000 22:54:30 +0000 (14:54 -0800)
Mon Jan 17 11:58:17 2000  Joerg Brunsmann  <joerg.brunsmann@fernuni-hagen.de>

        * parse.y (format_parameter:): Use final: rule instead of modifiers:.
        (final:): New rule.

Joerg Brunsmann's contribution to fix the Java PR #128.

From-SVN: r31477

gcc/java/ChangeLog
gcc/java/parse.y

index 85c0b05d292ab0ae450fe8e37ab322d7e7591bf4..aa636cf4d08db3c602c06aca7c9aa1999511b743 100644 (file)
@@ -1,3 +1,8 @@
+Mon Jan 17 11:58:17 2000  Joerg Brunsmann  <joerg.brunsmann@fernuni-hagen.de>
+
+       * parse.y (format_parameter:): Use final: rule instead of modifiers:.
+       (final:): New rule.
+
 2000-01-17  Tom Tromey  <tromey@cygnus.com>
 
        * gjavah.c (print_field_info): Allow non-static final fields.
index 85635082dded1e81ff7d6ba46579c3068d7378f6..b4d9d7666df96fbba6c992875b48cb7d1ed7f1c1 100644 (file)
@@ -950,20 +950,29 @@ formal_parameter:
                {
                  $$ = build_tree_list ($2, $1);
                }
-|      modifiers type variable_declarator_id /* Added, JDK1.1 final parms */
+|      final type variable_declarator_id /* Added, JDK1.1 final parms */
                { 
                  parse_jdk1_1_error ("final parameters");
                  $$ = build_tree_list ($3, $2);
                }
 |      type error
                {yyerror ("Missing identifier"); RECOVER;}
-|      modifiers type error
+|      final type error
                {
-                 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", $1));
                  yyerror ("Missing identifier"); RECOVER;
                }
 ;
 
+final:
+       modifiers
+               {
+                 check_modifiers ("Illegal modifier `%s'. Only `final' was expected here",
+                                  $1, ACC_FINAL);
+                 if ($1 != ACC_FINAL)
+                   MODIFIER_WFL (FINAL_TK) = build_wfl_node (NULL_TREE);
+               }
+;
+
 throws:
                { $$ = NULL_TREE; }
 |      THROWS_TK class_type_list