List of usage examples for org.eclipse.jdt.internal.compiler.lookup Scope outerMostClassScope
public final ClassScope outerMostClassScope()
From source file:lombok.eclipse.agent.PatchVisibleForTesting.java
License:Open Source License
private static MethodBinding handleVisibleForTestingOnMethod(final Scope scope, final MethodBinding methodBinding) { if ((methodBinding == null) || (methodBinding.declaringClass == null)) return methodBinding; for (AnnotationBinding annotation : Each.elementIn(methodBinding.getAnnotations())) { if (!As.string(annotation.getAnnotationType()).contains("VisibleForTesting")) continue; ClassScope classScope = scope.outerMostClassScope(); if (classScope == null) continue; TypeDeclaration decl = classScope.referenceContext; if ((methodBinding.declaringClass == decl.binding) || As.string(decl.name).contains("Test")) continue; return new ProblemMethodBinding(methodBinding, methodBinding.selector, methodBinding.parameters, ProblemReasons.NotVisible); }/*from w ww . j ava2 s.c om*/ return methodBinding; }
From source file:lombok.eclipse.agent.PatchVisibleForTesting.java
License:Open Source License
private static ReferenceBinding handleVisibleForTestingOnType(final Scope scope, final ReferenceBinding typeBinding) { if (typeBinding == null) return typeBinding; for (AnnotationBinding annotation : Each.elementIn(typeBinding.getAnnotations())) { if (!As.string(annotation.getAnnotationType()).contains("VisibleForTesting")) continue; ClassScope classScope = scope.outerMostClassScope(); if (classScope == null) continue; TypeDeclaration decl = classScope.referenceContext; if (As.string(decl.name).contains("Test")) continue; return new ProblemReferenceBinding(typeBinding.compoundName, typeBinding, ProblemReasons.NotVisible); }//from www.j a v a2 s .com return typeBinding; }