Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.ITypeBinding


    /**
     * The rule is that the declared, generic type, is the single canonical type.
     * Parameterized types are actually different type bindings.
     * @see org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment#createParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType)
     */
    ITypeBinding generic_type = node.resolveTypeBinding().getTypeDeclaration();
    ThisVariable result = thisVar.get(generic_type);
    if(result == null) {
      // explicitly qualified this
      result = new ThisVariable(this, qualifier);
      thisVar.put(node.resolveTypeBinding().getTypeDeclaration(), result);
View Full Code Here


  private static void useNotNullArgument(ClassInstanceCreation expression, Object[] arguments)
      throws Exception {
    IMethodBinding binding = AstNodeUtils.getCreationBinding(expression);
    ITypeBinding[] parameterTypes = binding.getParameterTypes();
    for (int i = 0; i < parameterTypes.length; i++) {
      ITypeBinding parameterType = parameterTypes[i];
      if (arguments[i] == null) {
        ClassLoader classLoader = JavaInfoUtils.getClassLoader(EditorState.getActiveJavaInfo());
        if (AstNodeUtils.isSuccessorOf(
            parameterType,
            "com.extjs.gxt.ui.client.widget.grid.ColumnModel")) {
View Full Code Here

            return null;

        ast.accept(new ASTVisitor() {
            @Override
            public boolean visit(TypeDeclaration typeDecl) {
                ITypeBinding typeBinding = typeDecl.resolveBinding();
                if (typeBinding != null) {
                    if (typeBinding.getBinaryName().equals(className)) {
                        SimpleName nameNode = typeDecl.getName();
                        markerAttributes.put(IMarker.CHAR_START, nameNode.getStartPosition());
                        markerAttributes.put(IMarker.CHAR_END, nameNode.getStartPosition() + nameNode.getLength());

                        return false;
View Full Code Here

        private static boolean isClassLoader(ITypeBinding typeBinding) {
            if (typeBinding.getQualifiedName().equals(ClassLoader.class.getName())) {
                return true;
            }

            ITypeBinding superclass = typeBinding.getSuperclass();
            return superclass != null && isClassLoader(superclass);
        }
View Full Code Here

    final CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.accept(new ASTVisitor() {

      @Override
      public boolean visit(final ClassInstanceCreation node) {
        final ITypeBinding ntb = node.resolveTypeBinding();
        final ITypeBinding nttb = node.getType().resolveBinding();
        IJavaElement javaElement = null;
        if (ntb == null || nttb == null) {
          return true;
        }
        if (ntb.getPackage().getName().startsWith(PACKAGE_MARKUP)) {
          javaElement = ntb.getJavaElement();
        }
        if (nttb.getPackage().getName().startsWith(PACKAGE_MARKUP)) {
          javaElement = nttb.getJavaElement();
        }
        if (javaElement == null) {
          ITypeBinding superclass = ntb.getSuperclass();
          while (superclass != null) {
            if (PACKAGE_MARKUP.startsWith(superclass.getPackage().getName())) {
              javaElement = ntb.getJavaElement();
              break;
            }
            superclass = superclass.getSuperclass();
          }
        }
        if (javaElement != null) {
          set.add((JavaElement) javaElement);
          final ResolvedBinaryType rbt = (ResolvedBinaryType) javaElement.getAdapter(ResolvedBinaryType.class);
View Full Code Here

    final CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.accept(new ASTVisitor() {

      @Override
      public boolean visit(final ClassInstanceCreation node) {
        ITypeBinding ntb = node.resolveTypeBinding();
        while (ntb != null) {
          if (ntb.getPackage().getName().startsWith(PACKAGE_MODEL)) {
            // it is a wicket model
            final ITypeBinding[] typeArguments = ntb.getTypeArguments();
            for (int i = 0; i < typeArguments.length; i++) {
              ITypeBinding typeArgument = typeArguments[i];
              if (!typeArgument.isArray() && !typeArgument.isNullType() && !typeArgument.isPrimitive() && !"java.lang.String".equals(typeArgument.getBinaryName())) {
                list.addAll(Arrays.asList(typeArgument.getDeclaredFields()));
                return false;
              }
            }
          }
          ntb = ntb.getSuperclass();
View Full Code Here

            while (keys.hasMoreElements()) {
                String typeName = (String) keys.nextElement();
                PtolemyMethod[] methods = (PtolemyMethod[]) _METHODS
                        .get(typeName);

                ITypeBinding type = binding.getDeclaringClass();
                boolean classFound = false;
                List<ITypeBinding> workList = new LinkedList<ITypeBinding>();
                Set<ITypeBinding> handledSet = new HashSet<ITypeBinding>();
                workList.add(type);

                while (workList.size() > 0) {
                    type = workList.remove(0);

                    if (type.getQualifiedName().equals(typeName)) {
                        classFound = true;
                        break;
                    }

                    handledSet.add(type);

                    ITypeBinding nextType = type.getSuperclass();

                    if ((nextType != null) && !handledSet.contains(nextType)) {
                        workList.add(nextType);
                    }
View Full Code Here

        String[] candidateParameters= candidate.getParameterTypes();
        if (methodParamters.length != candidateParameters.length)
            return false;
        IType scope= candidate.getDeclaringType();
        for (int i= 0; i < methodParamters.length; i++) {
            ITypeBinding methodParameter= methodParamters[i];
            String candidateParameter= candidateParameters[i];
            if (!sameParameter(methodParameter, candidateParameter, scope))
                return false;
        }
        return true;
View Full Code Here

        createName(type, false, result);
        return (String[]) result.toArray(new String[result.size()]);
    }
   
    private static void createName(ITypeBinding type, boolean includePackage, StringBuffer buffer) {
        ITypeBinding baseType= type;
        if (type.isArray()) {
            baseType= type.getElementType();
        }
        if (!baseType.isPrimitive() && !baseType.isNullType()) {
            ITypeBinding declaringType= baseType.getDeclaringClass();
            if (declaringType != null) {
                createName(declaringType, includePackage, buffer);
                buffer.append('.');
            } else if (includePackage && !baseType.getPackage().isUnnamed()) {
                buffer.append(baseType.getPackage().getName());
View Full Code Here

            buffer.append("$local$"); //$NON-NLS-1$
        }
    }
   
    private static void createName(ITypeBinding type, boolean includePackage, List<String> list) {
        ITypeBinding baseType= type;
        if (type.isArray()) {
            baseType= type.getElementType();
        }
        if (!baseType.isPrimitive() && !baseType.isNullType()) {
            ITypeBinding declaringType= baseType.getDeclaringClass();
            if (declaringType != null) {
                createName(declaringType, includePackage, list);
            } else if (includePackage && !baseType.getPackage().isUnnamed()) {
                String[] components= baseType.getPackage().getNameComponents();
                for (int i= 0; i < components.length; i++) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.ITypeBinding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.