summaryrefslogtreecommitdiff
path: root/gcc/java/parse.y
diff options
context:
space:
mode:
authorapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-05 22:33:44 +0000
committerapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-05 22:33:44 +0000
commit66ffb2a46d47373244437682ce4990b9370959d4 (patch)
treec27ae8ff81e650632f11ca9a8fc6aa5dade53668 /gcc/java/parse.y
parent2a9237aa1f2a73f449c3087bb9c83534c2bde105 (diff)
downloadgcc-66ffb2a46d47373244437682ce4990b9370959d4.tar.gz
2001-07-03 Alexandre Petit-Bianco <apbianco@redhat.com>
* parse.y (resolve_expression_name): Improved error message for inner class cases. Fixes PR java/1958 2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com> * jcf-parse.c (gcc_mark_jcf): Test for a finished JCF. * jcf.h (typedef struct JCF): New bitfield `finished.' (JCF_FINISH): Set `finished.' (JCF_ZERO): Reset `finished.' Fixes PR java/2633 2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com> * parse.y (class_body_declaration:): Don't install empty instance initializers. Fixes PR java/1314 (http://gcc.gnu.org/ml/gcc-patches/2001-07/msg00321.html ) git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r--gcc/java/parse.y18
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index ac062ad1cbb..e4e682b453b 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -924,8 +924,11 @@ class_body_declaration:
| constructor_declaration
| block /* Added, JDK1.1, instance initializer */
{
- TREE_CHAIN ($1) = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
- SET_CPC_INSTANCE_INITIALIZER_STMT (ctxp, $1);
+ if ($1 != empty_stmt_node)
+ {
+ TREE_CHAIN ($1) = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
+ SET_CPC_INSTANCE_INITIALIZER_STMT (ctxp, $1);
+ }
}
;
@@ -8952,8 +8955,15 @@ resolve_expression_name (id, orig)
}
/* We've got an error here */
- parse_error_context (id, "Undefined variable `%s'",
- IDENTIFIER_POINTER (name));
+ if (INNER_CLASS_TYPE_P (current_class))
+ parse_error_context (id,
+ "Local variable `%s' can't be accessed from within the inner class `%s' unless it is declared final",
+ IDENTIFIER_POINTER (name),
+ IDENTIFIER_POINTER (DECL_NAME
+ (TYPE_NAME (current_class))));
+ else
+ parse_error_context (id, "Undefined variable `%s'",
+ IDENTIFIER_POINTER (name));
return error_mark_node;
}