List of usage examples for org.eclipse.jdt.core.dom ITypeBinding toString
@Override
public String toString();
From source file:astview.Binding.java
License:Open Source License
public static void appendAnnotatedQualifiedName(StringBuffer buf, ITypeBinding typeBinding) { String debugString = typeBinding.toString(); // XXX: hack, but that's OK for a debugging tool... if (debugString.indexOf('\n') == -1 || typeBinding.getTypeAnnotations().length != 0) { // one-liner || outermost type has type annotations buf.append(debugString);//from w ww .j a va 2 s. c o m } else { buf.append(typeBinding.getQualifiedName()); } }
From source file:com.google.devtools.j2objc.gen.SignatureGenerator.java
License:Apache License
/** * TypeArgument ::= (["+" | "-"] FieldTypeSignature) | "*". *//*w w w .ja v a 2 s.c o m*/ private void genTypeArgument(ITypeBinding typeArg) { if (typeArg.isWildcardType()) { ITypeBinding bound = typeArg.getBound(); if (bound != null) { // JDT bug: bound.isUpperbound() always returns false, but toString() is correct. sb.append(typeArg.toString().contains("extends") ? '+' : '-'); genTypeArgument(bound); } else { sb.append('*'); return; } } else if (typeArg.isTypeVariable()) { genTypeVariableSignature(typeArg); } else { genClassTypeSignature(typeArg); } }
From source file:fr.labri.harmony.rta.junit.jdt.JDTVisitorRTA.java
License:Open Source License
private static String getMethodBindingId(IMethodBinding b) { String realId = ""; if (b.getDeclaringClass().isParameterizedType()) { realId += b.getDeclaringClass().getBinaryName(); for (ITypeBinding tb : b.getDeclaringClass().getTypeDeclaration().getTypeParameters()) realId += tb.toString(); realId += "("; } else if (!b.getDeclaringClass().getQualifiedName().isEmpty()) realId = b.getDeclaringClass().getQualifiedName() + "." + b.getName() + "("; else {/*w w w .j a v a 2s . com*/ if (b.getMethodDeclaration().getDeclaringClass().getDeclaringMethod() != null) realId = b.getMethodDeclaration().getDeclaringClass().getDeclaringClass().getQualifiedName() + "." + b.getMethodDeclaration().getDeclaringClass().getDeclaringMethod().getName() + "." + b.getMethodDeclaration().getName() + "("; else realId = b.getMethodDeclaration().getDeclaringClass().getDeclaringClass().getQualifiedName() + "." + "." + b.getMethodDeclaration().getName() + "("; } int i = 0; for (ITypeBinding tb : b.getMethodDeclaration().getParameterTypes()) { realId += tb.getTypeDeclaration().getQualifiedName(); if (i < b.getParameterTypes().length - 1) realId += ","; //System.out.println("6"+tb.getTypeDeclaration().getQualifiedName()); i++; } if (!b.isConstructor()) { if (b.getReturnType().getDeclaringClass() != null) { if (b.getReturnType().getDeclaringClass().isParameterizedType()) { realId += "):" + b.getReturnType().getDeclaringClass().getBinaryName(); for (ITypeBinding tb : b.getReturnType().getDeclaringClass().getTypeDeclaration() .getTypeParameters()) { realId += tb.toString(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } else if (b.getReturnType() != null) { if (b.getReturnType().isParameterizedType() || b.isGenericMethod()) { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); for (ITypeBinding tb : b.getReturnType().getTypeDeclaration().getTypeParameters()) { realId += tb.toString(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } else { if (b.getDeclaringClass().isParameterizedType()) { realId += "):" + b.getDeclaringClass().getBinaryName(); for (ITypeBinding tb : b.getDeclaringClass().getTypeDeclaration().getTypeParameters()) { realId += tb.toString(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } return realId; }
From source file:fr.labri.harmony.rta.junit.jdt.JDTVisitorRTA.java
License:Open Source License
private static String getAnonymousMethodBindingId(IMethodBinding b, JavaClass currentClass) { String realId = currentClass.getQualifiedName() + "." + b.getName() + "("; int i = 0;/*from w ww . ja v a 2 s.com*/ for (ITypeBinding tb : b.getMethodDeclaration().getParameterTypes()) { realId += tb.getTypeDeclaration().getQualifiedName(); if (i < b.getParameterTypes().length - 1) realId += ","; //System.out.println("6"+tb.getTypeDeclaration().getQualifiedName()); i++; } if (!b.isConstructor()) { if (b.getReturnType().getDeclaringClass() != null) { if (b.getReturnType().getDeclaringClass().isParameterizedType()) { realId += "):" + b.getReturnType().getDeclaringClass().getBinaryName(); for (ITypeBinding tb : b.getReturnType().getDeclaringClass().getTypeDeclaration() .getTypeParameters()) { realId += tb.toString(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } else if (b.getReturnType() != null) { if (b.getReturnType().isParameterizedType() || b.isGenericMethod()) { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); for (ITypeBinding tb : b.getReturnType().getTypeDeclaration().getTypeParameters()) { realId += tb.toString(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } else { if (b.getDeclaringClass().isParameterizedType()) { realId += "):" + b.getDeclaringClass().getBinaryName(); for (ITypeBinding tb : b.getDeclaringClass().getTypeDeclaration().getTypeParameters()) { realId += tb.toString(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } return realId; }
From source file:fr.labri.harmony.rta.junit.jdt.JDTVisitorRTA.java
License:Open Source License
private static String getShortDeclaration(IMethodBinding b) { String realId = ""; realId += b.getMethodDeclaration().getName() + "("; int i = 0;// ww w. j a va 2s.c o m for (ITypeBinding tb : b.getMethodDeclaration().getParameterTypes()) { realId += tb.getTypeDeclaration().getQualifiedName(); if (i < b.getParameterTypes().length - 1) realId += ","; i++; } if (!b.isConstructor()) { if (b.getReturnType().getDeclaringClass() != null) { if (b.getReturnType().getDeclaringClass().isParameterizedType()) { realId += "):" + b.getReturnType().getDeclaringClass().getBinaryName(); for (ITypeBinding tb : b.getReturnType().getDeclaringClass().getTypeDeclaration() .getTypeParameters()) { realId += tb.toString(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } else if (b.getReturnType() != null) { if (b.getReturnType().isParameterizedType() || b.getReturnType().isGenericType()) { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); for (ITypeBinding tb : b.getReturnType().getTypeDeclaration().getTypeParameters()) { realId += tb.toString(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } else { realId += "):" + b.getMethodDeclaration().getReturnType().getTypeDeclaration().getQualifiedName(); } } else { realId += "):void"; } return realId; }
From source file:fr.labri.harmony.rta.junit.jdt.JDTVisitorRTA.java
License:Open Source License
private static String getStaticType(IMethodBinding b) { String realId = ""; if (b.getMethodDeclaration().getDeclaringClass().isParameterizedType()) { realId += b.getMethodDeclaration().getDeclaringClass().getBinaryName(); for (ITypeBinding tb : b.getMethodDeclaration().getDeclaringClass().getTypeDeclaration() .getTypeParameters())/*w w w . jav a2 s .com*/ realId += tb.toString(); } else if (!b.getMethodDeclaration().getDeclaringClass().getQualifiedName().isEmpty()) realId = b.getMethodDeclaration().getDeclaringClass().getQualifiedName(); else { if (b.getMethodDeclaration().getMethodDeclaration().getDeclaringClass().getDeclaringMethod() != null) realId = b.getMethodDeclaration().getDeclaringClass().getDeclaringClass().getQualifiedName(); else realId = b.getMethodDeclaration().getDeclaringClass().getDeclaringClass().getQualifiedName(); } return realId; }