[gcjx] Patch: FYI: field annotations fix

Tom Tromey tromey@redhat.com
Fri Dec 2 16:54:00 GMT 2005


I'm checking this in on the gcjx branch.

We were pushing a warning scope in the field resolution code before
field annotations had been resolved.  This fixes the problem by moving
the code into the model_variable_decl resolver instead.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* model/field.cc (resolve_classes): Don't push warning scope.
	* model/variable.cc (resolve_classes): Resolve annotations
	first.  Push warning scope.
	(resolve): Likewise.

Index: model/field.cc
===================================================================
--- model/field.cc	(revision 107604)
+++ model/field.cc	(working copy)
@@ -82,7 +82,6 @@
   if (state < CLASSES)
     {
       state = CLASSES;
-      resolution_scope::push_warnings warn_holder (scope, this);
       model_variable_decl::resolve_classes (scope);
     }
 }
@@ -134,9 +133,11 @@
   if (state < RESOLVED)
     {
       state = RESOLVED;
-      resolution_scope::push_warnings warn_holder (scope, this);
       model_variable_decl::resolve (scope);
 
+      // Ideally this warning push would be done in
+      // model_variable_decl.
+      resolution_scope::push_warnings warn_holder (scope, this);
       if (scope->warn_bad_serialization_field ())
 	check_serialization_fields ();
     }
Index: model/variable.cc
===================================================================
--- model/variable.cc	(revision 107604)
+++ model/variable.cc	(working copy)
@@ -24,14 +24,16 @@
 void
 model_variable_decl::resolve_classes (resolution_scope *scope)
 {
+  resolve_annotation_classes (scope);
+  resolution_scope::push_warnings warn_holder (scope, this);
   decltype->resolve (scope);
-  resolve_annotation_classes (scope);
 }
 
 void
 model_variable_decl::resolve (resolution_scope *scope)
 {
   resolve_annotations (scope);
+  resolution_scope::push_warnings warn_holder (scope, this);
   decltype->resolve (scope);  // fixme redundant for fields...
   if (initializer)
     {



More information about the Java-patches mailing list