[External] : Re: Invalid jar in classpath aborts the compilation and throws an exception
Jaikiran Pai
jai.forums2013 at gmail.com
Tue Jun 21 05:56:43 UTC 2022
Hello Jon,
On 20/06/22 10:10 pm, Jonathan Gibbons wrote:
> I was not suggesting that javac should handle this issue in any
> special way. If it gives a coherent message and exits with an error
> code, that seems sufficient.
>
> What are you guessing that javac could do differently/better?
I misunderstood your previous reply. Thank you for your inputs.
-Jaikiran
>
> -- Jon
>
>
> On 6/20/22 8:18 AM, Jaikiran Pai wrote:
>> Hello Jon,
>>
>> In its current form, javac does exit with a non-zero exit code and
>> does report the root exception. However, based on what you say, I'm
>> guessing javac could be enhanced to do this specific error reporting
>> differently? Did I understand it right? If so, should I be creating a
>> JBS enhancement request for it?
>>
>> -Jaikiran
>>
>> On 20/06/22 5:44 am, Jonathan Gibbons wrote:
>>> At a minimum, javac should report an error that it cannot open the
>>> file, and not simply ignore it. I think an error is warranted over a
>>> warning, because the compilation cannot determine if it has been
>>> adversely affected by the bad jar file. Eventually, I would expect
>>> the error to cause javac to exit with a non-zero exit code. Once an
>>> error has been reported, javac may continue "for a while" but will
>>> give up at the next point that it checks the error status.
>>>
>>> -- Jon
>>>
>>> On 6/18/22 1:44 AM, Jaikiran Pai wrote:
>>>> An user of Ant has reported an issue where their project's build
>>>> fails during compilation. The failure appears to be a result of a
>>>> jar (in the classpath) having entries that the Java's
>>>> java.util.zip/jar code doesn't allow. The issue reported in Ant is
>>>> here
>>>> https://urldefense.com/v3/__https://bz.apache.org/bugzilla/show_bug.cgi?id=66110__;!!ACWV5N9M2RV99hQ!ICdtR3KvThiV0w3XCZPTzhhkC6Ki7ZHkeCP5wxQZWNO1mDbFBFu9oHwKY_PgoPaEriHC1-AkQp8x_ylu23tXHUhcylFm9Q$
>>>> .
>>>>
>>>> In cases like these, should the javac tool just ignore such jar
>>>> files and continue with the compilation? At least for this specific
>>>> issue that jar which is failing doesn't contribute any
>>>> classes/resources for the compilation to succeed.
>>>>
>>>> The specific exception that gets thrown comes from the
>>>> ArchiveContainer which then propagates and ultimately results in a
>>>> compilation error which looks like:
>>>>
>>>>
>>>> /foo/src/com/abc/Bz66110.java:1: error: cannot access com.abc
>>>> package com.abc;
>>>> ^
>>>> ZipException opening "bz66110badJar.jar": ZIP file can't be opened
>>>> as a file system because entry "/." has a '.' or '..' element in
>>>> its name
>>>> 1 error
>>>>
>>>>
>>>> -Jaikiran
>>>>
More information about the compiler-dev
mailing list