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

Fix issues discovered using Error Prone #4860

Merged
merged 1 commit into from Dec 5, 2017

Conversation

Projects
None yet
4 participants
@nglorioso
Contributor

nglorioso commented Nov 21, 2017

Hello!

As part of the investigation that led to #4844, I integrated Error Prone (http://errorprone.info) into the JRuby compiler. (See configuration in nglorioso@ae3a5cb).

This found a number of bugs (ranging in severity/nagginess). I'm happy to revert or change any of these, but all of them represent real defects:

RubyEnumerable - each_with_index19 is trivially infinitely-recursive. I assumed that each_with_index is appropriate
StructLayout/SymbolProc - hashCode() ends up RSHIFT'ing an int value by 32 bits, which always ends up resulting in 0. I changed to 16 bits, but if you needed a stable hash code, I can change to XOR 0
RipperContext/FullInterpreterContext - Array.toString() is unhelpful for error messages. Manually unrolled them with Arrays.toString.
RealClassGenerator - an exception was created and thrown on the floor in an exceptional condition. I threw it instead.
Pack - ulMask was an int constant left shifted by 56, but since it was an int, it shifts out to 0 instead of 0xfe000000.
SelectExecutor - Here, I don't have enough context to make the right changes, but the errorKeyList.contains() calls will never return true, since the file descriptor objects can't be contained in errorKeyList

@kares

This comment has been minimized.

Show comment
Hide comment
@kares

kares Nov 21, 2017

Member

these are looking really good ... @headius let's have these for 9.1.15 shall we?
have tried find bugs + IDEA's analysis previously but the amount was just too much to find such real gems.

Member

kares commented Nov 21, 2017

these are looking really good ... @headius let's have these for 9.1.15 shall we?
have tried find bugs + IDEA's analysis previously but the amount was just too much to find such real gems.

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Nov 21, 2017

Member

The ripper suggestion is wrong even though it did point out there was a bug there. These all look good except that one. That one should be something like:

StringBuilder buf = new StringBuilder();
buf.append((char) end);

@nglorioso change to that or omit that change otherwise I think it all looks good to me. Although I surprising bad at bit math stuff so the StructLayout change would be nice if someone else said that is ok.

Member

enebo commented Nov 21, 2017

The ripper suggestion is wrong even though it did point out there was a bug there. These all look good except that one. That one should be something like:

StringBuilder buf = new StringBuilder();
buf.append((char) end);

@nglorioso change to that or omit that change otherwise I think it all looks good to me. Although I surprising bad at bit math stuff so the StructLayout change would be nice if someone else said that is ok.

@headius

About half reasonable changes, half unnecessary or incorrect.

@headius

Might as well squash all these into one commit, but it looks good to me.

@headius

Few more tweaks and we can merge.

@nglorioso

This comment has been minimized.

Show comment
Hide comment
@nglorioso

nglorioso Dec 1, 2017

Contributor

Thanks! Extraneous things removed, should be good to merge (assuming no other CI failures)

Contributor

nglorioso commented Dec 1, 2017

Thanks! Extraneous things removed, should be good to merge (assuming no other CI failures)

@headius headius merged commit 0e959fe into jruby:master Dec 5, 2017

1 check failed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Dec 5, 2017

Member

Thanks for your patience and help!

Member

headius commented Dec 5, 2017

Thanks for your patience and help!

@nglorioso nglorioso deleted the nglorioso:bugfixes branch Dec 5, 2017

@nglorioso

This comment has been minimized.

Show comment
Hide comment
@nglorioso

nglorioso Dec 5, 2017

Contributor

Thank you! Glad to help improve things :)

Contributor

nglorioso commented Dec 5, 2017

Thank you! Glad to help improve things :)

@enebo enebo added this to the JRuby 9.1.15.0 milestone Dec 7, 2017

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