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

Unicode Decoding in String/Char Literal Evaluation #113

Closed
wants to merge 27 commits into from
Closed

Unicode Decoding in String/Char Literal Evaluation #113

wants to merge 27 commits into from

Conversation

morris821028
Copy link

This patch is used to avoid the content of comment make it failed in parser. According to #112 , there is a solution which move the unicode decode part of readchar() into stringSetup and charSetup.

[email protected] and others added 27 commits October 20, 2011 18:59
Improve error message for method invocation on null.
2.2b0 -> 2.2.0
ScriptEngineFactory should not advertise support for java
* added old code (parse java source if existent and class file is not found) but with switch
* default is switched off
* switch on by 
** api call -> Interpreter.setCompatibility(true)
** system property -> -Dbsh.compatibility=true
…g a script without local member declaration
…to string, and can not be successfully retrieved by outer layers
corrected junit library version number in eclipse .classpath file

Fix provided by Andrea Curtoni
prevent obsolete calls to "j.l.reflect.AccessibleObject.setAccessible(true)"
@pejobo
Copy link
Owner

pejobo commented Apr 18, 2018

Thanks for making a pull request! This reminds me to add a "code of conduct", still on my buckt list :(

Two things before I proceed:

  1. The pull request should be for branch v2.1, not master
  2. I intend to change the licence to Apache-2, so please withdraw your pull request if you do not agree that your code is made available under this licence (see Licence change: LGPL to Apache-2 #110)

Another thing - do you know this repro: https://github.com/beanshell/beanshell?

public void parse_unicode_literals_in_comment() throws Exception {
final Interpreter interpreter = new Interpreter();
Object result = interpreter.eval("// source path: C:\\user\\desktop");
Assert.assertEquals(result, null);
Copy link
Owner

Choose a reason for hiding this comment

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

Test case one (dedicated method)

Object result = interpreter.eval("// source path: C:\\user\\desktop");
Assert.assertEquals(result, null);
char c = (char) interpreter.eval("return '\\u51ea\'");
Assert.assertEquals(c, '\u51ea');
Copy link
Owner

Choose a reason for hiding this comment

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

Test case two (dedicated method)

Assert.assertEquals(c, '\u51ea');
String s = (String) interpreter.eval("return \"\\u51EA1234\"; // \\user\\desktop");
System.out.println(s);
Assert.assertEquals(s, "\u51EA1234");
Copy link
Owner

Choose a reason for hiding this comment

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

Test case three (dedicated method)

@morris821028
Copy link
Author

Yeah, I know the repo https://github.com/beanshell/beanshell . Therefore, I also opened the issue about it. There are many enhancement in other repo than this one. But, this one has a large version number of release product. I don't know what this repo has, but anthoer don't. Our product uses 2.1.x version, so there is a problem to update.

Althrough @stain, @nickl- , etc. fixed some bugs in their repo, I prefer this repo to work with Eclipse IDE. It has more convenient to develop, experiment and build.

If all of you can decide how to merge into a repository, and create a complete environment for build flow and introduce what's kind of IDE you used, it will be more maintainers I think.

@morris821028
Copy link
Author

@morris821028 morris821028 changed the base branch from master to v2.1 April 19, 2018 11:22
@pejobo
Copy link
Owner

pejobo commented Apr 20, 2018

Superseded by #114

@pejobo pejobo closed this Apr 20, 2018
@nickl-
Copy link

nickl- commented Apr 21, 2018

@morris821028 pong!

Missed this thread but perhaps #110 is more appropriate for a response from me. @pejobo please see response there...

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.

None yet

4 participants