JDK-4671844 : Javap output for static variables referenced from other classes confusing
  • Type: Bug
  • Component: tools
  • Sub-Component: javap
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-04-19
  • Updated: 2002-11-20
  • Resolved: 2002-11-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2 mantisFixed
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
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis FIXED IN: mantis INTEGRATED IN: mantis
2004-06-14

EVALUATION This is fixed as a side-effect of 4633400. ###@###.### 2002-11-19
2002-11-19