-
-
Notifications
You must be signed in to change notification settings - Fork 922
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
Java types should simply toString on inspect? #5182
Comments
At one point inspect also showed fields, by reflectively digging them out. Once we removed that, the inspect output is now largely useless other than showing what type the object is. Perhaps it should be something like |
that would make sense for me, but only doing that if there isn't a toString override (which is tricky). |
A simple way to do this is to just define java.lang.Object.inspect to call to_s, but that will do it for all Java objects, not just the ones that have overridden to_s. |
Ok, so I thought I could do a clever trick like this: class java::lang::Object
alias old_inspect inspect
def inspect
toString
end
def toString
old_inspect
end
end There's a couple snags though:
|
Actually ignore that first bullet; I don't think it matters. The main problem is that |
have an idea to play some 'ugly' tricks around and hook this up into the JavaProxy class, as I want it to play well with existing Java array inspect-ing while also providing a reflective default, we'll see how it goes ... |
Ok I'll let you play with it then. |
some progress - to make it somehow cleaner I would be reverting an old feature, where a proxy Java class does not get instance methods put in if its smt that exists in super hierarchy e.g. an |
this would be a resolution for weird non-readable rspec output ... with Java types - jrubyGH-5182
this would be a resolution for weird non-readable rspec output ... with Java types - GH-5182
this would be a resolution for weird non-readable rspec output ... with Java types - GH-5182
this would be a resolution for weird non-readable rspec output ... with Java types - GH-5182
JRuby will be shipping changed Java type inspect -> toString in 9.2.1 (#5219) |
this would be a resolution for weird non-readable rspec output ... with Java types - jrubyGH-5182
Java types
inspect
isn't as useful as for Ruby objects.When using Ruby tools it usually just shows the type but no real information, e.g.
its likely a breaking change -> so only to be done in a major version such as 9.2
The text was updated successfully, but these errors were encountered: