List of usage examples for org.eclipse.jdt.core.dom IMethodBinding getKey
public String getKey();
From source file:com.google.gwt.eclipse.core.validators.rpc.RemoteServiceProblemFactory.java
License:Open Source License
/** * Returns a new {@link RemoteServiceProblem} for a * {@link RemoteServiceProblemType#MISSING_ASYNC_METHOD} on an * <b>asynchronous</b> type. *//*from ww w. j a va 2 s .c o m*/ static RemoteServiceProblem newMissingAsyncMethodOnAsync(IMethodBinding syncMethodBinding, TypeDeclaration asyncTypeDeclaration) { String[] messageArgs = { asyncTypeDeclaration.getName().getIdentifier(), toAsyncMethodSignature(syncMethodBinding) }; String[] problemArgs = { "async", syncMethodBinding.getKey() }; return RemoteServiceProblem.create(asyncTypeDeclaration.getName(), RemoteServiceProblemType.MISSING_ASYNC_METHOD, messageArgs, problemArgs); }
From source file:com.google.gwt.eclipse.core.validators.rpc.RemoteServiceProblemFactory.java
License:Open Source License
/** * Returns a new {@link RemoteServiceProblem} for a * {@link RemoteServiceProblemType#MISSING_SYNC_METHOD} on a * <b>synchronous</b> type.// w ww . j a v a 2 s. co m */ static RemoteServiceProblem newMissingSyncMethodOnSync(TypeDeclaration syncTypeDeclaration, IMethodBinding asyncMethodBinding) { String[] messageArgs = { syncTypeDeclaration.getName().getIdentifier(), toSyncMethodSignature(asyncMethodBinding) }; String[] problemArgs = { "sync", asyncMethodBinding.getKey() }; return RemoteServiceProblem.create(syncTypeDeclaration.getName(), RemoteServiceProblemType.MISSING_SYNC_METHOD, messageArgs, problemArgs); }
From source file:com.ibm.wala.cast.java.translator.jdt.JDTIdentityMapper.java
License:Open Source License
public MethodReference getMethodRef(IMethodBinding met) { if (!fMethodMap.containsKey(met.getKey())) { // create one TypeName ownerType = TypeName.string2TypeName(typeToTypeID(met.getDeclaringClass())); TypeReference ownerTypeRef = TypeReference.findOrCreate(fClassLoaderRef, ownerType); MethodReference ref = MethodReference.findOrCreate(ownerTypeRef, selectorForMethod(met)); fMethodMap.put(met.getKey(), ref); return ref; }/*from ww w . j a v a 2 s . c o m*/ return fMethodMap.get(met.getKey()); }
From source file:de.ovgu.cide.typing.jdt.BindingProjectColorCache.java
License:Open Source License
/** * called after an item's color is changed. cycles through all children an * searches for java elements that need to be updated. * /* w w w.j a v a 2 s. c o m*/ * @param nodes * @param file */ void updateASTColors(ASTNode node, final ColoredSourceFile file) { node.accept(new ASTVisitor() { public boolean visit(MethodDeclaration node) { String key = null; IMethodBinding binding = node.resolveBinding(); if (binding != null) { IJavaElement javaElement = binding.getJavaElement(); if (javaElement instanceof IMethod) key = ((IMethod) javaElement).getKey(); } if (key != null) { Set<IFeature> colors = getColor(file, node); update(bindingKeys2colors, key, colors); //add param keys for (int paramIdx = 0; paramIdx < node.parameters().size(); paramIdx++) { ASTNode param = (ASTNode) node.parameters().get(paramIdx); update(bindingKeys2colors, getParamKey(key, paramIdx), getColor(file, param)); } //add exception keys for (int excIdx = 0; excIdx < node.thrownExceptions().size(); excIdx++) { Name exception = (Name) node.thrownExceptions().get(excIdx); ITypeBinding excBinding = exception.resolveTypeBinding(); if (excBinding == null) continue; update(bindingKeys2colors, getExceptionKey(key, excBinding.getKey()), getColor(file, exception)); } } return super.visit(node); } private Set<IFeature> getColor(final ColoredSourceFile file, ASTNode node) { return file.getColorManager().getColors(new AstidWrapperWithParents(node)); } private void update(HashMap<String, Set<IFeature>> map, String key, Set<IFeature> colors) { if (colors != null && colors.size() > 0) map.put(key, colors); else map.remove(key); } public boolean visit(VariableDeclarationFragment node) { visitVD(node); return super.visit(node); } public boolean visit(SingleVariableDeclaration node) { visitVD(node); return super.visit(node); } public void visitVD(VariableDeclaration node) { String key = null; IVariableBinding binding = node.resolveBinding(); if (binding != null) { IJavaElement javaElement = binding.getJavaElement(); if (javaElement instanceof IField) key = ((IField) javaElement).getKey(); } if (key != null) update(bindingKeys2colors, key, getColor(file, node)); } @Override public boolean visit(TypeDeclaration node) { ITypeBinding binding = node.resolveBinding(); if (binding != null) { update(bindingKeys2colors, binding.getKey(), getColor(file, node)); } return super.visit(node); } }); }
From source file:de.ovgu.cide.typing.jdt.BindingProjectColorCache.java
License:Open Source License
public Set<IFeature> getColors(IMethodBinding method) { return getColors(method.getKey()); }
From source file:de.ovgu.cide.typing.jdt.BindingProjectColorCache.java
License:Open Source License
public Set<IFeature> getColors(IMethodBinding method, int paramIdx) { return getColors(getParamKey(method.getKey(), paramIdx)); }
From source file:de.ovgu.cide.typing.jdt.checks.MethodInvocationCheck.java
License:Open Source License
private boolean checkSourceAndTargetCondition(IEvaluationStrategy strategy, IMethodBinding targetBinding) { Set<IFeature> sourceMethodColors = file.getColorManager().getColors(source); Set<IFeature> targetMethodColors = typingProvider.getBindingColors().getColors(targetBinding); if (!strategy.implies(file.getFeatureModel(), sourceMethodColors, targetMethodColors)) return false; // check each parameter same condition Set<IFeature> context = new HashSet<IFeature>(); context.addAll(sourceMethodColors);/* ww w .java 2s.c o m*/ context.addAll(targetMethodColors); for (int j = 0; j < arguments.size(); j++) { if (strategy.equal(file.getFeatureModel(), context, file.getColorManager().getColors(arguments.get(j)), file.getColorManager().getColors(source))) continue; // check the default case if (strategy.equal(file.getFeatureModel(), context, file.getColorManager().getColors(arguments.get(j)), typingProvider.getBindingColors() .getColors(BindingProjectColorCache.getParamKey(targetBinding.getKey(), j)))) continue; return false; } return true; }
From source file:de.ovgu.cide.typing.jdt.checks.resolutions.ASTBindingFinderHelper.java
License:Open Source License
public static IASTNode getMethodDecl(IMethodBinding binding) { CompilationUnit ast = getAST(binding); if (ast == null) return null; ASTBindingFinder bindingFinder = new ASTBindingFinder(binding.getKey()); ast.accept(bindingFinder);//from ww w .j a v a 2 s .c o m ASTNode result = bindingFinder.getResult(); if (result == null) return null; return ASTBridge.bridge(result); }
From source file:de.ovgu.cide.typing.jdt.checks.util.MethodPathItem.java
License:Open Source License
public MethodPathItem(IMethodBinding binding, boolean isDeclClassAbstract) { this.binding = binding; this.isDeclClassAbstract = isDeclClassAbstract; key = binding.getKey(); isAbstract = Modifier.isAbstract(binding.getModifiers()); }
From source file:edu.cmu.cs.crystal.annotations.AnnotationDatabase.java
License:Open Source License
/*** * Given a method binding, returns a summary that represents annotation info for that method * declaration.//from w w w .ja va2 s .c o m */ public AnnotationSummary getSummaryForMethod(IMethodBinding binding) { while (binding != binding.getMethodDeclaration()) binding = binding.getMethodDeclaration(); String name = binding.getKey(); AnnotationSummary result = methods.get(name); if (result == null) { result = createMethodSummary(binding); methods.put(name, result); } return result; }