United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6507179 javadoc -source 1.3 does not work with jdk6
JDK-6507179 : javadoc -source 1.3 does not work with jdk6

Details
Type:
Bug
Submit Date:
2006-12-21
Status:
Resolved
Updated Date:
2011-03-01
Project Name:
JDK
Resolved Date:
2007-04-07
Component:
tools
OS:
linux
Sub-Component:
javadoc(tool)
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
6u2 (b02)

Related Reports
Backport:
Backport:

Sub Tasks

Description
FULL PRODUCT VERSION :
betelgeuse@pena ~/test/java $ java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
betelgeuse@pena ~/test/java $ uname -a
Linux pena 2.6.19-gentoo-r2 #6 SMP Sat Dec 16 23:59:19 EET 2006 i686 Intel(R) Core(TM)2 CPU          6600  @ 2.40GHz GenuineIntel GNU/Linux

A DESCRIPTION OF THE PROBLEM :
javadoc -source 1.3 does not work any more with 1.6. This behaviour is inconsistent with the help message when running javadoc without -source 1.3 and -source 1.3 used to work correctly in 1.5.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run javadoc -source 1.3 on a code containing assert in a place where a keyword is expected.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
  From 1.5:
betelgeuse@pena ~/test/java $ java -version
java version "1.5.0_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) Server VM (build 1.5.0_10-b03, mixed mode)
betelgeuse@pena ~/test/java $ javadoc -source 1.3 Hello.java
Loading source file Hello.java...
Hello.java:3: warning: as of release 1.4, 'assert' is a keyword, and may not be used as an identifier
(try -source 1.4 or higher to use 'assert' as a keyword)
        private void assert(){;}
                     ^
Constructing Javadoc information...
Standard Doclet version 1.5.0_10
Building tree for all the packages and classes...
Generating Hello.html...
Generating package-frame.html...
Generating package-summary.html...
Generating package-tree.html...
Generating constant-values.html...
Building index for all the packages and classes...
Generating overview-tree.html...
Generating index-all.html...
Generating deprecated-list.html...
Building index for all classes...
Generating allclasses-frame.html...
Generating allclasses-noframe.html...
Generating index.html...
Generating help-doc.html...
Generating stylesheet.css...
1 warning

ACTUAL -
betelgeuse@pena ~/test/java $ javadoc -source 1.3 Hello.java
Loading source file Hello.java...
Hello.java:3: as of release 1.4, 'assert' is a keyword, and may not be used as an identifier
(use -source 1.3 or lower to use 'assert' as an identifier)
        private void assert(){;}
                     ^
1 error
betelgeuse

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
betelgeuse@pena ~/test/java $ cat Hello.java
public class Hello
{
        private void assert(){;}
        public static void main(String[] args)
        {
                System.out.println("Hello World!");
        }
}

---------- END SOURCE ----------

                                    

Comments
EVALUATION

The Source object is being initialized before the "-source" option
has been parsed.

The javadoc tool initializes its Messager (a javac Log) early on:
even before the command line is fully parsed, since it uses the Messager
in several ways during parsing.

Before JDK 6 this was safe, as the Log didn't access the
Source object.  But since JDK 6 it does access it, to determine
if mandatory warnings are in effect.  Thus the Source object
is being initialized earlier now, leading to the problem.
                                     
2007-03-14



Hardware and Software, Engineered to Work Together