Merge
This commit is contained in:
commit
b936939454
src
hotspot/share
gc/shenandoah
jfr/leakprofiler
oops
opto
java.desktop/macosx/classes/sun/lwawt
jdk.incubator.foreign/share/classes/jdk/incubator/foreign
jdk.javadoc/share/classes/jdk/javadoc/internal/doclets
test
jdk/javax/swing/JLightweightFrame
langtools/jdk/javadoc/doclet/testMemberInheritance
@ -1332,7 +1332,9 @@ void ShenandoahHeap::object_iterate(ObjectClosure* cl) {
|
||||
|
||||
// Keep alive an object that was loaded with AS_NO_KEEPALIVE.
|
||||
void ShenandoahHeap::keep_alive(oop obj) {
|
||||
ShenandoahBarrierSet::barrier_set()->enqueue(obj);
|
||||
if (is_concurrent_mark_in_progress()) {
|
||||
ShenandoahBarrierSet::barrier_set()->enqueue(obj);
|
||||
}
|
||||
}
|
||||
|
||||
void ShenandoahHeap::heap_region_iterate(ShenandoahHeapRegionClosure* blk) const {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2020, 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
|
||||
@ -131,7 +131,7 @@ void BFSClosure::closure_impl(UnifiedOopRef reference, const oop pointee) {
|
||||
if (!_mark_bits->is_marked(pointee)) {
|
||||
_mark_bits->mark_obj(pointee);
|
||||
// is the pointee a sample object?
|
||||
if (NULL == pointee->mark().to_pointer()) {
|
||||
if (pointee->mark().is_marked()) {
|
||||
add_chain(reference, pointee);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ void BFSClosure::closure_impl(UnifiedOopRef reference, const oop pointee) {
|
||||
|
||||
void BFSClosure::add_chain(UnifiedOopRef reference, const oop pointee) {
|
||||
assert(pointee != NULL, "invariant");
|
||||
assert(NULL == pointee->mark().to_pointer(), "invariant");
|
||||
assert(pointee->mark().is_marked(), "invariant");
|
||||
Edge leak_edge(_current_parent, reference);
|
||||
_edge_store->put_chain(&leak_edge, _current_parent == NULL ? 1 : _current_frontier_level + 2);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2020, 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
|
||||
@ -121,7 +121,7 @@ void DFSClosure::closure_impl(UnifiedOopRef reference, const oop pointee) {
|
||||
assert(_mark_bits->is_marked(pointee), "invariant");
|
||||
|
||||
// is the pointee a sample object?
|
||||
if (NULL == pointee->mark().to_pointer()) {
|
||||
if (pointee->mark().is_marked()) {
|
||||
add_chain();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2020, 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
|
||||
@ -231,7 +231,7 @@ StoredEdge* EdgeStore::associate_leak_context_with_candidate(const Edge* edge) {
|
||||
StoredEdge* const leak_context_edge = put(edge->reference());
|
||||
oop sample_object = edge->pointee();
|
||||
assert(sample_object != NULL, "invariant");
|
||||
assert(NULL == sample_object->mark().to_pointer(), "invariant");
|
||||
assert(sample_object->mark().is_marked(), "invariant");
|
||||
sample_object->set_mark(markWord::from_pointer(leak_context_edge));
|
||||
return leak_context_edge;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2020, 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
|
||||
@ -67,14 +67,11 @@ class ObjectSampleMarker : public StackObj {
|
||||
assert(obj != NULL, "invariant");
|
||||
// save the original markWord
|
||||
_store->push(ObjectSampleMarkWord(obj, obj->mark()));
|
||||
// now we will "poison" the mark word of the sample object
|
||||
// to the intermediate monitor INFLATING state.
|
||||
// This is an "impossible" state during a safepoint,
|
||||
// hence we will use it to quickly identify sample objects
|
||||
// during the reachability search from gc roots.
|
||||
assert(NULL == markWord::INFLATING().to_pointer(), "invariant");
|
||||
obj->set_mark(markWord::INFLATING());
|
||||
assert(NULL == obj->mark().to_pointer(), "invariant");
|
||||
// now we will set the mark word to "marked" in order to quickly
|
||||
// identify sample objects during the reachability search from gc roots.
|
||||
assert(!obj->mark().is_marked(), "should only mark an object once");
|
||||
obj->set_mark(markWord::prototype().set_marked());
|
||||
assert(obj->mark().is_marked(), "invariant");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2020, 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
|
||||
@ -116,7 +116,9 @@ void EventEmitter::write_event(const ObjectSample* sample, EdgeStore* edge_store
|
||||
traceid gc_root_id = 0;
|
||||
const Edge* edge = NULL;
|
||||
if (SafepointSynchronize::is_at_safepoint()) {
|
||||
edge = (const Edge*)(sample->object())->mark().to_pointer();
|
||||
if (!sample->object()->mark().is_marked()) {
|
||||
edge = (const Edge*)(sample->object())->mark().to_pointer();
|
||||
}
|
||||
}
|
||||
if (edge == NULL) {
|
||||
// In order to dump out a representation of the event
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2020, 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
|
||||
@ -83,8 +83,7 @@
|
||||
// [ptr | 00] locked ptr points to real header on stack
|
||||
// [header | 0 | 01] unlocked regular object header
|
||||
// [ptr | 10] monitor inflated lock (header is wapped out)
|
||||
// [ptr | 11] marked used by markSweep to mark an object
|
||||
// not valid at any other time
|
||||
// [ptr | 11] marked used to mark an object
|
||||
//
|
||||
// We assume that stack/thread pointers have the lowest two bits cleared.
|
||||
|
||||
|
@ -1389,8 +1389,9 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) {
|
||||
// an early loop exit. Try them with profile data.
|
||||
while (if_proj_list.size() > 0) {
|
||||
Node* proj = if_proj_list.pop();
|
||||
float f = pf.to(proj);
|
||||
if (proj->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none) &&
|
||||
pf.to(proj) * loop_trip_cnt >= 1) {
|
||||
f * loop_trip_cnt >= 1) {
|
||||
hoisted = loop_predication_impl_helper(loop, proj->as_Proj(), profile_predicate_proj, cl, zero, invar, Deoptimization::Reason_profile_predicate) | hoisted;
|
||||
}
|
||||
}
|
||||
|
@ -946,19 +946,19 @@ Node *LoopNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
||||
|
||||
#ifdef ASSERT
|
||||
void LoopNode::verify_strip_mined(int expect_skeleton) const {
|
||||
if (!is_valid_counted_loop()) {
|
||||
return; // Skip malformed counted loop
|
||||
}
|
||||
const OuterStripMinedLoopNode* outer = NULL;
|
||||
const CountedLoopNode* inner = NULL;
|
||||
if (is_strip_mined()) {
|
||||
if (!is_valid_counted_loop()) {
|
||||
return; // Skip malformed counted loop
|
||||
}
|
||||
assert(is_CountedLoop(), "no Loop should be marked strip mined");
|
||||
inner = as_CountedLoop();
|
||||
outer = inner->in(LoopNode::EntryControl)->as_OuterStripMinedLoop();
|
||||
} else if (is_OuterStripMinedLoop()) {
|
||||
outer = this->as_OuterStripMinedLoop();
|
||||
inner = outer->unique_ctrl_out()->as_CountedLoop();
|
||||
assert(inner->is_valid_counted_loop(), "OuterStripMinedLoop should have been removed");
|
||||
assert(inner->is_valid_counted_loop() && inner->is_strip_mined(), "OuterStripMinedLoop should have been removed");
|
||||
assert(!is_strip_mined(), "outer loop shouldn't be marked strip mined");
|
||||
}
|
||||
if (inner != NULL || outer != NULL) {
|
||||
@ -1240,7 +1240,7 @@ Node* CountedLoopNode::match_incr_with_optional_truncation(
|
||||
}
|
||||
|
||||
LoopNode* CountedLoopNode::skip_strip_mined(int expect_skeleton) {
|
||||
if (is_strip_mined()) {
|
||||
if (is_strip_mined() && is_valid_counted_loop()) {
|
||||
verify_strip_mined(expect_skeleton);
|
||||
return in(EntryControl)->as_Loop();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2020, 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
|
||||
@ -90,7 +90,7 @@ public class LWLightweightFramePeer extends LWWindowPeer implements OverrideNati
|
||||
|
||||
@Override
|
||||
public void setBounds(int x, int y, int w, int h, int op) {
|
||||
setBounds(x, y, w, h, op, true, false);
|
||||
setBounds(x, y, w, h, op, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,10 +97,10 @@ public interface MemoryAddress {
|
||||
|
||||
/**
|
||||
* Perform bulk copy from source address to target address. More specifically, the bytes at addresses {@code src}
|
||||
* through {@code src.offset(bytes - 1)} are copied into addresses {@code dst} through {@code dst.offset(bytes - 1)}.
|
||||
* through {@code src.addOffset(bytes - 1)} are copied into addresses {@code dst} through {@code dst.addOffset(bytes - 1)}.
|
||||
* If the source and address ranges overlap, then the copying is performed as if the bytes at addresses {@code src}
|
||||
* through {@code src.offset(bytes - 1)} were first copied into a temporary segment with size {@code bytes},
|
||||
* and then the contents of the temporary segment were copied into the bytes at addresses {@code dst} through {@code dst.offset(bytes - 1)}.
|
||||
* through {@code src.addOffset(bytes - 1)} were first copied into a temporary segment with size {@code bytes},
|
||||
* and then the contents of the temporary segment were copied into the bytes at addresses {@code dst} through {@code dst.addOffset(bytes - 1)}.
|
||||
* @param src the source address.
|
||||
* @param dst the target address.
|
||||
* @param bytes the number of bytes to be copied.
|
||||
|
@ -110,7 +110,7 @@ SequenceLayout seq = MemoryLayout.ofSequence(5,
|
||||
*
|
||||
* We can obtain the offset of the member layout named <code>value</code> from <code>seq</code>, as follows:
|
||||
* <blockquote><pre>{@code
|
||||
long valueOffset = seq.offset(PathElement.sequenceElement(), PathElement.groupElement("value"));
|
||||
long valueOffset = seq.addOffset(PathElement.sequenceElement(), PathElement.groupElement("value"));
|
||||
* }</pre></blockquote>
|
||||
*
|
||||
* Similarly, we can select the member layout named {@code value}, as follows:
|
||||
|
@ -348,10 +348,9 @@ public interface MemorySegment extends AutoCloseable {
|
||||
allocateNative(layout.bytesSize(), layout.bytesAlignment());
|
||||
* }</pre></blockquote>
|
||||
*
|
||||
* @implNote The initialization state of the contents of the block of off-heap memory associated with the returned native memory
|
||||
* segment is unspecified and should not be relied upon. Moreover, a client is responsible to call the {@link MemorySegment#close()}
|
||||
* on a native memory segment, to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so
|
||||
* will result in off-heap memory leaks.
|
||||
* @implNote The block of off-heap memory associated with the returned native memory segment is initialized to zero.
|
||||
* Moreover, a client is responsible to call the {@link MemorySegment#close()} on a native memory segment,
|
||||
* to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so will result in off-heap memory leaks.
|
||||
*
|
||||
* @param layout the layout of the off-heap memory block backing the native memory segment.
|
||||
* @return a new native memory segment.
|
||||
@ -369,10 +368,9 @@ public interface MemorySegment extends AutoCloseable {
|
||||
allocateNative(bytesSize, 1);
|
||||
* }</pre></blockquote>
|
||||
*
|
||||
* @implNote The initialization state of the contents of the block of off-heap memory associated with the returned native memory
|
||||
* segment is unspecified and should not be relied upon. Moreover, a client is responsible to call the {@link MemorySegment#close()}
|
||||
* on a native memory segment, to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so
|
||||
* will result in off-heap memory leaks.
|
||||
* @implNote The block of off-heap memory associated with the returned native memory segment is initialized to zero.
|
||||
* Moreover, a client is responsible to call the {@link MemorySegment#close()} on a native memory segment,
|
||||
* to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so will result in off-heap memory leaks.
|
||||
*
|
||||
* @param bytesSize the size (in bytes) of the off-heap memory block backing the native memory segment.
|
||||
* @return a new native memory segment.
|
||||
@ -404,10 +402,9 @@ public interface MemorySegment extends AutoCloseable {
|
||||
* Creates a new native memory segment that models a newly allocated block of off-heap memory with given size and
|
||||
* alignment constraint (in bytes).
|
||||
*
|
||||
* @implNote The initialization state of the contents of the block of off-heap memory associated with the returned native memory
|
||||
* segment is unspecified and should not be relied upon. Moreover, a client is responsible to call the {@link MemorySegment#close()}
|
||||
* on a native memory segment, to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so
|
||||
* will result in off-heap memory leaks.
|
||||
* @implNote The block of off-heap memory associated with the returned native memory segment is initialized to zero.
|
||||
* Moreover, a client is responsible to call the {@link MemorySegment#close()} on a native memory segment,
|
||||
* to make sure the backing off-heap memory block is deallocated accordingly. Failure to do so will result in off-heap memory leaks.
|
||||
*
|
||||
* @param bytesSize the size (in bytes) of the off-heap memory block backing the native memory segment.
|
||||
* @param alignmentBytes the alignment constraint (in bytes) of the off-heap memory block backing the native memory segment.
|
||||
|
@ -33,7 +33,7 @@ static final VarHandle intHandle = MemoryHandles.varHandle(int.class, ByteOrder.
|
||||
try (MemorySegment segment = MemorySegment.allocateNative(10 * 4)) {
|
||||
MemoryAddress base = segment.baseAddress();
|
||||
for (long i = 0 ; i < 10 ; i++) {
|
||||
intHandle.set(base.offset(i * 4), (int)i);
|
||||
intHandle.set(base.addOffset(i * 4), (int)i);
|
||||
}
|
||||
}
|
||||
* }</pre>
|
||||
|
@ -35,6 +35,7 @@ import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
import javax.lang.model.type.ArrayType;
|
||||
import javax.lang.model.type.DeclaredType;
|
||||
import javax.lang.model.type.ExecutableType;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.type.TypeVariable;
|
||||
import javax.lang.model.util.SimpleTypeVisitor9;
|
||||
@ -141,10 +142,10 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
||||
* @param isVarArg true if this is a link to var arg.
|
||||
* @param tree the content tree to which the parameter information will be added.
|
||||
*/
|
||||
protected void addParam(ExecutableElement member, VariableElement param,
|
||||
protected void addParam(ExecutableElement member, VariableElement param, TypeMirror paramType,
|
||||
boolean isVarArg, Content tree) {
|
||||
Content link = writer.getLink(new LinkInfoImpl(configuration, EXECUTABLE_MEMBER_PARAM,
|
||||
param.asType()).varargs(isVarArg));
|
||||
paramType).varargs(isVarArg));
|
||||
tree.add(link);
|
||||
if(name(param).length() > 0) {
|
||||
tree.add(Entity.NO_BREAK_SPACE);
|
||||
@ -208,9 +209,11 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
||||
sep = "," + DocletConstants.NL;
|
||||
}
|
||||
int paramstart;
|
||||
ExecutableType instMeth = utils.asInstantiatedMethodType(typeElement, member);
|
||||
for (paramstart = 0; paramstart < parameters.size(); paramstart++) {
|
||||
paramTree.add(sep);
|
||||
VariableElement param = parameters.get(paramstart);
|
||||
TypeMirror paramType = instMeth.getParameterTypes().get(paramstart);
|
||||
|
||||
if (param.getKind() != ElementKind.INSTANCE_INIT) {
|
||||
if (includeAnnotations) {
|
||||
@ -220,7 +223,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
||||
paramTree.add(DocletConstants.NL);
|
||||
}
|
||||
}
|
||||
addParam(member, param,
|
||||
addParam(member, param, paramType,
|
||||
(paramstart == parameters.size() - 1) && member.isVarArgs(), paramTree);
|
||||
break;
|
||||
}
|
||||
@ -237,7 +240,8 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
||||
paramTree.add(DocletConstants.NL);
|
||||
}
|
||||
}
|
||||
addParam(member, parameters.get(i), (i == parameters.size() - 1) && member.isVarArgs(),
|
||||
addParam(member, parameters.get(i), instMeth.getParameterTypes().get(i),
|
||||
(i == parameters.size() - 1) && member.isVarArgs(),
|
||||
paramTree);
|
||||
}
|
||||
|
||||
@ -251,7 +255,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
||||
* @return the content tree containing the exceptions information.
|
||||
*/
|
||||
protected Content getExceptions(ExecutableElement member) {
|
||||
List<? extends TypeMirror> exceptions = member.getThrownTypes();
|
||||
List<? extends TypeMirror> exceptions = utils.asInstantiatedMethodType(typeElement, member).getThrownTypes();
|
||||
Content htmltree = new ContentBuilder();
|
||||
if (!exceptions.isEmpty()) {
|
||||
Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
|
||||
|
@ -247,7 +247,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
|
||||
if (utils.isConstructor(member))
|
||||
return null;
|
||||
if (utils.isExecutableElement(member))
|
||||
return utils.getReturnType((ExecutableElement)member);
|
||||
return utils.getReturnType(typeElement, (ExecutableElement)member);
|
||||
return member.asType();
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
|
||||
|
||||
private TypeMirror getType(Element member) {
|
||||
return utils.isExecutableElement(member)
|
||||
? utils.getReturnType((ExecutableElement) member)
|
||||
? utils.getReturnType(typeElement, (ExecutableElement) member)
|
||||
: member.asType();
|
||||
}
|
||||
}
|
||||
|
@ -204,6 +204,14 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
return getMemberTree(HtmlStyle.description, classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected TypeElement getCurrentPageElement() {
|
||||
return typeElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -114,7 +114,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
@Override
|
||||
public Content getSignature(VariableElement field) {
|
||||
return new MemberSignature(field)
|
||||
.addType(field.asType())
|
||||
.addType(utils.asInstantiatedFieldType(typeElement, field))
|
||||
.toContent();
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
*/
|
||||
@Override
|
||||
protected void addSummaryType(Element member, Content tdSummaryType) {
|
||||
addModifierAndType(member, member.asType(), tdSummaryType);
|
||||
addModifierAndType(member, utils.asInstantiatedFieldType(typeElement, (VariableElement)member), tdSummaryType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -860,6 +860,15 @@ public class HtmlDocletWriter {
|
||||
return (encl.isUnnamed()) ? "" : (encl.getQualifiedName() + ".");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the main type element of the current page or null for pages that don't have one.
|
||||
*
|
||||
* @return the type element of the current page.
|
||||
*/
|
||||
protected TypeElement getCurrentPageElement() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the class link, with only class name as the strong link and prefixing
|
||||
* plain package name.
|
||||
|
@ -277,7 +277,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
@Override
|
||||
protected void addSummaryType(Element member, Content tdSummaryType) {
|
||||
ExecutableElement meth = (ExecutableElement)member;
|
||||
addModifierAndType(meth, utils.getReturnType(meth), tdSummaryType);
|
||||
addModifierAndType(meth, utils.getReturnType(typeElement, meth), tdSummaryType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -373,7 +373,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
* @return content containing the return type
|
||||
*/
|
||||
protected Content getReturnType(ExecutableElement method) {
|
||||
TypeMirror type = utils.getReturnType(method);
|
||||
TypeMirror type = utils.getReturnType(typeElement, method);
|
||||
if (type != null) {
|
||||
return writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
@Override
|
||||
public Content getSignature(ExecutableElement property) {
|
||||
return new MemberSignature(property)
|
||||
.addType(utils.getReturnType(property))
|
||||
.addType(utils.getReturnType(typeElement, property))
|
||||
.toContent();
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
*/
|
||||
@Override
|
||||
protected void addSummaryType(Element member, Content tdSummaryType) {
|
||||
addModifierAndType(member, utils.getReturnType((ExecutableElement)member), tdSummaryType);
|
||||
addModifierAndType(member, utils.getReturnType(typeElement, (ExecutableElement)member), tdSummaryType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -341,12 +341,15 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content throwsTagOutput(Element element, DocTree throwsTag) {
|
||||
public Content throwsTagOutput(Element element, DocTree throwsTag, TypeMirror substituteType) {
|
||||
ContentBuilder body = new ContentBuilder();
|
||||
CommentHelper ch = utils.getCommentHelper(element);
|
||||
Element exception = ch.getException(configuration, throwsTag);
|
||||
Content excName;
|
||||
if (exception == null) {
|
||||
if (substituteType != null) {
|
||||
excName = htmlWriter.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER,
|
||||
substituteType));
|
||||
} else if (exception == null) {
|
||||
excName = new RawHtml(ch.getExceptionName(throwsTag).toString());
|
||||
} else if (exception.asType() == null) {
|
||||
excName = new RawHtml(utils.getFullyQualifiedName(exception));
|
||||
@ -415,6 +418,13 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected TypeElement getCurrentPageElement() {
|
||||
return htmlWriter.getCurrentPageElement();
|
||||
}
|
||||
|
||||
@SuppressWarnings("preview")
|
||||
private Content createAnchorAndSearchIndex(Element element, String tagText, String desc, boolean isSystemProperty) {
|
||||
Content result = null;
|
||||
|
@ -73,7 +73,7 @@ public class ReturnTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
public Content getTagletOutput(Element holder, TagletWriter writer) {
|
||||
Messages messages = writer.configuration().getMessages();
|
||||
Utils utils = writer.configuration().utils;
|
||||
TypeMirror returnType = utils.getReturnType((ExecutableElement)holder);
|
||||
TypeMirror returnType = utils.getReturnType(writer.getCurrentPageElement(), (ExecutableElement)holder);
|
||||
List<? extends DocTree> tags = utils.getBlockTags(holder, DocTree.Kind.RETURN);
|
||||
|
||||
//Make sure we are not using @return tag on method with void return type.
|
||||
|
@ -28,6 +28,7 @@ package jdk.javadoc.internal.doclets.toolkit.taglets;
|
||||
import java.util.List;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ElementKind;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
|
||||
@ -190,9 +191,10 @@ public abstract class TagletWriter {
|
||||
*
|
||||
* @param element
|
||||
* @param throwsTag the throws tag.
|
||||
* @param substituteType instantiated type of a generic type-variable, or null.
|
||||
* @return the output of the throws tag.
|
||||
*/
|
||||
protected abstract Content throwsTagOutput(Element element, DocTree throwsTag);
|
||||
protected abstract Content throwsTagOutput(Element element, DocTree throwsTag, TypeMirror substituteType);
|
||||
|
||||
/**
|
||||
* Return the output for the throws tag.
|
||||
@ -214,6 +216,13 @@ public abstract class TagletWriter {
|
||||
protected abstract Content valueTagOutput(VariableElement field,
|
||||
String constantVal, boolean includeLink);
|
||||
|
||||
/**
|
||||
* Return the main type element of the current page or null for pages that don't have one.
|
||||
*
|
||||
* @return the type element of the current page or null.
|
||||
*/
|
||||
protected abstract TypeElement getCurrentPageElement();
|
||||
|
||||
/**
|
||||
* Given an output object, append to it the tag documentation for
|
||||
* the given member.
|
||||
|
@ -25,8 +25,11 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.toolkit.taglets;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -36,6 +39,7 @@ import java.util.Set;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.type.ExecutableType;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
|
||||
import com.sun.source.doctree.DocTree;
|
||||
@ -104,8 +108,8 @@ public class ThrowsTaglet extends BaseTaglet
|
||||
for (TypeMirror declaredExceptionType : declaredExceptionTypes) {
|
||||
TypeElement klass = utils.asTypeElement(declaredExceptionType);
|
||||
if (klass != null &&
|
||||
!alreadyDocumented.contains(utils.getSimpleName(klass)) &&
|
||||
!alreadyDocumented.contains(utils.getFullyQualifiedName(klass))) {
|
||||
!alreadyDocumented.contains(declaredExceptionType.toString()) &&
|
||||
!alreadyDocumented.contains(utils.getFullyQualifiedName(klass, false))) {
|
||||
if (alreadyDocumented.isEmpty()) {
|
||||
result.add(writer.getThrowsHeader());
|
||||
}
|
||||
@ -122,7 +126,7 @@ public class ThrowsTaglet extends BaseTaglet
|
||||
*/
|
||||
private Content inheritThrowsDocumentation(Element holder,
|
||||
List<? extends TypeMirror> declaredExceptionTypes, Set<String> alreadyDocumented,
|
||||
TagletWriter writer) {
|
||||
Map<String, TypeMirror> typeSubstitutions, TagletWriter writer) {
|
||||
Utils utils = writer.configuration().utils;
|
||||
Content result = writer.getOutputInstance();
|
||||
if (utils.isExecutableElement(holder)) {
|
||||
@ -143,7 +147,8 @@ public class ThrowsTaglet extends BaseTaglet
|
||||
declaredExceptionTags.put(inheritedDoc.tagList, (ExecutableElement)inheritedDoc.holder);
|
||||
}
|
||||
}
|
||||
result.add(throwsTagsOutput(declaredExceptionTags, writer, alreadyDocumented, false));
|
||||
result.add(throwsTagsOutput(declaredExceptionTags, writer, alreadyDocumented,
|
||||
typeSubstitutions, false));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -154,17 +159,21 @@ public class ThrowsTaglet extends BaseTaglet
|
||||
public Content getTagletOutput(Element holder, TagletWriter writer) {
|
||||
Utils utils = writer.configuration().utils;
|
||||
ExecutableElement execHolder = (ExecutableElement) holder;
|
||||
ExecutableType instantiatedType = utils.asInstantiatedMethodType(
|
||||
writer.getCurrentPageElement(), (ExecutableElement)holder);
|
||||
List<? extends TypeMirror> thrownTypes = instantiatedType.getThrownTypes();
|
||||
Map<String, TypeMirror> typeSubstitutions = getSubstitutedThrownTypes(
|
||||
((ExecutableElement) holder).getThrownTypes(), thrownTypes);
|
||||
Map<List<? extends DocTree>, ExecutableElement> tagsMap = new LinkedHashMap<>();
|
||||
tagsMap.put(utils.getThrowsTrees(execHolder), execHolder);
|
||||
Content result = writer.getOutputInstance();
|
||||
HashSet<String> alreadyDocumented = new HashSet<>();
|
||||
if (!tagsMap.isEmpty()) {
|
||||
result.add(throwsTagsOutput(tagsMap, writer, alreadyDocumented, true));
|
||||
result.add(throwsTagsOutput(tagsMap, writer, alreadyDocumented, typeSubstitutions, true));
|
||||
}
|
||||
result.add(inheritThrowsDocumentation(holder,
|
||||
execHolder.getThrownTypes(), alreadyDocumented, writer));
|
||||
result.add(linkToUndocumentedDeclaredExceptions(
|
||||
execHolder.getThrownTypes(), alreadyDocumented, writer));
|
||||
thrownTypes, alreadyDocumented, typeSubstitutions, writer));
|
||||
result.add(linkToUndocumentedDeclaredExceptions(thrownTypes, alreadyDocumented, writer));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -179,7 +188,8 @@ public class ThrowsTaglet extends BaseTaglet
|
||||
* @return the Content representation of this <code>Tag</code>.
|
||||
*/
|
||||
protected Content throwsTagsOutput(Map<List<? extends DocTree>, ExecutableElement> throwTags,
|
||||
TagletWriter writer, Set<String> alreadyDocumented, boolean allowDups) {
|
||||
TagletWriter writer, Set<String> alreadyDocumented,
|
||||
Map<String,TypeMirror> typeSubstitutions, boolean allowDups) {
|
||||
Utils utils = writer.configuration().utils;
|
||||
Content result = writer.getOutputInstance();
|
||||
if (!throwTags.isEmpty()) {
|
||||
@ -189,21 +199,52 @@ public class ThrowsTaglet extends BaseTaglet
|
||||
for (DocTree dt : entry.getKey()) {
|
||||
Element te = ch.getException(utils.configuration, dt);
|
||||
String excName = ch.getExceptionName(dt).toString();
|
||||
TypeMirror substituteType = typeSubstitutions.get(excName);
|
||||
if ((!allowDups) &&
|
||||
(alreadyDocumented.contains(excName) ||
|
||||
(te != null && alreadyDocumented.contains(utils.getFullyQualifiedName(te))))) {
|
||||
(te != null && alreadyDocumented.contains(utils.getFullyQualifiedName(te, false)))) ||
|
||||
(substituteType != null && alreadyDocumented.contains(substituteType.toString()))) {
|
||||
continue;
|
||||
}
|
||||
if (alreadyDocumented.isEmpty()) {
|
||||
result.add(writer.getThrowsHeader());
|
||||
}
|
||||
result.add(writer.throwsTagOutput(e, dt));
|
||||
alreadyDocumented.add(te != null
|
||||
? utils.getFullyQualifiedName(te)
|
||||
: excName);
|
||||
result.add(writer.throwsTagOutput(e, dt, substituteType));
|
||||
if (substituteType != null) {
|
||||
alreadyDocumented.add(substituteType.toString());
|
||||
} else {
|
||||
alreadyDocumented.add(te != null
|
||||
? utils.getFullyQualifiedName(te, false)
|
||||
: excName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of substitutions for a list of thrown types with the original type-variable
|
||||
* name as key and the instantiated type as value. If no types need to be substituted
|
||||
* an empty map is returned.
|
||||
* @param declaredThrownTypes the originally declared thrown types.
|
||||
* @param instantiatedThrownTypes the thrown types in the context of the current type.
|
||||
* @return map of declared to instantiated thrown types or an empty map.
|
||||
*/
|
||||
private Map<String, TypeMirror> getSubstitutedThrownTypes(List<? extends TypeMirror> declaredThrownTypes,
|
||||
List<? extends TypeMirror> instantiatedThrownTypes) {
|
||||
if (!instantiatedThrownTypes.equals(declaredThrownTypes)) {
|
||||
Map<String, TypeMirror> map = new HashMap<>();
|
||||
Iterator<? extends TypeMirror> i1 = instantiatedThrownTypes.iterator();
|
||||
Iterator<? extends TypeMirror> i2 = declaredThrownTypes.iterator();
|
||||
while (i1.hasNext() && i2.hasNext()) {
|
||||
TypeMirror t1 = i1.next();
|
||||
TypeMirror t2 = i2.next();
|
||||
if (!t1.equals(t2))
|
||||
map.put(t2.toString(), t1);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public class Utils {
|
||||
* @return true if t1 is a superclass of t2.
|
||||
*/
|
||||
public boolean isSubclassOf(TypeElement t1, TypeElement t2) {
|
||||
return typeUtils.isSubtype(t1.asType(), t2.asType());
|
||||
return typeUtils.isSubtype(typeUtils.erasure(t1.asType()), typeUtils.erasure(t2.asType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -569,7 +569,8 @@ public class Utils {
|
||||
}
|
||||
|
||||
public boolean isUndocumentedEnclosure(TypeElement enclosingTypeElement) {
|
||||
return isPackagePrivate(enclosingTypeElement) && !isLinkable(enclosingTypeElement);
|
||||
return (isPackagePrivate(enclosingTypeElement) || isPrivate(enclosingTypeElement))
|
||||
&& !isLinkable(enclosingTypeElement);
|
||||
}
|
||||
|
||||
public boolean isError(TypeElement te) {
|
||||
@ -800,13 +801,51 @@ public class Utils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TypeMirror of the ExecutableElement for all methods,
|
||||
* a null if constructor.
|
||||
* Returns the TypeMirror of the ExecutableElement if it is a method, or null
|
||||
* if it is a constructor.
|
||||
* @param site the contextual type
|
||||
* @param ee the ExecutableElement
|
||||
* @return
|
||||
* @return the return type
|
||||
*/
|
||||
public TypeMirror getReturnType(ExecutableElement ee) {
|
||||
return ee.getKind() == CONSTRUCTOR ? null : ee.getReturnType();
|
||||
public TypeMirror getReturnType(TypeElement site, ExecutableElement ee) {
|
||||
return ee.getKind() == CONSTRUCTOR ? null : asInstantiatedMethodType(site, ee).getReturnType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ExecutableType corresponding to the type of the method declaration seen as a
|
||||
* member of a given declared type. This might cause type-variable substitution to kick in.
|
||||
* @param site the contextual type.
|
||||
* @param ee the method declaration.
|
||||
* @return the instantiated method type.
|
||||
*/
|
||||
public ExecutableType asInstantiatedMethodType(TypeElement site, ExecutableElement ee) {
|
||||
return shouldInstantiate(site, ee) ?
|
||||
(ExecutableType)typeUtils.asMemberOf((DeclaredType)site.asType(), ee) :
|
||||
(ExecutableType)ee.asType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TypeMirror corresponding to the type of the field declaration seen as a
|
||||
* member of a given declared type. This might cause type-variable substitution to kick in.
|
||||
* @param site the contextual type.
|
||||
* @param ve the field declaration.
|
||||
* @return the instantiated field type.
|
||||
*/
|
||||
public TypeMirror asInstantiatedFieldType(TypeElement site, VariableElement ve) {
|
||||
return shouldInstantiate(site, ve) ?
|
||||
typeUtils.asMemberOf((DeclaredType)site.asType(), ve) :
|
||||
ve.asType();
|
||||
}
|
||||
|
||||
/*
|
||||
* We should not instantiate if (i) there's no contextual type declaration, (ii) the declaration
|
||||
* to which the member belongs to is the same as the one under consideration, (iii) if the
|
||||
* delcaration to which the member belongs to is not generic.
|
||||
*/
|
||||
private boolean shouldInstantiate(TypeElement site, Element e) {
|
||||
return site != null &&
|
||||
site != e.getEnclosingElement() &&
|
||||
!((DeclaredType)e.getEnclosingElement().asType()).getTypeArguments().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
175
test/jdk/javax/swing/JLightweightFrame/ResizedMovedEvents.java
Normal file
175
test/jdk/javax/swing/JLightweightFrame/ResizedMovedEvents.java
Normal file
@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 8236953
|
||||
* @summary JavaFX SwingNode is not rendered on macOS
|
||||
* @modules java.desktop/sun.swing
|
||||
*/
|
||||
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import sun.swing.JLightweightFrame;
|
||||
import sun.swing.LightweightContent;
|
||||
|
||||
public final class ResizedMovedEvents {
|
||||
|
||||
private static final AtomicInteger resized = new AtomicInteger();
|
||||
private static final AtomicInteger moved = new AtomicInteger();
|
||||
private static JLightweightFrame jLightweightFrame;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
emulateSwingNode(true); // emulate visible node
|
||||
emulateSwingNode(false); // emulate invisible node
|
||||
}
|
||||
|
||||
private static void emulateSwingNode(boolean visible) throws Exception {
|
||||
try {
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
jLightweightFrame = new JLightweightFrame();
|
||||
jLightweightFrame.setContent(new XLightweightContent());
|
||||
jLightweightFrame.addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
resized.incrementAndGet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) {
|
||||
moved.incrementAndGet();
|
||||
}
|
||||
});
|
||||
jLightweightFrame.setVisible(visible);
|
||||
});
|
||||
|
||||
// Some dummy initial location
|
||||
setBounds(10, 10, 10, 10);
|
||||
|
||||
// resize and move
|
||||
resetFlags();
|
||||
setBounds(100, 100, 100, 100);
|
||||
checkFlags(1, 1);
|
||||
|
||||
// resize only
|
||||
resetFlags();
|
||||
setBounds(100, 100, 200, 200);
|
||||
checkFlags(1, 0);
|
||||
|
||||
// move only
|
||||
resetFlags();
|
||||
setBounds(200, 200, 200, 200);
|
||||
checkFlags(0, 1);
|
||||
} finally {
|
||||
if (jLightweightFrame != null) jLightweightFrame.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setBounds(int x, int y, int w, int h) throws Exception {
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
jLightweightFrame.setBounds(x, y, w, h);
|
||||
});
|
||||
EventQueue.invokeAndWait(() -> {
|
||||
// dummy event to flush the EventQueue
|
||||
});
|
||||
}
|
||||
|
||||
private static void resetFlags() {
|
||||
resized.set(0);
|
||||
moved.set(0);
|
||||
}
|
||||
|
||||
private static void checkFlags(int expectedR, int expectedM) {
|
||||
int actualR = resized.get();
|
||||
int actualM = moved.get();
|
||||
//
|
||||
if (actualR < expectedR) {
|
||||
System.err.println("Expected: " + expectedR);
|
||||
System.err.println("Actual: " + actualR);
|
||||
throw new RuntimeException("Wrong number of COMPONENT_RESIZED");
|
||||
}
|
||||
if (actualM < expectedM) {
|
||||
System.err.println("Expected: " + expectedM);
|
||||
System.err.println("Actual: " + actualM);
|
||||
throw new RuntimeException("Wrong number of COMPONENT_MOVED");
|
||||
}
|
||||
}
|
||||
|
||||
static final class XLightweightContent implements LightweightContent {
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return new JPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintLock() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintUnlock() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void imageBufferReset(int[] data, int x, int y, int width,
|
||||
int height, int linestride,
|
||||
double scaleX,
|
||||
double scaleY) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void imageReshaped(int x, int y, int width, int height) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void imageUpdated(int dirtyX, int dirtyY, int dirtyWidth,
|
||||
int dirtyHeight) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGrabbed() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusUngrabbed() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preferredSizeChanged(int width, int height) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maximumSizeChanged(int width, int height) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void minimumSizeChanged(int width, int height) {
|
||||
}
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4638588 4635809 6256068 6270645 8025633 8026567 8162363 8175200
|
||||
* 8192850 8182765 8220217
|
||||
* 8192850 8182765 8220217 8224052
|
||||
* @summary Test to make sure that members are inherited properly in the Javadoc.
|
||||
* Verify that inheritance labels are correct.
|
||||
* @library ../../lib
|
||||
@ -46,7 +46,7 @@ public class TestMemberInheritance extends JavadocTester {
|
||||
public void test() {
|
||||
javadoc("-d", "out",
|
||||
"-sourcepath", testSrc,
|
||||
"pkg", "diamond", "inheritDist", "pkg1", "pkg2");
|
||||
"pkg", "diamond", "inheritDist", "pkg1", "pkg2", "pkg3");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOutput("pkg/SubClass.html", true,
|
||||
@ -114,17 +114,52 @@ public class TestMemberInheritance extends JavadocTester {
|
||||
checkOutput("pkg2/DocumentedNonGenericChild.html", true,
|
||||
"<td class=\"colFirst\"><code>protected abstract java.lang.String</code></td>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
|
||||
+ "<a href=\"#parentMethod()\">parentMethod</a></span>()</code></th>\n"
|
||||
+ "<a href=\"#parentMethod(T)\">parentMethod</a></span>​(java.lang.String t)</code></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">Returns some value.</div>\n"
|
||||
+ "</td>\n");
|
||||
|
||||
checkOutput("pkg2/DocumentedNonGenericChild.html", true,
|
||||
"<section class=\"detail\" id=\"parentMethod()\">\n"
|
||||
+ "<h3>parentMethod</h3>\n"
|
||||
"<section class=\"detail\" id=\"parentMethod(T)\">\n"
|
||||
+ "<h3 id=\"parentMethod(java.lang.Object)\">parentMethod</h3>\n"
|
||||
+ "<div class=\"memberSignature\"><span class=\"modifiers\">protected abstract</span>"
|
||||
+ " <span class=\"returnType\">java.lang.String</span> "
|
||||
+ "<span class=\"memberName\">parentMethod</span>()</div>");
|
||||
+ "<span class=\"memberName\">parentMethod</span>​"
|
||||
+ "(<span class=\"arguments\">java.lang.String t)</span>\n"
|
||||
+ " "
|
||||
+ "throws <span class=\"exceptions\">java.lang.IllegalArgumentException,\n"
|
||||
+ "java.lang.InterruptedException,\n"
|
||||
+ "java.lang.IllegalStateException</span></div>");
|
||||
|
||||
checkOutput("pkg2/DocumentedNonGenericChild.html", true,
|
||||
"<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
|
||||
+ "<dd><code>java.lang.InterruptedException</code> - a generic error</dd>\n"
|
||||
+ "<dd><code>java.lang.IllegalStateException</code> - illegal state</dd>\n"
|
||||
+ "<dd><code>java.lang.IllegalArgumentException</code></dd>");
|
||||
|
||||
checkOutput("pkg2/DocumentedNonGenericChild.html", true,
|
||||
"<td class=\"colFirst\"><code>java.lang.String</code></td>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
|
||||
+ "<a href=\"#f\">f</a></span></code></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">A field.</div>",
|
||||
"<section class=\"detail\" id=\"f\">\n"
|
||||
+ "<h3>f</h3>\n"
|
||||
+ "<div class=\"memberSignature\"><span class=\"modifiers\">public</span> "
|
||||
+ "<span class=\"returnType\">java.lang.String</span> <span class=\"memberName\">f</span></div>\n"
|
||||
+ "<div class=\"block\">A field.</div>\n"
|
||||
+ "</section>");
|
||||
|
||||
checkOutput("pkg3/PrivateGenericParent.PublicChild.html", true,
|
||||
"<td class=\"colFirst\"><code>java.lang.String</code></td>\n"
|
||||
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
|
||||
+ "<a href=\"#method(T)\">method</a></span>​(java.lang.String t)</code></th>",
|
||||
"<section class=\"detail\" id=\"method(T)\">\n"
|
||||
+ "<h3 id=\"method(java.lang.Object)\">method</h3>\n"
|
||||
+ "<div class=\"memberSignature\"><span class=\"modifiers\">public</span>"
|
||||
+ " <span class=\"returnType\">java.lang.String</span> "
|
||||
+ "<span class=\"memberName\">method</span>​(<span class=\"arguments\">"
|
||||
+ "java.lang.String t)</span></div>\n"
|
||||
+ "</section>");
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,6 @@
|
||||
|
||||
package pkg2;
|
||||
|
||||
public abstract class DocumentedNonGenericChild extends UndocumentedGenericParent<String> {
|
||||
public abstract class DocumentedNonGenericChild extends UndocumentedGenericParent<String, InterruptedException, IllegalArgumentException> {
|
||||
|
||||
}
|
||||
|
@ -23,11 +23,19 @@
|
||||
|
||||
package pkg2;
|
||||
|
||||
abstract class UndocumentedGenericParent<T> {
|
||||
abstract class UndocumentedGenericParent<T, E extends Throwable, F extends Throwable> {
|
||||
/**
|
||||
* A field.
|
||||
*/
|
||||
public T f;
|
||||
|
||||
/**
|
||||
* Returns some value.
|
||||
*
|
||||
* @param t a parameter
|
||||
* @return some value
|
||||
* @throws E a generic error
|
||||
* @throws IllegalStateException illegal state
|
||||
*/
|
||||
protected abstract String parentMethod();
|
||||
protected abstract T parentMethod(T t) throws F, E, IllegalStateException;
|
||||
}
|
||||
|
35
test/langtools/jdk/javadoc/doclet/testMemberInheritance/pkg3/PrivateGenericParent.java
Normal file
35
test/langtools/jdk/javadoc/doclet/testMemberInheritance/pkg3/PrivateGenericParent.java
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package pkg3;
|
||||
|
||||
public class PrivateGenericParent {
|
||||
|
||||
private static class PrivateParent<T> {
|
||||
public T method(T t) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
public class PublicChild extends PrivateParent<String> {}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user