static Object getConstPoolItem()

in dubbo-error-code-inspector/src/main/java/org/apache/dubbo/errorcode/extractor/JavassistUtils.java [74:95]


    static Object getConstPoolItem(ConstPool cp, int index) {

        if (getItemMethodCache == null) {
            Class<ConstPool> cpc = ConstPool.class;
            Method getItemMethod;
            try {
                getItemMethod = cpc.getDeclaredMethod("getItem", int.class);
                getItemMethod.setAccessible(true);

                getItemMethodCache = getItemMethod;

            } catch (NoSuchMethodException e) {
                throw new RuntimeException("Javassist internal method changed.", e);
            }
        }

        try {
            return getItemMethodCache.invoke(cp, index);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new RuntimeException("Javassist internal method changed.", e);
        }
    }