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 17:21:39 UTC 2017
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"
Thanks,
Vicente
On 02/15/2017 12:12 PM, Alan Bateman wrote:
> On 15/02/2017 17:03, Vicente Romero wrote:
>
>> Hi,
>>
>> Please review the fix for bug [1]. The fix is improving an already
>> existing error message. The public patch can be reached at [2]
>>
>> Thanks,
>> Vicente
>>
>> [1] https://bugs.openjdk.java.net/browse/JDK-8174694
>> [2] http://cr.openjdk.java.net/~vromero/8174694/webrev.00/jdk.patch
> Can you provide one or two examples to see the difference? I ask
> because it looks like "was not found" is changed to "is not defined"
> which looks a bit odd.
>
> -Alan
More information about the core-libs-dev
mailing list