From 0fd77f29e169ffe0508bb11ab11eaa4d643701ab Mon Sep 17 00:00:00 2001 From: Alexander Fedorov Date: Fri, 31 Jan 2025 20:53:22 +0300 Subject: [PATCH] [#1575] EmptyStackException with javadoc on record method * support `record` types --- .../tests/tags/InvalidRecordTagTests.java | 271 ++++++++++++++++++ .../api/tools/builder/tests/tags/TagTest.java | 5 +- .../tests/tags/ValidRecordTagTests.java | 56 ++++ .../tagprojects/java17tags/.classpath | 7 + .../tagprojects/java17tags/.project | 34 +++ .../.settings/org.eclipse.jdt.core.prefs | 8 + .../java17tags/META-INF/MANIFEST.MF | 9 + .../tagprojects/java17tags/build.properties | 17 ++ .../java17tags/src/a/b/c/Dummy.txt | 0 .../test-builder/tags/record/test1.java | 51 ++++ .../test-builder/tags/record/test10.java | 21 ++ .../test-builder/tags/record/test11.java | 31 ++ .../test-builder/tags/record/test3.java | 51 ++++ .../test-builder/tags/record/test4.java | 21 ++ .../test-builder/tags/record/test5.java | 51 ++++ .../test-builder/tags/record/test6.java | 22 ++ .../test-builder/tags/record/test7.java | 51 ++++ .../test-builder/tags/record/test8.java | 21 ++ .../test-builder/tags/record/test9.java | 51 ++++ .../test-builder/tags/record/valid/test1.java | 21 ++ .../pde/api/tools/internal/CoreMessages.java | 4 +- .../api/tools/internal/JavadocTagManager.java | 6 +- .../internal/builder/BuilderMessages.java | 5 +- .../tools/internal/builder/TagValidator.java | 77 ++++- .../api/tools/internal/builder/Validator.java | 25 +- .../builder/buildermessages.properties | 5 +- .../tools/internal/coremessages.properties | 4 +- .../internal/provisional/IApiJavadocTag.java | 9 +- 28 files changed, 921 insertions(+), 13 deletions(-) create mode 100644 apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidRecordTagTests.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidRecordTagTests.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.classpath create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.project create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.settings/org.eclipse.jdt.core.prefs create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/META-INF/MANIFEST.MF create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/build.properties create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/src/a/b/c/Dummy.txt create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test1.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test10.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test11.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test3.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test4.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test5.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test6.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test7.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test8.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test9.java create mode 100644 apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/valid/test1.java diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidRecordTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidRecordTagTests.java new file mode 100644 index 0000000000..8936b40e2f --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/InvalidRecordTagTests.java @@ -0,0 +1,271 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.api.tools.builder.tests.tags; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.pde.api.tools.internal.builder.BuilderMessages; +import org.eclipse.pde.api.tools.internal.problems.ApiProblemFactory; +import org.eclipse.pde.api.tools.internal.provisional.descriptors.IElementDescriptor; +import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblem; + +import junit.framework.Test; + +/** + * Tests that the builder finds and properly reports invalid tags on records + * + * @since 1.4 + */ +public class InvalidRecordTagTests extends TagTest { + + public InvalidRecordTagTests(String name) { + super(name); + } + + /** + * @return the tests for this class + */ + public static Test suite() { + return buildTestSuite(InvalidRecordTagTests.class); + } + + @Override + protected String getTestingProjectName() { + return "java17tags"; //$NON-NLS-1$ + } + + @Override + protected IPath getTestSourcePath() { + return super.getTestSourcePath().append("record"); //$NON-NLS-1$ + } + + @Override + protected int getDefaultProblemId() { + return ApiProblemFactory.createProblemId(IApiProblem.CATEGORY_USAGE, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_TAG_USE, IApiProblem.NO_FLAGS); + } + + @Override + protected String getTestCompliance() { + return JavaCore.VERSION_14; + } + + public void testInvalidRecordTag1I() { + x1(true); + } + + public void testInvalidRecordTag1F() { + x1(false); + } + + /** + * Tests having an @noreference tag on a variety of inner / outer / + * top-level record in package a.b.c + */ + private void x1(boolean inc) { + setExpectedProblemIds(getDefaultProblemSet(3)); + setExpectedMessageArgs(new String[][] { + { "@noreference", BuilderMessages.TagValidator_record_not_visible }, //$NON-NLS-1$ + { "@noreference", BuilderMessages.TagValidator_record_not_visible }, //$NON-NLS-1$ + { "@noreference", BuilderMessages.TagValidator_record_not_visible }, //$NON-NLS-1$ + }); + deployTagTest("test1.java", inc, false); //$NON-NLS-1$ + } + + public void testInvalidRecordTag3I() { + x3(true); + } + + public void testInvalidRecordTag3F() { + x3(false); + } + + /** + * Tests having an @noextend tag on a variety of inner / outer / top-level + * records in package a.b.c + */ + private void x3(boolean inc) { + setExpectedProblemIds(getDefaultProblemSet(4)); + setExpectedMessageArgs(new String[][] { + { "@noextend", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@noextend", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@noextend", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@noextend", BuilderMessages.TagValidator_a_record } //$NON-NLS-1$ + }); + deployTagTest("test3.java", inc, false); //$NON-NLS-1$ + } + + public void testInvalidRecordTag4I() { + x4(true); + } + + public void testInvalidRecordTag4F() { + x4(false); + } + + /** + * Tests having an @noextend tag on an record in the default package + */ + private void x4(boolean inc) { + setExpectedProblemIds(getDefaultProblemSet(1)); + setExpectedMessageArgs(new String[][] { { + "@noextend", BuilderMessages.TagValidator_a_record } //$NON-NLS-1$ + }); + deployTagTest("test4.java", inc, true); //$NON-NLS-1$ + } + + public void testInvalidRecordTag5I() { + x5(true); + } + + public void testInvalidRecordTag5F() { + x5(false); + } + + /** + * Tests having an @nooverride tag on a variety of inner / outer / top-level + * records in package a.b.c + */ + private void x5(boolean inc) { + setExpectedProblemIds(getDefaultProblemSet(4)); + setExpectedMessageArgs(new String[][] { + { "@nooverride", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@nooverride", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@nooverride", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@nooverride", BuilderMessages.TagValidator_a_record } //$NON-NLS-1$ + }); + deployTagTest("test5.java", inc, false); //$NON-NLS-1$ + } + + public void testInvalidRecordTag6I() { + x6(true); + } + + public void testInvalidRecordTag6F() { + x6(false); + } + + /** + * Tests having an @nooverride tag on a record in the default package + */ + private void x6(boolean inc) { + setExpectedProblemIds(getDefaultProblemSet(1)); + setExpectedMessageArgs(new String[][] { { + "@nooverride", BuilderMessages.TagValidator_a_record } //$NON-NLS-1$ + }); + deployTagTest("test6.java", inc, true); //$NON-NLS-1$ + } + + public void testInvalidRecordTag7I() { + x7(true); + } + + public void testInvalidRecordTag7F() { + x7(false); + } + + /** + * Tests having an @noinstantiate on a variety of inner / outer / top-level + * records in package a.b.c + */ + private void x7(boolean inc) { + setExpectedProblemIds(getDefaultProblemSet(4)); + setExpectedMessageArgs(new String[][] { + { "@noinstantiate", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@noinstantiate", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@noinstantiate", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@noinstantiate", BuilderMessages.TagValidator_a_record } //$NON-NLS-1$ + }); + deployTagTest("test7.java", inc, false); //$NON-NLS-1$ + } + + public void testInvalidRecordTag8I() { + x8(true); + } + + public void testInvalidRecordTag8F() { + x8(false); + } + + /** + * Tests having an @noinstantiate on a record in the default package + */ + private void x8(boolean inc) { + setExpectedProblemIds(getDefaultProblemSet(1)); + setExpectedMessageArgs(new String[][] { { + "@noinstantiate", BuilderMessages.TagValidator_a_record } //$NON-NLS-1$ + }); + deployTagTest("test8.java", inc, true); //$NON-NLS-1$ + } + + public void testInvalidRecordTag9I() { + x9(true); + } + + public void testInvalidRecordTag9F() { + x9(false); + } + + /** + * Tests having an @noimplement tag on a variety of inner / outer / + * top-level records in package a.b.c + */ + private void x9(boolean inc) { + setExpectedProblemIds(getDefaultProblemSet(4)); + setExpectedMessageArgs(new String[][] { + { "@noimplement", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@noimplement", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@noimplement", BuilderMessages.TagValidator_a_record }, //$NON-NLS-1$ + { "@noimplement", BuilderMessages.TagValidator_a_record } //$NON-NLS-1$ + }); + deployTagTest("test9.java", inc, false); //$NON-NLS-1$ + } + + public void testInvalidRecordTag10I() { + x10(true); + } + + public void testInvalidRecordTag10F() { + x10(false); + } + + /** + * Tests having an @noimplement tag on a record in the default package + */ + private void x10(boolean inc) { + setExpectedProblemIds(getDefaultProblemSet(1)); + setExpectedMessageArgs(new String[][] { { + "@noimplement", BuilderMessages.TagValidator_a_record } //$NON-NLS-1$ + }); + deployTagTest("test10.java", inc, true); //$NON-NLS-1$ + } + + public void testInvalidRecordTag11I() { + x11(true); + } + + public void testInvalidRecordTag11F() { + x11(false); + } + + /** + * Tests all tags are invalid when parent record is package default + */ + private void x11(boolean inc) { + setExpectedProblemIds(getDefaultProblemSet(1)); + setExpectedMessageArgs(new String[][] { + { "@noreference", BuilderMessages.TagValidator_record_not_visible } //$NON-NLS-1$ + }); + deployTagTest("test11.java", inc, true); //$NON-NLS-1$ + } +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/TagTest.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/TagTest.java index 10e3fae080..be344a56fb 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/TagTest.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/TagTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2024 IBM Corporation and others. + * Copyright (c) 2008, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,6 +10,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Fedorov (ArSysOp) - support records *******************************************************************************/ package org.eclipse.pde.api.tools.builder.tests.tags; @@ -70,6 +71,8 @@ private static Class[] getAllTestClasses() { classes.add(ValidMethodTagTests.class); classes.add(ValidEnumTagTests.class); classes.add(InvalidEnumTagTests.class); + classes.add(InvalidRecordTagTests.class); + classes.add(ValidRecordTagTests.class); classes.add(ValidAnnotationTagTests.class); classes.add(InvalidAnnotationTagTests.class); classes.add(InvalidDuplicateTagsTests.class); diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidRecordTagTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidRecordTagTests.java new file mode 100644 index 0000000000..f1839764db --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/tags/ValidRecordTagTests.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.pde.api.tools.builder.tests.tags; + +import org.eclipse.core.runtime.IPath; + +import junit.framework.Test; + +/** + * Tests that the builder accepts valid tags on records + */ +public class ValidRecordTagTests extends InvalidRecordTagTests { + + public ValidRecordTagTests(String name) { + super(name); + } + + /** + * @return the tests for this class + */ + public static Test suite() { + return buildTestSuite(ValidRecordTagTests.class); + } + + @Override + protected IPath getTestSourcePath() { + return super.getTestSourcePath().append("valid"); //$NON-NLS-1$ + } + + public void testValidRecordTag1I() { + x1(true); + } + + @Override + public void testInvalidRecordTag1F() { + x1(false); + } + + /** + * Tests having an @noreference tag on a record in the default package + */ + private void x1(boolean inc) { + deployTagTest("test1.java", inc, true); //$NON-NLS-1$ + } +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.classpath b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.classpath new file mode 100644 index 0000000000..81fe078c20 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.project b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.project new file mode 100644 index 0000000000..fec422a650 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.project @@ -0,0 +1,34 @@ + + + java17tags + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature + + diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.settings/org.eclipse.jdt.core.prefs b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..2bce8be068 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Jul 16 11:12:55 CDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=17 diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/META-INF/MANIFEST.MF b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..347671d288 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/META-INF/MANIFEST.MF @@ -0,0 +1,9 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: java17tags +Bundle-SymbolicName: java17tags +Bundle-Version: 1.0.0.qualifier +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.pde.api.tools.annotations;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-17 +Export-Package: a.b.c diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/build.properties b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/build.properties new file mode 100644 index 0000000000..1d882c3740 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/build.properties @@ -0,0 +1,17 @@ +############################################################################### +# Copyright (c) 2025 ArSysOp and others. +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Alexander Fedorov (ArSysOp) - initial API and implementation +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/src/a/b/c/Dummy.txt b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tagprojects/java17tags/src/a/b/c/Dummy.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test1.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test1.java new file mode 100644 index 0000000000..16a6450c69 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test1.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + +package a.b.c; + +/** + * Tests invalid @noreference tags on nested inner records + * @noreference + */ +public record test1(int a) { + + /** + * @noreference + */ + record inner() { + + } + + record inner1(int a) { + /** + * @noreference + */ + record inner2() { + + } + } + + record inner2() { + + } +} + +record outer(int a) { + /** + * @noreference + */ + record inner() { + + } +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test10.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test10.java new file mode 100644 index 0000000000..adad3ac9fa --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test10.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + +/** + * Test unsupported @noimplement tag on a record in the default package + * @noimplement + */ +public record test10() { + +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test11.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test11.java new file mode 100644 index 0000000000..e99befc8d3 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test11.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + +/** + * Tests all tags are invalid when parent record is package default + */ +public record test11(int a) { + + record inner1(int a) { + + /** + * @noreference + */ + public record inner2() { + + } + + } + +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test3.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test3.java new file mode 100644 index 0000000000..014cbb2728 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test3.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + +package a.b.c; + +/** + * Tests invalid @noextend tags on nested inner records + * @noextend + */ +public record test3(int a) { + + /** + * @noextend + */ + record inner() { + + } + + record inner1(int a) { + /** + * @noextend + */ + record inner2() { + + } + } + + record inner2() { + + } +} + +record outer(int a) { + /** + * @noextend + */ + record inner() { + + } +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test4.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test4.java new file mode 100644 index 0000000000..f031b66d8e --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test4.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + +/** + * Test unsupported @noextend tag on a record in the default package + * @noextend + */ +public record test4() { + +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test5.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test5.java new file mode 100644 index 0000000000..6e36507b2b --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test5.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + +package a.b.c; + +/** + * Tests invalid @nooverride tags on nested inner records + * @nooverride + */ +public record test5(int a) { + + /** + * @nooverride + */ + record inner() { + + } + + record inner1(int a) { + /** + * @nooverride + */ + record inner2() { + + } + } + + record inner2() { + + } +} + +record outer(int a) { + /** + * @nooverride + */ + record InnerNoRef4() { + + } +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test6.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test6.java new file mode 100644 index 0000000000..67fdadfb32 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test6.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + + +/** + * Test unsupported @nooverride tag on a record + * @nooverride + */ +public record test6() { + +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test7.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test7.java new file mode 100644 index 0000000000..2025b41e5d --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test7.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + +package a.b.c; + +/** + * Tests invalid @noinstantiate tags on nested inner records + * @noinstantiate + */ +public record test7(int a) { + + /** + * @noinstantiate + */ + record inner() { + + } + + record inner1(int a) { + /** + * @noinstantiate + */ + record inner2() { + + } + } + + record inner2() { + + } +} + +record outer(int A) { + /** + * @noinstantiate + */ + record inner() { + + } +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test8.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test8.java new file mode 100644 index 0000000000..f844e76a42 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test8.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + +/** + * Test unsupported @noinstantiate tag on a record in the default package + * @noinstantiate + */ +public record test8() { + +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test9.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test9.java new file mode 100644 index 0000000000..33b757b497 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/test9.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + +package a.b.c; + +/** + * Tests invalid @noimplement tags on nested inner records + * @noimplement + */ +public record test9(int a) { + + /** + * @noimplement + */ + record inner() { + + } + + record inner1(int a) { + /** + * @noimplement + */ + record inner2() { + + } + } + + record inner2() { + + } +} + +record outer(int a) { + /** + * @noimplement + */ + record inner() { + + } +} diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/valid/test1.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/valid/test1.java new file mode 100644 index 0000000000..a4f464b8d4 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/tags/record/valid/test1.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2025 ArSysOp and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Alexander Fedorov (ArSysOp) - initial API and implementation + *******************************************************************************/ + +/** + * Test supported @noreference tag on a record in the default package + * @noreference + */ +public record test1() { + +} diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/CoreMessages.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/CoreMessages.java index 239c59c1ce..a22cc93d5b 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/CoreMessages.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/CoreMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2014 IBM Corporation and others. + * Copyright (c) 2008, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,6 +10,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Fedorov (ArSysOp) - support records *******************************************************************************/ package org.eclipse.pde.api.tools.internal; @@ -39,6 +40,7 @@ public class CoreMessages extends NLS { public static String JavadocTagManager_interface_no_reference; public static String JavadocTagManager_method_no_overried; public static String JavadocTagManager_method_no_reference; + public static String JavadocTagManager_record_no_reference; public static String ProjectComponent_could_not_locate_model; public static String api_generation_printArguments; public static String api_generation_projectLocationNotADirectory; diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/JavadocTagManager.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/JavadocTagManager.java index ad027ec8dd..5b9e4fda2b 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/JavadocTagManager.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/JavadocTagManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2021 IBM Corporation and others. + * Copyright (c) 2007, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,6 +10,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Fedorov (ArSysOp) - support records *******************************************************************************/ package org.eclipse.pde.api.tools.internal; @@ -227,6 +228,7 @@ private void initializeAnnotations() { fAnnotationCache.put(new Key(IApiJavadocTag.TYPE_ENUM, IApiJavadocTag.MEMBER_NONE), annots); fAnnotationCache.put(new Key(IApiJavadocTag.TYPE_ENUM, IApiJavadocTag.MEMBER_FIELD), annots); fAnnotationCache.put(new Key(IApiJavadocTag.TYPE_ENUM, IApiJavadocTag.MEMBER_METHOD), annots); + fAnnotationCache.put(new Key(IApiJavadocTag.TYPE_RECORD, IApiJavadocTag.MEMBER_NONE), annots); } } @@ -284,6 +286,8 @@ private void initializeJavadocTags() { newtag.setApplicableTo(IApiJavadocTag.TYPE_ENUM, IApiJavadocTag.MEMBER_FIELD, CoreMessages.JavadocTagManager_enum_field_no_reference); newtag.setApplicableTo(IApiJavadocTag.TYPE_ENUM, IApiJavadocTag.MEMBER_METHOD, CoreMessages.JavadocTagManager_enum_method_no_reference); newtag.setApplicableTo(IApiJavadocTag.TYPE_ANNOTATION, IApiJavadocTag.MEMBER_NONE, CoreMessages.JavadocTagManager_annotation_no_reference); + newtag.setApplicableTo(IApiJavadocTag.TYPE_RECORD, IApiJavadocTag.MEMBER_NONE, + CoreMessages.JavadocTagManager_record_no_reference); tagcache.put(newtag.getTagId(), newtag); list.add(newtag); tags = list.toArray(new IApiJavadocTag[list.size()]); diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BuilderMessages.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BuilderMessages.java index 0c35abf405..d7f13b1d52 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BuilderMessages.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BuilderMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2021 IBM Corporation and others. + * Copyright (c) 2008, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,6 +10,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Fedorov (ArSysOp) - support records *******************************************************************************/ package org.eclipse.pde.api.tools.internal.builder; @@ -70,6 +71,7 @@ public class BuilderMessages extends NLS { public static String TagValidator_a_method; public static String TagValidator_a_method_in_a_final_class; public static String TagValidator_a_method_that_is_not_visible; + public static String TagValidator_a_record; public static String TagValidator_a_static_final_method; public static String TagValidator_a_static_method; public static String TagValidator_an_abstract_class; @@ -99,6 +101,7 @@ public class BuilderMessages extends NLS { public static String TagValidator_private_enum_method; public static String TagValidator_private_field; public static String TagValidator_private_method; + public static String TagValidator_record_not_visible; public static String TagValidator_static_final_constructor; public static String TagValidator_static_package_constructor; public static String IncrementalBuilder_builder_for_project; diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/TagValidator.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/TagValidator.java index ce910d6d1a..493f563c14 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/TagValidator.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/TagValidator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 IBM Corporation and others. + * Copyright (c) 2008, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,6 +10,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Fedorov (ArSysOp) - support records *******************************************************************************/ package org.eclipse.pde.api.tools.internal.builder; @@ -29,6 +30,7 @@ import org.eclipse.jdt.core.dom.Javadoc; import org.eclipse.jdt.core.dom.MarkerAnnotation; import org.eclipse.jdt.core.dom.MethodDeclaration; +import org.eclipse.jdt.core.dom.RecordDeclaration; import org.eclipse.jdt.core.dom.TagElement; import org.eclipse.jdt.core.dom.TypeDeclaration; import org.eclipse.jface.text.BadLocationException; @@ -95,6 +97,12 @@ public boolean visit(EnumDeclaration node) { return super.visit(node); } + @Override + public boolean visit(RecordDeclaration node) { + fProcessedAnnotations.clear(); + return super.visit(node); + } + @Override public boolean visit(FieldDeclaration node) { fProcessedAnnotations.clear(); @@ -159,12 +167,39 @@ private void validateTags(ASTNode node, List tags) { if (tagname == null || !JavadocTagManager.ALL_TAGS.contains(tagname)) { continue; } - createTagProblem(item.typename, tag, IElementDescriptor.FIELD, IApiProblem.UNSUPPORTED_TAG_USE, IApiMarkerConstants.UNSUPPORTED_TAG_MARKER_ID, BuilderMessages.TagValidator_an_enum_constant); + createTagProblem(item.typename, tag, IElementDescriptor.FIELD, IApiProblem.UNSUPPORTED_TAG_USE, + IApiMarkerConstants.UNSUPPORTED_TAG_MARKER_ID, + BuilderMessages.TagValidator_an_enum_constant); } } case ASTNode.ANNOTATION_TYPE_DECLARATION -> { Item item = getItem(); - Set supported = getSupportedTagNames(IApiJavadocTag.TYPE_ANNOTATION, IApiJavadocTag.MEMBER_NONE); + Set supported = getSupportedTagNames(IApiJavadocTag.TYPE_ANNOTATION, + IApiJavadocTag.MEMBER_NONE); + HashSet processed = new HashSet<>(); + for (TagElement tag : tags) { + String tagname = tag.getTagName(); + if (tagname == null || !JavadocTagManager.ALL_TAGS.contains(tagname)) { + continue; + } + if (processed.contains(tagname)) { + createTagProblem(item.typename, tag, IElementDescriptor.METHOD, IApiProblem.DUPLICATE_TAG_USE, + IApiMarkerConstants.DUPLICATE_TAG_MARKER_ID, null); + } else if (!supported.contains(tagname)) { + createTagProblem(item.typename, tag, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_TAG_USE, + IApiMarkerConstants.UNSUPPORTED_TAG_MARKER_ID, + BuilderMessages.TagValidator_an_annotation); + } else if (!item.visible) { + createTagProblem(item.typename, tag, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_TAG_USE, + IApiMarkerConstants.UNSUPPORTED_TAG_MARKER_ID, + BuilderMessages.TagValidator_annotation_not_visible); + } + processed.add(tagname); + } + } + case ASTNode.RECORD_DECLARATION -> { + Item item = getItem(); + Set supported = getSupportedTagNames(IApiJavadocTag.TYPE_RECORD, IApiJavadocTag.MEMBER_NONE); HashSet processed = new HashSet<>(); for (TagElement tag : tags) { String tagname = tag.getTagName(); @@ -174,9 +209,12 @@ private void validateTags(ASTNode node, List tags) { if (processed.contains(tagname)) { createTagProblem(item.typename, tag, IElementDescriptor.METHOD, IApiProblem.DUPLICATE_TAG_USE, IApiMarkerConstants.DUPLICATE_TAG_MARKER_ID, null); } else if (!supported.contains(tagname)) { - createTagProblem(item.typename, tag, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_TAG_USE, IApiMarkerConstants.UNSUPPORTED_TAG_MARKER_ID, BuilderMessages.TagValidator_an_annotation); + createTagProblem(item.typename, tag, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_TAG_USE, + IApiMarkerConstants.UNSUPPORTED_TAG_MARKER_ID, BuilderMessages.TagValidator_a_record); } else if (!item.visible) { - createTagProblem(item.typename, tag, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_TAG_USE, IApiMarkerConstants.UNSUPPORTED_TAG_MARKER_ID, BuilderMessages.TagValidator_annotation_not_visible); + createTagProblem(item.typename, tag, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_TAG_USE, + IApiMarkerConstants.UNSUPPORTED_TAG_MARKER_ID, + BuilderMessages.TagValidator_record_not_visible); } processed.add(tagname); } @@ -448,6 +486,7 @@ public boolean visit(MarkerAnnotation node) { IElementDescriptor.METHOD, IApiProblem.UNSUPPORTED_ANNOTATION_USE, IApiMarkerConstants.UNSUPPORTED_ANNOTATION_MARKER_ID, BuilderMessages.TagValidator_an_annotation_method); + case ASTNode.RECORD_DECLARATION -> checkRecord(node, (RecordDeclaration) parent); case ASTNode.FIELD_DECLARATION -> checkField(node, (FieldDeclaration) parent); case ASTNode.METHOD_DECLARATION -> checkMethod(node, (MethodDeclaration) parent); default -> { /**/ } @@ -539,6 +578,34 @@ void checkAnnotation(MarkerAnnotation node, AnnotationTypeDeclaration type) { } } + /** + * Checks the annotation that appears on the given parent + * + * @param node the annotation + * @param type the parent + */ + void checkRecord(MarkerAnnotation node, RecordDeclaration type) { + String name = node.getTypeName().getFullyQualifiedName(); + Item item = getItem(); + if (fProcessedAnnotations.contains(name)) { + createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, IApiProblem.DUPLICATE_ANNOTATION_USE, + IApiMarkerConstants.DUPLICATE_ANNOTATION_MARKER_ID, null); + } else { + Set supported = ApiPlugin.getJavadocTagManager().getAnntationsForType(IApiJavadocTag.TYPE_RECORD, + IApiJavadocTag.MEMBER_NONE); + if (!supported.contains(name)) { + createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, + IApiProblem.UNSUPPORTED_ANNOTATION_USE, IApiMarkerConstants.UNSUPPORTED_ANNOTATION_MARKER_ID, + BuilderMessages.TagValidator_a_record); + } else if (!item.visible) { + createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, + IApiProblem.UNSUPPORTED_ANNOTATION_USE, IApiMarkerConstants.UNSUPPORTED_ANNOTATION_MARKER_ID, + BuilderMessages.TagValidator_record_not_visible); + } + } + fProcessedAnnotations.add(name); + } + /** * Checks the annotation that appears on the given parent * diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/Validator.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/Validator.java index cc3ae1c73d..6eebb4ca62 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/Validator.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/Validator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) Sep 11, 2013 IBM Corporation and others. + * Copyright (c) 2013, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,6 +10,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Fedorov (ArSysOp) - support records *******************************************************************************/ package org.eclipse.pde.api.tools.internal.builder; @@ -25,6 +26,7 @@ import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.EnumDeclaration; import org.eclipse.jdt.core.dom.PackageDeclaration; +import org.eclipse.jdt.core.dom.RecordDeclaration; import org.eclipse.jdt.core.dom.TypeDeclaration; import org.eclipse.pde.api.tools.internal.provisional.IApiJavadocTag; import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblem; @@ -124,6 +126,27 @@ public void endVisit(EnumDeclaration node) { } } + @Override + public boolean visit(RecordDeclaration node) { + int flags = node.getModifiers(); + if (node.isMemberTypeDeclaration()) { + isvisible &= Flags.isPublic(flags); + } else { + isvisible &= !Flags.isPackageDefault(flags); + } + fStack.push(new Item(getTypeName(node), node.getModifiers(), isvisible)); + return true; + } + + @Override + public void endVisit(RecordDeclaration node) { + fStack.pop(); + if (!fStack.isEmpty()) { + Item item = fStack.peek(); + isvisible = item.visible; + } + } + @Override public void endVisit(CompilationUnit node) { fStack.clear(); diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/buildermessages.properties b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/buildermessages.properties index 1a400069a6..27cd9046c2 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/buildermessages.properties +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/buildermessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2008, 2021 IBM Corporation and others. +# Copyright (c) 2008, 2025 IBM Corporation and others. # # This program and the accompanying materials # are made available under the terms of the Eclipse Public License 2.0 @@ -10,6 +10,7 @@ # # Contributors: # IBM Corporation - initial API and implementation +# Alexander Fedorov (ArSysOp) - support records ############################################################################### api_analysis_builder=Performing API Analysis api_analysis_on_0=Analyzing API @@ -58,6 +59,7 @@ TagValidator_a_final_method=a final method TagValidator_a_method=a method TagValidator_a_method_in_a_final_class=a method in a final class TagValidator_a_method_that_is_not_visible=a method that is not visible +TagValidator_a_record=a record TagValidator_a_static_final_method=a static final method TagValidator_a_static_method=a static method TagValidator_an_abstract_class=an abstract class @@ -87,6 +89,7 @@ TagValidator_private_enum_field=a private enum field TagValidator_private_enum_method=a private enum method TagValidator_private_field=a private field TagValidator_private_method=a private method +TagValidator_record_not_visible=a record that is not visible TagValidator_static_final_constructor=a static final constructor TagValidator_static_package_constructor=a static package default constructor undefinedRange= diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/coremessages.properties b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/coremessages.properties index f0a992efd1..b199cd49a7 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/coremessages.properties +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/coremessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2008, 2014 IBM Corporation and others. +# Copyright (c) 2008, 2025 IBM Corporation and others. # # This program and the accompanying materials # are made available under the terms of the Eclipse Public License 2.0 @@ -10,6 +10,7 @@ # # Contributors: # IBM Corporation - initial API and implementation +# Alexander Fedorov (ArSysOp) - support records ############################################################################### ApiBaseline_0=Baseline not bound to an execution environment @@ -34,6 +35,7 @@ JavadocTagManager_interface_no_implement=This interface is not intended to be im JavadocTagManager_interface_no_reference=This interface is not intended to be referenced by clients. JavadocTagManager_method_no_overried=This method is not intended to be re-implemented or extended by clients. JavadocTagManager_method_no_reference=This method is not intended to be referenced by clients. +JavadocTagManager_record_no_reference=This record is not intended to be referenced by clients. ProjectComponent_could_not_locate_model=Could not locate the plug-in model base for project: {0} api_generation_printArguments=Missing arguments:\n\ project name : {0}\n\ diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/IApiJavadocTag.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/IApiJavadocTag.java index 547ffaf649..4f36f762a5 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/IApiJavadocTag.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/IApiJavadocTag.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,6 +10,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alexander Fedorov (ArSysOp) - support records *******************************************************************************/ package org.eclipse.pde.api.tools.internal.provisional; @@ -45,6 +46,12 @@ public interface IApiJavadocTag { */ public static final int TYPE_ANNOTATION = 0x1 << 7; + /** + * Type constant representing the tag applies to a Java enum. Values is + * 256 + */ + public static final int TYPE_RECORD = 0x1 << 8; + /** * Member constant representing the tag applies to a Java method. Values is * 4