Examples of PsiType


Examples of com.intellij.psi.PsiType

  }

  public static PsiClass checkForLazyOrProvider(PsiField psiField) {
    PsiClass wrapperClass = PsiConsultantImpl.getClass(psiField);

    PsiType psiFieldType = psiField.getType();
    if (!(psiFieldType instanceof PsiClassType)) {
      return wrapperClass;
    }

    return getPsiClass(psiField, wrapperClass, psiFieldType);
View Full Code Here

Examples of com.intellij.psi.PsiType

  }

  public static PsiClass checkForLazyOrProvider(PsiParameter psiParameter) {
    PsiClass wrapperClass = PsiConsultantImpl.getClass(psiParameter);

    PsiType psiParameterType = psiParameter.getType();
    if (!(psiParameterType instanceof PsiClassType)) {
      return wrapperClass;
    }

    return getPsiClass(psiParameter, wrapperClass, psiParameterType);
View Full Code Here

Examples of com.intellij.psi.PsiType

    PsiClass outerClass = classResolveResult.getElement();

    // If Lazy<Foo> or Provider<Foo>, extract Foo as the interesting type.
    if (outerClass != null //
        && (outerClass.equals(lazyClass) || outerClass.equals(providerClass))) {
      PsiType genericType =
          classResolveResult.getSubstitutor().getSubstitutionMap().values().iterator().next();
      // Convert genericType to its PsiClass and store in psiClass
      wrapperClass = getClass(genericType);
    }
View Full Code Here

Examples of com.intellij.psi.PsiType

        return false;
      }
      final PsiParameter[] parameters = parameterList.getParameters();
      for (int i = 0; i < parameters.length; i++) {
        final PsiParameter parameter = parameters[i];
        final PsiType type = parameter.getType();
        final PsiType parameterType = parameterTypes[i];
        if (PsiType.NULL.equals(parameterType)) {
          continue;
        }
        if (parameterType != null &&
            !typesAreEquivalent(type,
                parameterType)) {
          return false;
        }
      }
    }
    if (returnType != null) {
      final PsiType methodReturnType = method.getReturnType();
      if (!typesAreEquivalent(returnType,
          methodReturnType)) {
        return false;
      }
    }
View Full Code Here

Examples of com.intellij.psi.PsiType

        return false;
      }
      final PsiParameter[] methodParameters = methodParameterList.getParameters();
      final PsiParameter[] otherParameters = parameterList.getParameters();
      for (int i = 0; i < methodParameters.length; i++) {
        final PsiType type = methodParameters[i].getType();
        final PsiType parameterType = otherParameters[i].getType();
        if (PsiType.NULL.equals(parameterType)) {
          continue;
        }
        if (!typesAreEquivalent(type,
            parameterType)) {
          return false;
        }
      }
    }
    if (returnType != null) {
      final PsiType methodReturnType = method.getReturnType();
      if (!typesAreEquivalent(returnType,
          methodReturnType)) {
        return false;
      }
    }
View Full Code Here

Examples of com.intellij.psi.PsiType

  protected <Psi extends PsiElement> void processIntern(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation, @NotNull List<Psi> target) {
    Project project = psiClass.getProject();
    PsiManager manager = psiClass.getContainingFile().getManager();

    final PsiElementFactory psiElementFactory = JavaPsiFacade.getElementFactory(project);
    PsiType psiLoggerType = psiElementFactory.createTypeFromText(loggerType, psiClass);
    LombokLightFieldBuilder loggerField = LombokPsiElementFactory.getInstance().createLightField(manager, loggerName, psiLoggerType)
        .withContainingClass(psiClass)
        .withModifier(PsiModifier.FINAL).withModifier(PsiModifier.STATIC).withModifier(PsiModifier.PRIVATE)
        .withNavigationElement(psiAnnotation);
View Full Code Here

Examples of com.intellij.psi.PsiType

    }
    if (!hasFieldByName(psiClass, loggerName)) {
      Project project = psiClass.getProject();
      PsiManager manager = psiClass.getContainingFile().getManager();

      PsiType psiLoggerType = JavaPsiFacade.getElementFactory(project).createTypeFromText(loggerType, psiClass);
      LightElement loggerField = new MyLightFieldBuilder(manager, loggerName, psiLoggerType)
          .setHasInitializer(true)
          .setContainingClass(psiClass)
          .setModifiers(PsiModifier.FINAL, PsiModifier.STATIC, PsiModifier.PRIVATE)
          .setNavigationElement(psiAnnotation);
View Full Code Here

Examples of com.intellij.psi.PsiType

  public Collection<PsiMethod> createFieldSetters(@NotNull PsiClass psiClass, @Modifier @NotNull String methodModifier) {
    Collection<PsiMethod> result = new ArrayList<PsiMethod>();
    final PsiMethod[] classMethods = PsiClassUtil.collectClassMethodsIntern(psiClass);

    final PsiType booleanType = PsiPrimitiveTypeFactory.getInstance().getBooleanType();
    for (PsiField psiField : psiClass.getFields()) {
      boolean createSetter = true;
      PsiModifierList modifierList = psiField.getModifierList();
      if (null != modifierList) {
        //Skip final fields.
        createSetter = !modifierList.hasModifierProperty(PsiModifier.FINAL);
        //Skip static fields.
        createSetter &= !modifierList.hasModifierProperty(PsiModifier.STATIC);
        //Skip fields having Setter annotation already
        createSetter &= !hasFieldProcessorAnnotation(modifierList);
        //Skip fields that start with $
        createSetter &= !psiField.getName().startsWith(LombokConstants.LOMBOK_INTERN_FIELD_MARKER);
        //Skip fields if a method with same name already exists
        final Collection<String> methodNames = getFieldProcessor().getAllSetterNames(psiField, booleanType.equals(psiField.getType()));
        createSetter &= !PsiMethodUtil.hasMethodByName(classMethods, methodNames);
      }
      if (createSetter) {
        result.add(fieldProcessor.createSetterMethod(psiField, methodModifier));
      }
View Full Code Here

Examples of com.intellij.psi.PsiType

  private PsiMethod rebuildMethodFromString() {
    final StringBuilder builder = StringBuilderSpinAllocator.alloc();
    try {
      builder.append(getAllModifierProperties((LightModifierList) getModifierList()));
      PsiType returnType = getReturnType();
      if (null != returnType) {
        builder.append(returnType.getCanonicalText()).append(' ');
      }
      builder.append(getName());
      builder.append('(');
      if (getParameterList().getParametersCount() > 0) {
        for (PsiParameter parameter : getParameterList().getParameters()) {
View Full Code Here

Examples of com.intellij.psi.PsiType

  @NotNull
  public Collection<PsiMethod> createFieldGetters(@NotNull PsiClass psiClass, @Modifier @NotNull String methodModifier) {
    Collection<PsiMethod> result = new ArrayList<PsiMethod>();
    final PsiMethod[] classMethods = PsiClassUtil.collectClassMethodsIntern(psiClass);

    final PsiType booleanType = PsiPrimitiveTypeFactory.getInstance().getBooleanType();
    for (PsiField psiField : psiClass.getFields()) {
      boolean createGetter = true;
      PsiModifierList modifierList = psiField.getModifierList();
      if (null != modifierList) {
        //Skip static fields.
        createGetter = !modifierList.hasModifierProperty(PsiModifier.STATIC);
        //Skip fields having Getter annotation already
        createGetter &= !hasFieldProcessorAnnotation(modifierList);
        //Skip fields that start with $
        createGetter &= !psiField.getName().startsWith(LombokConstants.LOMBOK_INTERN_FIELD_MARKER);
        //Skip fields if a method with same name already exists
        final Collection<String> methodNames = TransformationsUtil.toAllGetterNames(psiField.getName(), booleanType.equals(psiField.getType()));
        createGetter &= !PsiMethodUtil.hasMethodByName(classMethods, methodNames);
      }
      if (createGetter) {
        result.add(fieldProcessor.createGetterMethod(psiField, methodModifier));
      }
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.