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

Temporarily commented out 'character class has duplicated range' #34

Open
enebo opened this issue Feb 21, 2018 · 0 comments
Open

Temporarily commented out 'character class has duplicated range' #34

enebo opened this issue Feb 21, 2018 · 0 comments

Comments

@enebo
Copy link
Member

enebo commented Feb 21, 2018

In 2.1.14 we updated some data and this uncovered some issues with joni and JRuby interactions involving warnings. The main visible issue is some regexps are generating the warning:

character class has duplicated range

This warning is sometimes coming out from internal expansions (like \X). If an expansion is internally diplicating we definitely do not want end users to be warned. We actually fixed one case where we were making a regexp UTF-8 when it shouldn't have been, but we are still see some other missing cases.

Joni's design compounds this issue because some constructor paths use the DEFAULT WarnCallback which is literally a system.err.println() call. This means we cannot change anything in JRuby specifically to avoid this potentially being used since not all joni Regex code is from JRuby core. We also have native extension authors who might be calling a constructor using DEFAULT.

That probably was not a super clear description but the solution should be reasonably easy to follow:

  • uncomment warn for 'character class has duplicated range' (in ScanEnvironment)
  • Add ability to register a default WarnCallback handler
  • (on jruby side) use this new register API

Additional things to do:

  • (on jruby side) audit all regex constructors and figure out where our remaining duplicated class warnings are coming from
  • augment joni warning to provide the actual regexp which is generating the warning (MRI does print out the failing regexp). But warn(message, regexp) would be a great API for debugging issues like this so we should change joni to be like that.
enebo added a commit that referenced this issue Feb 21, 2018
…ges. Issue

#34 talks about what we will need to do to uncomment this code.
enebo added a commit that referenced this issue Feb 21, 2018
warnings more than is acceptable.  Warning will get re-enabled next release
when we fix #34 (warning itself is not very important so we do not anticipate
anyone noticing past this commit message :) ).
enebo added a commit that referenced this issue Feb 21, 2018
headius added a commit to jruby/jruby that referenced this issue Feb 28, 2018
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

No branches or pull requests

1 participant