private Class findArrayClassType()

in src/main/java/com/ql/util/express/instruction/op/OperatorAnonymousNewArray.java [35:59]


    private Class<?> findArrayClassType(InstructionSetContext instructionSetContext, ArraySwap list) throws Exception {
        Class<?> type = null;
        for (int i = 0; i < list.length; i++) {
            Class<?> type1 = list.get(i).getType(instructionSetContext);
            if (type1 == null) {
                //doNothing
            } else if (type == null) {
                //第一次赋值
                type = type1;
            } else if (type1 == type || type.isAssignableFrom(type1)) {
                //type1是type的子类
                //doNothing
            } else if (type1.isAssignableFrom(type)) {
                //寻找更基础的类
                type = type1;
            } else {
                type = Object.class;
            }
        }
        if (type == null) {
            //参数全部为null的情况
            type = Object.class;
        }
        return type;
    }