Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow inline classes to have abstract supers #24

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -6927,11 +6927,14 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
return;
}

// For a value class, only java/lang/Object is an acceptable super class
// For an inline class, only java/lang/Object or special abstract classes
// are acceptable super classes.
if (_access_flags.get_flags() & JVM_ACC_VALUE) {
guarantee_property(_super_klass->name() == vmSymbols::java_lang_Object(),
"Inline type must have java.lang.Object as superclass in class file %s",
CHECK);
if (_super_klass->name() != vmSymbols::java_lang_Object()) {
guarantee_property(_super_klass->is_abstract(),
"Inline type must have java.lang.Object or an abstract class as its superclass, class file %s",
CHECK);
}
}

// Make sure super class is not final
@@ -162,7 +162,7 @@ bool VerificationType::is_ref_assignable_from_value_type(const VerificationType&
return true;
}

// Need to load 'this' to see if it is an interface.
// Need to load 'this' to see if it is an interface or supertype.
InstanceKlass* klass = context->current_class();
{
HandleMark hm(THREAD);
@@ -173,7 +173,17 @@ bool VerificationType::is_ref_assignable_from_value_type(const VerificationType&
if (log_is_enabled(Debug, class, resolve)) {
Verifier::trace_class_resolution(this_class, klass);
}
return (this_class->is_interface());
if (this_class->is_interface()) {
return true;
} else {
Klass* from_class = SystemDictionary::resolve_or_fail(
from.name(), Handle(THREAD, klass->class_loader()),
Handle(THREAD, klass->protection_domain()), true, CHECK_false);
if (log_is_enabled(Debug, class, resolve)) {
Verifier::trace_class_resolution(from_class, klass);
}
return from_class->is_subclass_of(this_class);
}
}
}

@@ -60,7 +60,8 @@ public static void main(String[] args) throws Exception {
runTest("ValueMethodSynch",
"Method getInt in class ValueMethodSynch (an inline class) has illegal modifiers");

runTest("ValueSuperClass", "Inline type must have java.lang.Object as superclass");
runTest("ValueSuperClass",
"Inline type must have java.lang.Object or an abstract class as its superclass");

// Test that ClassCircularityError gets detected for instance fields.
System.out.println("Testing ClassCircularityError for instance fields");