Review Request: JDK-8174694: improve error message shown when main class can't be loaded
Vicente Romero
vicente.romero at oracle.com
Wed Feb 15 21:14:52 UTC 2017
On 02/15/2017 04:12 PM, Kumar Srinivasan wrote:
> Hi Vicente,
>
> Looks good.
>
> Mucho gracias for fixing this!.
thanks!
>
> Kumar
Vicente
>
>> Hi,
>>
>> Thanks guys for your comments. I have uploaded another iteration of
>> the review at [1],
>>
>> Vicente
>>
>> [1] http://cr.openjdk.java.net/~vromero/8174694/webrev.01/jdk.patch
>>
>> On 02/15/2017 02:06 PM, Kumar Srinivasan wrote:
>>>
>>> On 2/15/2017 10:39 AM, Alan Bateman wrote:
>>>> On 15/02/2017 17:21, Vicente Romero wrote:
>>>>
>>>>> The simplest reproductor for this issue is:
>>>>>
>>>>> ------------------------------------------------------------------------------------------------
>>>>>
>>>>> public class A extends B {
>>>>> public static void main(String... args) {}
>>>>> }
>>>>> ------------------------------------------------------------------------------------------------
>>>>>
>>>>> class B {}
>>>>> ------------------------------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> $javac -d out A.java B.java
>>>>> $rm out/B.class
>>>>>
>>>>> before this patch this command:
>>>>> $java -cp out A
>>>>>
>>>>> produces this output
>>>>> Error: Could not find or load main class A
>>>>>
>>>>> with the current patch, the output produced is:
>>>>> Error: Could not find or load main class A
>>>>> because class B is not defined.
>>>>>
>>>>> if while loading the main class ClassNotFoundException is produced
>>>>> then the second part of the message will be: "because class Foo is
>>>>> not defined."
>>>>> if NoClassDefFoundError is produced then it will be: "because
>>>>> class Foo is not defined"
>>>> It's good that "B" is shown in the output but "because class B is
>>>> not defined" looks very strange to me. Have you consider something
>>>> more useful like:
>>>>
>>>> Error: Could not find or load main class A
>>>> Caused by: java.lang.NoClassDefFoundError: B
>>>
>>> Yes this will also solve the translation issue thus we can go back to
>>> one property.
>>>
>>> Kumar
>>>
>>>>
>>>> -Alan
>>>>
>>>>
>>>
>>
>
More information about the core-libs-dev
mailing list