From 96a168beee86faa6de6ea87ee878dade294c2ad2 Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Mon, 21 Sep 2020 08:35:27 +0700 Subject: [PATCH 01/55] Add documentation links (#33) --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 87fef86..21fa13c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,17 @@ # Annotations for JVM-based languages -[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jetbrains/annotations/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.jetbrains/annotations) +[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains. +com/display/ALL/JetBrains+on+GitHub) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jetbrains/annotations/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.jetbrains/annotations) [![javadoc](https://javadoc.io/badge2/org.jetbrains/annotations/javadoc.svg)](https://javadoc.io/doc/org.jetbrains/annotations) A set of Java annotations which can be used in JVM-based languages. They serve as an additional documentation and can be interpreted by IDEs and static analysis tools to improve code analysis. [Change Log](CHANGELOG.md) | [Contributing](CONTRIBUTING.md) | [Code of Conduct](CODE_OF_CONDUCT.md) +## Documentation + +- [JavaDoc](https://javadoc.io/doc/org.jetbrains/annotations) +- [JavaDoc](https://javadoc.io/doc/org.jetbrains/annotations-java5) for legacy Java 5.0 compatible package + ## Using the annotations The annotations are published on [Maven Central](https://repo1.maven.org/maven2/org/jetbrains/annotations/) and [JCenter](https://jcenter.bintray.com/org/jetbrains/annotations/). To add a dependency using gradle write the following in the `build.gradle` file: From d7c469b3b53c2135ba1c8863fc5eb2f5d5ccb36c Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Mon, 21 Sep 2020 08:38:13 +0700 Subject: [PATCH 02/55] Fix broken link --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 21fa13c..376d44f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # Annotations for JVM-based languages -[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains. -com/display/ALL/JetBrains+on+GitHub) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jetbrains/annotations/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.jetbrains/annotations) [![javadoc](https://javadoc.io/badge2/org.jetbrains/annotations/javadoc.svg)](https://javadoc.io/doc/org.jetbrains/annotations) +[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jetbrains/annotations/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.jetbrains/annotations) [![javadoc](https://javadoc.io/badge2/org.jetbrains/annotations/javadoc.svg)](https://javadoc.io/doc/org.jetbrains/annotations) A set of Java annotations which can be used in JVM-based languages. They serve as an additional documentation and can be interpreted by IDEs and static analysis tools to improve code analysis. From 651171bd3421f4f9ada27d08439ff589dfc9fa83 Mon Sep 17 00:00:00 2001 From: progrm_jarvis Date: Fri, 4 Dec 2020 14:32:11 +0300 Subject: [PATCH 03/55] Prohibit instantiation of namespace-like classes Closes JetBrains/java-annotations#38 --- .../java/org/intellij/lang/annotations/JdkConstants.java | 8 ++++++++ .../main/java/org/jetbrains/annotations/ApiStatus.java | 8 ++++++++ common/src/main/java/org/jetbrains/annotations/Async.java | 7 +++++++ common/src/main/java/org/jetbrains/annotations/Debug.java | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/common/src/main/java/org/intellij/lang/annotations/JdkConstants.java b/common/src/main/java/org/intellij/lang/annotations/JdkConstants.java index 262bad4..0aae0cc 100644 --- a/common/src/main/java/org/intellij/lang/annotations/JdkConstants.java +++ b/common/src/main/java/org/intellij/lang/annotations/JdkConstants.java @@ -25,6 +25,14 @@ @SuppressWarnings("EmptyClass") public class JdkConstants { + + /** + * Prohibited default constructor. + */ + private JdkConstants() { + throw new AssertionError("JdkConstants should not be instantiated"); + } + @MagicConstant(intValues = {SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT, SwingConstants.LEADING, SwingConstants.TRAILING}) public @interface HorizontalAlignment {} diff --git a/common/src/main/java/org/jetbrains/annotations/ApiStatus.java b/common/src/main/java/org/jetbrains/annotations/ApiStatus.java index 1e699c0..4edb051 100644 --- a/common/src/main/java/org/jetbrains/annotations/ApiStatus.java +++ b/common/src/main/java/org/jetbrains/annotations/ApiStatus.java @@ -23,6 +23,14 @@ * @since 18.0.0 */ public final class ApiStatus { + + /** + * Prohibited default constructor. + */ + private ApiStatus() { + throw new AssertionError("ApiStatus should not be instantiated"); + } + /** *

Indicates that a public API of the annotated element (class, method or field) is not in stable state yet. It may be renamed, changed or * even removed in a future version. This annotation refers to API status only, it doesn't mean that the implementation has diff --git a/common/src/main/java/org/jetbrains/annotations/Async.java b/common/src/main/java/org/jetbrains/annotations/Async.java index c6d7996..5372919 100644 --- a/common/src/main/java/org/jetbrains/annotations/Async.java +++ b/common/src/main/java/org/jetbrains/annotations/Async.java @@ -28,6 +28,13 @@ */ public final class Async { + /** + * Prohibited default constructor. + */ + private Async() { + throw new AssertionError("Async should not be instantiated"); + } + /** * Indicates that the marked method schedules async computation. * Scheduled object is either {@code this}, or the annotated parameter value. diff --git a/common/src/main/java/org/jetbrains/annotations/Debug.java b/common/src/main/java/org/jetbrains/annotations/Debug.java index 7cbe2cf..479cb93 100644 --- a/common/src/main/java/org/jetbrains/annotations/Debug.java +++ b/common/src/main/java/org/jetbrains/annotations/Debug.java @@ -26,6 +26,14 @@ * @since 18.0.0 */ public final class Debug { + + /** + * Prohibited default constructor. + */ + private Debug() { + throw new AssertionError("Debug should not be instantiated"); + } + /** * Allows to change the presentation of an object in debuggers */ From 3839a6d16f4569d5ce5477a20564bf3560818a03 Mon Sep 17 00:00:00 2001 From: progrm_jarvis Date: Fri, 4 Dec 2020 14:34:23 +0300 Subject: [PATCH 04/55] Make JdkConstants final --- .../main/java/org/intellij/lang/annotations/JdkConstants.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/src/main/java/org/intellij/lang/annotations/JdkConstants.java b/common/src/main/java/org/intellij/lang/annotations/JdkConstants.java index 0aae0cc..2cf453d 100644 --- a/common/src/main/java/org/intellij/lang/annotations/JdkConstants.java +++ b/common/src/main/java/org/intellij/lang/annotations/JdkConstants.java @@ -23,8 +23,7 @@ import java.util.Calendar; import java.util.regex.Pattern; -@SuppressWarnings("EmptyClass") -public class JdkConstants { +public final class JdkConstants { /** * Prohibited default constructor. From fb022d072344e9a3e8ccd374020912a85c29b06c Mon Sep 17 00:00:00 2001 From: Jackson Bailey Date: Sat, 6 Feb 2021 19:05:42 -0500 Subject: [PATCH 05/55] Change scope of artifact to "provided" The annotations are not needed at runtime. They only provide hints to the IDE about how the code works. The Gradle example uses `compileOnly`, using Maven's `provided` scope will perform the same thing. It causes the dependency to be made available during compilation but not at runtime. (The fact that it assumes it will be "provided" at runtime is irrelevant, it simply doesn't need to be provided.) Note that using the provided scope is more correct than using `true` since making something optional only affects downstream projects that depend on your own. It will still be made available at runtime. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 376d44f..bafac05 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ To add a dependency using Maven, write the following in `pom.xml`: org.jetbrains annotations 20.1.0 + provided ``` From 4027cfdc3b8e5ccff8c55eccffb682fc59b5a186 Mon Sep 17 00:00:00 2001 From: janothan Date: Wed, 17 Feb 2021 09:34:16 +0100 Subject: [PATCH 06/55] Update NonNls.java Fixed typo (no n required before a non-phonetic vowel). --- common/src/main/java/org/jetbrains/annotations/NonNls.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/org/jetbrains/annotations/NonNls.java b/common/src/main/java/org/jetbrains/annotations/NonNls.java index 84ed9e3..91fb4dd 100644 --- a/common/src/main/java/org/jetbrains/annotations/NonNls.java +++ b/common/src/main/java/org/jetbrains/annotations/NonNls.java @@ -19,7 +19,7 @@ import java.lang.annotation.*; /** - * Specifies that an element of the program is not an user-visible string which needs to be localized, + * Specifies that an element of the program is not a user-visible string which needs to be localized, * or does not contain such strings. This annotation is intended to be used by localization tools for * detecting strings which should not be reported as requiring localization. *