mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-12 06:29:37 +00:00
Merge
This commit is contained in:
commit
4eedc33696
@ -107,6 +107,8 @@ public class MutableFieldsAnalyzer extends AbstractCodingRulesAnalyzer {
|
||||
"layerClass", "bootMethod", "defineModulesWithOneLoaderMethod", "configurationMethod");
|
||||
ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$ServiceLoaderHelper",
|
||||
"loadMethod");
|
||||
ignoreFields("com.sun.tools.javac.util.JDK9Wrappers$VMHelper",
|
||||
"vmClass", "getRuntimeArgumentsMethod");
|
||||
ignoreFields("com.sun.tools.javac.util.ModuleHelper",
|
||||
"addExportsMethod", "getUnnamedModuleMethod", "getModuleMethod");
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2016, 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
|
||||
@ -57,7 +57,7 @@ public interface DocumentationTool extends Tool, OptionChecker {
|
||||
* use the tool's default method for reporting diagnostics
|
||||
*
|
||||
* @param docletClass a class providing the necessary methods required
|
||||
* of a doclet
|
||||
* of a doclet; a value of {@code null} means to use the standard doclet.
|
||||
*
|
||||
* @param options documentation tool options and doclet options,
|
||||
* {@code null} means no options
|
||||
|
||||
@ -179,10 +179,10 @@ public final class JavacTool implements JavaCompiler {
|
||||
args.init("javac", options, classes, compilationUnits);
|
||||
|
||||
// init multi-release jar handling
|
||||
if (fileManager.isSupportedOption(Option.MULTIRELEASE.text) == 1) {
|
||||
if (fileManager.isSupportedOption(Option.MULTIRELEASE.primaryName) == 1) {
|
||||
Target target = Target.instance(context);
|
||||
List<String> list = List.of(target.multiReleaseValue());
|
||||
fileManager.handleOption(Option.MULTIRELEASE.text, list.iterator());
|
||||
fileManager.handleOption(Option.MULTIRELEASE.primaryName, list.iterator());
|
||||
}
|
||||
|
||||
return new JavacTaskImpl(context);
|
||||
@ -212,8 +212,9 @@ public final class JavacTool implements JavaCompiler {
|
||||
public int isSupportedOption(String option) {
|
||||
Set<Option> recognizedOptions = Option.getJavacToolOptions();
|
||||
for (Option o : recognizedOptions) {
|
||||
if (o.matches(option))
|
||||
if (o.matches(option)) {
|
||||
return o.hasArg() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -51,6 +51,7 @@ import com.sun.tools.javac.file.JRTIndex;
|
||||
import com.sun.tools.javac.file.JavacFileManager;
|
||||
import com.sun.tools.javac.jvm.ClassReader;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.javac.main.Option;
|
||||
import com.sun.tools.javac.platform.PlatformDescription;
|
||||
import com.sun.tools.javac.util.*;
|
||||
|
||||
@ -59,8 +60,6 @@ import static javax.tools.StandardLocation.*;
|
||||
import static com.sun.tools.javac.code.Flags.*;
|
||||
import static com.sun.tools.javac.code.Kinds.Kind.*;
|
||||
|
||||
import static com.sun.tools.javac.main.Option.*;
|
||||
|
||||
import com.sun.tools.javac.util.Dependencies.CompletionCause;
|
||||
|
||||
/**
|
||||
@ -200,10 +199,10 @@ public class ClassFinder {
|
||||
annotate = Annotate.instance(context);
|
||||
|
||||
Options options = Options.instance(context);
|
||||
verbose = options.isSet(VERBOSE);
|
||||
verbose = options.isSet(Option.VERBOSE);
|
||||
cacheCompletionFailure = options.isUnset("dev");
|
||||
preferSource = "source".equals(options.get("-Xprefer"));
|
||||
userPathsFirst = options.isSet(XXUSERPATHSFIRST);
|
||||
userPathsFirst = options.isSet(Option.XXUSERPATHSFIRST);
|
||||
allowSigFiles = context.get(PlatformDescription.class) != null;
|
||||
|
||||
completionFailureName =
|
||||
@ -211,7 +210,7 @@ public class ClassFinder {
|
||||
? names.fromString(options.get("failcomplete"))
|
||||
: null;
|
||||
|
||||
moduleOverride = options.isSet(XMODULE) ? names.fromString(options.get(XMODULE))
|
||||
moduleOverride = options.isSet(Option.XMODULE) ? names.fromString(options.get(Option.XMODULE))
|
||||
: null;
|
||||
|
||||
// Temporary, until more info is available from the module system.
|
||||
|
||||
@ -3184,11 +3184,13 @@ public class Lower extends TreeTranslator {
|
||||
}
|
||||
|
||||
public void visitAssignop(final JCAssignOp tree) {
|
||||
JCTree lhsAccess = access(TreeInfo.skipParens(tree.lhs));
|
||||
final boolean boxingReq = !tree.lhs.type.isPrimitive() &&
|
||||
tree.operator.type.getReturnType().isPrimitive();
|
||||
|
||||
if (boxingReq || lhsAccess.hasTag(APPLY)) {
|
||||
AssignopDependencyScanner depScanner = new AssignopDependencyScanner(tree);
|
||||
depScanner.scan(tree.rhs);
|
||||
|
||||
if (boxingReq || depScanner.dependencyFound) {
|
||||
// boxing required; need to rewrite as x = (unbox typeof x)(x op y);
|
||||
// or if x == (typeof x)z then z = (unbox typeof x)((typeof x)z op y)
|
||||
// (but without recomputing x)
|
||||
@ -3238,6 +3240,41 @@ public class Lower extends TreeTranslator {
|
||||
}
|
||||
}
|
||||
|
||||
class AssignopDependencyScanner extends TreeScanner {
|
||||
|
||||
Symbol sym;
|
||||
boolean dependencyFound = false;
|
||||
|
||||
AssignopDependencyScanner(JCAssignOp tree) {
|
||||
this.sym = TreeInfo.symbol(tree.lhs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scan(JCTree tree) {
|
||||
if (tree != null && sym != null) {
|
||||
tree.accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitAssignop(JCAssignOp tree) {
|
||||
if (TreeInfo.symbol(tree.lhs) == sym) {
|
||||
dependencyFound = true;
|
||||
return;
|
||||
}
|
||||
super.visitAssignop(tree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitUnary(JCUnary tree) {
|
||||
if (TreeInfo.symbol(tree.arg) == sym) {
|
||||
dependencyFound = true;
|
||||
return;
|
||||
}
|
||||
super.visitUnary(tree);
|
||||
}
|
||||
}
|
||||
|
||||
/** Lower a tree of the form e++ or e-- where e is an object type */
|
||||
JCExpression lowerBoxedPostop(final JCUnary tree) {
|
||||
// translate to tmp1=lval(e); tmp2=tmp1; tmp1 OP 1; tmp2
|
||||
|
||||
@ -147,7 +147,9 @@ public class Modules extends JCTree.Visitor {
|
||||
private final String addReadsOpt;
|
||||
private Map<ModuleSymbol, Set<RequiresDirective>> addReads;
|
||||
private final String addModsOpt;
|
||||
private final Set<String> extraAddMods = new HashSet<>();
|
||||
private final String limitModsOpt;
|
||||
private final Set<String> extraLimitMods = new HashSet<>();
|
||||
|
||||
private Set<ModuleSymbol> rootModules = null;
|
||||
|
||||
@ -182,10 +184,10 @@ public class Modules extends JCTree.Visitor {
|
||||
java_se = names.fromString("java.se");
|
||||
java_ = names.fromString("java.");
|
||||
|
||||
addExportsOpt = options.get(Option.XADDEXPORTS);
|
||||
addReadsOpt = options.get(Option.XADDREADS);
|
||||
addModsOpt = options.get(Option.ADDMODS);
|
||||
limitModsOpt = options.get(Option.LIMITMODS);
|
||||
addExportsOpt = options.get(Option.ADD_EXPORTS);
|
||||
addReadsOpt = options.get(Option.ADD_READS);
|
||||
addModsOpt = options.get(Option.ADD_MODULES);
|
||||
limitModsOpt = options.get(Option.LIMIT_MODULES);
|
||||
}
|
||||
|
||||
int depth = -1;
|
||||
@ -195,8 +197,16 @@ public class Modules extends JCTree.Visitor {
|
||||
System.err.println(msg);
|
||||
}
|
||||
|
||||
public void addExtraAddModules(String... extras) {
|
||||
extraAddMods.addAll(Arrays.asList(extras));
|
||||
}
|
||||
|
||||
public void addExtraLimitModules(String... extras) {
|
||||
extraLimitMods.addAll(Arrays.asList(extras));
|
||||
}
|
||||
|
||||
boolean inInitModules;
|
||||
public void initModules(List<JCCompilationUnit> trees, Collection<String> extraAddMods, Collection<String> extraLimitMods) {
|
||||
public void initModules(List<JCCompilationUnit> trees) {
|
||||
Assert.check(!inInitModules);
|
||||
try {
|
||||
inInitModules = true;
|
||||
@ -205,7 +215,7 @@ public class Modules extends JCTree.Visitor {
|
||||
Assert.checkNull(rootModules);
|
||||
Assert.checkNull(allModules);
|
||||
this.rootModules = modules;
|
||||
setupAllModules(extraAddMods, extraLimitMods); //initialize the module graph
|
||||
setupAllModules(); //initialize the module graph
|
||||
Assert.checkNonNull(allModules);
|
||||
inInitModules = false;
|
||||
}, null);
|
||||
@ -862,7 +872,7 @@ public class Modules extends JCTree.Visitor {
|
||||
return allModules;
|
||||
}
|
||||
|
||||
private void setupAllModules(Collection<String> extraAddMods, Collection<String> extraLimitMods) {
|
||||
private void setupAllModules() {
|
||||
Assert.checkNonNull(rootModules);
|
||||
Assert.checkNull(allModules);
|
||||
|
||||
|
||||
@ -232,7 +232,7 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
OptionHelper helper = new GrumpyHelper(log) {
|
||||
@Override
|
||||
public String get(Option option) {
|
||||
return options.get(option.getText());
|
||||
return options.get(option);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -251,23 +251,15 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
}
|
||||
};
|
||||
|
||||
for (Option o: javacFileManagerOptions) {
|
||||
if (o.matches(current)) {
|
||||
if (o.hasArg()) {
|
||||
if (remaining.hasNext()) {
|
||||
if (!o.process(helper, current, remaining.next()))
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (!o.process(helper, current))
|
||||
return true;
|
||||
}
|
||||
// operand missing, or process returned true
|
||||
throw new IllegalArgumentException(current);
|
||||
}
|
||||
Option o = Option.lookup(current, javacFileManagerOptions);
|
||||
if (o == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (!o.handleOption(helper, current, remaining))
|
||||
throw new IllegalArgumentException(current);
|
||||
|
||||
return true;
|
||||
}
|
||||
// where
|
||||
private static final Set<Option> javacFileManagerOptions =
|
||||
@ -275,11 +267,8 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER)
|
||||
public int isSupportedOption(String option) {
|
||||
for (Option o : javacFileManagerOptions) {
|
||||
if (o.matches(option))
|
||||
return o.hasArg() ? 1 : 0;
|
||||
}
|
||||
return -1;
|
||||
Option o = Option.lookup(option, javacFileManagerOptions);
|
||||
return (o == null) ? -1 : o.hasArg() ? 1 : 0;
|
||||
}
|
||||
|
||||
protected String multiReleaseValue;
|
||||
@ -316,7 +305,7 @@ public abstract class BaseFileManager implements JavaFileManager {
|
||||
try {
|
||||
ok = ok & handleOption(e.getKey(), e.getValue());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
log.error(Errors.IllegalArgumentForOption(e.getKey().getText(), ex.getMessage()));
|
||||
log.error(Errors.IllegalArgumentForOption(e.getKey().getPrimaryName(), ex.getMessage()));
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ import com.sun.tools.javac.util.StringUtils;
|
||||
|
||||
import static javax.tools.StandardLocation.PLATFORM_CLASS_PATH;
|
||||
|
||||
import static com.sun.tools.javac.main.Option.BOOTCLASSPATH;
|
||||
import static com.sun.tools.javac.main.Option.BOOT_CLASS_PATH;
|
||||
import static com.sun.tools.javac.main.Option.DJAVA_ENDORSED_DIRS;
|
||||
import static com.sun.tools.javac.main.Option.DJAVA_EXT_DIRS;
|
||||
import static com.sun.tools.javac.main.Option.ENDORSEDDIRS;
|
||||
@ -580,8 +580,7 @@ public class Locations {
|
||||
private class ClassPathLocationHandler extends SimpleLocationHandler {
|
||||
|
||||
ClassPathLocationHandler() {
|
||||
super(StandardLocation.CLASS_PATH,
|
||||
Option.CLASSPATH, Option.CP);
|
||||
super(StandardLocation.CLASS_PATH, Option.CLASS_PATH);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -649,7 +648,7 @@ public class Locations {
|
||||
|
||||
BootClassPathLocationHandler() {
|
||||
super(StandardLocation.PLATFORM_CLASS_PATH,
|
||||
Option.BOOTCLASSPATH, Option.XBOOTCLASSPATH,
|
||||
Option.BOOT_CLASS_PATH, Option.XBOOTCLASSPATH,
|
||||
Option.XBOOTCLASSPATH_PREPEND,
|
||||
Option.XBOOTCLASSPATH_APPEND,
|
||||
Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS,
|
||||
@ -669,7 +668,7 @@ public class Locations {
|
||||
|
||||
option = canonicalize(option);
|
||||
optionValues.put(option, value);
|
||||
if (option == BOOTCLASSPATH) {
|
||||
if (option == BOOT_CLASS_PATH) {
|
||||
optionValues.remove(XBOOTCLASSPATH_PREPEND);
|
||||
optionValues.remove(XBOOTCLASSPATH_APPEND);
|
||||
}
|
||||
@ -682,7 +681,7 @@ public class Locations {
|
||||
private Option canonicalize(Option option) {
|
||||
switch (option) {
|
||||
case XBOOTCLASSPATH:
|
||||
return Option.BOOTCLASSPATH;
|
||||
return Option.BOOT_CLASS_PATH;
|
||||
case DJAVA_ENDORSED_DIRS:
|
||||
return Option.ENDORSEDDIRS;
|
||||
case DJAVA_EXT_DIRS:
|
||||
@ -713,7 +712,7 @@ public class Locations {
|
||||
SearchPath computePath() throws IOException {
|
||||
SearchPath path = new SearchPath();
|
||||
|
||||
String bootclasspathOpt = optionValues.get(BOOTCLASSPATH);
|
||||
String bootclasspathOpt = optionValues.get(BOOT_CLASS_PATH);
|
||||
String endorseddirsOpt = optionValues.get(ENDORSEDDIRS);
|
||||
String extdirsOpt = optionValues.get(EXTDIRS);
|
||||
String xbootclasspathPrependOpt = optionValues.get(XBOOTCLASSPATH_PREPEND);
|
||||
@ -773,14 +772,14 @@ public class Locations {
|
||||
private Collection<Path> systemClasses() throws IOException {
|
||||
// Return "modules" jimage file if available
|
||||
if (Files.isRegularFile(thisSystemModules)) {
|
||||
return addAdditionalBootEntries(Collections.singleton(thisSystemModules));
|
||||
return Collections.singleton(thisSystemModules);
|
||||
}
|
||||
|
||||
// Exploded module image
|
||||
Path modules = javaHome.resolve("modules");
|
||||
if (Files.isDirectory(modules.resolve("java.base"))) {
|
||||
try (Stream<Path> listedModules = Files.list(modules)) {
|
||||
return addAdditionalBootEntries(listedModules.collect(Collectors.toList()));
|
||||
return listedModules.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@ -788,26 +787,6 @@ public class Locations {
|
||||
return null;
|
||||
}
|
||||
|
||||
//ensure bootclasspath prepends/appends are reflected in the systemClasses
|
||||
private Collection<Path> addAdditionalBootEntries(Collection<Path> modules) throws IOException {
|
||||
String files = System.getProperty("sun.boot.class.path");
|
||||
if (files == null)
|
||||
return modules;
|
||||
|
||||
Set<Path> paths = new LinkedHashSet<>();
|
||||
|
||||
// The JVM no longer supports -Xbootclasspath/p:, so any interesting
|
||||
// entries should be appended to the set of modules.
|
||||
|
||||
paths.addAll(modules);
|
||||
|
||||
for (String s : files.split(Pattern.quote(File.pathSeparator))) {
|
||||
paths.add(getPath(s));
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
private void lazy() {
|
||||
if (searchPath == null) {
|
||||
try {
|
||||
@ -1161,7 +1140,7 @@ public class Locations {
|
||||
|
||||
ModuleSourcePathLocationHandler() {
|
||||
super(StandardLocation.MODULE_SOURCE_PATH,
|
||||
Option.MODULESOURCEPATH);
|
||||
Option.MODULE_SOURCE_PATH);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1493,16 +1472,16 @@ public class Locations {
|
||||
BasicLocationHandler[] handlers = {
|
||||
new BootClassPathLocationHandler(),
|
||||
new ClassPathLocationHandler(),
|
||||
new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
|
||||
new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
|
||||
new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_MODULE_PATH, Option.PROCESSORMODULEPATH),
|
||||
new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCE_PATH),
|
||||
new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSOR_PATH),
|
||||
new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_MODULE_PATH, Option.PROCESSOR_MODULE_PATH),
|
||||
new OutputLocationHandler(StandardLocation.CLASS_OUTPUT, Option.D),
|
||||
new OutputLocationHandler(StandardLocation.SOURCE_OUTPUT, Option.S),
|
||||
new OutputLocationHandler(StandardLocation.NATIVE_HEADER_OUTPUT, Option.H),
|
||||
new ModuleSourcePathLocationHandler(),
|
||||
// TODO: should UPGRADE_MODULE_PATH be merged with SYSTEM_MODULES?
|
||||
new ModulePathLocationHandler(StandardLocation.UPGRADE_MODULE_PATH, Option.UPGRADEMODULEPATH),
|
||||
new ModulePathLocationHandler(StandardLocation.MODULE_PATH, Option.MODULEPATH, Option.MP),
|
||||
new ModulePathLocationHandler(StandardLocation.UPGRADE_MODULE_PATH, Option.UPGRADE_MODULE_PATH),
|
||||
new ModulePathLocationHandler(StandardLocation.MODULE_PATH, Option.MODULE_PATH),
|
||||
new SystemModulesLocationHandler(),
|
||||
};
|
||||
|
||||
@ -1518,29 +1497,42 @@ public class Locations {
|
||||
|
||||
boolean handleOption(Option option, String value) {
|
||||
switch (option) {
|
||||
case XPATCH:
|
||||
Map<String, SearchPath> map = new LinkedHashMap<>();
|
||||
int eq = value.indexOf('=');
|
||||
if (eq > 0) {
|
||||
String mName = value.substring(0, eq);
|
||||
SearchPath mPatchPath = new SearchPath()
|
||||
.addFiles(value.substring(eq + 1));
|
||||
boolean ok = true;
|
||||
for (Path p: mPatchPath) {
|
||||
Path mi = p.resolve("module-info.class");
|
||||
if (Files.exists(mi)) {
|
||||
log.error(Errors.LocnModuleInfoNotAllowedOnPatchPath(mi));
|
||||
ok = false;
|
||||
case PATCH_MODULE:
|
||||
if (value == null) {
|
||||
patchMap = null;
|
||||
} else {
|
||||
// Allow an extended syntax for --patch-module consisting of a series
|
||||
// of values separated by NULL characters. This is to facilitate
|
||||
// supporting deferred file manager options on the command line.
|
||||
// See Option.PATCH_MODULE for the code that composes these multiple
|
||||
// values.
|
||||
for (String v : value.split("\0")) {
|
||||
int eq = v.indexOf('=');
|
||||
if (eq > 0) {
|
||||
String mName = v.substring(0, eq);
|
||||
SearchPath mPatchPath = new SearchPath()
|
||||
.addFiles(v.substring(eq + 1));
|
||||
boolean ok = true;
|
||||
for (Path p : mPatchPath) {
|
||||
Path mi = p.resolve("module-info.class");
|
||||
if (Files.exists(mi)) {
|
||||
log.error(Errors.LocnModuleInfoNotAllowedOnPatchPath(mi));
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
if (ok) {
|
||||
if (patchMap == null) {
|
||||
patchMap = new LinkedHashMap<>();
|
||||
}
|
||||
patchMap.put(mName, mPatchPath);
|
||||
}
|
||||
} else {
|
||||
// Should not be able to get here;
|
||||
// this should be caught and handled in Option.PATCH_MODULE
|
||||
log.error(Errors.LocnInvalidArgForXpatch(value));
|
||||
}
|
||||
}
|
||||
if (ok && !mPatchPath.isEmpty()) {
|
||||
map.computeIfAbsent(mName, (_x) -> new SearchPath())
|
||||
.addAll(mPatchPath);
|
||||
}
|
||||
} else {
|
||||
log.error(Errors.LocnInvalidArgForXpatch(value));
|
||||
}
|
||||
patchMap = map;
|
||||
return true;
|
||||
default:
|
||||
LocationHandler h = handlersForOption.get(option);
|
||||
|
||||
@ -55,6 +55,7 @@ import com.sun.tools.javac.file.BaseFileManager;
|
||||
import com.sun.tools.javac.file.PathFileObject;
|
||||
import com.sun.tools.javac.jvm.ClassFile.NameAndType;
|
||||
import com.sun.tools.javac.jvm.ClassFile.Version;
|
||||
import com.sun.tools.javac.main.Option;
|
||||
import com.sun.tools.javac.util.*;
|
||||
import com.sun.tools.javac.util.DefinedBy.Api;
|
||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||
@ -67,7 +68,7 @@ import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
|
||||
import static com.sun.tools.javac.jvm.ClassFile.*;
|
||||
import static com.sun.tools.javac.jvm.ClassFile.Version.*;
|
||||
|
||||
import static com.sun.tools.javac.main.Option.*;
|
||||
import static com.sun.tools.javac.main.Option.PARAMETERS;
|
||||
|
||||
/** This class provides operations to read a classfile into an internal
|
||||
* representation. The internal representation is anchored in a
|
||||
@ -236,7 +237,7 @@ public class ClassReader {
|
||||
log = Log.instance(context);
|
||||
|
||||
Options options = Options.instance(context);
|
||||
verbose = options.isSet(VERBOSE);
|
||||
verbose = options.isSet(Option.VERBOSE);
|
||||
|
||||
Source source = Source.instance(context);
|
||||
allowSimplifiedVarargs = source.allowSimplifiedVarargs();
|
||||
|
||||
@ -63,6 +63,7 @@ import com.sun.tools.javac.platform.PlatformUtils;
|
||||
import com.sun.tools.javac.resources.CompilerProperties.Errors;
|
||||
import com.sun.tools.javac.resources.CompilerProperties.Warnings;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.JCDiagnostic;
|
||||
import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.ListBuffer;
|
||||
import com.sun.tools.javac.util.Log;
|
||||
@ -143,7 +144,7 @@ public class Arguments {
|
||||
|
||||
@Override
|
||||
public boolean handleFileManagerOption(Option option, String value) {
|
||||
options.put(option.getText(), value);
|
||||
options.put(option, value);
|
||||
deferredFileManagerOptions.put(option, value);
|
||||
return true;
|
||||
}
|
||||
@ -163,6 +164,11 @@ public class Arguments {
|
||||
Arguments.this.error(key, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(JCDiagnostic.Error error) {
|
||||
Arguments.this.error(error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFile(Path p) {
|
||||
files.add(p);
|
||||
@ -193,12 +199,15 @@ public class Arguments {
|
||||
fileObjects = null;
|
||||
classNames = new LinkedHashSet<>();
|
||||
processArgs(List.from(args), Option.getJavaCompilerOptions(), cmdLineHelper, true, false);
|
||||
if (errors) {
|
||||
log.printLines(PrefixKind.JAVAC, "msg.usage", ownName);
|
||||
}
|
||||
}
|
||||
|
||||
private final OptionHelper apiHelper = new GrumpyHelper(null) {
|
||||
@Override
|
||||
public String get(Option option) {
|
||||
return options.get(option.getText());
|
||||
return options.get(option);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -297,8 +306,8 @@ public class Arguments {
|
||||
String platformString = options.get(Option.RELEASE);
|
||||
|
||||
checkOptionAllowed(platformString == null,
|
||||
option -> error("err.release.bootclasspath.conflict", option.getText()),
|
||||
Option.BOOTCLASSPATH, Option.XBOOTCLASSPATH, Option.XBOOTCLASSPATH_APPEND,
|
||||
option -> error("err.release.bootclasspath.conflict", option.getPrimaryName()),
|
||||
Option.BOOT_CLASS_PATH, Option.XBOOTCLASSPATH, Option.XBOOTCLASSPATH_APPEND,
|
||||
Option.XBOOTCLASSPATH_PREPEND,
|
||||
Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS,
|
||||
Option.EXTDIRS, Option.DJAVA_EXT_DIRS,
|
||||
@ -360,39 +369,29 @@ public class Arguments {
|
||||
}
|
||||
|
||||
Option option = null;
|
||||
|
||||
// first, check the provided set of javac options
|
||||
if (arg.startsWith("-")) {
|
||||
for (Option o : allowableOpts) {
|
||||
if (o.matches(arg)) {
|
||||
option = o;
|
||||
break;
|
||||
}
|
||||
}
|
||||
option = Option.lookup(arg, allowableOpts);
|
||||
} else if (allowOperands && Option.SOURCEFILE.matches(arg)) {
|
||||
option = Option.SOURCEFILE;
|
||||
}
|
||||
|
||||
if (option == null) {
|
||||
if (fm != null && fm.handleOption(arg, argIter)) {
|
||||
continue;
|
||||
if (option != null) {
|
||||
if (!option.handleOption(helper, arg, argIter)) {
|
||||
return false;
|
||||
}
|
||||
error("err.invalid.flag", arg);
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (option.hasArg()) {
|
||||
if (!argIter.hasNext()) {
|
||||
error("err.req.arg", arg);
|
||||
return false;
|
||||
}
|
||||
String operand = argIter.next();
|
||||
if (option.process(helper, arg, operand)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (option.process(helper, arg)) {
|
||||
return false;
|
||||
}
|
||||
// check file manager option
|
||||
if (fm != null && fm.handleOption(arg, argIter)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// none of the above
|
||||
error("err.invalid.flag", arg);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -407,13 +406,13 @@ public class Arguments {
|
||||
*/
|
||||
public boolean validate() {
|
||||
JavaFileManager fm = getFileManager();
|
||||
if (options.isSet(Option.M)) {
|
||||
if (options.isSet(Option.MODULE)) {
|
||||
if (!fm.hasLocation(StandardLocation.CLASS_OUTPUT)) {
|
||||
log.error(Errors.OutputDirMustBeSpecifiedWithDashMOption);
|
||||
} else if (!fm.hasLocation(StandardLocation.MODULE_SOURCE_PATH)) {
|
||||
log.error(Errors.ModulesourcepathMustBeSpecifiedWithDashMOption);
|
||||
} else {
|
||||
java.util.List<String> modules = Arrays.asList(options.get(Option.M).split(","));
|
||||
java.util.List<String> modules = Arrays.asList(options.get(Option.MODULE).split(","));
|
||||
try {
|
||||
for (String module : modules) {
|
||||
Location sourceLoc = fm.getModuleLocation(StandardLocation.MODULE_SOURCE_PATH, module);
|
||||
@ -449,17 +448,20 @@ public class Arguments {
|
||||
|| options.isSet(Option.X)
|
||||
|| options.isSet(Option.VERSION)
|
||||
|| options.isSet(Option.FULLVERSION)
|
||||
|| options.isSet(Option.M))
|
||||
|| options.isSet(Option.MODULE))
|
||||
return true;
|
||||
|
||||
if (emptyAllowed)
|
||||
return true;
|
||||
|
||||
if (JavaCompiler.explicitAnnotationProcessingRequested(options)) {
|
||||
error("err.no.source.files.classes");
|
||||
} else {
|
||||
error("err.no.source.files");
|
||||
if (!errors) {
|
||||
if (JavaCompiler.explicitAnnotationProcessingRequested(options)) {
|
||||
error("err.no.source.files.classes");
|
||||
} else {
|
||||
error("err.no.source.files");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -542,12 +544,12 @@ public class Arguments {
|
||||
|
||||
// This check is only effective in command line mode,
|
||||
// where the file manager options are added to options
|
||||
if (options.get(Option.BOOTCLASSPATH) != null) {
|
||||
if (options.get(Option.BOOT_CLASS_PATH) != null) {
|
||||
error("err.profile.bootclasspath.conflict");
|
||||
}
|
||||
}
|
||||
|
||||
if (options.isSet(Option.SOURCEPATH) && options.isSet(Option.MODULESOURCEPATH)) {
|
||||
if (options.isSet(Option.SOURCE_PATH) && options.isSet(Option.MODULE_SOURCE_PATH)) {
|
||||
error("err.sourcepath.modulesourcepath.conflict");
|
||||
}
|
||||
|
||||
@ -578,17 +580,17 @@ public class Arguments {
|
||||
|
||||
final Target t = target;
|
||||
checkOptionAllowed(t.compareTo(Target.JDK1_8) <= 0,
|
||||
option -> error("err.option.not.allowed.with.target", option.getText(), t.name),
|
||||
Option.BOOTCLASSPATH,
|
||||
option -> error("err.option.not.allowed.with.target", option.getPrimaryName(), t.name),
|
||||
Option.BOOT_CLASS_PATH,
|
||||
Option.XBOOTCLASSPATH_PREPEND, Option.XBOOTCLASSPATH, Option.XBOOTCLASSPATH_APPEND,
|
||||
Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS,
|
||||
Option.EXTDIRS, Option.DJAVA_EXT_DIRS);
|
||||
|
||||
checkOptionAllowed(t.compareTo(Target.JDK1_9) >= 0,
|
||||
option -> error("err.option.not.allowed.with.target", option.getText(), t.name),
|
||||
Option.MODULESOURCEPATH, Option.UPGRADEMODULEPATH,
|
||||
Option.SYSTEM, Option.MODULEPATH, Option.ADDMODS, Option.LIMITMODS,
|
||||
Option.XPATCH);
|
||||
option -> error("err.option.not.allowed.with.target", option.getPrimaryName(), t.name),
|
||||
Option.MODULE_SOURCE_PATH, Option.UPGRADE_MODULE_PATH,
|
||||
Option.SYSTEM, Option.MODULE_PATH, Option.ADD_MODULES, Option.LIMIT_MODULES,
|
||||
Option.PATCH_MODULE);
|
||||
|
||||
if (fm.hasLocation(StandardLocation.MODULE_SOURCE_PATH)) {
|
||||
if (!options.isSet(Option.PROC, "only")
|
||||
@ -608,7 +610,7 @@ public class Arguments {
|
||||
if (obsoleteOptionFound)
|
||||
log.warning(LintCategory.OPTIONS, "option.obsolete.suppression");
|
||||
|
||||
String addExports = options.get(Option.XADDEXPORTS);
|
||||
String addExports = options.get(Option.ADD_EXPORTS);
|
||||
if (addExports != null) {
|
||||
// Each entry must be of the form module/package=target-list where target-list is a
|
||||
// comma-separated list of module or ALL-UNNAMED.
|
||||
@ -636,7 +638,7 @@ public class Arguments {
|
||||
});
|
||||
}
|
||||
|
||||
String addReads = options.get(Option.XADDREADS);
|
||||
String addReads = options.get(Option.ADD_READS);
|
||||
if (addReads != null) {
|
||||
// Each entry must be of the form module=source-list where source-list is a
|
||||
// comma separated list of module or ALL-UNNAMED.
|
||||
@ -724,7 +726,7 @@ public class Arguments {
|
||||
for (String s: xdoclintCustom.split("\\s+")) {
|
||||
if (s.isEmpty())
|
||||
continue;
|
||||
doclintOpts.add(s.replace(Option.XDOCLINT_CUSTOM.text, DocLint.XMSGS_CUSTOM_PREFIX));
|
||||
doclintOpts.add(DocLint.XMSGS_CUSTOM_PREFIX + s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -735,14 +737,13 @@ public class Arguments {
|
||||
|
||||
if (checkPackages != null) {
|
||||
for (String s : checkPackages.split("\\s+")) {
|
||||
doclintOpts.add(s.replace(Option.XDOCLINT_PACKAGE.text, DocLint.XCHECK_PACKAGE));
|
||||
doclintOpts.add(DocLint.XCHECK_PACKAGE + s);
|
||||
}
|
||||
}
|
||||
|
||||
// standard doclet normally generates H1, H2,
|
||||
// so for now, allow user comments to assume that
|
||||
doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
|
||||
|
||||
return List.from(doclintOpts.toArray(new String[doclintOpts.size()]));
|
||||
}
|
||||
|
||||
@ -771,6 +772,22 @@ public class Arguments {
|
||||
}
|
||||
}
|
||||
|
||||
void error(JCDiagnostic.Error error) {
|
||||
errors = true;
|
||||
switch (errorMode) {
|
||||
case ILLEGAL_ARGUMENT: {
|
||||
String msg = log.localize(error);
|
||||
throw new PropagatedException(new IllegalArgumentException(msg));
|
||||
}
|
||||
case ILLEGAL_STATE: {
|
||||
String msg = log.localize(error);
|
||||
throw new PropagatedException(new IllegalStateException(msg));
|
||||
}
|
||||
case LOG:
|
||||
report(error);
|
||||
}
|
||||
}
|
||||
|
||||
void error(String key, Object... args) {
|
||||
errors = true;
|
||||
switch (errorMode) {
|
||||
@ -784,7 +801,6 @@ public class Arguments {
|
||||
}
|
||||
case LOG:
|
||||
report(key, args);
|
||||
log.printLines(PrefixKind.JAVAC, "msg.usage", ownName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -797,6 +813,11 @@ public class Arguments {
|
||||
log.printRawLines(ownName + ": " + log.localize(PrefixKind.JAVAC, key, args));
|
||||
}
|
||||
|
||||
private void report(JCDiagnostic.Error error) {
|
||||
// Would be good to have support for -XDrawDiagnostics here
|
||||
log.printRawLines(ownName + ": " + log.localize(error));
|
||||
}
|
||||
|
||||
private JavaFileManager getFileManager() {
|
||||
if (fileManager == null)
|
||||
fileManager = context.get(JavaFileManager.class);
|
||||
|
||||
@ -892,14 +892,21 @@ public class JavaCompiler {
|
||||
|
||||
// forcibly set the equivalent of -Xlint:-options, so that no further
|
||||
// warnings about command line options are generated from this point on
|
||||
options.put(XLINT_CUSTOM.text + "-" + LintCategory.OPTIONS.option, "true");
|
||||
options.remove(XLINT_CUSTOM.text + LintCategory.OPTIONS.option);
|
||||
options.put(XLINT_CUSTOM.primaryName + "-" + LintCategory.OPTIONS.option, "true");
|
||||
options.remove(XLINT_CUSTOM.primaryName + LintCategory.OPTIONS.option);
|
||||
|
||||
start_msec = now();
|
||||
|
||||
try {
|
||||
initProcessAnnotations(processors);
|
||||
|
||||
for (String className : classnames) {
|
||||
int sep = className.indexOf('/');
|
||||
if (sep != -1) {
|
||||
modules.addExtraAddModules(className.substring(0, sep));
|
||||
}
|
||||
}
|
||||
|
||||
// These method calls must be chained to avoid memory leaks
|
||||
processAnnotations(
|
||||
enterTrees(
|
||||
@ -1010,7 +1017,7 @@ public class JavaCompiler {
|
||||
}
|
||||
|
||||
public List<JCCompilationUnit> initModules(List<JCCompilationUnit> roots) {
|
||||
modules.initModules(roots, Collections.emptySet(), Collections.emptySet());
|
||||
modules.initModules(roots);
|
||||
if (roots.isEmpty()) {
|
||||
enterDone = true;
|
||||
}
|
||||
@ -1258,8 +1265,8 @@ public class JavaCompiler {
|
||||
static boolean explicitAnnotationProcessingRequested(Options options) {
|
||||
return
|
||||
options.isSet(PROCESSOR) ||
|
||||
options.isSet(PROCESSORPATH) ||
|
||||
options.isSet(PROCESSORMODULEPATH) ||
|
||||
options.isSet(PROCESSOR_PATH) ||
|
||||
options.isSet(PROCESSOR_MODULE_PATH) ||
|
||||
options.isSet(PROC, "only") ||
|
||||
options.isSet(XPRINT);
|
||||
}
|
||||
|
||||
@ -176,12 +176,13 @@ public class Main {
|
||||
log = Log.instance(context);
|
||||
|
||||
if (argv.length == 0) {
|
||||
Option.HELP.process(new OptionHelper.GrumpyHelper(log) {
|
||||
OptionHelper h = new OptionHelper.GrumpyHelper(log) {
|
||||
@Override
|
||||
public String getOwnName() { return ownName; }
|
||||
@Override
|
||||
public void put(String name, String value) { }
|
||||
}, "-help");
|
||||
};
|
||||
Option.HELP.process(h, "-help");
|
||||
return Result.CMDERR;
|
||||
}
|
||||
|
||||
@ -266,10 +267,10 @@ public class Main {
|
||||
}
|
||||
|
||||
// init multi-release jar handling
|
||||
if (fileManager.isSupportedOption(Option.MULTIRELEASE.text) == 1) {
|
||||
if (fileManager.isSupportedOption(Option.MULTIRELEASE.primaryName) == 1) {
|
||||
Target target = Target.instance(context);
|
||||
List<String> list = List.of(target.multiReleaseValue());
|
||||
fileManager.handleOption(Option.MULTIRELEASE.text, list.iterator());
|
||||
fileManager.handleOption(Option.MULTIRELEASE.primaryName, list.iterator());
|
||||
}
|
||||
|
||||
// init JavaCompiler
|
||||
|
||||
@ -30,9 +30,14 @@ import java.io.PrintWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.Collator;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.Set;
|
||||
@ -51,6 +56,9 @@ import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.javac.jvm.Target;
|
||||
import com.sun.tools.javac.platform.PlatformProvider;
|
||||
import com.sun.tools.javac.processing.JavacProcessingEnvironment;
|
||||
import com.sun.tools.javac.resources.CompilerProperties.Errors;
|
||||
import com.sun.tools.javac.util.Assert;
|
||||
import com.sun.tools.javac.util.JDK9Wrappers;
|
||||
import com.sun.tools.javac.util.Log;
|
||||
import com.sun.tools.javac.util.Log.PrefixKind;
|
||||
import com.sun.tools.javac.util.Log.WriterKind;
|
||||
@ -62,10 +70,13 @@ import static com.sun.tools.javac.main.Option.OptionGroup.*;
|
||||
import static com.sun.tools.javac.main.Option.OptionKind.*;
|
||||
|
||||
/**
|
||||
* Options for javac. The specific Option to handle a command-line option
|
||||
* is identified by searching the members of this enum in order, looking for
|
||||
* the first {@link #matches match}. The action for an Option is performed
|
||||
* by calling {@link #process process}, and by providing a suitable
|
||||
* Options for javac.
|
||||
* The specific Option to handle a command-line option can be found by calling
|
||||
* {@link #lookup}, which search some or all of the members of this enum in order,
|
||||
* looking for the first {@link #matches match}.
|
||||
* The action for an Option is performed {@link #handleOption}, which determines
|
||||
* whether an argument is needed and where to find it;
|
||||
* {@code handleOption} then calls {@link #process process} providing a suitable
|
||||
* {@link OptionHelper} to provide access the compiler state.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
@ -89,17 +100,12 @@ public enum Option {
|
||||
|
||||
XLINT("-Xlint", "opt.Xlint", EXTENDED, BASIC),
|
||||
|
||||
XLINT_CUSTOM("-Xlint:", EXTENDED, BASIC, ANYOF, getXLintChoices()) {
|
||||
private static final String LINT_KEY_FORMAT = " %-19s %s";
|
||||
XLINT_CUSTOM("-Xlint:", "opt.arg.Xlint", "opt.Xlint.custom", EXTENDED, BASIC, ANYOF, getXLintChoices()) {
|
||||
private final String LINT_KEY_FORMAT = LARGE_INDENT + " %-" +
|
||||
(DEFAULT_SYNOPSIS_WIDTH + SMALL_INDENT.length() - LARGE_INDENT.length() - 2) + "s %s";
|
||||
@Override
|
||||
void help(Log log, OptionKind kind) {
|
||||
if (this.kind != kind)
|
||||
return;
|
||||
|
||||
log.printRawLines(WriterKind.STDOUT,
|
||||
String.format(HELP_LINE_FORMAT,
|
||||
log.localize(PrefixKind.JAVAC, "opt.Xlint.subopts"),
|
||||
log.localize(PrefixKind.JAVAC, "opt.Xlint.suboptlist")));
|
||||
protected void help(Log log) {
|
||||
super.help(log);
|
||||
log.printRawLines(WriterKind.STDOUT,
|
||||
String.format(LINT_KEY_FORMAT,
|
||||
"all",
|
||||
@ -125,14 +131,14 @@ public enum Option {
|
||||
@Override
|
||||
public boolean matches(String option) {
|
||||
return DocLint.isValidOption(
|
||||
option.replace(XDOCLINT_CUSTOM.text, DocLint.XMSGS_CUSTOM_PREFIX));
|
||||
option.replace(XDOCLINT_CUSTOM.primaryName, DocLint.XMSGS_CUSTOM_PREFIX));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
String prev = helper.get(XDOCLINT_CUSTOM);
|
||||
String next = (prev == null) ? option : (prev + " " + option);
|
||||
helper.put(XDOCLINT_CUSTOM.text, next);
|
||||
helper.put(XDOCLINT_CUSTOM.primaryName, next);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@ -141,14 +147,14 @@ public enum Option {
|
||||
@Override
|
||||
public boolean matches(String option) {
|
||||
return DocLint.isValidOption(
|
||||
option.replace(XDOCLINT_PACKAGE.text, DocLint.XCHECK_PACKAGE));
|
||||
option.replace(XDOCLINT_PACKAGE.primaryName, DocLint.XCHECK_PACKAGE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
String prev = helper.get(XDOCLINT_PACKAGE);
|
||||
String next = (prev == null) ? option : (prev + " " + option);
|
||||
helper.put(XDOCLINT_PACKAGE.text, next);
|
||||
helper.put(XDOCLINT_PACKAGE.primaryName, next);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@ -173,35 +179,55 @@ public enum Option {
|
||||
}
|
||||
},
|
||||
|
||||
CLASSPATH("-classpath", "opt.arg.path", "opt.classpath", STANDARD, FILEMANAGER),
|
||||
CLASS_PATH("--class-path -classpath -cp", "opt.arg.path", "opt.classpath", STANDARD, FILEMANAGER),
|
||||
|
||||
CP("-cp", "opt.arg.path", "opt.classpath", STANDARD, FILEMANAGER) {
|
||||
SOURCE_PATH("--source-path -sourcepath", "opt.arg.path", "opt.sourcepath", STANDARD, FILEMANAGER),
|
||||
|
||||
MODULE_SOURCE_PATH("--module-source-path -modulesourcepath", "opt.arg.mspath", "opt.modulesourcepath", STANDARD, FILEMANAGER),
|
||||
|
||||
MODULE_PATH("--module-path -p -modulepath -mp", "opt.arg.path", "opt.modulepath", STANDARD, FILEMANAGER),
|
||||
|
||||
UPGRADE_MODULE_PATH("--upgrade-module-path -upgrademodulepath", "opt.arg.path", "opt.upgrademodulepath", STANDARD, FILEMANAGER),
|
||||
|
||||
SYSTEM("--system -system", "opt.arg.jdk", "opt.system", STANDARD, FILEMANAGER),
|
||||
|
||||
PATCH_MODULE("--patch-module -Xpatch:", "opt.arg.patch", "opt.patch", EXTENDED, FILEMANAGER) {
|
||||
// The deferred filemanager diagnostics mechanism assumes a single value per option,
|
||||
// but --patch-module can be used multiple times, once per module. Therefore we compose
|
||||
// a value for the option containing the last value specified for each module, and separate
|
||||
// the the module=path pairs by an invalid path character, NULL.
|
||||
// The standard file manager code knows to split apart the NULL-separated components.
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option, String arg) {
|
||||
return super.process(helper, "-classpath", arg);
|
||||
if (!arg.contains("=")) { // could be more strict regeex, e.g. "(?i)[a-z0-9_.]+=.*"
|
||||
helper.error(Errors.LocnInvalidArgForXpatch(arg));
|
||||
}
|
||||
|
||||
String previous = helper.get(this);
|
||||
if (previous == null) {
|
||||
return super.process(helper, option, arg);
|
||||
}
|
||||
|
||||
Map<String,String> map = new LinkedHashMap<>();
|
||||
for (String s : previous.split("\0")) {
|
||||
int sep = s.indexOf('=');
|
||||
map.put(s.substring(0, sep), s.substring(sep + 1));
|
||||
}
|
||||
|
||||
int sep = arg.indexOf('=');
|
||||
map.put(arg.substring(0, sep), arg.substring(sep + 1));
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
map.forEach((m, p) -> {
|
||||
if (sb.length() > 0)
|
||||
sb.append('\0');
|
||||
sb.append(m).append('=').append(p);
|
||||
});
|
||||
return super.process(helper, option, sb.toString());
|
||||
}
|
||||
},
|
||||
|
||||
SOURCEPATH("-sourcepath", "opt.arg.path", "opt.sourcepath", STANDARD, FILEMANAGER),
|
||||
|
||||
MODULESOURCEPATH("-modulesourcepath", "opt.arg.mspath", "opt.modulesourcepath", STANDARD, FILEMANAGER),
|
||||
|
||||
MODULEPATH("-modulepath", "opt.arg.path", "opt.modulepath", STANDARD, FILEMANAGER),
|
||||
|
||||
MP("-mp", "opt.arg.path", "opt.modulepath", STANDARD, FILEMANAGER) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option, String arg) {
|
||||
return super.process(helper, "-modulepath", arg);
|
||||
}
|
||||
},
|
||||
|
||||
UPGRADEMODULEPATH("-upgrademodulepath", "opt.arg.path", "opt.upgrademodulepath", STANDARD, FILEMANAGER),
|
||||
|
||||
SYSTEM("-system", "opt.arg.jdk", "opt.system", STANDARD, FILEMANAGER),
|
||||
|
||||
XPATCH("-Xpatch:", "opt.arg.patch", "opt.patch", EXTENDED, FILEMANAGER),
|
||||
|
||||
BOOTCLASSPATH("-bootclasspath", "opt.arg.path", "opt.bootclasspath", STANDARD, FILEMANAGER) {
|
||||
BOOT_CLASS_PATH("--boot-class-path -bootclasspath", "opt.arg.path", "opt.bootclasspath", STANDARD, FILEMANAGER) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option, String arg) {
|
||||
helper.remove("-Xbootclasspath/p:");
|
||||
@ -228,7 +254,7 @@ public enum Option {
|
||||
DJAVA_EXT_DIRS("-Djava.ext.dirs=", "opt.arg.dirs", "opt.extdirs", EXTENDED, FILEMANAGER) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option, String arg) {
|
||||
return super.process(helper, "-extdirs", arg);
|
||||
return EXTDIRS.process(helper, "-extdirs", arg);
|
||||
}
|
||||
},
|
||||
|
||||
@ -237,7 +263,7 @@ public enum Option {
|
||||
DJAVA_ENDORSED_DIRS("-Djava.endorsed.dirs=", "opt.arg.dirs", "opt.endorseddirs", EXTENDED, FILEMANAGER) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option, String arg) {
|
||||
return super.process(helper, "-endorseddirs", arg);
|
||||
return ENDORSEDDIRS.process(helper, "-endorseddirs", arg);
|
||||
}
|
||||
},
|
||||
|
||||
@ -245,9 +271,9 @@ public enum Option {
|
||||
|
||||
PROCESSOR("-processor", "opt.arg.class.list", "opt.processor", STANDARD, BASIC),
|
||||
|
||||
PROCESSORPATH("-processorpath", "opt.arg.path", "opt.processorpath", STANDARD, FILEMANAGER),
|
||||
PROCESSOR_PATH("--processor-path -processorpath", "opt.arg.path", "opt.processorpath", STANDARD, FILEMANAGER),
|
||||
|
||||
PROCESSORMODULEPATH("-processormodulepath", "opt.arg.path", "opt.processormodulepath", STANDARD, FILEMANAGER),
|
||||
PROCESSOR_MODULE_PATH("--processor-module-path -processormodulepath", "opt.arg.path", "opt.processormodulepath", STANDARD, FILEMANAGER),
|
||||
|
||||
PARAMETERS("-parameters","opt.parameters", STANDARD, BASIC),
|
||||
|
||||
@ -285,12 +311,9 @@ public enum Option {
|
||||
}
|
||||
},
|
||||
|
||||
RELEASE("-release", "opt.arg.release", "opt.release", STANDARD, BASIC) {
|
||||
RELEASE("--release -release", "opt.arg.release", "opt.release", STANDARD, BASIC) {
|
||||
@Override
|
||||
void help(Log log, OptionKind kind) {
|
||||
if (this.kind != kind)
|
||||
return;
|
||||
|
||||
protected void help(Log log) {
|
||||
Iterable<PlatformProvider> providers =
|
||||
ServiceLoader.load(PlatformProvider.class, Arguments.class.getClassLoader());
|
||||
Set<String> platforms = StreamSupport.stream(providers.spliterator(), false)
|
||||
@ -307,10 +330,7 @@ public enum Option {
|
||||
delim = ", ";
|
||||
}
|
||||
|
||||
log.printRawLines(WriterKind.STDOUT,
|
||||
String.format(HELP_LINE_FORMAT,
|
||||
super.helpSynopsis(log),
|
||||
log.localize(PrefixKind.JAVAC, descrKey, targets.toString())));
|
||||
super.help(log, log.localize(PrefixKind.JAVAC, descrKey, targets.toString()));
|
||||
}
|
||||
},
|
||||
|
||||
@ -346,21 +366,20 @@ public enum Option {
|
||||
}
|
||||
},
|
||||
|
||||
HELP("-help", "opt.help", STANDARD, INFO) {
|
||||
// Note: -h is already taken for "native header output directory".
|
||||
HELP("--help -help", "opt.help", STANDARD, INFO) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
Log log = helper.getLog();
|
||||
String ownName = helper.getOwnName();
|
||||
log.printLines(WriterKind.STDOUT, PrefixKind.JAVAC, "msg.usage.header", ownName);
|
||||
for (Option o: getJavaCompilerOptions()) {
|
||||
o.help(log, OptionKind.STANDARD);
|
||||
}
|
||||
showHelp(log, OptionKind.STANDARD);
|
||||
log.printNewline(WriterKind.STDOUT);
|
||||
return super.process(helper, option);
|
||||
}
|
||||
},
|
||||
|
||||
A("-A", "opt.arg.key.equals.value", "opt.A", STANDARD, BASIC, true) {
|
||||
A("-A", "opt.arg.key.equals.value", "opt.A", STANDARD, BASIC, ArgKind.ADJACENT) {
|
||||
@Override
|
||||
public boolean matches(String arg) {
|
||||
return arg.startsWith("-A");
|
||||
@ -385,7 +404,8 @@ public enum Option {
|
||||
helper.error("err.invalid.A.key", option);
|
||||
return true;
|
||||
}
|
||||
return process(helper, option, option);
|
||||
helper.put(option, option);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
@ -393,9 +413,7 @@ public enum Option {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
Log log = helper.getLog();
|
||||
for (Option o: getJavaCompilerOptions()) {
|
||||
o.help(log, OptionKind.EXTENDED);
|
||||
}
|
||||
showHelp(log, OptionKind.EXTENDED);
|
||||
log.printNewline(WriterKind.STDOUT);
|
||||
log.printLines(WriterKind.STDOUT, PrefixKind.JAVAC, "msg.usage.nonstandard.footer");
|
||||
return super.process(helper, option);
|
||||
@ -404,7 +422,7 @@ public enum Option {
|
||||
|
||||
// This option exists only for the purpose of documenting itself.
|
||||
// It's actually implemented by the launcher.
|
||||
J("-J", "opt.arg.flag", "opt.J", STANDARD, INFO, true) {
|
||||
J("-J", "opt.arg.flag", "opt.J", STANDARD, INFO, ArgKind.ADJACENT) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
throw new AssertionError
|
||||
@ -484,7 +502,7 @@ public enum Option {
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
String p = option.substring(option.indexOf(':') + 1).trim();
|
||||
String prev = helper.get(PLUGIN);
|
||||
helper.put(PLUGIN.text, (prev == null) ? p : prev + '\0' + p);
|
||||
helper.put(PLUGIN.primaryName, (prev == null) ? p : prev + '\0' + p);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@ -517,7 +535,7 @@ public enum Option {
|
||||
}
|
||||
},
|
||||
|
||||
DIAGS("-diags:", null, HIDDEN, BASIC, true) {
|
||||
DIAGS("-diags:", null, HIDDEN, BASIC) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
return HiddenGroup.DIAGS.process(helper, option);
|
||||
@ -531,11 +549,11 @@ public enum Option {
|
||||
XD("-XD", null, HIDDEN, BASIC) {
|
||||
@Override
|
||||
public boolean matches(String s) {
|
||||
return s.startsWith(text);
|
||||
return s.startsWith(primaryName);
|
||||
}
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
return process(helper, option, option.substring(text.length()));
|
||||
return process(helper, option, option.substring(primaryName.length()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -548,47 +566,45 @@ public enum Option {
|
||||
}
|
||||
},
|
||||
|
||||
XADDEXPORTS("-XaddExports:", "opt.arg.addExports", "opt.addExports", EXTENDED, BASIC) {
|
||||
ADD_EXPORTS("--add-exports -XaddExports:", "opt.arg.addExports", "opt.addExports", EXTENDED, BASIC) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
String p = option.substring(option.indexOf(':') + 1).trim();
|
||||
String prev = helper.get(XADDEXPORTS);
|
||||
helper.put(XADDEXPORTS.text, (prev == null) ? p : prev + '\0' + p);
|
||||
public boolean process(OptionHelper helper, String option, String arg) {
|
||||
String prev = helper.get(ADD_EXPORTS);
|
||||
helper.put(ADD_EXPORTS.primaryName, (prev == null) ? arg : prev + '\0' + arg);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
XADDREADS("-XaddReads:", "opt.arg.addReads", "opt.addReads", EXTENDED, BASIC) {
|
||||
ADD_READS("--add-reads -XaddReads:", "opt.arg.addReads", "opt.addReads", EXTENDED, BASIC) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
String p = option.substring(option.indexOf(':') + 1).trim();
|
||||
String prev = helper.get(XADDREADS);
|
||||
helper.put(XADDREADS.text, (prev == null) ? p : prev + '\0' + p);
|
||||
public boolean process(OptionHelper helper, String option, String arg) {
|
||||
String prev = helper.get(ADD_READS);
|
||||
helper.put(ADD_READS.primaryName, (prev == null) ? arg : prev + '\0' + arg);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
XMODULE("-Xmodule:", "opt.arg.module", "opt.module", EXTENDED, BASIC) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
public boolean process(OptionHelper helper, String option, String arg) {
|
||||
String prev = helper.get(XMODULE);
|
||||
if (prev != null) {
|
||||
helper.error("err.option.too.many", XMODULE.text);
|
||||
helper.error("err.option.too.many", XMODULE.primaryName);
|
||||
}
|
||||
String p = option.substring(option.indexOf(':') + 1);
|
||||
helper.put(XMODULE.text, p);
|
||||
helper.put(XMODULE.primaryName, arg);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
M("-m", "opt.arg.m", "opt.m", STANDARD, BASIC),
|
||||
MODULE("--module -m", "opt.arg.m", "opt.m", STANDARD, BASIC),
|
||||
|
||||
ADDMODS("-addmods", "opt.arg.addmods", "opt.addmods", STANDARD, BASIC),
|
||||
LIMITMODS("-limitmods", "opt.arg.limitmods", "opt.limitmods", STANDARD, BASIC),
|
||||
ADD_MODULES("--add-modules -addmods", "opt.arg.addmods", "opt.addmods", STANDARD, BASIC),
|
||||
|
||||
LIMIT_MODULES("--limit-modules -limitmods", "opt.arg.limitmods", "opt.limitmods", STANDARD, BASIC),
|
||||
|
||||
// This option exists only for the purpose of documenting itself.
|
||||
// It's actually implemented by the CommandLine class.
|
||||
AT("@", "opt.arg.file", "opt.AT", STANDARD, INFO, true) {
|
||||
AT("@", "opt.arg.file", "opt.AT", STANDARD, INFO, ArgKind.ADJACENT) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
throw new AssertionError("the @ flag should be caught by CommandLine.");
|
||||
@ -629,9 +645,78 @@ public enum Option {
|
||||
}
|
||||
},
|
||||
|
||||
MULTIRELEASE("-multi-release", "opt.arg.multi-release", "opt.multi-release", HIDDEN, FILEMANAGER);
|
||||
MULTIRELEASE("--multi-release -multi-release", "opt.arg.multi-release", "opt.multi-release", HIDDEN, FILEMANAGER),
|
||||
|
||||
/** The kind of an Option. This is used by the -help and -X options. */
|
||||
INHERIT_RUNTIME_ENVIRONMENT("--inherit-runtime-environment", "opt.inherit_runtime_environment",
|
||||
EXTENDED, BASIC) {
|
||||
@Override
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
try {
|
||||
Class.forName(JDK9Wrappers.VMHelper.VM_CLASSNAME);
|
||||
String[] runtimeArgs = JDK9Wrappers.VMHelper.getRuntimeArguments();
|
||||
for (String arg : runtimeArgs) {
|
||||
// Handle any supported runtime options; ignore all others.
|
||||
// The runtime arguments always use the single token form, e.g. "--name=value".
|
||||
for (Option o : getSupportedRuntimeOptions()) {
|
||||
if (o.matches(arg)) {
|
||||
o.handleOption(helper, arg, Collections.emptyIterator());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException | SecurityException e) {
|
||||
helper.error("err.cannot.access.runtime.env");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Option[] getSupportedRuntimeOptions() {
|
||||
Option[] supportedRuntimeOptions = {
|
||||
ADD_EXPORTS,
|
||||
ADD_MODULES,
|
||||
LIMIT_MODULES,
|
||||
MODULE_PATH,
|
||||
UPGRADE_MODULE_PATH,
|
||||
PATCH_MODULE
|
||||
};
|
||||
return supportedRuntimeOptions;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The kind of argument, if any, accepted by this option. The kind is augmented
|
||||
* by characters in the name of the option.
|
||||
*/
|
||||
public enum ArgKind {
|
||||
/** This option does not take any argument. */
|
||||
NONE,
|
||||
|
||||
// Not currently supported
|
||||
// /**
|
||||
// * This option takes an optional argument, which may be provided directly after an '='
|
||||
// * separator, or in the following argument position if that word does not itself appear
|
||||
// * to be the name of an option.
|
||||
// */
|
||||
// OPTIONAL,
|
||||
|
||||
/**
|
||||
* This option takes an argument.
|
||||
* If the name of option ends with ':' or '=', the argument must be provided directly
|
||||
* after that separator.
|
||||
* Otherwise, if may appear after an '=' or in the following argument position.
|
||||
*/
|
||||
REQUIRED,
|
||||
|
||||
/**
|
||||
* This option takes an argument immediately after the option name, with no separator
|
||||
* character.
|
||||
*/
|
||||
ADJACENT
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of an Option. This is used by the -help and -X options.
|
||||
*/
|
||||
public enum OptionKind {
|
||||
/** A standard option, documented by -help. */
|
||||
STANDARD,
|
||||
@ -641,8 +726,10 @@ public enum Option {
|
||||
HIDDEN,
|
||||
}
|
||||
|
||||
/** The group for an Option. This determines the situations in which the
|
||||
* option is applicable. */
|
||||
/**
|
||||
* The group for an Option. This determines the situations in which the
|
||||
* option is applicable.
|
||||
*/
|
||||
enum OptionGroup {
|
||||
/** A basic option, available for use on the command line or via the
|
||||
* Compiler API. */
|
||||
@ -656,7 +743,9 @@ public enum Option {
|
||||
OPERAND
|
||||
}
|
||||
|
||||
/** The kind of choice for "choice" options. */
|
||||
/**
|
||||
* The kind of choice for "choice" options.
|
||||
*/
|
||||
enum ChoiceKind {
|
||||
/** The expected value is exactly one of the set of choices. */
|
||||
ONEOF,
|
||||
@ -684,65 +773,113 @@ public enum Option {
|
||||
}
|
||||
}
|
||||
|
||||
public final String text;
|
||||
|
||||
final OptionKind kind;
|
||||
|
||||
final OptionGroup group;
|
||||
|
||||
/** Documentation key for arguments.
|
||||
/**
|
||||
* The "primary name" for this option.
|
||||
* This is the name that is used to put values in the {@link Options} table.
|
||||
*/
|
||||
final String argsNameKey;
|
||||
public final String primaryName;
|
||||
|
||||
/**
|
||||
* The set of names (primary name and aliases) for this option.
|
||||
* Note that some names may end in a separator, to indicate that an argument must immediately
|
||||
* follow the separator (and cannot appear in the following argument position.
|
||||
*/
|
||||
public final String[] names;
|
||||
|
||||
/** Documentation key for arguments. */
|
||||
protected final String argsNameKey;
|
||||
|
||||
/** Documentation key for description.
|
||||
*/
|
||||
final String descrKey;
|
||||
protected final String descrKey;
|
||||
|
||||
/** Suffix option (-foo=bar or -foo:bar)
|
||||
/** The kind of this option. */
|
||||
private final OptionKind kind;
|
||||
|
||||
/** The group for this option. */
|
||||
private final OptionGroup group;
|
||||
|
||||
/** The kind of argument for this option. */
|
||||
private final ArgKind argKind;
|
||||
|
||||
/** The kind of choices for this option, if any. */
|
||||
private final ChoiceKind choiceKind;
|
||||
|
||||
/** The choices for this option, if any, and whether or not the choices are hidden. */
|
||||
private final Map<String,Boolean> choices;
|
||||
|
||||
/**
|
||||
* Looks up the first option matching the given argument in the full set of options.
|
||||
* @param arg the argument to be matches
|
||||
* @return the first option that matches, or null if none.
|
||||
*/
|
||||
final boolean hasSuffix;
|
||||
public static Option lookup(String arg) {
|
||||
return lookup(arg, EnumSet.allOf(Option.class));
|
||||
}
|
||||
|
||||
/** The kind of choices for this option, if any.
|
||||
/**
|
||||
* Looks up the first option matching the given argument within a set of options.
|
||||
* @param arg the argument to be matches
|
||||
* @return the first option that matches, or null if none.
|
||||
*/
|
||||
final ChoiceKind choiceKind;
|
||||
public static Option lookup(String arg, Set<Option> options) {
|
||||
for (Option option: options) {
|
||||
if (option.matches(arg))
|
||||
return option;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** The choices for this option, if any, and whether or not the choices
|
||||
* are hidden
|
||||
/**
|
||||
* Writes the "command line help" for given kind of option to the log.
|
||||
* @param log the log
|
||||
* @param kind the kind of options to select
|
||||
*/
|
||||
final Map<String,Boolean> choices;
|
||||
private static void showHelp(Log log, OptionKind kind) {
|
||||
Comparator<Option> comp = new Comparator<Option>() {
|
||||
final Collator collator = Collator.getInstance(Locale.US);
|
||||
{ collator.setStrength(Collator.PRIMARY); }
|
||||
|
||||
@Override
|
||||
public int compare(Option o1, Option o2) {
|
||||
return collator.compare(o1.primaryName, o2.primaryName);
|
||||
}
|
||||
};
|
||||
|
||||
Option(String text, String descrKey,
|
||||
OptionKind kind, OptionGroup group) {
|
||||
this(text, null, descrKey, kind, group, null, null, false);
|
||||
getJavaCompilerOptions()
|
||||
.stream()
|
||||
.filter(o -> o.kind == kind)
|
||||
.sorted(comp)
|
||||
.forEach(o -> {
|
||||
o.help(log);
|
||||
});
|
||||
}
|
||||
|
||||
Option(String text, String descrKey,
|
||||
OptionKind kind, OptionGroup group,
|
||||
boolean doHasSuffix) {
|
||||
this(text, null, descrKey, kind, group, null, null, doHasSuffix);
|
||||
OptionKind kind, OptionGroup group) {
|
||||
this(text, null, descrKey, kind, group, null, null, ArgKind.NONE);
|
||||
}
|
||||
|
||||
Option(String text, String argsNameKey, String descrKey,
|
||||
OptionKind kind, OptionGroup group) {
|
||||
this(text, argsNameKey, descrKey, kind, group, null, null, false);
|
||||
this(text, argsNameKey, descrKey, kind, group, null, null, ArgKind.REQUIRED);
|
||||
}
|
||||
|
||||
Option(String text, String argsNameKey, String descrKey,
|
||||
OptionKind kind, OptionGroup group, boolean doHasSuffix) {
|
||||
this(text, argsNameKey, descrKey, kind, group, null, null, doHasSuffix);
|
||||
OptionKind kind, OptionGroup group, ArgKind ak) {
|
||||
this(text, argsNameKey, descrKey, kind, group, null, null, ak);
|
||||
}
|
||||
|
||||
Option(String text, OptionKind kind, OptionGroup group,
|
||||
Option(String text, String argsNameKey, String descrKey, OptionKind kind, OptionGroup group,
|
||||
ChoiceKind choiceKind, Map<String,Boolean> choices) {
|
||||
this(text, null, null, kind, group, choiceKind, choices, false);
|
||||
this(text, argsNameKey, descrKey, kind, group, choiceKind, choices, ArgKind.REQUIRED);
|
||||
}
|
||||
|
||||
Option(String text, String descrKey,
|
||||
OptionKind kind, OptionGroup group,
|
||||
ChoiceKind choiceKind, String... choices) {
|
||||
this(text, null, descrKey, kind, group, choiceKind,
|
||||
createChoices(choices), false);
|
||||
createChoices(choices), ArgKind.REQUIRED);
|
||||
}
|
||||
// where
|
||||
private static Map<String,Boolean> createChoices(String... choices) {
|
||||
@ -755,39 +892,60 @@ public enum Option {
|
||||
private Option(String text, String argsNameKey, String descrKey,
|
||||
OptionKind kind, OptionGroup group,
|
||||
ChoiceKind choiceKind, Map<String,Boolean> choices,
|
||||
boolean doHasSuffix) {
|
||||
this.text = text;
|
||||
ArgKind argKind) {
|
||||
this.names = text.trim().split("\\s+");
|
||||
Assert.check(names.length >= 1);
|
||||
this.primaryName = names[0];
|
||||
this.argsNameKey = argsNameKey;
|
||||
this.descrKey = descrKey;
|
||||
this.kind = kind;
|
||||
this.group = group;
|
||||
this.choiceKind = choiceKind;
|
||||
this.choices = choices;
|
||||
char lastChar = text.charAt(text.length()-1);
|
||||
this.hasSuffix = doHasSuffix || lastChar == ':' || lastChar == '=';
|
||||
this.argKind = argKind;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
public String getPrimaryName() {
|
||||
return primaryName;
|
||||
}
|
||||
|
||||
public OptionKind getKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
public ArgKind getArgKind() {
|
||||
return argKind;
|
||||
}
|
||||
|
||||
public boolean hasArg() {
|
||||
return argsNameKey != null && !hasSuffix;
|
||||
return (argKind != ArgKind.NONE);
|
||||
}
|
||||
|
||||
public boolean matches(String option) {
|
||||
if (!hasSuffix)
|
||||
return option.equals(text);
|
||||
for (String name: names) {
|
||||
if (matches(option, name))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!option.startsWith(text))
|
||||
private boolean matches(String option, String name) {
|
||||
if (name.startsWith("--")) {
|
||||
return option.equals(name)
|
||||
|| hasArg() && option.startsWith(name + "=");
|
||||
}
|
||||
|
||||
boolean hasSuffix = (argKind == ArgKind.ADJACENT)
|
||||
|| name.endsWith(":") || name.endsWith("=");
|
||||
|
||||
if (!hasSuffix)
|
||||
return option.equals(name);
|
||||
|
||||
if (!option.startsWith(name))
|
||||
return false;
|
||||
|
||||
if (choices != null) {
|
||||
String arg = option.substring(text.length());
|
||||
String arg = option.substring(name.length());
|
||||
if (choiceKind == ChoiceKind.ONEOF)
|
||||
return choices.keySet().contains(arg);
|
||||
else {
|
||||
@ -801,55 +959,161 @@ public enum Option {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles an option.
|
||||
* If an argument for the option is required, depending on spec of the option, it will be found
|
||||
* as part of the current arg (following ':' or '=') or in the following argument.
|
||||
* This is the recommended way to handle an option directly, instead of calling the underlying
|
||||
* {@link #process process} methods.
|
||||
* @param helper a helper to provide access to the environment
|
||||
* @param arg the arg string that identified this option
|
||||
* @param rest the remaining strings to be analysed
|
||||
* @return true if the operation was successful, and false otherwise
|
||||
* @implNote The return value is the opposite of that used by {@link #process}.
|
||||
*/
|
||||
public boolean handleOption(OptionHelper helper, String arg, Iterator<String> rest) {
|
||||
if (hasArg()) {
|
||||
String operand;
|
||||
int sep = findSeparator(arg);
|
||||
if (getArgKind() == Option.ArgKind.ADJACENT) {
|
||||
operand = arg.substring(primaryName.length());
|
||||
} else if (sep > 0) {
|
||||
operand = arg.substring(sep + 1);
|
||||
} else {
|
||||
if (!rest.hasNext()) {
|
||||
helper.error("err.req.arg", arg);
|
||||
return false;
|
||||
}
|
||||
operand = rest.next();
|
||||
}
|
||||
return !process(helper, arg, operand);
|
||||
} else {
|
||||
return !process(helper, arg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes an option that either does not need an argument,
|
||||
* or which contains an argument within it, following a separator.
|
||||
* @param helper a helper to provide access to the environment
|
||||
* @param option the option to be processed
|
||||
* @return true if an error occurred
|
||||
*/
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
if (argKind == ArgKind.NONE) {
|
||||
return process(helper, primaryName, option);
|
||||
} else {
|
||||
int sep = findSeparator(option);
|
||||
return process(helper, primaryName, option.substring(sep + 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes an option by updating the environment via a helper object.
|
||||
* @param helper a helper to provide access to the environment
|
||||
* @param option the option to be processed
|
||||
* @param arg the value to associate with the option, or a default value
|
||||
* to be used if the option does not otherwise take an argument.
|
||||
* @return true if an error occurred
|
||||
*/
|
||||
public boolean process(OptionHelper helper, String option, String arg) {
|
||||
if (choices != null) {
|
||||
if (choiceKind == ChoiceKind.ONEOF) {
|
||||
// some clients like to see just one of option+choice set
|
||||
for (String s: choices.keySet())
|
||||
helper.remove(option + s);
|
||||
String opt = option + arg;
|
||||
helper.remove(primaryName + s);
|
||||
String opt = primaryName + arg;
|
||||
helper.put(opt, opt);
|
||||
// some clients like to see option (without trailing ":")
|
||||
// set to arg
|
||||
String nm = option.substring(0, option.length() - 1);
|
||||
String nm = primaryName.substring(0, primaryName.length() - 1);
|
||||
helper.put(nm, arg);
|
||||
} else {
|
||||
// set option+word for each word in arg
|
||||
for (String a: arg.split(",+")) {
|
||||
String opt = option + a;
|
||||
String opt = primaryName + a;
|
||||
helper.put(opt, opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
helper.put(option, arg);
|
||||
helper.put(primaryName, arg);
|
||||
if (group == OptionGroup.FILEMANAGER)
|
||||
helper.handleFileManagerOption(this, arg);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean process(OptionHelper helper, String option) {
|
||||
if (hasSuffix)
|
||||
return process(helper, text, option.substring(text.length()));
|
||||
else
|
||||
return process(helper, option, option);
|
||||
/**
|
||||
* Scans a word to find the first separator character, either colon or equals.
|
||||
* @param word the word to be scanned
|
||||
* @return the position of the first':' or '=' character in the word,
|
||||
* or -1 if none found
|
||||
*/
|
||||
private static int findSeparator(String word) {
|
||||
for (int i = 0; i < word.length(); i++) {
|
||||
switch (word.charAt(i)) {
|
||||
case ':': case '=':
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static final String HELP_LINE_FORMAT = " %-26s %s";
|
||||
/** The indent for the option synopsis. */
|
||||
private static final String SMALL_INDENT = " ";
|
||||
/** The automatic indent for the description. */
|
||||
private static final String LARGE_INDENT = " ";
|
||||
/** The space allowed for the synopsis, if the description is to be shown on the same line. */
|
||||
private static final int DEFAULT_SYNOPSIS_WIDTH = 28;
|
||||
/** The nominal maximum line length, when seeing if text will fit on a line. */
|
||||
private static final int DEFAULT_MAX_LINE_LENGTH = 80;
|
||||
/** The format for a single-line help entry. */
|
||||
private static final String COMPACT_FORMAT = SMALL_INDENT + "%-" + DEFAULT_SYNOPSIS_WIDTH + "s %s";
|
||||
|
||||
void help(Log log, OptionKind kind) {
|
||||
if (this.kind != kind)
|
||||
/**
|
||||
* Writes help text for this option to the log.
|
||||
* @param log the log
|
||||
*/
|
||||
protected void help(Log log) {
|
||||
help(log, log.localize(PrefixKind.JAVAC, descrKey));
|
||||
}
|
||||
|
||||
protected void help(Log log, String descr) {
|
||||
String synopses = Arrays.stream(names)
|
||||
.map(s -> helpSynopsis(s, log))
|
||||
.collect(Collectors.joining(", "));
|
||||
|
||||
// If option synopses and description fit on a single line of reasonable length,
|
||||
// display using COMPACT_FORMAT
|
||||
if (synopses.length() < DEFAULT_SYNOPSIS_WIDTH
|
||||
&& !descr.contains("\n")
|
||||
&& (SMALL_INDENT.length() + DEFAULT_SYNOPSIS_WIDTH + 1 + descr.length() <= DEFAULT_MAX_LINE_LENGTH)) {
|
||||
log.printRawLines(WriterKind.STDOUT, String.format(COMPACT_FORMAT, synopses, descr));
|
||||
return;
|
||||
}
|
||||
|
||||
log.printRawLines(WriterKind.STDOUT,
|
||||
String.format(HELP_LINE_FORMAT,
|
||||
helpSynopsis(log),
|
||||
log.localize(PrefixKind.JAVAC, descrKey)));
|
||||
// If option synopses fit on a single line of reasonable length, show that;
|
||||
// otherwise, show 1 per line
|
||||
if (synopses.length() <= DEFAULT_MAX_LINE_LENGTH) {
|
||||
log.printRawLines(WriterKind.STDOUT, SMALL_INDENT + synopses);
|
||||
} else {
|
||||
for (String name: names) {
|
||||
log.printRawLines(WriterKind.STDOUT, SMALL_INDENT + helpSynopsis(name, log));
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, show the description
|
||||
log.printRawLines(WriterKind.STDOUT, LARGE_INDENT + descr.replace("\n", "\n" + LARGE_INDENT));
|
||||
}
|
||||
|
||||
private String helpSynopsis(Log log) {
|
||||
/**
|
||||
* Composes the initial synopsis of one of the forms for this option.
|
||||
* @param name the name of this form of the option
|
||||
* @param log the log used to localize the description of the arguments
|
||||
* @return the synopsis
|
||||
*/
|
||||
private String helpSynopsis(String name, Log log) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(text);
|
||||
sb.append(name);
|
||||
if (argsNameKey == null) {
|
||||
if (choices != null) {
|
||||
String sep = "{";
|
||||
@ -863,10 +1127,9 @@ public enum Option {
|
||||
sb.append("}");
|
||||
}
|
||||
} else {
|
||||
if (!hasSuffix)
|
||||
if (!name.matches(".*[=:]$") && argKind != ArgKind.ADJACENT)
|
||||
sb.append(" ");
|
||||
sb.append(log.localize(PrefixKind.JAVAC, argsNameKey));
|
||||
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
@ -915,24 +1178,35 @@ public enum Option {
|
||||
return choices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set of options supported by the command line tool.
|
||||
* @return the set of options.
|
||||
*/
|
||||
static Set<Option> getJavaCompilerOptions() {
|
||||
return EnumSet.allOf(Option.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set of options supported by the built-in file manager.
|
||||
* @return the set of options.
|
||||
*/
|
||||
public static Set<Option> getJavacFileManagerOptions() {
|
||||
return getOptions(EnumSet.of(FILEMANAGER));
|
||||
return getOptions(FILEMANAGER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set of options supported by this implementation of
|
||||
* the JavaCompiler API, via {@link JavaCompiler#getTask}.
|
||||
* @return the set of options.
|
||||
*/
|
||||
public static Set<Option> getJavacToolOptions() {
|
||||
return getOptions(EnumSet.of(BASIC));
|
||||
return getOptions(BASIC);
|
||||
}
|
||||
|
||||
static Set<Option> getOptions(Set<OptionGroup> desired) {
|
||||
Set<Option> options = EnumSet.noneOf(Option.class);
|
||||
for (Option option : Option.values())
|
||||
if (desired.contains(option.group))
|
||||
options.add(option);
|
||||
return Collections.unmodifiableSet(options);
|
||||
private static Set<Option> getOptions(OptionGroup group) {
|
||||
return Arrays.stream(Option.values())
|
||||
.filter(o -> o.group == group)
|
||||
.collect(Collectors.toCollection(() -> EnumSet.noneOf(Option.class)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ package com.sun.tools.javac.main;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import com.sun.tools.javac.util.JCDiagnostic;
|
||||
import com.sun.tools.javac.util.Log;
|
||||
import com.sun.tools.javac.util.Log.PrefixKind;
|
||||
|
||||
@ -63,6 +64,9 @@ public abstract class OptionHelper {
|
||||
/** Report an error. */
|
||||
abstract void error(String key, Object... args);
|
||||
|
||||
/** Report an error. */
|
||||
abstract void error(JCDiagnostic.Error error);
|
||||
|
||||
/** Record a file to be compiled. */
|
||||
abstract void addFile(Path p);
|
||||
|
||||
@ -112,6 +116,11 @@ public abstract class OptionHelper {
|
||||
throw new IllegalArgumentException(log.localize(PrefixKind.JAVAC, key, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
void error(JCDiagnostic.Error error) {
|
||||
throw new IllegalArgumentException(log.localize(error));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFile(Path p) {
|
||||
throw new IllegalArgumentException(p.toString());
|
||||
|
||||
@ -62,6 +62,7 @@ import com.sun.tools.javac.comp.Env;
|
||||
import com.sun.tools.javac.comp.Modules;
|
||||
import com.sun.tools.javac.file.JavacFileManager;
|
||||
import com.sun.tools.javac.main.JavaCompiler;
|
||||
import com.sun.tools.javac.main.Option;
|
||||
import com.sun.tools.javac.model.JavacElements;
|
||||
import com.sun.tools.javac.model.JavacTypes;
|
||||
import com.sun.tools.javac.platform.PlatformDescription;
|
||||
@ -89,7 +90,6 @@ import com.sun.tools.javac.util.Options;
|
||||
|
||||
import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING;
|
||||
import static com.sun.tools.javac.code.Kinds.Kind.*;
|
||||
import static com.sun.tools.javac.main.Option.*;
|
||||
import static com.sun.tools.javac.comp.CompileStates.CompileState;
|
||||
import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*;
|
||||
|
||||
@ -196,17 +196,17 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
||||
source = Source.instance(context);
|
||||
diags = JCDiagnostic.Factory.instance(context);
|
||||
options = Options.instance(context);
|
||||
printProcessorInfo = options.isSet(XPRINTPROCESSORINFO);
|
||||
printRounds = options.isSet(XPRINTROUNDS);
|
||||
verbose = options.isSet(VERBOSE);
|
||||
printProcessorInfo = options.isSet(Option.XPRINTPROCESSORINFO);
|
||||
printRounds = options.isSet(Option.XPRINTROUNDS);
|
||||
verbose = options.isSet(Option.VERBOSE);
|
||||
lint = Lint.instance(context).isEnabled(PROCESSING);
|
||||
compiler = JavaCompiler.instance(context);
|
||||
if (options.isSet(PROC, "only") || options.isSet(XPRINT)) {
|
||||
if (options.isSet(Option.PROC, "only") || options.isSet(Option.XPRINT)) {
|
||||
compiler.shouldStopPolicyIfNoError = CompileState.PROCESS;
|
||||
}
|
||||
fatalErrors = options.isSet("fatalEnterError");
|
||||
showResolveErrors = options.isSet("showResolveErrors");
|
||||
werror = options.isSet(WERROR);
|
||||
werror = options.isSet(Option.WERROR);
|
||||
fileManager = context.get(JavaFileManager.class);
|
||||
platformAnnotations = initPlatformAnnotations();
|
||||
|
||||
@ -279,7 +279,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
||||
private void initProcessorIterator(Iterable<? extends Processor> processors) {
|
||||
Iterator<? extends Processor> processorIterator;
|
||||
|
||||
if (options.isSet(XPRINT)) {
|
||||
if (options.isSet(Option.XPRINT)) {
|
||||
try {
|
||||
processorIterator = List.of(new PrintingProcessor()).iterator();
|
||||
} catch (Throwable t) {
|
||||
@ -297,7 +297,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
||||
* path for the named class. Otherwise, use a service
|
||||
* provider mechanism to create the processor iterator.
|
||||
*/
|
||||
String processorNames = options.get(PROCESSOR);
|
||||
String processorNames = options.get(Option.PROCESSOR);
|
||||
if (fileManager.hasLocation(ANNOTATION_PROCESSOR_MODULE_PATH)) {
|
||||
processorIterator = (processorNames == null) ?
|
||||
new ServiceIterator(serviceLoader, log) :
|
||||
@ -363,7 +363,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
||||
? standardFileManager.getLocationAsPaths(ANNOTATION_PROCESSOR_PATH)
|
||||
: standardFileManager.getLocationAsPaths(CLASS_PATH);
|
||||
|
||||
if (needClassLoader(options.get(PROCESSOR), workingPath) )
|
||||
if (needClassLoader(options.get(Option.PROCESSOR), workingPath) )
|
||||
handleException(key, e);
|
||||
|
||||
} else {
|
||||
|
||||
@ -1222,7 +1222,7 @@ compiler.err.locn.module-info.not.allowed.on.patch.path=\
|
||||
|
||||
# 0: string
|
||||
compiler.err.locn.invalid.arg.for.xpatch=\
|
||||
invalid argument for -Xpatch option: {0}
|
||||
invalid argument for --patch-module option: {0}
|
||||
|
||||
#####
|
||||
|
||||
|
||||
@ -165,12 +165,12 @@ javac.opt.Xlint.all=\
|
||||
javac.opt.Xlint.none=\
|
||||
Disable all warnings
|
||||
#L10N: do not localize: -Xlint
|
||||
javac.opt.Xlint.subopts=\
|
||||
-Xlint:key,...
|
||||
javac.opt.Xlint.suboptlist=\n\
|
||||
\ Warnings to enable or disable, separated by comma.\n\
|
||||
\ Precede a key by '-' to disable the specified warning.\n\
|
||||
\ Supported keys are:
|
||||
javac.opt.arg.Xlint=\
|
||||
<key>(,<key>)*
|
||||
javac.opt.Xlint.custom=\
|
||||
Warnings to enable or disable, separated by comma.\n\
|
||||
Precede a key by '-' to disable the specified warning.\n\
|
||||
Supported keys are:
|
||||
javac.opt.Xlint.desc.auxiliaryclass=\
|
||||
Warn about an auxiliary class that is hidden in a source file, and is used from other files.
|
||||
|
||||
@ -239,20 +239,19 @@ javac.opt.Xdoclint.subopts = \
|
||||
|
||||
# L10N: do not localize: accessibility html missing reference syntax
|
||||
# L10N: do not localize: public protected package private
|
||||
javac.opt.Xdoclint.custom=\n\
|
||||
\ Enable or disable specific checks for problems in javadoc comments,\n\
|
||||
\ where <group> is one of accessibility, html, missing, reference, or syntax,\n\
|
||||
\ and <access> is one of public, protected, package, or private.
|
||||
javac.opt.Xdoclint.custom=\
|
||||
Enable or disable specific checks for problems in javadoc comments,\n\
|
||||
where <group> is one of accessibility, html, missing, reference, or syntax,\n\
|
||||
and <access> is one of public, protected, package, or private.
|
||||
|
||||
javac.opt.Xdoclint.package.args = \
|
||||
([-]<packages>)
|
||||
[-]<packages>(,[-]<package>)*
|
||||
|
||||
javac.opt.Xdoclint.package.desc=\n\
|
||||
\ Enable or disable checks in specific packages. <packages> is a comma separated\n\
|
||||
\ list of package specifiers. Package specifier is either a qualified name of a package\n\
|
||||
\ or a package name prefix followed by '.*', which expands to all sub-packages of\n\
|
||||
\ the given package. Prefix the package specifier with '-' to disable checks for\n\
|
||||
\ the specified packages.
|
||||
javac.opt.Xdoclint.package.desc=\
|
||||
Enable or disable checks in specific packages. Each <package> is either the\n\
|
||||
qualified name of a package or a package name prefix followed by '.*', which\n\
|
||||
expands to all sub-packages of the given package. Each <package> can be prefixed\n\
|
||||
with '-' to disable checks for the specified package or packages.
|
||||
|
||||
javac.opt.Xstdout=\
|
||||
Redirect standard output
|
||||
@ -274,34 +273,36 @@ javac.opt.AT=\
|
||||
Read options and filenames from file
|
||||
javac.opt.diags=\
|
||||
Select a diagnostic mode
|
||||
javac.opt.addExports=\n\
|
||||
\ Specify a package to be considered as exported from its defining module\n\
|
||||
\ to additional modules, or to all unnamed modules if <other-module> is ALL-UNNAMED.
|
||||
javac.opt.addExports=\
|
||||
Specify a package to be considered as exported from its defining module\n\
|
||||
to additional modules, or to all unnamed modules if <other-module> is ALL-UNNAMED.
|
||||
javac.opt.arg.addExports=\
|
||||
<module>/<package>=<other-module>(,<other-module>)*
|
||||
javac.opt.addReads=\n\
|
||||
\ Specify additional modules to be considered as required by a given module.\n\
|
||||
\ <other-module> may be ALL-UNNAMED to require the unnamed module.
|
||||
javac.opt.addReads=\
|
||||
Specify additional modules to be considered as required by a given module.\n\
|
||||
<other-module> may be ALL-UNNAMED to require the unnamed module.
|
||||
javac.opt.arg.addReads=\
|
||||
<module>=<other-module>(,<other-module>)*
|
||||
javac.opt.patch=\n\
|
||||
\ Override or augment a module with classes and resources\n\
|
||||
\ in JAR files or directories
|
||||
javac.opt.patch=\
|
||||
Override or augment a module with classes and resources\n\
|
||||
in JAR files or directories
|
||||
javac.opt.arg.patch=\
|
||||
<module>=<file>(:<file>)*
|
||||
javac.opt.module=\
|
||||
Specify a module to which the classes being compiled belong.
|
||||
javac.opt.arg.module=\
|
||||
<module-name>
|
||||
javac.opt.addmods=\n\
|
||||
\ Root modules to resolve in addition to the initial modules, or all modules\n\
|
||||
\ on the module path if <module> is ALL-MODULE-PATH.
|
||||
<module>
|
||||
javac.opt.addmods=\
|
||||
Root modules to resolve in addition to the initial modules, or all modules\n\
|
||||
on the module path if <module> is ALL-MODULE-PATH.
|
||||
javac.opt.arg.addmods=\
|
||||
<module>(,<module>)*
|
||||
javac.opt.limitmods=\
|
||||
Limit the universe of observable modules
|
||||
javac.opt.arg.limitmods=\
|
||||
<module>(,<module>)*
|
||||
javac.opt.inherit_runtime_environment=\
|
||||
Inherit module system configuration options from the runtime environment.
|
||||
|
||||
## errors
|
||||
|
||||
@ -334,7 +335,7 @@ javac.err.invalid.source=\
|
||||
javac.err.error.writing.file=\
|
||||
error writing {0}; {1}
|
||||
javac.err.sourcepath.modulesourcepath.conflict=\
|
||||
cannot specify both -sourcepath and -modulesourcepath
|
||||
cannot specify both --source-path and --module-source-path
|
||||
javac.warn.source.target.conflict=\
|
||||
source release {0} requires target release {1}
|
||||
javac.warn.target.default.source.conflict=\
|
||||
@ -347,6 +348,8 @@ javac.err.file.not.directory=\
|
||||
not a directory: {0}
|
||||
javac.err.file.not.file=\
|
||||
not a file: {0}
|
||||
javac.err.cannot.access.runtime.env=\
|
||||
cannot access runtime environment
|
||||
|
||||
## messages
|
||||
|
||||
@ -356,7 +359,7 @@ where possible options include:
|
||||
|
||||
javac.msg.usage=\
|
||||
Usage: {0} <options> <source files>\n\
|
||||
use -help for a list of possible options
|
||||
use --help for a list of possible options
|
||||
|
||||
javac.msg.usage.nonstandard.footer=\
|
||||
These options are non-standard and subject to change without notice.
|
||||
|
||||
@ -252,4 +252,40 @@ public class JDK9Wrappers {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper class for new method in jdk.internal.misc.VM.
|
||||
*/
|
||||
public static final class VMHelper {
|
||||
public static final String VM_CLASSNAME = "jdk.internal.misc.VM";
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static String[] getRuntimeArguments() {
|
||||
try {
|
||||
init();
|
||||
Object result = getRuntimeArgumentsMethod.invoke(null);
|
||||
return (String[])result;
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
|
||||
| SecurityException ex) {
|
||||
throw new Abort(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
|
||||
private static Class<?> vmClass = null;
|
||||
private static Method getRuntimeArgumentsMethod = null;
|
||||
|
||||
private static void init() {
|
||||
if (vmClass == null) {
|
||||
try {
|
||||
vmClass = Class.forName(VM_CLASSNAME, false, null);
|
||||
getRuntimeArgumentsMethod = vmClass.getDeclaredMethod("getRuntimeArguments");
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
|
||||
throw new Abort(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -748,6 +748,14 @@ public class Log extends AbstractLog {
|
||||
return localize(PrefixKind.COMPILER_MISC, key, args);
|
||||
}
|
||||
|
||||
public String localize(JCDiagnostic.DiagnosticInfo diagInfo) {
|
||||
if (useRawMessages) {
|
||||
return diagInfo.key();
|
||||
} else {
|
||||
return messages.getLocalizedString(diagInfo.key(), diagInfo.args);
|
||||
}
|
||||
}
|
||||
|
||||
/** Find a localized string in the resource bundle.
|
||||
* @param key The key for the localized string.
|
||||
* @param args Fields to substitute into the string.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2016, 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
|
||||
@ -71,7 +71,7 @@ public class Options {
|
||||
* Get the value for an option.
|
||||
*/
|
||||
public String get(Option option) {
|
||||
return values.get(option.text);
|
||||
return values.get(option.primaryName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,14 +101,14 @@ public class Options {
|
||||
* Check if the value for an option has been set.
|
||||
*/
|
||||
public boolean isSet(Option option) {
|
||||
return (values.get(option.text) != null);
|
||||
return (values.get(option.primaryName) != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the value for a choice option has been set to a specific value.
|
||||
*/
|
||||
public boolean isSet(Option option, String value) {
|
||||
return (values.get(option.text + value) != null);
|
||||
return (values.get(option.primaryName + value) != null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,14 +122,14 @@ public class Options {
|
||||
* Check if the value for an option has not been set.
|
||||
*/
|
||||
public boolean isUnset(Option option) {
|
||||
return (values.get(option.text) == null);
|
||||
return (values.get(option.primaryName) == null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the value for a choice option has not been set to a specific value.
|
||||
*/
|
||||
public boolean isUnset(Option option, String value) {
|
||||
return (values.get(option.text + value) == null);
|
||||
return (values.get(option.primaryName + value) == null);
|
||||
}
|
||||
|
||||
public void put(String name, String value) {
|
||||
@ -137,7 +137,7 @@ public class Options {
|
||||
}
|
||||
|
||||
public void put(Option option, String value) {
|
||||
values.put(option.text, value);
|
||||
values.put(option.primaryName, value);
|
||||
}
|
||||
|
||||
public void putAll(Options options) {
|
||||
|
||||
@ -526,19 +526,27 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
|
||||
|
||||
private void showHelp() {
|
||||
log.println(getMessage("main.usage", progname));
|
||||
|
||||
for (Option o: recognizedOptions) {
|
||||
if (o.isHidden())
|
||||
continue;
|
||||
String name = o.aliases[0].substring(1); // there must always be at least one name
|
||||
log.println(getMessage("main.opt." + name));
|
||||
}
|
||||
String[] fmOptions = { "-classpath", "-cp", "-bootclasspath" };
|
||||
|
||||
String[] fmOptions = {
|
||||
"--module-path", "--system",
|
||||
"--class-path", "-classpath", "-cp",
|
||||
"-bootclasspath"
|
||||
};
|
||||
|
||||
for (String o: fmOptions) {
|
||||
if (fileManager.isSupportedOption(o) == -1)
|
||||
continue;
|
||||
String name = o.substring(1);
|
||||
String name = o.replaceAll("^-+", "").replaceAll("-+", "_");
|
||||
log.println(getMessage("main.opt." + name));
|
||||
}
|
||||
|
||||
log.println(getMessage("main.usage.foot"));
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2016, 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
|
||||
@ -91,7 +91,6 @@ public class Util {
|
||||
log.println(s);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Help for loading localized messages.
|
||||
*/
|
||||
@ -116,18 +115,6 @@ public class Util {
|
||||
return null; /* dead code */
|
||||
}
|
||||
|
||||
/*
|
||||
* Usage message.
|
||||
*/
|
||||
public void usage() throws Exit {
|
||||
log.println(getText("usage"));
|
||||
}
|
||||
|
||||
public void version() throws Exit {
|
||||
log.println(getText("javah.version",
|
||||
System.getProperty("java.version"), null));
|
||||
}
|
||||
|
||||
/*
|
||||
* Failure modes.
|
||||
*/
|
||||
|
||||
@ -69,58 +69,61 @@ tracing.not.supported=\
|
||||
Warning: Tracing is no longer supported. Instead, use\
|
||||
-verbose:jni option of the virtual machine.
|
||||
|
||||
#
|
||||
# Usage message.
|
||||
#
|
||||
usage=\
|
||||
Usage: javah [options] <classes>\n\
|
||||
\n\
|
||||
where [options] include:\n\
|
||||
\n\t\
|
||||
-help Print this help message and exit\n\t\
|
||||
-classpath <path> Path from which to load classes\n\t\
|
||||
-cp <path> Path from which to load classes\n\t\
|
||||
-modulepath <path> Path from which to load application modules\n\t\
|
||||
-system <path> JDK directory from which to load system modules\n\t\
|
||||
-d <dir> Output directory\n\t\
|
||||
-o <file> Output file (only one of -d or -o may be used)\n\t\
|
||||
-jni Generate JNI-style header file (default)\n\t\
|
||||
-version Print version information\n\t\
|
||||
-verbose Enable verbose output\n\t\
|
||||
-force Always write output files\n\
|
||||
\n\
|
||||
<classes> are specified with their fully qualified names, optionally\n\
|
||||
prefixed by a module name followed by '/'. Examples:\n\
|
||||
java.lang.Object\n\
|
||||
java.base/java.io.File\n\
|
||||
|
||||
main.usage=\
|
||||
Usage: \n\
|
||||
\ javah [options] <classes>\n\
|
||||
where [options] include:
|
||||
|
||||
main.opt.o=\
|
||||
\ -o <file> Output file (only one of -d or -o may be used)
|
||||
\ -o <file> Output file (only one of -d or -o may be used)
|
||||
|
||||
main.opt.d=\
|
||||
\ -d <dir> Output directory
|
||||
\ -d <dir> Output directory
|
||||
|
||||
main.opt.v=\
|
||||
\ -v -verbose Enable verbose output
|
||||
\ -v -verbose Enable verbose output
|
||||
|
||||
main.opt.h=\
|
||||
\ -h --help -? Print this message
|
||||
\ -h --help -? Print this message
|
||||
|
||||
main.opt.version=\
|
||||
\ -version Print version information
|
||||
\ -version Print version information
|
||||
|
||||
main.opt.jni=\
|
||||
\ -jni Generate JNI-style header file (default)
|
||||
\ -jni Generate JNI-style header file (default)
|
||||
|
||||
main.opt.force=\
|
||||
\ -force Always write output files
|
||||
\ -force Always write output files
|
||||
|
||||
main.opt.module_path=\
|
||||
\ --module-path <path> Path from which to load application modules
|
||||
|
||||
main.opt.upgrade_module_path=\
|
||||
\ --upgrade_module-path <path> Path from which to load application modules
|
||||
|
||||
main.opt.classpath=\
|
||||
\ -classpath <path> Path from which to load classes
|
||||
\ -classpath <path> Path from which to load classes
|
||||
|
||||
main.opt.class_path=\
|
||||
\ --class-path <path> Path from which to load classes
|
||||
|
||||
main.opt.cp=\
|
||||
\ -cp <path> Path from which to load classes
|
||||
\ -cp <path> Path from which to load classes
|
||||
|
||||
main.opt.bootclasspath=\
|
||||
\ -bootclasspath <path> Path from which to load bootstrap classes
|
||||
main.usage.foot=\
|
||||
<classes> are specified with their fully qualified names\n\
|
||||
(for example, java.lang.Object).
|
||||
\ -bootclasspath <path> Path from which to load bootstrap classes
|
||||
|
||||
main.opt.system=\
|
||||
\ --system <jdk> Specify where to find system modules
|
||||
|
||||
main.usage.foot=\n\
|
||||
GNU-style options may use '=' instead whitespace to separate the name of an option\n\
|
||||
from its value.\n\
|
||||
\n\
|
||||
Each class must be specified by its fully qualified names, optionally\n\
|
||||
prefixed by a module name followed by '/'. Examples:\n\
|
||||
\ java.lang.Object\n\
|
||||
\ java.base/java.io.File\n\
|
||||
|
||||
#
|
||||
# Version string.
|
||||
|
||||
@ -63,7 +63,7 @@ public enum Option {
|
||||
helper.sourceRoots(paths);
|
||||
}
|
||||
},
|
||||
SOURCEPATH("-sourcepath", "Specify search path for sources.") {
|
||||
SOURCE_PATH("--source-path", "Specify search path for sources.") {
|
||||
@Override
|
||||
protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
|
||||
List<Path> paths = getFileListArg(iter, helper);
|
||||
@ -71,7 +71,13 @@ public enum Option {
|
||||
helper.sourcepath(paths);
|
||||
}
|
||||
},
|
||||
MODULEPATH("-modulepath", "Specify search path for modules.") {
|
||||
SOURCEPATH("-sourcepath", "An alias for -sourcepath") {
|
||||
@Override
|
||||
protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
|
||||
SOURCE_PATH.processMatching(iter, helper);
|
||||
}
|
||||
},
|
||||
MODULE_PATH("--module-path", "Specify search path for modules.") {
|
||||
@Override
|
||||
protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
|
||||
List<Path> paths = getFileListArg(iter, helper);
|
||||
@ -79,7 +85,19 @@ public enum Option {
|
||||
helper.modulepath(paths);
|
||||
}
|
||||
},
|
||||
CLASSPATH("-classpath", "Specify search path for classes.") {
|
||||
MODULEPATH("-modulepath", "An alias for -modulepath") {
|
||||
@Override
|
||||
protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
|
||||
MODULE_PATH.processMatching(iter, helper);
|
||||
}
|
||||
},
|
||||
P("-p", "An alias for -modulepath") {
|
||||
@Override
|
||||
protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
|
||||
MODULE_PATH.processMatching(iter, helper);
|
||||
}
|
||||
},
|
||||
CLASS_PATH("--class-path", "Specify search path for classes.") {
|
||||
@Override
|
||||
protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
|
||||
List<Path> paths = getFileListArg(iter, helper);
|
||||
@ -87,10 +105,16 @@ public enum Option {
|
||||
helper.classpath(paths);
|
||||
}
|
||||
},
|
||||
CLASSPATH("-classpath", "An alias for -classpath.") {
|
||||
@Override
|
||||
protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
|
||||
CLASS_PATH.processMatching(iter, helper);
|
||||
}
|
||||
},
|
||||
CP("-cp", "An alias for -classpath") {
|
||||
@Override
|
||||
protected void processMatching(ArgumentIterator iter, OptionHelper helper) {
|
||||
CLASSPATH.processMatching(iter, helper);
|
||||
CLASS_PATH.processMatching(iter, helper);
|
||||
}
|
||||
},
|
||||
X("-x", "Exclude files matching the given pattern") {
|
||||
|
||||
@ -251,9 +251,9 @@ public class Options {
|
||||
|
||||
// Source roots
|
||||
args.addSourceLocations(Option.SRC, sources);
|
||||
args.addSourceLocations(Option.SOURCEPATH, sourceSearchPaths);
|
||||
args.addSourceLocations(Option.CLASSPATH, classSearchPaths);
|
||||
args.addSourceLocations(Option.MODULEPATH, moduleSearchPaths);
|
||||
args.addSourceLocations(Option.SOURCE_PATH, sourceSearchPaths);
|
||||
args.addSourceLocations(Option.CLASS_PATH, classSearchPaths);
|
||||
args.addSourceLocations(Option.MODULE_PATH, moduleSearchPaths);
|
||||
|
||||
// Boolean options
|
||||
if (permitSourcesInDefaultPackage)
|
||||
|
||||
@ -187,7 +187,7 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
|
||||
// Parse file objects provide via the DocumentationTool API
|
||||
parse(fileObjects, classTrees, true);
|
||||
|
||||
modules.initModules(classTrees.toList(), Collections.emptySet(), Collections.emptySet());
|
||||
modules.initModules(classTrees.toList());
|
||||
|
||||
// Build up the complete list of any packages to be documented
|
||||
Location location = modules.multiModuleMode ? StandardLocation.MODULE_SOURCE_PATH
|
||||
|
||||
@ -45,6 +45,8 @@ import com.sun.tools.javac.file.JavacFileManager;
|
||||
import com.sun.tools.javac.main.CommandLine;
|
||||
import com.sun.tools.javac.main.Option;
|
||||
import com.sun.tools.javac.file.BaseFileManager;
|
||||
import com.sun.tools.javac.main.OptionHelper;
|
||||
import com.sun.tools.javac.main.OptionHelper.GrumpyHelper;
|
||||
import com.sun.tools.javac.platform.PlatformDescription;
|
||||
import com.sun.tools.javac.platform.PlatformUtils;
|
||||
import com.sun.tools.javac.util.ClientCodeException;
|
||||
@ -173,7 +175,7 @@ public class Start extends ToolOption.Helper {
|
||||
}
|
||||
|
||||
void usage(boolean exit) {
|
||||
usage("main.usage", "-help", null, exit);
|
||||
usage("main.usage", "-help", "main.usage.foot", exit);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -365,14 +367,14 @@ public class Start extends ToolOption.Helper {
|
||||
((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
|
||||
}
|
||||
|
||||
String platformString = compOpts.get("-release");
|
||||
String platformString = compOpts.get("--release");
|
||||
|
||||
if (platformString != null) {
|
||||
if (compOpts.isSet("-source")) {
|
||||
usageError("main.release.bootclasspath.conflict", "-source");
|
||||
}
|
||||
if (fileManagerOpts.containsKey(Option.BOOTCLASSPATH)) {
|
||||
usageError("main.release.bootclasspath.conflict", Option.BOOTCLASSPATH.getText());
|
||||
if (fileManagerOpts.containsKey(Option.BOOT_CLASS_PATH)) {
|
||||
usageError("main.release.bootclasspath.conflict", Option.BOOT_CLASS_PATH.getPrimaryName());
|
||||
}
|
||||
|
||||
PlatformDescription platformDescription =
|
||||
@ -555,4 +557,19 @@ public class Start extends ToolOption.Helper {
|
||||
}
|
||||
options.append(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
OptionHelper getOptionHelper() {
|
||||
return new GrumpyHelper(null) {
|
||||
@Override
|
||||
public String get(com.sun.tools.javac.main.Option option) {
|
||||
return compOpts.get(option);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(String name, String value) {
|
||||
compOpts.put(name, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ import java.util.StringTokenizer;
|
||||
|
||||
import com.sun.tools.javac.code.Flags;
|
||||
import com.sun.tools.javac.main.Option;
|
||||
import com.sun.tools.javac.main.OptionHelper;
|
||||
import com.sun.tools.javac.util.ListBuffer;
|
||||
import com.sun.tools.javac.util.Options;
|
||||
|
||||
@ -50,21 +51,28 @@ public enum ToolOption {
|
||||
BOOTCLASSPATH("-bootclasspath", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.BOOTCLASSPATH, arg);
|
||||
helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
CLASSPATH("-classpath", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.CLASSPATH, arg);
|
||||
helper.setFileManagerOpt(Option.CLASS_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
CP("-cp", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.CP, arg);
|
||||
helper.setFileManagerOpt(Option.CLASS_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
CLASS_PATH("--class-path", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.CLASS_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
@ -78,28 +86,49 @@ public enum ToolOption {
|
||||
SOURCEPATH("-sourcepath", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.SOURCEPATH, arg);
|
||||
helper.setFileManagerOpt(Option.SOURCE_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
SOURCE_PATH("--source-path", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.SOURCE_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
SYSCLASSPATH("-sysclasspath", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.BOOTCLASSPATH, arg);
|
||||
helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
MODULESOURCEPATH("-modulesourcepath", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.MODULESOURCEPATH, arg);
|
||||
helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
MODULE_SOURCE_PATH("--module-source-path", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
UPGRADEMODULEPATH("-upgrademodulepath", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.UPGRADEMODULEPATH, arg);
|
||||
helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
UPGRADE_MODULE_PATH("--upgrade-module-path", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
@ -110,10 +139,31 @@ public enum ToolOption {
|
||||
}
|
||||
},
|
||||
|
||||
SYSTEM_("--system", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.SYSTEM, arg);
|
||||
}
|
||||
},
|
||||
|
||||
MODULEPATH("-modulepath", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.MODULEPATH, arg);
|
||||
helper.setFileManagerOpt(Option.MODULE_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
MODULE_PATH("--module-path", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.MODULE_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
P("-p", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setFileManagerOpt(Option.MODULE_PATH, arg);
|
||||
}
|
||||
},
|
||||
|
||||
@ -124,6 +174,13 @@ public enum ToolOption {
|
||||
}
|
||||
},
|
||||
|
||||
ADD_MODULES("--add-modules", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
Option.ADD_MODULES.process(helper.getOptionHelper(), opt, arg);
|
||||
}
|
||||
},
|
||||
|
||||
LIMITMODS("-limitmods", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
@ -131,6 +188,13 @@ public enum ToolOption {
|
||||
}
|
||||
},
|
||||
|
||||
LIMIT_MODULES("--limit-modules", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
Option.LIMIT_MODULES.process(helper.getOptionHelper(), opt, arg);
|
||||
}
|
||||
},
|
||||
|
||||
ENCODING("-encoding", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
@ -139,13 +203,20 @@ public enum ToolOption {
|
||||
}
|
||||
},
|
||||
|
||||
RELEASE("-release", true) {
|
||||
RELEASE("--release", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setCompilerOpt(opt, arg);
|
||||
}
|
||||
},
|
||||
|
||||
RELEASE_OLD("-release", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.setCompilerOpt("--release", arg);
|
||||
}
|
||||
},
|
||||
|
||||
SOURCE("-source", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
@ -167,6 +238,55 @@ public enum ToolOption {
|
||||
}
|
||||
},
|
||||
|
||||
XADDREADS("-XaddReads:", false) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
Option.ADD_READS.process(helper.getOptionHelper(), arg);
|
||||
}
|
||||
},
|
||||
|
||||
ADD_READS("--add-reads", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
Option.ADD_READS.process(helper.getOptionHelper(), opt, arg);
|
||||
}
|
||||
},
|
||||
|
||||
ADDEXPORTS("-XaddExports:", false) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
Option.ADD_EXPORTS.process(helper.getOptionHelper(), arg);
|
||||
}
|
||||
},
|
||||
|
||||
ADD_EXPORTS("--add-exports", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
Option.ADD_EXPORTS.process(helper.getOptionHelper(), opt, arg);
|
||||
}
|
||||
},
|
||||
|
||||
XMODULE("-Xmodule:", false) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
Option.XMODULE.process(helper.getOptionHelper(), arg);
|
||||
}
|
||||
},
|
||||
|
||||
XPATCH("-Xpatch:", false) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
Option.XMODULE.process(helper.getOptionHelper(), arg);
|
||||
}
|
||||
},
|
||||
|
||||
PATCH_MODULE("--patch-module", true) {
|
||||
@Override
|
||||
public void process(Helper helper, String arg) {
|
||||
Option.PATCH_MODULE.process(helper.getOptionHelper(), opt, arg);
|
||||
}
|
||||
},
|
||||
|
||||
// ----- doclet options -----
|
||||
|
||||
DOCLET("-doclet", true), // handled in setDocletInvoker
|
||||
@ -362,6 +482,7 @@ public enum ToolOption {
|
||||
abstract void Xusage();
|
||||
|
||||
abstract void usageError(String msg, Object... args);
|
||||
abstract OptionHelper getOptionHelper();
|
||||
|
||||
void addToList(ListBuffer<String> list, String str){
|
||||
StringTokenizer st = new StringTokenizer(str, ":");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1997, 2016, 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
|
||||
@ -37,15 +37,28 @@ main.usage=Usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\
|
||||
\ -help Display command line options and exit\n\
|
||||
\ -doclet <class> Generate output via alternate doclet\n\
|
||||
\ -docletpath <path> Specify where to find doclet class files\n\
|
||||
\ -sourcepath <pathlist> Specify where to find source files\n\
|
||||
\ -classpath <pathlist> Specify where to find user class files\n\
|
||||
\ -cp <pathlist> Specify where to find user class files\n\
|
||||
\ --module-source-path <path> Specify where to find input source files for multiple modules\n\
|
||||
\ --upgrade-module-path <path> Override location of upgradeable modules\n\
|
||||
\ --module-path <path>, -p <path> Specify where to find application modules\n\
|
||||
\ --add-modules <module>(,<module>)*\n\
|
||||
\ Root modules to resolve in addition to the initial modules,\n\
|
||||
\ or all modules on the module path if <module> is ALL-MODULE-PATH.\n\
|
||||
\ --limit-modules <module>(,<module>)*\n\
|
||||
\ Limit the universe of observable modules\n\
|
||||
\ --source-path <path> Specify where to find source files\n\
|
||||
\ -sourcepath <path> Specify where to find source files\n\
|
||||
\ --class-path <path> Specify where to find user class files\n\
|
||||
\ -classpath <path> Specify where to find user class files\n\
|
||||
\ -cp <path> Specify where to find user class files\n\
|
||||
\ -exclude <pkglist> Specify a list of packages to exclude\n\
|
||||
\ -subpackages <subpkglist> Specify subpackages to recursively load\n\
|
||||
\ -breakiterator Compute first sentence with BreakIterator\n\
|
||||
\ -bootclasspath <pathlist> Override location of class files loaded\n\
|
||||
\ by the bootstrap class loader\n\
|
||||
\ -bootclasspath <path> Override location of platform class files\n\
|
||||
\ used for non-modular releases\n\
|
||||
\ --system <jdk> Override location of system modules used\n\
|
||||
\ for modular releases.\n\
|
||||
\ -source <release> Provide source compatibility with specified release\n\
|
||||
\ --release <release> Provide source compatibility with specified release\n\
|
||||
\ -extdirs <dirlist> Override location of installed extensions\n\
|
||||
\ -verbose Output messages about what Javadoc is doing\n\
|
||||
\ -locale <name> Locale to be used, e.g. en_US or en_US_WIN\n\
|
||||
@ -54,9 +67,25 @@ main.usage=Usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\
|
||||
\ -J<flag> Pass <flag> directly to the runtime system\n\
|
||||
\ -X Print a synopsis of nonstandard options and exit\n
|
||||
|
||||
main.usage.foot=\n\
|
||||
GNU-style options may use '=' instead whitespace to separate the name of an option\n\
|
||||
from its value.\n
|
||||
|
||||
main.Xusage=\
|
||||
\ -Xmaxerrs <number> Set the maximum number of errors to print\n\
|
||||
\ -Xmaxwarns <number> Set the maximum number of warnings to print\n
|
||||
\ -Xmaxwarns <number> Set the maximum number of warnings to print\n\
|
||||
\ --add-exports <module>/<package>=<other-module>(,<other-module>)*\n\
|
||||
\ Specify a package to be considered as exported from its \n\
|
||||
\ defining module to additional modules, or to all unnamed \n\
|
||||
\ modules if <other-module> is ALL-UNNAMED.\n\
|
||||
\ --add-reads <module>=<other-module>(,<other-module>)*\n\
|
||||
\ Specify additional modules to be considered as required by a\n\
|
||||
\ given module. <other-module> may be ALL-UNNAMED to require\n\
|
||||
\ the unnamed module.\n\
|
||||
\ -Xmodule:<module-name> Specify a module to which the classes being compiled belong.\n\
|
||||
\ --patch-module <module>=<file>(:<file>)*\n\
|
||||
\ Override or augment a module with classes and resources\n\
|
||||
\ in JAR files or directories\n
|
||||
|
||||
main.Xusage.foot=\
|
||||
These options are non-standard and subject to change without notice.
|
||||
|
||||
@ -80,7 +80,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
||||
Content typeParameters = getTypeParameters(member);
|
||||
if (!typeParameters.isEmpty()) {
|
||||
htmltree.addContent(typeParameters);
|
||||
htmltree.addContent(writer.getSpace());
|
||||
htmltree.addContent(Contents.SPACE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
||||
param.asType()).varargs(isVarArg));
|
||||
tree.addContent(link);
|
||||
if(name(param).length() > 0) {
|
||||
tree.addContent(writer.getSpace());
|
||||
tree.addContent(Contents.SPACE);
|
||||
tree.addContent(name(param));
|
||||
}
|
||||
}
|
||||
@ -173,11 +173,11 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
||||
protected void addReceiverAnnotations(ExecutableElement member, TypeMirror rcvrType,
|
||||
List<? extends AnnotationMirror> annotationMirrors, Content tree) {
|
||||
writer.addReceiverAnnotationInfo(member, rcvrType, annotationMirrors, tree);
|
||||
tree.addContent(writer.getSpace());
|
||||
tree.addContent(Contents.SPACE);
|
||||
tree.addContent(utils.getTypeName(rcvrType, false));
|
||||
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, RECEIVER_TYPE, rcvrType);
|
||||
tree.addContent(writer.getTypeParameterLinks(linkInfo));
|
||||
tree.addContent(writer.getSpace());
|
||||
tree.addContent(Contents.SPACE);
|
||||
tree.addContent("this");
|
||||
}
|
||||
|
||||
|
||||
@ -82,8 +82,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
*/
|
||||
protected AbstractIndexWriter(ConfigurationImpl configuration,
|
||||
DocPath path,
|
||||
IndexBuilder indexbuilder)
|
||||
throws IOException {
|
||||
IndexBuilder indexbuilder) {
|
||||
super(configuration, path);
|
||||
this.indexbuilder = indexbuilder;
|
||||
}
|
||||
@ -94,7 +93,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
* @return a content tree for the tree label
|
||||
*/
|
||||
protected Content getNavLinkIndex() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, indexLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.indexLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -216,10 +215,10 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
protected void addDescription(PackageElement pkg, Content dlTree, SearchIndexItem si) {
|
||||
Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
|
||||
si.setLabel(utils.getPackageName(pkg));
|
||||
si.setCategory(getResource("doclet.Packages").toString());
|
||||
si.setCategory(resources.getText("doclet.Packages"));
|
||||
Content dt = HtmlTree.DT(link);
|
||||
dt.addContent(" - ");
|
||||
dt.addContent(getResource("doclet.package"));
|
||||
dt.addContent(contents.package_);
|
||||
dt.addContent(" " + utils.getPackageName(pkg));
|
||||
dlTree.addContent(dt);
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
@ -238,7 +237,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
LinkInfoImpl.Kind.INDEX, typeElement).strong(true));
|
||||
si.setContainingPackage(utils.getPackageName(utils.containingPackage(typeElement)));
|
||||
si.setLabel(utils.getSimpleName(typeElement));
|
||||
si.setCategory(getResource("doclet.Types").toString());
|
||||
si.setCategory(resources.getText("doclet.Types"));
|
||||
Content dt = HtmlTree.DT(link);
|
||||
dt.addContent(" - ");
|
||||
addClassInfo(typeElement, dt);
|
||||
@ -256,7 +255,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
* @param contentTree the content tree to which the class info will be added
|
||||
*/
|
||||
protected void addClassInfo(TypeElement te, Content contentTree) {
|
||||
contentTree.addContent(getResource("doclet.in",
|
||||
contentTree.addContent(contents.getContent("doclet.in",
|
||||
utils.getTypeElementName(te, false),
|
||||
getPackageLink(utils.containingPackage(te),
|
||||
utils.getPackageName(utils.containingPackage(te)))
|
||||
@ -286,7 +285,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
} else {
|
||||
si.setLabel(name);
|
||||
}
|
||||
si.setCategory(getResource("doclet.Members").toString());
|
||||
si.setCategory(resources.getText("doclet.Members"));
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
|
||||
getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
|
||||
Content dt = HtmlTree.DT(span);
|
||||
@ -304,11 +303,11 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
HtmlTree labelLink = HtmlTree.A(path, new StringContent(sii.getLabel()));
|
||||
Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.searchTagLink, labelLink));
|
||||
dt.addContent(" - ");
|
||||
dt.addContent(getResource("doclet.Search_tag_in", sii.getHolder()));
|
||||
dt.addContent(contents.getContent("doclet.Search_tag_in", sii.getHolder()));
|
||||
dlTree.addContent(dt);
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
if (sii.getDescription().isEmpty()) {
|
||||
dd.addContent(getSpace());
|
||||
dd.addContent(Contents.SPACE);
|
||||
} else {
|
||||
dd.addContent(sii.getDescription());
|
||||
}
|
||||
@ -326,7 +325,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
*/
|
||||
protected void addComment(Element element, Content contentTree) {
|
||||
List<? extends DocTree> tags;
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.block);
|
||||
if (utils.isDeprecated(element)) {
|
||||
@ -360,15 +359,15 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
TypeElement containing = utils.getEnclosingTypeElement(member);
|
||||
String classdesc = utils.getTypeElementName(containing, true) + " ";
|
||||
if (utils.isField(member)) {
|
||||
Content resource = getResource(utils.isStatic(member)
|
||||
Content resource = contents.getContent(utils.isStatic(member)
|
||||
? "doclet.Static_variable_in"
|
||||
: "doclet.Variable_in", classdesc);
|
||||
contentTree.addContent(resource);
|
||||
} else if (utils.isConstructor(member)) {
|
||||
contentTree.addContent(
|
||||
getResource("doclet.Constructor_for", classdesc));
|
||||
contents.getContent("doclet.Constructor_for", classdesc));
|
||||
} else if (utils.isMethod(member)) {
|
||||
Content resource = getResource(utils.isStatic(member)
|
||||
Content resource = contents.getContent(utils.isStatic(member)
|
||||
? "doclet.Static_method_in"
|
||||
: "doclet.Method_in", classdesc);
|
||||
contentTree.addContent(resource);
|
||||
|
||||
@ -33,13 +33,9 @@ import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.Modifier;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.TypeParameterElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.util.SimpleElementVisitor9;
|
||||
|
||||
import com.sun.source.doctree.DocTree;
|
||||
import com.sun.tools.javac.util.DefinedBy;
|
||||
import com.sun.tools.javac.util.DefinedBy.Api;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
|
||||
@ -48,6 +44,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.taglets.DeprecatedTaglet;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
@ -73,6 +70,9 @@ public abstract class AbstractMemberWriter {
|
||||
protected final ConfigurationImpl configuration;
|
||||
protected final Utils utils;
|
||||
protected final SubWriterHolderWriter writer;
|
||||
protected final Contents contents;
|
||||
protected final Resources resources;
|
||||
|
||||
protected final TypeElement typeElement;
|
||||
protected Map<String, Integer> typeMap = new LinkedHashMap<>();
|
||||
protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class);
|
||||
@ -86,7 +86,9 @@ public abstract class AbstractMemberWriter {
|
||||
this.writer = writer;
|
||||
this.nodepr = configuration.nodeprecated;
|
||||
this.typeElement = typeElement;
|
||||
this.utils = writer.configuration.utils;
|
||||
this.utils = configuration.utils;
|
||||
this.contents = configuration.contents;
|
||||
this.resources = configuration.resources;
|
||||
}
|
||||
|
||||
public AbstractMemberWriter(SubWriterHolderWriter writer) {
|
||||
@ -258,7 +260,7 @@ public abstract class AbstractMemberWriter {
|
||||
if (!set.isEmpty()) {
|
||||
String mods = set.stream().map(m -> m.toString()).collect(Collectors.joining(" "));
|
||||
htmltree.addContent(mods);
|
||||
htmltree.addContent(writer.getSpace());
|
||||
htmltree.addContent(Contents.SPACE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,7 +288,7 @@ public abstract class AbstractMemberWriter {
|
||||
addModifier(member, code);
|
||||
if (type == null) {
|
||||
code.addContent(utils.isClass(member) ? "class" : "interface");
|
||||
code.addContent(writer.getSpace());
|
||||
code.addContent(Contents.SPACE);
|
||||
} else {
|
||||
List<? extends TypeParameterElement> list = utils.isExecutableElement(member)
|
||||
? ((ExecutableElement)member).getTypeParameters()
|
||||
@ -299,7 +301,7 @@ public abstract class AbstractMemberWriter {
|
||||
if (typeParameters.charCount() > 10) {
|
||||
code.addContent(new HtmlTree(HtmlTag.BR));
|
||||
} else {
|
||||
code.addContent(writer.getSpace());
|
||||
code.addContent(Contents.SPACE);
|
||||
}
|
||||
code.addContent(
|
||||
writer.getLink(new LinkInfoImpl(configuration,
|
||||
@ -394,6 +396,7 @@ public abstract class AbstractMemberWriter {
|
||||
* @param ped The <code>ProgramElement</code> being checked.
|
||||
* return true if the <code>ProgramElement</code> is being inherited and
|
||||
* false otherwise.
|
||||
*@return true if inherited
|
||||
*/
|
||||
protected boolean isInherited(Element ped){
|
||||
return (!utils.isPrivate(ped) &&
|
||||
@ -413,7 +416,7 @@ public abstract class AbstractMemberWriter {
|
||||
protected void addDeprecatedAPI(Collection<Element> deprmembers, String headingKey,
|
||||
String tableSummary, List<String> tableHeader, Content contentTree) {
|
||||
if (deprmembers.size() > 0) {
|
||||
Content caption = writer.getTableCaption(configuration.getResource(headingKey));
|
||||
Content caption = writer.getTableCaption(configuration.getContent(headingKey));
|
||||
Content table = (configuration.isOutputHtml5())
|
||||
? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
|
||||
: HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
|
||||
@ -536,7 +539,7 @@ public abstract class AbstractMemberWriter {
|
||||
|
||||
protected void serialWarning(Element e, String key, String a1, String a2) {
|
||||
if (configuration.serialwarn) {
|
||||
configuration.getDocletSpecificMsg().warning(e, key, a1, a2);
|
||||
configuration.messages.warning(e, key, a1, a2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
|
||||
* @param filename Name of the module index file to be generated.
|
||||
*/
|
||||
public AbstractModuleIndexWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
DocPath filename) {
|
||||
super(configuration, filename);
|
||||
modules = configuration.modulePackages;
|
||||
}
|
||||
@ -259,7 +259,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
|
||||
* @return a Content object to be added to the documentation tree
|
||||
*/
|
||||
protected Content getNavLinkContents() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2016, 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
|
||||
@ -65,7 +65,7 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
|
||||
* @param filename Name of the package index file to be generated.
|
||||
*/
|
||||
public AbstractPackageIndexWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
DocPath filename) {
|
||||
super(configuration, filename);
|
||||
packages = configuration.packages;
|
||||
}
|
||||
@ -191,7 +191,7 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
|
||||
* @return a Content object to be added to the documentation tree
|
||||
*/
|
||||
protected Content getNavLinkContents() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
|
||||
@ -71,8 +71,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
protected AbstractTreeWriter(ConfigurationImpl configuration,
|
||||
DocPath filename, ClassTree classtree)
|
||||
throws IOException {
|
||||
DocPath filename, ClassTree classtree) {
|
||||
super(configuration, filename);
|
||||
this.classtree = classtree;
|
||||
}
|
||||
@ -121,7 +120,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
|
||||
HtmlTree div, boolean isEnums) {
|
||||
if (!sset.isEmpty()) {
|
||||
TypeElement firstTypeElement = sset.first();
|
||||
Content headingContent = getResource(heading);
|
||||
Content headingContent = contents.getContent(heading);
|
||||
Content sectionHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
|
||||
headingContent);
|
||||
HtmlTree htmlTree;
|
||||
@ -162,7 +161,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
|
||||
isFirst = false;
|
||||
if (utils.isInterface(typeElement)) {
|
||||
contentTree.addContent(" (");
|
||||
contentTree.addContent(getResource("doclet.also"));
|
||||
contentTree.addContent(contents.also);
|
||||
contentTree.addContent(" extends ");
|
||||
} else {
|
||||
contentTree.addContent(" (implements ");
|
||||
@ -196,7 +195,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
|
||||
* @return a content tree for the tree label
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, treeLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.treeLabel);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -78,8 +79,7 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public AllClassesFrameWriter(ConfigurationImpl configuration,
|
||||
DocPath filename, IndexBuilder indexbuilder)
|
||||
throws IOException {
|
||||
DocPath filename, IndexBuilder indexbuilder) {
|
||||
super(configuration, filename);
|
||||
this.indexbuilder = indexbuilder;
|
||||
}
|
||||
@ -100,15 +100,13 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
|
||||
allclassgen = new AllClassesFrameWriter(configuration,
|
||||
filename, indexbuilder);
|
||||
allclassgen.buildAllClassesFile(true);
|
||||
allclassgen.close();
|
||||
filename = DocPaths.ALLCLASSES_NOFRAME;
|
||||
allclassgen = new AllClassesFrameWriter(configuration,
|
||||
filename, indexbuilder);
|
||||
allclassgen.buildAllClassesFile(false);
|
||||
allclassgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.
|
||||
error("doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -122,7 +120,7 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
|
||||
String label = configuration.getText("doclet.All_Classes");
|
||||
Content body = getBody(false, getWindowTitle(label));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
|
||||
HtmlStyle.bar, allclassesLabel);
|
||||
HtmlStyle.bar, contents.allClassesLabel);
|
||||
body.addContent(heading);
|
||||
Content ul = new HtmlTree(HtmlTag.UL);
|
||||
// Generate the class links and add it to the tdFont tree.
|
||||
|
||||
@ -111,7 +111,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
|
||||
memberDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.fieldDetailsLabel);
|
||||
contents.fieldDetailsLabel);
|
||||
memberDetailsTree.addContent(heading);
|
||||
writer.printedAnnotationFieldHeading = true;
|
||||
}
|
||||
@ -142,7 +142,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
|
||||
writer.getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.MEMBER, getType(member)));
|
||||
pre.addContent(link);
|
||||
pre.addContent(writer.getSpace());
|
||||
pre.addContent(Contents.SPACE);
|
||||
if (configuration.linksource) {
|
||||
Content memberName = new StringContent(name(member));
|
||||
writer.addSrcLink(member, memberName, pre);
|
||||
@ -192,19 +192,12 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
|
||||
return getMemberTree(annotationDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Field_Summary"));
|
||||
contents.fieldSummaryLabel);
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
@ -221,7 +214,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Fields");
|
||||
return configuration.getContent("doclet.Fields");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -296,9 +289,9 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
|
||||
if (link) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.ANNOTATION_TYPE_FIELD_SUMMARY,
|
||||
writer.getResource("doclet.navField"));
|
||||
contents.navField);
|
||||
} else {
|
||||
return writer.getResource("doclet.navField");
|
||||
return contents.navField;
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,9 +302,9 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.ANNOTATION_TYPE_FIELD_DETAIL,
|
||||
writer.getResource("doclet.navField")));
|
||||
contents.navField));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navField"));
|
||||
liNav.addContent(contents.navField);
|
||||
}
|
||||
}
|
||||
private TypeMirror getType(Element member) {
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -96,7 +94,7 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
|
||||
ExecutableElement ee = (ExecutableElement)member;
|
||||
AnnotationValue value = ee.getDefaultValue();
|
||||
if (value != null) {
|
||||
Content dt = HtmlTree.DT(writer.getResource("doclet.Default"));
|
||||
Content dt = HtmlTree.DT(contents.default_);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
Content dd = HtmlTree.DD(new StringContent(value.toString()));
|
||||
dl.addContent(dd);
|
||||
@ -105,19 +103,12 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Annotation_Type_Optional_Member_Summary"));
|
||||
contents.annotateTypeOptionalMemberSummaryLabel);
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
@ -125,16 +116,16 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Annotation_Type_Optional_Member_Summary"),
|
||||
configuration.getText("doclet.annotation_type_optional_members"));
|
||||
return resources.getText("doclet.Member_Table_Summary",
|
||||
resources.getText("doclet.Annotation_Type_Optional_Member_Summary"),
|
||||
resources.getText("doclet.annotation_type_optional_members"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Annotation_Type_Optional_Members");
|
||||
return configuration.getContent("doclet.Annotation_Type_Optional_Members");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,9 +154,9 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
|
||||
if (link) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY,
|
||||
writer.getResource("doclet.navAnnotationTypeOptionalMember"));
|
||||
contents.navAnnotationTypeOptionalMember);
|
||||
} else {
|
||||
return writer.getResource("doclet.navAnnotationTypeOptionalMember");
|
||||
return contents.navAnnotationTypeOptionalMember;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
|
||||
memberDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.annotationTypeDetailsLabel);
|
||||
contents.annotationTypeDetailsLabel);
|
||||
memberDetailsTree.addContent(heading);
|
||||
writer.printedAnnotationHeading = true;
|
||||
}
|
||||
@ -143,7 +143,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
|
||||
writer.getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.MEMBER, getType(member)));
|
||||
pre.addContent(link);
|
||||
pre.addContent(writer.getSpace());
|
||||
pre.addContent(Contents.SPACE);
|
||||
if (configuration.linksource) {
|
||||
Content memberName = new StringContent(name(member));
|
||||
writer.addSrcLink(member, memberName, pre);
|
||||
@ -193,19 +193,12 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
|
||||
return getMemberTree(annotationDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Annotation_Type_Required_Member_Summary"));
|
||||
contents.annotateTypeRequiredMemberSummaryLabel);
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
@ -222,7 +215,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Annotation_Type_Required_Members");
|
||||
return configuration.getContent("doclet.Annotation_Type_Required_Members");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -297,9 +290,9 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
|
||||
if (link) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY,
|
||||
writer.getResource("doclet.navAnnotationTypeRequiredMember"));
|
||||
contents.navAnnotationTypeRequiredMember);
|
||||
} else {
|
||||
return writer.getResource("doclet.navAnnotationTypeRequiredMember");
|
||||
return contents.navAnnotationTypeRequiredMember;
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,9 +303,9 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL,
|
||||
writer.getResource("doclet.navAnnotationTypeMember")));
|
||||
contents.navAnnotationTypeMember));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember"));
|
||||
liNav.addContent(contents.navAnnotationTypeMember);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
@Override
|
||||
protected Content getNavLinkModule() {
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(annotationType),
|
||||
moduleLabel);
|
||||
contents.moduleLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -111,7 +111,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
@Override
|
||||
protected Content getNavLinkPackage() {
|
||||
Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
|
||||
packageLabel);
|
||||
contents.packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -123,7 +123,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
*/
|
||||
@Override
|
||||
protected Content getNavLinkClass() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.classLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
*/
|
||||
@Override
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel);
|
||||
Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), contents.useLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -150,11 +150,11 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
if (prev != null) {
|
||||
Content prevLink = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS, utils.asTypeElement(prev))
|
||||
.label(prevclassLabel).strong(true));
|
||||
.label(contents.prevClassLabel).strong(true));
|
||||
li = HtmlTree.LI(prevLink);
|
||||
}
|
||||
else
|
||||
li = HtmlTree.LI(prevclassLabel);
|
||||
li = HtmlTree.LI(contents.prevClassLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -169,11 +169,11 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
if (next != null) {
|
||||
Content nextLink = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS, utils.asTypeElement(next))
|
||||
.label(nextclassLabel).strong(true));
|
||||
.label(contents.nextClassLabel).strong(true));
|
||||
li = HtmlTree.LI(nextLink);
|
||||
}
|
||||
else
|
||||
li = HtmlTree.LI(nextclassLabel);
|
||||
li = HtmlTree.LI(contents.nextClassLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -320,13 +320,13 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
List<? extends DocTree> deprs = utils.getBlockTags(annotationType, DocTree.Kind.DEPRECATED);
|
||||
if (utils.isDeprecated(annotationType)) {
|
||||
CommentHelper ch = utils.getCommentHelper(annotationType);
|
||||
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
|
||||
if (!deprs.isEmpty()) {
|
||||
|
||||
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
|
||||
if (!commentTags.isEmpty()) {
|
||||
div.addContent(getSpace());
|
||||
div.addContent(Contents.SPACE);
|
||||
addInlineDeprecatedComment(annotationType, deprs.get(0), div);
|
||||
}
|
||||
}
|
||||
@ -340,7 +340,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
@Override
|
||||
protected Content getNavLinkTree() {
|
||||
Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE,
|
||||
treeLabel, "", "");
|
||||
contents.treeLabel, "", "");
|
||||
Content li = HtmlTree.LI(treeLinkContent);
|
||||
return li;
|
||||
}
|
||||
@ -368,8 +368,8 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected Content getNavSummaryLinks() throws Exception {
|
||||
Content li = HtmlTree.LI(summaryLabel);
|
||||
li.addContent(getSpace());
|
||||
Content li = HtmlTree.LI(contents.summaryLabel);
|
||||
li.addContent(Contents.SPACE);
|
||||
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
|
||||
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
|
||||
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
|
||||
@ -406,7 +406,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
AbstractMemberWriter writer = ((AbstractMemberWriter) builder.
|
||||
getMemberSummaryWriter(type));
|
||||
if (writer == null) {
|
||||
liNav.addContent(getResource(label));
|
||||
liNav.addContent(contents.getContent(label));
|
||||
} else {
|
||||
liNav.addContent(writer.getNavSummaryLink(null,
|
||||
! builder.getVisibleMemberMap(type).noVisibleMembers()));
|
||||
@ -420,8 +420,8 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected Content getNavDetailLinks() throws Exception {
|
||||
Content li = HtmlTree.LI(detailLabel);
|
||||
li.addContent(getSpace());
|
||||
Content li = HtmlTree.LI(contents.detailLabel);
|
||||
li.addContent(Contents.SPACE);
|
||||
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
|
||||
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
|
||||
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
|
||||
@ -438,7 +438,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
if (writerField != null) {
|
||||
writerField.addNavDetailLink(!utils.getAnnotationFields(annotationType).isEmpty(), liNavField);
|
||||
} else {
|
||||
liNavField.addContent(getResource("doclet.navField"));
|
||||
liNavField.addContent(contents.navField);
|
||||
}
|
||||
addNavGap(liNavField);
|
||||
ulNav.addContent(liNavField);
|
||||
@ -451,7 +451,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
writerRequired.addNavDetailLink(!annotationType.getAnnotationMirrors().isEmpty(), liNavReq);
|
||||
ulNav.addContent(liNavReq);
|
||||
} else {
|
||||
Content liNav = HtmlTree.LI(getResource("doclet.navAnnotationTypeMember"));
|
||||
Content liNav = HtmlTree.LI(contents.navAnnotationTypeMember);
|
||||
ulNav.addContent(liNav);
|
||||
}
|
||||
return ulNav;
|
||||
|
||||
@ -47,6 +47,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
@ -226,11 +227,10 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
try {
|
||||
clsgen = new ClassUseWriter(configuration, mapper, path, typeElement);
|
||||
clsgen.generateClassUseFile();
|
||||
clsgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.
|
||||
error("doclet.exception_encountered",
|
||||
exc.toString(), path.getPath());
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), path.getPath());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
@ -245,7 +245,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
if (pkgSet.size() > 0) {
|
||||
addClassUse(div);
|
||||
} else {
|
||||
div.addContent(getResource("doclet.ClassUse_No.usage.of.0",
|
||||
div.addContent(contents.getContent("doclet.ClassUse_No.usage.of.0",
|
||||
utils.getFullyQualifiedName(typeElement)));
|
||||
}
|
||||
if (configuration.allowTag(HtmlTag.MAIN)) {
|
||||
@ -287,7 +287,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
* @param contentTree the content tree to which the packages elements will be added
|
||||
*/
|
||||
protected void addPackageList(Content contentTree) throws IOException {
|
||||
Content caption = getTableCaption(configuration.getResource(
|
||||
Content caption = getTableCaption(configuration.getContent(
|
||||
"doclet.ClassUse_Packages.that.use.0",
|
||||
getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement))));
|
||||
@ -320,7 +320,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
pkgToPackageAnnotations.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Content caption = getTableCaption(configuration.getResource(
|
||||
Content caption = getTableCaption(configuration.getContent(
|
||||
"doclet.ClassUse_PackageAnnotation",
|
||||
getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement))));
|
||||
@ -360,10 +360,10 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(markerAnchor)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, markerAnchor);
|
||||
Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
|
||||
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
|
||||
typeElement)),
|
||||
getPackageLink(pkg, utils.getPackageName(pkg)));
|
||||
Content link = contents.getContent("doclet.ClassUse_Uses.of.0.in.1",
|
||||
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
|
||||
typeElement)),
|
||||
getPackageLink(pkg, utils.getPackageName(pkg)));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
|
||||
htmlTree.addContent(heading);
|
||||
addClassUse(pkg, htmlTree);
|
||||
@ -404,67 +404,67 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement));
|
||||
Content pkgLink = getPackageLink(pkg, utils.getPackageName(pkg));
|
||||
classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_Annotation", classLink,
|
||||
configuration.getContent("doclet.ClassUse_Annotation", classLink,
|
||||
pkgLink), classUseTableSummary, contentTree);
|
||||
classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_TypeParameter", classLink,
|
||||
configuration.getContent("doclet.ClassUse_TypeParameter", classLink,
|
||||
pkgLink), classUseTableSummary, contentTree);
|
||||
classSubWriter.addUseInfo(pkgToSubclass.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_Subclass", classLink,
|
||||
configuration.getContent("doclet.ClassUse_Subclass", classLink,
|
||||
pkgLink), subclassUseTableSummary, contentTree);
|
||||
classSubWriter.addUseInfo(pkgToSubinterface.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_Subinterface", classLink,
|
||||
configuration.getContent("doclet.ClassUse_Subinterface", classLink,
|
||||
pkgLink), subinterfaceUseTableSummary, contentTree);
|
||||
classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_ImplementingClass", classLink,
|
||||
configuration.getContent("doclet.ClassUse_ImplementingClass", classLink,
|
||||
pkgLink), classUseTableSummary, contentTree);
|
||||
fieldSubWriter.addUseInfo(pkgToField.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_Field", classLink,
|
||||
configuration.getContent("doclet.ClassUse_Field", classLink,
|
||||
pkgLink), fieldUseTableSummary, contentTree);
|
||||
fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_FieldAnnotations", classLink,
|
||||
configuration.getContent("doclet.ClassUse_FieldAnnotations", classLink,
|
||||
pkgLink), fieldUseTableSummary, contentTree);
|
||||
fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_FieldTypeParameter", classLink,
|
||||
configuration.getContent("doclet.ClassUse_FieldTypeParameter", classLink,
|
||||
pkgLink), fieldUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_MethodAnnotations", classLink,
|
||||
configuration.getContent("doclet.ClassUse_MethodAnnotations", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_MethodParameterAnnotations", classLink,
|
||||
configuration.getContent("doclet.ClassUse_MethodParameterAnnotations", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_MethodTypeParameter", classLink,
|
||||
configuration.getContent("doclet.ClassUse_MethodTypeParameter", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_MethodReturn", classLink,
|
||||
configuration.getContent("doclet.ClassUse_MethodReturn", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_MethodReturnTypeParameter", classLink,
|
||||
configuration.getContent("doclet.ClassUse_MethodReturnTypeParameter", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_MethodArgs", classLink,
|
||||
configuration.getContent("doclet.ClassUse_MethodArgs", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_MethodArgsTypeParameters", classLink,
|
||||
configuration.getContent("doclet.ClassUse_MethodArgsTypeParameters", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_MethodThrows", classLink,
|
||||
configuration.getContent("doclet.ClassUse_MethodThrows", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_ConstructorAnnotations", classLink,
|
||||
configuration.getContent("doclet.ClassUse_ConstructorAnnotations", classLink,
|
||||
pkgLink), constructorUseTableSummary, contentTree);
|
||||
constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
|
||||
configuration.getContent("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
|
||||
pkgLink), constructorUseTableSummary, contentTree);
|
||||
constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_ConstructorArgs", classLink,
|
||||
configuration.getContent("doclet.ClassUse_ConstructorArgs", classLink,
|
||||
pkgLink), constructorUseTableSummary, contentTree);
|
||||
constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
|
||||
configuration.getContent("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
|
||||
pkgLink), constructorUseTableSummary, contentTree);
|
||||
constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg),
|
||||
configuration.getResource("doclet.ClassUse_ConstructorThrows", classLink,
|
||||
configuration.getContent("doclet.ClassUse_ConstructorThrows", classLink,
|
||||
pkgLink), constructorUseTableSummary, contentTree);
|
||||
}
|
||||
|
||||
@ -490,7 +490,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
bodyTree.addContent(htmlTree);
|
||||
}
|
||||
ContentBuilder headContent = new ContentBuilder();
|
||||
headContent.addContent(getResource("doclet.ClassUse_Title", cltype));
|
||||
headContent.addContent(contents.getContent("doclet.ClassUse_Title", cltype));
|
||||
headContent.addContent(new HtmlTree(HtmlTag.BR));
|
||||
headContent.addContent(clname);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
|
||||
@ -512,7 +512,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
@Override
|
||||
protected Content getNavLinkModule() {
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement),
|
||||
moduleLabel);
|
||||
contents.moduleLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -524,7 +524,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content linkContent =
|
||||
getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY), packageLabel);
|
||||
getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY), contents.packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -548,7 +548,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
* @return a content tree for the use link
|
||||
*/
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.useLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -559,8 +559,8 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content linkContent = utils.isEnclosingPackageIncluded(typeElement)
|
||||
? getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), treeLabel)
|
||||
: getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), treeLabel);
|
||||
? getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), contents.treeLabel)
|
||||
: getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), contents.treeLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
@Override
|
||||
protected Content getNavLinkModule() {
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement),
|
||||
moduleLabel);
|
||||
contents.moduleLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -125,7 +125,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
@Override
|
||||
protected Content getNavLinkPackage() {
|
||||
Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
|
||||
packageLabel);
|
||||
contents.packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -137,7 +137,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
*/
|
||||
@Override
|
||||
protected Content getNavLinkClass() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.classLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
*/
|
||||
@Override
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel);
|
||||
Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), contents.useLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -164,11 +164,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
if (prev != null) {
|
||||
Content prevLink = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS, prev)
|
||||
.label(prevclassLabel).strong(true));
|
||||
.label(contents.prevClassLabel).strong(true));
|
||||
li = HtmlTree.LI(prevLink);
|
||||
}
|
||||
else
|
||||
li = HtmlTree.LI(prevclassLabel);
|
||||
li = HtmlTree.LI(contents.prevClassLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -183,11 +183,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
if (next != null) {
|
||||
Content nextLink = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS, next)
|
||||
.label(nextclassLabel).strong(true));
|
||||
.label(contents.nextClassLabel).strong(true));
|
||||
li = HtmlTree.LI(nextLink);
|
||||
}
|
||||
else
|
||||
li = HtmlTree.LI(nextclassLabel);
|
||||
li = HtmlTree.LI(contents.nextClassLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -210,18 +210,18 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
div.addStyle(HtmlStyle.header);
|
||||
ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(typeElement);
|
||||
if (mdle != null && !mdle.isUnnamed()) {
|
||||
Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, moduleLabel);
|
||||
Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, contents.moduleLabel);
|
||||
Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
|
||||
moduleNameDiv.addContent(getSpace());
|
||||
moduleNameDiv.addContent(Contents.SPACE);
|
||||
moduleNameDiv.addContent(getModuleLink(mdle,
|
||||
new StringContent(mdle.getQualifiedName().toString())));
|
||||
div.addContent(moduleNameDiv);
|
||||
}
|
||||
PackageElement pkg = utils.containingPackage(typeElement);
|
||||
if (!pkg.isUnnamed()) {
|
||||
Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInClass, packageLabel);
|
||||
Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInClass, contents.packageLabel);
|
||||
Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classPackageLabel);
|
||||
pkgNameDiv.addContent(getSpace());
|
||||
pkgNameDiv.addContent(Contents.SPACE);
|
||||
Content pkgNameContent = getPackageLink(pkg,
|
||||
new StringContent(utils.getPackageName(pkg)));
|
||||
pkgNameDiv.addContent(pkgNameContent);
|
||||
@ -469,8 +469,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
}
|
||||
Set<TypeElement> subclasses = classtree.directSubClasses(typeElement, false);
|
||||
if (!subclasses.isEmpty()) {
|
||||
Content label = getResource(
|
||||
"doclet.Subclasses");
|
||||
Content label = contents.subclassesLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUBCLASSES,
|
||||
@ -488,8 +487,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
if (utils.isInterface(typeElement)) {
|
||||
Set<TypeElement> subInterfaces = classtree.allSubClasses(typeElement, false);
|
||||
if (!subInterfaces.isEmpty()) {
|
||||
Content label = getResource(
|
||||
"doclet.Subinterfaces");
|
||||
Content label = contents.subinterfacesLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUBINTERFACES,
|
||||
@ -513,8 +511,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
}
|
||||
Set<TypeElement> implcl = classtree.implementingClasses(typeElement);
|
||||
if (!implcl.isEmpty()) {
|
||||
Content label = getResource(
|
||||
"doclet.Implementing_Classes");
|
||||
Content label = contents.implementingClassesLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.addContent(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_CLASSES,
|
||||
@ -531,8 +528,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
SortedSet<TypeMirror> interfaces = new TreeSet<>(utils.makeTypeMirrorClassUseComparator());
|
||||
interfaces.addAll(utils.getAllInterfaces(typeElement));
|
||||
if (utils.isClass(typeElement) && !interfaces.isEmpty()) {
|
||||
Content label = getResource(
|
||||
"doclet.All_Implemented_Interfaces");
|
||||
Content label = contents.allImplementedInterfacesLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.addContent(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_INTERFACES, interfaces));
|
||||
@ -550,7 +546,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
interfaces.addAll(utils.getAllInterfaces(typeElement));
|
||||
|
||||
if (utils.isInterface(typeElement) && !interfaces.isEmpty()) {
|
||||
Content label = getResource("doclet.All_Superinterfaces");
|
||||
Content label = contents.allSuperinterfacesLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUPER_INTERFACES, interfaces));
|
||||
@ -569,10 +565,10 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
new SimpleElementVisitor8<Void, Void>() {
|
||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||
public Void visitType(TypeElement e, Void p) {
|
||||
String label = utils.isInterface(e)
|
||||
? "doclet.Enclosing_Interface"
|
||||
: "doclet.Enclosing_Class";
|
||||
Content dt = HtmlTree.DT(getResource(label));
|
||||
Content label = utils.isInterface(e)
|
||||
? contents.enclosingInterfaceLabel
|
||||
: contents.enclosingClassLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
dd.addContent(getLink(new LinkInfoImpl(configuration,
|
||||
@ -590,10 +586,10 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
@Override
|
||||
public void addFunctionalInterfaceInfo (Content classInfoTree) {
|
||||
if (isFunctionalInterface()) {
|
||||
Content dt = HtmlTree.DT(getResource("doclet.Functional_Interface"));
|
||||
Content dt = HtmlTree.DT(contents.functionalInterface);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
dd.addContent(getResource("doclet.Functional_Interface_Message"));
|
||||
dd.addContent(contents.functionalInterfaceMessage);
|
||||
dl.addContent(dd);
|
||||
classInfoTree.addContent(dl);
|
||||
}
|
||||
@ -619,14 +615,14 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
classInfoTree.addContent(hr);
|
||||
List<? extends DocTree> deprs = utils.getBlockTags(typeElement, DocTree.Kind.DEPRECATED);
|
||||
if (utils.isDeprecated(typeElement)) {
|
||||
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
|
||||
if (!deprs.isEmpty()) {
|
||||
CommentHelper ch = utils.getCommentHelper(typeElement);
|
||||
DocTree dt = deprs.get(0);
|
||||
List<? extends DocTree> commentTags = ch.getBody(configuration, dt);
|
||||
if (!commentTags.isEmpty()) {
|
||||
div.addContent(getSpace());
|
||||
div.addContent(Contents.SPACE);
|
||||
addInlineDeprecatedComment(typeElement, deprs.get(0), div);
|
||||
}
|
||||
}
|
||||
@ -671,7 +667,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
@Override
|
||||
protected Content getNavLinkTree() {
|
||||
Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE,
|
||||
treeLabel, "", "");
|
||||
contents.treeLabel, "", "");
|
||||
Content li = HtmlTree.LI(treeLinkContent);
|
||||
return li;
|
||||
}
|
||||
@ -697,8 +693,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
* @return the content tree for the navigation summary links
|
||||
*/
|
||||
protected Content getNavSummaryLinks() throws Exception {
|
||||
Content li = HtmlTree.LI(summaryLabel);
|
||||
li.addContent(getSpace());
|
||||
Content li = HtmlTree.LI(contents.summaryLabel);
|
||||
li.addContent(Contents.SPACE);
|
||||
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
|
||||
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
|
||||
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
|
||||
@ -713,7 +709,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
AbstractMemberWriter writer =
|
||||
((AbstractMemberWriter) memberSummaryBuilder.getMemberSummaryWriter(kind));
|
||||
if (writer == null) {
|
||||
liNav.addContent(getResource(VisibleMemberMap.Kind.getNavLinkLabels(kind)));
|
||||
liNav.addContent(contents.getContent(VisibleMemberMap.Kind.getNavLinkLabels(kind)));
|
||||
} else {
|
||||
writer.addNavSummaryLink(
|
||||
memberSummaryBuilder.members(kind),
|
||||
@ -734,8 +730,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected Content getNavDetailLinks() throws Exception {
|
||||
Content li = HtmlTree.LI(detailLabel);
|
||||
li.addContent(getSpace());
|
||||
Content li = HtmlTree.LI(contents.detailLabel);
|
||||
li.addContent(Contents.SPACE);
|
||||
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
|
||||
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
|
||||
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
|
||||
@ -751,7 +747,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
||||
continue;
|
||||
}
|
||||
if (writer == null) {
|
||||
liNav.addContent(getResource(VisibleMemberMap.Kind.getNavLinkLabels(kind)));
|
||||
liNav.addContent(contents.getContent(VisibleMemberMap.Kind.getNavLinkLabels(kind)));
|
||||
} else {
|
||||
writer.addNavDetailLink(memberSummaryBuilder.members(kind), liNav);
|
||||
}
|
||||
|
||||
@ -40,23 +40,22 @@ import javax.tools.StandardLocation;
|
||||
|
||||
import com.sun.source.util.DocTreePath;
|
||||
import com.sun.tools.doclint.DocLint;
|
||||
import com.sun.tools.javac.code.Symbol.ClassSymbol;
|
||||
import com.sun.tools.javac.code.Symbol.ModuleSymbol;
|
||||
import com.sun.tools.javac.code.Symbol.PackageSymbol;
|
||||
|
||||
import jdk.javadoc.doclet.Doclet;
|
||||
import jdk.javadoc.doclet.DocletEnvironment;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlVersion;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Configuration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.WriterFactory;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.MessageRetriever;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
||||
import static javax.tools.Diagnostic.Kind.*;
|
||||
@ -208,10 +207,7 @@ public class ConfigurationImpl extends Configuration {
|
||||
*/
|
||||
public Map<Doclet.Option, String> doclintOpts = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Unique Resource Handler for this package.
|
||||
*/
|
||||
public final MessageRetriever standardmessage;
|
||||
public final Resources resources;
|
||||
|
||||
/**
|
||||
* First file to appear in the right-hand frame in the generated
|
||||
@ -236,13 +232,21 @@ public class ConfigurationImpl extends Configuration {
|
||||
|
||||
protected Set<Character> tagSearchIndexKeys;
|
||||
|
||||
protected Contents contents;
|
||||
|
||||
protected Messages messages;
|
||||
|
||||
/**
|
||||
* Constructor. Initializes resource for the
|
||||
* {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
|
||||
*/
|
||||
public ConfigurationImpl() {
|
||||
standardmessage = new MessageRetriever(this,
|
||||
"jdk.javadoc.internal.doclets.formats.html.resources.standard");
|
||||
resources = new Resources(this,
|
||||
Configuration.sharedResourceBundleName,
|
||||
"jdk.javadoc.internal.doclets.formats.html.resources.standard");
|
||||
|
||||
messages = new Messages(this);
|
||||
contents = new Contents(this);
|
||||
}
|
||||
|
||||
private final String versionRBName = "jdk.javadoc.internal.tool.resources.version";
|
||||
@ -269,6 +273,16 @@ public class ConfigurationImpl extends Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resources getResources() {
|
||||
return resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Messages getMessages() {
|
||||
return messages;
|
||||
}
|
||||
|
||||
protected boolean validateOptions() {
|
||||
// check shared options
|
||||
if (!generalValidOptions()) {
|
||||
@ -392,14 +406,6 @@ public class ConfigurationImpl extends Configuration {
|
||||
return htmlTag.allowTag(this.htmlVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public MessageRetriever getDocletSpecificMsg() {
|
||||
return standardmessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide the page which will appear first in the right-hand frame. It will
|
||||
* be "overview-summary.html" if "-overview" option is used or no
|
||||
@ -479,10 +485,11 @@ public class ConfigurationImpl extends Configuration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the path of the overview file and null if it does not exist.
|
||||
* Return the path of the overview file or null if it does not exist.
|
||||
*
|
||||
* @return the path of the overview file and null if it does not exist.
|
||||
* @return the path of the overview file or null if it does not exist.
|
||||
*/
|
||||
@Override
|
||||
public JavaFileObject getOverviewPath() {
|
||||
if (overviewpath != null && getFileManager() instanceof StandardJavaFileManager) {
|
||||
StandardJavaFileManager fm = (StandardJavaFileManager) getFileManager();
|
||||
@ -510,10 +517,63 @@ public class ConfigurationImpl extends Configuration {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content newContent() {
|
||||
return new ContentBuilder();
|
||||
public String getText(String key) {
|
||||
return resources.getText(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(String key, String... args) {
|
||||
return resources.getText(key, (Object[]) args);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@Override
|
||||
public Content getContent(String key) {
|
||||
return contents.getContent(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param o string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
@Override
|
||||
public Content getContent(String key, Object o) {
|
||||
return contents.getContent(key, o);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param o1 resource argument
|
||||
* @param o2 resource argument
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
@Override
|
||||
public Content getContent(String key, Object o1, Object o2) {
|
||||
return contents.getContent(key, o1, o2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param o0 string or content argument added to configuration text
|
||||
* @param o1 string or content argument added to configuration text
|
||||
* @param o2 string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
@Override
|
||||
public Content getContent(String key, Object o0, Object o1, Object o2) {
|
||||
return contents.getContent(key, o0, o1, o2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Location getLocationForPackage(PackageElement pd) {
|
||||
JavaFileManager fm = getFileManager();
|
||||
|
||||
@ -87,8 +87,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
|
||||
* @param configuration the configuration used in this run
|
||||
* of the standard doclet.
|
||||
*/
|
||||
public ConstantsSummaryWriterImpl(ConfigurationImpl configuration)
|
||||
throws IOException {
|
||||
public ConstantsSummaryWriterImpl(ConfigurationImpl configuration) {
|
||||
super(configuration, DocPaths.CONSTANT_VALUES);
|
||||
this.configuration = configuration;
|
||||
constantsTableSummary = configuration.getText("doclet.Constants_Table_Summary",
|
||||
@ -133,7 +132,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
|
||||
if (pkg.isUnnamed()) {
|
||||
link = getHyperLink(getDocLink(
|
||||
SectionName.UNNAMED_PACKAGE_ANCHOR),
|
||||
defaultPackageLabel, "", "");
|
||||
contents.defaultPackageLabel, "", "");
|
||||
} else {
|
||||
String parsedPackageName = utils.parsePackageName(pkg);
|
||||
Content packageNameContent = getPackageLabel(parsedPackageName);
|
||||
@ -150,13 +149,11 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addContentsList(Content contentTree, Content contentListTree) {
|
||||
Content titleContent = getResource(
|
||||
"doclet.Constants_Summary");
|
||||
Content titleContent = contents.constantsSummaryTitle;
|
||||
Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, titleContent);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, pHeading);
|
||||
Content headingContent = getResource(
|
||||
"doclet.Contents");
|
||||
Content headingContent = contents.contentsHeading;
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
|
||||
headingContent);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
@ -191,7 +188,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
|
||||
if (pkg.isUnnamed()) {
|
||||
summariesTree.addContent(getMarkerAnchor(
|
||||
SectionName.UNNAMED_PACKAGE_ANCHOR));
|
||||
pkgNameContent = defaultPackageLabel;
|
||||
pkgNameContent = contents.defaultPackageLabel;
|
||||
} else {
|
||||
String parsedPackageName = utils.parsePackageName(pkg);
|
||||
summariesTree.addContent(getMarkerAnchor(parsedPackageName));
|
||||
@ -315,7 +312,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
|
||||
for (Modifier mod : member.getModifiers()) {
|
||||
Content modifier = new StringContent(mod.toString());
|
||||
code.addContent(modifier);
|
||||
code.addContent(getSpace());
|
||||
code.addContent(Contents.SPACE);
|
||||
}
|
||||
Content type = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CONSTANT_SUMMARY, member.asType()));
|
||||
|
||||
@ -119,7 +119,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
constructorDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.CONSTRUCTOR_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.constructorDetailsLabel);
|
||||
contents.constructorDetailsLabel);
|
||||
constructorDetailsTree.addContent(heading);
|
||||
return constructorDetailsTree;
|
||||
}
|
||||
@ -220,14 +220,6 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
return getMemberTree(constructorDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Let the writer know whether a non public constructor was found.
|
||||
*
|
||||
@ -244,7 +236,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
@Override
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Constructor_Summary"));
|
||||
contents.constructorSummaryLabel);
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
@ -253,9 +245,9 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Constructor_Summary"),
|
||||
configuration.getText("doclet.constructors"));
|
||||
return resources.getText("doclet.Member_Table_Summary",
|
||||
resources.getText("doclet.Constructor_Summary"),
|
||||
resources.getText("doclet.constructors"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,7 +255,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Constructors");
|
||||
return contents.constructors;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -273,11 +265,11 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
public List<String> getSummaryTableHeader(Element member) {
|
||||
List<String> header = new ArrayList<>();
|
||||
if (foundNonPubConstructor) {
|
||||
header.add(configuration.getText("doclet.Modifier"));
|
||||
header.add(resources.getText("doclet.Modifier"));
|
||||
}
|
||||
header.add(configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Constructor"),
|
||||
configuration.getText("doclet.Description")));
|
||||
header.add(resources.getText("doclet.0_and_1",
|
||||
resources.getText("doclet.Constructor"),
|
||||
resources.getText("doclet.Description")));
|
||||
return header;
|
||||
}
|
||||
|
||||
@ -311,9 +303,9 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
protected Content getNavSummaryLink(TypeElement typeElement, boolean link) {
|
||||
if (link) {
|
||||
return writer.getHyperLink(SectionName.CONSTRUCTOR_SUMMARY,
|
||||
writer.getResource("doclet.navConstructor"));
|
||||
contents.navConstructor);
|
||||
} else {
|
||||
return writer.getResource("doclet.navConstructor");
|
||||
return contents.navConstructor;
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,9 +317,9 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.CONSTRUCTOR_DETAIL,
|
||||
writer.getResource("doclet.navConstructor")));
|
||||
contents.navConstructor));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navConstructor"));
|
||||
liNav.addContent(contents.navConstructor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,7 +335,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
} else if (utils.isPrivate(member)) {
|
||||
code.addContent("private ");
|
||||
} else if (utils.isPublic(member)) {
|
||||
code.addContent(writer.getSpace());
|
||||
code.addContent(Contents.SPACE);
|
||||
} else {
|
||||
code.addContent(
|
||||
configuration.getText("doclet.Package_private"));
|
||||
|
||||
@ -0,0 +1,369 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2016, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.FixedStringContent;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
|
||||
|
||||
/**
|
||||
* Constants and factory methods for common fragments of content
|
||||
* used by HtmlDoclet. The string content of these fragments is
|
||||
* generally obtained from the {@link Resources resources} found
|
||||
* in the doclet's configuration.
|
||||
*
|
||||
* @implNote
|
||||
* Many constants are made available in this class, so that they are
|
||||
* only created once per doclet-instance, instead of once per generated page.
|
||||
*/
|
||||
public class Contents {
|
||||
public static final Content SPACE = RawHtml.nbsp;
|
||||
|
||||
public final Content allClassesLabel;
|
||||
public final Content allImplementedInterfacesLabel;
|
||||
public final Content allModulesLabel;
|
||||
public final Content allPackagesLabel;
|
||||
public final Content allSuperinterfacesLabel;
|
||||
public final Content also;
|
||||
public final Content annotateTypeOptionalMemberSummaryLabel;
|
||||
public final Content annotateTypeRequiredMemberSummaryLabel;
|
||||
public final Content annotationType;
|
||||
public final Content annotationTypeDetailsLabel;
|
||||
public final Content annotationTypeMemberDetail;
|
||||
public final Content annotationTypes;
|
||||
public final Content classLabel;
|
||||
public final Content classes;
|
||||
public final Content constantsSummaryTitle;
|
||||
public final Content constructorDetailsLabel;
|
||||
public final Content constructorSummaryLabel;
|
||||
public final Content constructors;
|
||||
public final Content contentsHeading;
|
||||
public final Content defaultPackageLabel;
|
||||
public final Content default_;
|
||||
public final Content deprecatedAPI;
|
||||
public final Content deprecatedLabel;
|
||||
public final Content deprecatedPhrase;
|
||||
public final Content descfrmClassLabel;
|
||||
public final Content descfrmInterfaceLabel;
|
||||
public final Content descriptionLabel;
|
||||
public final Content detailLabel;
|
||||
public final Content enclosingClassLabel;
|
||||
public final Content enclosingInterfaceLabel;
|
||||
public final Content enumConstantDetailLabel;
|
||||
public final Content enumConstantSummary;
|
||||
public final Content enum_;
|
||||
public final Content enums;
|
||||
public final Content errors;
|
||||
public final Content exceptions;
|
||||
public final Content fieldDetailsLabel;
|
||||
public final Content fieldSummaryLabel;
|
||||
public final Content fields;
|
||||
public final Content framesLabel;
|
||||
public final Content functionalInterface;
|
||||
public final Content functionalInterfaceMessage;
|
||||
public final Content helpLabel;
|
||||
public final Content hierarchyForAllPackages;
|
||||
public final Content implementation;
|
||||
public final Content implementingClassesLabel;
|
||||
public final Content inClass;
|
||||
public final Content inInterface;
|
||||
public final Content indexLabel;
|
||||
public final Content interfaces;
|
||||
public final Content interfacesItalic;
|
||||
public final Content methodDetailLabel;
|
||||
public final Content methodSummary;
|
||||
public final Content methods;
|
||||
public final Content moduleLabel;
|
||||
public final Content moduleSubNavLabel;
|
||||
public final Content modulesLabel;
|
||||
public final Content navAnnotationTypeMember;
|
||||
public final Content navAnnotationTypeOptionalMember;
|
||||
public final Content navAnnotationTypeRequiredMember;
|
||||
public final Content navConstructor;
|
||||
public final Content navEnum;
|
||||
public final Content navField;
|
||||
public final Content navMethod;
|
||||
public final Content navModuleDescription;
|
||||
public final Content navModules;
|
||||
public final Content navNested;
|
||||
public final Content navPackages;
|
||||
public final Content navProperty;
|
||||
public final Content navServices;
|
||||
public final Content nestedClassSummary;
|
||||
public final Content nextClassLabel;
|
||||
public final Content nextLabel;
|
||||
public final Content nextLetter;
|
||||
public final Content nextModuleLabel;
|
||||
public final Content nextPackageLabel;
|
||||
public final Content noFramesLabel;
|
||||
public final Content noScriptMessage;
|
||||
public final Content overridesLabel;
|
||||
public final Content overviewLabel;
|
||||
public final Content packageHierarchies;
|
||||
public final Content packageLabel;
|
||||
public final Content package_;
|
||||
public final Content packagesLabel;
|
||||
public final Content prevClassLabel;
|
||||
public final Content prevLabel;
|
||||
public final Content prevLetter;
|
||||
public final Content prevModuleLabel;
|
||||
public final Content prevPackageLabel;
|
||||
public final Content properties;
|
||||
public final Content propertyDetailsLabel;
|
||||
public final Content propertySummary;
|
||||
public final Content seeLabel;
|
||||
public final Content serializedForm;
|
||||
public final Content specifiedByLabel;
|
||||
public final Content subclassesLabel;
|
||||
public final Content subinterfacesLabel;
|
||||
public final Content summaryLabel;
|
||||
public final Content treeLabel;
|
||||
public final Content useLabel;
|
||||
|
||||
private final Resources resources;
|
||||
|
||||
/**
|
||||
* Creates a {@code Contents} object.
|
||||
*
|
||||
* @param configuration the configuration in which to find the
|
||||
* resources used to look up resource keys, and other details.
|
||||
*/
|
||||
Contents(ConfigurationImpl configuration) {
|
||||
this.resources = configuration.getResources();
|
||||
|
||||
allClassesLabel = getNonBreakContent("doclet.All_Classes");
|
||||
allImplementedInterfacesLabel = getContent("doclet.All_Implemented_Interfaces");
|
||||
allModulesLabel = getNonBreakContent("doclet.All_Modules");
|
||||
allPackagesLabel = getNonBreakContent("doclet.All_Packages");
|
||||
allSuperinterfacesLabel = getContent("doclet.All_Superinterfaces");
|
||||
also = getContent("doclet.also");
|
||||
annotateTypeOptionalMemberSummaryLabel = getContent("doclet.Annotation_Type_Optional_Member_Summary");
|
||||
annotateTypeRequiredMemberSummaryLabel = getContent("doclet.Annotation_Type_Required_Member_Summary");
|
||||
annotationType = getContent("doclet.AnnotationType");
|
||||
annotationTypeDetailsLabel = getContent("doclet.Annotation_Type_Member_Detail");
|
||||
annotationTypeMemberDetail = getContent("doclet.Annotation_Type_Member_Detail");
|
||||
annotationTypes = getContent("doclet.AnnotationTypes");
|
||||
classLabel = getContent("doclet.Class");
|
||||
classes = getContent("doclet.Classes");
|
||||
constantsSummaryTitle = getContent("doclet.Constants_Summary");
|
||||
constructorDetailsLabel = getContent("doclet.Constructor_Detail");
|
||||
constructorSummaryLabel = getContent("doclet.Constructor_Summary");
|
||||
constructors = getContent("doclet.Constructors");
|
||||
contentsHeading = getContent("doclet.Contents");
|
||||
defaultPackageLabel = new StringContent(DocletConstants.DEFAULT_PACKAGE_NAME);
|
||||
default_ = getContent("doclet.Default");
|
||||
deprecatedAPI = getContent("doclet.Deprecated_API");
|
||||
deprecatedLabel = getContent("doclet.navDeprecated");
|
||||
deprecatedPhrase = getContent("doclet.Deprecated");
|
||||
descfrmClassLabel = getContent("doclet.Description_From_Class");
|
||||
descfrmInterfaceLabel = getContent("doclet.Description_From_Interface");
|
||||
descriptionLabel = getContent("doclet.Description");
|
||||
detailLabel = getContent("doclet.Detail");
|
||||
enclosingClassLabel = getContent("doclet.Enclosing_Class");
|
||||
enclosingInterfaceLabel = getContent("doclet.Enclosing_Interface");
|
||||
enumConstantDetailLabel = getContent("doclet.Enum_Constant_Detail");
|
||||
enumConstantSummary = getContent("doclet.Enum_Constant_Summary");
|
||||
enum_ = getContent("doclet.Enum");
|
||||
enums = getContent("doclet.Enums");
|
||||
errors = getContent("doclet.Errors");
|
||||
exceptions = getContent("doclet.Exceptions");
|
||||
fieldDetailsLabel = getContent("doclet.Field_Detail");
|
||||
fieldSummaryLabel = getContent("doclet.Field_Summary");
|
||||
fields = getContent("doclet.Fields");
|
||||
framesLabel = getContent("doclet.Frames");
|
||||
functionalInterface = getContent("doclet.Functional_Interface");
|
||||
functionalInterfaceMessage = getContent("doclet.Functional_Interface_Message");
|
||||
helpLabel = getContent("doclet.Help");
|
||||
hierarchyForAllPackages = getContent("doclet.Hierarchy_For_All_Packages");
|
||||
implementation = getContent("doclet.Implementation");
|
||||
implementingClassesLabel = getContent("doclet.Implementing_Classes");
|
||||
inClass = getContent("doclet.in_class");
|
||||
inInterface = getContent("doclet.in_interface");
|
||||
indexLabel = getContent("doclet.Index");
|
||||
interfaces = getContent("doclet.Interfaces");
|
||||
interfacesItalic = getContent("doclet.Interfaces_Italic");
|
||||
methodDetailLabel = getContent("doclet.Method_Detail");
|
||||
methodSummary = getContent("doclet.Method_Summary");
|
||||
methods = getContent("doclet.Methods");
|
||||
moduleLabel = getContent("doclet.Module");
|
||||
moduleSubNavLabel = getContent("doclet.Module_Sub_Nav");
|
||||
modulesLabel = getContent("doclet.Modules");
|
||||
navAnnotationTypeMember = getContent("doclet.navAnnotationTypeMember");
|
||||
navAnnotationTypeOptionalMember = getContent("doclet.navAnnotationTypeOptionalMember");
|
||||
navAnnotationTypeRequiredMember = getContent("doclet.navAnnotationTypeRequiredMember");
|
||||
navConstructor = getContent("doclet.navConstructor");
|
||||
navEnum = getContent("doclet.navEnum");
|
||||
navField = getContent("doclet.navField");
|
||||
navMethod = getContent("doclet.navMethod");
|
||||
navModuleDescription = getContent("doclet.navModuleDescription");
|
||||
navModules = getContent("doclet.navModules");
|
||||
navNested = getContent("doclet.navNested");
|
||||
navPackages = getContent("doclet.navPackages");
|
||||
navProperty = getContent("doclet.navProperty");
|
||||
navServices = getContent("doclet.navServices");
|
||||
nestedClassSummary = getContent("doclet.Nested_Class_Summary");
|
||||
nextClassLabel = getNonBreakContent("doclet.Next_Class");
|
||||
nextLabel = getNonBreakContent("doclet.Next");
|
||||
nextLetter = getContent("doclet.Next_Letter");
|
||||
nextModuleLabel = getNonBreakContent("doclet.Next_Module");
|
||||
nextPackageLabel = getNonBreakContent("doclet.Next_Package");
|
||||
noFramesLabel = getNonBreakContent("doclet.No_Frames");
|
||||
noScriptMessage = getContent("doclet.No_Script_Message");
|
||||
overridesLabel = getContent("doclet.Overrides");
|
||||
overviewLabel = getContent("doclet.Overview");
|
||||
packageHierarchies = getContent("doclet.Package_Hierarchies");
|
||||
packageLabel = getContent("doclet.Package");
|
||||
package_ = getContent("doclet.package");
|
||||
packagesLabel = getContent("doclet.Packages");
|
||||
prevClassLabel = getNonBreakContent("doclet.Prev_Class");
|
||||
prevLabel = getContent("doclet.Prev");
|
||||
prevLetter = getContent("doclet.Prev_Letter");
|
||||
prevModuleLabel = getNonBreakContent("doclet.Prev_Module");
|
||||
prevPackageLabel = getNonBreakContent("doclet.Prev_Package");
|
||||
properties = getContent("doclet.Properties");
|
||||
propertyDetailsLabel = getContent("doclet.Property_Detail");
|
||||
propertySummary = getContent("doclet.Property_Summary");
|
||||
seeLabel = getContent("doclet.See");
|
||||
serializedForm = getContent("doclet.Serialized_Form");
|
||||
specifiedByLabel = getContent("doclet.Specified_By");
|
||||
subclassesLabel = getContent("doclet.Subclasses");
|
||||
subinterfacesLabel = getContent("doclet.Subinterfaces");
|
||||
summaryLabel = getContent("doclet.Summary");
|
||||
treeLabel = getContent("doclet.Tree");
|
||||
useLabel = getContent("doclet.navClassUse");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a {@code Content} object, containing the string for
|
||||
* a given key in the doclet's resources.
|
||||
*
|
||||
* @param key the key for the desired string
|
||||
* @return a content tree for the string
|
||||
*/
|
||||
public Content getContent(String key) {
|
||||
return new FixedStringContent(resources.getText(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a {@code Content} object, containing the string for
|
||||
* a given key in the doclet's resources, formatted with
|
||||
* given arguments.
|
||||
*
|
||||
* @param key the key to look for in the configuration fil
|
||||
* @param key the key for the desired string
|
||||
* @param o0 string or content argument to be formatted into the result
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getContent(String key, Object o0) {
|
||||
return getContent(key, o0, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a {@code Content} object, containing the string for
|
||||
* a given key in the doclet's resources, formatted with
|
||||
* given arguments.
|
||||
|
||||
* @param key the key for the desired string
|
||||
* @param o0 string or content argument to be formatted into the result
|
||||
* @param o1 string or content argument to be formatted into the result
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getContent(String key, Object o0, Object o1) {
|
||||
return getContent(key, o0, o1, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a {@code Content} object, containing the string for
|
||||
* a given key in the doclet's resources, formatted with
|
||||
* given arguments.
|
||||
*
|
||||
* @param key the key for the desired string
|
||||
* @param o0 string or content argument to be formatted into the result
|
||||
* @param o1 string or content argument to be formatted into the result
|
||||
* @param o2 string or content argument to be formatted into the result
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getContent(String key, Object o0, Object o1, Object o2) {
|
||||
Content c = new ContentBuilder();
|
||||
Pattern p = Pattern.compile("\\{([012])\\}");
|
||||
String text = resources.getText(key); // TODO: cache
|
||||
Matcher m = p.matcher(text);
|
||||
int start = 0;
|
||||
while (m.find(start)) {
|
||||
c.addContent(text.substring(start, m.start()));
|
||||
|
||||
Object o = null;
|
||||
switch (m.group(1).charAt(0)) {
|
||||
case '0': o = o0; break;
|
||||
case '1': o = o1; break;
|
||||
case '2': o = o2; break;
|
||||
}
|
||||
|
||||
if (o == null) {
|
||||
c.addContent("{" + m.group(1) + "}");
|
||||
} else if (o instanceof String) {
|
||||
c.addContent((String) o);
|
||||
} else if (o instanceof Content) {
|
||||
c.addContent((Content) o);
|
||||
}
|
||||
|
||||
start = m.end();
|
||||
}
|
||||
|
||||
c.addContent(text.substring(start));
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a {@code Content} object, containing the string for
|
||||
* a given key in the doclet's resources, substituting
|
||||
* <code> </code> for any space characters found in
|
||||
* the named resource string.
|
||||
*
|
||||
* @param key the key for the desired string
|
||||
* @return a content tree for the string
|
||||
*/
|
||||
private Content getNonBreakContent(String key) {
|
||||
String text = resources.getText(key); // TODO: cache
|
||||
Content c = new ContentBuilder();
|
||||
int start = 0;
|
||||
int p;
|
||||
while ((p = text.indexOf(" ", start)) != -1) {
|
||||
c.addContent(text.substring(start, p));
|
||||
c.addContent(RawHtml.nbsp);
|
||||
start = p + 1;
|
||||
}
|
||||
c.addContent(text.substring(start));
|
||||
return c; // TODO: should be made immutable
|
||||
}
|
||||
}
|
||||
@ -35,6 +35,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
@ -243,10 +244,9 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
|
||||
new DeprecatedListWriter(configuration, filename);
|
||||
depr.generateDeprecatedListFile(
|
||||
new DeprecatedAPIListBuilder(configuration));
|
||||
depr.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -314,7 +314,7 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
|
||||
DeprElementKind kind, Content contentTree) {
|
||||
if (builder.hasDocumentation(kind)) {
|
||||
Content li = HtmlTree.LI(getHyperLink(getAnchorName(kind),
|
||||
getResource(getHeadingKey(kind))));
|
||||
contents.getContent(getHeadingKey(kind))));
|
||||
contentTree.addContent(li);
|
||||
}
|
||||
}
|
||||
@ -326,11 +326,11 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
|
||||
* @return a content tree for the contents list
|
||||
*/
|
||||
public Content getContentsList(DeprecatedAPIListBuilder deprapi) {
|
||||
Content headContent = getResource("doclet.Deprecated_API");
|
||||
Content headContent = contents.deprecatedAPI;
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, headContent);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
Content headingContent = getResource("doclet.Contents");
|
||||
Content headingContent = contents.contentsHeading;
|
||||
div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
|
||||
headingContent));
|
||||
Content ul = new HtmlTree(HtmlTag.UL);
|
||||
@ -379,7 +379,7 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
|
||||
* @return a content tree for the deprecated label
|
||||
*/
|
||||
protected Content getNavLinkDeprecated() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, deprecatedLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.deprecatedLabel);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
enumConstantsDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.ENUM_CONSTANT_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.enumConstantsDetailsLabel);
|
||||
contents.enumConstantDetailLabel);
|
||||
enumConstantsDetailsTree.addContent(heading);
|
||||
return enumConstantsDetailsTree;
|
||||
}
|
||||
@ -181,21 +181,13 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
return getMemberTree(enumConstantsTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Enum_Constant_Summary"));
|
||||
contents.enumConstantSummary);
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
@ -204,9 +196,9 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Enum_Constant_Summary"),
|
||||
configuration.getText("doclet.enum_constants"));
|
||||
return resources.getText("doclet.Member_Table_Summary",
|
||||
resources.getText("doclet.Enum_Constant_Summary"),
|
||||
resources.getText("doclet.enum_constants"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -214,7 +206,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Enum_Constants");
|
||||
return configuration.getContent("doclet.Enum_Constants");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -303,14 +295,14 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
if (link) {
|
||||
if (typeElement == null) {
|
||||
return writer.getHyperLink(SectionName.ENUM_CONSTANT_SUMMARY,
|
||||
writer.getResource("doclet.navEnum"));
|
||||
contents.navEnum);
|
||||
} else {
|
||||
return writer.getHyperLink(
|
||||
SectionName.ENUM_CONSTANTS_INHERITANCE,
|
||||
configuration.getClassName(typeElement), writer.getResource("doclet.navEnum"));
|
||||
configuration.getClassName(typeElement), contents.navEnum);
|
||||
}
|
||||
} else {
|
||||
return writer.getResource("doclet.navEnum");
|
||||
return contents.navEnum;
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,9 +314,9 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.ENUM_CONSTANT_DETAIL,
|
||||
writer.getResource("doclet.navEnum")));
|
||||
contents.navEnum));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navEnum"));
|
||||
liNav.addContent(contents.navEnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
fieldDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.FIELD_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.fieldDetailsLabel);
|
||||
contents.fieldDetailsLabel);
|
||||
fieldDetailsTree.addContent(heading);
|
||||
return fieldDetailsTree;
|
||||
}
|
||||
@ -181,21 +181,13 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
return getMemberTree(fieldTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Field_Summary"));
|
||||
contents.fieldSummaryLabel);
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
@ -204,9 +196,9 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Field_Summary"),
|
||||
configuration.getText("doclet.fields"));
|
||||
return resources.getText("doclet.Member_Table_Summary",
|
||||
resources.getText("doclet.Field_Summary"),
|
||||
resources.getText("doclet.fields"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -214,7 +206,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Fields");
|
||||
return contents.fields;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,9 +215,9 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
@Override
|
||||
public List<String> getSummaryTableHeader(Element member) {
|
||||
List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Field"),
|
||||
configuration.getText("doclet.Description")));
|
||||
resources.getText("doclet.0_and_1",
|
||||
resources.getText("doclet.Field"),
|
||||
resources.getText("doclet.Description")));
|
||||
return header;
|
||||
}
|
||||
|
||||
@ -259,7 +251,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
: configuration.getText("doclet.Fields_Inherited_From_Interface"));
|
||||
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
|
||||
label);
|
||||
labelHeading.addContent(writer.getSpace());
|
||||
labelHeading.addContent(Contents.SPACE);
|
||||
labelHeading.addContent(classLink);
|
||||
inheritedTree.addContent(labelHeading);
|
||||
}
|
||||
@ -312,14 +304,14 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
if (typeElement == null) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.FIELD_SUMMARY,
|
||||
writer.getResource("doclet.navField"));
|
||||
contents.navField);
|
||||
} else {
|
||||
return writer.getHyperLink(
|
||||
SectionName.FIELDS_INHERITANCE,
|
||||
configuration.getClassName(typeElement), writer.getResource("doclet.navField"));
|
||||
configuration.getClassName(typeElement), contents.navField);
|
||||
}
|
||||
} else {
|
||||
return writer.getResource("doclet.navField");
|
||||
return contents.navField;
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,9 +323,9 @@ public class FieldWriterImpl extends AbstractMemberWriter
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.FIELD_DETAIL,
|
||||
writer.getResource("doclet.navField")));
|
||||
contents.navField));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navField"));
|
||||
liNav.addContent(contents.navField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -68,7 +69,7 @@ public class FrameOutputWriter extends HtmlDocletWriter {
|
||||
* @param filename File to be generated.
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public FrameOutputWriter(ConfigurationImpl configuration, DocPath filename) throws IOException {
|
||||
public FrameOutputWriter(ConfigurationImpl configuration, DocPath filename) {
|
||||
super(configuration, filename);
|
||||
noOfPackages = configuration.packages.size();
|
||||
}
|
||||
@ -87,10 +88,9 @@ public class FrameOutputWriter extends HtmlDocletWriter {
|
||||
filename = DocPaths.INDEX;
|
||||
framegen = new FrameOutputWriter(configuration, filename);
|
||||
framegen.generateFrameFile();
|
||||
framegen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2016, 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
|
||||
@ -33,6 +33,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -58,7 +59,7 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
* @param filename File to be generated.
|
||||
*/
|
||||
public HelpWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
DocPath filename) {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
@ -76,10 +77,9 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
filename = DocPaths.HELP_DOC;
|
||||
helpgen = new HelpWriter(configuration, filename);
|
||||
helpgen.generateHelpFile();
|
||||
helpgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -121,10 +121,10 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
*/
|
||||
protected void addHelpFileContents(Content contentTree) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title,
|
||||
getResource("doclet.Help_line_1"));
|
||||
contents.getContent("doclet.Help_line_1"));
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
Content line2 = HtmlTree.DIV(HtmlStyle.subTitle,
|
||||
getResource("doclet.Help_line_2"));
|
||||
contents.getContent("doclet.Help_line_2"));
|
||||
div.addContent(line2);
|
||||
if (configuration.allowTag(HtmlTag.MAIN)) {
|
||||
mainTree.addContent(div);
|
||||
@ -136,11 +136,11 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
if (configuration.createoverview) {
|
||||
Content overviewHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Overview"));
|
||||
contents.overviewLabel);
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(overviewHeading)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, overviewHeading);
|
||||
Content line3 = getResource("doclet.Help_line_3",
|
||||
Content line3 = contents.getContent("doclet.Help_line_3",
|
||||
getHyperLink(DocPaths.OVERVIEW_SUMMARY,
|
||||
configuration.getText("doclet.Overview")));
|
||||
Content overviewPara = HtmlTree.P(line3);
|
||||
@ -152,26 +152,26 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
}
|
||||
}
|
||||
Content packageHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Package"));
|
||||
contents.packageLabel);
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(packageHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, packageHead);
|
||||
Content line4 = getResource("doclet.Help_line_4");
|
||||
Content line4 = contents.getContent("doclet.Help_line_4");
|
||||
Content packagePara = HtmlTree.P(line4);
|
||||
htmlTree.addContent(packagePara);
|
||||
HtmlTree ulPackage = new HtmlTree(HtmlTag.UL);
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Interfaces_Italic")));
|
||||
contents.interfacesItalic));
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Classes")));
|
||||
contents.classes));
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Enums")));
|
||||
contents.enums));
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Exceptions")));
|
||||
contents.exceptions));
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Errors")));
|
||||
contents.errors));
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.AnnotationTypes")));
|
||||
contents.annotationTypes));
|
||||
htmlTree.addContent(ulPackage);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
|
||||
@ -179,46 +179,39 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
ul.addContent(htmlTree);
|
||||
}
|
||||
Content classHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_5"));
|
||||
contents.getContent("doclet.Help_line_5"));
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(classHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, classHead);
|
||||
Content line6 = getResource("doclet.Help_line_6");
|
||||
Content line6 = contents.getContent("doclet.Help_line_6");
|
||||
Content classPara = HtmlTree.P(line6);
|
||||
htmlTree.addContent(classPara);
|
||||
HtmlTree ul1 = new HtmlTree(HtmlTag.UL);
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_7")));
|
||||
contents.getContent("doclet.Help_line_7")));
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_8")));
|
||||
contents.getContent("doclet.Help_line_8")));
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_9")));
|
||||
contents.getContent("doclet.Help_line_9")));
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_10")));
|
||||
contents.getContent("doclet.Help_line_10")));
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_11")));
|
||||
contents.getContent("doclet.Help_line_11")));
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_12")));
|
||||
contents.getContent("doclet.Help_line_12")));
|
||||
htmlTree.addContent(ul1);
|
||||
HtmlTree ul2 = new HtmlTree(HtmlTag.UL);
|
||||
ul2.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Nested_Class_Summary")));
|
||||
ul2.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Field_Summary")));
|
||||
ul2.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Constructor_Summary")));
|
||||
ul2.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Method_Summary")));
|
||||
ul2.addContent(HtmlTree.LI(contents.nestedClassSummary));
|
||||
ul2.addContent(HtmlTree.LI(contents.fieldSummaryLabel));
|
||||
ul2.addContent(HtmlTree.LI(contents.constructorSummaryLabel));
|
||||
ul2.addContent(HtmlTree.LI(contents.methodSummary));
|
||||
htmlTree.addContent(ul2);
|
||||
HtmlTree ul3 = new HtmlTree(HtmlTag.UL);
|
||||
ul3.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Field_Detail")));
|
||||
ul3.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Constructor_Detail")));
|
||||
ul3.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Method_Detail")));
|
||||
ul3.addContent(HtmlTree.LI(contents.fieldDetailsLabel));
|
||||
ul3.addContent(HtmlTree.LI(contents.constructorDetailsLabel));
|
||||
ul3.addContent(HtmlTree.LI(contents.methodDetailLabel));
|
||||
htmlTree.addContent(ul3);
|
||||
Content line13 = getResource("doclet.Help_line_13");
|
||||
Content line13 = contents.getContent("doclet.Help_line_13");
|
||||
Content para = HtmlTree.P(line13);
|
||||
htmlTree.addContent(para);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
@ -228,24 +221,24 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
}
|
||||
//Annotation Types
|
||||
Content aHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.AnnotationType"));
|
||||
contents.annotationType);
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(aHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, aHead);
|
||||
Content aline1 = getResource("doclet.Help_annotation_type_line_1");
|
||||
Content aline1 = contents.getContent("doclet.Help_annotation_type_line_1");
|
||||
Content aPara = HtmlTree.P(aline1);
|
||||
htmlTree.addContent(aPara);
|
||||
HtmlTree aul = new HtmlTree(HtmlTag.UL);
|
||||
aul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_annotation_type_line_2")));
|
||||
contents.getContent("doclet.Help_annotation_type_line_2")));
|
||||
aul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_annotation_type_line_3")));
|
||||
contents.getContent("doclet.Help_annotation_type_line_3")));
|
||||
aul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Annotation_Type_Required_Member_Summary")));
|
||||
contents.annotateTypeRequiredMemberSummaryLabel));
|
||||
aul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Annotation_Type_Optional_Member_Summary")));
|
||||
contents.annotateTypeOptionalMemberSummaryLabel));
|
||||
aul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Annotation_Type_Member_Detail")));
|
||||
contents.annotationTypeMemberDetail));
|
||||
htmlTree.addContent(aul);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
|
||||
@ -254,22 +247,22 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
}
|
||||
//Enums
|
||||
Content enumHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Enum"));
|
||||
contents.enum_);
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(enumHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, enumHead);
|
||||
Content eline1 = getResource("doclet.Help_enum_line_1");
|
||||
Content eline1 = contents.getContent("doclet.Help_enum_line_1");
|
||||
Content enumPara = HtmlTree.P(eline1);
|
||||
htmlTree.addContent(enumPara);
|
||||
HtmlTree eul = new HtmlTree(HtmlTag.UL);
|
||||
eul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_enum_line_2")));
|
||||
contents.getContent("doclet.Help_enum_line_2")));
|
||||
eul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_enum_line_3")));
|
||||
contents.getContent("doclet.Help_enum_line_3")));
|
||||
eul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Enum_Constant_Summary")));
|
||||
contents.enumConstantSummary));
|
||||
eul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Enum_Constant_Detail")));
|
||||
contents.enumConstantDetailLabel));
|
||||
htmlTree.addContent(eul);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
|
||||
@ -278,11 +271,11 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
}
|
||||
if (configuration.classuse) {
|
||||
Content useHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_14"));
|
||||
contents.getContent("doclet.Help_line_14"));
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(useHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, useHead);
|
||||
Content line15 = getResource("doclet.Help_line_15");
|
||||
Content line15 = contents.getContent("doclet.Help_line_15");
|
||||
Content usePara = HtmlTree.P(line15);
|
||||
htmlTree.addContent(usePara);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
@ -293,11 +286,11 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
}
|
||||
if (configuration.createtree) {
|
||||
Content treeHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_16"));
|
||||
contents.getContent("doclet.Help_line_16"));
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(treeHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, treeHead);
|
||||
Content line17 = getResource("doclet.Help_line_17_with_tree_link",
|
||||
Content line17 = contents.getContent("doclet.Help_line_17_with_tree_link",
|
||||
getHyperLink(DocPaths.OVERVIEW_TREE,
|
||||
configuration.getText("doclet.Class_Hierarchy")),
|
||||
HtmlTree.CODE(new StringContent("java.lang.Object")));
|
||||
@ -305,9 +298,9 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
htmlTree.addContent(treePara);
|
||||
HtmlTree tul = new HtmlTree(HtmlTag.UL);
|
||||
tul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_18")));
|
||||
contents.getContent("doclet.Help_line_18")));
|
||||
tul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_19")));
|
||||
contents.getContent("doclet.Help_line_19")));
|
||||
htmlTree.addContent(tul);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
|
||||
@ -318,11 +311,11 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
if (!(configuration.nodeprecatedlist ||
|
||||
configuration.nodeprecated)) {
|
||||
Content dHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Deprecated_API"));
|
||||
contents.deprecatedAPI);
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(dHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, dHead);
|
||||
Content line20 = getResource("doclet.Help_line_20_with_deprecated_api_link",
|
||||
Content line20 = contents.getContent("doclet.Help_line_20_with_deprecated_api_link",
|
||||
getHyperLink(DocPaths.DEPRECATED_LIST,
|
||||
configuration.getText("doclet.Deprecated_API")));
|
||||
Content dPara = HtmlTree.P(line20);
|
||||
@ -343,11 +336,11 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
configuration.getText("doclet.Index"));
|
||||
}
|
||||
Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_21"));
|
||||
contents.getContent("doclet.Help_line_21"));
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(indexHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, indexHead);
|
||||
Content line22 = getResource("doclet.Help_line_22", indexlink);
|
||||
Content line22 = contents.getContent("doclet.Help_line_22", indexlink);
|
||||
Content indexPara = HtmlTree.P(line22);
|
||||
htmlTree.addContent(indexPara);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
@ -357,11 +350,11 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
}
|
||||
}
|
||||
Content prevHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_23"));
|
||||
contents.getContent("doclet.Help_line_23"));
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(prevHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, prevHead);
|
||||
Content line24 = getResource("doclet.Help_line_24");
|
||||
Content line24 = contents.getContent("doclet.Help_line_24");
|
||||
Content prevPara = HtmlTree.P(line24);
|
||||
htmlTree.addContent(prevPara);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
@ -370,11 +363,11 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
ul.addContent(htmlTree);
|
||||
}
|
||||
Content frameHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_25"));
|
||||
contents.getContent("doclet.Help_line_25"));
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(frameHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, frameHead);
|
||||
Content line26 = getResource("doclet.Help_line_26");
|
||||
Content line26 = contents.getContent("doclet.Help_line_26");
|
||||
Content framePara = HtmlTree.P(line26);
|
||||
htmlTree.addContent(framePara);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
@ -383,13 +376,13 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
ul.addContent(htmlTree);
|
||||
}
|
||||
Content allclassesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.All_Classes"));
|
||||
contents.allClassesLabel);
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(allclassesHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, allclassesHead);
|
||||
Content line27 = getResource("doclet.Help_line_27",
|
||||
Content line27 = contents.getContent("doclet.Help_line_27",
|
||||
getHyperLink(DocPaths.ALLCLASSES_NOFRAME,
|
||||
configuration.getText("doclet.All_Classes")));
|
||||
resources.getText("doclet.All_Classes")));
|
||||
Content allclassesPara = HtmlTree.P(line27);
|
||||
htmlTree.addContent(allclassesPara);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
@ -398,11 +391,11 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
ul.addContent(htmlTree);
|
||||
}
|
||||
Content sHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Serialized_Form"));
|
||||
contents.serializedForm);
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(sHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, sHead);
|
||||
Content line28 = getResource("doclet.Help_line_28");
|
||||
Content line28 = contents.getContent("doclet.Help_line_28");
|
||||
Content serialPara = HtmlTree.P(line28);
|
||||
htmlTree.addContent(serialPara);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
@ -411,13 +404,13 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
ul.addContent(htmlTree);
|
||||
}
|
||||
Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Constants_Summary"));
|
||||
contents.constantsSummaryTitle);
|
||||
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
|
||||
? HtmlTree.SECTION(constHead)
|
||||
: HtmlTree.LI(HtmlStyle.blockList, constHead);
|
||||
Content line29 = getResource("doclet.Help_line_29",
|
||||
Content line29 = contents.getContent("doclet.Help_line_29",
|
||||
getHyperLink(DocPaths.CONSTANT_VALUES,
|
||||
configuration.getText("doclet.Constants_Summary")));
|
||||
resources.getText("doclet.Constants_Summary")));
|
||||
Content constPara = HtmlTree.P(line29);
|
||||
htmlTree.addContent(constPara);
|
||||
if (configuration.allowTag(HtmlTag.SECTION)) {
|
||||
@ -426,7 +419,7 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
ul.addContent(htmlTree);
|
||||
}
|
||||
Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul);
|
||||
Content line30 = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase, getResource("doclet.Help_line_30"));
|
||||
Content line30 = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase, contents.getContent("doclet.Help_line_30"));
|
||||
divContent.addContent(line30);
|
||||
if (configuration.allowTag(HtmlTag.MAIN)) {
|
||||
mainTree.addContent(divContent);
|
||||
@ -443,7 +436,7 @@ public class HelpWriter extends HtmlDocletWriter {
|
||||
*/
|
||||
@Override
|
||||
protected Content getNavLinkHelp() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, helpLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.helpLabel);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ import jdk.javadoc.doclet.DocletEnvironment;
|
||||
import jdk.javadoc.doclet.Reporter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Configuration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
@ -68,7 +69,9 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
/**
|
||||
* The global configuration information for this run.
|
||||
*/
|
||||
public final ConfigurationImpl configuration;
|
||||
private final ConfigurationImpl configuration;
|
||||
|
||||
private Messages messages;
|
||||
|
||||
|
||||
private static final DocPath DOCLET_RESOURCES = DocPath
|
||||
@ -77,6 +80,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
public void init(Locale locale, Reporter reporter) {
|
||||
configuration.reporter = reporter;
|
||||
configuration.locale = locale;
|
||||
messages = configuration.getMessages();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,8 +122,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
}
|
||||
|
||||
if (configuration.topFile.isEmpty()) {
|
||||
configuration.standardmessage.
|
||||
error("doclet.No_Non_Deprecated_Classes_To_Document");
|
||||
messages.error("doclet.No_Non_Deprecated_Classes_To_Document");
|
||||
return;
|
||||
}
|
||||
boolean nodeprecated = configuration.nodeprecated;
|
||||
@ -351,11 +354,11 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
if (toFile.isSameFile(fromfile))
|
||||
return;
|
||||
|
||||
configuration.message.notice("doclet.Copying_File_0_To_File_1",
|
||||
messages.notice("doclet.Copying_File_0_To_File_1",
|
||||
fromfile.toString(), path.getPath());
|
||||
toFile.copyFile(fromfile);
|
||||
} catch (IOException exc) {
|
||||
configuration.message.error("doclet.perform_copy_exception_encountered",
|
||||
messages.error("doclet.perform_copy_exception_encountered",
|
||||
exc.toString());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
|
||||
@ -82,7 +82,9 @@ import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Configuration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.taglets.DocRootTaglet;
|
||||
import jdk.javadoc.internal.doclets.toolkit.taglets.TagletWriter;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
@ -145,6 +147,12 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
|
||||
protected final Utils utils;
|
||||
|
||||
protected final Contents contents;
|
||||
|
||||
protected final Messages messages;
|
||||
|
||||
protected final Resources resources;
|
||||
|
||||
/**
|
||||
* To check whether annotation heading is printed or not.
|
||||
*/
|
||||
@ -174,10 +182,12 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
*
|
||||
* @param path File to be generated.
|
||||
*/
|
||||
public HtmlDocletWriter(ConfigurationImpl configuration, DocPath path)
|
||||
throws IOException {
|
||||
public HtmlDocletWriter(ConfigurationImpl configuration, DocPath path) {
|
||||
super(configuration, path);
|
||||
this.configuration = configuration;
|
||||
this.contents = configuration.contents;
|
||||
this.messages = configuration.messages;
|
||||
this.resources = configuration.resources;
|
||||
this.utils = configuration.utils;
|
||||
this.path = path;
|
||||
this.pathToRoot = path.parent().invert();
|
||||
@ -249,19 +259,19 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
*/
|
||||
public Content getAllClassesLinkScript(String id) {
|
||||
HtmlTree script = HtmlTree.SCRIPT();
|
||||
String scriptCode = "<!--" + DocletConstants.NL +
|
||||
" allClassesLink = document.getElementById(\"" + id + "\");" + DocletConstants.NL +
|
||||
" if(window==top) {" + DocletConstants.NL +
|
||||
" allClassesLink.style.display = \"block\";" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" else {" + DocletConstants.NL +
|
||||
" allClassesLink.style.display = \"none\";" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" //-->" + DocletConstants.NL;
|
||||
Content scriptContent = new RawHtml(scriptCode);
|
||||
String scriptCode = "<!--\n" +
|
||||
" allClassesLink = document.getElementById(\"" + id + "\");\n" +
|
||||
" if(window==top) {\n" +
|
||||
" allClassesLink.style.display = \"block\";\n" +
|
||||
" }\n" +
|
||||
" else {\n" +
|
||||
" allClassesLink.style.display = \"none\";\n" +
|
||||
" }\n" +
|
||||
" //-->\n";
|
||||
Content scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL));
|
||||
script.addContent(scriptContent);
|
||||
Content div = HtmlTree.DIV(script);
|
||||
Content div_noscript = HtmlTree.DIV(getResource("doclet.No_Script_Message"));
|
||||
Content div_noscript = HtmlTree.DIV(contents.noScriptMessage);
|
||||
Content noScript = HtmlTree.NOSCRIPT(div_noscript);
|
||||
div.addContent(noScript);
|
||||
return div;
|
||||
@ -404,7 +414,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
|
||||
tdClassDescription.addStyle(HtmlStyle.colLast);
|
||||
if (utils.isDeprecated(te)) {
|
||||
tdClassDescription.addContent(deprecatedLabel);
|
||||
tdClassDescription.addContent(contents.deprecatedLabel);
|
||||
List<? extends DocTree> tags = utils.getDeprecatedTrees(te);
|
||||
if (!tags.isEmpty()) {
|
||||
addSummaryDeprecatedComment(te, tags.get(0), tdClassDescription);
|
||||
@ -535,7 +545,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
String allClassesId = "allclasses_";
|
||||
HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
|
||||
fixedNavDiv.addStyle(HtmlStyle.fixedNav);
|
||||
Content skipNavLinks = configuration.getResource("doclet.Skip_navigation_links");
|
||||
Content skipNavLinks = configuration.getContent("doclet.Skip_navigation_links");
|
||||
if (header) {
|
||||
fixedNavDiv.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
|
||||
navDiv.addStyle(HtmlStyle.topNav);
|
||||
@ -617,8 +627,9 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
if (header && configuration.createindex) {
|
||||
HtmlTree inputText = HtmlTree.INPUT("text", "search");
|
||||
HtmlTree inputReset = HtmlTree.INPUT("reset", "reset");
|
||||
Content searchTxt = configuration.getResource("doclet.search");
|
||||
searchTxt.addContent(getSpace());
|
||||
Content searchTxt = new ContentBuilder();
|
||||
searchTxt.addContent(configuration.getContent("doclet.search"));
|
||||
searchTxt.addContent(Contents.SPACE);
|
||||
HtmlTree liInput = HtmlTree.LI(HtmlTree.SPAN(searchTxt));
|
||||
liInput.addContent(inputText);
|
||||
liInput.addContent(inputReset);
|
||||
@ -632,7 +643,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
fixedNavDiv.addContent(subDiv);
|
||||
fixedNavDiv.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
|
||||
tree.addContent(fixedNavDiv);
|
||||
HtmlTree paddingDiv = HtmlTree.DIV(HtmlStyle.navPadding, getSpace());
|
||||
HtmlTree paddingDiv = HtmlTree.DIV(HtmlStyle.navPadding, Contents.SPACE);
|
||||
tree.addContent(paddingDiv);
|
||||
} else {
|
||||
subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM));
|
||||
@ -678,7 +689,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
*/
|
||||
protected Content getNavLinkContents() {
|
||||
Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_SUMMARY),
|
||||
overviewLabel, "", "");
|
||||
contents.overviewLabel, "", "");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -690,7 +701,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
protected Content getNavLinkModule(ModuleElement mdle) {
|
||||
Content linkContent = getModuleLink(mdle, moduleLabel);
|
||||
Content linkContent = getModuleLink(mdle, contents.moduleLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -701,7 +712,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
protected Content getNavLinkModule() {
|
||||
Content li = HtmlTree.LI(moduleLabel);
|
||||
Content li = HtmlTree.LI(contents.moduleLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -712,7 +723,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
protected Content getNavLinkPackage(PackageElement pkg) {
|
||||
Content linkContent = getPackageLink(pkg, packageLabel);
|
||||
Content linkContent = getPackageLink(pkg, contents.packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -723,7 +734,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content li = HtmlTree.LI(packageLabel);
|
||||
Content li = HtmlTree.LI(contents.packageLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -733,7 +744,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content li = HtmlTree.LI(useLabel);
|
||||
Content li = HtmlTree.LI(contents.useLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -746,10 +757,10 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
public Content getNavLinkPrevious(DocPath prev) {
|
||||
Content li;
|
||||
if (prev != null) {
|
||||
li = HtmlTree.LI(getHyperLink(prev, prevLabel, "", ""));
|
||||
li = HtmlTree.LI(getHyperLink(prev, contents.prevLabel, "", ""));
|
||||
}
|
||||
else
|
||||
li = HtmlTree.LI(prevLabel);
|
||||
li = HtmlTree.LI(contents.prevLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -763,10 +774,10 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
public Content getNavLinkNext(DocPath next) {
|
||||
Content li;
|
||||
if (next != null) {
|
||||
li = HtmlTree.LI(getHyperLink(next, nextLabel, "", ""));
|
||||
li = HtmlTree.LI(getHyperLink(next, contents.nextLabel, "", ""));
|
||||
}
|
||||
else
|
||||
li = HtmlTree.LI(nextLabel);
|
||||
li = HtmlTree.LI(contents.nextLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -778,7 +789,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
*/
|
||||
protected Content getNavShowLists(DocPath link) {
|
||||
DocLink dl = new DocLink(link, path.getPath(), null);
|
||||
Content framesContent = getHyperLink(dl, framesLabel, "", "_top");
|
||||
Content framesContent = getHyperLink(dl, contents.framesLabel, "", "_top");
|
||||
Content li = HtmlTree.LI(framesContent);
|
||||
return li;
|
||||
}
|
||||
@ -799,7 +810,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
protected Content getNavHideLists(DocPath link) {
|
||||
Content noFramesContent = getHyperLink(link, noframesLabel, "", "_top");
|
||||
Content noFramesContent = getHyperLink(link, contents.noFramesLabel, "", "_top");
|
||||
Content li = HtmlTree.LI(noFramesContent);
|
||||
return li;
|
||||
}
|
||||
@ -817,7 +828,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
DocPath docPath = packages.size() == 1 && utils.getSpecifiedClasses().isEmpty()
|
||||
? pathString(packages.get(0), DocPaths.PACKAGE_TREE)
|
||||
: pathToRoot.resolve(DocPaths.OVERVIEW_TREE);
|
||||
return HtmlTree.LI(getHyperLink(docPath, treeLabel, "", ""));
|
||||
return HtmlTree.LI(getHyperLink(docPath, contents.treeLabel, "", ""));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -839,7 +850,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
protected Content getNavLinkClass() {
|
||||
Content li = HtmlTree.LI(classLabel);
|
||||
Content li = HtmlTree.LI(contents.classLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -850,7 +861,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
*/
|
||||
protected Content getNavLinkDeprecated() {
|
||||
Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST),
|
||||
deprecatedLabel, "", "");
|
||||
contents.deprecatedLabel, "", "");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -865,7 +876,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
protected Content getNavLinkClassIndex() {
|
||||
Content allClassesContent = getHyperLink(pathToRoot.resolve(
|
||||
DocPaths.ALLCLASSES_NOFRAME),
|
||||
allclassesLabel, "", "");
|
||||
contents.allClassesLabel, "", "");
|
||||
Content li = HtmlTree.LI(allClassesContent);
|
||||
return li;
|
||||
}
|
||||
@ -880,7 +891,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
(configuration.splitindex
|
||||
? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1))
|
||||
: DocPaths.INDEX_ALL)),
|
||||
indexLabel, "", "");
|
||||
contents.indexLabel, "", "");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -902,7 +913,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
helpfilenm = DocPath.create(file.getName());
|
||||
}
|
||||
Content linkContent = getHyperLink(pathToRoot.resolve(helpfilenm),
|
||||
helpLabel, "", "");
|
||||
contents.helpLabel, "", "");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -913,9 +924,9 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
* @param liNav the content tree to which the gap will be added
|
||||
*/
|
||||
protected void addNavGap(Content liNav) {
|
||||
liNav.addContent(getSpace());
|
||||
liNav.addContent(Contents.SPACE);
|
||||
liNav.addContent("|");
|
||||
liNav.addContent(getSpace());
|
||||
liNav.addContent(Contents.SPACE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -954,7 +965,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
*/
|
||||
public Content getTableCaption(Content title) {
|
||||
Content captionSpan = HtmlTree.SPAN(title);
|
||||
Content space = getSpace();
|
||||
Content space = Contents.SPACE;
|
||||
Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space);
|
||||
Content caption = HtmlTree.CAPTION(captionSpan);
|
||||
caption.addContent(tabSpan);
|
||||
@ -1014,7 +1025,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
*/
|
||||
public Content getPackageName(PackageElement packageElement) {
|
||||
return packageElement == null || packageElement.isUnnamed()
|
||||
? defaultPackageLabel
|
||||
? contents.defaultPackageLabel
|
||||
: getPackageLabel(packageElement.getQualifiedName());
|
||||
}
|
||||
|
||||
@ -1040,7 +1051,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
protected void addPackageDeprecatedAPI(SortedSet<Element> deprPkgs, String headingKey,
|
||||
String tableSummary, List<String> tableHeader, Content contentTree) {
|
||||
if (deprPkgs.size() > 0) {
|
||||
Content caption = getTableCaption(configuration.getResource(headingKey));
|
||||
Content caption = getTableCaption(configuration.getContent(headingKey));
|
||||
Content table = (configuration.isOutputHtml5())
|
||||
? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
|
||||
: HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
|
||||
@ -1551,7 +1562,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
return classCrossLink;
|
||||
} else {
|
||||
// No cross link found so print warning
|
||||
configuration.getDocletSpecificMsg().warning(ch.getDocTreePath(see),
|
||||
messages.warning(ch.getDocTreePath(see),
|
||||
"doclet.see.class_or_package_not_found",
|
||||
"@" + tagName,
|
||||
seetext);
|
||||
@ -1594,11 +1605,11 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
if (this instanceof ClassWriterImpl) {
|
||||
containing = ((ClassWriterImpl) this).getTypeElement();
|
||||
} else if (!utils.isPublic(containing)) {
|
||||
configuration.getDocletSpecificMsg().warning(
|
||||
messages.warning(
|
||||
ch.getDocTreePath(see), "doclet.see.class_or_package_not_accessible",
|
||||
tagName, utils.getFullyQualifiedName(containing));
|
||||
} else {
|
||||
configuration.getDocletSpecificMsg().warning(
|
||||
messages.warning(
|
||||
ch.getDocTreePath(see), "doclet.see.class_or_package_not_found",
|
||||
tagName, seetext);
|
||||
}
|
||||
@ -1728,7 +1739,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
htmltree.addContent(div);
|
||||
}
|
||||
if (tags.isEmpty()) {
|
||||
htmltree.addContent(getSpace());
|
||||
htmltree.addContent(Contents.SPACE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1917,7 +1928,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||
public Boolean visitErroneous(ErroneousTree node, Content c) {
|
||||
configuration.getDocletSpecificMsg().warning(ch.getDocTreePath(node),
|
||||
messages.warning(ch.getDocTreePath(node),
|
||||
"doclet.tag.invalid_usage", node);
|
||||
result.addContent(new RawHtml(node.toString()));
|
||||
return false;
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
@ -111,7 +109,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
methodDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.METHOD_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.methodDetailsLabel);
|
||||
contents.methodDetailLabel);
|
||||
methodDetailsTree.addContent(heading);
|
||||
return methodDetailsTree;
|
||||
}
|
||||
@ -190,9 +188,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
Content codelLink = HtmlTree.CODE(link);
|
||||
Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel,
|
||||
utils.isClass(holder)
|
||||
? writer.descfrmClassLabel
|
||||
: writer.descfrmInterfaceLabel);
|
||||
descfrmLabel.addContent(writer.getSpace());
|
||||
? contents.descfrmClassLabel
|
||||
: contents.descfrmInterfaceLabel);
|
||||
descfrmLabel.addContent(Contents.SPACE);
|
||||
descfrmLabel.addContent(codelLink);
|
||||
methodDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel));
|
||||
writer.addInlineComment(method, methodDocTree);
|
||||
@ -229,21 +227,13 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
return getMemberTree(methodDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Method_Summary"));
|
||||
contents.methodSummary);
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
@ -252,9 +242,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Method_Summary"),
|
||||
configuration.getText("doclet.methods"));
|
||||
return resources.getText("doclet.Member_Table_Summary",
|
||||
resources.getText("doclet.Method_Summary"),
|
||||
resources.getText("doclet.methods"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -262,7 +252,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Methods");
|
||||
return contents.methods;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -271,9 +261,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
@Override
|
||||
public List<String> getSummaryTableHeader(Element member) {
|
||||
List<String> header = Arrays.asList(writer.getModifierTypeHeader(),
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Method"),
|
||||
configuration.getText("doclet.Description")));
|
||||
resources.getText("doclet.0_and_1",
|
||||
resources.getText("doclet.Method"),
|
||||
resources.getText("doclet.Description")));
|
||||
return header;
|
||||
}
|
||||
|
||||
@ -307,7 +297,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
: configuration.getText("doclet.Methods_Inherited_From_Interface"));
|
||||
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
|
||||
label);
|
||||
labelHeading.addContent(writer.getSpace());
|
||||
labelHeading.addContent(Contents.SPACE);
|
||||
labelHeading.addContent(classLink);
|
||||
inheritedTree.addContent(labelHeading);
|
||||
}
|
||||
@ -329,7 +319,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
if (writer.configuration.nocomment) {
|
||||
return;
|
||||
}
|
||||
Utils utils = writer.configuration().utils;
|
||||
Utils utils = writer.utils;
|
||||
Contents contents = writer.contents;
|
||||
TypeElement holder = utils.getEnclosingTypeElement(method);
|
||||
if (!(utils.isPublic(holder) ||
|
||||
utils.isLinkable(holder))) {
|
||||
@ -341,14 +332,14 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
//is not visible so don't document this.
|
||||
return;
|
||||
}
|
||||
Content label = writer.overridesLabel;
|
||||
Content label = contents.overridesLabel;
|
||||
LinkInfoImpl.Kind context = LinkInfoImpl.Kind.METHOD_OVERRIDES;
|
||||
|
||||
if (method != null) {
|
||||
if (utils.isAbstract(holder) && utils.isAbstract(method)){
|
||||
//Abstract method is implemented from abstract class,
|
||||
//not overridden
|
||||
label = writer.specifiedByLabel;
|
||||
label = contents.specifiedByLabel;
|
||||
context = LinkInfoImpl.Kind.METHOD_SPECIFIED_BY;
|
||||
}
|
||||
Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, label));
|
||||
@ -362,9 +353,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
.where(writer.getName(writer.getAnchor(method))).label(method.getSimpleName()));
|
||||
Content codeMethLink = HtmlTree.CODE(methlink);
|
||||
Content dd = HtmlTree.DD(codeMethLink);
|
||||
dd.addContent(writer.getSpace());
|
||||
dd.addContent(writer.getResource("doclet.in_class"));
|
||||
dd.addContent(writer.getSpace());
|
||||
dd.addContent(Contents.SPACE);
|
||||
dd.addContent(writer.contents.inClass);
|
||||
dd.addContent(Contents.SPACE);
|
||||
dd.addContent(codeOverridenTypeLink);
|
||||
dl.addContent(dd);
|
||||
}
|
||||
@ -379,6 +370,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
return;
|
||||
}
|
||||
Utils utils = writer.utils;
|
||||
Contents contents = writer.contents;
|
||||
ImplementedMethods implementedMethodsFinder =
|
||||
new ImplementedMethods(method, writer.configuration);
|
||||
SortedSet<ExecutableElement> implementedMethods =
|
||||
@ -390,16 +382,16 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
Content intfaclink = writer.getLink(new LinkInfoImpl(
|
||||
writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac));
|
||||
Content codeIntfacLink = HtmlTree.CODE(intfaclink);
|
||||
Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, writer.specifiedByLabel));
|
||||
Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, contents.specifiedByLabel));
|
||||
dl.addContent(dt);
|
||||
Content methlink = writer.getDocLink(
|
||||
LinkInfoImpl.Kind.MEMBER, implementedMeth,
|
||||
implementedMeth.getSimpleName(), false);
|
||||
Content codeMethLink = HtmlTree.CODE(methlink);
|
||||
Content dd = HtmlTree.DD(codeMethLink);
|
||||
dd.addContent(writer.getSpace());
|
||||
dd.addContent(writer.getResource("doclet.in_interface"));
|
||||
dd.addContent(writer.getSpace());
|
||||
dd.addContent(Contents.SPACE);
|
||||
dd.addContent(contents.inInterface);
|
||||
dd.addContent(Contents.SPACE);
|
||||
dd.addContent(codeIntfacLink);
|
||||
dl.addContent(dd);
|
||||
}
|
||||
@ -417,7 +409,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
Content linkContent = writer.getLink(
|
||||
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
|
||||
htmltree.addContent(linkContent);
|
||||
htmltree.addContent(writer.getSpace());
|
||||
htmltree.addContent(Contents.SPACE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,14 +422,14 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
if (typeElement == null) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.METHOD_SUMMARY,
|
||||
writer.getResource("doclet.navMethod"));
|
||||
contents.navMethod);
|
||||
} else {
|
||||
return writer.getHyperLink(
|
||||
SectionName.METHODS_INHERITANCE,
|
||||
configuration.getClassName(typeElement), writer.getResource("doclet.navMethod"));
|
||||
configuration.getClassName(typeElement), contents.navMethod);
|
||||
}
|
||||
} else {
|
||||
return writer.getResource("doclet.navMethod");
|
||||
return contents.navMethod;
|
||||
}
|
||||
}
|
||||
|
||||
@ -448,9 +440,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
protected void addNavDetailLink(boolean link, Content liNav) {
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.METHOD_DETAIL, writer.getResource("doclet.navMethod")));
|
||||
SectionName.METHOD_DETAIL, contents.navMethod));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navMethod"));
|
||||
liNav.addContent(contents.navMethod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public class ModuleFrameWriter extends HtmlDocletWriter {
|
||||
/**
|
||||
* The module being documented.
|
||||
*/
|
||||
private ModuleElement mdle;
|
||||
private final ModuleElement mdle;
|
||||
|
||||
/**
|
||||
* The classes to be documented. Use this to filter out classes
|
||||
@ -114,9 +114,8 @@ public class ModuleFrameWriter extends HtmlDocletWriter {
|
||||
}
|
||||
mdlgen.printHtmlDocument(
|
||||
configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body);
|
||||
mdlgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
configuration.messages.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), DocPaths.moduleTypeFrame(moduleElement).getPath());
|
||||
throw new DocletAbortException(exc);
|
||||
@ -148,12 +147,12 @@ public class ModuleFrameWriter extends HtmlDocletWriter {
|
||||
annotationTypes.addAll(utils.getAnnotationTypes(pkg));
|
||||
}
|
||||
}
|
||||
addClassKindListing(interfaces, getResource("doclet.Interfaces"), contentTree);
|
||||
addClassKindListing(classes, getResource("doclet.Classes"), contentTree);
|
||||
addClassKindListing(enums, getResource("doclet.Enums"), contentTree);
|
||||
addClassKindListing(exceptions, getResource("doclet.Exceptions"), contentTree);
|
||||
addClassKindListing(errors, getResource("doclet.Errors"), contentTree);
|
||||
addClassKindListing(annotationTypes, getResource("doclet.AnnotationTypes"), contentTree);
|
||||
addClassKindListing(interfaces, contents.interfaces, contentTree);
|
||||
addClassKindListing(classes, contents.classes, contentTree);
|
||||
addClassKindListing(enums, contents.enums, contentTree);
|
||||
addClassKindListing(exceptions, contents.exceptions, contentTree);
|
||||
addClassKindListing(errors, contents.errors, contentTree);
|
||||
addClassKindListing(annotationTypes, contents.annotationTypes, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -39,6 +39,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -79,10 +80,9 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
try {
|
||||
modulegen = new ModuleIndexFrameWriter(configuration, filename);
|
||||
modulegen.buildModuleIndexFile("doclet.Window_Overview", false);
|
||||
modulegen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -94,12 +94,12 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
protected void addModulesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
|
||||
String tableSummary, Content body) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.MODULE_HEADING, true,
|
||||
modulesLabel);
|
||||
contents.modulesLabel);
|
||||
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
|
||||
? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
|
||||
: HtmlTree.DIV(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(modulesLabel);
|
||||
ul.setTitle(contents.modulesLabel);
|
||||
for (ModuleElement mdle: modules.keySet()) {
|
||||
ul.addContent(getModuleLink(mdle));
|
||||
}
|
||||
@ -150,7 +150,7 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
*/
|
||||
protected void addAllClassesLink(Content ul) {
|
||||
Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
|
||||
allclassesLabel, "", "packageFrame");
|
||||
contents.allClassesLabel, "", "packageFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.addContent(li);
|
||||
}
|
||||
@ -163,7 +163,7 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
*/
|
||||
protected void addAllPackagesLink(Content ul) {
|
||||
Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
|
||||
allpackagesLabel, "", "packageListFrame");
|
||||
contents.allPackagesLabel, "", "packageListFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.addContent(li);
|
||||
}
|
||||
@ -172,7 +172,7 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavigationBarFooter(Content body) {
|
||||
Content p = HtmlTree.P(getSpace());
|
||||
Content p = HtmlTree.P(Contents.SPACE);
|
||||
body.addContent(p);
|
||||
}
|
||||
|
||||
|
||||
@ -32,12 +32,14 @@ import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
|
||||
import jdk.javadoc.doclet.DocletEnvironment;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -90,9 +92,9 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
|
||||
try {
|
||||
mdlgen = new ModuleIndexWriter(configuration, filename);
|
||||
mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", true);
|
||||
mdlgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
@ -195,12 +197,13 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter {
|
||||
subTitleDiv.addStyle(HtmlStyle.subTitle);
|
||||
addSummaryComment(configuration.overviewElement, subTitleDiv);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, subTitleDiv);
|
||||
Content see = seeLabel;
|
||||
Content see = new ContentBuilder();
|
||||
see.addContent(contents.seeLabel);
|
||||
see.addContent(" ");
|
||||
Content descPara = HtmlTree.P(see);
|
||||
Content descLink = getHyperLink(getDocLink(
|
||||
SectionName.OVERVIEW_DESCRIPTION),
|
||||
descriptionLabel, "", "");
|
||||
contents.descriptionLabel, "", "");
|
||||
descPara.addContent(descLink);
|
||||
div.addContent(descPara);
|
||||
if (configuration.allowTag(HtmlTag.MAIN)) {
|
||||
|
||||
@ -41,6 +41,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -82,10 +83,9 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
try {
|
||||
modpackgen = new ModulePackageIndexFrameWriter(configuration, filename);
|
||||
modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", false, mdle);
|
||||
modpackgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -99,13 +99,13 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
Content profNameContent = new StringContent(mdle.getQualifiedName().toString());
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
|
||||
getTargetModuleLink("classFrame", profNameContent, mdle));
|
||||
heading.addContent(getSpace());
|
||||
heading.addContent(packagesLabel);
|
||||
heading.addContent(Contents.SPACE);
|
||||
heading.addContent(contents.packagesLabel);
|
||||
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
|
||||
? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
|
||||
: HtmlTree.DIV(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(packagesLabel);
|
||||
ul.setTitle(contents.packagesLabel);
|
||||
List<PackageElement> packages = new ArrayList<>(modules.get(mdle));
|
||||
for (PackageElement pkg : packages) {
|
||||
if ((!(configuration.nodeprecated && utils.isDeprecated(pkg)))) {
|
||||
@ -124,13 +124,13 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
Content moduleNameContent = new StringContent(mdle.getQualifiedName().toString());
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
|
||||
getTargetModuleLink("classFrame", moduleNameContent, mdle));
|
||||
heading.addContent(getSpace());
|
||||
heading.addContent(packagesLabel);
|
||||
heading.addContent(Contents.SPACE);
|
||||
heading.addContent(contents.packagesLabel);
|
||||
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
|
||||
? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
|
||||
: HtmlTree.DIV(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(packagesLabel);
|
||||
ul.setTitle(contents.packagesLabel);
|
||||
Set<PackageElement> modulePackages = configuration.modulePackages.get(mdle);
|
||||
for (PackageElement pkg: modulePackages) {
|
||||
if ((!(configuration.nodeprecated && utils.isDeprecated(pkg)))) {
|
||||
@ -198,7 +198,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
*/
|
||||
protected void addAllClassesLink(Content ul) {
|
||||
Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
|
||||
allclassesLabel, "", "packageFrame");
|
||||
contents.allClassesLabel, "", "packageFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.addContent(li);
|
||||
}
|
||||
@ -211,7 +211,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
*/
|
||||
protected void addAllPackagesLink(Content ul) {
|
||||
Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
|
||||
allpackagesLabel, "", "packageListFrame");
|
||||
contents.allPackagesLabel, "", "packageListFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.addContent(li);
|
||||
}
|
||||
@ -224,7 +224,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
*/
|
||||
protected void addAllModulesLink(Content ul) {
|
||||
Content linkContent = getHyperLink(DocPaths.MODULE_OVERVIEW_FRAME,
|
||||
allmodulesLabel, "", "packageListFrame");
|
||||
contents.allModulesLabel, "", "packageListFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.addContent(li);
|
||||
}
|
||||
@ -233,7 +233,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavigationBarFooter(Content body) {
|
||||
Content p = HtmlTree.P(getSpace());
|
||||
Content p = HtmlTree.P(Contents.SPACE);
|
||||
body.addContent(p);
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,8 +102,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
* @param nextModule Next module in the sorted array.
|
||||
*/
|
||||
public ModuleWriterImpl(ConfigurationImpl configuration,
|
||||
ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule)
|
||||
throws IOException {
|
||||
ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule) {
|
||||
super(configuration, DocPaths.moduleSummary(mdle));
|
||||
this.prevModule = prevModule;
|
||||
this.nextModule = nextModule;
|
||||
@ -129,8 +128,8 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.header);
|
||||
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, moduleLabel);
|
||||
tHeading.addContent(getSpace());
|
||||
HtmlStyle.title, contents.moduleLabel);
|
||||
tHeading.addContent(Contents.SPACE);
|
||||
Content moduleHead = new RawHtml(heading);
|
||||
tHeading.addContent(moduleHead);
|
||||
div.addContent(tHeading);
|
||||
@ -262,7 +261,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
|
||||
getResource("doclet.navModules"), li);
|
||||
contents.navModules, li);
|
||||
String text = configuration.getText("doclet.Requires_Summary");
|
||||
String tableSummary = configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Requires_Summary"),
|
||||
@ -315,7 +314,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
|
||||
getResource("doclet.navPackages"), li);
|
||||
contents.navPackages, li);
|
||||
String text = configuration.getText("doclet.Exported_Packages_Summary");
|
||||
String tableSummary = configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Exported_Packages_Summary"),
|
||||
@ -385,7 +384,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
|
||||
getResource("doclet.navServices"), li);
|
||||
contents.navServices, li);
|
||||
String text;
|
||||
String tableSummary;
|
||||
if (usesDirs != null && !usesDirs.isEmpty()) {
|
||||
@ -468,9 +467,9 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
HtmlTree tdType = HtmlTree.TD(HtmlStyle.colFirst, srvLinkContent);
|
||||
tdType.addContent(new HtmlTree(HtmlTag.BR));
|
||||
tdType.addContent("(");
|
||||
HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, getResource("doclet.Implementation"));
|
||||
HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
|
||||
tdType.addContent(implSpan);
|
||||
tdType.addContent(getSpace());
|
||||
tdType.addContent(Contents.SPACE);
|
||||
tdType.addContent(implLinkContent);
|
||||
tdType.addContent(")");
|
||||
HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
|
||||
@ -530,25 +529,25 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
* @return the content tree for the navigation summary links
|
||||
*/
|
||||
protected Content getNavSummaryLinks() throws Exception {
|
||||
Content li = HtmlTree.LI(moduleSubNavLabel);
|
||||
li.addContent(getSpace());
|
||||
Content li = HtmlTree.LI(contents.moduleSubNavLabel);
|
||||
li.addContent(Contents.SPACE);
|
||||
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
|
||||
Content liNav = new HtmlTree(HtmlTag.LI);
|
||||
liNav.addContent(!utils.getBody(mdle).isEmpty() && !configuration.nocomment
|
||||
? getHyperLink(SectionName.MODULE_DESCRIPTION, getResource("doclet.navModuleDescription"))
|
||||
: getResource("doclet.navModuleDescription"));
|
||||
? getHyperLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription)
|
||||
: contents.navModuleDescription);
|
||||
addNavGap(liNav);
|
||||
liNav.addContent(showDirectives(DirectiveKind.REQUIRES)
|
||||
? getHyperLink(SectionName.MODULES, getResource("doclet.navModules"))
|
||||
: getResource("doclet.navModules"));
|
||||
? getHyperLink(SectionName.MODULES, contents.navModules)
|
||||
: contents.navModules);
|
||||
addNavGap(liNav);
|
||||
liNav.addContent(showDirectives(DirectiveKind.EXPORTS)
|
||||
? getHyperLink(SectionName.PACKAGES, getResource("doclet.navPackages"))
|
||||
: getResource("doclet.navPackages"));
|
||||
? getHyperLink(SectionName.PACKAGES, contents.navPackages)
|
||||
: contents.navPackages);
|
||||
addNavGap(liNav);
|
||||
liNav.addContent((showDirectives(DirectiveKind.USES) || showDirectives(DirectiveKind.PROVIDES))
|
||||
? getHyperLink(SectionName.SERVICES, getResource("doclet.navServices"))
|
||||
: getResource("doclet.navServices"));
|
||||
? getHyperLink(SectionName.SERVICES, contents.navServices)
|
||||
: contents.navServices);
|
||||
ulNav.addContent(liNav);
|
||||
return ulNav;
|
||||
}
|
||||
@ -609,7 +608,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
deprs = utils.getDeprecatedTrees(pkg);
|
||||
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
|
||||
deprDiv.addStyle(HtmlStyle.deprecatedContent);
|
||||
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
|
||||
deprDiv.addContent(deprPhrase);
|
||||
if (!deprs.isEmpty()) {
|
||||
CommentHelper ch = utils.getCommentHelper(pkg);
|
||||
@ -629,7 +628,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
*/
|
||||
@Override
|
||||
protected Content getNavLinkModule() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, moduleLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.moduleLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -641,10 +640,10 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
public Content getNavLinkPrevious() {
|
||||
Content li;
|
||||
if (prevModule == null) {
|
||||
li = HtmlTree.LI(prevmoduleLabel);
|
||||
li = HtmlTree.LI(contents.prevModuleLabel);
|
||||
} else {
|
||||
li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(
|
||||
prevModule)), prevmoduleLabel, "", ""));
|
||||
prevModule)), contents.prevModuleLabel, "", ""));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
@ -657,10 +656,10 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
public Content getNavLinkNext() {
|
||||
Content li;
|
||||
if (nextModule == null) {
|
||||
li = HtmlTree.LI(nextmoduleLabel);
|
||||
li = HtmlTree.LI(contents.nextModuleLabel);
|
||||
} else {
|
||||
li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(
|
||||
nextModule)), nextmoduleLabel, "", ""));
|
||||
nextModule)), contents.nextModuleLabel, "", ""));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -83,21 +83,13 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
|
||||
writer.addMemberTree(memberSummaryTree, memberTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Nested_Class_Summary"));
|
||||
contents.nestedClassSummary);
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
@ -106,9 +98,9 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Nested_Class_Summary"),
|
||||
configuration.getText("doclet.nested_classes"));
|
||||
return resources.getText("doclet.Member_Table_Summary",
|
||||
resources.getText("doclet.Nested_Class_Summary"),
|
||||
resources.getText("doclet.nested_classes"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,7 +108,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Nested_Classes");
|
||||
return configuration.getContent("doclet.Nested_Classes");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,7 +161,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
|
||||
: configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
|
||||
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
|
||||
label);
|
||||
labelHeading.addContent(writer.getSpace());
|
||||
labelHeading.addContent(Contents.SPACE);
|
||||
labelHeading.addContent(classLink);
|
||||
inheritedTree.addContent(labelHeading);
|
||||
}
|
||||
@ -221,14 +213,14 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
|
||||
if (typeElement == null) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.NESTED_CLASS_SUMMARY,
|
||||
writer.getResource("doclet.navNested"));
|
||||
contents.navNested);
|
||||
} else {
|
||||
return writer.getHyperLink(
|
||||
SectionName.NESTED_CLASSES_INHERITANCE,
|
||||
utils.getFullyQualifiedName(typeElement), writer.getResource("doclet.navNested"));
|
||||
utils.getFullyQualifiedName(typeElement), contents.navNested);
|
||||
}
|
||||
} else {
|
||||
return writer.getResource("doclet.navNested");
|
||||
return contents.navNested;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Configuration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -80,8 +81,7 @@ public class PackageFrameWriter extends HtmlDocletWriter {
|
||||
* @param configuration the configuration of the doclet.
|
||||
* @param packageElement PackageElement under consideration.
|
||||
*/
|
||||
public PackageFrameWriter(ConfigurationImpl configuration, PackageElement packageElement)
|
||||
throws IOException {
|
||||
public PackageFrameWriter(ConfigurationImpl configuration, PackageElement packageElement) {
|
||||
super(configuration, DocPath.forPackage(packageElement).resolve(DocPaths.PACKAGE_FRAME));
|
||||
this.packageElement = packageElement;
|
||||
if (utils.getSpecifiedPackages().isEmpty()) {
|
||||
@ -119,10 +119,9 @@ public class PackageFrameWriter extends HtmlDocletWriter {
|
||||
}
|
||||
packgen.printHtmlDocument(
|
||||
configuration.metakeywords.getMetaKeywords(packageElement), false, body);
|
||||
packgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -139,30 +138,30 @@ public class PackageFrameWriter extends HtmlDocletWriter {
|
||||
Configuration config = configuration;
|
||||
if (utils.isIncluded(packageElement)) {
|
||||
addClassKindListing(utils.getInterfaces(packageElement),
|
||||
getResource("doclet.Interfaces"), contentTree);
|
||||
contents.interfaces, contentTree);
|
||||
addClassKindListing(utils.getOrdinaryClasses(packageElement),
|
||||
getResource("doclet.Classes"), contentTree);
|
||||
contents.classes, contentTree);
|
||||
addClassKindListing(utils.getEnums(packageElement),
|
||||
getResource("doclet.Enums"), contentTree);
|
||||
contents.enums, contentTree);
|
||||
addClassKindListing(utils.getExceptions(packageElement),
|
||||
getResource("doclet.Exceptions"), contentTree);
|
||||
contents.exceptions, contentTree);
|
||||
addClassKindListing(utils.getErrors(packageElement),
|
||||
getResource("doclet.Errors"), contentTree);
|
||||
contents.errors, contentTree);
|
||||
addClassKindListing(utils.getAnnotationTypes(packageElement),
|
||||
getResource("doclet.AnnotationTypes"), contentTree);
|
||||
contents.annotationTypes, contentTree);
|
||||
} else {
|
||||
addClassKindListing(config.typeElementCatalog.interfaces(packageElement),
|
||||
getResource("doclet.Interfaces"), contentTree);
|
||||
contents.interfaces, contentTree);
|
||||
addClassKindListing(config.typeElementCatalog.ordinaryClasses(packageElement),
|
||||
getResource("doclet.Classes"), contentTree);
|
||||
contents.classes, contentTree);
|
||||
addClassKindListing(config.typeElementCatalog.enums(packageElement),
|
||||
getResource("doclet.Enums"), contentTree);
|
||||
contents.enums, contentTree);
|
||||
addClassKindListing(config.typeElementCatalog.exceptions(packageElement),
|
||||
getResource("doclet.Exceptions"), contentTree);
|
||||
contents.exceptions, contentTree);
|
||||
addClassKindListing(config.typeElementCatalog.errors(packageElement),
|
||||
getResource("doclet.Errors"), contentTree);
|
||||
contents.errors, contentTree);
|
||||
addClassKindListing(config.typeElementCatalog.annotationTypes(packageElement),
|
||||
getResource("doclet.AnnotationTypes"), contentTree);
|
||||
contents.annotationTypes, contentTree);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -76,10 +77,9 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
|
||||
try {
|
||||
packgen = new PackageIndexFrameWriter(configuration, filename);
|
||||
packgen.buildPackageIndexFile("doclet.Window_Overview", false);
|
||||
packgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -91,12 +91,12 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
|
||||
protected void addPackagesList(Collection<PackageElement> packages, String text,
|
||||
String tableSummary, Content body) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
|
||||
packagesLabel);
|
||||
contents.packagesLabel);
|
||||
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
|
||||
? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
|
||||
: HtmlTree.DIV(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(packagesLabel);
|
||||
ul.setTitle(contents.packagesLabel);
|
||||
for (PackageElement aPackage : packages) {
|
||||
// Do not list the package if -nodeprecated option is set and the
|
||||
// package is marked as deprecated.
|
||||
@ -161,7 +161,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
|
||||
*/
|
||||
protected void addAllClassesLink(Content ul) {
|
||||
Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
|
||||
allclassesLabel, "", "packageFrame");
|
||||
contents.allClassesLabel, "", "packageFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.addContent(li);
|
||||
}
|
||||
@ -174,7 +174,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
|
||||
*/
|
||||
protected void addAllModulesLink(Content ul) {
|
||||
Content linkContent = getHyperLink(DocPaths.MODULE_OVERVIEW_FRAME,
|
||||
allmodulesLabel, "", "packageListFrame");
|
||||
contents.allModulesLabel, "", "packageListFrame");
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
ul.addContent(li);
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavigationBarFooter(Content body) {
|
||||
Content p = HtmlTree.P(getSpace());
|
||||
Content p = HtmlTree.P(Contents.SPACE);
|
||||
body.addContent(p);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,11 +31,13 @@ import java.util.*;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
|
||||
import jdk.javadoc.doclet.DocletEnvironment;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -103,10 +105,9 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
|
||||
try {
|
||||
packgen = new PackageIndexWriter(configuration, filename);
|
||||
packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
|
||||
packgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -189,12 +190,13 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
|
||||
subTitleDiv.addStyle(HtmlStyle.subTitle);
|
||||
addSummaryComment(configuration.overviewElement, subTitleDiv);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, subTitleDiv);
|
||||
Content see = seeLabel;
|
||||
see.addContent(" ");
|
||||
Content descPara = HtmlTree.P(see);
|
||||
Content descBody = new ContentBuilder();
|
||||
descBody.addContent(contents.seeLabel);
|
||||
descBody.addContent(" ");
|
||||
Content descPara = HtmlTree.P(descBody);
|
||||
Content descLink = getHyperLink(getDocLink(
|
||||
SectionName.OVERVIEW_DESCRIPTION),
|
||||
descriptionLabel, "", "");
|
||||
contents.descriptionLabel, "", "");
|
||||
descPara.addContent(descLink);
|
||||
div.addContent(descPara);
|
||||
if (configuration.allowTag(HtmlTag.MAIN)) {
|
||||
|
||||
@ -34,6 +34,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
@ -112,10 +113,9 @@ public class PackageTreeWriter extends AbstractTreeWriter {
|
||||
packgen = new PackageTreeWriter(configuration, path, pkg,
|
||||
prev, next);
|
||||
packgen.generatePackageTreeFile();
|
||||
packgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), path.getPath());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -130,7 +130,7 @@ public class PackageTreeWriter extends AbstractTreeWriter {
|
||||
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
|
||||
? HtmlTree.MAIN()
|
||||
: body;
|
||||
Content headContent = getResource("doclet.Hierarchy_For_Package",
|
||||
Content headContent = contents.getContent("doclet.Hierarchy_For_Package",
|
||||
utils.getPackageName(packageElement));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
|
||||
HtmlStyle.title, headContent);
|
||||
@ -187,7 +187,7 @@ public class PackageTreeWriter extends AbstractTreeWriter {
|
||||
*/
|
||||
protected void addLinkToMainTree(Content div) {
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
|
||||
getResource("doclet.Package_Hierarchies"));
|
||||
contents.packageHierarchies);
|
||||
div.addContent(span);
|
||||
HtmlTree ul = new HtmlTree (HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.horizontal);
|
||||
@ -231,7 +231,7 @@ public class PackageTreeWriter extends AbstractTreeWriter {
|
||||
@Override
|
||||
protected Content getNavLinkModule() {
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
|
||||
moduleLabel);
|
||||
contents.moduleLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -243,7 +243,7 @@ public class PackageTreeWriter extends AbstractTreeWriter {
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
|
||||
packageLabel);
|
||||
contents.packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
@ -108,11 +109,9 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
try {
|
||||
pkgusegen = new PackageUseWriter(configuration, mapper, filename, pkgElement);
|
||||
pkgusegen.generatePackageUseFile();
|
||||
pkgusegen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error(exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
@ -125,7 +124,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.contentContainer);
|
||||
if (usingPackageToUsedClasses.isEmpty()) {
|
||||
div.addContent(getResource("doclet.ClassUse_No.usage.of.0", utils.getPackageName(packageElement)));
|
||||
div.addContent(contents.getContent("doclet.ClassUse_No.usage.of.0", utils.getPackageName(packageElement)));
|
||||
} else {
|
||||
addPackageUse(div);
|
||||
}
|
||||
@ -167,7 +166,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
* @param contentTree the content tree to which the package list will be added
|
||||
*/
|
||||
protected void addPackageList(Content contentTree) throws IOException {
|
||||
Content caption = getTableCaption(configuration.getResource(
|
||||
Content caption = getTableCaption(configuration.getContent(
|
||||
"doclet.ClassUse_Packages.that.use.0",
|
||||
getPackageLink(packageElement, utils.getPackageName(packageElement))));
|
||||
Content table = (configuration.isOutputHtml5())
|
||||
@ -208,7 +207,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
}
|
||||
String tableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.classes"));
|
||||
Content caption = getTableCaption(configuration.getResource(
|
||||
Content caption = getTableCaption(configuration.getContent(
|
||||
"doclet.ClassUse_Classes.in.0.used.by.1",
|
||||
getPackageLink(packageElement, utils.getPackageName(packageElement)),
|
||||
getPackageLink(usingPackage, utils.getPackageName(usingPackage))));
|
||||
@ -265,7 +264,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
if (pkg != null && !pkg.isUnnamed()) {
|
||||
addSummaryComment(pkg, tdLast);
|
||||
} else {
|
||||
tdLast.addContent(getSpace());
|
||||
tdLast.addContent(Contents.SPACE);
|
||||
}
|
||||
contentTree.addContent(tdLast);
|
||||
}
|
||||
@ -289,7 +288,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
bodyTree.addContent(htmlTree);
|
||||
}
|
||||
ContentBuilder headContent = new ContentBuilder();
|
||||
headContent.addContent(getResource("doclet.ClassUse_Title", packageText));
|
||||
headContent.addContent(contents.getContent("doclet.ClassUse_Title", packageText));
|
||||
headContent.addContent(new HtmlTree(HtmlTag.BR));
|
||||
headContent.addContent(name);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
@ -311,7 +310,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
@Override
|
||||
protected Content getNavLinkModule() {
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
|
||||
moduleLabel);
|
||||
contents.moduleLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -323,7 +322,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
|
||||
packageLabel);
|
||||
contents.packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -334,7 +333,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
* @return a content tree for the use link
|
||||
*/
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.useLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -345,7 +344,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content linkContent = getHyperLink(DocPaths.PACKAGE_TREE,
|
||||
treeLabel);
|
||||
contents.treeLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
@ -100,8 +100,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
* @param next Next package in the sorted array.
|
||||
*/
|
||||
public PackageWriterImpl(ConfigurationImpl configuration,
|
||||
PackageElement packageElement, PackageElement prev, PackageElement next)
|
||||
throws IOException {
|
||||
PackageElement packageElement, PackageElement prev, PackageElement next) {
|
||||
super(configuration, DocPath
|
||||
.forPackage(packageElement)
|
||||
.resolve(DocPaths.PACKAGE_SUMMARY));
|
||||
@ -127,9 +126,9 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
div.addStyle(HtmlStyle.header);
|
||||
ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(packageElement);
|
||||
if (mdle != null && !mdle.isUnnamed()) {
|
||||
Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, moduleLabel);
|
||||
Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, contents.moduleLabel);
|
||||
Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
|
||||
moduleNameDiv.addContent(getSpace());
|
||||
moduleNameDiv.addContent(Contents.SPACE);
|
||||
moduleNameDiv.addContent(getModuleLink(mdle,
|
||||
new StringContent(mdle.getQualifiedName().toString())));
|
||||
div.addContent(moduleNameDiv);
|
||||
@ -138,8 +137,8 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
addAnnotationInfo(packageElement, annotationContent);
|
||||
div.addContent(annotationContent);
|
||||
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, packageLabel);
|
||||
tHeading.addContent(getSpace());
|
||||
HtmlStyle.title, contents.packageLabel);
|
||||
tHeading.addContent(Contents.SPACE);
|
||||
Content packageHead = new StringContent(heading);
|
||||
tHeading.addContent(packageHead);
|
||||
div.addContent(tHeading);
|
||||
@ -149,11 +148,11 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
docSummaryDiv.addStyle(HtmlStyle.docSummary);
|
||||
addSummaryComment(packageElement, docSummaryDiv);
|
||||
div.addContent(docSummaryDiv);
|
||||
Content space = getSpace();
|
||||
Content space = Contents.SPACE;
|
||||
Content descLink = getHyperLink(getDocLink(
|
||||
SectionName.PACKAGE_DESCRIPTION),
|
||||
descriptionLabel, "", "");
|
||||
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
|
||||
contents.descriptionLabel, "", "");
|
||||
Content descPara = new HtmlTree(HtmlTag.P, contents.seeLabel, space, descLink);
|
||||
div.addContent(descPara);
|
||||
}
|
||||
if (configuration.allowTag(HtmlTag.MAIN)) {
|
||||
@ -184,7 +183,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
CommentHelper ch = utils.getCommentHelper(packageElement);
|
||||
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
|
||||
deprDiv.addStyle(HtmlStyle.deprecatedContent);
|
||||
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
|
||||
deprDiv.addContent(deprPhrase);
|
||||
if (!deprs.isEmpty()) {
|
||||
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
|
||||
@ -233,7 +232,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
|
||||
tdClassDescription.addStyle(HtmlStyle.colLast);
|
||||
if (utils.isDeprecated(klass)) {
|
||||
tdClassDescription.addContent(deprecatedLabel);
|
||||
tdClassDescription.addContent(contents.deprecatedLabel);
|
||||
List<? extends DocTree> tags = utils.getDeprecatedTrees(klass);
|
||||
if (!tags.isEmpty()) {
|
||||
addSummaryDeprecatedComment(klass, tags.get(0), tdClassDescription);
|
||||
@ -323,7 +322,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
*/
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
|
||||
useLabel, "", "");
|
||||
contents.useLabel, "", "");
|
||||
Content li = HtmlTree.LI(useLink);
|
||||
return li;
|
||||
}
|
||||
@ -336,11 +335,11 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
public Content getNavLinkPrevious() {
|
||||
Content li;
|
||||
if (prev == null) {
|
||||
li = HtmlTree.LI(prevpackageLabel);
|
||||
li = HtmlTree.LI(contents.prevPackageLabel);
|
||||
} else {
|
||||
DocPath path = DocPath.relativePath(packageElement, prev);
|
||||
li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.PACKAGE_SUMMARY),
|
||||
prevpackageLabel, "", ""));
|
||||
contents.prevPackageLabel, "", ""));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
@ -353,11 +352,11 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
public Content getNavLinkNext() {
|
||||
Content li;
|
||||
if (next == null) {
|
||||
li = HtmlTree.LI(nextpackageLabel);
|
||||
li = HtmlTree.LI(contents.nextPackageLabel);
|
||||
} else {
|
||||
DocPath path = DocPath.relativePath(packageElement, next);
|
||||
li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.PACKAGE_SUMMARY),
|
||||
nextpackageLabel, "", ""));
|
||||
contents.nextPackageLabel, "", ""));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
@ -370,7 +369,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
|
||||
treeLabel, "", "");
|
||||
contents.treeLabel, "", "");
|
||||
Content li = HtmlTree.LI(useLink);
|
||||
return li;
|
||||
}
|
||||
@ -383,7 +382,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
@Override
|
||||
protected Content getNavLinkModule() {
|
||||
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
|
||||
moduleLabel);
|
||||
contents.moduleLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
@ -394,7 +393,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
|
||||
* @return a content tree for the package link
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.packageLabel);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
propertyDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.PROPERTY_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.propertyDetailsLabel);
|
||||
contents.propertyDetailsLabel);
|
||||
propertyDetailsTree.addContent(heading);
|
||||
return propertyDetailsTree;
|
||||
}
|
||||
@ -163,9 +163,9 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
Content codeLink = HtmlTree.CODE(link);
|
||||
Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel,
|
||||
utils.isClass(holder)
|
||||
? writer.descfrmClassLabel
|
||||
: writer.descfrmInterfaceLabel);
|
||||
descfrmLabel.addContent(writer.getSpace());
|
||||
? contents.descfrmClassLabel
|
||||
: contents.descfrmInterfaceLabel);
|
||||
descfrmLabel.addContent(Contents.SPACE);
|
||||
descfrmLabel.addContent(codeLink);
|
||||
propertyDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel));
|
||||
writer.addInlineComment(property, propertyDocTree);
|
||||
@ -202,21 +202,13 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
return getMemberTree(propertyDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Property_Summary"));
|
||||
contents.propertySummary);
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
@ -225,9 +217,9 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Property_Summary"),
|
||||
configuration.getText("doclet.properties"));
|
||||
return resources.getText("doclet.Member_Table_Summary",
|
||||
resources.getText("doclet.Property_Summary"),
|
||||
resources.getText("doclet.properties"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -235,7 +227,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
*/
|
||||
@Override
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Properties");
|
||||
return contents.properties;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -282,7 +274,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
: configuration.getText("doclet.Properties_Inherited_From_Interface"));
|
||||
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
|
||||
label);
|
||||
labelHeading.addContent(writer.getSpace());
|
||||
labelHeading.addContent(Contents.SPACE);
|
||||
labelHeading.addContent(classLink);
|
||||
inheritedTree.addContent(labelHeading);
|
||||
}
|
||||
@ -342,14 +334,14 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
if (typeElement == null) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.PROPERTY_SUMMARY,
|
||||
writer.getResource("doclet.navProperty"));
|
||||
contents.navProperty);
|
||||
} else {
|
||||
return writer.getHyperLink(
|
||||
SectionName.PROPERTIES_INHERITANCE,
|
||||
configuration.getClassName(typeElement), writer.getResource("doclet.navProperty"));
|
||||
configuration.getClassName(typeElement), contents.navProperty);
|
||||
}
|
||||
} else {
|
||||
return writer.getResource("doclet.navProperty");
|
||||
return contents.navProperty;
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,9 +353,9 @@ public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.PROPERTY_DETAIL,
|
||||
writer.getResource("doclet.navProperty")));
|
||||
contents.navProperty));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navProperty"));
|
||||
liNav.addContent(contents.navProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,8 +136,8 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
|
||||
*/
|
||||
public Content getPackageHeader(String packageName) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
|
||||
packageLabel);
|
||||
heading.addContent(getSpace());
|
||||
contents.packageLabel);
|
||||
heading.addContent(Contents.SPACE);
|
||||
heading.addContent(packageName);
|
||||
return heading;
|
||||
}
|
||||
@ -183,9 +183,9 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
|
||||
|
||||
//Print the heading.
|
||||
Content className = superClassLink == null ?
|
||||
configuration.getResource(
|
||||
configuration.getContent(
|
||||
"doclet.Class_0_implements_serializable", classLink) :
|
||||
configuration.getResource(
|
||||
configuration.getContent(
|
||||
"doclet.Class_0_extends_implements_serializable", classLink,
|
||||
superClassLink);
|
||||
li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2016, 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
|
||||
@ -33,6 +33,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -84,10 +85,9 @@ public class SingleIndexWriter extends AbstractIndexWriter {
|
||||
indexgen = new SingleIndexWriter(configuration,
|
||||
filename, indexbuilder);
|
||||
indexgen.generateIndexFile();
|
||||
indexgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -150,7 +150,7 @@ public class SingleIndexWriter extends AbstractIndexWriter {
|
||||
contentTree.addContent(
|
||||
getHyperLink(getNameForIndex(unicode),
|
||||
new StringContent(unicode)));
|
||||
contentTree.addContent(getSpace());
|
||||
contentTree.addContent(Contents.SPACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
@ -73,6 +74,7 @@ public class SourceToHTMLConverter {
|
||||
private static final String NEW_LINE = DocletConstants.NL;
|
||||
|
||||
private final ConfigurationImpl configuration;
|
||||
private final Messages messages;
|
||||
private final Utils utils;
|
||||
|
||||
private final DocletEnvironment docEnv;
|
||||
@ -88,6 +90,7 @@ public class SourceToHTMLConverter {
|
||||
private SourceToHTMLConverter(ConfigurationImpl configuration, DocletEnvironment rd,
|
||||
DocPath outputdir) {
|
||||
this.configuration = configuration;
|
||||
this.messages = configuration.getMessages();
|
||||
this.utils = configuration.utils;
|
||||
this.docEnv = rd;
|
||||
this.outputdir = outputdir;
|
||||
@ -200,7 +203,7 @@ public class SourceToHTMLConverter {
|
||||
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
|
||||
head, body);
|
||||
Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
|
||||
configuration.message.notice("doclet.Generating_0", path.getPath());
|
||||
messages.notice("doclet.Generating_0", path.getPath());
|
||||
DocFile df = DocFile.createFileForOutput(configuration, path);
|
||||
try (Writer w = df.openWriter()) {
|
||||
htmlDocument.write(w, true);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2016, 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
|
||||
@ -32,11 +32,13 @@ import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
@ -115,11 +117,10 @@ public class SplitIndexWriter extends AbstractIndexWriter {
|
||||
if (!li.hasNext()) {
|
||||
indexgen.createSearchIndexFiles();
|
||||
}
|
||||
indexgen.close();
|
||||
}
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename.getPath());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -178,7 +179,7 @@ public class SplitIndexWriter extends AbstractIndexWriter {
|
||||
int j = i + 1;
|
||||
contentTree.addContent(getHyperLink(DocPaths.indexN(j),
|
||||
new StringContent(indexElements.get(i).toString())));
|
||||
contentTree.addContent(getSpace());
|
||||
contentTree.addContent(Contents.SPACE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +189,7 @@ public class SplitIndexWriter extends AbstractIndexWriter {
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
public Content getNavLinkPrevious() {
|
||||
Content prevletterLabel = getResource("doclet.Prev_Letter");
|
||||
Content prevletterLabel = contents.prevLetter;
|
||||
if (prev == -1) {
|
||||
return HtmlTree.LI(prevletterLabel);
|
||||
}
|
||||
@ -205,7 +206,7 @@ public class SplitIndexWriter extends AbstractIndexWriter {
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
public Content getNavLinkNext() {
|
||||
Content nextletterLabel = getResource("doclet.Next_Letter");
|
||||
Content nextletterLabel = contents.nextLetter;
|
||||
if (next == -1) {
|
||||
return HtmlTree.LI(nextletterLabel);
|
||||
}
|
||||
|
||||
@ -35,7 +35,6 @@ import com.sun.source.doctree.DocTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
|
||||
@ -67,8 +66,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
|
||||
*/
|
||||
protected HtmlTree mainTree = HtmlTree.MAIN();
|
||||
|
||||
public SubWriterHolderWriter(ConfigurationImpl configuration, DocPath filename)
|
||||
throws IOException {
|
||||
public SubWriterHolderWriter(ConfigurationImpl configuration, DocPath filename) {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
@ -126,7 +124,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
|
||||
Content captionSpan;
|
||||
Content span;
|
||||
if (type.isDefaultTab()) {
|
||||
captionSpan = HtmlTree.SPAN(configuration.getResource(type.resourceKey()));
|
||||
captionSpan = HtmlTree.SPAN(configuration.getContent(type.resourceKey()));
|
||||
span = HtmlTree.SPAN(type.tabId(),
|
||||
HtmlStyle.activeTableTab, captionSpan);
|
||||
} else {
|
||||
@ -134,7 +132,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
|
||||
span = HtmlTree.SPAN(type.tabId(),
|
||||
HtmlStyle.tableTab, captionSpan);
|
||||
}
|
||||
Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, getSpace());
|
||||
Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, Contents.SPACE);
|
||||
span.addContent(tabSpan);
|
||||
tabbedCaption.addContent(span);
|
||||
}
|
||||
@ -149,7 +147,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
|
||||
*/
|
||||
public Content getMethodTypeLinks(MethodTypes methodType) {
|
||||
String jsShow = "javascript:show(" + methodType.value() +");";
|
||||
HtmlTree link = HtmlTree.A(jsShow, configuration.getResource(methodType.resourceKey()));
|
||||
HtmlTree link = HtmlTree.A(jsShow, configuration.getContent(methodType.resourceKey()));
|
||||
return link;
|
||||
}
|
||||
|
||||
@ -189,9 +187,9 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
|
||||
List<? extends DocTree> deprs = utils.getBlockTags(member, DocTree.Kind.DEPRECATED);
|
||||
Content div;
|
||||
if (utils.isDeprecated(member)) {
|
||||
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
|
||||
div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
|
||||
div.addContent(getSpace());
|
||||
div.addContent(Contents.SPACE);
|
||||
if (!deprs.isEmpty()) {
|
||||
addInlineDeprecatedComment(member, deprs.get(0), div);
|
||||
}
|
||||
@ -200,9 +198,9 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
|
||||
} else {
|
||||
Element te = member.getEnclosingElement();
|
||||
if (te != null && utils.isTypeElement(te) && utils.isDeprecated(te)) {
|
||||
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, contents.deprecatedPhrase);
|
||||
div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
|
||||
div.addContent(getSpace());
|
||||
div.addContent(Contents.SPACE);
|
||||
tdSummary.addContent(div);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
@ -51,7 +52,6 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.MessageRetriever;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
||||
/**
|
||||
@ -144,7 +144,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
return null;
|
||||
}
|
||||
}.visit(element);
|
||||
si.setCategory(configuration.getResource("doclet.SearchTags").toString());
|
||||
si.setCategory(configuration.getContent("doclet.SearchTags").toString());
|
||||
configuration.tagSearchIndex.add(si);
|
||||
}
|
||||
return result;
|
||||
@ -212,13 +212,6 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public MessageRetriever getMsgRetriever() {
|
||||
return configuration.message;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, 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
|
||||
@ -36,6 +36,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
@ -96,10 +97,9 @@ public class TreeWriter extends AbstractTreeWriter {
|
||||
try {
|
||||
treegen = new TreeWriter(configuration, filename, classtree);
|
||||
treegen.generateTreeFile();
|
||||
treegen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
@ -110,7 +110,7 @@ public class TreeWriter extends AbstractTreeWriter {
|
||||
*/
|
||||
public void generateTreeFile() throws IOException {
|
||||
HtmlTree body = getTreeHeader();
|
||||
Content headContent = getResource("doclet.Hierarchy_For_All_Packages");
|
||||
Content headContent = contents.hierarchyForAllPackages;
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
|
||||
HtmlStyle.title, headContent);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
@ -154,7 +154,7 @@ public class TreeWriter extends AbstractTreeWriter {
|
||||
}
|
||||
if (!classesonly) {
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
|
||||
getResource("doclet.Package_Hierarchies"));
|
||||
contents.packageHierarchies);
|
||||
contentTree.addContent(span);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.horizontal);
|
||||
|
||||
@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2016, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.javadoc.internal.doclets.formats.html.markup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
|
||||
|
||||
/**
|
||||
* Class for containing fixed string content for HTML tags of javadoc output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*/
|
||||
public class FixedStringContent extends Content {
|
||||
private final String string;
|
||||
|
||||
/**
|
||||
* Constructor to construct FixedStringContent object.
|
||||
*
|
||||
* @param content content for the object
|
||||
*/
|
||||
public FixedStringContent(CharSequence content) {
|
||||
string = needEscape(content)
|
||||
? escape(content)
|
||||
: content.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is not supported by the class.
|
||||
*
|
||||
* @param content content that needs to be added
|
||||
* @throws DocletAbortException this method will always throw a
|
||||
* DocletAbortException because it
|
||||
* is not supported.
|
||||
*/
|
||||
@Override
|
||||
public void addContent(Content content) {
|
||||
throw new DocletAbortException("not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds content for the StringContent object. The method escapes
|
||||
* HTML characters for the string content that is added.
|
||||
*
|
||||
* @param strContent string content to be added
|
||||
* @throws DocletAbortException this method will always throw a
|
||||
* DocletAbortException because it
|
||||
* is not supported.
|
||||
*/
|
||||
@Override
|
||||
public void addContent(CharSequence strContent) {
|
||||
throw new DocletAbortException("not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return string.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int charCount() {
|
||||
return RawHtml.charCount(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return string;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean write(Writer out, boolean atNewline) throws IOException {
|
||||
out.write(string);
|
||||
return string.endsWith(DocletConstants.NL);
|
||||
}
|
||||
|
||||
private boolean needEscape(CharSequence cs) {
|
||||
for (int i = 0; i < cs.length(); i++) {
|
||||
switch (cs.charAt(i)) {
|
||||
case '<':
|
||||
case '>':
|
||||
case '&':
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private String escape(CharSequence s) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
switch (ch) {
|
||||
case '<': sb.append("<"); break;
|
||||
case '>': sb.append(">"); break;
|
||||
case '&': sb.append("&"); break;
|
||||
default: sb.append(ch); break;
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -36,6 +36,7 @@ import jdk.javadoc.internal.doclets.formats.html.ConfigurationImpl;
|
||||
import jdk.javadoc.internal.doclets.formats.html.SectionName;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Configuration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
@ -67,11 +68,11 @@ public abstract class HtmlDocWriter extends HtmlWriter {
|
||||
*
|
||||
* @param filename String file name.
|
||||
*/
|
||||
public HtmlDocWriter(Configuration configuration, DocPath filename)
|
||||
throws IOException {
|
||||
public HtmlDocWriter(Configuration configuration, DocPath filename) {
|
||||
super(configuration, filename);
|
||||
this.pathToRoot = filename.parent().invert();
|
||||
configuration.message.notice("doclet.Generating_0",
|
||||
Messages messages = configuration.getMessages();
|
||||
messages.notice("doclet.Generating_0",
|
||||
DocFile.createFileForOutput(configuration, filename).getPath());
|
||||
}
|
||||
|
||||
@ -310,10 +311,6 @@ public abstract class HtmlDocWriter extends HtmlWriter {
|
||||
return (encl.isUnnamed()) ? "" : (encl.getQualifiedName() + ".");
|
||||
}
|
||||
|
||||
public boolean getMemberDetailsListPrinted() {
|
||||
return memberDetailsListPrinted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the frames version of the Html file header.
|
||||
* Called only when generating an HTML frames file.
|
||||
|
||||
@ -30,6 +30,7 @@ import java.util.*;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Configuration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Resources;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
|
||||
@ -61,11 +62,6 @@ public class HtmlWriter {
|
||||
*/
|
||||
protected Configuration configuration;
|
||||
|
||||
/**
|
||||
* The flag to indicate whether a member details list is printed or not.
|
||||
*/
|
||||
protected boolean memberDetailsListPrinted;
|
||||
|
||||
/**
|
||||
* Header for table displaying modules and description..
|
||||
*/
|
||||
@ -106,89 +102,7 @@ public class HtmlWriter {
|
||||
*/
|
||||
protected final String modifierTypeHeader;
|
||||
|
||||
public final Content overviewLabel;
|
||||
|
||||
public final Content defaultPackageLabel;
|
||||
|
||||
public final Content packageLabel;
|
||||
|
||||
public final Content moduleLabel;
|
||||
|
||||
public final Content useLabel;
|
||||
|
||||
public final Content prevLabel;
|
||||
|
||||
public final Content nextLabel;
|
||||
|
||||
public final Content prevclassLabel;
|
||||
|
||||
public final Content nextclassLabel;
|
||||
|
||||
public final Content summaryLabel;
|
||||
|
||||
public final Content detailLabel;
|
||||
|
||||
public final Content moduleSubNavLabel;
|
||||
|
||||
public final Content framesLabel;
|
||||
|
||||
public final Content noframesLabel;
|
||||
|
||||
public final Content treeLabel;
|
||||
|
||||
public final Content classLabel;
|
||||
|
||||
public final Content deprecatedLabel;
|
||||
|
||||
public final Content deprecatedPhrase;
|
||||
|
||||
public final Content allclassesLabel;
|
||||
|
||||
public final Content allpackagesLabel;
|
||||
|
||||
public final Content allmodulesLabel;
|
||||
|
||||
public final Content indexLabel;
|
||||
|
||||
public final Content helpLabel;
|
||||
|
||||
public final Content seeLabel;
|
||||
|
||||
public final Content descriptionLabel;
|
||||
|
||||
public final Content prevpackageLabel;
|
||||
|
||||
public final Content nextpackageLabel;
|
||||
|
||||
public final Content prevmoduleLabel;
|
||||
|
||||
public final Content nextmoduleLabel;
|
||||
|
||||
public final Content packagesLabel;
|
||||
|
||||
public final Content modulesLabel;
|
||||
|
||||
public final Content methodDetailsLabel;
|
||||
|
||||
public final Content annotationTypeDetailsLabel;
|
||||
|
||||
public final Content fieldDetailsLabel;
|
||||
|
||||
public final Content propertyDetailsLabel;
|
||||
|
||||
public final Content constructorDetailsLabel;
|
||||
|
||||
public final Content enumConstantsDetailsLabel;
|
||||
|
||||
public final Content specifiedByLabel;
|
||||
|
||||
public final Content overridesLabel;
|
||||
|
||||
public final Content descfrmClassLabel;
|
||||
|
||||
public final Content descfrmInterfaceLabel;
|
||||
|
||||
private final Writer writer;
|
||||
private final DocFile docFile;
|
||||
|
||||
protected Content script;
|
||||
|
||||
@ -198,143 +112,45 @@ public class HtmlWriter {
|
||||
*
|
||||
* @param path The directory path to be created for this file
|
||||
* or null if none to be created.
|
||||
* @exception IOException Exception raised by the FileWriter is passed on
|
||||
* to next level.
|
||||
* @exception UnsupportedEncodingException Exception raised by the
|
||||
* OutputStreamWriter is passed on to next level.
|
||||
*/
|
||||
public HtmlWriter(Configuration configuration, DocPath path)
|
||||
throws IOException, UnsupportedEncodingException {
|
||||
writer = DocFile.createFileForOutput(configuration, path).openWriter();
|
||||
public HtmlWriter(Configuration configuration, DocPath path) {
|
||||
docFile = DocFile.createFileForOutput(configuration, path);
|
||||
this.configuration = configuration;
|
||||
this.memberDetailsListPrinted = false;
|
||||
|
||||
// The following should be converted to shared Content objects
|
||||
// and moved to Contents, but that will require additional
|
||||
// changes at the use sites.
|
||||
Resources resources = configuration.getResources();
|
||||
moduleTableHeader = Arrays.asList(
|
||||
configuration.getText("doclet.Module"),
|
||||
configuration.getText("doclet.Description"));
|
||||
resources.getText("doclet.Module"),
|
||||
resources.getText("doclet.Description"));
|
||||
packageTableHeader = new ArrayList<>();
|
||||
packageTableHeader.add(configuration.getText("doclet.Package"));
|
||||
packageTableHeader.add(configuration.getText("doclet.Description"));
|
||||
packageTableHeader.add(resources.getText("doclet.Package"));
|
||||
packageTableHeader.add(resources.getText("doclet.Description"));
|
||||
requiresTableHeader = new ArrayList<>();
|
||||
requiresTableHeader.add(configuration.getText("doclet.Module"));
|
||||
requiresTableHeader.add(configuration.getText("doclet.Description"));
|
||||
requiresTableHeader.add(resources.getText("doclet.Module"));
|
||||
requiresTableHeader.add(resources.getText("doclet.Description"));
|
||||
exportedPackagesTableHeader = new ArrayList<>();
|
||||
exportedPackagesTableHeader.add(configuration.getText("doclet.Package"));
|
||||
exportedPackagesTableHeader.add(configuration.getText("doclet.Module"));
|
||||
exportedPackagesTableHeader.add(configuration.getText("doclet.Description"));
|
||||
exportedPackagesTableHeader.add(resources.getText("doclet.Package"));
|
||||
exportedPackagesTableHeader.add(resources.getText("doclet.Module"));
|
||||
exportedPackagesTableHeader.add(resources.getText("doclet.Description"));
|
||||
usesTableHeader = new ArrayList<>();
|
||||
usesTableHeader.add(configuration.getText("doclet.Type"));
|
||||
usesTableHeader.add(configuration.getText("doclet.Description"));
|
||||
usesTableHeader.add(resources.getText("doclet.Type"));
|
||||
usesTableHeader.add(resources.getText("doclet.Description"));
|
||||
providesTableHeader = new ArrayList<>();
|
||||
providesTableHeader.add(configuration.getText("doclet.Type"));
|
||||
providesTableHeader.add(configuration.getText("doclet.Description"));
|
||||
useTableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.packages"));
|
||||
modifierTypeHeader = configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Modifier"),
|
||||
configuration.getText("doclet.Type"));
|
||||
overviewLabel = getResource("doclet.Overview");
|
||||
defaultPackageLabel = new StringContent(DocletConstants.DEFAULT_PACKAGE_NAME);
|
||||
packageLabel = getResource("doclet.Package");
|
||||
moduleLabel = getResource("doclet.Module");
|
||||
useLabel = getResource("doclet.navClassUse");
|
||||
prevLabel = getResource("doclet.Prev");
|
||||
nextLabel = getResource("doclet.Next");
|
||||
prevclassLabel = getNonBreakResource("doclet.Prev_Class");
|
||||
nextclassLabel = getNonBreakResource("doclet.Next_Class");
|
||||
summaryLabel = getResource("doclet.Summary");
|
||||
detailLabel = getResource("doclet.Detail");
|
||||
moduleSubNavLabel = getResource("doclet.Module_Sub_Nav");
|
||||
framesLabel = getResource("doclet.Frames");
|
||||
noframesLabel = getNonBreakResource("doclet.No_Frames");
|
||||
treeLabel = getResource("doclet.Tree");
|
||||
classLabel = getResource("doclet.Class");
|
||||
deprecatedLabel = getResource("doclet.navDeprecated");
|
||||
deprecatedPhrase = getResource("doclet.Deprecated");
|
||||
allclassesLabel = getNonBreakResource("doclet.All_Classes");
|
||||
allpackagesLabel = getNonBreakResource("doclet.All_Packages");
|
||||
allmodulesLabel = getNonBreakResource("doclet.All_Modules");
|
||||
indexLabel = getResource("doclet.Index");
|
||||
helpLabel = getResource("doclet.Help");
|
||||
seeLabel = getResource("doclet.See");
|
||||
descriptionLabel = getResource("doclet.Description");
|
||||
prevpackageLabel = getNonBreakResource("doclet.Prev_Package");
|
||||
nextpackageLabel = getNonBreakResource("doclet.Next_Package");
|
||||
prevmoduleLabel = getNonBreakResource("doclet.Prev_Module");
|
||||
nextmoduleLabel = getNonBreakResource("doclet.Next_Module");
|
||||
packagesLabel = getResource("doclet.Packages");
|
||||
modulesLabel = getResource("doclet.Modules");
|
||||
methodDetailsLabel = getResource("doclet.Method_Detail");
|
||||
annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
|
||||
fieldDetailsLabel = getResource("doclet.Field_Detail");
|
||||
propertyDetailsLabel = getResource("doclet.Property_Detail");
|
||||
constructorDetailsLabel = getResource("doclet.Constructor_Detail");
|
||||
enumConstantsDetailsLabel = getResource("doclet.Enum_Constant_Detail");
|
||||
specifiedByLabel = getResource("doclet.Specified_By");
|
||||
overridesLabel = getResource("doclet.Overrides");
|
||||
descfrmClassLabel = getResource("doclet.Description_From_Class");
|
||||
descfrmInterfaceLabel = getResource("doclet.Description_From_Interface");
|
||||
providesTableHeader.add(resources.getText("doclet.Type"));
|
||||
providesTableHeader.add(resources.getText("doclet.Description"));
|
||||
useTableSummary = resources.getText("doclet.Use_Table_Summary",
|
||||
resources.getText("doclet.packages"));
|
||||
modifierTypeHeader = resources.getText("doclet.0_and_1",
|
||||
resources.getText("doclet.Modifier"),
|
||||
resources.getText("doclet.Type"));
|
||||
}
|
||||
|
||||
public void write(Content c) throws IOException {
|
||||
c.write(writer, true);
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key) {
|
||||
return configuration.getResource(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content, replacing spaces
|
||||
* with non-breaking spaces.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getNonBreakResource(String key) {
|
||||
String text = configuration.getText(key);
|
||||
Content c = configuration.newContent();
|
||||
int start = 0;
|
||||
int p;
|
||||
while ((p = text.indexOf(" ", start)) != -1) {
|
||||
c.addContent(text.substring(start, p));
|
||||
c.addContent(RawHtml.nbsp);
|
||||
start = p + 1;
|
||||
try (Writer writer = docFile.openWriter()) {
|
||||
c.write(writer, true);
|
||||
}
|
||||
c.addContent(text.substring(start));
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param o string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key, Object o) {
|
||||
return configuration.getResource(key, o);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param o1 string or content argument added to configuration text
|
||||
* @param o2 string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key, Object o0, Object o1) {
|
||||
return configuration.getResource(key, o0, o1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -343,21 +159,21 @@ public class HtmlWriter {
|
||||
* @return an HtmlTree for the SCRIPT tag
|
||||
*/
|
||||
protected HtmlTree getWinTitleScript(){
|
||||
HtmlTree script = HtmlTree.SCRIPT();
|
||||
HtmlTree scriptTree = HtmlTree.SCRIPT();
|
||||
if(winTitle != null && winTitle.length() > 0) {
|
||||
String scriptCode = "<!--" + DocletConstants.NL +
|
||||
" try {" + DocletConstants.NL +
|
||||
" if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
|
||||
" parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" catch(err) {" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
"//-->" + DocletConstants.NL;
|
||||
RawHtml scriptContent = new RawHtml(scriptCode);
|
||||
script.addContent(scriptContent);
|
||||
String scriptCode = "<!--\n" +
|
||||
" try {\n" +
|
||||
" if (location.href.indexOf('is-external=true') == -1) {\n" +
|
||||
" parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" catch(err) {\n" +
|
||||
" }\n" +
|
||||
"//-->\n";
|
||||
RawHtml scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL));
|
||||
scriptTree.addContent(scriptContent);
|
||||
}
|
||||
return script;
|
||||
return scriptTree;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -413,61 +229,61 @@ public class HtmlWriter {
|
||||
* @return a content for the SCRIPT tag
|
||||
*/
|
||||
protected Content getFramesJavaScript() {
|
||||
HtmlTree script = HtmlTree.SCRIPT();
|
||||
String scriptCode = DocletConstants.NL +
|
||||
" targetPage = \"\" + window.location.search;" + DocletConstants.NL +
|
||||
" if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
|
||||
" targetPage = targetPage.substring(1);" + DocletConstants.NL +
|
||||
" if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL +
|
||||
" targetPage = \"undefined\";" + DocletConstants.NL +
|
||||
" function validURL(url) {" + DocletConstants.NL +
|
||||
" try {" + DocletConstants.NL +
|
||||
" url = decodeURIComponent(url);" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" catch (error) {" + DocletConstants.NL +
|
||||
" return false;" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" var pos = url.indexOf(\".html\");" + DocletConstants.NL +
|
||||
" if (pos == -1 || pos != url.length - 5)" + DocletConstants.NL +
|
||||
" return false;" + DocletConstants.NL +
|
||||
" var allowNumber = false;" + DocletConstants.NL +
|
||||
" var allowSep = false;" + DocletConstants.NL +
|
||||
" var seenDot = false;" + DocletConstants.NL +
|
||||
" for (var i = 0; i < url.length - 5; i++) {" + DocletConstants.NL +
|
||||
" var ch = url.charAt(i);" + DocletConstants.NL +
|
||||
" if ('a' <= ch && ch <= 'z' ||" + DocletConstants.NL +
|
||||
" 'A' <= ch && ch <= 'Z' ||" + DocletConstants.NL +
|
||||
" ch == '$' ||" + DocletConstants.NL +
|
||||
" ch == '_' ||" + DocletConstants.NL +
|
||||
" ch.charCodeAt(0) > 127) {" + DocletConstants.NL +
|
||||
" allowNumber = true;" + DocletConstants.NL +
|
||||
" allowSep = true;" + DocletConstants.NL +
|
||||
" } else if ('0' <= ch && ch <= '9'" + DocletConstants.NL +
|
||||
" || ch == '-') {" + DocletConstants.NL +
|
||||
" if (!allowNumber)" + DocletConstants.NL +
|
||||
" return false;" + DocletConstants.NL +
|
||||
" } else if (ch == '/' || ch == '.') {" + DocletConstants.NL +
|
||||
" if (!allowSep)" + DocletConstants.NL +
|
||||
" return false;" + DocletConstants.NL +
|
||||
" allowNumber = false;" + DocletConstants.NL +
|
||||
" allowSep = false;" + DocletConstants.NL +
|
||||
" if (ch == '.')" + DocletConstants.NL +
|
||||
" seenDot = true;" + DocletConstants.NL +
|
||||
" if (ch == '/' && seenDot)" + DocletConstants.NL +
|
||||
" return false;" + DocletConstants.NL +
|
||||
" } else {" + DocletConstants.NL +
|
||||
" return false;"+ DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" return true;" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" function loadFrames() {" + DocletConstants.NL +
|
||||
" if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
|
||||
" top.classFrame.location = top.targetPage;" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL;
|
||||
RawHtml scriptContent = new RawHtml(scriptCode);
|
||||
script.addContent(scriptContent);
|
||||
return script;
|
||||
HtmlTree scriptTree = HtmlTree.SCRIPT();
|
||||
String scriptCode = "\n" +
|
||||
" targetPage = \"\" + window.location.search;\n" +
|
||||
" if (targetPage != \"\" && targetPage != \"undefined\")\n" +
|
||||
" targetPage = targetPage.substring(1);\n" +
|
||||
" if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))\n" +
|
||||
" targetPage = \"undefined\";\n" +
|
||||
" function validURL(url) {\n" +
|
||||
" try {\n" +
|
||||
" url = decodeURIComponent(url);\n" +
|
||||
" }\n" +
|
||||
" catch (error) {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" var pos = url.indexOf(\".html\");\n" +
|
||||
" if (pos == -1 || pos != url.length - 5)\n" +
|
||||
" return false;\n" +
|
||||
" var allowNumber = false;\n" +
|
||||
" var allowSep = false;\n" +
|
||||
" var seenDot = false;\n" +
|
||||
" for (var i = 0; i < url.length - 5; i++) {\n" +
|
||||
" var ch = url.charAt(i);\n" +
|
||||
" if ('a' <= ch && ch <= 'z' ||\n" +
|
||||
" 'A' <= ch && ch <= 'Z' ||\n" +
|
||||
" ch == '$' ||\n" +
|
||||
" ch == '_' ||\n" +
|
||||
" ch.charCodeAt(0) > 127) {\n" +
|
||||
" allowNumber = true;\n" +
|
||||
" allowSep = true;\n" +
|
||||
" } else if ('0' <= ch && ch <= '9'\n" +
|
||||
" || ch == '-') {\n" +
|
||||
" if (!allowNumber)\n" +
|
||||
" return false;\n" +
|
||||
" } else if (ch == '/' || ch == '.') {\n" +
|
||||
" if (!allowSep)\n" +
|
||||
" return false;\n" +
|
||||
" allowNumber = false;\n" +
|
||||
" allowSep = false;\n" +
|
||||
" if (ch == '.')\n" +
|
||||
" seenDot = true;\n" +
|
||||
" if (ch == '/' && seenDot)\n" +
|
||||
" return false;\n" +
|
||||
" } else {\n" +
|
||||
" return false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" return true;\n" +
|
||||
" }\n" +
|
||||
" function loadFrames() {\n" +
|
||||
" if (targetPage != \"\" && targetPage != \"undefined\")\n" +
|
||||
" top.classFrame.location = top.targetPage;\n" +
|
||||
" }\n";
|
||||
RawHtml scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL));
|
||||
scriptTree.addContent(scriptContent);
|
||||
return scriptTree;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -487,7 +303,7 @@ public class HtmlWriter {
|
||||
this.script = getWinTitleScript();
|
||||
body.addContent(script);
|
||||
Content noScript = HtmlTree.NOSCRIPT(
|
||||
HtmlTree.DIV(getResource("doclet.No_Script_Message")));
|
||||
HtmlTree.DIV(configuration.getContent("doclet.No_Script_Message")));
|
||||
body.addContent(noScript);
|
||||
}
|
||||
return body;
|
||||
@ -558,17 +374,6 @@ public class HtmlWriter {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String codeText(String text) {
|
||||
return "<code>" + text + "</code>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return "&nbsp;", non-breaking space.
|
||||
*/
|
||||
public Content getSpace() {
|
||||
return RawHtml.nbsp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a header for Modifier and Type column of a table.
|
||||
*/
|
||||
|
||||
@ -44,7 +44,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
|
||||
*/
|
||||
public class RawHtml extends Content {
|
||||
|
||||
private String rawHtmlContent;
|
||||
private final String rawHtmlContent;
|
||||
|
||||
public static final Content nbsp = new RawHtml(" ");
|
||||
|
||||
|
||||
@ -58,7 +58,10 @@ public abstract class AbstractDoclet {
|
||||
/**
|
||||
* The global configuration information for this run.
|
||||
*/
|
||||
public Configuration configuration;
|
||||
private Configuration configuration;
|
||||
|
||||
protected Messages messages;
|
||||
|
||||
/*
|
||||
* a handle to our utility methods
|
||||
*/
|
||||
@ -76,7 +79,7 @@ public abstract class AbstractDoclet {
|
||||
*/
|
||||
private boolean isValidDoclet() {
|
||||
if (!getClass().getName().equals(TOOLKIT_DOCLET_NAME)) {
|
||||
configuration.message.error("doclet.Toolkit_Usage_Violation",
|
||||
messages.error("doclet.Toolkit_Usage_Violation",
|
||||
TOOLKIT_DOCLET_NAME);
|
||||
return false;
|
||||
}
|
||||
@ -96,6 +99,8 @@ public abstract class AbstractDoclet {
|
||||
configuration.utils = new Utils(configuration);
|
||||
utils = configuration.utils;
|
||||
configuration.workArounds = new WorkArounds(configuration);
|
||||
messages = configuration.getMessages();
|
||||
|
||||
if (!isValidDoclet()) {
|
||||
return false;
|
||||
}
|
||||
@ -116,6 +121,7 @@ public abstract class AbstractDoclet {
|
||||
}
|
||||
return false;
|
||||
} catch (Exception exc) {
|
||||
exc.printStackTrace(System.err);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -146,14 +152,13 @@ public abstract class AbstractDoclet {
|
||||
*/
|
||||
private void startGeneration(DocletEnvironment root) throws Configuration.Fault, Exception {
|
||||
if (root.getIncludedClasses().isEmpty()) {
|
||||
configuration.message.
|
||||
error("doclet.No_Public_Classes_To_Document");
|
||||
messages.error("doclet.No_Public_Classes_To_Document");
|
||||
return;
|
||||
}
|
||||
if (!configuration.setOptions()) {
|
||||
return;
|
||||
}
|
||||
configuration.getDocletSpecificMsg().notice("doclet.build_version",
|
||||
messages.notice("doclet.build_version",
|
||||
configuration.getDocletSpecificBuildDate());
|
||||
ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
|
||||
|
||||
|
||||
@ -124,9 +124,4 @@ public interface AnnotationTypeFieldWriter {
|
||||
* @param annotationDocTree the content tree to which the tags will be added
|
||||
*/
|
||||
public void addTags(Element member, Content annotationDocTree);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
||||
@ -125,9 +125,4 @@ public interface AnnotationTypeRequiredMemberWriter {
|
||||
* @param annotationDocTree the content tree to which the tags will be added
|
||||
*/
|
||||
public void addTags(Element member, Content annotationDocTree);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
||||
@ -155,11 +155,6 @@ public interface AnnotationTypeWriter {
|
||||
*/
|
||||
public void printDocument(Content contentTree) throws IOException;
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
|
||||
/**
|
||||
* Return the {@link TypeElement} being documented.
|
||||
*
|
||||
|
||||
@ -196,11 +196,6 @@ public interface ClassWriter {
|
||||
*/
|
||||
public void printDocument(Content contentTree) throws IOException;
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
|
||||
/**
|
||||
* Return the TypeElement being documented.
|
||||
*
|
||||
|
||||
@ -27,8 +27,6 @@ package jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ModuleElement;
|
||||
@ -50,7 +48,6 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Extern;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Group;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.MessageRetriever;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.MetaKeywords;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.TypeElementCatalog;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
@ -265,15 +262,6 @@ public abstract class Configuration {
|
||||
*/
|
||||
public TypeElementCatalog typeElementCatalog;
|
||||
|
||||
/**
|
||||
* Message Retriever for the doclet, to retrieve message from the resource
|
||||
* file for this Configuration, which is common for 1.1 and standard
|
||||
* doclets.
|
||||
*
|
||||
* TODO: Make this private!!!
|
||||
*/
|
||||
public MessageRetriever message = null;
|
||||
|
||||
/**
|
||||
* True if user wants to suppress time stamp in output.
|
||||
* Default is false.
|
||||
@ -309,6 +297,9 @@ public abstract class Configuration {
|
||||
|
||||
private List<GroupContainer> groups;
|
||||
|
||||
public abstract Messages getMessages();
|
||||
public abstract Resources getResources();
|
||||
|
||||
/**
|
||||
* Return the build date for the doclet.
|
||||
*/
|
||||
@ -322,12 +313,6 @@ public abstract class Configuration {
|
||||
|
||||
public abstract boolean finishOptionSettings();
|
||||
|
||||
/**
|
||||
* Return the doclet specific {@link MessageRetriever}
|
||||
* @return the doclet specific MessageRetriever.
|
||||
*/
|
||||
public abstract MessageRetriever getDocletSpecificMsg();
|
||||
|
||||
public CommentUtils cmtUtils;
|
||||
public SortedSet<ModuleElement> modules;
|
||||
|
||||
@ -354,11 +339,12 @@ public abstract class Configuration {
|
||||
*/
|
||||
public Map<ModuleElement, Set<PackageElement>> modulePackages;
|
||||
|
||||
protected static final String sharedResourceBundleName =
|
||||
"jdk.javadoc.internal.doclets.toolkit.resources.doclets";
|
||||
/**
|
||||
* Constructor. Constructs the message retriever with resource file.
|
||||
*/
|
||||
public Configuration() {
|
||||
message = new MessageRetriever(this, "jdk.javadoc.internal.doclets.toolkit.resources.doclets");
|
||||
excludedDocFileDirs = new HashSet<>();
|
||||
excludedQualifiers = new HashSet<>();
|
||||
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
|
||||
@ -578,7 +564,7 @@ public abstract class Configuration {
|
||||
sourcetab = -1;
|
||||
}
|
||||
if (sourcetab <= 0) {
|
||||
message.warning("doclet.sourcetab_warning");
|
||||
getMessages().warning("doclet.sourcetab_warning");
|
||||
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
|
||||
}
|
||||
return true;
|
||||
@ -696,7 +682,7 @@ public abstract class Configuration {
|
||||
*/
|
||||
private void initTagletManager(Set<List<String>> customTagStrs) {
|
||||
tagletManager = tagletManager == null ?
|
||||
new TagletManager(nosince, showversion, showauthor, javafx, message) :
|
||||
new TagletManager(nosince, showversion, showauthor, javafx, this) :
|
||||
tagletManager;
|
||||
for (List<String> args : customTagStrs) {
|
||||
if (args.get(0).equals("-taglet")) {
|
||||
@ -721,7 +707,8 @@ public abstract class Configuration {
|
||||
} else if (tokens.size() >= 3) {
|
||||
tagletManager.addNewSimpleCustomTag(tokens.get(0), tokens.get(2), tokens.get(1));
|
||||
} else {
|
||||
message.error("doclet.Error_invalid_custom_tag_argument", args.get(1));
|
||||
Messages messages = getMessages();
|
||||
messages.error("doclet.Error_invalid_custom_tag_argument", args.get(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -893,123 +880,69 @@ public abstract class Configuration {
|
||||
: utils.getFullyQualifiedName(te);
|
||||
}
|
||||
|
||||
public String getText(String key) {
|
||||
// Check the doclet specific properties file.
|
||||
MessageRetriever docletMessage = getDocletSpecificMsg();
|
||||
if (docletMessage.containsKey(key)) {
|
||||
return docletMessage.getText(key);
|
||||
}
|
||||
// Check the shared properties file.
|
||||
return message.getText(key);
|
||||
}
|
||||
|
||||
public String getText(String key, String a1) {
|
||||
// Check the doclet specific properties file.
|
||||
MessageRetriever docletMessage = getDocletSpecificMsg();
|
||||
if (docletMessage.containsKey(key)) {
|
||||
return docletMessage.getText(key, a1);
|
||||
}
|
||||
// Check the shared properties file.
|
||||
return message.getText(key, a1);
|
||||
}
|
||||
|
||||
public String getText(String key, String a1, String a2) {
|
||||
// Check the doclet specific properties file.
|
||||
MessageRetriever docletMessage = getDocletSpecificMsg();
|
||||
if (docletMessage.containsKey(key)) {
|
||||
return docletMessage.getText(key, a1, a2);
|
||||
}
|
||||
// Check the shared properties file.
|
||||
return message.getText(key, a1, a2);
|
||||
}
|
||||
|
||||
public String getText(String key, String a1, String a2, String a3) {
|
||||
// Check the doclet specific properties file.
|
||||
MessageRetriever docletMessage = getDocletSpecificMsg();
|
||||
if (docletMessage.containsKey(key)) {
|
||||
return docletMessage.getText(key, a1, a2, a3);
|
||||
}
|
||||
// Check the shared properties file.
|
||||
return message.getText(key, a1, a2, a3);
|
||||
}
|
||||
|
||||
public abstract Content newContent();
|
||||
/**
|
||||
* Convenience method to obtain a resource from the doclet's
|
||||
* {@link Resources resources}.
|
||||
* Equivalent to <code>getResources.getText(key);</code>.
|
||||
* @param key the key for the desired string
|
||||
* @return the string for the given key
|
||||
* @throws MissingResourceException if the key is not found in either
|
||||
* bundle.
|
||||
*/
|
||||
public abstract String getText(String key);
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
* Convenience method to obtain a resource from the doclet's
|
||||
* {@link Resources resources}.
|
||||
* Equivalent to <code>getResources.getText(key, args);</code>.
|
||||
* @param key the key for the desired string
|
||||
* @param args values to be substituted into the resulting string
|
||||
* @return the string for the given key
|
||||
* @throws MissingResourceException if the key is not found in either
|
||||
* bundle.
|
||||
*/
|
||||
public abstract String getText(String key, String... args);
|
||||
|
||||
/**
|
||||
* Convenience method to obtain a resource from the doclet's
|
||||
* {@link Resources resources} as a {@code Content} object.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param key the key for the desired string
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key) {
|
||||
Content c = newContent();
|
||||
c.addContent(getText(key));
|
||||
return c;
|
||||
}
|
||||
public abstract Content getContent(String key);
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
* Convenience method to obtain a resource from the doclet's
|
||||
* {@link Resources resources} as a {@code Content} object.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param key the key for the desired string
|
||||
* @param o string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key, Object o) {
|
||||
return getResource(key, o, null, null);
|
||||
}
|
||||
public abstract Content getContent(String key, Object o);
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
* Convenience method to obtain a resource from the doclet's
|
||||
* {@link Resources resources} as a {@code Content} object.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param key the key for the desired string
|
||||
* @param o1 resource argument
|
||||
* @param o2 resource argument
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key, Object o1, Object o2) {
|
||||
return getResource(key, o1, o2, null);
|
||||
}
|
||||
public abstract Content getContent(String key, Object o1, Object o2);
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param key the key for the desired string
|
||||
* @param o0 string or content argument added to configuration text
|
||||
* @param o1 string or content argument added to configuration text
|
||||
* @param o2 string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key, Object o0, Object o1, Object o2) {
|
||||
Content c = newContent();
|
||||
Pattern p = Pattern.compile("\\{([012])\\}");
|
||||
String text = getText(key);
|
||||
Matcher m = p.matcher(text);
|
||||
int start = 0;
|
||||
while (m.find(start)) {
|
||||
c.addContent(text.substring(start, m.start()));
|
||||
|
||||
Object o = null;
|
||||
switch (m.group(1).charAt(0)) {
|
||||
case '0': o = o0; break;
|
||||
case '1': o = o1; break;
|
||||
case '2': o = o2; break;
|
||||
}
|
||||
|
||||
if (o == null) {
|
||||
c.addContent("{" + m.group(1) + "}");
|
||||
} else if (o instanceof String) {
|
||||
c.addContent((String) o);
|
||||
} else if (o instanceof Content) {
|
||||
c.addContent((Content) o);
|
||||
}
|
||||
|
||||
start = m.end();
|
||||
}
|
||||
|
||||
c.addContent(text.substring(start));
|
||||
return c;
|
||||
}
|
||||
|
||||
public abstract Content getContent(String key, Object o0, Object o1, Object o2);
|
||||
|
||||
/**
|
||||
* Return true if the TypeElement element is getting documented, depending upon
|
||||
@ -1110,7 +1043,7 @@ public abstract class Configuration {
|
||||
|
||||
private String getOptionsMessage(String key) {
|
||||
try {
|
||||
return c.getDocletSpecificMsg().getText(key, (Object[]) null);
|
||||
return c.getResources().getText(key);
|
||||
} catch (MissingResourceException ignore) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -46,11 +46,6 @@ import javax.lang.model.element.VariableElement;
|
||||
|
||||
public interface ConstantsSummaryWriter {
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public abstract void close() throws IOException;
|
||||
|
||||
/**
|
||||
* Get the header for the constant summary documentation.
|
||||
*
|
||||
|
||||
@ -119,9 +119,4 @@ public interface ConstructorWriter {
|
||||
* @param foundNonPubConstructor true if we found a non public constructor.
|
||||
*/
|
||||
public void setFoundNonPubConstructor(boolean foundNonPubConstructor);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
||||
@ -112,9 +112,4 @@ public interface EnumConstantWriter {
|
||||
* @return content tree for the enum constants documentation
|
||||
*/
|
||||
public Content getEnumConstants(Content enumConstantsTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
||||
@ -113,9 +113,4 @@ public interface FieldWriter {
|
||||
* @return content tree for the field documentation
|
||||
*/
|
||||
public Content getFieldDoc(Content fieldDocTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
||||
@ -122,9 +122,4 @@ public interface MemberSummaryWriter {
|
||||
* @return a content tree for the member
|
||||
*/
|
||||
public Content getMemberTree(Content memberTree);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
||||
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.tools.Diagnostic;
|
||||
|
||||
import com.sun.source.util.DocTreePath;
|
||||
import jdk.javadoc.doclet.Reporter;
|
||||
|
||||
import static javax.tools.Diagnostic.Kind.*;
|
||||
|
||||
/**
|
||||
* Provides standardized access to the diagnostic reporting facilities
|
||||
* for a doclet.
|
||||
*
|
||||
* Messages are specified by resource keys to be found in the doclet's
|
||||
* {@link Resources resources}. Values can be substituted into the
|
||||
* strings obtained from the resource files.
|
||||
*
|
||||
* Messages are reported to the doclet's {@link Reporter reporter}.
|
||||
*/
|
||||
public class Messages {
|
||||
private final Configuration configuration;
|
||||
private final Resources resources;
|
||||
private Reporter reporter;
|
||||
|
||||
/**
|
||||
* Creates a {@code Messages} object to provide standardized access to
|
||||
* the doclet's diagnostic reporting mechanisms.
|
||||
*
|
||||
* @param configuration the doclet's configuration, used to access
|
||||
* the doclet's resources, reporter, and additional methods and state
|
||||
* used to filter out messages, if any, which should be suppressed.
|
||||
*/
|
||||
public Messages(Configuration configuration) {
|
||||
this.configuration = configuration;
|
||||
resources = configuration.getResources();
|
||||
}
|
||||
|
||||
// ***** Errors *****
|
||||
|
||||
/**
|
||||
* Reports an error message to the doclet's reporter.
|
||||
*
|
||||
* @param key the name of a resource containing the message to be printed
|
||||
* @param args optional arguments to be replaced in the message.
|
||||
*/
|
||||
public void error(String key, Object... args) {
|
||||
report(ERROR, resources.getText(key, args));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an error message to the doclet's reporter.
|
||||
*
|
||||
* @param path a path identifying the position to be included with
|
||||
* the message
|
||||
* @param key the name of a resource containing the message to be printed
|
||||
* @param args optional arguments to be replaced in the message.
|
||||
*/
|
||||
public void error(DocTreePath path, String key, Object... args) {
|
||||
report(ERROR, path, resources.getText(key, args));
|
||||
}
|
||||
|
||||
// ***** Warnings *****
|
||||
|
||||
/**
|
||||
* Reports a warning message to the doclet's reporter.
|
||||
*
|
||||
* @param key the name of a resource containing the message to be printed
|
||||
* @param args optional arguments to be replaced in the message.
|
||||
*/
|
||||
public void warning(String key, Object... args) {
|
||||
report(WARNING, resources.getText(key, args));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports a warning message to the doclet's reporter.
|
||||
*
|
||||
* @param path a path identifying the position to be included with
|
||||
* the message
|
||||
* @param key the name of a resource containing the message to be printed
|
||||
* @param args optional arguments to be replaced in the message.
|
||||
*/
|
||||
public void warning(DocTreePath path, String key, Object... args) {
|
||||
if (configuration.showMessage(path, key))
|
||||
report(WARNING, path, resources.getText(key, args));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports a warning message to the doclet's reporter.
|
||||
*
|
||||
* @param e an element identifying the declaration whose position should
|
||||
* to be included with the message
|
||||
* @param key the name of a resource containing the message to be printed
|
||||
* @param args optional arguments to be replaced in the message.
|
||||
*/
|
||||
public void warning(Element e, String key, Object... args) {
|
||||
if (configuration.showMessage(e, key)) {
|
||||
report(WARNING, e, resources.getText(key, args));
|
||||
}
|
||||
}
|
||||
|
||||
// ***** Notices *****
|
||||
|
||||
/**
|
||||
* Reports an informational notice to the doclet's reporter.
|
||||
*
|
||||
* @param key the name of a resource containing the message to be printed
|
||||
* @param args optional arguments to be replaced in the message.
|
||||
*/
|
||||
public void notice(String key, Object... args) {
|
||||
if (!configuration.quiet) {
|
||||
report(NOTE, resources.getText(key, args));
|
||||
}
|
||||
}
|
||||
|
||||
// ***** Internal support *****
|
||||
|
||||
private void report(Diagnostic.Kind k, String msg) {
|
||||
initReporter();
|
||||
reporter.print(k, msg);
|
||||
}
|
||||
|
||||
private void report(Diagnostic.Kind k, DocTreePath p, String msg) {
|
||||
initReporter();
|
||||
reporter.print(k, p, msg);
|
||||
}
|
||||
|
||||
private void report(Diagnostic.Kind k, Element e, String msg) {
|
||||
initReporter();
|
||||
reporter.print(k, e, msg);
|
||||
}
|
||||
|
||||
// Lazy init the reporter for now, until we can fix/improve
|
||||
// the init of ConfigurationImpl in HtmlDoclet (and similar.)
|
||||
private void initReporter() {
|
||||
if (reporter == null) {
|
||||
reporter = configuration.reporter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -114,9 +114,4 @@ public interface MethodWriter {
|
||||
* @return content tree for the method documentation
|
||||
*/
|
||||
public Content getMethodDoc(Content methodDocTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
||||
@ -132,10 +132,4 @@ public interface ModuleSummaryWriter {
|
||||
* @param contentTree the content tree that will be printed
|
||||
*/
|
||||
public abstract void printDocument(Content contentTree) throws IOException;
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public abstract void close() throws IOException;
|
||||
|
||||
}
|
||||
|
||||
@ -40,9 +40,4 @@ import java.io.*;
|
||||
*/
|
||||
|
||||
public interface NestedClassWriter {
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
||||
@ -121,9 +121,4 @@ public interface PackageSummaryWriter {
|
||||
*/
|
||||
public abstract void printDocument(Content contentTree) throws IOException;
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public abstract void close() throws IOException;
|
||||
|
||||
}
|
||||
|
||||
@ -112,9 +112,4 @@ public interface PropertyWriter {
|
||||
* @return content tree for the property documentation
|
||||
*/
|
||||
public Content getPropertyDoc(Content propertyDocTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
|
||||
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.javadoc.internal.doclets.toolkit;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Access to the localizable resources used by a doclet.
|
||||
* The resources are split across two resource bundles:
|
||||
* one that contains format-neutral strings common to
|
||||
* all supported formats, and one that contains strings
|
||||
* specific to the selected doclet, such as the standard
|
||||
* HTML doclet.
|
||||
*/
|
||||
public class Resources {
|
||||
private final Configuration configuration;
|
||||
private final String commonBundleName;
|
||||
private final String docletBundleName;
|
||||
|
||||
protected ResourceBundle commonBundle;
|
||||
protected ResourceBundle docletBundle;
|
||||
|
||||
/**
|
||||
* Creates a {@code Resources} to provide access the resource
|
||||
* bundles used by a doclet.
|
||||
*
|
||||
* @param configuration the configuration for the doclet,
|
||||
* to provide access the locale to be used when accessing the
|
||||
* names resource bundles.
|
||||
* @param commonBundleName the name of the bundle containing the strings
|
||||
* common to all output formats
|
||||
* @param docletBundleName the name of the bundle containing the strings
|
||||
* specific to a particular format
|
||||
*/
|
||||
public Resources(Configuration configuration, String commonBundleName, String docletBundleName) {
|
||||
this.configuration = configuration;
|
||||
this.commonBundleName = commonBundleName;
|
||||
this.docletBundleName = docletBundleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string for the given key from one of the doclet's
|
||||
* resource bundles.
|
||||
*
|
||||
* The more specific bundle is checked first;
|
||||
* if it is not there, the common bundle is then checked.
|
||||
*
|
||||
* @param key the key for the desired string
|
||||
* @return the string for the given key
|
||||
* @throws MissingResourceException if the key is not found in either
|
||||
* bundle.
|
||||
*/
|
||||
public String getText(String key) throws MissingResourceException {
|
||||
initBundles();
|
||||
|
||||
if (docletBundle.containsKey(key))
|
||||
return docletBundle.getString(key);
|
||||
|
||||
return commonBundle.getString(key);
|
||||
}
|
||||
/**
|
||||
* Gets the string for the given key from one of the doclet's
|
||||
* resource bundles, substituting additional arguments into
|
||||
* into the resulting string with {@link MessageFormat#format}.
|
||||
*
|
||||
* The more specific bundle is checked first;
|
||||
* if it is not there, the common bundle is then checked.
|
||||
*
|
||||
* @param key the key for the desired string
|
||||
* @param args values to be substituted into the resulting string
|
||||
* @return the string for the given key
|
||||
* @throws MissingResourceException if the key is not found in either
|
||||
* bundle.
|
||||
*/
|
||||
public String getText(String key, Object... args) throws MissingResourceException {
|
||||
return MessageFormat.format(getText(key), args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazily initializes the bundles. This is (currently) necessary because
|
||||
* this object may be created before the locale to be used is known.
|
||||
*/
|
||||
protected void initBundles() {
|
||||
if (commonBundle == null) {
|
||||
Locale locale = configuration.getLocale();
|
||||
this.commonBundle = ResourceBundle.getBundle(commonBundleName, locale);
|
||||
this.docletBundle = ResourceBundle.getBundle(docletBundleName, locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -137,11 +137,6 @@ public interface SerializedFormWriter {
|
||||
*/
|
||||
public SerialMethodWriter getSerialMethodWriter(TypeElement typeElement);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public abstract void close() throws IOException;
|
||||
|
||||
/**
|
||||
* Get the serialized content.
|
||||
*
|
||||
|
||||
@ -33,6 +33,7 @@ import javax.lang.model.element.PackageElement;
|
||||
|
||||
import jdk.javadoc.internal.doclets.toolkit.Configuration;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Content;
|
||||
import jdk.javadoc.internal.doclets.toolkit.Messages;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
|
||||
|
||||
@ -89,6 +90,7 @@ public abstract class AbstractBuilder {
|
||||
*/
|
||||
protected final Configuration configuration;
|
||||
|
||||
protected final Messages messages;
|
||||
protected final Utils utils;
|
||||
|
||||
/**
|
||||
@ -112,6 +114,7 @@ public abstract class AbstractBuilder {
|
||||
*/
|
||||
public AbstractBuilder(Context c) {
|
||||
this.configuration = c.configuration;
|
||||
this.messages = configuration.getMessages();
|
||||
this.utils = configuration.utils;
|
||||
this.containingPackagesSeen = c.containingPackagesSeen;
|
||||
this.layoutParser = c.layoutParser;
|
||||
@ -144,13 +147,18 @@ public abstract class AbstractBuilder {
|
||||
new Class<?>[]{XMLNode.class, Content.class},
|
||||
new Object[]{node, contentTree});
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
e.printStackTrace(System.err);
|
||||
configuration.reporter.print(ERROR, "Unknown element: " + component);
|
||||
throw new DocletAbortException(e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new DocletAbortException(e.getCause());
|
||||
Throwable cause = e.getCause();
|
||||
if (cause instanceof DocletAbortException) {
|
||||
throw (DocletAbortException) cause;
|
||||
} else {
|
||||
throw new DocletAbortException(e.getCause());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
e.printStackTrace(System.err);
|
||||
configuration.reporter.print(ERROR, "Exception " +
|
||||
e.getClass().getName() +
|
||||
" thrown while processing element: " + component);
|
||||
|
||||
@ -124,7 +124,6 @@ public class AnnotationTypeBuilder extends AbstractBuilder {
|
||||
writer.addAnnotationContentTree(contentTree, annotationContentTree);
|
||||
writer.addFooter(contentTree);
|
||||
writer.printDocument(contentTree);
|
||||
writer.close();
|
||||
copyDocFiles();
|
||||
}
|
||||
|
||||
|
||||
@ -152,7 +152,6 @@ public class ClassBuilder extends AbstractBuilder {
|
||||
writer.addClassContentTree(contentTree, classContentTree);
|
||||
writer.addFooter(contentTree);
|
||||
writer.printDocument(contentTree);
|
||||
writer.close();
|
||||
copyDocFiles();
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user