JDK-4834738 NullPointerException: Better info

Fedor Bobin fuudtorrentsru at gmail.com
Sat Apr 26 12:45:05 UTC 2014


func((Integer) null)
expanded by javac to
func(((Integer) null).intValue())

So message will be "can not invoke method java.lang.Integer.intValue()I on
null object"
26.04.2014 12:10 пользователь "Milan Mimica" <milan.mimica at infobip.com>
написал:

> Milan Mimica, Software Engineer / Team Leader
>
> Milan Mimica, Software Engineer / Team Leader
>
> On 04/15/2014 09:16 AM, Fedor Bobin wrote:
>
>  java.lang.NullPointerException: can not invoke method
>> java.lang.String.length()I on null object
>>          at Test.testNPE(Test.java:14)
>>          at Test.main(Test.java:8)
>>
>> This additional information can help to understand cause of NPE in case of
>> call chains. For example, let we have java code
>>
>
> What does it say in this situation?
>
> static void func(int i) {...}
>
> {
>     func((Integer) null);
> }
>
>


More information about the hotspot-dev mailing list