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..32ed3e30a48 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 20 + */ + 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 78e973d23d4..c10ee0f6117 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 @@ -212,6 +212,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 20 + */ + 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 bd5a64324ca..fc80febf4c2 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 @@ -324,7 +324,7 @@ public class DocTreeScanner