java - Passing type-casted variables to a method for generic compilation -
i have system takes class name , enumerated soot -- gives details such methods in class, modifiers of said class, visibility, arguments methods, , more.
what take information , build java file instantiate class (through reflection or regular instantiation), call each method member of class, compile , use elsewhere in our system. i've got working 98~ of test cases. 2% fails on when object argument of method inner class (package.path.here.classname$innerclass variable type).
please note: i not care in method, care signature in enumeration phase.
the compiler error cannot find symbol when try compile class has method member who's arguments include package.path.here.classname$innerclass.
so input simple package.path.here.toenumerate:
package package.path.here; public class toenumerate { public toenumerate() { //irrelevant code here } public void method1(some.other.package.otherclass$innerclass c, long a) { // irrelevant code here } public void method1(int x, long b) { // irrelevant code here } public void method1(yet.another.package.yetanotherclass b, long a) { // irrelevant code here } public void method2(long b, boolean a) { // irrelevant code here } public int method3(int x) { // irrelevant code here } } through system generate java file looks this:
package package.path.here; // necessary imports auto generated public class toenumerate_main { public static void main(string[] args) { toenumerate inst = new toenumerate(); object obj = new object(); inst.method1((some.other.package.otherclass$innerclass) obj, (long) -1); inst.method1((int)-1, (long)-1); inst.method1((yet.another.package.yetanotherclass) obj, (long) -1); inst.method2((long)-1, false); inst.method3((int)-1); } } when compile with: javac -cp /path/to/all/my/classes toenumerate_main.java cannot find symbol in reference inner class. carrot points period between last package path , class name:
toenumerate_main.java:7: error: cannot find symbol inst.method1((some.other.package.otherclass$innerclass) obj, (long) -1); ^ symbol: class otherclass$innerclass location: package some.other.package even though can find file @ path, included in -cp argument javac.
if change toenumerate_main send object-based variables nulls reference method1 ambiguous expect signatures if 1 tried send null.
i'm not quite sure why cannot find symbol error thrown @ compilation because file exists. in identifying either why error thrown, why javac -cp... doesn't find file, or way work appreciated.
Comments
Post a Comment