8267176: StandardDoclet should provide access to Reporter and Locale
Reviewed-by: hannesw
This commit is contained in:
parent
56b65e4a8d
commit
e1462e79df
@ -102,4 +102,26 @@ public class StandardDoclet implements Doclet {
|
|||||||
public boolean run(DocletEnvironment docEnv) {
|
public boolean run(DocletEnvironment docEnv) {
|
||||||
return htmlDoclet.run(docEnv);
|
return htmlDoclet.run(docEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@return the locale for this doclet}
|
||||||
|
*
|
||||||
|
* @see #init(Locale, Reporter)
|
||||||
|
*
|
||||||
|
* @since 17
|
||||||
|
*/
|
||||||
|
public Locale getLocale() {
|
||||||
|
return htmlDoclet.getConfiguration().getLocale();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@return the reporter for this doclet}
|
||||||
|
*
|
||||||
|
* @see #init(Locale, Reporter)
|
||||||
|
*
|
||||||
|
* @since 17
|
||||||
|
*/
|
||||||
|
public Reporter getReporter() {
|
||||||
|
return htmlDoclet.getConfiguration().getReporter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,21 +55,7 @@ public class MyTaglet implements Taglet {
|
|||||||
Taglet.super.init(env, doclet);
|
Taglet.super.init(env, doclet);
|
||||||
docEnv = env;
|
docEnv = env;
|
||||||
|
|
||||||
// The following should be as simple as
|
reporter = ((StandardDoclet) doclet).getReporter();
|
||||||
// reporter = ((StandardDoclet) doclet).getReporter();
|
|
||||||
// JDK-8267176
|
|
||||||
try {
|
|
||||||
StandardDoclet sd = (StandardDoclet) doclet;
|
|
||||||
Field htmlDocletField = sd.getClass().getDeclaredField("htmlDoclet");
|
|
||||||
htmlDocletField.setAccessible(true);
|
|
||||||
Object htmlDoclet = htmlDocletField.get(sd);
|
|
||||||
Method getConfigurationMethod = htmlDoclet.getClass().getDeclaredMethod("getConfiguration");
|
|
||||||
Object config = getConfigurationMethod.invoke(htmlDoclet);
|
|
||||||
Method getReporterMethod = config.getClass().getMethod(("getReporter"));
|
|
||||||
reporter = (Reporter) getReporterMethod.invoke(config);
|
|
||||||
} catch (ReflectiveOperationException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 8267126
|
* @bug 8267126 8267176
|
||||||
* @summary javadoc should show "line and caret" for diagnostics
|
* @summary javadoc should show "line and caret" for diagnostics
|
||||||
* @library /tools/lib ../../lib
|
* @library /tools/lib ../../lib
|
||||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||||
|
Loading…
Reference in New Issue
Block a user