United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4671844 : Javap output for static variables referenced from other classes confusing

Details
Type:
Bug
Submit Date:
2002-04-19
Status:
Resolved
Updated Date:
2002-11-20
Project Name:
JDK
Resolved Date:
2002-11-20
Component:
tools
OS:
windows_2000
Sub-Component:
javap
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
1.4.2 (mantis)

Related Reports

Sub Tasks

Description

Name: nt126004			Date: 04/19/2002


FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

And
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
The output of javap -c on reference to static fields is
misleading. It should contain the containing class.

(This is undenialy minor but I wasted a bunch of time
tying to find a field that actually lives in another class.
And javap trivially knows this.)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. javap -c <ClassThatReferencesStaticField>

EXPECTED VERSUS ACTUAL BEHAVIOR :
It would be nice to see the containing class.

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
// Code
public class StaticTest{
    public StaticTest(){
        java.io.InputStream is = System.in;
    }
}

>javap -c StaticTest
Compiled from StaticTest.java
public class StaticTest extends java.lang.Object {
    public StaticTest();
}

Method StaticTest()
   0 aload_0
   1 invokespecial #1 <Method java.lang.Object()>
   4 getstatic #2 <Field java.io.InputStream in>   // On what class!?!?!?
   7 astore_1
   8 return
---------- END SOURCE ----------

CUSTOMER WORKAROUND :
- Look at source code
- grep for 'classname looking things' in class file (and then javap)
- Write one's own (which admittedly is not terribly difficult)
...
(Review ID: 144365) 
======================================================================

                                    

Comments
EVALUATION

This is fixed as a side-effect of 4633400.

###@###.### 2002-11-19
                                     
2002-11-19
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis

FIXED IN:
mantis

INTEGRATED IN:
mantis


                                     
2004-06-14



Hardware and Software, Engineered to Work Together