4785 |
4785 |
return true;
|
4786 |
4786 |
}
|
4787 |
4787 |
|
|
4788 |
public static class ObjectInternalEntryCacheKey
|
|
4789 |
{
|
|
4790 |
private Class aClass;
|
|
4791 |
private String modes;
|
|
4792 |
private Class[] argsClasses;
|
|
4793 |
private int hashCode;
|
|
4794 |
|
|
4795 |
public ObjectInternalEntryCacheKey(Class aClass, String modes, Class[] argsClasses)
|
|
4796 |
{
|
|
4797 |
this.aClass = aClass;
|
|
4798 |
this.modes = modes;
|
|
4799 |
this.argsClasses = argsClasses;
|
|
4800 |
|
|
4801 |
int result = Objects.hash(aClass, modes);
|
|
4802 |
result = 31 * result + Arrays.hashCode(argsClasses);
|
|
4803 |
this.hashCode = result;
|
|
4804 |
}
|
|
4805 |
|
|
4806 |
@Override
|
|
4807 |
public boolean equals(Object o)
|
|
4808 |
{
|
|
4809 |
if (this == o)
|
|
4810 |
{
|
|
4811 |
return true;
|
|
4812 |
}
|
|
4813 |
if (o == null)
|
|
4814 |
{
|
|
4815 |
return false;
|
|
4816 |
}
|
|
4817 |
ObjectInternalEntryCacheKey that = (ObjectInternalEntryCacheKey) o;
|
|
4818 |
return Objects.equals(aClass, that.aClass) &&
|
|
4819 |
Objects.equals(modes, that.modes) &&
|
|
4820 |
Arrays.equals(argsClasses, that.argsClasses);
|
|
4821 |
}
|
|
4822 |
|
|
4823 |
@Override
|
|
4824 |
public int hashCode()
|
|
4825 |
{
|
|
4826 |
return hashCode;
|
|
4827 |
}
|
|
4828 |
|
|
4829 |
@Override
|
|
4830 |
public String toString()
|
|
4831 |
{
|
|
4832 |
return "ObjectInternalEntryCacheKey{" +
|
|
4833 |
"aClass=" + aClass +
|
|
4834 |
", modes='" + modes + '\'' +
|
|
4835 |
", argsClasses=" + Arrays.toString(argsClasses) +
|
|
4836 |
'}';
|
|
4837 |
}
|
|
4838 |
}
|
|
4839 |
|
4788 |
4840 |
/**
|
4789 |
4841 |
* Given a legacy class instance, execute the initialization methods. These are comprised from
|
4790 |
4842 |
* the synthetic execute methods (for all super-classes), and the synthetic constructor method
|
... | ... | |
4814 |
4866 |
wa.pm.addProcedure(phandle, name, true);
|
4815 |
4867 |
|
4816 |
4868 |
BufferManager.get().resolvePendingBufferClasses(referent);
|
4817 |
|
|
4818 |
|
List<InternalEntry> ctors = SourceNameMapper.getConstructors((Class) referent.getClass());
|
4819 |
|
|
4820 |
|
InternalEntry ie = resolveLegacyEntry(wa, false, referent.getClass(), name, null, modes, ctors, args);
|
|
4869 |
|
|
4870 |
Class refClass = referent.getClass();
|
|
4871 |
List<InternalEntry> ctors = SourceNameMapper.getConstructors(refClass);
|
|
4872 |
|
|
4873 |
Class[] argsClasses = new Class[args == null ? 0 : args.length];
|
|
4874 |
for (int i = 0; i < argsClasses.length; i++)
|
|
4875 |
{
|
|
4876 |
argsClasses[i] = args[i].getClass();
|
|
4877 |
}
|
|
4878 |
|
|
4879 |
ObjectInternalEntryCacheKey key = new ObjectInternalEntryCacheKey(refClass, modes, argsClasses);
|
|
4880 |
InternalEntry ie = wa.cachedObjectIEntries.get(key);
|
|
4881 |
System.out.println(key + " -> " + ie);
|
4821 |
4882 |
if (ie == null)
|
4822 |
4883 |
{
|
|
4884 |
ie = resolveLegacyEntry(wa, false, refClass, name, null, modes, ctors, args);
|
|
4885 |
if (ie == null)
|
|
4886 |
{
|
|
4887 |
ie = InternalEntry.NULL;
|
|
4888 |
}
|
|
4889 |
wa.cachedObjectIEntries.put(key, ie);
|
|
4890 |
System.out.println(key + " put " + ie);
|
|
4891 |
}
|
|
4892 |
if (ie == InternalEntry.NULL)
|
|
4893 |
{
|
4823 |
4894 |
// not found
|
4824 |
4895 |
return false;
|
4825 |
4896 |
}
|
... | ... | |
4882 |
4953 |
// use the method resolved after arg validation.
|
4883 |
4954 |
ctorCaller.mthd = ie.getMethod();
|
4884 |
4955 |
|
|
4956 |
InternalEntry finalIe = ie;
|
4885 |
4957 |
Runnable push = () ->
|
4886 |
4958 |
{
|
4887 |
|
Class<?> def = ie.getMethod().getDeclaringClass();
|
|
4959 |
Class<?> def = finalIe.getMethod().getDeclaringClass();
|
4888 |
4960 |
wa.pm.pushCalleeInfo(def, false, referent, referent, "CONSTRUCTOR", relName, false, false);
|
4889 |
4961 |
};
|
4890 |
4962 |
|
... | ... | |
9040 |
9112 |
|
9041 |
9113 |
/** Cached resolved procedure internal entries */
|
9042 |
9114 |
private HashMap<InternalResolver.InternalEntryCacheKey, InternalEntry> cachedIEntries = new HashMap<>();
|
|
9115 |
|
|
9116 |
private HashMap<ObjectInternalEntryCacheKey, InternalEntry> cachedObjectIEntries = new HashMap<>();
|
9043 |
9117 |
|
9044 |
9118 |
private WorkArea()
|
9045 |
9119 |
{
|