Package org.cojen.classfile

Examples of org.cojen.classfile.TypeDesc


            b.returnValue(TypeDesc.BOOLEAN);

            isInstance.setLocation();
        }

        final TypeDesc atomicRefType = TypeDesc.forClass(AtomicReference.class);

        // Load wrapped object...
        b.loadThis();
        b.loadField(REF_FIELD_NAME, atomicRefType);
        b.invokeVirtual(atomicRefType, "get", TypeDesc.OBJECT, null);
View Full Code Here


            cf.markSynthetic();
            cf.setSourceFile(PatternMatcher.class.getName());
           
            // constructor
            TypeDesc objectArrayType = TypeDesc.OBJECT.toArrayType();
            TypeDesc[] params = {objectArrayType};
            MethodInfo mi = cf.addConstructor(Modifiers.PUBLIC, params);
            mBuilder = new CodeBuilder(mi);
            mBuilder.loadThis();
            mBuilder.loadLocal(mBuilder.getParameter(0));
            mBuilder.invokeSuperConstructor(params);
            mBuilder.returnVoid();

            mIntType = TypeDesc.INT;
            mBooleanType = TypeDesc.BOOLEAN;
            mListType = TypeDesc.forClass(List.class);
            mStringType = TypeDesc.STRING;
            mObjectType = TypeDesc.OBJECT;
            mIntArrayType = TypeDesc.INT.toArrayType();

            // fillMatchResults method
            TypeDesc charArrayType = TypeDesc.CHAR.toArrayType();
            params = new TypeDesc[]{charArrayType, mIntType, mListType};
            mi = cf.addMethod(Modifiers.PUBLIC, "fillMatchResults", null, params);
            mBuilder = new CodeBuilder(mi);

            mLookupLocal = mBuilder.getParameter(0);
View Full Code Here

        if (parseTag() != TAG_ANNOTATION) {
            throw error("Malformed");
        }

        TypeDesc rootAnnotationType = parseTypeDesc();

        if (rootAnnotation == null) {
            rootAnnotation = buildRootAnnotation(rootAnnotationType);
        } else if (!rootAnnotationType.equals(rootAnnotation.getType())) {
            throw new IllegalArgumentException
                ("Annotation type of \"" + rootAnnotationType +
                 "\" does not match expected type of \"" + rootAnnotation.getType());
        }
View Full Code Here

                endPos = nextTerminator();
                int dot = mStr.lastIndexOf('.', endPos);
                if (dot < mPos) {
                    throw error("Invalid enumeration");
                }
                TypeDesc type = TypeDesc.forClass(mStr.substring(mPos, dot));
                mPos = dot + 1;
                return type;

            case TAG_BOOLEAN:
            case TAG_BYTE:
            case TAG_SHORT:
            case TAG_CHAR:
            case TAG_INT:
            case TAG_LONG:
            case TAG_FLOAT:
            case TAG_DOUBLE:
            case TAG_VOID:
                endPos = mPos + 1;
                break;

            case TAG_OBJECT:
                endPos = nextTerminator() + 1;
                break;
            }

            TypeDesc type = TypeDesc.forDescriptor(mStr.substring(mPos, endPos));
            mPos = endPos;

            return type;
        } catch (IndexOutOfBoundsException e) {
            throw error("Invalid type descriptor");
View Full Code Here

                   
                    switch (methodType) {
                    case READ_METHOD: case TRY_READ_METHOD: default: {
                        b.loadLocal(beanVar);
                        b.invoke(bp.getReadMethod());
                        TypeDesc type = TypeDesc.forClass(bp.getType());
                        b.convert(type, type.toObjectType());
                        b.returnValue(TypeDesc.OBJECT);
                        break;
                    }
                    case WRITE_METHOD: case TRY_WRITE_METHOD: {
                        b.loadLocal(beanVar);
                        b.loadLocal(valueVar);
                        TypeDesc type = TypeDesc.forClass(bp.getType());
                        b.checkCast(type.toObjectType());
                        b.convert(type.toObjectType(), type);
                        b.invoke(bp.getWriteMethod());
                        if (methodType == WRITE_METHOD) {
                            b.returnVoid();
                        } else {
                            b.loadConstant(true);
View Full Code Here

    /**
     * Used to describe an array class.
     */
    public ConstantClassInfo(ConstantPool cp, String className, int dim) {
        super(TAG_CLASS);
        TypeDesc type = TypeDesc.forClass(className);
        String desc;
        if (dim > 0) {
            while (--dim >= 0) {
                type = type.toArrayType();
            }
            desc = type.getDescriptor();
        } else {
            desc = className.replace('.', '/');
        }
        mType = type;
        mNameConstant = cp.addConstantUTF(desc);
View Full Code Here

TOP

Related Classes of org.cojen.classfile.TypeDesc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.