| 1900 | } |
| 1901 | |
| 1902 | static class InstanceMethodExpr extends MethodExpr{ |
| 1903 | public final Expr target; |
| 1904 | public final String methodName; |
| 1905 | public final IPersistentVector args; |
| 1906 | public final String source; |
| 1907 | public final int line; |
| 1908 | public final int column; |
| 1909 | public final Symbol tag; |
| 1910 | public final boolean tailPosition; |
| 1911 | public final java.lang.reflect.Method method; |
| 1912 | public final Class qualifyingClass; |
| 1913 | Class jc; |
| 1914 | |
| 1915 | final static Method invokeInstanceMethodMethod = |
| 1916 | Method.getMethod("Object invokeInstanceMethod(Object,String,Object[])"); |
| 1917 | final static Method invokeInstanceMethodOfClassMethod = |
| 1918 | Method.getMethod("Object invokeInstanceMethodOfClass(Object,String,String,Object[])"); |
| 1919 | |
| 1920 | public InstanceMethodExpr(String source, int line, int column, Symbol tag, Expr target, |
| 1921 | Class qualifyingClass, String methodName, java.lang.reflect.Method resolvedMethod, |
| 1922 | IPersistentVector args, boolean tailPosition) |
| 1923 | { |
| 1924 | checkMethodArity(resolvedMethod, RT.count(args)); |
| 1925 | |
| 1926 | this.source = source; |
| 1927 | this.line = line; |
| 1928 | this.column = column; |
| 1929 | this.args = args; |
| 1930 | this.methodName = methodName; |
| 1931 | this.target = target; |
| 1932 | this.tag = tag; |
| 1933 | this.tailPosition = tailPosition; |
| 1934 | this.method = resolvedMethod; |
| 1935 | this.qualifyingClass = qualifyingClass; |
| 1936 | } |
| 1937 | |
| 1938 | public InstanceMethodExpr(String source, int line, int column, Symbol tag, Expr target, |
| 1939 | Class qualifyingClass, String methodName, IPersistentVector args, boolean tailPosition) |
| 1940 | { |
| 1941 | this.source = source; |
| 1942 | this.line = line; |
| 1943 | this.column = column; |
| 1944 | this.args = args; |
| 1945 | this.methodName = methodName; |
| 1946 | this.target = target; |
| 1947 | this.tag = tag; |
| 1948 | this.tailPosition = tailPosition; |
| 1949 | this.qualifyingClass = qualifyingClass; |
| 1950 | Class contextClass = qualifyingClass != null ? qualifyingClass : |
| 1951 | (target.hasJavaClass() ? target.getJavaClass() : null); |
| 1952 | if(contextClass != null) |
| 1953 | { |
| 1954 | List methods = Reflector.getMethods(contextClass, args.count(), methodName, false); |
| 1955 | if(methods.isEmpty()) |
| 1956 | { |
| 1957 | method = null; |
| 1958 | if(RT.booleanCast(RT.WARN_ON_REFLECTION.deref())) |
| 1959 | { |