Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8277028: Use service type documentation as fallback for @provides #6387

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -763,12 +763,14 @@ public void addProvidesList(Table table) {
Content desc = new ContentBuilder();
if (display(providesTrees)) {
description = providesTrees.get(srv);
desc.add((description != null && !description.isEmpty())
? HtmlTree.DIV(HtmlStyle.block, description)
: Entity.NO_BREAK_SPACE);
if (description != null && !description.isEmpty()) {
desc.add(HtmlTree.DIV(HtmlStyle.block, description));
} else {
addSummaryComment(srv, desc);
}
} else {
desc.add(Entity.NO_BREAK_SPACE);
}
}
// Only display the implementation details in the "all" mode.
if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) {
desc.add(new HtmlTree(TagName.BR));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
Expand All @@ -23,7 +23,7 @@

/*
* @test
* @bug 8178067 8192007 8182765 8184205
* @bug 8178067 8192007 8182765 8184205 8277028
* @summary tests the module's services, such as provides and uses
* @modules jdk.javadoc/jdk.javadoc.internal.api
* jdk.javadoc/jdk.javadoc.internal.tool
Expand Down Expand Up @@ -93,6 +93,26 @@ public void testMethod1() {}
public void testMethod2() {}
}""");
mb.write(src);
mb = new ModuleBuilder(tb, "moduleServiceProviderNoDescription")
.comment("""
This is another module that provides an implementation of a service.
@provides pkgService.Service""")
.requires("moduleService")
.provides("pkgService.Service", "pkgServiceProviderNoDesc.ServiceProviderNoDescription")
.classes("/**A Package that has a service provider.*/ package pkgServiceProviderNoDesc;")
.classes("""
package pkgServiceProviderNoDesc;
public class ServiceProviderNoDescription implements pkgService.Service {
/**
* {@inheritDoc}
*/
public void testMethod1() {}
/**
* This is an internal implementation so the documentation will not be seen.
*/
public void testMethod2() {}
}""");
mb.write(src);
mb = new ModuleBuilder(tb, "moduleServiceUser")
.comment("""
This module uses a service defined in another module.
Expand Down Expand Up @@ -128,7 +148,8 @@ public class ServiceUserNoDescription {
"-quiet",
"-noindex",
"--module-source-path", src.toString(),
"--module", "moduleService,moduleServiceProvider,moduleServiceUser,moduleServiceUserNoDescription",
"--module", "moduleService,moduleServiceProvider,moduleServiceProviderNoDescription",
"--module", "moduleServiceUser,moduleServiceUserNoDescription",
"pkgService", "moduleServiceProvider/pkgServiceProvider", "moduleServiceUser/pkgServiceUser",
"moduleServiceUserNoDescription/pkgServiceUserNoDescription");
checkExit(Exit.OK);
Expand All @@ -139,6 +160,12 @@ public class ServiceUserNoDescription {
ml" title="interface in pkgService">Service</a></div>
<div class="col-last even-row-color">
<div class="block">Provides a service whose name is ServiceProvider.</div>""");
checkOutput("moduleServiceProviderNoDescription/module-summary.html", true,
"""
<div class="col-first even-row-color"><a href="../moduleService/pkgService/Service.ht\
ml" title="interface in pkgService">Service</a></div>
<div class="col-last even-row-color">
<div class="block">A service Interface for service providers.</div>""");
checkOutput("moduleServiceUser/module-summary.html", true,
"""
<div class="col-first even-row-color"><a href="../moduleService/pkgService/Service.ht\
Expand Down