Java Code Examples for org.eclipse.jdt.internal.compiler.lookup.Binding#readableName()

The following examples show how to use org.eclipse.jdt.internal.compiler.lookup.Binding#readableName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PatchDelegate.java    From EasyMPermission with MIT License 6 votes vote down vote up
private static void failIfContainsAnnotation(TypeBinding parent, Binding[] bindings) throws DelegateRecursion {
	if (bindings == null) return;
	
	for (Binding b : bindings) {
		AnnotationBinding[] anns = null;
		if (b instanceof MethodBinding) anns = ((MethodBinding) b).getAnnotations();
		if (b instanceof FieldBinding) anns = ((FieldBinding) b).getAnnotations();
		// anns = b.getAnnotations() would make a heck of a lot more sense, but that is a late addition to ecj, so would cause NoSuchMethodErrors! Don't use that!
		if (anns == null) continue;
		for (AnnotationBinding ann : anns) {
			char[][] name = null;
			try {
				name = ann.getAnnotationType().compoundName;
			} catch (Exception ignore) {}
			
			if (name == null || name.length < 2 || name.length > 3) continue;
			if (!Arrays.equals(STRING_LOMBOK, name[0])) continue;
			if (!Arrays.equals(STRING_DELEGATE, name[name.length - 1])) continue;
			if (name.length == 3 && !Arrays.equals(STRING_EXPERIMENTAL, name[1])) continue;
			
			throw new DelegateRecursion(parent.readableName(), b.readableName());
		}
	}
}
 
Example 2
Source File: JavaStatementPostfixContext.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected String resolveNodeToTypeString(ASTNode node) {
	Binding b = resolveNodeToBinding(node);
	if (b != null) {
		return new String(b.readableName());
	}
	return OBJECT_SIGNATURE;
}