Skip to content

[ji] support re-reifying class hierarchy#8140

Merged
enebo merged 3 commits intojruby:masterfrom
kares:fix-java_sub_class_re-reify
Apr 29, 2024
Merged

[ji] support re-reifying class hierarchy#8140
enebo merged 3 commits intojruby:masterfrom
kares:fix-java_sub_class_re-reify

Conversation

@kares
Copy link
Member

@kares kares commented Mar 5, 2024

a quick attempt to support partial removing of a reified class hierarchy... (#8141)

if this seems fishy I am okay to drop and leave this use-case as not supported


if (classLoader.hasDefinedClass(javaName)) { // class removed after being reified but parent got kept around
// while this seems like a leak the parent Java class might be GCable just hasn't been collected, yet
classLoader = new OneShotClassLoader((OneShotClassLoader) classLoader);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this extra wrapping (which under normal condition won't happen) is the fix,
not super happy about it but I wonder if there are any concerns?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively we could append some suffix (counter) to the class-name but having the same name seemed nice.

this also reminds me that using rubyobj. package prefix with modularization might not be "ideal".

if we would to consider having some kind of package prefix than we might want to leverage org.jruby.gen:

  • "org.jruby.gen.reified_#{ruby_class.id}.SubList"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternative proposal: #8147

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternative alternative proposal: #8185

@kares kares linked an issue Mar 5, 2024 that may be closed by this pull request
@kares kares marked this pull request as ready for review March 5, 2024 14:21
@kares kares marked this pull request as draft April 2, 2024 12:39
@enebo enebo merged commit e3aacb5 into jruby:master Apr 29, 2024
@enebo enebo added this to the JRuby 9.4.8.0 milestone Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can not re-reify sub-class of a Java sub-class

2 participants