Sample method demonstrating all Javadoc tags
Returns calculated result.
Math.E
diff --git a/java/java-tests/testData/codeInsight/javadocIG/allTagsMarkdown.java b/java/java-tests/testData/codeInsight/javadocIG/allTagsMarkdown.java
index cb963b5a4d7b..2643b006e674 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/allTagsMarkdown.java
+++ b/java/java-tests/testData/codeInsight/javadocIG/allTagsMarkdown.java
@@ -1,4 +1,5 @@
import java.lang.Math;
+import java.lang.Deprecated;
class X {
@@ -30,6 +31,7 @@ class X {
/// @provides Math
/// @uses Math
/// @hidden
+ @Deprecated
public double calculateMd(T a, T b) {
return a.doubleValue() + b.doubleValue();
}
diff --git a/java/java-tests/testData/codeInsight/javadocIG/deprecatedTagNoAnnotationMarkdown.html b/java/java-tests/testData/codeInsight/javadocIG/deprecatedTagNoAnnotationMarkdown.html
new file mode 100644
index 000000000000..000cb2da9ac5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/javadocIG/deprecatedTagNoAnnotationMarkdown.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/deprecatedTagNoAnnotationMarkdown.java b/java/java-tests/testData/codeInsight/javadocIG/deprecatedTagNoAnnotationMarkdown.java
new file mode 100644
index 000000000000..4af3a41be95a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/javadocIG/deprecatedTagNoAnnotationMarkdown.java
@@ -0,0 +1,2 @@
+/// @deprecated Oops look at who forgot the annotation
+class X {}
\ No newline at end of file
diff --git a/java/java-tests/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration/DeprecatedUsages.after.java b/java/java-tests/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration/DeprecatedUsages.after.java
new file mode 100644
index 000000000000..398105decab2
--- /dev/null
+++ b/java/java-tests/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration/DeprecatedUsages.after.java
@@ -0,0 +1,22 @@
+import java.lang.Deprecated;
+public class DeprecatedUsages {
+
+ /// @deprecated We before java 5 there were no annotations
+ /// so that how you were expected to deprecate something
+ @Deprecated
+ void onlyTag() {}
+
+ /// @deprecated
+ @Deprecated
+ void emptyTag() {}
+
+ /// @deprecated
+ @Deprecated
+ void emptyTagWithAnnotation() {}
+
+
+ /// @deprecated Markdown Javadoc updated the meaning of the deprecated tag.
+ /// This is a bit of heresy and honestly artificial friction but so be it.
+ @Deprecated
+ void tagWithAnnotation() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration/DeprecatedUsages.java b/java/java-tests/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration/DeprecatedUsages.java
new file mode 100644
index 000000000000..fe9c52a96e0a
--- /dev/null
+++ b/java/java-tests/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration/DeprecatedUsages.java
@@ -0,0 +1,24 @@
+import java.lang.Deprecated;
+public class DeprecatedUsages {
+
+ /**
+ * @deprecated We before java 5 there were no annotations
+ * so that how you were expected to deprecate something
+ */
+ void onlyTag() {}
+
+ /** @deprecated */
+ void emptyTag() {}
+
+ /** @deprecated */
+ @Deprecated
+ void emptyTagWithAnnotation() {}
+
+
+ /**
+ * @deprecated Markdown Javadoc updated the meaning of the deprecated tag.
+ * This is a bit of heresy and honestly artificial friction but so be it.
+ */
+ @Deprecated
+ void tagWithAnnotation() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration/MarkdownDocumentationCommentsMigration.after.java b/java/java-tests/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration/MarkdownDocumentationCommentsMigration.after.java
index 0f16fbc16abc..797145228cec 100644
--- a/java/java-tests/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration/MarkdownDocumentationCommentsMigration.after.java
+++ b/java/java-tests/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration/MarkdownDocumentationCommentsMigration.after.java
@@ -298,6 +298,7 @@ public class MarkdownDocumentationCommentsMigration {
///
/// This method will remain in place until finalizers have been removed from
/// most existing code.
+ @Deprecated
@Override
protected void finalize() throws Throwable {
super.finalize();
diff --git a/java/java-tests/testData/psi/repositoryUse/src/pack/MyClass2.java b/java/java-tests/testData/psi/repositoryUse/src/pack/MyClass2.java
index 2eb4bcbf7cab..82ffe2a3c0d1 100644
--- a/java/java-tests/testData/psi/repositoryUse/src/pack/MyClass2.java
+++ b/java/java-tests/testData/psi/repositoryUse/src/pack/MyClass2.java
@@ -6,6 +6,7 @@ public class MyClass2 extends String implements Runnable{
*/
int field1 = 0;
+ /// @deprecated The annotation is missing so no real deprecation
Object field2[];
java.lang.Object[] field3;
diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/javadoc/JavaDocInfoGeneratorTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/javadoc/JavaDocInfoGeneratorTest.java
index d5f79381351e..e1a271a080b0 100644
--- a/java/java-tests/testSrc/com/intellij/java/codeInsight/javadoc/JavaDocInfoGeneratorTest.java
+++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/javadoc/JavaDocInfoGeneratorTest.java
@@ -268,6 +268,7 @@ public class JavaDocInfoGeneratorTest extends JavaCodeInsightTestCase {
public void testWrongfulInnerClassReferences() { doTestClass(); }
public void testImplicitConstructor() { doTestClass(); }
public void testCommatHtmlEntity() { doTestClass(); }
+ public void testDeprecatedTagNoAnnotationMarkdown() { doTestClass(); }
public void testRepeatableAnnotations() {
useJava8();
diff --git a/java/java-tests/testSrc/com/intellij/java/psi/JavaStubsTest.java b/java/java-tests/testSrc/com/intellij/java/psi/JavaStubsTest.java
index 58dd14538c9b..ecbd6e258cee 100644
--- a/java/java-tests/testSrc/com/intellij/java/psi/JavaStubsTest.java
+++ b/java/java-tests/testSrc/com/intellij/java/psi/JavaStubsTest.java
@@ -180,12 +180,18 @@ public class JavaStubsTest extends LightJavaCodeInsightFixtureTestCase {
}
public void test_deprecated_enum_constant() {
- PsiClass cls = myFixture.addClass("enum Foo { c1, @Deprecated c2, /** @deprecated */ c3 }");
+ PsiClass cls = myFixture.addClass("""
+ enum Foo {
+ c1, @Deprecated c2, /** @deprecated */ c3,
+ /// @deprecated no real deprecation
+ c4
+ }""");
assertFalse(((PsiFileImpl)cls.getContainingFile()).isContentsLoaded());
assertFalse(cls.getFields()[0].isDeprecated());
assertTrue(cls.getFields()[1].isDeprecated());
assertTrue(cls.getFields()[2].isDeprecated());
+ assertFalse(cls.getFields()[3].isDeprecated());
assertFalse(((PsiFileImpl)cls.getContainingFile()).isContentsLoaded());
}
diff --git a/java/java-tests/testSrc/com/intellij/java/psi/SrcRepositoryUseTest.java b/java/java-tests/testSrc/com/intellij/java/psi/SrcRepositoryUseTest.java
index ed2431a94bae..a38fb6608226 100644
--- a/java/java-tests/testSrc/com/intellij/java/psi/SrcRepositoryUseTest.java
+++ b/java/java-tests/testSrc/com/intellij/java/psi/SrcRepositoryUseTest.java
@@ -308,6 +308,9 @@ public class SrcRepositoryUseTest extends JavaPsiTestCase {
PsiField field = aClass.findFieldByName("field1", false);
assertTrue(field.isDeprecated());
+
+ PsiField field2 = aClass.findFieldByName("field2", false);
+ assertFalse(field2.isDeprecated());
teardownLoadingFilter();
}
diff --git a/java/java-tests/testSrc/com/siyeh/ig/migration/MarkdownDocumentationCommentsMigrationInspectionTest.java b/java/java-tests/testSrc/com/siyeh/ig/migration/MarkdownDocumentationCommentsMigrationInspectionTest.java
index 68823795d063..64ef44ed4b62 100644
--- a/java/java-tests/testSrc/com/siyeh/ig/migration/MarkdownDocumentationCommentsMigrationInspectionTest.java
+++ b/java/java-tests/testSrc/com/siyeh/ig/migration/MarkdownDocumentationCommentsMigrationInspectionTest.java
@@ -2,18 +2,20 @@
package com.siyeh.ig.migration;
import com.intellij.codeInspection.InspectionProfileEntry;
+import com.intellij.testFramework.TestDataPath;
import com.siyeh.ig.LightJavaInspectionTestCase;
import org.jetbrains.annotations.Nullable;
/**
* @author Bas Leijdekkers
*/
+@TestDataPath("$CONTENT_ROOT/testData/ig/com/siyeh/igtest/migration/markdown_documentation_comments_migration")
public class MarkdownDocumentationCommentsMigrationInspectionTest extends LightJavaInspectionTestCase {
public void testMarkdownDocumentationCommentsMigration() { check(); }
public void testReferencesNoEscape() { check(); }
public void testCodeBlocks() { check(); }
-
+ public void testDeprecatedUsages() { check(); }
@Override
protected @Nullable InspectionProfileEntry getInspection() {
@@ -24,5 +26,4 @@ public class MarkdownDocumentationCommentsMigrationInspectionTest extends LightJ
doTest();
checkQuickFixAll();
}
-
}
\ No newline at end of file