Menu ▾ ▴

#9 .class reference in inner class

closed-fixed
None
5
2003-01-11
2002-11-19
Anonymous
No

.class reference doesn't handled properly.
for example,

--------------------------
package test;
public class Main {
public static void main(String[]args) {
new Test();
}
static class Test {
Test() {
System.out.println("" + Test.class);
}
}
}
---------------------------

Test class renamed to a, but Test.class reference
still remains "test.Main$Test". I think this is a
bug in
proguard.classfile.util.ClassFileReferenceInitializer.java.

In ClassFileReferenceInitializer$MyClassForNameFinder#
visitMethodrefCpInfo() method,

----------------------------
isDotClassInvocation =
className .equals(classFile.getName()) && // remove
this LINE
methodName.equals(ClassConstants.INTERNAL_METHOD_NAME_DOT_CLASS)&&
(methodType.equals(ClassConstants.INTERNAL_METHOD_TYPE_DOT_CLASS_JAVAC)||
methodType.equals(ClassConstants.INTERNAL_METHOD_TYPE_DOT_CLASS_JIKES));
-----------------------------

className represents outer class, but
classFile.getName() represents inner class.
So they don't match.

Related

Bugs: #655

Discussion

  • Eric Lafortune

    Eric Lafortune - 2002-11-21

    Logged In: YES
    user_id=555208

    You're right. This way of compiling .class in inner classes
    seems to be a new feature of JDK 1.4. Your fix should work
    fine indeed.

    Since .class constructs can be compiled in any number of
    ways by different compilers, I can only try to keep up with
    the various signatures and then handle them properly.

    Thanks for your help!

    Eric.

     
  • Eric Lafortune

    Eric Lafortune - 2002-11-21
    • assigned_to: nobody --> lafortune
     
  • Eric Lafortune

    Eric Lafortune - 2003-01-11
    • status: open --> closed-fixed
     

Log in to post a comment.