diff --git a/src/jdk.compiler/share/classes/com/sun/source/doctree/InheritDocTree.java b/src/jdk.compiler/share/classes/com/sun/source/doctree/InheritDocTree.java index 304bde3908f..9173d56df2a 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/doctree/InheritDocTree.java +++ b/src/jdk.compiler/share/classes/com/sun/source/doctree/InheritDocTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,8 +30,21 @@ package com.sun.source.doctree; * *
* {@inheritDoc} + * {@inheritDoc supertype} ** * @since 1.8 */ -public interface InheritDocTree extends InlineTagTree { } +public interface InheritDocTree extends InlineTagTree { + + /** + * {@return the reference to a superclass or superinterface from which + * to inherit documentation, or {@code null} if no reference was provided} + * + * @implSpec this implementation returns {@code null}. + * @since 19 + */ + default ReferenceTree getSupertype() { + return null; + } +} diff --git a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java index 52c859fb728..e33f39fa919 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java +++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -211,6 +211,17 @@ public interface DocTreeFactory { */ InheritDocTree newInheritDocTree(); + /** + * Creates a new {@code InheritDocTree} object, to represent an {@code {@inheritDoc}} tag. + * @param supertype a superclass or superinterface reference + * @return an {@code InheritDocTree} object + * @implSpec This implementation throws {@code UnsupportedOperationException}. + * @since 19 + */ + default InheritDocTree newInheritDocTree(ReferenceTree supertype) { + throw new UnsupportedOperationException(); + } + /** * Creates a new {@code LinkTree} object, to represent a {@code {@link }} tag. * @param ref the API element being referenced diff --git a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java index ef92d0b52b5..f69f6e566ea 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java +++ b/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java @@ -318,7 +318,7 @@ public class DocTreeScanner