@Override public boolean isVisible(/* @NonNull */ JvmMember member) { return member.getVisibility() != JvmVisibility.PRIVATE; } };
@Override public boolean isVisible(/* @NonNull */ JvmMember member) { return member.getVisibility() == JvmVisibility.PUBLIC; }
public ITreeAppendable generateVisibilityModifier(final JvmMember it, final ITreeAppendable result) { return result.append(this.javaName(it.getVisibility())); }
/** Replies if the target feature is visible from the type. * * @param fromType - the type from which the feature visibility is tested. * @param target - the feature to test for the visibility. * @return <code>true</code> if the given type can see the target feature. */ public static boolean isVisible(JvmDeclaredType fromType, JvmMember target) { switch (target.getVisibility()) { case DEFAULT: return target.getDeclaringType().getPackageName().equals(fromType.getPackageName()); case PROTECTED: case PUBLIC: return true; case PRIVATE: default: } return false; }
@Override public Visibility getVisibility() { return this.getCompilationUnit().toVisibility(this.getDelegate().getVisibility()); }
public boolean isVisible(final JvmMember jvmMember, JvmDeclaredType contextType) { if (jvmMember.getVisibility() == JvmVisibility.PUBLIC) return true; if (contextType == null) { return false; } else if (jvmMember.getVisibility() == JvmVisibility.DEFAULT) { if (jvmMember instanceof JvmDeclaredType) { return equal(((JvmDeclaredType) jvmMember).getPackageName(), contextType.getPackageName()); } else { JvmDeclaredType declaringType = jvmMember.getDeclaringType(); if (declaringType != null) return equal(declaringType.getPackageName(), contextType.getPackageName()); return true; } } else if (contextType.equals(jvmMember.getDeclaringType())) { return true; } else { JvmParameterizedTypeReference typeReference = typesFactory.createJvmParameterizedTypeReference(); typeReference.setType(contextType); Set<JvmType> rawTypes = superTypeCollector.collectSuperTypesAsRawTypes(typeReference); if (rawTypes.contains(jvmMember.getDeclaringType())) { return jvmMember.getVisibility() == JvmVisibility.PROTECTED; } return false; } } }
/** * Determine whether the given member is visible without considering the class hierarchy. */ private boolean isVisible(final JvmMember member, final JvmDeclaredType context) { final JvmVisibility visibility = member.getVisibility(); boolean _equals = Objects.equal(visibility, JvmVisibility.PUBLIC); if (_equals) { return true; } JvmDeclaredType _xifexpression = null; if ((member instanceof JvmDeclaredType)) { _xifexpression = ((JvmDeclaredType)member); } else { _xifexpression = member.getDeclaringType(); } final JvmDeclaredType type = _xifexpression; if ((Objects.equal(type, context) || EcoreUtil.isAncestor(context, type))) { return true; } if (((type != null) && (Objects.equal(visibility, JvmVisibility.DEFAULT) || Objects.equal(visibility, JvmVisibility.PROTECTED)))) { if (((Strings.isEmpty(context.getPackageName()) && Strings.isEmpty(type.getPackageName())) || Objects.equal(context.getPackageName(), type.getPackageName()))) { return true; } } return false; }
@Override public ITreeAppendable generateVisibilityModifier(final JvmMember it, final ITreeAppendable result) { ITreeAppendable _xblockexpression = null; { JvmVisibility _visibility = it.getVisibility(); boolean _equals = Objects.equal(_visibility, JvmVisibility.PRIVATE); if (_equals) { JvmDeclaredType _declaringType = it.getDeclaringType(); boolean _tripleEquals = (_declaringType == null); if (_tripleEquals) { return result; } if ((it.getDeclaringType().isLocal() && (it instanceof JvmOperation))) { JvmDeclaredType _declaringType_1 = it.getDeclaringType(); final JvmGenericType declarator = ((JvmGenericType) _declaringType_1); boolean _isAnonymous = declarator.isAnonymous(); boolean _not = (!_isAnonymous); if (_not) { return result; } } } _xblockexpression = super.generateVisibilityModifier(it, result); } return _xblockexpression; }
@Override public boolean isVisible(JvmMember member) { JvmVisibility visibility = member.getVisibility(); if (visibility == JvmVisibility.PUBLIC) { return true;
@Check public void checkInstantiable(Component component) { if (component.getModule() != null) return; JvmType actualType = component.getActualType(); if (actualType == null || actualType.eIsProxy()) return; JvmDeclaredType declaredType = (JvmDeclaredType) actualType; if (!declaredType.isAbstract() && !(declaredType instanceof JvmGenericType && ((JvmGenericType) declaredType).isInterface())) { for(JvmMember member: declaredType.getMembers()) { if (member instanceof JvmConstructor) { if (((JvmConstructor) member).getParameters().isEmpty() && member.getVisibility().equals(JvmVisibility.PUBLIC)) return; } } error( "'" + declaredType.getQualifiedName('.') + "' does not have a public default constructor.", component, Mwe2Package.Literals.REFERRABLE__TYPE, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, MISSING_DEFAULT_CONSTRUCTOR); } }
@Override public boolean isVisible(JvmMember member, /* @Nullable */ LightweightTypeReference receiverType, /* @Nullable */ JvmIdentifiableElement receiverFeature) { boolean result = isVisible(member); if (result && JvmVisibility.PROTECTED == member.getVisibility()) { if (receiverFeature != null) {
if (member.getVisibility() == JvmVisibility.PRIVATE) { LightweightTypeReference receiverType = getReceiverType(); if (receiverType != null) {