[gcjx] Patch: FYI: fix type for Foo.class
Tom Tromey
tromey@redhat.com
Fri Oct 28 20:09:00 GMT 2005
I'm checking this in on the gcjx branch.
In 1.5, 'Foo.class' has type Class<Foo>. This patch implements this.
It also changes the default source language to 1.4, as now enabling
generics requires a genericized class library.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* compiler.cc (compiler): Default to 1.4 language.
* model/classref.cc (resolve): Use correct type for generic
class.
Index: compiler.cc
===================================================================
--- compiler.cc (revision 105944)
+++ compiler.cc (working copy)
@@ -132,14 +132,15 @@
warnings_are_errors (false),
dump_methods (false),
dump_tree (false),
+ // Default to 1.4 source language.
feature_assert (true),
- feature_enum (true),
- feature_static_import (true),
- feature_enhanced_for (true),
- feature_generics (true),
- feature_boxing_conversion (true),
- feature_varargs (true),
- feature_annotations (true),
+ feature_enum (false),
+ feature_static_import (false),
+ feature_enhanced_for (false),
+ feature_generics (false),
+ feature_boxing_conversion (false),
+ feature_varargs (false),
+ feature_annotations (false),
target_assert (true),
target_debug (false),
target_15 (false),
Index: model/classref.cc
===================================================================
--- model/classref.cc (revision 105944)
+++ model/classref.cc (working copy)
@@ -1,6 +1,6 @@
// Class references.
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -43,7 +43,20 @@
scope->get_current_class ()->add_class_members ();
}
- set_type (global->get_compiler ()->java_lang_Class ());
+ model_class *dest = global->get_compiler ()->java_lang_Class ();
+ if (global->get_compiler ()->feature_generics ())
+ {
+ model_type *boxed = boxing_conversion (klass->type ());
+ model_class *boxed_class = assert_cast<model_class *> (boxed);
+
+ std::list<model_class *> args;
+ args.push_back (boxed_class);
+ // FIXME: if Class is not parameterized, issue an error about
+ // the class library.
+ dest = dest->create_instance (this, args);
+ }
+
+ set_type (dest);
}
void
More information about the Java-patches
mailing list