This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Java: parser_check_super_interface error message fix


The error message thrown by parser_check_super_interface looks the wrong 
way around to my eye.

Given:

// I.java
interface C {}
public class I extends C {}

Before:

$ gcj I.java -c
I.java:3: Can't use class `C' to implement/extend interface `I'.
   public interface I extends C {}
                              ^
1 error

After:

$ gcj I.java -c
I.java:3: Interface `I' can't implement/extend class `C'.
   public interface I extends C {}
                              ^
1 error

I'm checking in this patch as obvious.

regards

Bryce.


2002-03-18  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

	* parse.y (parser_check_super_interface): Fix error message
	grammar/order.

Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.360
diff -u -r1.360 parse.y
--- parse.y	2002/03/16 20:57:10	1.360
+++ parse.y	2002/03/18 10:18:33
@@ -5070,12 +5070,12 @@
   if (!CLASS_INTERFACE (super_decl))
     {
       parse_error_context 
-	(this_wfl, "Can't use %s `%s' to implement/extend %s `%s'",
-	 (TYPE_ARRAY_P (super_type) ? "array" : "class"),
-	 IDENTIFIER_POINTER (DECL_NAME (super_decl)),
+	(this_wfl, "%s `%s' can't implement/extend %s `%s'",
 	 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ? 
-	  "interface" : "class"),
-	 IDENTIFIER_POINTER (DECL_NAME (this_decl)));
+	  "Interface" : "Class"),
+	 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
+	 (TYPE_ARRAY_P (super_type) ? "array" : "class"),
+	 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
       return 1;
     }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]