Skip to content

Commit c2b0a99

Browse files
committed
Add tests of unicode character support in Java class file names
Add regression tests for unicode class and method names. Fixes: #628
1 parent 4fe3ade commit c2b0a99

File tree

11 files changed

+74
-0
lines changed

11 files changed

+74
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
ЮЛ
3+
--
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
Test that .class suffix is properly stripped for Unicode class names
574 Bytes
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class ЮЛ
2+
{
3+
static void f()
4+
{
5+
assert false;
6+
}
7+
8+
public static void main(String[] args)
9+
{
10+
ЮЛ.f();
11+
}
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
ЮЛ
3+
--
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
Test Unicode characters in Java class names
592 Bytes
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class ЮЛ
2+
{
3+
void f()
4+
{
5+
assert false;
6+
}
7+
8+
public static void main(String[] args)
9+
{
10+
ЮЛ obj = new ЮЛ();
11+
obj.f();
12+
}
13+
}
589 Bytes
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class f
2+
{
3+
void ЮЛ()
4+
{
5+
assert false;
6+
}
7+
8+
public static void main(String[] args)
9+
{
10+
f obj = new f();
11+
obj.ЮЛ();
12+
}
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
f
3+
--
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
Test Unicode characters in Java method names (should already work)

jbmc/src/janalyzer/janalyzer_parse_options.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Author: Daniel Kroening, [email protected]
1515
#include <util/exit_codes.h>
1616
#include <util/help_formatter.h>
1717
#include <util/options.h>
18+
#include <util/suffix.h>
1819
#include <util/version.h>
1920

2021
#include <goto-programs/goto_check.h>
@@ -355,6 +356,11 @@ int janalyzer_parse_optionst::doit()
355356
if((cmdline.args.size() == 1) && !cmdline.isset("show-parse-tree"))
356357
{
357358
std::string main_class = cmdline.args[0];
359+
360+
// Strip .class suffix if present (to support filenames like "ClassName.class")
361+
if(has_suffix(main_class, ".class"))
362+
main_class.resize(main_class.size() - 6);
363+
358364
// `java` accepts slashes and dots as package separators
359365
std::replace(main_class.begin(), main_class.end(), '/', '.');
360366
config.java.main_class = main_class;

0 commit comments

Comments
 (0)