ICU-12739 JDK8 as the reference platform - use Java 8 version of ICUTaglet implementation by default.

X-SVN-Rev: 39349
This commit is contained in:
Yoshito Umaoka 2016-09-26 16:41:39 +00:00
parent 4bbd8315bd
commit 72dea1b93c
7 changed files with 103 additions and 98 deletions

1
.gitattributes vendored
View File

@ -538,6 +538,7 @@ icu4j/tools/build/icu4j54.api3.gz -text
icu4j/tools/build/icu4j55.api3.gz -text icu4j/tools/build/icu4j55.api3.gz -text
icu4j/tools/build/icu4j56.api3.gz -text icu4j/tools/build/icu4j56.api3.gz -text
icu4j/tools/build/icu4j57.api3.gz -text icu4j/tools/build/icu4j57.api3.gz -text
icu4j/tools/build/src-pre8/com/ibm/icu/dev/tool/docs/ICUTagletAdapter.java -text
tools/currency/.classpath -text tools/currency/.classpath -text
tools/currency/.project -text tools/currency/.project -text
tools/currency/.settings/org.eclipse.core.resources.prefs -text tools/currency/.settings/org.eclipse.core.resources.prefs -text

View File

@ -82,14 +82,15 @@
</condition> </condition>
</fail> </fail>
<condition property="is.java7"> <condition property="is.java8">
<contains string="${java.version}" substring="1.7."/> <contains string="${java.version}" substring="1.8."/>
</condition> </condition>
<condition property="is.java7.plus"> <condition property="is.java7.plus">
<or> <or>
<contains string="${java.version}" substring="1.7."/> <contains string="${java.version}" substring="1.7."/>
<contains string="${java.version}" substring="1.8."/> <contains string="${java.version}" substring="1.8."/>
<contains string="${java.version}" substring="1.9."/>
</or> </or>
</condition> </condition>
@ -542,10 +543,10 @@
<!-- release targets --> <!-- release targets -->
<target name="_check_config_for_release"> <target name="_check_config_for_release" depends="_checkJCite">
<condition property="release.build.config.ok"> <condition property="release.build.config.ok">
<and> <and>
<isset property="is.java7"/> <isset property="is.java8"/>
<isset property="java6.bootclasspath"/> <isset property="java6.bootclasspath"/>
<isset property="jcite.libs"/> <isset property="jcite.libs"/>
</and> </and>
@ -553,8 +554,8 @@
</target> </target>
<target name="_verify_config_for_release" depends="_check_config_for_release" unless="release.build.config.ok"> <target name="_verify_config_for_release" depends="_check_config_for_release" unless="release.build.config.ok">
<condition property="disp.is.java7" value="${java.version}" else="${java.version} - Must be 1.7!"> <condition property="disp.is.java8" value="${java.version}" else="${java.version} - Must be 1.8!">
<isset property="is.java7"/> <isset property="is.java8"/>
</condition> </condition>
<condition property="disp.java6.bootclasspath" value="${java6.bootclasspath}" else="Not Defined!"> <condition property="disp.java6.bootclasspath" value="${java6.bootclasspath}" else="Not Defined!">
<isset property="java6.bootclasspath"/> <isset property="java6.bootclasspath"/>
@ -565,7 +566,7 @@
<echo message="################################################################"/> <echo message="################################################################"/>
<echo message="[WARNING] Insufficient Build Configuration for ICU4J Release"/> <echo message="[WARNING] Insufficient Build Configuration for ICU4J Release"/>
<echo message="JDK Tools Version: ${disp.is.java7}"/> <echo message="JDK Tools Version: ${disp.is.java8}"/>
<echo message="JRE 6 System Library Path: ${disp.java6.bootclasspath}"/> <echo message="JRE 6 System Library Path: ${disp.java6.bootclasspath}"/>
<echo message="JCite Library Path: ${disp.jcite.libs}"/> <echo message="JCite Library Path: ${disp.jcite.libs}"/>
<echo message="################################################################"/> <echo message="################################################################"/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JDK7_TOOLS"/> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JDK8_TOOLS"/>
<classpathentry kind="output" path="out/bin"/> <classpathentry kind="output" path="out/bin"/>
</classpath> </classpath>

View File

@ -7,9 +7,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@ -98,7 +98,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16

View File

@ -11,8 +11,11 @@
<property file="build.properties"/> <property file="build.properties"/>
<!-- before importing common-targets.xml --> <!-- before importing common-targets.xml -->
<condition property="alt.src.dir" value="out/tmp-src8"> <condition property="alt.src.dir" value="out/tmp-src-pre8">
<equals arg1="${ant.java.version}" arg2="1.8"/> <or>
<equals arg1="${ant.java.version}" arg2="1.6"/>
<equals arg1="${ant.java.version}" arg2="1.7"/>
</or>
</condition> </condition>
<condition property="src.dir" value="${alt.src.dir}"> <condition property="src.dir" value="${alt.src.dir}">
@ -33,25 +36,25 @@
<target name="clean" depends="@clean" description="Clean up the build outputs"/> <target name="clean" depends="@clean" description="Clean up the build outputs"/>
<target name="compile" depends="copy-src-jdk8, @compile" description="Compile java source files"/> <target name="compile" depends="copy-src-pre8, @compile" description="Compile java source files"/>
<target name="copy" depends="@copy" description="Copy non-java runtime files to the project's binary directory"/> <target name="copy" depends="@copy" description="Copy non-java runtime files to the project's binary directory"/>
<target name="jar" depends="compile, copy, @jar" description="Create the project's jar file"/> <target name="jar" depends="compile, copy, @jar" description="Create the project's jar file"/>
<target name="src-jar" depends="copy-src-jdk8, @src-jar" description="Create the project's source jar file"/> <target name="src-jar" depends="copy-src-pre8, @src-jar" description="Create the project's source jar file"/>
<!-- Override a source file for supporting JDK 8 JavaDoc --> <!-- Override a source file for supporting JDK 8 JavaDoc -->
<target name="copy-src-jdk8" if="alt.src.dir"> <target name="copy-src-pre8" if="alt.src.dir">
<echo message="Building ICU4J build tools with JDK8 tools..."/> <echo message="Building ICU4J build tools with JDK7 or older tools..."/>
<mkdir dir="${alt.src.dir}"/> <mkdir dir="${alt.src.dir}"/>
<!-- copy all files under 'src' --> <!-- copy all files under 'src' -->
<copy todir="${alt.src.dir}"> <copy todir="${alt.src.dir}">
<fileset dir="src"/> <fileset dir="src"/>
</copy> </copy>
<!-- overwrite jdk8 specific source file --> <!-- overwrite jdk7 or older specific source file -->
<copy todir="${alt.src.dir}" overwrite="yes"> <copy todir="${alt.src.dir}" overwrite="yes">
<fileset dir="src8"/> <fileset dir="src-pre8"/>
</copy> </copy>
</target> </target>
</project> </project>

View File

@ -10,16 +10,15 @@ package com.ibm.icu.dev.tool.docs;
import com.sun.javadoc.Doc; import com.sun.javadoc.Doc;
import com.sun.javadoc.Tag; import com.sun.javadoc.Tag;
import com.sun.tools.doclets.formats.html.markup.RawHtml;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.taglets.Taglet; import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletOutput;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter; import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter;
/** /**
* The ICUTagletAdapter class is the abstract base class that adapts the ICUTaglet class to different implementations of the JavaDoc API. * The ICUTagletAdapter class is the abstract base class that adapts the ICUTaglet class to different implementations of the JavaDoc API.
* The methods in this class are meant to minimize the dual maintenance nature of supporting multiple JavaDoc APIs. * The methods in this class are meant to minimize the dual maintenance nature of supporting multiple JavaDoc APIs.
* *
* This adapter supports the v8 JavaDoc API * This adapter supports the v7 and earlier JavaDoc API
*/ */
public abstract class ICUTagletAdapter implements Taglet { public abstract class ICUTagletAdapter implements Taglet {
@ -27,34 +26,24 @@ public abstract class ICUTagletAdapter implements Taglet {
public abstract String toString(Tag[] tags); public abstract String toString(Tag[] tags);
public Content getTagletOutput(Tag tag, TagletWriter writer) public TagletOutput getTagletOutput(Tag tag, TagletWriter writer)
throws IllegalArgumentException { throws IllegalArgumentException {
// addContext doesn't except nulls so filter them out TagletOutput out = writer.getTagletOutputInstance();
String encodedText = toString(tag); out.setOutput(toString(tag));
if(encodedText == null) return null; return out;
Content out = writer.getOutputInstance();
out.addContent(new RawHtml(encodedText));
return out;
}
public Content getTagletOutput(Doc holder, TagletWriter writer)
throws IllegalArgumentException {
Content out = writer.getOutputInstance();
Tag[] tags = holder.tags(getName());
if (tags.length == 0) {
return null;
} }
// addContext doesn't except nulls so filter them out public TagletOutput getTagletOutput(Doc holder, TagletWriter writer)
String encodedText = toString(tags[0]); throws IllegalArgumentException {
if(encodedText == null) return null;
out.addContent(new RawHtml(encodedText)); TagletOutput out = writer.getTagletOutputInstance();
return out; Tag[] tags = holder.tags(getName());
} if (tags.length == 0) {
return null;
}
out.setOutput(toString(tags[0]));
return out;
}
} }

View File

@ -10,15 +10,16 @@ package com.ibm.icu.dev.tool.docs;
import com.sun.javadoc.Doc; import com.sun.javadoc.Doc;
import com.sun.javadoc.Tag; import com.sun.javadoc.Tag;
import com.sun.tools.doclets.formats.html.markup.RawHtml;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.taglets.Taglet; import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletOutput;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter; import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter;
/** /**
* The ICUTagletAdapter class is the abstract base class that adapts the ICUTaglet class to different implementations of the JavaDoc API. * The ICUTagletAdapter class is the abstract base class that adapts the ICUTaglet class to different implementations of the JavaDoc API.
* The methods in this class are meant to minimize the dual maintenance nature of supporting multiple JavaDoc APIs. * The methods in this class are meant to minimize the dual maintenance nature of supporting multiple JavaDoc APIs.
* *
* This adapter supports the v7 and earlier JavaDoc API * This adapter supports the v8 JavaDoc API
*/ */
public abstract class ICUTagletAdapter implements Taglet { public abstract class ICUTagletAdapter implements Taglet {
@ -26,24 +27,34 @@ public abstract class ICUTagletAdapter implements Taglet {
public abstract String toString(Tag[] tags); public abstract String toString(Tag[] tags);
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) public Content getTagletOutput(Tag tag, TagletWriter writer)
throws IllegalArgumentException { throws IllegalArgumentException {
TagletOutput out = writer.getTagletOutputInstance(); // addContext doesn't except nulls so filter them out
out.setOutput(toString(tag)); String encodedText = toString(tag);
return out; if(encodedText == null) return null;
Content out = writer.getOutputInstance();
out.addContent(new RawHtml(encodedText));
return out;
}
public Content getTagletOutput(Doc holder, TagletWriter writer)
throws IllegalArgumentException {
Content out = writer.getOutputInstance();
Tag[] tags = holder.tags(getName());
if (tags.length == 0) {
return null;
} }
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) // addContext doesn't except nulls so filter them out
throws IllegalArgumentException { String encodedText = toString(tags[0]);
if(encodedText == null) return null;
TagletOutput out = writer.getTagletOutputInstance(); out.addContent(new RawHtml(encodedText));
Tag[] tags = holder.tags(getName()); return out;
if (tags.length == 0) { }
return null;
}
out.setOutput(toString(tags[0]));
return out;
}
} }