|
From: <fra...@us...> - 2009-08-18 22:25:23
|
Revision: 1839
http://javapathfinder.svn.sourceforge.net/javapathfinder/?rev=1839&view=rev
Author: frankrimlinger
Date: 2009-08-18 22:25:13 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
More subtle class name rehab in progress.
LDC is turning into a real headache. A class name is not a type, so LDC is going to load java.lang.String, NOT Ljava.lang.String;. This means you can't use Types.getTypeName() to convert to java syntax, because it will gag on java.lang.String. Instead, use FormalTypes.jvmClassNameToSourceCodeClassName(). So what should this routine do with "I". Should it return "I" or "int". To find out, consider this example:
public class I {
static Class<?> whatHappens(){
return I.class;
}
static Class<?> whatHappens1(){
return int.class;
}
static Class<?> whatHappens2(){
return I[].class;
}
}
The method whatHappens will perform LDC "I" of CLASS type, and whatHappens2 does LDC "[LI;" , but whatHappens1 is a real cop-out:
putstatic java.lang.Integer.TYPE
Sure enough, in the java doc,
static?\194?\160Class<Integer> TYPE The Class instance representing the primitive type int.
So, we assume that LDC never gets a primitive type name as a CLASS type. Therefore, FormalTypes.jvmClassNameToSourceCodeClassName() should just wrap with L; if there are no brackets, and then pass to Types.getTypeName(), which will then return the correct source code level name. If there are brackets, you can pass directly to getTypeName(), this is canonical name syndrome.
So far so good, but now there is unfinished business. We really can't mess with java.lang.Integer.TYPE, as it represents a documented field of the Integer class. But we are already using "int" to represent the "class of the primitive type int". This could lead to problems, but oh well...
In any event, need MangoFieldPeer class, because fields do need to be converted to MangoFormal syntax, i.e., java.lang.Integer_MangoFormal.TYPE.
jvmClassNameToSourceCodeClassName() is tested and working as expected. Now clean up the fields with MangoFieldPeer.
Modified Paths:
--------------
branches/mango/Mango/javapathfinder-mango-bridge/mango/FormalTypes.java
branches/mango/Mango/javapathfinder-mango-bridge/mango/scanner/CodeSurvey.java
branches/mango/Mango/javapathfinder-mango-bridge/mango/scanner/bytecode/LDC.java
branches/mango/Mango/mangoUserHome/frank/rules/rulebase.zip
branches/mango/Mango/mangoUserHome/frank/sessions/a.zip
branches/mango/Mango/mangoUserHome/system/SystemTests/src/systemTests/ClassTests.java
Added Paths:
-----------
branches/mango/Mango/mangoUserHome/frank/sessions/java/lang/Class_MangoFormal/isAssignableFrom(Ljava.lang.Class_MangoFormal;)Z/
branches/mango/Mango/mangoUserHome/frank/sessions/java/lang/Class_MangoFormal/isAssignableFrom(Ljava.lang.Class_MangoFormal;)Z/cls is defined.zip
branches/mango/Mango/mangoUserHome/frank/sessions/java/lang/Class_MangoFormal/isAssignableFrom(Ljava.lang.Class_MangoFormal;)Z/cls is undefined.zip
branches/mango/Mango/mangoUserHome/frank/sessions/java/lang/Class_MangoFormal/isPrimitive()Z/
branches/mango/Mango/mangoUserHome/frank/sessions/java/lang/Class_MangoFormal/isPrimitive()Z/case.zip
branches/mango/Mango/mangoUserHome/system/SystemTests/src/I.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|