• Join/Login
  • Business Software
  • Open Source Software
  • For Vendors
  • Blog
  • About
  • More
    • Articles
    • Create
    • SourceForge Podcast
    • Site Documentation
    • Subscribe to our Newsletter
    • Support Request
SourceForge logo
For Vendors Help Create Join Login
SourceForge logo
Business Software
Open Source Software
SourceForge Podcast
Resources
  • Articles
  • Case Studies
  • Blog
Menu
  • Help
  • Create
  • Join
  • Login
  • Home
  • Browse
  • JReversePro - Java Decompiler
  • Bugs

Type of local variable incorrect

Status: Alpha
Brought to you by: akkumar
  • Summary
  • Files
  • Reviews
  • Support
  • Mailing Lists
  • Tickets ▾
    • Bugs
    • Support Requests
    • Feature Requests
  • News
  • Donate
  • CVS
Menu ▾ ▴
  • Create Ticket
  • View Stats

Group

  • v1.0_(example)

Searches

  • Changes
  • Closed Tickets
  • Open Tickets

Help

  • Formatting Help

#36 Type of local variable incorrect

open
nobody
None
5
2003-01-10
2003-01-10
Mike Van Emmerik
No

Line 9 of method f below is decompiled incorrectly (no
error message). Test program (concat of 4 .java files):

public class Circle implements Drawable {
public int radius;
public Circle(int r) {radius = r;}
public boolean isFat() {return false;}
public void draw() {
// Code to draw...
}
}

public class Rectangle implements Drawable {
public short height, width;
public Rectangle(short h, short w) {
height = h; width = w; }
public boolean isFat() {return (width > height);}
public void draw() {
// Code to draw ...
}
}
public interface Drawable {
public void draw();
}

public class Main {

public static void f(short i) {
Circle c; Rectangle r; Drawable d;
boolean is_fat;

if (i > 10) { // 6
r = new Rectangle(i, i); // 7
is_fat = r.isFat(); // 8
d = r; // 9
}
else {
c = new Circle(i); // 12
is_fat = c.isFat(); // 13
d = c; // 14
}
if (!is_fat) d.draw(); // 16
} // 17

public static void main(String args[])
{ f((short) 11); }
}

Version 1.4.1 produces the following incorrect code for f:
public static void f(short i)
{
boolean j;
Drawable drawable;
Circle circle;
if (i > 10) {
Rectangle rectangle = new Rectangle(i , i);
j = rectangle.isFat();
Rectangle rectangle3 = rectangle; // Error!
}
else {
circle = new Circle(i);
j = circle.isFat();
drawable = circle;
}
if (!j)
drawable.draw();

return;
}

This may be a design problem; I'd be very interested to
see if you can fix this. For more details, see

http://www.stratego-language.org/twiki/bin/view/Transform/DeCompilationJrpTest#Sable_Test_Program

Discussion

  • Mike Van Emmerik

    Mike Van Emmerik - 2003-01-10
     
    sample.zip
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Log in to post a comment.

SourceForge
  • Create a Project
  • Open Source Software
  • Business Software
  • Top Downloaded Projects
Company
  • About
  • Team
  • SourceForge Headquarters
    1320 Columbia Street Suite 310
    San Diego, CA 92101
    +1 (858) 422-6466
Resources
  • Support
  • Site Documentation
  • Site Status
  • SourceForge Reviews
SourceForge logo
© 2026 Slashdot Media. All Rights Reserved.
Terms Privacy Opt Out Advertise
MongoDB Logo MongoDB