sergioadevita / jarjar

Automatically exported from code.google.com/p/jarjar
0 stars 0 forks source link

Can't use "-" in patterns #38

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
...even though it's legal to have package names with it.

Original issue reported on code.google.com by tal.liron on 15 Feb 2010 at 9:13

GoogleCodeExporter commented 8 years ago
Here's a fix, in com.tonicsystems.jarjar.Wildcard:

    private static boolean checkIdentifierChars(String expr, String extra) {
        for (int i = 0, len = expr.length(); i < len; i++) {
            char c = expr.charAt(i);
            if (extra.indexOf(c) >= 0)
                continue;
            if (c == '-')
                continue;
            if (!Character.isJavaIdentifierPart(c))
                return false;
        }
        return true;
    }

Now, I know a "-" isn't legal generally in Java, but there are definitely JNI
packages (notably JNI) that use this. So it goes.

This fix was necessary for the Jython project, which uses JarJar.

Original comment by tal.liron on 15 Feb 2010 at 10:01