Java Code Examples for net.bytebuddy.description.type.TypeDescription#getInternalName()

The following examples show how to use net.bytebuddy.description.type.TypeDescription#getInternalName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransformerInvokerGenerator.java    From Diorite with MIT License 6 votes vote down vote up
@Override
        public ClassVisitor wrap(TypeDescription typeDescription, ClassVisitor cv, Context context, TypePool typePool,
                                 FieldList<FieldDescription.InDefinedShape> fieldList, MethodList<?> methodList, int i, int i1)
        {
//            public void visit(int version, int modifiers, String name, String signature, String superName, String[] interfaces) {
            cv.visit(ClassFileVersion.JAVA_V9.getMinorMajorVersion(), typeDescription.getModifiers(), typeDescription.getInternalName(), null,
                     typeDescription.getSuperClass().asErasure().getInternalName(), typeDescription.getInterfaces().asErasures().toInternalNames());
            TypeDescription clazz = this.clazz;
            String internalName = clazz.getInternalName();
            String descriptor = clazz.getDescriptor();
            MethodList<InDefinedShape> declaredMethods = clazz.getDeclaredMethods();
            int methodsSize = declaredMethods.size();
            String implName = GENERATED_PREFIX + "." + clazz.getName();
            String internalImplName = GENERATED_PREFIX.replace('.', '/') + "/" + internalName;
            String descriptorImplName = "L" + GENERATED_PREFIX.replace('.', '/') + "/" + internalName + ";";

            FieldVisitor fv;
            MethodVisitor mv;
            AnnotationVisitor av0;

            cv.visitEnd();
            return cv;
        }
 
Example 2
Source File: ClassWriterStrategy.java    From byte-buddy with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
protected String getCommonSuperClass(String leftTypeName, String rightTypeName) {
    TypeDescription leftType = typePool.describe(leftTypeName.replace('/', '.')).resolve();
    TypeDescription rightType = typePool.describe(rightTypeName.replace('/', '.')).resolve();
    if (leftType.isAssignableFrom(rightType)) {
        return leftType.getInternalName();
    } else if (leftType.isAssignableTo(rightType)) {
        return rightType.getInternalName();
    } else if (leftType.isInterface() || rightType.isInterface()) {
        return TypeDescription.OBJECT.getInternalName();
    } else {
        do {
            leftType = leftType.getSuperClass().asErasure();
        } while (!leftType.isAssignableFrom(rightType));
        return leftType.getInternalName();
    }
}
 
Example 3
Source File: TypeReferenceAdjustment.java    From byte-buddy with Apache License 2.0 5 votes vote down vote up
@Override
public void visitEnd() {
    for (String observedType : observedTypes) {
        if (visitedInnerTypes.add(observedType)) {
            TypePool.Resolution resolution = typePool.describe(observedType.replace('/', '.'));
            if (resolution.isResolved()) {
                TypeDescription typeDescription = resolution.resolve();
                if (!filter.matches(typeDescription)) {
                    while (typeDescription != null && typeDescription.isNestedClass()) {
                        super.visitInnerClass(typeDescription.getInternalName(),
                                typeDescription.isMemberType()
                                        ? typeDescription.getDeclaringType().getInternalName()
                                        : null,
                                typeDescription.isAnonymousType()
                                        ? null
                                        : typeDescription.getSimpleName(),
                                typeDescription.getModifiers());
                        try {
                            do {
                                typeDescription = typeDescription.getEnclosingType();
                            } while (typeDescription != null && !visitedInnerTypes.add(typeDescription.getInternalName()));
                        } catch (RuntimeException exception) {
                            if (strict) {
                                throw exception;
                            } else {
                                break;
                            }
                        }
                    }
                }
            } else if (strict) {
                throw new IllegalStateException("Could not locate type for: " + observedType.replace('/', '.'));
            }
        }
    }
    super.visitEnd();
}
 
Example 4
Source File: ArrayFactory.java    From byte-buddy with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new array creator for a reference type.
 *
 * @param referenceType The internal name of this array's non-primitive component type.
 */
protected ForReferenceType(TypeDescription referenceType) {
    this.internalTypeName = referenceType.getInternalName();
}