Fix cache-constructed-proxies #3602

Merged
merged 1 commit into from Jan 19, 2016

Conversation

Projects
None yet
3 participants
@smellsblue
Contributor

smellsblue commented Jan 18, 2016

Replicate the logic from org.jruby.javasupport.Java which determines whether an object should be cached.

I added some specs to ensure the caching is properly honored. If I comment out the new conditional, you can see that one of the new specs will correctly fail:

$ jruby -S rspec spec/java_integration/object/singleton_spec.rb spec/java_integration/types/wrapping_spec.rb
......F........

Failures:

  1) A Java method returning/receiving uncoercible Java types with persistence off doesn't cache the proxy when directly constructed
     Failure/Error: expect(object_proxy_cache.get(object)).to be_nil

       expected: nil
            got: #<Java::JavaLang::Object:0x38c6f217>
     # ./spec/java_integration/types/wrapping_spec.rb:74:in `block in (root)'

Finished in 0.103 seconds (files took 0.916 seconds to load)
15 examples, 1 failure

Failed examples:

rspec ./spec/java_integration/types/wrapping_spec.rb:72 # A Java method returning/receiving uncoercible Java types with persistence off doesn't cache the proxy when directly constructed

I wasn't sure if this was the right place to put these new specs, but it seemed like the most appropriate to me. Please let me know if I should move them.

@kares

This comment has been minimized.

Show comment
Hide comment
@kares

kares Jan 19, 2016

Member

👏 job Mike, thanks // cc @headius this should be the left-over from #3581

Member

kares commented Jan 19, 2016

👏 job Mike, thanks // cc @headius this should be the left-over from #3581

headius added a commit that referenced this pull request Jan 19, 2016

@headius headius merged commit 8e8485a into jruby:master Jan 19, 2016

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jan 19, 2016

Member

Looks good, thank you for your work on this!

Member

headius commented Jan 19, 2016

Looks good, thank you for your work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment