public final boolean isInnerClass() { return getDeclaringType() != null; }
public final boolean isInnerClass() { return getDeclaringType() != null; }
public final boolean isInnerClass() { return getDeclaringType() != null; }
public String getPackageName() { final TypeReference declaringType = getDeclaringType(); if (declaringType != null) { return declaringType.getPackageName(); } return _packageName != null ? _packageName : StringUtilities.EMPTY; }
public String getPackageName() { final TypeReference declaringType = getDeclaringType(); if (declaringType != null) { return declaringType.getPackageName(); } return _packageName != null ? _packageName : StringUtilities.EMPTY; }
public String getPackageName() { final TypeReference declaringType = getDeclaringType(); if (declaringType != null) { return declaringType.getPackageName(); } return _packageName != null ? _packageName : StringUtilities.EMPTY; }
@Override protected StringBuilder appendName(final StringBuilder sb, final boolean fullName, final boolean dottedName) { if (fullName && dottedName && isNested() && !isAnonymous() && _simpleName != null) { return getDeclaringType().appendName(sb, true, true).append('.').append(_simpleName); } return super.appendName(sb, fullName, dottedName); }
@Override protected StringBuilder appendName(final StringBuilder sb, final boolean fullName, final boolean dottedName) { if (fullName && dottedName && isNested() && !isAnonymous() && _simpleName != null) { return getDeclaringType().appendName(sb, true, true).append('.').append(_simpleName); } return super.appendName(sb, fullName, dottedName); }
@Override protected StringBuilder appendName(final StringBuilder sb, final boolean fullName, final boolean dottedName) { if (fullName && dottedName && isNested() && !isAnonymous() && _simpleName != null) { return getDeclaringType().appendName(sb, true, true).append('.').append(_simpleName); } return super.appendName(sb, fullName, dottedName); }
@Override protected void visitType(TypeDefinition td) { TypeReference tr = td.getDeclaringType(); if(tr == null) return; TypeDefinition outer = tr.resolve(); if(outer == null || !outer.isAnonymous()) return; for(MethodDefinition md : td.getDeclaredMethods()) { extractCalls(md, mr -> { mis.add(new MemberInfo(mr)); return true; }); } }
private static boolean isThisOrOuterThisReference(final Expression e) { if (e == null || e.isNull()) { return false; } if (e instanceof ThisReferenceExpression && ((ThisReferenceExpression) e).getTarget().isNull()) { return true; } if (e instanceof MemberReferenceExpression) { final MemberReference m = e.getUserData(Keys.MEMBER_REFERENCE); if (m instanceof FieldReference) { final FieldDefinition resolvedField = ((FieldReference) m).resolve(); if (resolvedField != null && resolvedField.isSynthetic() && resolvedField.getDeclaringType().isInnerClass() && resolvedField.getDeclaringType().getDeclaringType() != null && resolvedField.getDeclaringType().getDeclaringType().isEquivalentTo(resolvedField.getFieldType())) { return true; } } } return false; }
@Override public GenericParameter findTypeVariable(final String name) { for (final GenericParameter genericParameter : getGenericParameters()) { if (StringUtilities.equals(genericParameter.getName(), name)) { return genericParameter; } } final MethodReference declaringMethod = getDeclaringMethod(); if (declaringMethod != null) { return declaringMethod.findTypeVariable(name); } final TypeReference declaringType = getDeclaringType(); if (declaringType != null && !this.isStatic()) { return declaringType.findTypeVariable(name); } return null; }
@Override public GenericParameter findTypeVariable(final String name) { for (final GenericParameter genericParameter : getGenericParameters()) { if (StringUtilities.equals(genericParameter.getName(), name)) { return genericParameter; } } final MethodReference declaringMethod = getDeclaringMethod(); if (declaringMethod != null) { return declaringMethod.findTypeVariable(name); } final TypeReference declaringType = getDeclaringType(); if (declaringType != null && !this.isStatic()) { return declaringType.findTypeVariable(name); } return null; }
@Override public GenericParameter findTypeVariable(final String name) { for (final GenericParameter genericParameter : getGenericParameters()) { if (StringUtilities.equals(genericParameter.getName(), name)) { return genericParameter; } } final MethodReference declaringMethod = getDeclaringMethod(); if (declaringMethod != null) { return declaringMethod.findTypeVariable(name); } final TypeReference declaringType = getDeclaringType(); if (declaringType != null && !this.isStatic()) { return declaringType.findTypeVariable(name); } return null; }
private void addTypeMembers(final TypeDeclaration astType, final TypeDefinition type) { for (final FieldDefinition field : type.getDeclaredFields()) { astType.addChild(createField(field), Roles.TYPE_MEMBER); } for (final MethodDefinition method : type.getDeclaredMethods()) { if (method.isConstructor()) { astType.addChild(createConstructor(method), Roles.TYPE_MEMBER); } else { astType.addChild(createMethod(method), Roles.TYPE_MEMBER); } } final List<TypeDefinition> nestedTypes = new ArrayList<>(); for (final TypeDefinition nestedType : type.getDeclaredTypes()) { final TypeReference declaringType = nestedType.getDeclaringType(); if (!nestedType.isLocalClass() && type.isEquivalentTo(declaringType)) { if (nestedType.isAnonymous()) { _typeDeclarations.put(type.getInternalName(), new SoftReference<>(astType)); } else { nestedTypes.add(nestedType); } } } sortNestedTypes(nestedTypes); for (final TypeDefinition nestedType : nestedTypes) { astType.addChild(createTypeNoCache(nestedType), Roles.TYPE_MEMBER); } }
private void addTypeMembers(final TypeDeclaration astType, final TypeDefinition type) { for (final FieldDefinition field : type.getDeclaredFields()) { astType.addChild(createField(field), Roles.TYPE_MEMBER); } for (final MethodDefinition method : type.getDeclaredMethods()) { if (method.isConstructor()) { astType.addChild(createConstructor(method), Roles.TYPE_MEMBER); } else { astType.addChild(createMethod(method), Roles.TYPE_MEMBER); } } final List<TypeDefinition> nestedTypes = new ArrayList<>(); for (final TypeDefinition nestedType : type.getDeclaredTypes()) { final TypeReference declaringType = nestedType.getDeclaringType(); if (!nestedType.isLocalClass() && type.isEquivalentTo(declaringType)) { if (nestedType.isAnonymous()) { _typeDeclarations.put(type.getInternalName(), new SoftReference<>(astType)); } else { nestedTypes.add(nestedType); } } } sortNestedTypes(nestedTypes); for (final TypeDefinition nestedType : nestedTypes) { astType.addChild(createTypeNoCache(nestedType), Roles.TYPE_MEMBER); } }
private void addTypeMembers(final TypeDeclaration astType, final TypeDefinition type) { for (final FieldDefinition field : type.getDeclaredFields()) { astType.addChild(createField(field), Roles.TYPE_MEMBER); } for (final MethodDefinition method : type.getDeclaredMethods()) { if (method.isConstructor()) { astType.addChild(createConstructor(method), Roles.TYPE_MEMBER); } else { astType.addChild(createMethod(method), Roles.TYPE_MEMBER); } } final List<TypeDefinition> nestedTypes = new ArrayList<>(); for (final TypeDefinition nestedType : type.getDeclaredTypes()) { final TypeReference declaringType = nestedType.getDeclaringType(); if (!nestedType.isLocalClass() && type.isEquivalentTo(declaringType)) { if (nestedType.isAnonymous()) { _typeDeclarations.put(type.getInternalName(), new SoftReference<>(astType)); } else { nestedTypes.add(nestedType); } } } sortNestedTypes(nestedTypes); for (final TypeDefinition nestedType : nestedTypes) { astType.addChild(createTypeNoCache(nestedType), Roles.TYPE_MEMBER); } }
if (_typeDefinition.getDeclaringType() == null) { _typeDefinition.setDeclaringType(resolvedOuterType); else if (_typeDefinition.getDeclaringType() == null) { _typeDefinition.setDeclaringType(outerType);
private static void flagAnonymousEnumDefinitions(final TypeDefinition type) { if (!type.isEnum() || type.getDeclaringType() != null) { return; if (type.getDeclaringType() != null && type.isAnonymous()) {
private static void flagAnonymousEnumDefinitions(final TypeDefinition type) { if (!type.isEnum() || type.getDeclaringType() != null) { return; if (type.getDeclaringType() != null && type.isAnonymous()) {