PR java/1207, java/16178

PR java/1207, java/16178
	* jcf-parse.c (load_class): Return immediately if passed a type decl
	where CLASS_FROM_SOURCE_P is set. Remove FIXME.
	* parse.y (do_resolve_class): Remove checks for CLASS_FROM_SOURCE_P
	before calling load_class.
	(qualify_and_find): Likewise.
	(find_in_imports_on_demand): Likewise.
	(find_applicable_accessible_methods_list): Likewise.

Co-Authored-By: Ranjit Mathew <rmathew@hotmail.com>

From-SVN: r83719
This commit is contained in:
Bryce McKinlay 2004-06-26 20:40:31 +00:00 committed by Bryce McKinlay
parent c872077c88
commit ed7f23690a
3 changed files with 27 additions and 12 deletions

View file

@ -1,3 +1,20 @@
2004-06-26 Bryce McKinlay <mckinlay@redhat.com>
Ranjit Mathew <rmathew@hotmail.com>
PR java/1207, java/16178
* jcf-parse.c (load_class): Return immediately if passed a type decl
where CLASS_FROM_SOURCE_P is set. Remove FIXME.
* parse.y (do_resolve_class): Remove checks for CLASS_FROM_SOURCE_P
before calling load_class.
(qualify_and_find): Likewise.
(find_in_imports_on_demand): Likewise.
(find_applicable_accessible_methods_list): Likewise.
2004-06-24 Bryce McKinlay <mckinlay@redhat.com>
* parse.y (java_layout_seen_class_methods): Don't call load_class
on class defined by source parser.
2004-06-23 Bryce McKinlay <mckinlay@redhat.com> 2004-06-23 Bryce McKinlay <mckinlay@redhat.com>
* parse.y (set_nested_class_simple_name_value): Removed. * parse.y (set_nested_class_simple_name_value): Removed.

View file

@ -562,10 +562,6 @@ read_class (tree name)
/* Load CLASS_OR_NAME. CLASS_OR_NAME can be a mere identifier if /* Load CLASS_OR_NAME. CLASS_OR_NAME can be a mere identifier if
called from the parser, otherwise it's a RECORD_TYPE node. If called from the parser, otherwise it's a RECORD_TYPE node. If
VERBOSE is 1, print error message on failure to load a class. */ VERBOSE is 1, print error message on failure to load a class. */
/* Replace calls to load_class by having callers call read_class directly
- and then perhaps rename read_class to load_class. FIXME */
void void
load_class (tree class_or_name, int verbose) load_class (tree class_or_name, int verbose)
{ {
@ -581,7 +577,12 @@ load_class (tree class_or_name, int verbose)
name = TYPE_NAME (TREE_PURPOSE (class_or_name)); name = TYPE_NAME (TREE_PURPOSE (class_or_name));
/* Or it's a type in the making */ /* Or it's a type in the making */
else else
{
/* If the class is from source code, then it must already be loaded. */
if (CLASS_FROM_SOURCE_P (class_or_name))
return;
name = DECL_NAME (TYPE_NAME (class_or_name)); name = DECL_NAME (TYPE_NAME (class_or_name));
}
saved = name; saved = name;
while (1) while (1)

View file

@ -5796,8 +5796,7 @@ do_resolve_class (tree enclosing, tree class_type, tree decl, tree cl)
/* 2- And check for the type in the current compilation unit */ /* 2- And check for the type in the current compilation unit */
if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)))) if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
{ {
if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)))
!CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
load_class (TYPE_NAME (class_type), 0); load_class (TYPE_NAME (class_type), 0);
return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type)); return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
} }
@ -5891,8 +5890,7 @@ qualify_and_find (tree class_type, tree package, tree name)
load_class (new_qualified, 0); load_class (new_qualified, 0);
if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_qualified))) if ((new_class_decl = IDENTIFIER_CLASS_VALUE (new_qualified)))
{ {
if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) && if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)))
!CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
load_class (new_qualified, 0); load_class (new_qualified, 0);
TYPE_NAME (class_type) = new_qualified; TYPE_NAME (class_type) = new_qualified;
return IDENTIFIER_CLASS_VALUE (new_qualified); return IDENTIFIER_CLASS_VALUE (new_qualified);
@ -7044,8 +7042,7 @@ find_in_imports_on_demand (tree enclosing_type, tree class_type)
access_check = -1; access_check = -1;
/* If there is no DECL set for the class or if the class isn't /* If there is no DECL set for the class or if the class isn't
loaded and not seen in source yet, then load */ loaded and not seen in source yet, then load */
if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl)) if (!decl || ! CLASS_LOADED_P (TREE_TYPE (decl)))
&& !CLASS_FROM_SOURCE_P (TREE_TYPE (decl))))
{ {
load_class (node, 0); load_class (node, 0);
decl = IDENTIFIER_CLASS_VALUE (node); decl = IDENTIFIER_CLASS_VALUE (node);
@ -11014,7 +11011,7 @@ find_applicable_accessible_methods_list (int lc, tree class, tree name,
search_not_done++; search_not_done++;
*htab_find_slot (searched_classes, class, INSERT) = class; *htab_find_slot (searched_classes, class, INSERT) = class;
if (!CLASS_LOADED_P (class) && !CLASS_FROM_SOURCE_P (class)) if (!CLASS_LOADED_P (class))
{ {
load_class (class, 1); load_class (class, 1);
safe_layout_class (class); safe_layout_class (class);