提交 ba6f5e21 编写于 作者: T tbell

Merge

...@@ -15,7 +15,7 @@ that expect to be able to build this workspace with GNU Make. ...@@ -15,7 +15,7 @@ that expect to be able to build this workspace with GNU Make.
System Requirements: System Requirements:
Ant: version 1.6.5 or later Ant: version 1.6.5 or later
NetBeans: version 5.0 or later (optional) NetBeans: version 6.0 or later (optional)
JDK: currently version 1.5.0, although 1.6.0 is recommended JDK: currently version 1.5.0, although 1.6.0 is recommended
OS: any system supporting the above tools OS: any system supporting the above tools
......
...@@ -66,7 +66,7 @@ javac.no.jdk.warnings = -XDignore.symbol.file=true ...@@ -66,7 +66,7 @@ javac.no.jdk.warnings = -XDignore.symbol.file=true
# set the following to -version to verify the versions of javac being used # set the following to -version to verify the versions of javac being used
javac.version.opt = javac.version.opt =
# in time, there should be no exceptions to -Xlint:all # in time, there should be no exceptions to -Xlint:all
javac.lint.opts = -Xlint:all,-deprecation,-fallthrough,-serial,-unchecked,-cast javac.lint.opts = -Xlint:all -Werror
# options for the <javadoc> task for javac # options for the <javadoc> task for javac
javadoc.jls3.url=http://java.sun.com/docs/books/jls/ javadoc.jls3.url=http://java.sun.com/docs/books/jls/
......
...@@ -392,6 +392,7 @@ ...@@ -392,6 +392,7 @@
<attribute name="lib.dir" default="${dist.lib.dir}"/> <attribute name="lib.dir" default="${dist.lib.dir}"/>
<attribute name="java" default="java"/> <attribute name="java" default="java"/>
<attribute name="javac.bootclasspath" default="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/> <attribute name="javac.bootclasspath" default="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
<attribute name="javac.java.home" default="${boot.java.home}"/>
<attribute name="javac.target" default="${javac.target}"/> <attribute name="javac.target" default="${javac.target}"/>
<attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/> <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
<attribute name="jarclasspath" default=""/> <attribute name="jarclasspath" default=""/>
...@@ -433,6 +434,7 @@ ...@@ -433,6 +434,7 @@
<attribute name="gensrc.dir" default="${build.gensrc.dir}"/> <attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
<attribute name="lib.dir" default="${dist.lib.dir}"/> <attribute name="lib.dir" default="${dist.lib.dir}"/>
<attribute name="javac.bootclasspath" default="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/> <attribute name="javac.bootclasspath" default="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
<attribute name="javac.java.home" default="${boot.java.home}"/>
<attribute name="javac.target" default="${javac.target}"/> <attribute name="javac.target" default="${javac.target}"/>
<attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/> <attribute name="jarmainclass" default="com.sun.tools.@{name}.Main"/>
<attribute name="jarclasspath" default=""/> <attribute name="jarclasspath" default=""/>
...@@ -471,6 +473,7 @@ ...@@ -471,6 +473,7 @@
<attribute name="classes.dir" default="${build.classes.dir}"/> <attribute name="classes.dir" default="${build.classes.dir}"/>
<attribute name="gensrc.dir" default="${build.gensrc.dir}"/> <attribute name="gensrc.dir" default="${build.gensrc.dir}"/>
<attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/> <attribute name="javac.bootclasspath" default="${build.bootstrap.dir}/classes"/>
<attribute name="javac.java.home" default="${boot.java.home}"/>
<attribute name="javac.target" default="${javac.target}"/> <attribute name="javac.target" default="${javac.target}"/>
<attribute name="release" default="${release}"/> <attribute name="release" default="${release}"/>
<attribute name="full.version" default="${full.version}"/> <attribute name="full.version" default="${full.version}"/>
...@@ -493,6 +496,7 @@ ...@@ -493,6 +496,7 @@
destdir="@{gensrc.dir}" destdir="@{gensrc.dir}"
includes="**/*.properties"/> includes="**/*.properties"/>
<javac fork="true" <javac fork="true"
executable="@{javac.java.home}/bin/javac"
srcdir="@{gensrc.dir}" srcdir="@{gensrc.dir}"
destdir="@{classes.dir}" destdir="@{classes.dir}"
includes="@{includes}" includes="@{includes}"
...@@ -504,6 +508,7 @@ ...@@ -504,6 +508,7 @@
<compilerarg line="-Xlint"/> <compilerarg line="-Xlint"/>
</javac> </javac>
<javac fork="true" <javac fork="true"
executable="@{javac.java.home}/bin/javac"
srcdir="${src.classes.dir}" srcdir="${src.classes.dir}"
destdir="@{classes.dir}" destdir="@{classes.dir}"
includes="@{includes}" includes="@{includes}"
...@@ -562,7 +567,9 @@ ...@@ -562,7 +567,9 @@
<target name="-def-pcompile"> <target name="-def-pcompile">
<mkdir dir="${build.toolclasses.dir}"/> <mkdir dir="${build.toolclasses.dir}"/>
<javac srcdir="${make.tools.dir}/CompileProperties" <javac fork="true"
executable="${boot.java.home}/bin/javac"
srcdir="${make.tools.dir}/CompileProperties"
destdir="${build.toolclasses.dir}/" destdir="${build.toolclasses.dir}/"
classpath="${ant.home}/lib/ant.jar"/> classpath="${ant.home}/lib/ant.jar"/>
<taskdef name="pcompile" <taskdef name="pcompile"
...@@ -653,7 +660,7 @@ ...@@ -653,7 +660,7 @@
<!-- the next two properties are for convenience, when only <!-- the next two properties are for convenience, when only
a single instance of jtreg will be invoked. --> a single instance of jtreg will be invoked. -->
<condition property="jtreg.passed"> <condition property="jtreg.passed">
<equals arg1="${jtreg.javac.result}" arg2="0"/> <equals arg1="${jtreg.@{name}.result}" arg2="0"/>
</condition> </condition>
<property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/> <property name="jtreg.report" value="${build.jtreg.dir}/@{name}/report"/>
</sequential> </sequential>
......
Working on the "langtools" workspace using NetBeans. Using NetBeans to work on the langtools repository.
This directory (make/netbeans) contains NetBeans projects that Netbeans 6.0 or later is recommended.
allow you to work on the various tools using the NetBeans IDE.
NetBeans 5.0 or later is required and sufficient to use these The "langtools" project in this directory allows you to
projects. This is different from other projects in OpenJDK, edit, run, test and debug the tools in the OpenJDK langtools
which requires version 6.0 or later. repository.
The following projects are provided: The repository contains a number of tools:
apt, javac, javadoc and its doclets, javah and javap.
compiler: for working on the compiler, javac Build Properties.
javadoc: for working on the documentation tool, javadoc
doclets: for working on the standard doclets used by the
documentation tool, javadoc
javah: for working on the C header tool, javah
javap: for working on the disassembler, javap
apt: for working on the annotation processing tool, apt.
Note that this is just provided for completeness;
the tool has been superceded by new features in javac,
and work on apt itself is discouraged.
However, any tool can be worked on from any project; the only difference To build this repository, you must set some properties for Ant.
between these projects is the behavior of the standard NetBeans actions, You can set these properties in a number of ways:
so that "Build" in the compiler project will build the compiler, etc.
- Set the properties in the Properties panel under Tool> Options> Ant.
Properties set this way will apply globally to all the langtools
repositories you may be working on.
- Create a file build.properties in the root directory of a
langtools repository, and set the properties in that file.
These properties will be specific to that repository.
To build the repository, at a minimum you must set the "boot.java.home"
property. To run the tools, you must also set "target.java.home". To
run the regression tests, you must set "jtreg.home".
By default, the build and test targets will build and test all
of these tools. The run and debug targets will prompt you for the
name of a tool to execute.
As an alternative, you can focus on a single tool. When you do
this, you will still see all the source code for all the tools,
but the various Ant targets will now be focussed on the selected tool.
To focus on a tool, bring up the context menu on the "langtools"
project (i.e. right-click on the project) and select "Select Tool".
This brings up a dialog which allows you to specify which tool you
wish to work on, and the arguments to use if and when you run it.
"apt" project README.
This project is for working on the annotation processing tool (apt)
in the OpenJDK langtools component.
The tool was provided in Java 1.5, but has been superceded by new
features in the compiler (javac) in Java 6. apt itself is now
deprecated, and any further devlopment on it is strongly discouraged.
The main class for the tool is com.sun.tools.apt.Main.
NetBeans 5.0 or later is required and sufficient to use this
project, and others in the OpenJDK langtools component.
This is different from other projects in OpenJDK, which
require version 6.0 or later.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!--
Build file for the annotation processing tool, apt.
- The basic functionality of the build is imported from make/build.xml.
- Additional support for NetBeans actions is imported from
make/netbeans/common/shared.xml.
- This file gives the final customizations.
This tool is now deprecated, and any further development is strongly
discouraged.
-->
<project name="apt" default="build" basedir="../../..">
<property name="tool.name" value="apt"/>
<import file="../common/shared.xml"/>
<!--
Alias the following imported targets, giving descriptions as appropriate.
NetBeans will emphasize targets with descriptions in the Ant Targets list,
and will display the targets in the context menu (under Run Target) for
this file in the Projects viewer.
-->
<target name="build" depends="build-apt" description="Build the annotation processing tool, apt."/>
<target name="debug" depends="-debug-nb" description="Debug the annotation processing tool, apt."/>
<target name="-jtreg" depends="jtreg-apt"/>
<target name="jtreg" depends="-jtreg-nb" description="Run the jtreg tests for the annotation processing tool, apt."/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE project [
<!ENTITY standard-ide-actions-no-javadoc SYSTEM "../../common/standard-ide-actions-no-javadoc.ent">
<!ENTITY standard-context-menu-items-no-javadoc SYSTEM "../../common/standard-context-menu-items-no-javadoc.ent">
]>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.ant.freeform</type>
<configuration>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
<!-- Do not use Project Properties customizer when editing this file manually. -->
<name>apt</name>
<properties>
<property name="root">../../..</property>
</properties>
<folders>
<source-folder>
<label>langtools</label>
<location>${root}</location>
</source-folder>
<source-folder>
<label>Source files</label>
<type>java</type>
<location>${root}/src/share/classes</location>
</source-folder>
<source-folder>
<label>Test files</label>
<type>tests</type>
<location>${root}/test</location>
</source-folder>
<source-folder>
<label>Build files</label>
<type>build</type>
<location>${root}/make</location>
</source-folder>
</folders>
<ide-actions>
&standard-ide-actions-no-javadoc;
</ide-actions>
<export>
<type>folder</type>
<location>${root}/build/classes</location>
<build-target>build</build-target>
</export>
<view>
<items>
<source-folder style="tree">
<label>Source files</label>
<location>${root}/src/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Test files</label>
<location>${root}/test</location>
</source-folder>
<source-folder style="tree">
<label>Build files</label>
<location>${root}/make</location>
</source-folder>
<source-file>
<label>README</label>
<location>README</location>
</source-file>
</items>
<context-menu>
&standard-context-menu-items-no-javadoc;
</context-menu>
</view>
<subprojects/>
</general-data>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>${root}/src/share/classes</package-root>
<built-to>${root}/build/classes</built-to>
<source-level>1.5</source-level> <!-- FIXME -->
</compilation-unit>
</java-data>
</configuration>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!--
This file defines the actions that will appear on the project's context
menu, in the Projects viewer.
It is normally included as an entity into a project's project.xml file.
For information on these actions, see
- NetBeans: Setting Up Projects
at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html
- NetBeans: Advanced Freeform Project Configuration
at http://www.netbeans.org/kb/41/freeform-config.html
-->
<ide-action name="build"/>
<ide-action name="rebuild"/>
<ide-action name="clean"/>
<separator/>
<ide-action name="run"/>
<ide-action name="debug"/>
<separator/>
<ide-action name="test"/>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!--
This file defines the standard actions accepted by langtools projects.
It is normally included as an entity into a project's project.xml file.
For information on these actions, see
- NetBeans: Setting Up Projects
at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html
- NetBeans: Advanced Freeform Project Configuration
at http://www.netbeans.org/kb/41/freeform-config.html
-->
<action name="build">
<target>build</target>
</action>
<action name="clean">
<target>clean</target>
</action>
<action name="rebuild">
<target>clean</target>
<target>build</target>
</action>
<action name="compile.single">
<target>compile-single</target>
<property name="srcdir">${root}/src/share/classes</property>
<context>
<property>includes</property>
<folder>${root}/src/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path</format>
<arity>
<separated-files>,</separated-files>
</arity>
</context>
</action>
<action name="run">
<target>run</target>
</action>
<action name="run.single">
<target>run-single</target>
<context>
<property>run.classname</property>
<folder>${root}/src/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<!--
Note: NetBeans does not appear to support context menu items
on shell scripts :-(
-->
<action name="run.single">
<target>jtreg</target>
<context>
<property>jtreg.tests</property>
<folder>${root}/test</folder>
<pattern>\.(java|sh)$</pattern>
<format>relative-path</format>
<arity>
<separated-files>,</separated-files>
</arity>
</context>
</action>
<action name="test">
<target>jtreg</target>
</action>
<action name="debug">
<target>debug-nb</target>
</action>
<action name="debug.single">
<target>debug-single-nb</target>
<context>
<property>debug.classname</property>
<folder>${root}/src/share/classes</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<!--
Note: NetBeans does not appear to support context menu items
on shell scripts :-(
-->
<action name="debug.single">
<target>debug-jtreg-nb</target>
<context>
<property>jtreg.tests</property>
<folder>${root}/test</folder>
<pattern>\.(java|sh)$</pattern>
<format>relative-path</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="debug.fix">
<target>debug-fix</target>
<property name="srcdir">${root}/src/share/classes</property>
<context>
<property>class</property>
<folder>${root}/src/share/classes</folder>
<pattern>\.java$</pattern>
<format>relative-path-noext</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
<action name="javadoc">
<target>-javadoc-nb</target>
</action>
"compiler" project README.
This project is for working on the compiler tool (javac)
in the OpenJDK langtools component.
The main class for the tool is com.sun.tools.javac.Main.
NetBeans 5.0 or later is required and sufficient to use this
project, and others in the OpenJDK langtools component.
This is different from other projects in OpenJDK, which
require version 6.0 or later.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!--
Build file for the compiler.
- The basic functionality of the build is imported from make/build.xml.
- Additional support for NetBeans actions is imported from
make/netbeans/common/shared.xml.
- This file gives the final customizations.
-->
<project name="compiler" default="build" basedir="../../..">
<property name="tool.name" value="javac"/>
<import file="../common/shared.xml"/>
<!--
Alias the following imported targets, giving descriptions as appropriate.
NetBeans will emphasize targets with descriptions in the Ant Targets list,
and will display the targets in the context menu (under Run Target) for
this file in the Projects viewer.
-->
<target name="build" depends="build-javac" description="Build the compiler."/>
<target name="debug" depends="-debug-nb" description="Debug the compiler."/>
<target name="-javadoc" depends="javadoc-javac"/>
<target name="javadoc" depends="-javadoc-nb" description="Generate javadoc documentation for the compiler."/>
<target name="-jtreg" depends="jtreg-javac"/>
<target name="jtreg" depends="-jtreg-nb" description="Run the jtreg tests for the compiler."/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE project [
<!ENTITY standard-ide-actions SYSTEM "../../common/standard-ide-actions.ent">
<!ENTITY standard-context-menu-items SYSTEM "../../common/standard-context-menu-items.ent">
]>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.ant.freeform</type>
<configuration>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
<!-- Do not use Project Properties customizer when editing this file manually. -->
<name>compiler</name>
<properties>
<property name="root">../../..</property>
</properties>
<folders>
<source-folder>
<label>langtools</label>
<location>${root}</location>
</source-folder>
<source-folder>
<label>Source files</label>
<type>java</type>
<location>${root}/src/share/classes</location>
</source-folder>
<source-folder>
<label>Test files</label>
<type>tests</type>
<location>${root}/test</location>
</source-folder>
<source-folder>
<label>Build files</label>
<type>build</type>
<location>${root}/make</location>
</source-folder>
</folders>
<ide-actions>
&standard-ide-actions;
</ide-actions>
<export>
<type>folder</type>
<location>${root}/build/classes</location>
<build-target>build</build-target>
</export>
<view>
<items>
<source-folder style="tree">
<label>Source files</label>
<location>${root}/src/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Test files</label>
<location>${root}/test</location>
</source-folder>
<source-folder style="tree">
<label>Build files</label>
<location>${root}/make</location>
</source-folder>
<source-file>
<label>README</label>
<location>README</location>
</source-file>
</items>
<context-menu>
&standard-context-menu-items;
</context-menu>
</view>
<subprojects/>
</general-data>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>${root}/src/share/classes</package-root>
<built-to>${root}/build/classes</built-to>
<source-level>1.5</source-level> <!-- FIXME -->
</compilation-unit>
</java-data>
</configuration>
</project>
"doclets" project README.
This project is for working on the standard doclets used by
the documentation tool (javadoc) in the OpenJDK langtools component.
The doclets are invoked as part of the documentation tool (javadoc).
Using this project, you can also browse javadoc and any tools in langtools.
If you build the doclets, javadoc will be built automatically as well,
if necessary.
The doclets are found in com.sun.tools.doclets.
NetBeans 5.0 or later is required and sufficient to use this
project, and others in the OpenJDK langtools component.
This is different from other projects in OpenJDK, which
require version 6.0 or later.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!--
Build file for the standard doclets used by documentation tool, javadoc.
- The basic functionality of the build is imported from make/build.xml.
- Additional support for NetBeans actions is imported from
make/netbeans/common/shared.xml.
- This file gives the final customizations.
-->
<project name="doclets" default="build" basedir="../../..">
<property name="tool.name" value="doclets"/>
<import file="../common/shared.xml"/>
<!--
Alias the following imported targets, giving descriptions as appropriate.
NetBeans will emphasize targets with descriptions in the Ant Targets list,
and will display the targets in the context menu (under Run Target) for
this file in the Projects viewer.
-->
<target name="build" depends="build-doclets" description="Build the standard doclets for the documentation tool, javadoc."/>
<target name="debug" depends="-debug-nb" description="Debug the standard doclets for the documentation tool, javadoc."/>
<target name="-jtreg" depends="jtreg-doclets"/>
<target name="jtreg" depends="-jtreg-nb" description="Run the jtreg tests for the standard doclets used by the documentation tool, javadoc."/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE project [
<!ENTITY standard-ide-actions-no-javadoc SYSTEM "../../common/standard-ide-actions-no-javadoc.ent">
<!ENTITY standard-context-menu-items-no-javadoc SYSTEM "../../common/standard-context-menu-items-no-javadoc.ent">
]>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.ant.freeform</type>
<configuration>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
<!-- Do not use Project Properties customizer when editing this file manually. -->
<name>doclets</name>
<properties>
<property name="root">../../..</property>
</properties>
<folders>
<source-folder>
<label>langtools</label>
<location>${root}</location>
</source-folder>
<source-folder>
<label>Source files</label>
<type>java</type>
<location>${root}/src/share/classes</location>
</source-folder>
<source-folder>
<label>Test files</label>
<type>tests</type>
<location>${root}/test</location>
</source-folder>
<source-folder>
<label>Build files</label>
<type>build</type>
<location>${root}/make</location>
</source-folder>
</folders>
<ide-actions>
&standard-ide-actions-no-javadoc;
</ide-actions>
<export>
<type>folder</type>
<location>${root}/build/classes</location>
<build-target>build</build-target>
</export>
<view>
<items>
<source-folder style="tree">
<label>Source files</label>
<location>${root}/src/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Test files</label>
<location>${root}/test</location>
</source-folder>
<source-folder style="tree">
<label>Build files</label>
<location>${root}/make</location>
</source-folder>
<source-file>
<label>README</label>
<location>README</location>
</source-file>
</items>
<context-menu>
&standard-context-menu-items-no-javadoc;
</context-menu>
</view>
<subprojects/>
</general-data>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>${root}/src/share/classes</package-root>
<built-to>${root}/build/classes</built-to>
<source-level>1.5</source-level> <!-- FIXME -->
</compilation-unit>
</java-data>
</configuration>
</project>
"javadoc" project README.
This project is for working on the documentation tool (javadoc)
in the OpenJDK langtools component.
javadoc is built on top of the compiler (javac). Using this
project, you can also browse javac and any tools in langtools.
If you build javadoc, javac will be built automatically as well,
if necessary.
The main class for the tool is com.sun.tools.javadoc.Main.
NetBeans 5.0 or later is required and sufficient to use this
project, and others in the OpenJDK langtools component.
This is different from other projects in OpenJDK, which
require version 6.0 or later.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!--
Build file for the documentation tool, javadoc.
- The basic functionality of the build is imported from make/build.xml.
- Additional support for NetBeans actions is imported from
make/netbeans/common/shared.xml.
- This file gives the final customizations.
-->
<project name="javadoc" default="build" basedir="../../..">
<property name="tool.name" value="javadoc"/>
<import file="../common/shared.xml"/>
<!--
Alias the following imported targets, giving descriptions as appropriate.
NetBeans will emphasize targets with descriptions in the Ant Targets list,
and will display the targets in the context menu (under Run Target) for
this file in the Projects viewer.
-->
<target name="build" depends="build-javadoc" description="Build the documentation tool, javadoc."/>
<target name="debug" depends="-debug-nb" description="Debug the documentation tool, javadoc."/>
<target name="-javadoc" depends="javadoc-javadoc"/>
<target name="javadoc" depends="-javadoc-nb" description="Generate javadoc documentation for the Doclet API."/>
<target name="-jtreg" depends="jtreg-javadoc"/>
<target name="jtreg" depends="-jtreg-nb" description="Run the jtreg tests for the documentation tool, javadoc."/>
</project>
"javah" project README.
This project is for working on the native header tool (javah)
in the OpenJDK langtools component.
javah is built on top of the documentation tool (javadoc). Using this
project, you can also browse javadoc and any other tools in langtools.
If you build javah, javadoc will be built automatically as well,
if necessary.
javah is in the process of being converted so that it runs directly on
top of the compiler, javac, using the annotation processing API,
instead of on top of the documentation tool, javadoc, using the
Doclet API.
The main class for the tool is com.sun.tools.javah.Main.
NetBeans 5.0 or later is required and sufficient to use this
project, and others in the OpenJDK langtools component.
This is different from other projects in OpenJDK, which
require version 6.0 or later.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!--
Build file for the native header tool, javah.
- The basic functionality of the build is imported from make/build.xml.
- Additional support for NetBeans actions is imported from
make/netbeans/common/shared.xml.
- This file gives the final customizations.
-->
<project name="javah" default="build" basedir="../../..">
<property name="tool.name" value="javah"/>
<import file="../common/shared.xml"/>
<!--
Alias the following imported targets, giving descriptions as appropriate.
NetBeans will emphasize targets with descriptions in the Ant Targets list,
and will display the targets in the context menu (under Run Target) for
this file in the Projects viewer.
-->
<target name="build" depends="build-javah" description="Build the native header tool, javah."/>
<target name="debug" depends="-debug-nb" description="Debug the native header tool, javah."/>
<target name="-jtreg" depends="jtreg-javah"/>
<target name="jtreg" depends="-jtreg-nb" description="Run the jtreg tests for the native header tool, javah."/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE project [
<!ENTITY standard-ide-actions-no-javadoc SYSTEM "../../common/standard-ide-actions-no-javadoc.ent">
<!ENTITY standard-context-menu-items-no-javadoc SYSTEM "../../common/standard-context-menu-items-no-javadoc.ent">
]>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.ant.freeform</type>
<configuration>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
<!-- Do not use Project Properties customizer when editing this file manually. -->
<name>javah</name>
<properties>
<property name="root">../../..</property>
</properties>
<folders>
<source-folder>
<label>langtools</label>
<location>${root}</location>
</source-folder>
<source-folder>
<label>Source files</label>
<type>java</type>
<location>${root}/src/share/classes</location>
</source-folder>
<source-folder>
<label>Test files</label>
<type>tests</type>
<location>${root}/test</location>
</source-folder>
<source-folder>
<label>Build files</label>
<type>build</type>
<location>${root}/make</location>
</source-folder>
</folders>
<ide-actions>
&standard-ide-actions-no-javadoc;
</ide-actions>
<export>
<type>folder</type>
<location>${root}/build/classes</location>
<build-target>build</build-target>
</export>
<view>
<items>
<source-folder style="tree">
<label>Source files</label>
<location>${root}/src/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Test files</label>
<location>${root}/test</location>
</source-folder>
<source-folder style="tree">
<label>Build files</label>
<location>${root}/make</location>
</source-folder>
<source-file>
<label>README</label>
<location>README</location>
</source-file>
</items>
<context-menu>
&standard-context-menu-items-no-javadoc;
</context-menu>
</view>
<subprojects/>
</general-data>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>${root}/src/share/classes</package-root>
<built-to>${root}/build/classes</built-to>
<source-level>1.5</source-level> <!-- FIXME -->
</compilation-unit>
</java-data>
</configuration>
</project>
"javap" project README.
This project is for working on the disassembler tool (javap)
in the OpenJDK langtools component.
The main class for the tool is sun.tools.javap.Main.
NetBeans 5.0 or later is required and sufficient to use this
project, and others in the OpenJDK langtools component.
This is different from other projects in OpenJDK, which
require version 6.0 or later.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!--
Build file for the disassembler tool, javap.
- The basic functionality of the build is imported from make/build.xml.
- Additional support for NetBeans actions is imported from
make/netbeans/common/shared.xml.
- This file gives the final customizations.
-->
<project name="javap" default="build" basedir="../../..">
<property name="tool.name" value="javap"/>
<import file="../common/shared.xml"/>
<!--
Alias the following imported targets, giving descriptions as appropriate.
NetBeans will emphasize targets with descriptions in the Ant Targets list,
and will display the targets in the context menu (under Run Target) for
this file in the Projects viewer.
-->
<target name="build" depends="build-javap" description="Build the disassembler tool, javap."/>
<target name="debug" depends="-debug-nb" description="Debug the disassembler tool, javap."/>
<target name="-jtreg" depends="jtreg-javap"/>
<target name="jtreg" depends="-jtreg-nb" description="Run the jtreg tests for the disassembler tool, javap."/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Sun Microsystems nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE project [
<!ENTITY standard-ide-actions-no-javadoc SYSTEM "../../common/standard-ide-actions-no-javadoc.ent">
<!ENTITY standard-context-menu-items-no-javadoc SYSTEM "../../common/standard-context-menu-items-no-javadoc.ent">
]>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.ant.freeform</type>
<configuration>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
<!-- Do not use Project Properties customizer when editing this file manually. -->
<name>javap</name>
<properties>
<property name="root">../../..</property>
</properties>
<folders>
<source-folder>
<label>langtools</label>
<location>${root}</location>
</source-folder>
<source-folder>
<label>Source files</label>
<type>java</type>
<location>${root}/src/share/classes</location>
</source-folder>
<source-folder>
<label>Test files</label>
<type>tests</type>
<location>${root}/test</location>
</source-folder>
<source-folder>
<label>Build files</label>
<type>build</type>
<location>${root}/make</location>
</source-folder>
</folders>
<ide-actions>
&standard-ide-actions-no-javadoc;
</ide-actions>
<export>
<type>folder</type>
<location>${root}/build/classes</location>
<build-target>build</build-target>
</export>
<view>
<items>
<source-folder style="tree">
<label>Source files</label>
<location>${root}/src/share/classes</location>
</source-folder>
<source-folder style="tree">
<label>Test files</label>
<location>${root}/test</location>
</source-folder>
<source-folder style="tree">
<label>Build files</label>
<location>${root}/make</location>
</source-folder>
<source-file>
<label>README</label>
<location>README</location>
</source-file>
</items>
<context-menu>
&standard-context-menu-items-no-javadoc;
</context-menu>
</view>
<subprojects/>
</general-data>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>${root}/src/share/classes</package-root>
<built-to>${root}/build/classes</built-to>
<source-level>1.5</source-level> <!-- FIXME -->
</compilation-unit>
</java-data>
</configuration>
</project>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
...@@ -30,30 +30,45 @@ ...@@ -30,30 +30,45 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--> -->
<!-- <project name="langtools-netbeans" default="build" basedir="../../..">
The file contains targets for NetBeans action that are shared across
all langtools projects. <property name="langtools.properties"
--> location="make/netbeans/langtools/nbproject/private/langtools.properties"/>
<project name="shared" default="build" basedir="../../..">
<!-- <!--
Instead of importing the main build file, we could call it when needed. Instead of importing the main build file, we could call it when needed.
That would reduce the list of Ant targets that get displayed for this That would reduce the list of Ant targets that get displayed for this
file, but it also complicates the interface between the project build file, but it also complicates the interface between the project build
file and the main build file. For example, some imported targets file and the main build file. For example, some imported targets
would have to be reclared, properties would have to be restructured, would have to be reclared, properties would have to be restructured,
and it would be harder to run results (e.g. in properties) from nested and it would be harder to run results (e.g. in properties) from nested
targets. targets.
--> -->
<import file="../../build.xml"/> <import file="../../build.xml"/>
<property name="tool.mainclass" value="com.sun.tools.${tool.name}.Main"/> <!-- Build project. (action: build; F11)
<property name="tool.default.args" value="-version"/> If langtools.tool.name is set, then just build that tool; otherwise
build all tools.
-->
<target name="build" depends="-get-tool-if-set,-build-tool,-build-all"
description="Build one or all langtools tools"
/>
<target name="-build-tool" if="langtools.tool.name">
<echo level="info" message="Building ${langtools.tool.name}"/>
<echo level="verbose" message="(Unset langtools.tool.name to build all tools)"/>
<antcall target="build-${langtools.tool.name}"/>
</target>
<target name="-build-all" unless="langtools.tool.name">
<echo level="info" message="Building all tools"/>
<echo level="verbose" message="(Set langtools.tool.name to build a single tool)"/>
<antcall target="build-all-tools"/>
</target>
<!-- Compile a single file. (action: compile.single; F9) -->
<!-- compile a single file -->
<!-- for compile-single, etc, we might want different targets for
javac and not javac, because of bootstrap issues -->
<target name="compile-single" depends="build-bootstrap-javac"> <target name="compile-single" depends="build-bootstrap-javac">
<fail unless="includes">Must set property 'includes'</fail> <fail unless="includes">Must set property 'includes'</fail>
<javac fork="true" executable="${build.bootstrap.dir}/bin/javac" <javac fork="true" executable="${build.bootstrap.dir}/bin/javac"
...@@ -62,60 +77,89 @@ ...@@ -62,60 +77,89 @@
includes="${includes}" includes="${includes}"
sourcepath="" sourcepath=""
includeAntRuntime="no" includeAntRuntime="no"
target="${target}" target="${javac.target}"
debug="${javac.debug}" debug="${javac.debug}"
debuglevel="${javac.debuglevel}"/> debuglevel="${javac.debuglevel}"/>
</target> </target>
<!-- run tool --> <!-- Run tool. (action: run; F6)
Use langtools.tool.name and langtools.tool.args properties if set; otherwise prompt
the user.
-->
<target name="run" depends="build,-def-run" description="run ${tool.description}"> <target name="run" depends="-check-target.java.home,build,-def-run,-get-tool-and-args"
<run/> description="run tool">
<echo level="info" message="Run ${langtools.tool.name} with args ${langtools.tool.args}"/>
<run mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}"/>
</target> </target>
<!-- run a selected class --> <!-- Run a selected class. (action: run.single; shift-F6) -->
<target name="run-single" depends="-def-run"> <target name="run-single" depends="-check-target.java.home,-def-run">
<fail unless="run.classname">Must set property 'run.classname'</fail> <fail unless="run.classname">Must set property 'run.classname' </fail>
<run name="${run.classname}" mainclass="${run.classname}" default.args=""/> <echo level="info" message="run ${run.classname}"/>
<run mainclass="${run.classname}" args=""/>
</target> </target>
<!-- run jtreg tests, and display results in NetBeans --> <!-- Test project, and display results if tests failed. (action: test; Alt-F6)
If langtools.tool.name is set, then just test that tool; otherwise
test all tools.
-->
<target name="jtreg" depends="-get-tool-if-set,-jtreg-tool,-jtreg-all"
description="Test one or all langtools tools"
/>
<target name="-jtreg-tool" if="langtools.tool.name">
<echo level="info" message="Testing ${langtools.tool.name}"/>
<echo level="verbose" message="(Unset langtools.tool.name to test all tools)"/>
<antcall>
<target name="jtreg-${langtools.tool.name}"/>
<target name="-show-jtreg"/>
</antcall>
</target>
<target name="-jtreg-nb" depends="-jtreg" if="netbeans.home" unless="jtreg.passed"> <target name="-jtreg-all" unless="langtools.tool.name">
<echo level="info" message="Testing all tools"/>
<echo level="verbose" message="(Set langtools.tool.name to test a single tool)"/>
<antcall>
<target name="langtools.jtreg"/>
<target name="-show-jtreg"/>
</antcall>
</target>
<target name="-show-jtreg" if="netbeans.home" unless="jtreg.passed">
<nbbrowse file="${jtreg.report}/report.html"/> <nbbrowse file="${jtreg.report}/report.html"/>
<fail>Some tests failed; see report for details.</fail> <fail>Some tests failed; see report for details.</fail>
</target> </target>
<!-- debug tool in NetBeans --> <!-- Debug tool in NetBeans. -->
<target name="-debug-nb" depends="build,-def-run,-def-start-debugger" if="netbeans.home"> <target name="debug" depends="-check-target.java.home,-def-run,-def-start-debugger,-get-tool-and-args,build" if="netbeans.home">
<echo level="info" message="Debug ${langtools.tool.name} with args ${langtools.tool.args}"/>
<start-debugger/> <start-debugger/>
<run jpda.jvmargs="${jpda.jvmargs}"/> <run mainclass="com.sun.tools.${langtools.tool.name}.Main" args="${langtools.tool.args}" jpda.jvmargs="${jpda.jvmargs}"/>
</target> </target>
<!-- debug a selected class --> <!-- Debug a selected class . -->
<target name="debug-single" depends="-check-target.java.home,-def-start-debugger,-def-run">
<target name="debug-single-nb" depends="-def-start-debugger,-def-run">
<fail unless="debug.classname">Must set property 'debug.classname'</fail> <fail unless="debug.classname">Must set property 'debug.classname'</fail>
<start-debugger/> <start-debugger/>
<run name="${debug.classname}" mainclass="${debug.classname}" default.args="" <run mainclass="${debug.classname}" default.args="" jpda.jvmargs="${jpda.jvmargs}"/>
jpda.jvmargs="${jpda.jvmargs}"/>
</target> </target>
<!-- debug a jtreg test --> <!-- Debug a jtreg test. -->
<target name="debug-jtreg" depends="-check-target.java.home,-def-start-debugger,-def-jtreg">
<target name="debug-jtreg-nb" depends="-def-start-debugger,-def-jtreg">
<fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail> <fail unless="jtreg.tests">Must set property 'jtreg.tests'</fail>
<start-debugger/> <start-debugger/>
<jtreg-tool name="${tool.name}" samevm="false" tests="${jtreg.tests}" <jtreg-tool name="debug" samevm="false" tests="${jtreg.tests}" jpda.jvmargs="${jpda.jvmargs}"/>
jpda.jvmargs="${jpda.jvmargs}"/>
</target> </target>
<!-- update a class being debugged --> <!-- Update a class being debugged. -->
<target name="debug-fix"> <target name="debug-fix" if="langtools.tool.name">
<fail unless="class">Must set property 'class'</fail> <fail unless="class">Must set property 'class'
</fail>
<antcall target="compile-single"> <antcall target="compile-single">
<param name="includes" value="${class}.java"/> <param name="includes" value="${class}.java"/>
</antcall> </antcall>
...@@ -126,41 +170,74 @@ ...@@ -126,41 +170,74 @@
</nbjpdareload> </nbjpdareload>
</target> </target>
<!-- Generate javadoc for one or all tools. (action: javadoc; Alt-F6)
If langtools.tool.name is set, then just test that tool; otherwise
test all tools.
-->
<!-- create javadoc documentation --> <target name="javadoc" depends="-javadoc-tool,-javadoc-all"
description="Generate javadoc for one or all langtools tools"
/>
<target name="-javadoc-tool" if="langtools.tool.name">
<echo level="info" message="Generate javadoc for ${langtools.tool.name}"/>
<echo level="verbose" message="(Unset langtools.tool.name to generate javadoc for all tools)"/>
<antcall>
<target name="javadoc-${langtools.tool.name}"/>
<target name="-show-javadoc"/>
</antcall>
</target>
<target name="-javadoc-nb" depends="-javadoc" if="netbeans.home"> <target name="-javadoc-all" unless="langtools.tool.name">
<nbbrowse file="${build.javadoc.dir}/${tool.name}/index.html"/> <echo level="info" message="Generate javadoc for all tools"/>
<echo level="verbose" message="(Set langtools.tool.name to generate javadoc for a single tool)"/>
<antcall>
<target name="langtools.javadoc"/>
<target name="-show-javadoc"/>
</antcall>
</target> </target>
<!-- default target for those projects that don't have public API docs; <target name="-show-javadoc" if="netbeans.home">
override as needed for projects with public API docs.--> <!-- what if doing javadoc for all? -->
<target name="-javadoc"/> <nbbrowse file="${build.javadoc.dir}/${langtools.tool.name}/index.html"/>
</target>
<!-- macro to run a tool or selected class - used by run* and debug* tasks --> <!-- Prompt for values. -->
<target name="-get-tool-if-set" depends="-def-select-tool">
<select-tool
toolproperty="langtools.tool.name"
propertyfile="${langtools.properties}"
askIfUnset="false"
/>
</target>
<target name="-get-tool-and-args" depends="-def-select-tool">
<select-tool
toolproperty="langtools.tool.name"
argsproperty="langtools.tool.args"
propertyfile="${langtools.properties}"
askIfUnset="true"
/>
</target>
<!-- Macro to run a tool or selected class - used by run* and debug* tasks -->
<target name="-def-run"> <target name="-def-run">
<macrodef name="run"> <macrodef name="run">
<attribute name="name" default="${tool.name}"/> <attribute name="mainclass"/>
<attribute name="mainclass" default="${tool.mainclass}"/> <attribute name="args" default=""/>
<attribute name="default.args" default="${tool.default.args}"/>
<attribute name="jpda.jvmargs" default=""/> <attribute name="jpda.jvmargs" default=""/>
<sequential> <sequential>
<input addproperty="run.args" message="Run @{name} with options" defaultvalue="@{default.args}"/>
<java fork="true" jvm="${target.java}" classname="@{mainclass}"> <java fork="true" jvm="${target.java}" classname="@{mainclass}">
<bootclasspath> <jvmarg line="-Xbootclasspath/p:${build.classes.dir}"/>
<pathelement location="${build.classes.dir}"/> <jvmarg line="@{jpda.jvmargs}"/>
<pathelement location="${target.java.home}/jre/lib/rt.jar"/> <arg line="@{args}"/>
</bootclasspath>
<jvmarg line="@{jpda.jvmargs}"/>
<arg line="${run.args}"/>
</java> </java>
</sequential> </sequential>
</macrodef> </macrodef>
</target> </target>
<!-- macro to start the debugger and set a property containg the args needed by the run task --> <!-- Macro to start the debugger and set a property containg the args needed by the run task -->
<target name="-def-start-debugger" if="netbeans.home"> <target name="-def-start-debugger" if="netbeans.home">
<macrodef name="start-debugger"> <macrodef name="start-debugger">
<attribute name="jpda.jvmargs.property" default="jpda.jvmargs"/> <attribute name="jpda.jvmargs.property" default="jpda.jvmargs"/>
...@@ -182,5 +259,21 @@ ...@@ -182,5 +259,21 @@
</macrodef> </macrodef>
</target> </target>
<target name="-def-select-tool">
<mkdir dir="${build.toolclasses.dir}"/>
<javac srcdir="${make.tools.dir}/SelectTool"
destdir="${build.toolclasses.dir}/"
classpath="${ant.home}/lib/ant.jar"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}">
<compilerarg line="-Xlint"/>
</javac>
<taskdef name="select-tool"
classname="SelectToolTask"
classpath="${build.toolclasses.dir}/"/>
</target>
<target name="select-tool" depends="-def-select-tool">
<select-tool propertyfile="${langtools.properties}"/>
</target>
</project> </project>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
...@@ -31,15 +31,15 @@ ...@@ -31,15 +31,15 @@
--> -->
<!DOCTYPE project [ <!DOCTYPE project [
<!ENTITY standard-ide-actions SYSTEM "../../common/standard-ide-actions.ent"> <!ENTITY standard-ide-actions SYSTEM "standard-ide-actions.ent">
<!ENTITY standard-context-menu-items SYSTEM "../../common/standard-context-menu-items.ent"> <!ENTITY standard-context-menu-items SYSTEM "standard-context-menu-items.ent">
]> ]>
<project xmlns="http://www.netbeans.org/ns/project/1"> <project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.ant.freeform</type> <type>org.netbeans.modules.ant.freeform</type>
<configuration> <configuration>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1"> <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
<!-- Do not use Project Properties customizer when editing this file manually. --> <!-- Do not use Project Properties customizer when editing this file manually. -->
<name>javadoc</name> <name>langtools</name>
<properties> <properties>
<property name="root">../../..</property> <property name="root">../../..</property>
</properties> </properties>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
- NetBeans: Advanced Freeform Project Configuration - NetBeans: Advanced Freeform Project Configuration
at http://www.netbeans.org/kb/41/freeform-config.html at http://www.netbeans.org/kb/41/freeform-config.html
--> -->
<ide-action name="select-tool"/>
<separator/>
<ide-action name="build"/> <ide-action name="build"/>
<ide-action name="rebuild"/> <ide-action name="rebuild"/>
......
...@@ -108,11 +108,11 @@ ...@@ -108,11 +108,11 @@
</action> </action>
<action name="debug"> <action name="debug">
<target>debug-nb</target> <target>debug</target>
</action> </action>
<action name="debug.single"> <action name="debug.single">
<target>debug-single-nb</target> <target>debug-single</target>
<context> <context>
<property>debug.classname</property> <property>debug.classname</property>
<folder>${root}/src/share/classes</folder> <folder>${root}/src/share/classes</folder>
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
--> -->
<action name="debug.single"> <action name="debug.single">
<target>debug-jtreg-nb</target> <target>debug-jtreg</target>
<context> <context>
<property>jtreg.tests</property> <property>jtreg.tests</property>
<folder>${root}/test</folder> <folder>${root}/test</folder>
...@@ -157,5 +157,17 @@ ...@@ -157,5 +157,17 @@
</action> </action>
<action name="javadoc"> <action name="javadoc">
<target>-javadoc-nb</target> <target>javadoc</target>
</action>
<action name="select-tool">
<target>select-tool</target>
</action>
<action name="test-select-tool-1">
<target>test-select-tool-1</target>
</action>
<action name="test-select-tool-2">
<target>test-select-tool-2</target>
</action> </action>
/*
* Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
/**
* Task to allow the user to control langtools tools built when using NetBeans.
*
* There are two primary modes.
* 1) Property mode. In this mode, property names are provided to get values
* that may be specified by the user, either directly in a GUI dialog, or
* read from a properties file. If the GUI dialog is invoked, values may
* optionally be set for future use.
* 2) Setup mode. In this mode, no property names are provided, and the GUI
* is invoked to allow the user to set or reset values for use in property mode.
*/
public class SelectToolTask extends Task {
/**
* Set the location of the private properties file used to keep the retain
* user preferences for this repository.
*/
public void setPropertyFile(File propertyFile) {
this.propertyFile = propertyFile;
}
/**
* Set the name of the property which will be set to the name of the
* selected tool, if any. If no tool is selected, the property will
* remain unset.
*/
public void setToolProperty(String toolProperty) {
this.toolProperty = toolProperty;
}
/**
* Set the name of the property which will be set to the execution args of the
* selected tool, if any. The args default to an empty string.
*/
public void setArgsProperty(String argsProperty) {
this.argsProperty = argsProperty;
}
/**
* Specify whether or not to pop up a dialog if the user has not specified
* a default value for a property.
*/
public void setAskIfUnset(boolean askIfUnset) {
this.askIfUnset = askIfUnset;
}
@Override
public void execute() {
Project p = getProject();
Properties props = readProperties(propertyFile);
toolName = props.getProperty("tool.name");
if (toolName != null) {
toolArgs = props.getProperty(toolName + ".args", "");
}
if (toolProperty == null ||
askIfUnset && (toolName == null
|| (argsProperty != null && toolArgs == null))) {
showGUI(props);
}
// finally, return required values, if any
if (toolProperty != null && !(toolName == null || toolName.equals(""))) {
p.setProperty(toolProperty, toolName);
if (argsProperty != null && toolArgs != null)
p.setProperty(argsProperty, toolArgs);
}
}
void showGUI(Properties fileProps) {
Properties guiProps = new Properties(fileProps);
JOptionPane p = createPane(guiProps);
p.createDialog("Select Tool").setVisible(true);
toolName = (String) toolChoice.getSelectedItem();
toolArgs = argsField.getText();
if (defaultCheck.isSelected()) {
if (toolName.equals("")) {
fileProps.remove("tool.name");
} else {
fileProps.put("tool.name", toolName);
fileProps.put(toolName + ".args", toolArgs);
}
writeProperties(propertyFile, fileProps);
}
}
JOptionPane createPane(final Properties props) {
JPanel body = new JPanel(new GridBagLayout());
GridBagConstraints lc = new GridBagConstraints();
lc.insets.right = 10;
lc.insets.bottom = 3;
GridBagConstraints fc = new GridBagConstraints();
fc.anchor = GridBagConstraints.WEST;
fc.gridx = 1;
fc.gridwidth = GridBagConstraints.REMAINDER;
fc.insets.bottom = 3;
JLabel toolLabel = new JLabel("Tool:");
body.add(toolLabel, lc);
String[] toolChoices = { "apt", "javac", "javadoc", "javah", "javap" };
if (true || toolProperty == null) {
// include empty value in setup mode
List<String> l = new ArrayList<String>(Arrays.asList(toolChoices));
l.add(0, "");
toolChoices = l.toArray(new String[l.size()]);
}
toolChoice = new JComboBox(toolChoices);
if (toolName != null)
toolChoice.setSelectedItem(toolName);
toolChoice.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
String tn = (String) e.getItem();
argsField.setText(getDefaultArgsForTool(props, tn));
if (toolProperty != null)
okButton.setEnabled(!tn.equals(""));
}
});
body.add(toolChoice, fc);
argsField = new JTextField(getDefaultArgsForTool(props, toolName), 40);
if (toolProperty == null || argsProperty != null) {
JLabel argsLabel = new JLabel("Args:");
body.add(argsLabel, lc);
body.add(argsField, fc);
argsField.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
}
public void focusLost(FocusEvent e) {
String toolName = (String) toolChoice.getSelectedItem();
if (toolName.length() > 0)
props.put(toolName + ".args", argsField.getText());
}
});
}
defaultCheck = new JCheckBox("Set as default");
if (toolProperty == null)
defaultCheck.setSelected(true);
else
body.add(defaultCheck, fc);
final JOptionPane p = new JOptionPane(body);
okButton = new JButton("OK");
okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.equals("")));
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
d.setVisible(false);
}
});
p.setOptions(new Object[] { okButton });
return p;
}
Properties readProperties(File file) {
Properties p = new Properties();
if (file != null && file.exists()) {
Reader in = null;
try {
in = new BufferedReader(new FileReader(file));
p.load(in);
in.close();
} catch (IOException e) {
throw new BuildException("error reading property file", e);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
throw new BuildException("cannot close property file", e);
}
}
}
}
return p;
}
void writeProperties(File file, Properties p) {
if (file != null) {
Writer out = null;
try {
File dir = file.getParentFile();
if (dir != null && !dir.exists())
dir.mkdirs();
out = new BufferedWriter(new FileWriter(file));
p.store(out, "langtools properties");
out.close();
} catch (IOException e) {
throw new BuildException("error writing property file", e);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
throw new BuildException("cannot close property file", e);
}
}
}
}
}
String getDefaultArgsForTool(Properties props, String tn) {
return (tn == null || tn.equals("")) ? "" : props.getProperty(tn + ".args", "");
}
// Ant task parameters
private boolean askIfUnset;
private String toolProperty;
private String argsProperty;
private File propertyFile;
// GUI components
private JComboBox toolChoice;
private JTextField argsField;
private JCheckBox defaultCheck;
private JButton okButton;
// Result values for the client
private String toolName;
private String toolArgs;
}
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
package com.sun.tools.apt.comp; package com.sun.tools.apt.comp;
public class AnnotationProcessingError extends Error { public class AnnotationProcessingError extends Error {
private static final long serialVersionUID = 3279196183341719287L;
AnnotationProcessingError(Throwable cause) { AnnotationProcessingError(Throwable cause) {
super(cause); super(cause);
} }
......
...@@ -316,8 +316,13 @@ public class Apt extends ListBuffer<Env<AttrContext>> { ...@@ -316,8 +316,13 @@ public class Apt extends ListBuffer<Env<AttrContext>> {
} }
providers = list.iterator(); providers = list.iterator();
} else } else {
providers = sun.misc.Service.providers(AnnotationProcessorFactory.class, aptCL); @SuppressWarnings("unchecked")
Iterator<AnnotationProcessorFactory> iter =
sun.misc.Service.providers(AnnotationProcessorFactory.class, aptCL);
providers = iter;
}
} }
java.util.Map<AnnotationProcessorFactory, Set<AnnotationTypeDeclaration>> factoryToAnnotation = java.util.Map<AnnotationProcessorFactory, Set<AnnotationTypeDeclaration>> factoryToAnnotation =
......
...@@ -26,4 +26,6 @@ ...@@ -26,4 +26,6 @@
package com.sun.tools.apt.comp; package com.sun.tools.apt.comp;
public class UsageMessageNeededException extends RuntimeException {} public class UsageMessageNeededException extends RuntimeException {
private static final long serialVersionUID = -3265159608992825840L;
}
...@@ -233,6 +233,7 @@ public class JavaCompiler extends com.sun.tools.javac.main.JavaCompiler { ...@@ -233,6 +233,7 @@ public class JavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
ListBuffer<ClassSymbol> classes = new ListBuffer<ClassSymbol>(); ListBuffer<ClassSymbol> classes = new ListBuffer<ClassSymbol>();
try { try {
JavacFileManager fm = (JavacFileManager)fileManager;
//parse all files //parse all files
ListBuffer<JCCompilationUnit> trees = new ListBuffer<JCCompilationUnit>(); ListBuffer<JCCompilationUnit> trees = new ListBuffer<JCCompilationUnit>();
for (List<String> l = filenames; l.nonEmpty(); l = l.tail) { for (List<String> l = filenames; l.nonEmpty(); l = l.tail) {
...@@ -250,7 +251,8 @@ public class JavaCompiler extends com.sun.tools.javac.main.JavaCompiler { ...@@ -250,7 +251,8 @@ public class JavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
continue; continue;
} }
} }
trees.append(parse(l.head)); JavaFileObject fo = fm.getJavaFileObjectsFromStrings(List.of(l.head)).iterator().next();
trees.append(parse(fo));
} }
//enter symbols for all files //enter symbols for all files
......
...@@ -30,6 +30,8 @@ import com.sun.mirror.apt.RoundCompleteEvent; ...@@ -30,6 +30,8 @@ import com.sun.mirror.apt.RoundCompleteEvent;
import com.sun.mirror.apt.RoundState; import com.sun.mirror.apt.RoundState;
public class RoundCompleteEventImpl extends RoundCompleteEvent { public class RoundCompleteEventImpl extends RoundCompleteEvent {
private static final long serialVersionUID = 7067621446720784300L;
public RoundCompleteEventImpl(AnnotationProcessorEnvironment source, public RoundCompleteEventImpl(AnnotationProcessorEnvironment source,
RoundState rs) { RoundState rs) {
super(source, rs); super(source, rs);
......
...@@ -252,6 +252,7 @@ class AnnotationProxyMaker { ...@@ -252,6 +252,7 @@ class AnnotationProxyMaker {
*/ */
private void typeMismatch(final Method method, final Attribute attr) { private void typeMismatch(final Method method, final Attribute attr) {
value = new ExceptionProxy() { value = new ExceptionProxy() {
private static final long serialVersionUID = 8473323277815075163L;
public String toString() { public String toString() {
return "<error>"; // eg: @Anno(value=<error>) return "<error>"; // eg: @Anno(value=<error>)
} }
...@@ -270,6 +271,7 @@ class AnnotationProxyMaker { ...@@ -270,6 +271,7 @@ class AnnotationProxyMaker {
* type. * type.
*/ */
private static class MirroredTypeExceptionProxy extends ExceptionProxy { private static class MirroredTypeExceptionProxy extends ExceptionProxy {
private static final long serialVersionUID = 6662035281599933545L;
private MirroredTypeException ex; private MirroredTypeException ex;
...@@ -311,6 +313,7 @@ class AnnotationProxyMaker { ...@@ -311,6 +313,7 @@ class AnnotationProxyMaker {
* types. * types.
*/ */
private static class MirroredTypesExceptionProxy extends ExceptionProxy { private static class MirroredTypesExceptionProxy extends ExceptionProxy {
private static final long serialVersionUID = -6670822532616693951L;
private MirroredTypesException ex; private MirroredTypesException ex;
......
...@@ -64,7 +64,7 @@ public class TypeVariableImpl extends TypeMirrorImpl implements TypeVariable { ...@@ -64,7 +64,7 @@ public class TypeVariableImpl extends TypeMirrorImpl implements TypeVariable {
* {@inheritDoc} * {@inheritDoc}
*/ */
public TypeParameterDeclaration getDeclaration() { public TypeParameterDeclaration getDeclaration() {
TypeSymbol sym = (TypeSymbol) type.tsym; TypeSymbol sym = type.tsym;
return env.declMaker.getTypeParameterDeclaration(sym); return env.declMaker.getTypeParameterDeclaration(sym);
} }
......
...@@ -37,6 +37,7 @@ import java.io.IOException; ...@@ -37,6 +37,7 @@ import java.io.IOException;
*/ */
public class Annotation { public class Annotation {
static class InvalidAnnotation extends AttributeException { static class InvalidAnnotation extends AttributeException {
private static final long serialVersionUID = -4620480740735772708L;
InvalidAnnotation(String msg) { InvalidAnnotation(String msg) {
super(msg); super(msg);
} }
......
...@@ -32,6 +32,7 @@ package com.sun.tools.classfile; ...@@ -32,6 +32,7 @@ package com.sun.tools.classfile;
* deletion without notice.</b> * deletion without notice.</b>
*/ */
public class AttributeException extends Exception { public class AttributeException extends Exception {
private static final long serialVersionUID = -4231486387714867770L;
AttributeException() { } AttributeException() { }
AttributeException(String msg) { AttributeException(String msg) {
......
...@@ -37,6 +37,7 @@ import java.io.IOException; ...@@ -37,6 +37,7 @@ import java.io.IOException;
*/ */
public class Code_attribute extends Attribute { public class Code_attribute extends Attribute {
public class InvalidIndex extends AttributeException { public class InvalidIndex extends AttributeException {
private static final long serialVersionUID = -8904527774589382802L;
InvalidIndex(int index) { InvalidIndex(int index) {
this.index = index; this.index = index;
} }
......
...@@ -38,6 +38,7 @@ import java.io.IOException; ...@@ -38,6 +38,7 @@ import java.io.IOException;
public class ConstantPool { public class ConstantPool {
public class InvalidIndex extends ConstantPoolException { public class InvalidIndex extends ConstantPoolException {
private static final long serialVersionUID = -4350294289300939730L;
InvalidIndex(int index) { InvalidIndex(int index) {
super(index); super(index);
} }
...@@ -50,6 +51,7 @@ public class ConstantPool { ...@@ -50,6 +51,7 @@ public class ConstantPool {
} }
public class UnexpectedEntry extends ConstantPoolException { public class UnexpectedEntry extends ConstantPoolException {
private static final long serialVersionUID = 6986335935377933211L;
UnexpectedEntry(int index, int expected_tag, int found_tag) { UnexpectedEntry(int index, int expected_tag, int found_tag) {
super(index); super(index);
this.expected_tag = expected_tag; this.expected_tag = expected_tag;
...@@ -67,6 +69,7 @@ public class ConstantPool { ...@@ -67,6 +69,7 @@ public class ConstantPool {
} }
public class InvalidEntry extends ConstantPoolException { public class InvalidEntry extends ConstantPoolException {
private static final long serialVersionUID = 1000087545585204447L;
InvalidEntry(int index, int tag) { InvalidEntry(int index, int tag) {
super(index); super(index);
this.tag = tag; this.tag = tag;
...@@ -82,6 +85,7 @@ public class ConstantPool { ...@@ -82,6 +85,7 @@ public class ConstantPool {
} }
public class EntryNotFound extends ConstantPoolException { public class EntryNotFound extends ConstantPoolException {
private static final long serialVersionUID = 2885537606468581850L;
EntryNotFound(Object value) { EntryNotFound(Object value) {
super(-1); super(-1);
this.value = value; this.value = value;
......
...@@ -33,6 +33,7 @@ package com.sun.tools.classfile; ...@@ -33,6 +33,7 @@ package com.sun.tools.classfile;
* deletion without notice.</b> * deletion without notice.</b>
*/ */
public class ConstantPoolException extends Exception { public class ConstantPoolException extends Exception {
private static final long serialVersionUID = -2324397349644754565L;
ConstantPoolException(int index) { ConstantPoolException(int index) {
this.index = index; this.index = index;
} }
......
...@@ -38,6 +38,7 @@ import java.io.IOException; ...@@ -38,6 +38,7 @@ import java.io.IOException;
*/ */
public class Descriptor { public class Descriptor {
public class InvalidDescriptor extends DescriptorException { public class InvalidDescriptor extends DescriptorException {
private static final long serialVersionUID = 1L;
InvalidDescriptor(String desc) { InvalidDescriptor(String desc) {
this.desc = desc; this.desc = desc;
this.index = -1; this.index = -1;
......
...@@ -33,4 +33,5 @@ package com.sun.tools.classfile; ...@@ -33,4 +33,5 @@ package com.sun.tools.classfile;
* deletion without notice.</b> * deletion without notice.</b>
*/ */
public class DescriptorException extends Exception { public class DescriptorException extends Exception {
private static final long serialVersionUID = 2411890273788901032L;
} }
...@@ -37,6 +37,7 @@ import java.io.IOException; ...@@ -37,6 +37,7 @@ import java.io.IOException;
*/ */
public class StackMapTable_attribute extends Attribute { public class StackMapTable_attribute extends Attribute {
static class InvalidStackMap extends AttributeException { static class InvalidStackMap extends AttributeException {
private static final long serialVersionUID = -5659038410855089780L;
InvalidStackMap(String msg) { InvalidStackMap(String msg) {
super(msg); super(msg);
} }
......
...@@ -493,4 +493,14 @@ public class ConfigurationImpl extends Configuration { ...@@ -493,4 +493,14 @@ public class ConfigurationImpl extends Configuration {
public Comparator<ProgramElementDoc> getMemberComparator() { public Comparator<ProgramElementDoc> getMemberComparator() {
return null; return null;
} }
/**
* {@inheritDoc}
*/
public Locale getLocale() {
if (root instanceof com.sun.tools.javadoc.RootDocImpl)
return ((com.sun.tools.javadoc.RootDocImpl)root).getLocale();
else
return Locale.getDefault();
}
} }
...@@ -119,7 +119,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter { ...@@ -119,7 +119,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
*/ */
protected void generateIndex() { protected void generateIndex() {
for (int i = 0; i < groupList.size(); i++) { for (int i = 0; i < groupList.size(); i++) {
String groupname = (String)groupList.get(i); String groupname = groupList.get(i);
List<PackageDoc> list = groupPackageMap.get(groupname); List<PackageDoc> list = groupPackageMap.get(groupname);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
printIndexContents(list.toArray(new PackageDoc[list.size()]), printIndexContents(list.toArray(new PackageDoc[list.size()]),
......
...@@ -25,12 +25,11 @@ ...@@ -25,12 +25,11 @@
package com.sun.tools.doclets.formats.html.markup; package com.sun.tools.doclets.formats.html.markup;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
...@@ -56,8 +55,9 @@ public abstract class HtmlDocWriter extends HtmlWriter { ...@@ -56,8 +55,9 @@ public abstract class HtmlDocWriter extends HtmlWriter {
super(configuration, super(configuration,
null, configuration.destDirName + filename, null, configuration.destDirName + filename,
configuration.docencoding); configuration.docencoding);
// use File to normalize file separators
configuration.message.notice("doclet.Generating_0", configuration.message.notice("doclet.Generating_0",
configuration.destDirName + filename); new File(configuration.destDirName, filename));
} }
public HtmlDocWriter(Configuration configuration, public HtmlDocWriter(Configuration configuration,
...@@ -65,10 +65,10 @@ public abstract class HtmlDocWriter extends HtmlWriter { ...@@ -65,10 +65,10 @@ public abstract class HtmlDocWriter extends HtmlWriter {
super(configuration, super(configuration,
configuration.destDirName + path, filename, configuration.destDirName + path, filename,
configuration.docencoding); configuration.docencoding);
// use File to normalize file separators
configuration.message.notice("doclet.Generating_0", configuration.message.notice("doclet.Generating_0",
configuration.destDirName + new File(configuration.destDirName,
((path.length() > 0)? ((path.length() > 0)? path + File.separator: "") + filename));
path + File.separator: "") + filename);
} }
/** /**
......
...@@ -85,7 +85,7 @@ public class HtmlWriter extends PrintWriter { ...@@ -85,7 +85,7 @@ public class HtmlWriter extends PrintWriter {
* Print &lt;HTML&gt; tag. Add a newline character at the end. * Print &lt;HTML&gt; tag. Add a newline character at the end.
*/ */
public void html() { public void html() {
println("<HTML>"); println("<HTML lang=\"" + configuration.getLocale().getLanguage() + "\">");
} }
/** /**
......
...@@ -706,6 +706,11 @@ public abstract class Configuration { ...@@ -706,6 +706,11 @@ public abstract class Configuration {
new FileInputStream(new File(builderXMLPath)); new FileInputStream(new File(builderXMLPath));
} }
/**
* Return the Locale for this document.
*/
public abstract Locale getLocale();
/** /**
* Return the comparator that will be used to sort member documentation. * Return the comparator that will be used to sort member documentation.
* To no do any sorting, return null. * To no do any sorting, return null.
......
...@@ -402,7 +402,7 @@ public class SerializedFormBuilder extends AbstractBuilder { ...@@ -402,7 +402,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
public void buildFieldSerializationOverview(ClassDoc classDoc) { public void buildFieldSerializationOverview(ClassDoc classDoc) {
if (classDoc.definesSerializableFields()) { if (classDoc.definesSerializableFields()) {
FieldDoc serialPersistentField = FieldDoc serialPersistentField =
(FieldDoc)((Util.asList(classDoc.serializableFields()).get(0))); Util.asList(classDoc.serializableFields()).get(0);
String comment = serialPersistentField.commentText(); String comment = serialPersistentField.commentText();
if (comment.length() > 0) { if (comment.length() > 0) {
fieldWriter.writeHeader( fieldWriter.writeHeader(
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
package com.sun.tools.doclets.internal.toolkit.util; package com.sun.tools.doclets.internal.toolkit.util;
public class DocletAbortException extends RuntimeException { public class DocletAbortException extends RuntimeException {
private static final long serialVersionUID = -9131058909576418984L;
public DocletAbortException() { public DocletAbortException() {
} }
......
...@@ -80,47 +80,15 @@ public class MessageRetriever { ...@@ -80,47 +80,15 @@ public class MessageRetriever {
this.resourcelocation = resourcelocation; this.resourcelocation = resourcelocation;
} }
/**
* get and format message string from resource
*
* @param key selects message from resource
*/
public String getText(String key) {
return getText(key, (String)null);
}
/**
* Get and format message string from resource
*
* @param key selects message from resource
* @param a1 Argument, to be repalced in the message.
*/
public String getText(String key, String a1) {
return getText(key, a1, null);
}
/**
* Get and format message string from resource
*
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
* @param a2 second argument to be replaced in the message.
*/
public String getText(String key, String a1, String a2) {
return getText(key, a1, a2, null);
}
/** /**
* Get and format message string from resource * Get and format message string from resource
* *
* @param key selects message from resource * @param key selects message from resource
* @param a1 first argument to be replaced in the message. * @param args arguments to be replaced in the message.
* @param a2 second argument to be replaced in the message.
* @param a3 third argument to be replaced in the message.
* @throws MissingResourceException when the key does not * @throws MissingResourceException when the key does not
* exist in the properties file. * exist in the properties file.
*/ */
public String getText(String key, String a1, String a2, String a3) throws MissingResourceException { public String getText(String key, Object... args) throws MissingResourceException {
if (messageRB == null) { if (messageRB == null) {
try { try {
messageRB = ResourceBundle.getBundle(resourcelocation); messageRB = ResourceBundle.getBundle(resourcelocation);
...@@ -130,7 +98,7 @@ public class MessageRetriever { ...@@ -130,7 +98,7 @@ public class MessageRetriever {
} }
} }
String message = messageRB.getString(key); String message = messageRB.getString(key);
return MessageFormat.format(message, a1, a2, a3); return MessageFormat.format(message, args);
} }
/** /**
...@@ -195,127 +163,20 @@ public class MessageRetriever { ...@@ -195,127 +163,20 @@ public class MessageRetriever {
* *
* @param pos the position of the source * @param pos the position of the source
* @param key selects message from resource * @param key selects message from resource
* @param args arguments to be replaced in the message.
*/ */
public void error(SourcePosition pos, String key) { public void error(SourcePosition pos, String key, Object... args) {
printError(pos, getText(key)); printError(pos, getText(key, args));
} }
/** /**
* Print error message, increment error count. * Print error message, increment error count.
* *
* @param key selects message from resource * @param key selects message from resource
* @param args arguments to be replaced in the message.
*/ */
public void error(String key) { public void error(String key, Object... args) {
printError(getText(key)); printError(getText(key, args));
}
/**
* Print error message, increment error count.
*
* @param pos the position of the source
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
*/
public void error(SourcePosition pos, String key, String a1) {
printError(pos, getText(key, a1));
}
/**
* Print error message, increment error count.
*
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
*/
public void error(String key, String a1) {
printError(getText(key, a1));
}
/**
* Print error message, increment error count.
*
* @param pos the position of the source
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
* @param a2 second argument to be replaced in the message.
*/
public void error(SourcePosition pos, String key, String a1, String a2) {
printError(pos, getText(key, a1, a2));
}
/**
* Print error message, increment error count.
*
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
* @param a2 second argument to be replaced in the message.
*/
public void error(String key, String a1, String a2) {
printError(getText(key, a1, a2));
}
/**
* Print error message, increment error count.
*
* @param pos the position of the source
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
* @param a2 second argument to be replaced in the message.
* @param a3 third argument to be replaced in the message.
*/
public void error(SourcePosition pos, String key, String a1, String a2, String a3) {
printError(pos, getText(key, a1, a2, a3));
}
/**
* Print error message, increment error count.
*
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
* @param a2 second argument to be replaced in the message.
* @param a3 third argument to be replaced in the message.
*/
public void error(String key, String a1, String a2, String a3) {
printError(getText(key, a1, a2, a3));
}
/**
* Print warning message, increment warning count.
*
* @param pos the position of the source
* @param key selects message from resource
*/
public void warning(SourcePosition pos, String key) {
printWarning(pos, getText(key));
}
/**
* Print warning message, increment warning count.
*
* @param key selects message from resource
*/
public void warning(String key) {
printWarning(getText(key));
}
/**
* Print warning message, increment warning count.
*
* @param pos the position of the source
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
*/
public void warning(SourcePosition pos, String key, String a1) {
printWarning(pos, getText(key, a1));
}
/**
* Print warning message, increment warning count.
*
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
*/
public void warning(String key, String a1) {
printWarning(getText(key, a1));
} }
/** /**
...@@ -323,109 +184,20 @@ public class MessageRetriever { ...@@ -323,109 +184,20 @@ public class MessageRetriever {
* *
* @param pos the position of the source * @param pos the position of the source
* @param key selects message from resource * @param key selects message from resource
* @param a1 first argument to be replaced in the message. * @param args arguments to be replaced in the message.
* @param a2 second argument to be replaced in the message.
*/ */
public void warning(SourcePosition pos, String key, String a1, String a2) { public void warning(SourcePosition pos, String key, Object... args) {
printWarning(pos, getText(key, a1, a2)); printWarning(pos, getText(key, args));
} }
/** /**
* Print warning message, increment warning count. * Print warning message, increment warning count.
* *
* @param key selects message from resource * @param key selects message from resource
* @param a1 first argument to be replaced in the message. * @param args arguments to be replaced in the message.
* @param a2 second argument to be replaced in the message.
*/
public void warning(String key, String a1, String a2) {
printWarning(getText(key, a1, a2));
}
/**
* Print warning message, increment warning count.
*
* @param pos the position of the source
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
* @param a2 second argument to be replaced in the message.
* @param a3 third argument to be replaced in the message.
*/
public void warning(SourcePosition pos, String key, String a1, String a2, String a3) {
printWarning(pos, getText(key, a1, a2, a3));
}
/**
* Print warning message, increment warning count.
*
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
* @param a2 second argument to be replaced in the message.
* @param a3 third argument to be replaced in the message.
*/
public void warning(String key, String a1, String a2, String a3) {
printWarning(getText(key, a1, a2, a3));
}
/**
* Print a message.
*
* @param pos the position of the source
* @param key selects message from resource
*/
public void notice(SourcePosition pos, String key) {
printNotice(pos, getText(key));
}
/**
* Print a message.
*
* @param key selects message from resource
*/
public void notice(String key) {
printNotice(getText(key));
}
/**
* Print a message.
* @param pos the position of the source
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
*/
public void notice(SourcePosition pos, String key, String a1) {
printNotice(pos, getText(key, a1));
}
/**
* Print a message.
*
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
*/
public void notice(String key, String a1) {
printNotice(getText(key, a1));
}
/**
* Print a message.
*
* @param pos the position of the source
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
* @param a2 second argument to be replaced in the message.
*/
public void notice(SourcePosition pos, String key, String a1, String a2) {
printNotice(pos, getText(key, a1, a2));
}
/**
* Print a message.
*
* @param key selects message from resource
* @param a1 first argument to be replaced in the message.
* @param a2 second argument to be replaced in the message.
*/ */
public void notice(String key, String a1, String a2) { public void warning(String key, Object... args) {
printNotice(getText(key, a1, a2)); printWarning(getText(key, args));
} }
/** /**
...@@ -433,23 +205,19 @@ public class MessageRetriever { ...@@ -433,23 +205,19 @@ public class MessageRetriever {
* *
* @param pos the position of the source * @param pos the position of the source
* @param key selects message from resource * @param key selects message from resource
* @param a1 first argument to be replaced in the message. * @param args arguments to be replaced in the message.
* @param a2 second argument to be replaced in the message.
* @param a3 third argument to be replaced in the message.
*/ */
public void notice(SourcePosition pos, String key, String a1, String a2, String a3) { public void notice(SourcePosition pos, String key, Object... args) {
printNotice(pos, getText(key, a1, a2, a3)); printNotice(pos, getText(key, args));
} }
/** /**
* Print a message. * Print a message.
* *
* @param key selects message from resource * @param key selects message from resource
* @param a1 first argument to be replaced in the message. * @param args arguments to be replaced in the message.
* @param a2 second argument to be replaced in the message.
* @param a3 third argument to be replaced in the message.
*/ */
public void notice(String key, String a1, String a2, String a3) { public void notice(String key, Object... args) {
printNotice(getText(key, a1, a2, a3)); printNotice(getText(key, args));
} }
} }
...@@ -25,10 +25,12 @@ ...@@ -25,10 +25,12 @@
package com.sun.tools.doclets.internal.toolkit.util; package com.sun.tools.doclets.internal.toolkit.util;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import javax.tools.FileObject;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Converts Java Source Code to HTML. * Converts Java Source Code to HTML.
...@@ -123,16 +125,27 @@ public class SourceToHTMLConverter { ...@@ -123,16 +125,27 @@ public class SourceToHTMLConverter {
if (cd == null || outputdir == null) { if (cd == null || outputdir == null) {
return; return;
} }
File file;
SourcePosition sp = cd.position();
if (sp == null || (file = sp.file()) == null) {
return;
}
try { try {
SourcePosition sp = cd.position();
if (sp == null)
return;
Reader r;
// temp hack until we can update SourcePosition API.
if (sp instanceof com.sun.tools.javadoc.SourcePositionImpl) {
FileObject fo = ((com.sun.tools.javadoc.SourcePositionImpl) sp).fileObject();
if (fo == null)
return;
r = fo.openReader(true);
} else {
File file = sp.file();
if (file == null)
return;
r = new FileReader(file);
}
LineNumberReader reader = new LineNumberReader(r);
int lineno = 1; int lineno = 1;
String line; String line;
StringBuffer output = new StringBuffer(); StringBuffer output = new StringBuffer();
LineNumberReader reader = new LineNumberReader(new FileReader(file));
try { try {
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
output.append(formatLine(line, configuration.sourcetab, lineno)); output.append(formatLine(line, configuration.sourcetab, lineno));
...@@ -142,7 +155,7 @@ public class SourceToHTMLConverter { ...@@ -142,7 +155,7 @@ public class SourceToHTMLConverter {
reader.close(); reader.close();
} }
output = addLineNumbers(output.toString()); output = addLineNumbers(output.toString());
output.insert(0, getHeader()); output.insert(0, getHeader(configuration));
output.append(getFooter()); output.append(getFooter());
writeToFile(output.toString(), outputdir, cd.name(), configuration); writeToFile(output.toString(), outputdir, cd.name(), configuration);
} catch (Exception e){ } catch (Exception e){
...@@ -192,10 +205,11 @@ public class SourceToHTMLConverter { ...@@ -192,10 +205,11 @@ public class SourceToHTMLConverter {
/** /**
* Get the header. * Get the header.
* @param configuration the Doclet configuration
* @return the header to the output file * @return the header to the output file
*/ */
protected static String getHeader() { protected static String getHeader(Configuration configuration) {
StringBuffer result = new StringBuffer("<HTML>" + DocletConstants.NL); StringBuffer result = new StringBuffer("<HTML lang=\"" + configuration.getLocale().getLanguage() + "\">" + DocletConstants.NL);
result.append("<BODY BGCOLOR=\""+ BGCOLOR + "\">" + DocletConstants.NL); result.append("<BODY BGCOLOR=\""+ BGCOLOR + "\">" + DocletConstants.NL);
result.append("<PRE>" + DocletConstants.NL); result.append("<PRE>" + DocletConstants.NL);
return result.toString(); return result.toString();
......
...@@ -25,10 +25,11 @@ ...@@ -25,10 +25,11 @@
package com.sun.tools.doclets.internal.toolkit.util; package com.sun.tools.doclets.internal.toolkit.util;
import java.io.*;
import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import java.util.*;
import java.io.*;
/** /**
* Utilities Class for Doclets. * Utilities Class for Doclets.
...@@ -579,7 +580,7 @@ public class Util { ...@@ -579,7 +580,7 @@ public class Util {
* @param docencoding Encoding to be used for this file. * @param docencoding Encoding to be used for this file.
* @exception IOException Exception raised by the FileWriter is passed on * @exception IOException Exception raised by the FileWriter is passed on
* to next level. * to next level.
* @exception UnSupportedEncodingException Exception raised by the * @exception UnsupportedEncodingException Exception raised by the
* OutputStreamWriter is passed on to next level. * OutputStreamWriter is passed on to next level.
* @return Writer Writer for the file getting generated. * @return Writer Writer for the file getting generated.
* @see java.io.FileOutputStream * @see java.io.FileOutputStream
...@@ -598,9 +599,7 @@ public class Util { ...@@ -598,9 +599,7 @@ public class Util {
fos = new FileOutputStream(filename); fos = new FileOutputStream(filename);
} }
if (docencoding == null) { if (docencoding == null) {
OutputStreamWriter oswriter = new OutputStreamWriter(fos); return new OutputStreamWriter(fos);
docencoding = oswriter.getEncoding();
return oswriter;
} else { } else {
return new OutputStreamWriter(fos, docencoding); return new OutputStreamWriter(fos, docencoding);
} }
......
...@@ -471,6 +471,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter { ...@@ -471,6 +471,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
private int value; private int value;
}; };
protected class CompileStates extends HashMap<Env<AttrContext>,CompileState> { protected class CompileStates extends HashMap<Env<AttrContext>,CompileState> {
private static final long serialVersionUID = 1812267524140424433L;
boolean isDone(Env<AttrContext> env, CompileState cs) { boolean isDone(Env<AttrContext> env, CompileState cs) {
CompileState ecs = get(env); CompileState ecs = get(env);
return ecs != null && ecs.isDone(cs); return ecs != null && ecs.isDone(cs);
......
...@@ -338,13 +338,13 @@ public class Main { ...@@ -338,13 +338,13 @@ public class Main {
return EXIT_CMDERR; return EXIT_CMDERR;
} }
List<File> filenames; List<File> files;
try { try {
filenames = processArgs(CommandLine.parse(args)); files = processArgs(CommandLine.parse(args));
if (filenames == null) { if (files == null) {
// null signals an error in options, abort // null signals an error in options, abort
return EXIT_CMDERR; return EXIT_CMDERR;
} else if (filenames.isEmpty() && fileObjects.isEmpty() && classnames.isEmpty()) { } else if (files.isEmpty() && fileObjects.isEmpty() && classnames.isEmpty()) {
// it is allowed to compile nothing if just asking for help or version info // it is allowed to compile nothing if just asking for help or version info
if (options.get("-help") != null if (options.get("-help") != null
|| options.get("-X") != null || options.get("-X") != null
...@@ -380,12 +380,14 @@ public class Main { ...@@ -380,12 +380,14 @@ public class Main {
comp = JavaCompiler.instance(context); comp = JavaCompiler.instance(context);
if (comp == null) return EXIT_SYSERR; if (comp == null) return EXIT_SYSERR;
if (!filenames.isEmpty()) { Log log = Log.instance(context);
if (!files.isEmpty()) {
// add filenames to fileObjects // add filenames to fileObjects
comp = JavaCompiler.instance(context); comp = JavaCompiler.instance(context);
List<JavaFileObject> otherFiles = List.nil(); List<JavaFileObject> otherFiles = List.nil();
JavacFileManager dfm = (JavacFileManager)fileManager; JavacFileManager dfm = (JavacFileManager)fileManager;
for (JavaFileObject fo : dfm.getJavaFileObjectsFromFiles(filenames)) for (JavaFileObject fo : dfm.getJavaFileObjectsFromFiles(files))
otherFiles = otherFiles.prepend(fo); otherFiles = otherFiles.prepend(fo);
for (JavaFileObject fo : otherFiles) for (JavaFileObject fo : otherFiles)
fileObjects = fileObjects.prepend(fo); fileObjects = fileObjects.prepend(fo);
...@@ -394,6 +396,16 @@ public class Main { ...@@ -394,6 +396,16 @@ public class Main {
classnames.toList(), classnames.toList(),
processors); processors);
if (log.expectDiagKeys != null) {
if (log.expectDiagKeys.size() == 0) {
Log.printLines(log.noticeWriter, "all expected diagnostics found");
return EXIT_OK;
} else {
Log.printLines(log.noticeWriter, "expected diagnostic keys not found: " + log.expectDiagKeys);
return EXIT_ERROR;
}
}
if (comp.errorCount() != 0 || if (comp.errorCount() != 0 ||
options.get("-Werror") != null && comp.warningCount() != 0) options.get("-Werror") != null && comp.warningCount() != 0)
return EXIT_ERROR; return EXIT_ERROR;
......
...@@ -863,13 +863,13 @@ public class JavacParser implements Parser { ...@@ -863,13 +863,13 @@ public class JavacParser implements Parser {
accept(GT); accept(GT);
t = F.at(pos1).TypeApply(t, args.toList()); t = F.at(pos1).TypeApply(t, args.toList());
checkGenerics(); checkGenerics();
t = bracketsOpt(toP(t));
while (S.token() == DOT) { while (S.token() == DOT) {
S.nextToken(); S.nextToken();
mode = TYPE; mode = TYPE;
t = toP(F.at(S.pos()).Select(t, ident())); t = toP(F.at(S.pos()).Select(t, ident()));
t = typeArgumentsOpt(t); t = typeArgumentsOpt(t);
} }
t = bracketsOpt(toP(t));
} else if ((mode & EXPR) != 0) { } else if ((mode & EXPR) != 0) {
mode = EXPR; mode = EXPR;
t = F.at(pos1).Binary(op, t, term2Rest(t1, TreeInfo.shiftPrec)); t = F.at(pos1).Binary(op, t, term2Rest(t1, TreeInfo.shiftPrec));
......
...@@ -61,6 +61,7 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { ...@@ -61,6 +61,7 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
* @param opts list of command-line options * @param opts list of command-line options
* @param msgs JavacMessages object used for i18n * @param msgs JavacMessages object used for i18n
*/ */
@SuppressWarnings("fallthrough")
BasicDiagnosticFormatter(Options opts, JavacMessages msgs) { BasicDiagnosticFormatter(Options opts, JavacMessages msgs) {
super(msgs, opts, true); super(msgs, opts, true);
initAvailableFormats(); initAvailableFormats();
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
package com.sun.tools.javac.util; package com.sun.tools.javac.util;
import java.io.*; import java.io.*;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -96,6 +97,11 @@ public class Log extends AbstractLog { ...@@ -96,6 +97,11 @@ public class Log extends AbstractLog {
*/ */
private DiagnosticFormatter<JCDiagnostic> diagFormatter; private DiagnosticFormatter<JCDiagnostic> diagFormatter;
/**
* Keys for expected diagnostics
*/
public Set<String> expectDiagKeys;
/** /**
* JavacMessages object used for localization * JavacMessages object used for localization
*/ */
...@@ -123,9 +129,13 @@ public class Log extends AbstractLog { ...@@ -123,9 +129,13 @@ public class Log extends AbstractLog {
this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(options) : this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(options) :
new BasicDiagnosticFormatter(options, messages); new BasicDiagnosticFormatter(options, messages);
@SuppressWarnings("unchecked") // FIXME @SuppressWarnings("unchecked") // FIXME
DiagnosticListener<? super JavaFileObject> diagListener = DiagnosticListener<? super JavaFileObject> dl =
context.get(DiagnosticListener.class); context.get(DiagnosticListener.class);
this.diagListener = diagListener; this.diagListener = dl;
String ek = options.get("expectKeys");
if (ek != null)
expectDiagKeys = new HashSet<String>(Arrays.asList(ek.split(", *")));
} }
// where // where
private int getIntOption(Options options, String optionName, int defaultValue) { private int getIntOption(Options options, String optionName, int defaultValue) {
...@@ -291,6 +301,9 @@ public class Log extends AbstractLog { ...@@ -291,6 +301,9 @@ public class Log extends AbstractLog {
* reported so far, the diagnostic may be handed off to writeDiagnostic. * reported so far, the diagnostic may be handed off to writeDiagnostic.
*/ */
public void report(JCDiagnostic diagnostic) { public void report(JCDiagnostic diagnostic) {
if (expectDiagKeys != null)
expectDiagKeys.remove(diagnostic.getCode());
switch (diagnostic.getType()) { switch (diagnostic.getType()) {
case FRAGMENT: case FRAGMENT:
throw new IllegalArgumentException(); throw new IllegalArgumentException();
......
...@@ -25,42 +25,48 @@ ...@@ -25,42 +25,48 @@
package com.sun.tools.javadoc; package com.sun.tools.javadoc;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Modifier;
import java.net.URI;
import java.util.HashSet;
import java.util.Set;
import javax.tools.FileObject;
import javax.tools.JavaFileManager.Location;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import static com.sun.javadoc.LanguageVersion.*; import static com.sun.javadoc.LanguageVersion.*;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Position;
import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Kinds; import com.sun.tools.javac.code.Kinds;
import com.sun.tools.javac.code.TypeTags;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Type.ClassType;
import com.sun.tools.javac.code.Scope; import com.sun.tools.javac.code.Scope;
import com.sun.tools.javac.code.Symbol; import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Type.ClassType;
import com.sun.tools.javac.code.TypeTags;
import com.sun.tools.javac.comp.AttrContext; import com.sun.tools.javac.comp.AttrContext;
import com.sun.tools.javac.comp.Env; import com.sun.tools.javac.comp.Env;
import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.tree.JCTree.JCFieldAccess; import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
import com.sun.tools.javac.tree.JCTree.JCImport; import com.sun.tools.javac.tree.JCTree.JCImport;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.tree.TreeInfo; import com.sun.tools.javac.tree.TreeInfo;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Names; import com.sun.tools.javac.util.Names;
import com.sun.tools.javac.util.Position;
import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Flags.*;
import static com.sun.tools.javac.code.Kinds.*; import static com.sun.tools.javac.code.Kinds.*;
import java.io.File;
import java.util.Set;
import java.util.HashSet;
import java.lang.reflect.Modifier;
/** /**
* Represents a java class and provides access to information * Represents a java class and provides access to information
* about the class, the class' comment and tags, and the * about the class, the class' comment and tags, and the
...@@ -271,16 +277,41 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc { ...@@ -271,16 +277,41 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
*/ */
public PackageDoc containingPackage() { public PackageDoc containingPackage() {
PackageDocImpl p = env.getPackageDoc(tsym.packge()); PackageDocImpl p = env.getPackageDoc(tsym.packge());
SourcePosition po = position(); if (p.setDocPath == false) {
if (po != null && p.setDocPath == false && p.zipDocPath == null) { FileObject docPath;
//Set the package path if possible try {
File packageDir = po.file().getParentFile(); Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
if (packageDir != null ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
&& (new File(packageDir, "package.html")).exists()) {
p.setDocPath(packageDir.getPath()); docPath = env.fileManager.getFileForInput(
} else { location, p.qualifiedName(), "package.html");
p.setDocPath(null); } catch (IOException e) {
docPath = null;
} }
if (docPath == null) {
// fall back on older semantics of looking in same directory as
// source file for this class
SourcePosition po = position();
if (env.fileManager instanceof StandardJavaFileManager &&
po instanceof SourcePositionImpl) {
URI uri = ((SourcePositionImpl) po).filename.toUri();
if ("file".equals(uri.getScheme())) {
File f = new File(uri.getPath());
File dir = f.getParentFile();
if (dir != null) {
File pf = new File(dir, "package.html");
if (pf.exists()) {
StandardJavaFileManager sfm = (StandardJavaFileManager) env.fileManager;
docPath = sfm.getJavaFileObjects(pf).iterator().next();
}
}
}
}
}
p.setDocPath(docPath);
} }
return p; return p;
} }
...@@ -1251,7 +1282,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc { ...@@ -1251,7 +1282,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
*/ */
public SourcePosition position() { public SourcePosition position() {
if (tsym.sourcefile == null) return null; if (tsym.sourcefile == null) return null;
return SourcePositionImpl.make(tsym.sourcefile.toString(), return SourcePositionImpl.make(tsym.sourcefile,
(tree==null) ? Position.NOPOS : tree.pos, (tree==null) ? Position.NOPOS : tree.pos,
lineMap); lineMap);
} }
......
...@@ -74,6 +74,7 @@ class Comment { ...@@ -74,6 +74,7 @@ class Comment {
* the tag text. * the tag text.
* </pre> * </pre>
*/ */
@SuppressWarnings("fallthrough")
class CommentStringParser { class CommentStringParser {
/** /**
* The entry point to the comment string parser * The entry point to the comment string parser
......
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
package com.sun.tools.javadoc; package com.sun.tools.javadoc;
import java.util.*;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.*;
import javax.tools.JavaFileManager;
import com.sun.javadoc.*; import com.sun.javadoc.*;
...@@ -40,7 +41,6 @@ import com.sun.tools.javac.util.Context; ...@@ -40,7 +41,6 @@ import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Names; import com.sun.tools.javac.util.Names;
import com.sun.tools.javac.util.Position; import com.sun.tools.javac.util.Position;
/** /**
* Holds the environment for a run of javadoc. * Holds the environment for a run of javadoc.
* Holds only the information needed throughout the * Holds only the information needed throughout the
...@@ -103,6 +103,7 @@ public class DocEnv { ...@@ -103,6 +103,7 @@ public class DocEnv {
Check chk; Check chk;
Types types; Types types;
JavaFileManager fileManager;
/** Allow documenting from class files? */ /** Allow documenting from class files? */
boolean docClasses = false; boolean docClasses = false;
...@@ -133,6 +134,7 @@ public class DocEnv { ...@@ -133,6 +134,7 @@ public class DocEnv {
externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable")); externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
chk = Check.instance(context); chk = Check.instance(context);
types = Types.instance(context); types = Types.instance(context);
fileManager = context.get(JavaFileManager.class);
// Default. Should normally be reset with setLocale. // Default. Should normally be reset with setLocale.
this.doclocale = new DocLocale(this, "", breakiterator); this.doclocale = new DocLocale(this, "", breakiterator);
......
...@@ -25,11 +25,13 @@ ...@@ -25,11 +25,13 @@
package com.sun.tools.javadoc; package com.sun.tools.javadoc;
import com.sun.javadoc.*;
import java.io.InputStream; import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.text.CollationKey; import java.text.CollationKey;
import javax.tools.FileObject;
import com.sun.javadoc.*;
import com.sun.tools.javac.util.Position; import com.sun.tools.javac.util.Position;
/** /**
...@@ -43,7 +45,7 @@ import com.sun.tools.javac.util.Position; ...@@ -43,7 +45,7 @@ import com.sun.tools.javac.util.Position;
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Neal Gafter (rewrite) * @author Neal Gafter (rewrite)
*/ */
abstract class DocImpl implements Doc, Comparable<Object> { public abstract class DocImpl implements Doc, Comparable<Object> {
/** /**
* Doc environment * Doc environment
...@@ -163,7 +165,7 @@ abstract class DocImpl implements Doc, Comparable<Object> { ...@@ -163,7 +165,7 @@ abstract class DocImpl implements Doc, Comparable<Object> {
/** /**
* Utility for subclasses which read HTML documentation files. * Utility for subclasses which read HTML documentation files.
*/ */
String readHTMLDocumentation(InputStream input, String filename) throws IOException { String readHTMLDocumentation(InputStream input, FileObject filename) throws IOException {
int filesize = input.available(); int filesize = input.available();
byte[] filecontents = new byte[filesize]; byte[] filecontents = new byte[filesize];
input.read(filecontents, 0, filesize); input.read(filecontents, 0, filesize);
......
...@@ -25,20 +25,18 @@ ...@@ -25,20 +25,18 @@
package com.sun.tools.javadoc; package com.sun.tools.javadoc;
import java.lang.reflect.Modifier;
import java.text.CollationKey;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Position;
import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl; import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
import com.sun.tools.javac.util.List;
import java.text.CollationKey; import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Position;
import java.lang.reflect.Modifier;
/** /**
* Represents a method or constructor of a java class. * Represents a method or constructor of a java class.
...@@ -267,7 +265,7 @@ public abstract class ExecutableMemberDocImpl ...@@ -267,7 +265,7 @@ public abstract class ExecutableMemberDocImpl
*/ */
public SourcePosition position() { public SourcePosition position() {
if (sym.enclClass().sourcefile == null) return null; if (sym.enclClass().sourcefile == null) return null;
return SourcePositionImpl.make(sym.enclClass().sourcefile.toString(), return SourcePositionImpl.make(sym.enclClass().sourcefile,
(tree==null) ? 0 : tree.pos, (tree==null) ? 0 : tree.pos,
lineMap); lineMap);
} }
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
package com.sun.tools.javadoc; package com.sun.tools.javadoc;
import java.lang.reflect.Modifier;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import static com.sun.javadoc.LanguageVersion.*; import static com.sun.javadoc.LanguageVersion.*;
...@@ -38,9 +40,6 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl; ...@@ -38,9 +40,6 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.util.Position; import com.sun.tools.javac.util.Position;
import java.lang.reflect.Modifier;
/** /**
* Represents a field in a java class. * Represents a field in a java class.
* *
...@@ -260,7 +259,7 @@ public class FieldDocImpl extends MemberDocImpl implements FieldDoc { ...@@ -260,7 +259,7 @@ public class FieldDocImpl extends MemberDocImpl implements FieldDoc {
*/ */
public SourcePosition position() { public SourcePosition position() {
if (sym.enclClass().sourcefile == null) return null; if (sym.enclClass().sourcefile == null) return null;
return SourcePositionImpl.make(sym.enclClass().sourcefile.toString(), return SourcePositionImpl.make(sym.enclClass().sourcefile,
(tree==null) ? 0 : tree.pos, (tree==null) ? 0 : tree.pos,
lineMap); lineMap);
} }
......
...@@ -25,18 +25,13 @@ ...@@ -25,18 +25,13 @@
package com.sun.tools.javadoc; package com.sun.tools.javadoc;
import java.util.EnumSet;
import javax.tools.JavaFileObject;
import com.sun.tools.javac.code.Symbol.PackageSymbol; import com.sun.tools.javac.code.Symbol.PackageSymbol;
import com.sun.tools.javac.file.JavacFileManager;
import com.sun.tools.javac.file.ZipArchive.ZipFileObject;
import com.sun.tools.javac.file.Old199;
import com.sun.tools.javac.file.ZipFileIndexArchive;
import com.sun.tools.javac.jvm.ClassReader; import com.sun.tools.javac.jvm.ClassReader;
import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Context;
import java.io.File;
import java.util.EnumSet;
import javax.tools.JavaFileObject;
/** Javadoc uses an extended class reader that records package.html entries /** Javadoc uses an extended class reader that records package.html entries
* @author Neal Gafter * @author Neal Gafter
*/ */
...@@ -82,32 +77,7 @@ class JavadocClassReader extends ClassReader { ...@@ -82,32 +77,7 @@ class JavadocClassReader extends ClassReader {
*/ */
@Override @Override
protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) { protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) {
CharSequence fileName = Old199.getName(fo); if (fo.isNameCompatible("package", JavaFileObject.Kind.HTML))
if (docenv != null && fileName.equals("package.html")) { docenv.getPackageDoc(pack).setDocPath(fo);
if (fo instanceof ZipFileObject) {
ZipFileObject zfo = (ZipFileObject) fo;
String zipName = zfo.getZipName();
String entryName = zfo.getZipEntryName();
int lastSep = entryName.lastIndexOf("/");
String classPathName = entryName.substring(0, lastSep + 1);
docenv.getPackageDoc(pack).setDocPath(zipName, classPathName);
}
else if (fo instanceof ZipFileIndexArchive.ZipFileIndexFileObject) {
ZipFileIndexArchive.ZipFileIndexFileObject zfo = (ZipFileIndexArchive.ZipFileIndexFileObject) fo;
String zipName = zfo.getZipName();
String entryName = zfo.getZipEntryName();
if (File.separatorChar != '/') {
entryName = entryName.replace(File.separatorChar, '/');
}
int lastSep = entryName.lastIndexOf("/");
String classPathName = entryName.substring(0, lastSep + 1);
docenv.getPackageDoc(pack).setDocPath(zipName, classPathName);
}
else {
File fileDir = new File(Old199.getPath(fo)).getParentFile();
docenv.getPackageDoc(pack).setDocPath(fileDir.getAbsolutePath());
}
}
} }
} }
...@@ -25,17 +25,29 @@ ...@@ -25,17 +25,29 @@
package com.sun.tools.javadoc; package com.sun.tools.javadoc;
import java.io.*; import java.io.File;
import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.EnumSet;
import com.sun.tools.javac.code.Symbol.*; import java.util.HashMap;
import com.sun.tools.javac.comp.*; import java.util.Map;
import com.sun.tools.javac.file.Paths; import java.util.Set;
import javax.tools.JavaFileManager.Location;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import com.sun.tools.javac.code.Symbol.CompletionFailure;
import com.sun.tools.javac.comp.Annotate;
import com.sun.tools.javac.parser.DocCommentScanner; import com.sun.tools.javac.parser.DocCommentScanner;
import com.sun.tools.javac.tree.*; import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.*; import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.util.*; import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.util.Abort;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Position;
/** /**
...@@ -53,7 +65,6 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { ...@@ -53,7 +65,6 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
final JavadocClassReader reader; final JavadocClassReader reader;
final JavadocEnter enter; final JavadocEnter enter;
final Annotate annotate; final Annotate annotate;
private final Paths paths;
/** /**
* Construct a new JavaCompiler processor, using appropriately * Construct a new JavaCompiler processor, using appropriately
...@@ -66,7 +77,6 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { ...@@ -66,7 +77,6 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
reader = JavadocClassReader.instance0(context); reader = JavadocClassReader.instance0(context);
enter = JavadocEnter.instance0(context); enter = JavadocEnter.instance0(context);
annotate = Annotate.instance(context); annotate = Annotate.instance(context);
paths = Paths.instance(context);
} }
/** /**
...@@ -120,7 +130,7 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { ...@@ -120,7 +130,7 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
boolean quiet) throws IOException { boolean quiet) throws IOException {
docenv = DocEnv.instance(context); docenv = DocEnv.instance(context);
docenv.showAccess = filter; docenv.showAccess = filter;
docenv.quiet = quiet; docenv.quiet = quiet;
docenv.breakiterator = breakiterator; docenv.breakiterator = breakiterator;
docenv.setLocale(doclocale); docenv.setLocale(doclocale);
docenv.setEncoding(encoding); docenv.setEncoding(encoding);
...@@ -133,12 +143,14 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { ...@@ -133,12 +143,14 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
ListBuffer<JCCompilationUnit> packTrees = new ListBuffer<JCCompilationUnit>(); ListBuffer<JCCompilationUnit> packTrees = new ListBuffer<JCCompilationUnit>();
try { try {
StandardJavaFileManager fm = (StandardJavaFileManager) docenv.fileManager;
for (List<String> it = javaNames; it.nonEmpty(); it = it.tail) { for (List<String> it = javaNames; it.nonEmpty(); it = it.tail) {
String name = it.head; String name = it.head;
if (!docClasses && name.endsWith(".java") && new File(name).exists()) { if (!docClasses && name.endsWith(".java") && new File(name).exists()) {
JavaFileObject fo = fm.getJavaFileObjects(name).iterator().next();
docenv.notice("main.Loading_source_file", name); docenv.notice("main.Loading_source_file", name);
JCCompilationUnit tree = parse(name); JCCompilationUnit tree = parse(fo);
classTrees.append(tree); classTrees.append(tree);
} else if (isValidPackageName(name)) { } else if (isValidPackageName(name)) {
names = names.append(name); names = names.append(name);
} else if (name.endsWith(".java")) { } else if (name.endsWith(".java")) {
...@@ -151,12 +163,14 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { ...@@ -151,12 +163,14 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
if (!docClasses) { if (!docClasses) {
// Recursively search given subpackages. If any packages // Recursively search given subpackages. If any packages
//are found, add them to the list. //are found, add them to the list.
searchSubPackages(subPackages, names, excludedPackages); Map<String,List<JavaFileObject>> packageFiles =
searchSubPackages(subPackages, names, excludedPackages);
// Parse the packages // Parse the packages
for (List<String> packs = names.toList(); packs.nonEmpty(); packs = packs.tail) { for (List<String> packs = names.toList(); packs.nonEmpty(); packs = packs.tail) {
// Parse sources ostensibly belonging to package. // Parse sources ostensibly belonging to package.
parsePackageClasses(packs.head, packTrees, excludedPackages); String packageName = packs.head;
parsePackageClasses(packageName, packageFiles.get(packageName), packTrees, excludedPackages);
} }
if (messager.nerrors() != 0) return null; if (messager.nerrors() != 0) return null;
...@@ -167,7 +181,8 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { ...@@ -167,7 +181,8 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
} }
} catch (Abort ex) {} } catch (Abort ex) {}
if (messager.nerrors() != 0) return null; if (messager.nerrors() != 0)
return null;
if (docClasses) if (docClasses)
return new RootDocImpl(docenv, javaNames, options); return new RootDocImpl(docenv, javaNames, options);
...@@ -185,66 +200,129 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { ...@@ -185,66 +200,129 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
return isValidClassName(s); return isValidClassName(s);
} }
private final static char pathSep = File.pathSeparatorChar;
/** /**
* search all directories in path for subdirectory name. Add all * search all directories in path for subdirectory name. Add all
* .java files found in such a directory to args. * .java files found in such a directory to args.
*/ */
private void parsePackageClasses(String name, private void parsePackageClasses(String name,
ListBuffer<JCCompilationUnit> trees, Iterable<JavaFileObject> files,
List<String> excludedPackages) ListBuffer<JCCompilationUnit> trees,
throws IOException { List<String> excludedPackages)
throws IOException {
if (excludedPackages.contains(name)) { if (excludedPackages.contains(name)) {
return; return;
} }
boolean hasFiles = false; boolean hasFiles = false;
docenv.notice("main.Loading_source_files_for_package", name); docenv.notice("main.Loading_source_files_for_package", name);
name = name.replace('.', File.separatorChar);
for (File pathname : paths.sourceSearchPath()) { if (files == null) {
File f = new File(pathname, name); Location location = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
String names[] = f.list(); ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
// if names not null, then found directory with source files ListBuffer<JavaFileObject> lb = new ListBuffer<JavaFileObject>();
if (names != null) { for (JavaFileObject fo: docenv.fileManager.list(
String dir = f.getAbsolutePath(); location, name, EnumSet.of(JavaFileObject.Kind.SOURCE), false)) {
if (!dir.endsWith(File.separator)) String binaryName = docenv.fileManager.inferBinaryName(location, fo);
dir = dir + File.separator; String simpleName = getSimpleName(binaryName);
for (int j = 0; j < names.length; j++) { if (isValidClassName(simpleName)) {
if (isValidJavaSourceFile(names[j])) { lb.append(fo);
String fn = dir + names[j];
// messager.notice("main.Loading_source_file", fn);
trees.append(parse(fn));
hasFiles = true;
}
} }
} }
files = lb.toList();
}
for (JavaFileObject fo : files) {
// messager.notice("main.Loading_source_file", fn);
trees.append(parse(fo));
hasFiles = true;
} }
if (!hasFiles)
if (!hasFiles) {
messager.warning(null, "main.no_source_files_for_package", messager.warning(null, "main.no_source_files_for_package",
name.replace(File.separatorChar, '.')); name.replace(File.separatorChar, '.'));
}
} }
/** /**
* Recursively search all directories in path for subdirectory name. * Recursively search all directories in path for subdirectory name.
* Add all packages found in such a directory to packages list. * Add all packages found in such a directory to packages list.
*/ */
private Map<String,List<JavaFileObject>> searchSubPackages(
List<String> subPackages,
ListBuffer<String> packages,
List<String> excludedPackages)
throws IOException {
Map<String,List<JavaFileObject>> packageFiles =
new HashMap<String,List<JavaFileObject>>();
Map<String,Boolean> includedPackages = new HashMap<String,Boolean>();
includedPackages.put("", true);
for (String p: excludedPackages)
includedPackages.put(p, false);
if (docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH)) {
searchSubPackages(subPackages,
includedPackages,
packages, packageFiles,
StandardLocation.SOURCE_PATH,
EnumSet.of(JavaFileObject.Kind.SOURCE));
searchSubPackages(subPackages,
includedPackages,
packages, packageFiles,
StandardLocation.CLASS_PATH,
EnumSet.of(JavaFileObject.Kind.CLASS));
} else {
searchSubPackages(subPackages,
includedPackages,
packages, packageFiles,
StandardLocation.CLASS_PATH,
EnumSet.of(JavaFileObject.Kind.SOURCE, JavaFileObject.Kind.CLASS));
}
return packageFiles;
}
private void searchSubPackages(List<String> subPackages, private void searchSubPackages(List<String> subPackages,
ListBuffer<String> packages, Map<String,Boolean> includedPackages,
List<String> excludedPackages) { ListBuffer<String> packages,
// FIXME: This search path is bogus. Map<String, List<JavaFileObject>> packageFiles,
// Only the effective source path should be searched for sources. StandardLocation location, Set<JavaFileObject.Kind> kinds)
// Only the effective class path should be searched for classes. throws IOException {
// Should the bootclasspath/extdirs also be searched for classes? for (String subPackage: subPackages) {
java.util.List<File> pathnames = new java.util.ArrayList<File>(); if (!isIncluded(subPackage, includedPackages))
if (paths.sourcePath() != null) continue;
for (File elt : paths.sourcePath())
pathnames.add(elt); for (JavaFileObject fo: docenv.fileManager.list(location, subPackage, kinds, true)) {
for (File elt : paths.userClassPath()) String binaryName = docenv.fileManager.inferBinaryName(location, fo);
pathnames.add(elt); String packageName = getPackageName(binaryName);
String simpleName = getSimpleName(binaryName);
for (String subPackage : subPackages) if (isIncluded(packageName, includedPackages) && isValidClassName(simpleName)) {
searchSubPackage(subPackage, packages, excludedPackages, pathnames); List<JavaFileObject> list = packageFiles.get(packageName);
list = (list == null ? List.of(fo) : list.prepend(fo));
packageFiles.put(packageName, list);
if (!packages.contains(packageName))
packages.add(packageName);
}
}
}
}
private String getPackageName(String name) {
int lastDot = name.lastIndexOf(".");
return (lastDot == -1 ? "" : name.substring(0, lastDot));
}
private String getSimpleName(String name) {
int lastDot = name.lastIndexOf(".");
return (lastDot == -1 ? name : name.substring(lastDot + 1));
}
private boolean isIncluded(String packageName, Map<String,Boolean> includedPackages) {
Boolean b = includedPackages.get(packageName);
if (b == null) {
b = isIncluded(getPackageName(packageName), includedPackages);
includedPackages.put(packageName, b);
}
return b;
} }
/** /**
......
...@@ -111,6 +111,7 @@ public class Messager extends Log implements DocErrorReporter { ...@@ -111,6 +111,7 @@ public class Messager extends Log implements DocErrorReporter {
* @param warnWriter Stream for warnings * @param warnWriter Stream for warnings
* @param noticeWriter Stream for other messages * @param noticeWriter Stream for other messages
*/ */
@SuppressWarnings("deprecation")
protected Messager(Context context, protected Messager(Context context,
String programName, String programName,
PrintWriter errWriter, PrintWriter errWriter,
......
...@@ -25,30 +25,23 @@ ...@@ -25,30 +25,23 @@
package com.sun.tools.javadoc; package com.sun.tools.javadoc;
import com.sun.javadoc.*;
import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.zip.ZipFile; import javax.tools.FileObject;
import java.util.zip.ZipEntry;
import com.sun.javadoc.*;
import com.sun.tools.javac.code.Attribute; import com.sun.tools.javac.code.Attribute;
import com.sun.tools.javac.code.Scope; import com.sun.tools.javac.code.Scope;
import com.sun.tools.javac.code.Symbol.ClassSymbol; import com.sun.tools.javac.code.Symbol.ClassSymbol;
import com.sun.tools.javac.code.Symbol.PackageSymbol; import com.sun.tools.javac.code.Symbol.PackageSymbol;
import com.sun.tools.javac.comp.AttrContext;
import com.sun.tools.javac.comp.Env;
import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name; import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Position; import com.sun.tools.javac.util.Position;
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
/** /**
* Represents a java package. Provides access to information * Represents a java package. Provides access to information
* about the package, the package's comment and tags, and the * about the package, the package's comment and tags, and the
...@@ -63,14 +56,10 @@ import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; ...@@ -63,14 +56,10 @@ import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
public class PackageDocImpl extends DocImpl implements PackageDoc { public class PackageDocImpl extends DocImpl implements PackageDoc {
private static final String PACKAGE_HTML_FILE_NAME = "package.html";
protected PackageSymbol sym; protected PackageSymbol sym;
private JCCompilationUnit tree = null; // for source position private JCCompilationUnit tree = null; // for source position
public String docPath = null; public FileObject docPath = null;
public String zipDocPath = null;
public String zipDocEntry = null;
private boolean foundDoc; // found a doc comment in either private boolean foundDoc; // found a doc comment in either
// package.html or package-info.java // package.html or package-info.java
...@@ -108,30 +97,16 @@ public class PackageDocImpl extends DocImpl implements PackageDoc { ...@@ -108,30 +97,16 @@ public class PackageDocImpl extends DocImpl implements PackageDoc {
* Do lazy initialization of "documentation" string. * Do lazy initialization of "documentation" string.
*/ */
String documentation() { String documentation() {
if (documentation != null) return documentation; if (documentation != null)
if (zipDocPath != null) { return documentation;
try {
ZipFile f = new ZipFile(zipDocPath);
ZipEntry entry = f.getEntry(zipDocEntry);
if (entry != null) {
InputStream s = f.getInputStream(entry);
return (documentation = readHTMLDocumentation(s,
zipDocPath + File.separatorChar + zipDocEntry));
}
} catch (IOException exc) {
documentation = "";
env.error(null, "javadoc.File_Read_Error",
zipDocPath + File.separatorChar + zipDocEntry);
}
}
if (docPath != null) { if (docPath != null) {
// read from file // read from file
try { try {
InputStream s = new FileInputStream(docPath); InputStream s = docPath.openInputStream();
documentation = readHTMLDocumentation(s, docPath); documentation = readHTMLDocumentation(s, docPath);
} catch (IOException exc) { } catch (IOException exc) {
documentation = ""; documentation = "";
env.error(null, "javadoc.File_Read_Error", docPath); env.error(null, "javadoc.File_Read_Error", docPath.getName());
} }
} else { } else {
// no doc file to be had // no doc file to be had
...@@ -363,24 +338,12 @@ public class PackageDocImpl extends DocImpl implements PackageDoc { ...@@ -363,24 +338,12 @@ public class PackageDocImpl extends DocImpl implements PackageDoc {
/** /**
* set doc path for an unzipped directory * set doc path for an unzipped directory
*/ */
public void setDocPath(String path) { public void setDocPath(FileObject path) {
setDocPath = true; setDocPath = true;
if (path == null) if (path == null)
return; return;
String newDocPath = path + File.separatorChar + PACKAGE_HTML_FILE_NAME; if (!path.equals(docPath)) {
if (!newDocPath.equals(docPath)) { docPath = path;
docPath = newDocPath;
checkDoc();
}
}
/**
* set the doc path for zipped directory
*/
public void setDocPath(String path, String entry) {
if (!path.equals(zipDocPath)) {
zipDocPath = path;
zipDocEntry = entry + PACKAGE_HTML_FILE_NAME;
checkDoc(); checkDoc();
} }
} }
...@@ -409,7 +372,7 @@ public class PackageDocImpl extends DocImpl implements PackageDoc { ...@@ -409,7 +372,7 @@ public class PackageDocImpl extends DocImpl implements PackageDoc {
*/ */
public SourcePosition position() { public SourcePosition position() {
return (tree != null) return (tree != null)
? SourcePositionImpl.make(tree.sourcefile + "", tree.pos, tree.lineMap) ? SourcePositionImpl.make(tree.sourcefile, tree.pos, tree.lineMap)
: SourcePositionImpl.make(docPath, Position.NOPOS, null); : SourcePositionImpl.make(docPath, Position.NOPOS, null);
} }
} }
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
package com.sun.tools.javadoc; package com.sun.tools.javadoc;
import java.io.IOException; import java.io.IOException;
import java.io.FileInputStream; import java.util.Locale;
import java.io.File; import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.javac.tree.JCTree.JCClassDecl; import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Position; import com.sun.tools.javac.util.Position;
...@@ -307,10 +307,13 @@ public class RootDocImpl extends DocImpl implements RootDoc { ...@@ -307,10 +307,13 @@ public class RootDocImpl extends DocImpl implements RootDoc {
* Return the path of the overview file and 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 and null if it does not exist. * @return the path of the overview file and null if it does not exist.
*/ */
private String getOverviewPath() { private JavaFileObject getOverviewPath() {
for (String[] opt : options) { for (String[] opt : options) {
if (opt[0].equals("-overview")) { if (opt[0].equals("-overview")) {
return opt[1]; if (env.fileManager instanceof StandardJavaFileManager) {
StandardJavaFileManager fm = (StandardJavaFileManager) env.fileManager;
return fm.getJavaFileObjects(opt[1]).iterator().next();
}
} }
} }
return null; return null;
...@@ -322,7 +325,7 @@ public class RootDocImpl extends DocImpl implements RootDoc { ...@@ -322,7 +325,7 @@ public class RootDocImpl extends DocImpl implements RootDoc {
protected String documentation() { protected String documentation() {
if (documentation == null) { if (documentation == null) {
int cnt = options.length(); int cnt = options.length();
String overviewPath = getOverviewPath(); JavaFileObject overviewPath = getOverviewPath();
if (overviewPath == null) { if (overviewPath == null) {
// no doc file to be had // no doc file to be had
documentation = ""; documentation = "";
...@@ -330,11 +333,11 @@ public class RootDocImpl extends DocImpl implements RootDoc { ...@@ -330,11 +333,11 @@ public class RootDocImpl extends DocImpl implements RootDoc {
// read from file // read from file
try { try {
documentation = readHTMLDocumentation( documentation = readHTMLDocumentation(
new FileInputStream(overviewPath), overviewPath.openInputStream(),
overviewPath); overviewPath);
} catch (IOException exc) { } catch (IOException exc) {
documentation = ""; documentation = "";
env.error(null, "javadoc.File_Read_Error", overviewPath); env.error(null, "javadoc.File_Read_Error", overviewPath.getName());
} }
} }
} }
...@@ -346,9 +349,16 @@ public class RootDocImpl extends DocImpl implements RootDoc { ...@@ -346,9 +349,16 @@ public class RootDocImpl extends DocImpl implements RootDoc {
* no position is available. * no position is available.
*/ */
public SourcePosition position() { public SourcePosition position() {
String path; JavaFileObject path;
return ((path = getOverviewPath()) == null) ? return ((path = getOverviewPath()) == null) ?
null : null :
SourcePositionImpl.make(path, Position.NOPOS, null); SourcePositionImpl.make(path, Position.NOPOS, null);
} }
/**
* Return the locale provided by the user or the default locale value.
*/
public Locale getLocale() {
return env.doclocale.locale;
}
} }
...@@ -25,11 +25,12 @@ ...@@ -25,11 +25,12 @@
package com.sun.tools.javadoc; package com.sun.tools.javadoc;
import java.io.File;
import javax.tools.FileObject;
import com.sun.javadoc.SourcePosition; import com.sun.javadoc.SourcePosition;
import com.sun.tools.javac.util.Position; import com.sun.tools.javac.util.Position;
import java.io.File;
/** /**
* A source position: filename, line number, and column number. * A source position: filename, line number, and column number.
* *
...@@ -37,15 +38,21 @@ import java.io.File; ...@@ -37,15 +38,21 @@ import java.io.File;
* @author Neal M Gafter * @author Neal M Gafter
* @author Michael Van De Vanter (position representation changed to char offsets) * @author Michael Van De Vanter (position representation changed to char offsets)
*/ */
class SourcePositionImpl implements SourcePosition { public class SourcePositionImpl implements SourcePosition {
String filename; FileObject filename;
int position; int position;
Position.LineMap lineMap; Position.LineMap lineMap;
/** The source file. Returns null if no file information is /** The source file. Returns null if no file information is
* available. */ * available. */
public File file() { public File file() {
return (filename == null) ? null : new File(filename); return (filename == null) ? null : new File(filename.getName());
}
/** The source file. Returns null if no file information is
* available. */
public FileObject fileObject() {
return filename;
} }
/** The line in the source file. The first line is numbered 1; /** The line in the source file. The first line is numbered 1;
...@@ -71,7 +78,7 @@ class SourcePositionImpl implements SourcePosition { ...@@ -71,7 +78,7 @@ class SourcePositionImpl implements SourcePosition {
} }
} }
private SourcePositionImpl(String file, int position, private SourcePositionImpl(FileObject file, int position,
Position.LineMap lineMap) { Position.LineMap lineMap) {
super(); super();
this.filename = file; this.filename = file;
...@@ -79,16 +86,27 @@ class SourcePositionImpl implements SourcePosition { ...@@ -79,16 +86,27 @@ class SourcePositionImpl implements SourcePosition {
this.lineMap = lineMap; this.lineMap = lineMap;
} }
public static SourcePosition make(String file, int pos, public static SourcePosition make(FileObject file, int pos,
Position.LineMap lineMap) { Position.LineMap lineMap) {
if (file == null) return null; if (file == null) return null;
return new SourcePositionImpl(file, pos, lineMap); return new SourcePositionImpl(file, pos, lineMap);
} }
public String toString() { public String toString() {
// Backwards compatibility hack. ZipFileObjects use the format
// zipfile(zipentry) but javadoc has been using zipfile/zipentry
String fn = filename.toString();
if (fn.endsWith(")")) {
int paren = fn.lastIndexOf("(");
if (paren != -1)
fn = fn.substring(0, paren)
+ File.separatorChar
+ fn.substring(paren + 1, fn.length() - 1);
}
if (position == Position.NOPOS) if (position == Position.NOPOS)
return filename; return fn;
else else
return filename + ":" + line(); return fn + ":" + line();
} }
} }
...@@ -51,6 +51,7 @@ public class TypeMaker { ...@@ -51,6 +51,7 @@ public class TypeMaker {
* @param errToClassDoc if true, ERROR type results in a ClassDoc; * @param errToClassDoc if true, ERROR type results in a ClassDoc;
* false preserves legacy behavior * false preserves legacy behavior
*/ */
@SuppressWarnings("fallthrough")
public static com.sun.javadoc.Type getType(DocEnv env, Type t, public static com.sun.javadoc.Type getType(DocEnv env, Type t,
boolean errToClassDoc) { boolean errToClassDoc) {
if (env.legacyDoclet) { if (env.legacyDoclet) {
......
...@@ -342,6 +342,6 @@ public abstract class Gen { ...@@ -342,6 +342,6 @@ public abstract class Gen {
fields.addAll(Arrays.asList(cd.fields())); fields.addAll(Arrays.asList(cd.fields()));
} }
return (FieldDoc[]) fields.toArray(new FieldDoc[fields.size()]); return fields.toArray(new FieldDoc[fields.size()]);
} }
} }
...@@ -32,6 +32,7 @@ package com.sun.tools.javap; ...@@ -32,6 +32,7 @@ package com.sun.tools.javap;
* deletion without notice.</b> * deletion without notice.</b>
*/ */
public class InternalError extends Error { public class InternalError extends Error {
private static final long serialVersionUID = 8114054446416187030L;
InternalError(Throwable t, Object... args) { InternalError(Throwable t, Object... args) {
super("Internal error", t); super("Internal error", t);
this.args = args; this.args = args;
......
/* /*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
package javax.lang.model.type; package javax.lang.model.type;
import java.io.ObjectInputStream;
import java.io.IOException;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import javax.lang.model.element.Element; import javax.lang.model.element.Element;
...@@ -67,4 +68,13 @@ public class MirroredTypeException extends RuntimeException { ...@@ -67,4 +68,13 @@ public class MirroredTypeException extends RuntimeException {
public TypeMirror getTypeMirror() { public TypeMirror getTypeMirror() {
return type; return type;
} }
/**
* Explicitly set all transient fields.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject();
type = null;
}
} }
/* /*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
package javax.lang.model.type; package javax.lang.model.type;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Collections; import java.util.Collections;
import java.io.ObjectInputStream;
import java.io.IOException;
import javax.lang.model.element.Element; import javax.lang.model.element.Element;
...@@ -49,8 +49,7 @@ public class MirroredTypesException extends RuntimeException { ...@@ -49,8 +49,7 @@ public class MirroredTypesException extends RuntimeException {
private static final long serialVersionUID = 269; private static final long serialVersionUID = 269;
// Should this be non-final for a custum readObject method? private transient List<? extends TypeMirror> types; // cannot be serialized
private final transient List<? extends TypeMirror> types; // cannot be serialized
/** /**
* Constructs a new MirroredTypesException for the specified types. * Constructs a new MirroredTypesException for the specified types.
...@@ -58,7 +57,9 @@ public class MirroredTypesException extends RuntimeException { ...@@ -58,7 +57,9 @@ public class MirroredTypesException extends RuntimeException {
* @param types the types being accessed * @param types the types being accessed
*/ */
public MirroredTypesException(List<? extends TypeMirror> types) { public MirroredTypesException(List<? extends TypeMirror> types) {
super("Attempt to access Class objects for TypeMirrors " + types); super("Attempt to access Class objects for TypeMirrors " +
(types = // defensive copy
new ArrayList<TypeMirror>(types)).toString() );
this.types = Collections.unmodifiableList(types); this.types = Collections.unmodifiableList(types);
} }
...@@ -72,4 +73,13 @@ public class MirroredTypesException extends RuntimeException { ...@@ -72,4 +73,13 @@ public class MirroredTypesException extends RuntimeException {
public List<? extends TypeMirror> getTypeMirrors() { public List<? extends TypeMirror> getTypeMirrors() {
return types; return types;
} }
/**
* Explicitly set all transient fields.
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject();
types = null;
}
} }
...@@ -719,6 +719,7 @@ public class JavapPrinter { ...@@ -719,6 +719,7 @@ public class JavapPrinter {
/** /**
* Print constant pool entry information. * Print constant pool entry information.
*/ */
@SuppressWarnings("fallthrough")
public int PrintlnConstantEntry(int cpx) { public int PrintlnConstantEntry(int cpx) {
int size=1; int size=1;
byte tag=0; byte tag=0;
...@@ -757,6 +758,7 @@ public class JavapPrinter { ...@@ -757,6 +758,7 @@ public class JavapPrinter {
case CONSTANT_LONG: case CONSTANT_LONG:
case CONSTANT_DOUBLE: case CONSTANT_DOUBLE:
size=2; size=2;
// fall through
default: default:
out.println(str+";"); out.println(str+";");
} }
......
/*
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6786682
* @summary This test verifies the use of lang attribute by <HTML>.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester
* @build TestHtmlTag
* @run main TestHtmlTag
*/
import java.util.Locale;
public class TestHtmlTag extends JavadocTester {
private static final String BUG_ID = "6786682";
private static final String[][] TEST1 = {
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<HTML lang=\"" + Locale.getDefault().getLanguage() + "\">"},
{BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<HTML lang=\"" + Locale.getDefault().getLanguage() + "\">"}};
private static final String[][] NEGATED_TEST1 = {
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<HTML>"}};
private static final String[][] TEST2 = {
{BUG_ID + FS + "pkg2" + FS + "C2.html", "<HTML lang=\"ja\">"},
{BUG_ID + FS + "pkg2" + FS + "package-summary.html", "<HTML lang=\"ja\">"}};
private static final String[][] NEGATED_TEST2 = {
{BUG_ID + FS + "pkg2" + FS + "C2.html", "<HTML>"}};
private static final String[][] TEST3 = {
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<HTML lang=\"en\">"},
{BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<HTML lang=\"en\">"}};
private static final String[][] NEGATED_TEST3 = {
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<HTML>"}};
private static final String[] ARGS1 =
new String[] {
"-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS2 =
new String[] {
"-locale", "ja", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg2"};
private static final String[] ARGS3 =
new String[] {
"-locale", "en_US", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestHtmlTag tester = new TestHtmlTag();
run(tester, ARGS1, TEST1, NEGATED_TEST1);
run(tester, ARGS2, TEST2, NEGATED_TEST2);
run(tester, ARGS3, TEST3, NEGATED_TEST3);
tester.printSummary();
}
/**
* {@inheritDoc}
*/
public String getBugId() {
return BUG_ID;
}
/**
* {@inheritDoc}
*/
public String getBugName() {
return getClass().getName();
}
}
/*
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package pkg1;
public class C1 {
public void method(int param1, int param2) {
}
}
/*
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package pkg2;
/**
* <B>Comments:</B> Class 2
*/
public class C2 {}
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6794959
* @summary add new switch -XDexpectKeys=key,key,...
* @compile T6794959.java
* @compile/fail -XDfailcomplete=java.lang.String T6794959.java
* @compile -XDfailcomplete=java.lang.String -XDexpectKeys=compiler.err.cant.resolve.location T6794959.java
* @compile/fail -XDexpectKeys=compiler.err.cant.resolve.location T6794959.java
*/
class T6794959 {
String s;
}
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @author Maurizio Cimadamore
* @bug 6795580
* @summary parser confused by square brackets in qualified generic cast
* @compile/fail/ref=T6795580.out -XDrawDiagnostics T6795580.java
*/
class T6795580 {
class Outer<S> {
class Inner<T> {}
}
void cast1(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<Integer>.Inner<Long>[])p;
}
void cast2(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<? extends Number>.Inner<Long>[])p;
}
void cast3(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<Integer>.Inner<? extends Number>[])p;
}
void cast4(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<? extends Number>.Inner<? extends Number>[])p;
}
void cast5(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<? super Number>.Inner<Long>[])p;
}
void cast6(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<Integer>.Inner<? super Number>[])p;
}
void cast7(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<? super Number>.Inner<? super Number>[])p;
}
void cast8(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<? extends String>.Inner<Long>[])p;
}
void cast9(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<Integer>.Inner<? extends String>[])p;
}
void cast10(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<? super String>.Inner<Long>[])p;
}
void cast11(Outer<Integer>.Inner<Long>[] p) {
Object o = (Outer<Integer>.Inner<? super String>[])p;
}
}
\ No newline at end of file
T6795580.java:54:57: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<java.lang.Long>[]
T6795580.java:58:60: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.Number>[]
T6795580.java:62:67: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>[]
T6795580.java:66:59: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? extends java.lang.String>.Inner<java.lang.Long>[]
T6795580.java:70:62: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? extends java.lang.String>[]
T6795580.java:74:57: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.String>.Inner<java.lang.Long>[]
T6795580.java:78:60: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.String>[]
7 errors
/*
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6557199
* @summary Fails to reject bad override of generic method
* @author Maurizio Cimadamore
* @compile/fail/ref=T6557199.out T6557199.java -XDrawDiagnostics
*/
class T6557199 {
static class X<S> {
public static <U> X<U> test() {
return null;
}
}
static class B extends X<B> {
public static B test() {
return null;
}
}
}
T6557199.java:40:25: compiler.err.prob.found.req: (- compiler.misc.override.incompatible.ret: (- compiler.misc.cant.override: test(), T6557199.B, <U>test(), T6557199.X)), T6557199.B, T6557199.X<U>
1 error
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册