I want to compile simple code with oracle jdk 1.8:
class Foo {
public static void test(@NotNull String a) {}
}
But idea
not understand such code, and suggest to add:
import com.sun.istack.internal.NotNull;
after that compilation inside idea
works,
but if run build by gradle
with such build.gradle
:
version '1.0-snaphshot_03.03.2017'
apply plugin: 'java'
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}
artifacts {
archives sourcesJar
}
I got error:
error: package com.sun.istack.internal does not exist
import com.sun.istack.internal.NotNull;
error: cannot find symbol
public static void test(@NotNull String a) {
^
symbol: class NotNull
location: class Foo
I thought that NotNull
was added in 1.8
?
How can I make possible of usage of NotNull
in idea
and gradle
?