static int find_in_imports_on_demand (tree, tree);
static void find_in_imports (tree, tree);
static void check_inner_class_access (tree, tree, tree);
-static int check_pkg_class_access (tree, tree, bool);
+static int check_pkg_class_access (tree, tree, bool, tree);
static void register_package (tree);
static tree resolve_package (tree, tree *, tree *);
static tree resolve_class (tree, tree, tree, tree);
access rules (6.6.1). */
if (! INNER_CLASS_P (super_type)
&& check_pkg_class_access (DECL_NAME (super_decl),
- lookup_cl (this_decl), true))
+ NULL_TREE, true, this_decl))
return 1;
SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
/* Check top-level class scope. Inner classes are subject to member access
rules (6.6.1). */
if (! INNER_CLASS_P (super_type)
- && (check_pkg_class_access (DECL_NAME (super_decl), wfl, true)))
+ && (check_pkg_class_access (DECL_NAME (super_decl), wfl, true, NULL_TREE)))
return 1;
SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
by the caller. */
if (cl)
{
- if (check_pkg_class_access (TYPE_NAME (class_type), cl, true))
+ if (check_pkg_class_access (TYPE_NAME (class_type), cl, true, NULL_TREE))
return NULL_TREE;
}
QUALIFIED_P (to_be_found) = 1;
load_class (to_be_found, 0);
error_found =
- check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true);
+ check_pkg_class_access (to_be_found, TREE_PURPOSE (import), true, NULL_TREE);
/* We found it, we can bail out */
if (IDENTIFIER_CLASS_VALUE (to_be_found))
}
if (decl && ! INNER_CLASS_P (TREE_TYPE (decl)))
access_check = check_pkg_class_access (node, TREE_PURPOSE (import),
- false);
+ false, NULL_TREE);
else
/* 6.6.1: Inner classes are subject to member access rules. */
access_check = 0;
/* Accessibility check for top-level classes. If CLASS_NAME is in a
foreign package, it must be PUBLIC. Return 0 if no access
violations were found, 1 otherwise. If VERBOSE is true and an error
- was found, it is reported and accounted for. */
+ was found, it is reported and accounted for. If CL is NULL then
+ look it up with THIS_DECL. */
static int
-check_pkg_class_access (tree class_name, tree cl, bool verbose)
+check_pkg_class_access (tree class_name, tree cl, bool verbose, tree this_decl)
{
tree type;
if (verbose)
parse_error_context
- (cl, "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed",
+ (cl == NULL ? lookup_cl (this_decl): cl,
+ "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed",
(CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
IDENTIFIER_POINTER (class_name));
return 1;
tree list;
*where_found = decl;
- check_pkg_class_access (DECL_NAME (decl), qual_wfl, true);
+ check_pkg_class_access (DECL_NAME (decl), qual_wfl, true, NULL);
/* We want to be absolutely sure that the class is laid
out. We're going to search something inside it. */
return 1;
}
- check_pkg_class_access (DECL_NAME (decl), qual_wfl, true);
+ check_pkg_class_access (DECL_NAME (decl), qual_wfl, true, NULL);
check_deprecation (qual_wfl, decl);