Examples of ITypeBinding


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

  }

  private MethodDeclaration createMockMethodStub(final AST ast, final ASTRewrite rewrite,
      final CodeGenerationSettings settings) throws CoreException, JavaModelException
  {
    ITypeBinding declaringType = method.getDeclaringClass();

    MethodDeclaration stub = StubUtility2.createImplementationStub(fCompilationUnit, rewrite,
        importRewrite, context, method, declaringType.getName(), settings, false);

    if( !Object.class.getName().equals( method.getDeclaringClass().getQualifiedName() ) )
    {
      stub.modifiers().clear();
    }
View Full Code Here

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

  @Override
  public final List<ICompletionProposal> computeCompletionProposals(final ContentAssistInvocationContext context,
      final IProgressMonitor mon)
  {
    ITypeBinding mockType = null, paramType = null;
    ICompilationUnit cunit = getCompilationUnit(context);
    CompilationUnit astRoot = null;

    if (cunit != null)
    {
View Full Code Here

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

  @Override
  public boolean visit(final MethodDeclaration node)
  {
    IMethodBinding meth = node.resolveBinding();
    ITypeBinding mockedType = MockUtil.findMockedType(node, meth); // new MockUp< MockedType >

    if ( mockedType != null )
    {
      boolean hasMockAnn = MockUtil.isMockMethod(meth);
      boolean methodExists = findRealMethod(node, meth, mockedType) != null;
View Full Code Here

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

  }

  @Override
  public boolean visit(final AnonymousClassDeclaration node)
  {
    ITypeBinding binding = node.resolveBinding();

    if ( MockUtil.isMockUpType(binding.getSuperclass()) ) // new MockUp< type >
    {
      ITypeBinding typePar = ASTUtil.getFirstTypeParameter(node);
      ASTNode parent = node.getParent();

      if (parent instanceof ClassInstanceCreation && typePar.isInterface()  ) // creating interface mock
      {
        ClassInstanceCreation creation = (ClassInstanceCreation) parent;

        visitMockUpCreation(creation);
      }
View Full Code Here

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

      return false;
    }

    if ( MockUtil.isMockUpType(meth.getDeclaringClass()) && MockUtil.GET_INST.equals(meth.getName()))
    {
      ITypeBinding returnType = node.resolveTypeBinding();

      if (!returnType.isInterface())
      {
        String msg = "getMockInstance() used on mock of class " + returnType.getName()
            + ". Use on interfaces";
        addMarker(node.getName(), msg, false);
      }
    }
View Full Code Here

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

        IMethodBinding mockMethod = getSurroundingMockMethod(node);

        if( mockMethod != null && varBinding.isField() && mockMethod.isSubsignature(meth)
            && varBinding.getDeclaringClass().equals(mockMethod.getDeclaringClass()) )
        {
          ITypeBinding mockedType = MockUtil.findMockedType(node);

          if( mockedType.equals(varBinding.getType()) // field type is correct mocked type
              && !MockUtil.isReentrantMockMethod(mockMethod) )
          {
            addMarker( node,
                "Method calls itself. Set @Mock(reentrant=true) on method '"
                    + mockMethod.getName() + "'", true);
View Full Code Here

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

@SuppressWarnings("restriction")
public class ASTUtil
{
  public static ITypeBinding getFirstTypeParameter(final ASTNode node)
  {
    ITypeBinding declaringType = null;

    if( node.getParent() instanceof ClassInstanceCreation ) // for anonymous
    {
      ClassInstanceCreation creation = (ClassInstanceCreation) node.getParent();
      Type ctype = creation.getType();
View Full Code Here

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

  }

  @SuppressWarnings("unchecked")
  public static ITypeBinding getFirstTypeParam(final Type ctype)
  {
    ITypeBinding declaringType = null;

    if( ctype instanceof ParameterizedType )
    {
      ParameterizedType paramType = (ParameterizedType) ctype;
      List<Type> typeArgs = paramType.typeArguments();
View Full Code Here

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

      for(ITypeBinding superType: superTypes )
      {
        methods.addAll( Arrays.asList(superType.getDeclaredMethods()) );
      }

      ITypeBinding obj = ast.resolveWellKnownType(Object.class.getName());
      for(IMethodBinding m: obj.getDeclaredMethods())
      {
        if( !m.isConstructor() )
        {
          methods.add(m);
        }
View Full Code Here

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

    if (!(openAction instanceof SelectionDispatchAction))
    {
      return null;
    }

    ITypeBinding paramType = null;
    IRegion wordRegion = null;
    IMethodBinding mockMethod = null, realMethod = null;

    CompilationUnit astRoot = ASTUtil.getAstOrParse(input, null);
    if( astRoot == null )
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.