JDK-6778491 : javac cannot find all classes from rt.jar
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2008-12-01
  • Updated: 2010-05-10
  • Resolved: 2008-12-01
Description
FULL PRODUCT VERSION :
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6001]

A DESCRIPTION OF THE PROBLEM :
In jdk/lib/ct.sym are not all classes from rt.jar.
For example com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper is missing.
So it is not possible to compile a class depending on such class.

Example:

/////////////Java-File Start
package gbo.test;

import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;

public class NamespacePrefixTest extends NamespacePrefixMapper
{

    @Override
    public String getPreferredPrefix(String arg0, String arg1, boolean arg2)
    {
        return "test";
    }
}
/////////////Java-File End

Compiler:
D:\dev\src\gbo\test>javac NamespacePrefixTest.java
NamespacePrefixTest.java:3: package com.sun.xml.internal.bind.marshaller does not exist
import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;
                                           ^
NamespacePrefixTest.java:5: cannot find symbol
symbol: class NamespacePrefixMapper
public class NamespacePrefixTest extends NamespacePrefixMapper
                                         ^
NamespacePrefixTest.java:8: method does not override or implement a method from a supertype
    @Override
    ^
3 errors

Compiling in NetBeans produces the same error.
Compiling in Eclipse works.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
it should compile without error.

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
delete jdk/lib/ct.sym or
use Eclipse compiler

Comments
EVALUATION This is not a compiler issue. javac is behaving correctly, according to the information provided in ct.sym. The issue belongs with those who decide what should be available with (and what should be hidden by) ct.sym I cannot as yet determine the correct category for this bug.
04-03-2009

EVALUATION This is intentional. Perhaps the package name "com.sun.xml.internal...." might be seen as a hint. Users should not write code that depends on internal JDK implementation classes. Such classes are internal implementation details of the JDK and subject to change without notice.
01-12-2008