protected int resolveLevel(FieldDeclaration field) { // only accept enum constants if (field.type != null || field.binding == null) return IMPOSSIBLE_MATCH; if (this.pattern.declaringSimpleName != null && !matchesName(this.pattern.declaringSimpleName, field.binding.type.sourceName())) return IMPOSSIBLE_MATCH; if (!(field.initialization instanceof AllocationExpression) || field.initialization.resolvedType.isLocalType()) return IMPOSSIBLE_MATCH; return resolveLevel(((AllocationExpression)field.initialization).binding); } public int resolveLevel(Binding binding) {
private TypeBinding safeType(TypeBinding type) { if (type != null && type.isLocalType()) { MethodBinding enclosingMethod = ((LocalTypeBinding) type.original()).enclosingMethod; if (enclosingMethod != null && CharOperation.prefixEquals(TypeConstants.ANONYMOUS_METHOD, enclosingMethod.selector)) return type.superclass(); // don't use local class inside lambda: lambda is copied, type will be re-created and thus is unmatchable } return type; }
protected int resolveLevel(FieldDeclaration field) { // only accept enum constants if (field.type != null || field.binding == null) return IMPOSSIBLE_MATCH; if (this.pattern.declaringSimpleName != null && !matchesName(this.pattern.declaringSimpleName, field.binding.type.sourceName())) return IMPOSSIBLE_MATCH; if (!(field.initialization instanceof AllocationExpression) || field.initialization.resolvedType.isLocalType()) return IMPOSSIBLE_MATCH; return resolveLevel(((AllocationExpression)field.initialization).binding); } @Override
private TypeBinding safeType(TypeBinding type) { if (type != null && type.isLocalType()) { MethodBinding enclosingMethod = ((LocalTypeBinding) type.original()).enclosingMethod; if (enclosingMethod != null && CharOperation.prefixEquals(TypeConstants.ANONYMOUS_METHOD, enclosingMethod.selector)) return type.superclass(); // don't use local class inside lambda: lambda is copied, type will be re-created and thus is unmatchable } return type; }
protected int resolveLevel(FieldDeclaration field) { // only accept enum constants if (field.type != null || field.binding == null) return IMPOSSIBLE_MATCH; if (this.pattern.declaringSimpleName != null && !matchesName(this.pattern.declaringSimpleName, field.binding.type.sourceName())) return IMPOSSIBLE_MATCH; if (!(field.initialization instanceof AllocationExpression) || field.initialization.resolvedType.isLocalType()) return IMPOSSIBLE_MATCH; return resolveLevel(((AllocationExpression)field.initialization).binding); } public int resolveLevel(Binding binding) {
private TypeBinding safeType(TypeBinding type) { if (type != null && type.isLocalType()) { MethodBinding enclosingMethod = ((LocalTypeBinding) type.original()).enclosingMethod; if (enclosingMethod != null && CharOperation.prefixEquals(TypeConstants.ANONYMOUS_METHOD, enclosingMethod.selector)) return type.superclass(); // don't use local class inside lambda: lambda is copied, type will be re-created and thus is unmatchable } return type; }
@Override public TypeBinding substitute(Substitution substitution, TypeBinding originalType) { if (originalType.isLocalType()) { LocalTypeBinding orgLocal = (LocalTypeBinding) originalType; MethodScope lambdaScope2 = orgLocal.scope.enclosingLambdaScope(); if (lambdaScope2 != null) { if (((LambdaExpression) lambdaScope2.referenceContext).sourceStart == LambdaExpression.this.sourceStart) { // local type within this lambda needs replacement: TypeBinding substType = this.localTypes2.get(orgLocal.sourceStart); if (substType != null && substType != orgLocal) { //$IDENTITY-COMPARISON$ orgLocal.transferConstantPoolNameTo(substType); return substType; } } } return originalType; } return super.substitute(substitution, originalType); } }
protected int resolveLevel(FieldDeclaration field) { // only accept enum constants if (field.type != null || field.binding == null) return IMPOSSIBLE_MATCH; if (this.pattern.declaringSimpleName != null && !matchesName(this.pattern.declaringSimpleName, field.binding.type.sourceName())) return IMPOSSIBLE_MATCH; if (!(field.initialization instanceof AllocationExpression) || field.initialization.resolvedType.isLocalType()) return IMPOSSIBLE_MATCH; return resolveLevel(((AllocationExpression)field.initialization).binding); } public int resolveLevel(Binding binding) {
private TypeBinding safeType(TypeBinding type) { if (type != null && type.isLocalType()) { MethodBinding enclosingMethod = ((LocalTypeBinding) type.original()).enclosingMethod; if (enclosingMethod != null && CharOperation.prefixEquals(TypeConstants.ANONYMOUS_METHOD, enclosingMethod.selector)) return type.superclass(); // don't use local class inside lambda: lambda is copied, type will be re-created and thus is unmatchable } return type; }
protected int resolveLevel(FieldDeclaration field) { // only accept enum constants if (field.type != null || field.binding == null) return IMPOSSIBLE_MATCH; if (this.pattern.declaringSimpleName != null && !matchesName(this.pattern.declaringSimpleName, field.binding.type.sourceName())) return IMPOSSIBLE_MATCH; if (!(field.initialization instanceof AllocationExpression) || field.initialization.resolvedType.isLocalType()) return IMPOSSIBLE_MATCH; return resolveLevel(((AllocationExpression)field.initialization).binding); } public int resolveLevel(Binding binding) {
private TypeBinding safeType(TypeBinding type) { if (type != null && type.isLocalType()) { MethodBinding enclosingMethod = ((LocalTypeBinding) type.original()).enclosingMethod; if (enclosingMethod != null && CharOperation.prefixEquals(TypeConstants.ANONYMOUS_METHOD, enclosingMethod.selector)) return type.superclass(); // don't use local class inside lambda: lambda is copied, type will be re-created and thus is unmatchable } return type; }
protected int resolveLevel(FieldDeclaration field) { // only accept enum constants if (field.type != null || field.binding == null) return IMPOSSIBLE_MATCH; if (this.pattern.declaringSimpleName != null && !matchesName(this.pattern.declaringSimpleName, field.binding.type.sourceName())) return IMPOSSIBLE_MATCH; if (!(field.initialization instanceof AllocationExpression) || field.initialization.resolvedType.isLocalType()) return IMPOSSIBLE_MATCH; return resolveLevel(((AllocationExpression)field.initialization).binding); } public int resolveLevel(Binding binding) {
private TypeBinding safeType(TypeBinding type) { if (type != null && type.isLocalType()) { MethodBinding enclosingMethod = ((LocalTypeBinding) type.original()).enclosingMethod; if (enclosingMethod != null && CharOperation.prefixEquals(TypeConstants.ANONYMOUS_METHOD, enclosingMethod.selector)) return type.superclass(); // don't use local class inside lambda: lambda is copied, type will be re-created and thus is unmatchable } return type; }
private TypeBinding safeType(TypeBinding type) { if (type != null && type.isLocalType()) { MethodBinding enclosingMethod = ((LocalTypeBinding) type.original()).enclosingMethod; if (enclosingMethod != null && CharOperation.prefixEquals(TypeConstants.ANONYMOUS_METHOD, enclosingMethod.selector)) { // don't use local class inside lambda: lambda is copied, type will be re-created and thus is unmatchable if (type.superclass().id == TypeIds.T_JavaLangObject && type.superInterfaces().length > 0) return type.superInterfaces()[0]; return type.superclass(); } } return type; }
protected char[] getQualifiedSourceName(TypeBinding binding) { TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding; if (type instanceof ReferenceBinding) { if (type.isLocalType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), new char[] {'.', '1', '.'}, binding.sourceName()); } else if (type.isMemberType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), binding.sourceName(), '.'); } } return binding != null ? binding.qualifiedSourceName() : null; } /*
protected char[] getQualifiedSourceName(TypeBinding binding) { TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding; if (type instanceof ReferenceBinding) { if (type.isLocalType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), new char[] {'.', '1', '.'}, binding.sourceName()); } else if (type.isMemberType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), binding.sourceName(), '.'); } } return binding != null ? binding.qualifiedSourceName() : null; } /*
protected char[] getQualifiedSourceName(TypeBinding binding) { TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding; if (type instanceof ReferenceBinding) { if (type.isLocalType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), new char[] {'.', '1', '.'}, binding.sourceName()); } else if (type.isMemberType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), binding.sourceName(), '.'); } } return binding != null ? binding.qualifiedSourceName() : null; } /*
protected char[] getQualifiedSourceName(TypeBinding binding) { TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding; if (type instanceof ReferenceBinding) { if (type.isLocalType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), new char[] {'.', '1', '.'}, binding.sourceName()); } else if (type.isMemberType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), binding.sourceName(), '.'); } } return binding != null ? binding.qualifiedSourceName() : null; } /*
protected char[] getQualifiedSourceName(TypeBinding binding) { TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding; if (type instanceof ReferenceBinding) { if (type.isLocalType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), new char[] {'.', '1', '.'}, binding.sourceName()); } else if (type.isMemberType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), binding.sourceName(), '.'); } } return binding != null ? binding.qualifiedSourceName() : null; } /*
protected char[] getQualifiedSourceName(TypeBinding binding) { TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding; if (type instanceof ReferenceBinding) { if (type.isLocalType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), new char[] {'.', '1', '.'}, binding.sourceName()); } else if (type.isMemberType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), binding.sourceName(), '.'); } } return binding != null ? binding.qualifiedSourceName() : null; } /*