本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment类的典型用法代码示例。如果您正苦于以下问题:Java LookupEnvironment类的具体用法?Java LookupEnvironment怎么用?Java LookupEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LookupEnvironment类属于org.eclipse.jdt.internal.compiler.lookup包,在下文中一共展示了LookupEnvironment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getEnclosedElements
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
@Override
public List<? extends Element> getEnclosedElements() {
PackageBinding binding = (PackageBinding)_binding;
LookupEnvironment environment = binding.environment;
char[][][] typeNames = null;
INameEnvironment nameEnvironment = binding.environment.nameEnvironment;
if (nameEnvironment instanceof FileSystem) {
typeNames = ((FileSystem) nameEnvironment).findTypeNames(binding.compoundName);
}
HashSet<Element> set = new HashSet<Element>();
if (typeNames != null) {
for (char[][] typeName : typeNames) {
ReferenceBinding type = environment.getType(typeName);
if (type != null && type.isValidBinding()) {
set.add(_env.getFactory().newElement(type));
}
}
}
ArrayList<Element> list = new ArrayList<Element>(set.size());
list.addAll(set);
return Collections.unmodifiableList(list);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:PackageElementImpl.java
示例2: setExtendedData
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
protected void setExtendedData(
ITypeRoot typeRoot,
CompilationUnitDeclaration compilationUnitDeclaration,
LookupEnvironment lookupEnvironment,
Scope scope,
ASTNode astNode,
ASTNode astNodeParent,
WorkingCopyOwner owner,
CompletionParser parser) {
this.isExtended = true;
this.extendedContext =
new InternalExtendedCompletionContext(
this,
typeRoot,
compilationUnitDeclaration,
lookupEnvironment,
scope,
astNode,
astNodeParent,
owner,
parser);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:InternalCompletionContext.java
示例3: InternalExtendedCompletionContext
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
public InternalExtendedCompletionContext(
InternalCompletionContext completionContext,
ITypeRoot typeRoot,
CompilationUnitDeclaration compilationUnitDeclaration,
LookupEnvironment lookupEnvironment,
Scope assistScope,
ASTNode assistNode,
ASTNode assistNodeParent,
WorkingCopyOwner owner,
CompletionParser parser) {
this.completionContext = completionContext;
this.typeRoot = typeRoot;
this.compilationUnitDeclaration = compilationUnitDeclaration;
this.lookupEnvironment = lookupEnvironment;
this.assistScope = assistScope;
this.assistNode = assistNode;
this.assistNodeParent = assistNodeParent;
this.owner = owner;
this.parser = parser;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:InternalExtendedCompletionContext.java
示例4: processClassNames
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
private ReferenceBinding[] processClassNames(LookupEnvironment environment) {
// check for .class file presence in case of apt processing
int length = this.classNames.length;
ReferenceBinding[] referenceBindings = new ReferenceBinding[length];
for (int i = 0; i < length; i++) {
String currentName = this.classNames[i];
char[][] compoundName = null;
if (currentName.indexOf('.') != -1) {
// consider names with '.' as fully qualified names
char[] typeName = currentName.toCharArray();
compoundName = CharOperation.splitOn('.', typeName);
} else {
compoundName = new char[][] { currentName.toCharArray() };
}
ReferenceBinding type = environment.getType(compoundName);
if (type != null && type.isValidBinding()) {
if (type.isBinaryBinding()) {
referenceBindings[i] = type;
}
} else {
throw new IllegalArgumentException(
this.bind("configure.invalidClassName", currentName));//$NON-NLS-1$
}
}
return referenceBindings;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:Main.java
示例5: copyNameLookupAndCompletionEngine
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
private static void copyNameLookupAndCompletionEngine(CompletionProposalCollector completionProposalCollector, IJavaCompletionProposal proposal,
InternalCompletionProposal newProposal) {
try {
InternalCompletionContext context = (InternalCompletionContext) Reflection.contextField.get(completionProposalCollector);
InternalExtendedCompletionContext extendedContext = (InternalExtendedCompletionContext) Reflection.extendedContextField.get(context);
LookupEnvironment lookupEnvironment = (LookupEnvironment) Reflection.lookupEnvironmentField.get(extendedContext);
Reflection.nameLookupField.set(newProposal, ((SearchableEnvironment) lookupEnvironment.nameEnvironment).nameLookup);
Reflection.completionEngineField.set(newProposal, lookupEnvironment.typeRequestor);
} catch (IllegalAccessException ignore) {
// ignore
}
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:PatchExtensionMethodCompletionProposal.java
示例6: getPackageElement
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
@Override
public PackageElement getPackageElement(CharSequence name) {
LookupEnvironment le = _env.getLookupEnvironment();
if (name.length() == 0) {
return new PackageElementImpl(_env, le.defaultPackage);
}
char[] packageName = name.toString().toCharArray();
PackageBinding packageBinding = le.createPackage(CharOperation.splitOn('.', packageName));
if (packageBinding == null) {
return null;
}
return new PackageElementImpl(_env, packageBinding);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:ElementsImpl.java
示例7: getTypeElement
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
@Override
public TypeElement getTypeElement(CharSequence name) {
LookupEnvironment le = _env.getLookupEnvironment();
final char[][] compoundName = CharOperation.splitOn('.', name.toString().toCharArray());
ReferenceBinding binding = le.getType(compoundName);
// If we didn't find the binding, maybe it's a nested type;
// try finding the top-level type and then working downwards.
if (null == binding) {
ReferenceBinding topLevelBinding = null;
int topLevelSegments = compoundName.length;
while (--topLevelSegments > 0) {
char[][] topLevelName = new char[topLevelSegments][];
for (int i = 0; i < topLevelSegments; ++i) {
topLevelName[i] = compoundName[i];
}
topLevelBinding = le.getType(topLevelName);
if (null != topLevelBinding) {
break;
}
}
if (null == topLevelBinding) {
return null;
}
binding = topLevelBinding;
for (int i = topLevelSegments; null != binding && i < compoundName.length; ++i) {
binding = binding.getMemberType(compoundName[i]);
}
}
if (null == binding) {
return null;
}
return new TypeElementImpl(_env, binding, null);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:ElementsImpl.java
示例8: resolveDocument
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
public void resolveDocument() {
try {
IPath path = new Path(this.document.getPath());
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0));
JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
JavaProject javaProject = (JavaProject) model.getJavaProject(project);
this.options = new CompilerOptions(javaProject.getOptions(true));
ProblemReporter problemReporter =
new ProblemReporter(
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
this.options,
new DefaultProblemFactory());
// Re-parse using normal parser, IndexingParser swallows several nodes, see comment above class.
this.basicParser = new Parser(problemReporter, false);
this.basicParser.reportOnlyOneSyntaxError = true;
this.basicParser.scanner.taskTags = null;
this.cud = this.basicParser.parse(this.compilationUnit, new CompilationResult(this.compilationUnit, 0, 0, this.options.maxProblemsPerUnit));
// Use a non model name environment to avoid locks, monitors and such.
INameEnvironment nameEnvironment = new JavaSearchNameEnvironment(javaProject, JavaModelManager.getJavaModelManager().getWorkingCopies(DefaultWorkingCopyOwner.PRIMARY, true/*add primary WCs*/));
this.lookupEnvironment = new LookupEnvironment(this, this.options, problemReporter, nameEnvironment);
reduceParseTree(this.cud);
this.lookupEnvironment.buildTypeBindings(this.cud, null);
this.lookupEnvironment.completeTypeBindings();
this.cud.scope.faultInTypes();
this.cud.resolve();
} catch (Exception e) {
if (JobManager.VERBOSE) {
e.printStackTrace();
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:SourceIndexer.java
示例9: BindingKeyResolver
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
private BindingKeyResolver(BindingKeyParser parser, Compiler compiler, LookupEnvironment environment, CompilationUnitDeclaration outerMostParsedUnit, HashtableOfObject parsedUnits) {
super(parser);
this.compiler = compiler;
this.environment = environment;
this.outerMostParsedUnit = outerMostParsedUnit;
this.resolvedUnits = parsedUnits;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:BindingKeyResolver.java
示例10: isSubsignature
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
public boolean isSubsignature(IMethodBinding otherMethod) {
try {
LookupEnvironment lookupEnvironment = this.resolver.lookupEnvironment();
return lookupEnvironment != null
&& lookupEnvironment.methodVerifier().isMethodSubsignature(this.binding, ((MethodBinding) otherMethod).binding);
} catch (AbortCompilation e) {
// don't surface internal exception to clients
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013
return false;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:MethodBinding.java
示例11: DefaultBindingResolver
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
DefaultBindingResolver(LookupEnvironment lookupEnvironment, WorkingCopyOwner workingCopyOwner, BindingTables bindingTables, boolean isRecoveringBindings, boolean fromJavaProject) {
this.newAstToOldAst = new HashMap();
this.astNodesToBlockScope = new HashMap();
this.bindingsToAstNodes = new HashMap();
this.bindingTables = bindingTables;
this.scope = new CompilationUnitScope(new CompilationUnitDeclaration(null, null, -1), lookupEnvironment);
this.workingCopyOwner = workingCopyOwner;
this.isRecoveringBindings = isRecoveringBindings;
this.fromJavaProject = fromJavaProject;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:DefaultBindingResolver.java
示例12: NonNullDefaultAwareTypeAnnotationWalker
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
/** Create initial walker with non-empty type annotations. */
public NonNullDefaultAwareTypeAnnotationWalker(IBinaryTypeAnnotation[] typeAnnotations,
int defaultNullness, LookupEnvironment environment) {
super(typeAnnotations);
this.nonNullAnnotation = getNonNullAnnotation(environment);
this.defaultNullness = defaultNullness;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:NonNullDefaultAwareTypeAnnotationWalker.java
示例13: getNonNullAnnotation
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
private static IBinaryAnnotation getNonNullAnnotation(LookupEnvironment environment) {
final char[] nonNullAnnotationName = CharOperation.concat(
'L', CharOperation.concatWith(environment.getNonNullAnnotationName(), '/'), ';');
// create the synthetic annotation:
return new IBinaryAnnotation() {
@Override
public char[] getTypeName() {
return nonNullAnnotationName;
}
@Override
public IBinaryElementValuePair[] getElementValuePairs() {
return null;
}
};
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:NonNullDefaultAwareTypeAnnotationWalker.java
示例14: mergeParameterNullAnnotations
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
private void mergeParameterNullAnnotations(BlockScope currentScope) {
LookupEnvironment env = currentScope.environment();
TypeBinding[] ourParameters = this.binding.parameters;
TypeBinding[] descParameters = this.descriptor.parameters;
int len = Math.min(ourParameters.length, descParameters.length);
for (int i = 0; i < len; i++) {
long ourTagBits = ourParameters[i].tagBits & TagBits.AnnotationNullMASK;
long descTagBits = descParameters[i].tagBits & TagBits.AnnotationNullMASK;
if (ourTagBits == 0L) {
if (descTagBits != 0L && !ourParameters[i].isBaseType()) {
AnnotationBinding [] annotations = descParameters[i].getTypeAnnotations();
for (int j = 0, length = annotations.length; j < length; j++) {
AnnotationBinding annotation = annotations[j];
if (annotation != null) {
switch (annotation.getAnnotationType().id) {
case TypeIds.T_ConfiguredAnnotationNullable :
case TypeIds.T_ConfiguredAnnotationNonNull :
ourParameters[i] = env.createAnnotatedType(ourParameters[i], new AnnotationBinding [] { annotation });
break;
}
}
}
}
} else if (ourTagBits != descTagBits) {
if (ourTagBits == TagBits.AnnotationNonNull) { // requested @NonNull not provided
char[][] inheritedAnnotationName = null;
if (descTagBits == TagBits.AnnotationNullable)
inheritedAnnotationName = env.getNullableAnnotationName();
currentScope.problemReporter().illegalRedefinitionToNonNullParameter(this.arguments[i], this.descriptor.declaringClass, inheritedAnnotationName);
}
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:LambdaExpression.java
示例15: processClassNames
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
private ReferenceBinding[] processClassNames(LookupEnvironment environment) {
int length = this.classNames.length;
ReferenceBinding[] referenceBindings = new ReferenceBinding[length];
for(int i = 0; i < length; ++i) {
String currentName = this.classNames[i];
Object compoundName = null;
char[][] var8;
if(currentName.indexOf(46) != -1) {
char[] type = currentName.toCharArray();
var8 = CharOperation.splitOn('.', type);
} else {
var8 = new char[][]{currentName.toCharArray()};
}
ReferenceBinding var9 = environment.getType(var8);
if(var9 == null || !var9.isValidBinding()) {
throw new IllegalArgumentException(this.bind("configure.invalidClassName", currentName));
}
if(var9.isBinaryBinding()) {
referenceBindings[i] = var9;
}
}
return referenceBindings;
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:28,代码来源:MainCompiler.java
示例16: overrides
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
/**
* Return true if this method overrides {@code overridden} in the context of {@code type}. For
* instance, consider
* <pre>
* interface A { void f(); }
* class B { void f() {} }
* class C extends B implements I { }
* </pre>
* In the context of B, B.f() does not override A.f(); they are unrelated. But in the context of
* C, B.f() does override A.f(). That is, the copy of B.f() that C inherits overrides A.f().
* This is equivalent to considering two questions: first, does C inherit B.f(); if so, does
* the inherited C.f() override A.f(). If B.f() were private, for instance, then in the context
* of C it would still not override A.f().
*
* @see javax.lang.model.util.Elements#overrides(ExecutableElement, ExecutableElement, TypeElement)
* @jls3 8.4.8 Inheritance, Overriding, and Hiding
* @jls3 9.4.1 Inheritance and Overriding
*/
public boolean overrides(ExecutableElement overridden, TypeElement type)
{
MethodBinding overriddenBinding = (MethodBinding)((ExecutableElementImpl) overridden)._binding;
ReferenceBinding overriderContext = (ReferenceBinding)((TypeElementImpl)type)._binding;
if ((MethodBinding)_binding == overriddenBinding
|| overriddenBinding.isStatic()
|| overriddenBinding.isPrivate()
|| ((MethodBinding)_binding).isStatic()) {
return false;
}
char[] selector = ((MethodBinding)_binding).selector;
if (!CharOperation.equals(selector, overriddenBinding.selector))
return false;
// Construct a binding to the equivalent of this (the overrider) as it would be inherited by 'type'.
// Can only do this if 'type' is descended from the overrider.
// Second clause of the AND is required to match a peculiar javac behavior.
if (null == overriderContext.findSuperTypeOriginatingFrom(((MethodBinding)_binding).declaringClass) &&
null == ((MethodBinding)_binding).declaringClass.findSuperTypeOriginatingFrom(overriderContext)) {
return false;
}
MethodBinding overriderBinding = new MethodBinding((MethodBinding)_binding, overriderContext);
if (overriderBinding.isPrivate()) {
// a private method can never override another method. The other method would either be
// private itself, in which case it would not be visible; or this would be a restriction
// of access, which is a compile-time error.
return false;
}
TypeBinding match = overriderBinding.declaringClass.findSuperTypeOriginatingFrom(overriddenBinding.declaringClass);
if (!(match instanceof ReferenceBinding)) return false;
org.eclipse.jdt.internal.compiler.lookup.MethodBinding[] superMethods = ((ReferenceBinding)match).getMethods(selector);
LookupEnvironment lookupEnvironment = _env.getLookupEnvironment();
if (lookupEnvironment == null) return false;
MethodVerifier methodVerifier = lookupEnvironment.methodVerifier();
for (int i = 0, length = superMethods.length; i < length; i++) {
if (superMethods[i].original() == overriddenBinding) {
return methodVerifier.doesMethodOverride(overriderBinding, superMethods[i]);
}
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:62,代码来源:ExecutableElementImpl.java
示例17: getLookupEnvironment
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
public LookupEnvironment getLookupEnvironment() {
return _compiler.lookupEnvironment;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:BaseProcessingEnvImpl.java
示例18: overrides
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
/**
* @see IMethodBinding#overrides(IMethodBinding)
*/
public boolean overrides(IMethodBinding otherMethod) {
LookupEnvironment lookupEnvironment = this.resolver.lookupEnvironment();
return lookupEnvironment != null
&& lookupEnvironment.methodVerifier().doesMethodOverride(this.binding, ((MethodBinding) otherMethod).binding);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:MethodBinding.java
示例19: lookupEnvironment
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
LookupEnvironment lookupEnvironment() {
return this.scope.environment();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:DefaultBindingResolver.java
示例20: getNewInstance
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; //导入依赖的package包/类
public static ClassFile getNewInstance(SourceTypeBinding typeBinding) {
LookupEnvironment env = typeBinding.scope.environment();
return env.classFilePool.acquire(typeBinding);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:ClassFile.java
注:本文中的org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论