Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] (no subject)

Thanks. That's good to know about. Unfortunately, we need to stay on
Juno (3.8) because of https://bugs.eclipse.org/414191.  The change in
null analysis for fields is currently preventing our team from moving
to new versions of Eclipse. But, this fix is one more reason to do the
move anyway.

On Fri, Nov 15, 2013 at 3:10 PM, Stephan Herrmann
<stephan.herrmann@xxxxxxxxx> wrote:
> Hi Andrew,
>
>
> On 11/15/2013 09:02 PM, Andrew Eisenberg wrote:
>>
>> I have a method that looks like this:
>>
>>    void foo(@Nullable String str) {
>>      Preconditions.checkNonNull(str); // throws exception if str is null
>>      str.charAt(0); // Warning: Potential null pointer access
>>    }
>>
>> Is there any way to have the null analysis engine avoid raising a
>> warning on the charAt method?  At runtime, str.charAt(0) will never
>> throw an NPE.
>
>
> Is "Preconditions" in fact "com.google.common.base.Preconditions"?
> If so, https://bugs.eclipse.org/382069 should've taken care of this.
> (Which went into Kepler R).
>
>
>
>> Note that for various reasons, we must have @Nullable on the str
>> parameter and we would like to avoid @SuppressWarnings in the method
>> since this would preclude any null analysis in the method.
>>
>> There is an option "include 'assert' in null analysis". I wonder if
>> this can help at all.  Is this a limitation of null analysis, or is
>> there something I can do to address this?
>
>
> No, that option only affects the 'assert' keyword, not the
> assert utilities handled by bug 382069.
>
> HTH,
> Stephan
>


Back to the top