Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » "enable syntactic null analysis for fields" broken with eclise 4.4rc1 jdk1.8
"enable syntactic null analysis for fields" broken with eclise 4.4rc1 jdk1.8 [message #1378592] Sat, 24 May 2014 09:50 Go to next message
Eclipse UserFriend
With "enable syntactic null analysis for fields" enabled, the "a.toString();" compiles ok in java1.7 compliance, but give a warning/error with java1.8


import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;

public class Test3 {
@Nullable Integer a;

@NonNull
Integer get() {
return new Integer(1);
}

void test() {
a = get();
a.toString();
}
}
Re: "enable syntactic null analysis for fields" broken with eclise 4.4rc1 jdk1.8 [message #1379024 is a reply to message #1378592] Sat, 24 May 2014 14:14 Go to previous messageGo to next message
Eclipse UserFriend
Works for me - but sometimes the null analysis warnings/errors start to
show up arbitarily :-(

I also think that generally speaking this code is haveing the risk of
NPEs if it is used in a multi-threaded env.

Tom

On 24.05.14 11:50, Nicola Zanaga wrote:
> With "enable syntactic null analysis for fields" enabled, the
> "a.toString();" compiles ok in java1.7 compliance, but give a
> warning/error with java1.8
>
>
> import org.eclipse.jdt.annotation.NonNull;
> import org.eclipse.jdt.annotation.Nullable;
>
> public class Test3 {
> @Nullable Integer a;
>
> @NonNull
> Integer get() {
> return new Integer(1);
> }
> void test() {
> a = get();
> a.toString();
> }
> }
Re: "enable syntactic null analysis for fields" broken with eclise 4.4rc1 jdk1.8 [message #1379149 is a reply to message #1379024] Sat, 24 May 2014 15:29 Go to previous messageGo to next message
Eclipse UserFriend
With eclipse 4.4rc2 the warning still exists, are you sure using "compiler compliance level" 1.8 ? When using java 1.8 but with compliance 1.8, all works fine.

The option "enable syntactic null analysis for fields" is explained at
http://wiki.eclipse.org/JDT_Core/Null_Analysis/Beta

and it's supposed to eliminate this warning



Thomas Schindl wrote on Sat, 24 May 2014 10:14
Works for me - but sometimes the null analysis warnings/errors start to
show up arbitarily Sad

I also think that generally speaking this code is haveing the risk of
NPEs if it is used in a multi-threaded env.

Tom

On 24.05.14 11:50, Nicola Zanaga wrote:
> With "enable syntactic null analysis for fields" enabled, the
> "a.toString();" compiles ok in java1.7 compliance, but give a
> warning/error with java1.8
>
>
> import org.eclipse.jdt.annotation.NonNull;
> import org.eclipse.jdt.annotation.Nullable;
>
> public class Test3 {
> @Nullable Integer a;
>
> @NonNull
> Integer get() {
> return new Integer(1);
> }
> void test() {
> a = get();
> a.toString();
> }
> }

Re: "enable syntactic null analysis for fields" broken with eclise 4.4rc1 jdk1.8 [message #1382013 is a reply to message #1379149] Sun, 25 May 2014 20:54 Go to previous message
Eclipse UserFriend
solved: using the old org.elicpse.jdt.annotation give the problem
Previous Topic:null type mismatch with eclipse 4.4rc1 and java 1.8
Next Topic:the annotaion @NonNull is disallowed for this location
Goto Forum:
  


Current Time: Wed Feb 12 20:07:08 GMT 2025

Powered by FUDForum. Page generated in 0.03377 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top