OSDN Git Service

1999-02-09 Andrew Haley <aph@cygnus.com>
[pf3gnuchains/gcc-fork.git] / gcc / java / class.c
index 2ee7726..6d748a4 100644 (file)
@@ -1,5 +1,5 @@
 /* Functions related to building classes and their related objects.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 97-98, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -103,7 +103,7 @@ mangled_classname (prefix, type)
   tree ident = TYPE_NAME (type);
   if (TREE_CODE (ident) != IDENTIFIER_NODE)
     ident = DECL_NAME (ident);
-  return identifier_subst (ident, prefix, '/', '_', "");
+  return identifier_subst (ident, prefix, '.', '_', "");
 }
 
 tree
@@ -840,7 +840,12 @@ make_field_value (tree fdecl)
   if (resolved)
     type = build_class_ref (type);
   else
-    type = build_utf8_ref (build_java_signature (type));
+    {
+      tree signature = build_java_signature (type);
+      type = build_utf8_ref (unmangle_classname 
+                            (IDENTIFIER_POINTER(signature),
+                             IDENTIFIER_LENGTH(signature)));
+    }
   PUSH_FIELD_VALUE (finit, "type", type);
   flags = get_access_flags_from_decl (fdecl);
   if (! resolved)
@@ -886,8 +891,14 @@ make_method_value (mdecl, this_class_addr)
                    build_utf8_ref (DECL_CONSTRUCTOR_P (mdecl) ?
                                    init_identifier_node
                                    : DECL_NAME (mdecl)));
-  PUSH_FIELD_VALUE (minit, "signature",
-                   build_utf8_ref (build_java_signature (TREE_TYPE (mdecl))));
+  {
+    tree signature = build_java_signature (TREE_TYPE (mdecl));
+    PUSH_FIELD_VALUE (minit, "signature", 
+                     (build_utf8_ref 
+                      (unmangle_classname 
+                       (IDENTIFIER_POINTER(signature),
+                        IDENTIFIER_LENGTH(signature)))));
+  }
   PUSH_FIELD_VALUE (minit, "accflags", build_int_2 (accflags, 0));
   PUSH_FIELD_VALUE (minit, "ncode", code);
   FINISH_RECORD_CONSTRUCTOR (minit);
@@ -1120,17 +1131,12 @@ make_class_data (type)
   START_RECORD_CONSTRUCTOR (cons, class_type_node);
   PUSH_SUPER_VALUE (cons, temp);
   PUSH_FIELD_VALUE (cons, "next", null_pointer_node);
-#if 0
-  /* Need to fix _Jv_FindClassFromSignature. */
   PUSH_FIELD_VALUE (cons, "name", build_utf8_ref (DECL_NAME (type_decl)));
-#else
-  PUSH_FIELD_VALUE (cons, "name",
-                   build_utf8_ref (build_internal_class_name (type)));
-#endif
   PUSH_FIELD_VALUE (cons, "accflags",
                    build_int_2 (get_access_flags_from_decl (type_decl), 0));
 
-  PUSH_FIELD_VALUE (cons, "superclass", super);
+  PUSH_FIELD_VALUE (cons, "superclass", 
+                   CLASS_INTERFACE (type_decl) ? null_pointer_node : super);
   PUSH_FIELD_VALUE (cons, "constants", constant_pool_constructor);
   PUSH_FIELD_VALUE (cons, "methods",
                    build1 (ADDR_EXPR, method_ptr_type_node, methods_decl));