3

My import statements contain
import javax.annotation.ParametersAreNonnullByDefault;

But it fails, saying 'cannot find symbol...'

I'm using Netbeans 8.0.2, and my project uses Source format JDK8, Java platform 1.8.0.60

Typing 'javax.annotation.' doesn't show the ParametersAreNonnullByDefault in the autocompletion popup.

i'm trying to build sources from this project in Netbeans: https://github.com/fge/java7-fs-more

What should i do to make the import statement work?

Houtman
  • 2,819
  • 2
  • 24
  • 34
  • did this help? http://stackoverflow.com/questions/5516157/how-do-i-get-parametersarenonnullbydefault-to-work – Ash Oct 18 '16 at 11:36
  • I got the project-files from Github. But i never used that nor Maven. Could it have to do with Maven-build settings? I just created a simple Netbeans project-with-existing-sources – Houtman Oct 18 '16 at 11:38
  • It could have to do with the fact, that there is no `javax.annotation.ParametersAreNonnullByDefault` type in the standard API. You don’t need to use a build tool, but you have to download the required projects. – Holger Oct 18 '16 at 12:01
  • That's what i also think, but who would mix their code with the Oracle path "javax.annotation"? i thought code from Jars with different security-signatures are not allowed on the same package. – Houtman Oct 18 '16 at 12:17
  • They wouldn’t be considered the same package at runtime, but for compile-time code quality annotations, that hardly ever matters… – Holger Oct 18 '16 at 16:28
  • @Houtman you're rightly puzzled. That annotation type pretends to be "official" API where in fact it is not. It's the result of a JSR that never really took off. – Stephan Herrmann Oct 19 '16 at 18:38

1 Answers1

2

You may be missing JSR305 dependency. Here's an example for build.gradle:

dependencies { compileOnly 'com.google.code.findbugs:jsr305:3.0.1' }

vic-nik
  • 131
  • 1
  • 6