Package com.strobel.assembler.metadata

Examples of com.strobel.assembler.metadata.TypeDefinition


    }

    @Override
    public Void visitTypeDeclaration(final TypeDeclaration node, final Void _) {
        if (!(node.getParent() instanceof CompilationUnit)) {
            final TypeDefinition type = node.getUserData(Keys.TYPE_DEFINITION);

            if (type != null && AstBuilder.isMemberHidden(type, context)) {
                node.remove();
                return null;
            }
View Full Code Here


                //
                // Remove redundant default constructors.
                //

                final TypeDefinition declaringType = method.getDeclaringType();

                if (declaringType != null) {
                    final boolean hasOtherConstructors = any(
                        declaringType.getDeclaredMethods(),
                        new Predicate<MethodDefinition>() {
                            @Override
                            public boolean test(final MethodDefinition m) {
                                return m.isConstructor() &&
                                       !m.isSynthetic() &&
View Full Code Here

        if (currentMethod != null && AstBuilder.isMemberHidden(currentMethod, context)) {
            return false;
        }

        final TypeDefinition currentType = context.getCurrentType();

        if (currentType != null && AstBuilder.isMemberHidden(currentType, context)) {
            return false;
        }
View Full Code Here

        if (method.isStatic() || method.isConstructor() || method.isTypeInitializer()) {
            return;
        }

        final TypeDefinition declaringType = method.getDeclaringType();

        if (declaringType.getCompilerMajorVersion() < CompilerTarget.JDK1_6.majorVersion) {
            return;
        }

        final TypeReference annotationType = new MetadataParser(declaringType).parseTypeDescriptor(OVERRIDE_ANNOTATION_NAME);
View Full Code Here

    @Override
    public Void visitObjectCreationExpression(final ObjectCreationExpression node, final Void _) {
        super.visitObjectCreationExpression(node, _);

        final TypeReference type = node.getType().getUserData(Keys.TYPE_REFERENCE);
        final TypeDefinition resolvedType = type != null ? type.resolve() : null;

        if (resolvedType != null && isLocalOrAnonymous(resolvedType)) {
            List<ObjectCreationExpression> instantiations = _instantiations.get(type);

            if (instantiations == null) {
View Full Code Here

    @Override
    public Void visitAnonymousObjectCreationExpression(final AnonymousObjectCreationExpression node, final Void _) {
        super.visitAnonymousObjectCreationExpression(node, _);

        final TypeDefinition resolvedType = node.getTypeDeclaration().getUserData(Keys.TYPE_DEFINITION);

        if (resolvedType != null && isLocalOrAnonymous(resolvedType)) {
            List<ObjectCreationExpression> instantiations = _instantiations.get(resolvedType);

            if (instantiations == null) {
View Full Code Here

            super(context);
        }

        @Override
        public Void visitTypeDeclaration(final TypeDeclaration typeDeclaration, final Void _) {
            final TypeDefinition type = typeDeclaration.getUserData(Keys.TYPE_DEFINITION);

            if (type != null && (isLocalOrAnonymous(type) || type.isAnonymous())) {
                _localTypes.put(type, typeDeclaration);
            }

            return super.visitTypeDeclaration(typeDeclaration, _);
        }
View Full Code Here

    private String qualifyReference(final AstNode node, final TypeReference type) {
        if (type == null || type.isGenericParameter() || type.isWildcardType()) {
            return null;
        }

        final TypeDefinition resolvedType = type.resolve();
        final TypeReference t = resolvedType != null ? resolvedType : (type.isGenericType() ? type.getUnderlyingType() : type);
        final Object resolvedObject = resolveName(node, t.getSimpleName(), modeForType(node));

        if (resolvedObject instanceof TypeReference &&
            MetadataHelper.isSameType(t, (TypeReference) resolvedObject)) {
View Full Code Here

        else {
            return;
        }

        final MetadataParser parser;
        final TypeDefinition currentType = context.getCurrentType();

        if (currentType != null) {
            parser = new MetadataParser(currentType);
        }
        else {
            parser = new MetadataParser(IMetadataResolver.EMPTY);
        }

        final TypeReference declaringType = parser.parseTypeDescriptor("java/lang/" + jvmType.name());
        final FieldReference field = parser.parseField(declaringType, fieldName, jvmType.getDescriptorPrefix());

        if (currentType != null &&
            node.getParent() instanceof VariableInitializer &&
            node.getParent().getParent() instanceof FieldDeclaration &&
            StringUtilities.equals(currentType.getInternalName(), declaringType.getInternalName())) {

            final FieldDeclaration declaration = (FieldDeclaration) node.getParent().getParent();
            final FieldDefinition actualField = declaration.getUserData(Keys.FIELD_DEFINITION);

            if (actualField == null || StringUtilities.equals(actualField.getName(), fieldName)) {
View Full Code Here

        }

        @Override
        public Void visitTypeDeclaration(final TypeDeclaration typeDeclaration, final Void _) {
            final boolean oldIsSwitchMapWrapper = _isSwitchMapWrapper;
            final TypeDefinition typeDefinition = typeDeclaration.getUserData(Keys.TYPE_DEFINITION);
            final boolean isSwitchMapWrapper = isSwitchMapWrapper(typeDefinition);

            if (isSwitchMapWrapper) {
                final String internalName = typeDefinition.getInternalName();

                SwitchMapInfo info = _switchMaps.get(internalName);

                if (info == null) {
                    _switchMaps.put(internalName, info = new SwitchMapInfo(internalName));
View Full Code Here

TOP

Related Classes of com.strobel.assembler.metadata.TypeDefinition

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.