build annotations.jar for Java 8 which contains @NotNull/@Nullable annotations which can be applied to types (IDEA-123048)

This commit is contained in:
nik
2015-05-28 15:23:49 +03:00
parent aacfd78f3c
commit cd1b0f5f31
26 changed files with 147 additions and 13 deletions
+2
View File
@@ -31,6 +31,8 @@
</annotationProcessing>
<bytecodeTargetLevel target="1.6">
<module name="annotations" target="1.5" />
<module name="annotations-common" target="1.5" />
<module name="annotations-java8" target="1.8" />
<module name="community-tests" target="1.8" />
<module name="gradle-jps-plugin" target="1.6" />
<module name="groovy-rt-constants" target="1.5" />
+2
View File
@@ -20,6 +20,8 @@
<module fileurl="file://$PROJECT_DIR$/android/android/jps-plugin/android-jps-plugin.iml" filepath="$PROJECT_DIR$/android/android/jps-plugin/android-jps-plugin.iml" group="android" />
<module fileurl="file://$PROJECT_DIR$/android/android/rt/android-rt.iml" filepath="$PROJECT_DIR$/android/android/rt/android-rt.iml" group="android" />
<module fileurl="file://$PROJECT_DIR$/platform/annotations/annotations.iml" filepath="$PROJECT_DIR$/platform/annotations/annotations.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/annotations/common/annotations-common.iml" filepath="$PROJECT_DIR$/platform/annotations/common/annotations-common.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/platform/annotations/java8/annotations-java8.iml" filepath="$PROJECT_DIR$/platform/annotations/java8/annotations-java8.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/plugins/ant/ant.iml" filepath="$PROJECT_DIR$/plugins/ant/ant.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/ant/jps-plugin/ant-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/ant/jps-plugin/ant-jps-plugin.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/jps/antLayout/antlayout.iml" filepath="$PROJECT_DIR$/jps/antLayout/antlayout.iml" group="jps" />
+10 -1
View File
@@ -133,7 +133,14 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
openapiModules.each { module it}
}
jar("annotations.jar") { module("annotations")}
jar("annotations.jar") {
module("annotations-common")
module("annotations")
}
jar("annotations-java8.jar") {
module("annotations-common")
module("annotations-java8")
}
jar("jdkAnnotations.jar") {
fileset(dir: "${home}/java/jdkAnnotations")
}
@@ -752,6 +759,7 @@ def layoutJps(String home, String targetDir, String buildNumber, Closure additio
layout(targetDir) {
zip("standalone-jps-${buildNumber}.zip") {
jar("util.jar") {
module("annotations-common")
module("annotations")
module("util-rt")
module("util")
@@ -842,6 +850,7 @@ def layout_core(String home, String target) {
}
jar("annotations.jar") {
module("annotations-common")
module("annotations")
}
+3 -2
View File
@@ -4,9 +4,10 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/java5/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="annotations-common" exported="" />
</component>
</module>
</module>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
@@ -15,9 +15,10 @@
*/
package org.intellij.lang.annotations;
import org.jetbrains.annotations.NonNls;
import java.lang.annotation.*;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This annotation assists the 'Data flow to this' feature by describing data flow
@@ -60,8 +61,8 @@ public @interface Flow {
* </ul>
*/
String source() default org.intellij.lang.annotations.Flow.DEFAULT_SOURCE;
@NonNls String DEFAULT_SOURCE = "The method argument (if parameter was annotated) or this container (if instance method was annotated)";
@NonNls String THIS_SOURCE = "this";
String DEFAULT_SOURCE = "The method argument (if parameter was annotated) or this container (if instance method was annotated)";
String THIS_SOURCE = "this";
/**
* true if the data source is container and we should track not the expression but its contents.<br>
@@ -109,9 +110,9 @@ public @interface Flow {
* </ul>
*/
String target() default org.intellij.lang.annotations.Flow.DEFAULT_TARGET;
@NonNls String DEFAULT_TARGET = "This container (if the parameter was annotated) or the return value (if instance method was annotated)";
@NonNls String RETURN_METHOD_TARGET = "The return value of this method";
@NonNls String THIS_TARGET = "this";
String DEFAULT_TARGET = "This container (if the parameter was annotated) or the return value (if instance method was annotated)";
String RETURN_METHOD_TARGET = "The return value of this method";
String THIS_TARGET = "this";
/**
* true if the data target is container and we should track not the expression but its contents.<br>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="annotations-common" exported="" />
</component>
</module>
@@ -0,0 +1,46 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.annotations;
import java.lang.annotation.*;
/**
* An element annotated with NotNull claims <code>null</code> value is <em>forbidden</em>
* to return (for methods), pass to (parameters) and hold (local variables and fields).
* Apart from documentation purposes this annotation is intended to be used by static analysis tools
* to validate against probable runtime errors and element contract violations.
*
* @author max
*/
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
public @interface NotNull {
/**
* @return Custom exception message
*/
String value() default "";
/**
* @return Custom exception type that should be thrown when not-nullity contract is violated.
* The exception class should have a constructor with one String argument (message).
*
* By default, {@link IllegalArgumentException} is thrown on null method arguments and
* {@link IllegalStateException} &mdash; on null return value.
*/
Class<? extends Exception> exception() default Exception.class;
}
@@ -0,0 +1,44 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.annotations;
import java.lang.annotation.*;
/**
* An element annotated with {@link Nullable} claims {@code null} value is perfectly <em>valid</em>
* to return (for methods), pass to (parameters) or hold in (local variables and fields).
* Apart from documentation purposes this annotation is intended to be used by static analysis tools
* to validate against probable runtime errors or element contract violations.
* <br>
* By convention, this annotation applied only when the value should <em>always</em> be checked against {@code null}
* because the developer could do nothing to prevent null from happening.
* Otherwise, too eager {@link Nullable} usage could lead to too many false positives from static analysis tools.
* <br>
* For example, {@link java.util.Map#get(Object key)} should <em>not</em> be annotated {@link Nullable} because
* someone may have put not-null value in the map by this key and is expecting to find this value there ever since.
* <br>
* On the other hand, the {@link java.lang.ref.Reference#get()} should be annotated {@link Nullable} because
* it returns {@code null} if object got collected which can happen at any time completely unexpectedly.
*
* @author max
*/
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE})
public @interface Nullable {
String value() default "";
}
+4 -1
View File
@@ -213,7 +213,10 @@ private layoutFull(Map args, String target, Set usedJars) {
openapiModules.each { module it }
}
jar("annotations.jar") { module("annotations") }
jar("annotations.jar") {
module("annotations-common")
module("annotations")
}
jar("extensions.jar") { module("extensions") }
jar("pycharm.jar") {
+4 -1
View File
@@ -246,7 +246,10 @@ private layoutFull(Map args, String target, Set usedJars) {
openapiModules.each { module it }
}
jar("annotations.jar") { module("annotations") }
jar("annotations.jar") {
module("annotations-common")
module("annotations")
}
jar("extensions.jar") { module("extensions") }
jar("pycharm.jar") {