This is the mail archive of the java-prs@sourceware.cygnus.com 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]

gcj/197: Inner Interfaces need to support private, protected, and static keywords



>Number:         197
>Category:       gcj
>Synopsis:       Inner Interfaces need to support private, protected, and static keywords
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    apbianco
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 09 04:16:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Mo
>Release:        egcs CVS Sun Apr  9
>Organization:
>Environment:
Red Hat 5.2
>Description:
gcj needs to be able to compile the following classes.

// File PrivateInnerInterface.java

public class PrivateInnerInterface {
    private interface Inter {}
}

// File ProtectedInnerInterface.java

public class ProtectedInnerInterface {
    protected interface Inter {}
}

// File StaticInnerInterface.java

public class StaticInnerInterface {
    static interface Inter {}
}

>How-To-Repeat:
If you try to compile any of these classes with gcj
you will get an error saying those keywords are not
valid on an interface.
>Fix:
Index: gcc/java/parse.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.h,v
retrieving revision 1.49
diff -u -r1.49 parse.h
--- parse.h	2000/04/06 00:43:27	1.49
+++ parse.h	2000/04/09 10:59:32
@@ -79,6 +79,7 @@
 #define METHOD_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_PRIVATE|ACC_ABSTRACT| \
 			 ACC_STATIC|ACC_FINAL|ACC_SYNCHRONIZED|ACC_NATIVE
 #define INTERFACE_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT
+#define INTERFACE_INNER_MODIFIERS ACC_PUBLIC|ACC_PROTECTED|ACC_PRIVATE|ACC_ABSTRACT|ACC_STATIC
 #define INTERFACE_METHOD_MODIFIERS ACC_PUBLIC|ACC_ABSTRACT
 #define INTERFACE_FIELD_MODIFIERS ACC_PUBLIC|ACC_STATIC|ACC_FINAL
 
Index: gcc/java/parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.150
diff -u -r1.150 parse.y
--- parse.y	2000/04/06 05:29:30	1.150
+++ parse.y	2000/04/09 10:59:54
@@ -3348,7 +3348,7 @@
 	sca = (GET_CPC_LIST () ? ACC_STATIC : 0);
     }
 
-  /* Inner classes and interfaces can be declared private or protected
+  /* Inner classes can be declared private or protected
      within their enclosing classes. */
   if (CPC_INNER_P ())
     {
@@ -3364,9 +3364,15 @@
 	}
     }
 
-  if (is_interface)
+  if (is_interface) {
+    if (CPC_INNER_P ())
+      uaaf = INTERFACE_INNER_MODIFIERS;
+    else
+      uaaf = INTERFACE_MODIFIERS;
+
     check_modifiers ("Illegal modifier `%s' for interface declaration",
-		     flags, INTERFACE_MODIFIERS);
+		     flags, uaaf);
+  }
   else
     check_modifiers ("Illegal modifier `%s' for class declaration",
 		     flags, uaaf|sca|icaf);
@@ -3748,7 +3754,7 @@
   return class;
 }
 
-/* Create an class in pass1 and return its decl. Return class
+/* Create a class in pass1 and return its decl. Return class
    interface's decl in pass 2.  */
 
 static tree
>Release-Note:
>Audit-Trail:
>Unformatted:

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