Re: Hyphen in bigloo modules with Java backend?
Joseph Donaldson <[email protected]> Sun, 14 Feb 2021 19:11:19 +0000 (UTC)
| Newsgroups | gmane.lisp.scheme.bigloo |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I spent some time this weekend looking at possible solutions for the invalid class name issues we have been seeing. I have a branch that attempts to address the problem. It can be found at https://github.com/donaldsonjw/bigloo-1/tree/class_file_name_fixes. It makes 3 minor changes to the bigloo compiler and the jfile tool.
1. jfile was modified to produce mangled qualified types when the
source file name contains identifiers not supported by the
JLS. Note, we are currently only doing the mangling for the base
name sans extension and not all directory components.
2. The jvm backend was modified to honor the qualified type names
provided by jfile. Before this, the resulting class file was always
the base name of the source file with a .class extension.
3. When no jfile information is provided, we mangle the auto-produced
qualified name, if needed.
The changes above provide the following behavior. Assuming a source
file name test-case.scm containing a module named test-name with a
-pbase of bigloo.test, jfile will produces the .jfile below
((test-case "bigloo.test.BgL_testzd2casezd2"))
and the class file will be bigloo/test/BgL_testzd2casezd2.class.
For the same example src file when no .jfile is provided, the jvm backend will generate
a class file named BgL_testzd2casezd2.class
If people get a chance, let me know how this works for them.
Thank You,Joseph Donaldson
On Thursday, February 11, 2021, 11:38:56 PM PST, Sven Hartrumpf <[email protected]> wrote:
Hello Joseph.
You wrote, 2021-02-12 01:27:
> I am seeing the same issue as you with newer versions of Java.
> Although not
> ideal, if you had not already noted it, the contents of the modules do not
> need to change only the file name. For example, I have a module named
> sorted-bag in file name sorted-bag.scm. To accommodate the stricter Java
> identifier constraints in newer Java versions,
Thanks.
It seems that - with a recent security update - thes stricter identifier
constraints were back-ported to Java 8 :-(
> I only needed to change the filename to
> sorted_bag.scm; the contents did not need to change at all. For my
> projects, this file renaming was relatively easy to do.
Yes, this worked for me too, but a name mangler in bigloo would be cool.
Ciao
Sven
> Best Regards,
> Joe
>
> On Wednesday, February 10, 2021, 10:08:27 AM PST, <[email protected]>
> wrote:
>
> Hi Sven,
>
>> Normally, I use the C backend, but for some legacy application I need
>> the Java backend. With newer versions of Java (e.g. 11.0.10), I cannot run
>> my stable
>> code anymore, probably because the hyphen in class names is now a hard
>> error:
>>
>> Exception in thread "main" java.lang.ClassFormatError: Illegal class name
>> "Tool/srfi-xyz" in class file Tool/general
>>
>> Can bigloo help here?
>> Or do I really have to rename all my bigloo modules that contain a hyphen
>> (-)?
> I'm not sure I will be able to help here. I have face similar problems at
> one point but I cannot remember what I did to solve them and checking the
> git log is not of much help.
>
> --
> Manuel
>
> ps: I'm too busy these days so I'm not able to fix the few remaining
> problems that prevent the release of 4.4b. All these problems are about
> some Java tests that do not pass yet (or that do not pass anymore). As
> soon as I find the time to fix that, the version is released.