Package com.intellij.psi

Examples of com.intellij.psi.PsiType


    return problemNewBuilder.getProblems();
  }

  private void validateCleanUpMethodExists(@NotNull PsiLocalVariable psiVariable, @NotNull String cleanupName, @NotNull ProblemNewBuilder problemNewBuilder) {
    final PsiType psiType = psiVariable.getType();
    if (psiType instanceof PsiClassType) {
      final PsiClassType psiClassType = (PsiClassType) psiType;
      final PsiClass psiClassOfField = psiClassType.resolve();
      final PsiMethod[] methods;
View Full Code Here


        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.get(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

    PsiParameter[] firstMethodParameterListParameters = firstMethodParameterList.getParameters();
    PsiParameter[] secondMethodParameterListParameters = secondMethodParameterList.getParameters();
    PsiSubstitutor firstSubstitutor = firstPair.getSecond();
    PsiSubstitutor secondSubstitutor = secondPair.getSecond();
    for (int i = 0; i < firstMethodParameterListParameters.length; i++) {
      PsiType firstMethodParameterListParameterType = firstSubstitutor.substitute(firstMethodParameterListParameters[i].getType());
      PsiType secondMethodParameterListParameterType = secondSubstitutor.substitute(secondMethodParameterListParameters[i].getType());
      if (PsiType.NULL.equals(firstMethodParameterListParameterType)) {
        continue;
      }
      if (!typesAreEquivalent(firstMethodParameterListParameterType, secondMethodParameterListParameterType)) {
        return false;
View Full Code Here

      for (PsiField classField : psiFields) {
        final String fieldName = classField.getName();

        final String fieldAccessor = buildAttributeNameString(doNotUseGetters, classField, psiClass);

        final PsiType classFieldType = classField.getType();
        if (classFieldType instanceof PsiPrimitiveType) {
          if (PsiType.FLOAT.equals(classFieldType)) {
            builder.append("if (java.lang.Float.compare(this.").append(fieldAccessor).append(", other.").append(fieldAccessor).append(") != 0) return false;\n");
          } else if (PsiType.DOUBLE.equals(classFieldType)) {
            builder.append("if (java.lang.Double.compare(this.").append(fieldAccessor).append(", other.").append(fieldAccessor).append(") != 0) return false;\n");
          } else {
            builder.append("if (this.").append(fieldAccessor).append(" != other.").append(fieldAccessor).append(") return false;\n");
          }
        } else if (classFieldType instanceof PsiArrayType) {
          final PsiType componentType = ((PsiArrayType) classFieldType).getComponentType();
          if (componentType instanceof PsiPrimitiveType) {
            builder.append("if (!java.util.Arrays.equals(this.").append(fieldAccessor).append(", other.").append(fieldAccessor).append(")) return false;\n");
          } else {
            builder.append("if (!java.util.Arrays.deepEquals(this.").append(fieldAccessor).append(", other.").append(fieldAccessor).append(")) return false;\n");
          }
View Full Code Here

      for (PsiField classField : psiFields) {
        final String fieldName = classField.getName();

        final String fieldAccessor = buildAttributeNameString(doNotUseGetters, classField, psiClass);

        final PsiType classFieldType = classField.getType();
        if (classFieldType instanceof PsiPrimitiveType) {
          if (PsiType.BOOLEAN.equals(classFieldType)) {
            builder.append("result = ((result * PRIME) + (this.").append(fieldAccessor).append(" ? ").append(PRIME_FOR_TRUE).append(" : ").append(PRIME_FOR_FALSE).append("));\n");
          } else if (PsiType.LONG.equals(classFieldType)) {
            builder.append("final long $").append(fieldName).append(" = this.").append(fieldAccessor).append(";\n");
            builder.append("result = result * PRIME + (int)($").append(fieldName).append(" >>> 32 ^ $").append(fieldName).append(");\n");
          } else if (PsiType.FLOAT.equals(classFieldType)) {
            builder.append("result = result * PRIME + java.lang.Float.floatToIntBits(this.").append(fieldAccessor).append(");\n");
          } else if (PsiType.DOUBLE.equals(classFieldType)) {
            builder.append("final long $").append(fieldName).append(" = java.lang.Double.doubleToLongBits(this.").append(fieldAccessor).append(");\n");
            builder.append("result = result * PRIME + (int)($").append(fieldName).append(" >>> 32 ^ $").append(fieldName).append(");\n");
          } else {
            builder.append("result = result * PRIME + this.").append(fieldAccessor).append(";\n");
          }
        } else if (classFieldType instanceof PsiArrayType) {
          final PsiType componentType = ((PsiArrayType) classFieldType).getComponentType();
          if (componentType instanceof PsiPrimitiveType) {
            builder.append("result = result * PRIME + java.util.Arrays.hashCode(this.").append(fieldName).append(");\n");
          } else {
            builder.append("result = result * PRIME + java.util.Arrays.deepHashCode(this.").append(fieldName).append(");\n");
          }
View Full Code Here

        if (includeFieldNames) {
          paramString.append(fieldName).append('=');
        }
        paramString.append("\"+");

        final PsiType classFieldType = classField.getType();
        if (classFieldType instanceof PsiArrayType) {
          final PsiType componentType = ((PsiArrayType) classFieldType).getComponentType();
          if (componentType instanceof PsiPrimitiveType) {
            paramString.append("java.util.Arrays.toString(");
          } else {
            paramString.append("java.util.Arrays.deepToString(");
          }
View Full Code Here

    // Create all args constructor only if there is no declared constructors
    if (definedConstructors.isEmpty()) {
      target.addAll(allArgsConstructorProcessor.createAllArgsConstructor(psiClass, PsiModifier.DEFAULT, psiAnnotation));
    }

    final PsiType psiBuilderType = PsiClassUtil.getTypeWithGenerics(psiClass);

    final String builderClassName = builderHandler.getBuilderClassName(psiClass, psiAnnotation, psiBuilderType);
    final PsiClass builderClass = PsiClassUtil.getInnerClassByName(psiClass, builderClassName);
    if (null != builderClass) {
      target.add(builderHandler.createBuilderMethod(psiClass, builderClass, psiAnnotation));
View Full Code Here

  private LombokLightFieldBuilder createLoggerField(@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) {
    final Project project = psiClass.getProject();
    final PsiManager manager = psiClass.getContainingFile().getManager();

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

  private PsiMethod rebuildMethod(@NotNull Project project, @NotNull PsiMethod fromMethod) {
    final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();

    final PsiMethod resultMethod;
    final PsiType returnType = fromMethod.getReturnType();
    if (null == returnType) {
      resultMethod = elementFactory.createConstructor(fromMethod.getName());
    } else {
      resultMethod = elementFactory.createMethod(fromMethod.getName(), returnType);
    }
View Full Code Here

  /**
   * Creates a PsiType for a PsiClass enriched with generic substitution information if available
   */
  @NotNull
  public static PsiType getTypeWithGenerics(@NotNull PsiClass psiClass) {
    PsiType result;
    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(psiClass.getProject());
    final PsiTypeParameter[] classTypeParameters = psiClass.getTypeParameters();
    if (classTypeParameters.length > 0) {
      Map<PsiTypeParameter, PsiType> substitutionMap = new HashMap<PsiTypeParameter, PsiType>();
      for (PsiTypeParameter typeParameter : classTypeParameters) {
View Full Code Here

TOP

Related Classes of com.intellij.psi.PsiType

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.