issue deriving automatic module name

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

issue deriving automatic module name

Paul Bakker
Hi,

I ran into an issue testing some migration scenarios. When using jboss-transaction-api_1.2_spec-1.0.1.Final.jar as an automatic module, startup fails with:

Caused by: java.lang.IllegalArgumentException: jboss.transaction.api.1.2.spec: Invalid module name: '1' is not a Java identifier

This is clearly a strange JAR name, and can be fixed by providing a module name, but it should probably not prevent startup.

Best,

Paul
Reply | Threaded
Open this post in threaded view
|

Re: issue deriving automatic module name

forax
Hi Paul,
the whole idea of jigsaw is that if you pass the startup check of the module graph, there will be not surprise anymore,
so preventing the VM to boot is by design.

Here, you will not be able to reference the jar in another module-info so there is no point to start with a wrong configuration.

Rémi

----- Mail original -----
> De: "Paul Bakker" <[hidden email]>
> À: "jigsaw-dev" <[hidden email]>
> Envoyé: Mercredi 4 Octobre 2017 02:44:01
> Objet: issue deriving automatic module name

> Hi,
>
> I ran into an issue testing some migration scenarios. When using
> jboss-transaction-api_1.2_spec-1.0.1.Final.jar as an automatic module, startup
> fails with:
>
> Caused by: java.lang.IllegalArgumentException: jboss.transaction.api.1.2.spec:
> Invalid module name: '1' is not a Java identifier
>
> This is clearly a strange JAR name, and can be fixed by providing a module name,
> but it should probably not prevent startup.
>
> Best,
>
> Paul
Reply | Threaded
Open this post in threaded view
|

Re: issue deriving automatic module name

Alan Bateman
In reply to this post by Paul Bakker
On 03/10/2017 17:44, Paul Bakker wrote:
> Hi,
>
> I ran into an issue testing some migration scenarios. When using jboss-transaction-api_1.2_spec-1.0.1.Final.jar as an automatic module, startup fails with:
>
> Caused by: java.lang.IllegalArgumentException: jboss.transaction.api.1.2.spec: Invalid module name: '1' is not a Java identifier
>
> This is clearly a strange JAR name, and can be fixed by providing a module name, but it should probably not prevent startup.
>
I assume you've put this JAR file on the module path because some code
in an automatic module has references to classes in this JAR file. So
catching this at startup seem right, you will otherwise risk a failure
at runtime (NoClassDefFoundError) if the module system were to ignore
the oddly named JAR file.

As an aside, the contents of this JAR file are also problematic because
it contains classes from the java.transaction and java.sql modules. This
is something that we hope the owners of the Java Transaction API JSR
will resolve soon, maybe by splitting the spec into two so that Java SE
can define a java.transaction.xa module (in conjunction with jettisoning
the java.transaction module from Java SE and the JDK).

-Alan
Reply | Threaded
Open this post in threaded view
|

Re: issue deriving automatic module name

Paul Bakker
My point is that the module name resolver that generates a module name from the file name should not choke on this file pattern. Failing at startup if there is a problem is of course the right thing to do.

Yes, this jar has indeed another problem. I only ran into these problems testing some of my existing migration demos in IntelliJ, which puts all jars on the module path for a modular application. I’m going to open an issue with them for better control over this. Putting the jar on the CP is fine in this scenario, it is only a transitive dependency of another automatic module (Hibernate).

Paul

> On Oct 4, 2017, at 6:07 AM, Alan Bateman <[hidden email]> wrote:
>
>> On 03/10/2017 17:44, Paul Bakker wrote:
>> Hi,
>>
>> I ran into an issue testing some migration scenarios. When using jboss-transaction-api_1.2_spec-1.0.1.Final.jar as an automatic module, startup fails with:
>>
>> Caused by: java.lang.IllegalArgumentException: jboss.transaction.api.1.2.spec: Invalid module name: '1' is not a Java identifier
>>
>> This is clearly a strange JAR name, and can be fixed by providing a module name, but it should probably not prevent startup.
>>
> I assume you've put this JAR file on the module path because some code in an automatic module has references to classes in this JAR file. So catching this at startup seem right, you will otherwise risk a failure at runtime (NoClassDefFoundError) if the module system were to ignore the oddly named JAR file.
>
> As an aside, the contents of this JAR file are also problematic because it contains classes from the java.transaction and java.sql modules. This is something that we hope the owners of the Java Transaction API JSR will resolve soon, maybe by splitting the spec into two so that Java SE can define a java.transaction.xa module (in conjunction with jettisoning the java.transaction module from Java SE and the JDK).
>
> -Alan