コード例 #1
0
 // Temporary
 // Returns true if deprecated constructor is in use, like
 // ENTRY: Enum(arguments) instead of
 // ENTRY(arguments)
 public static boolean enumEntryUsesDeprecatedSuperConstructor(@NotNull JetEnumEntry enumEntry) {
   JetInitializerList initializerList = enumEntry.getInitializerList();
   if (initializerList == null || initializerList.getInitializers().isEmpty()) return false;
   JetTypeReference typeReference = initializerList.getInitializers().get(0).getTypeReference();
   if (typeReference == null) return false;
   JetUserType userType = (JetUserType) typeReference.getTypeElement();
   if (userType == null
       || userType.getReferenceExpression() instanceof JetEnumEntrySuperclassReferenceExpression)
     return false;
   return true;
 }
コード例 #2
0
ファイル: JetPsiUtil.java プロジェクト: vijaykiran/kotlin
 @Nullable
 public static Name getShortName(@NotNull JetAnnotationEntry annotation) {
   JetTypeReference typeReference = annotation.getTypeReference();
   assert typeReference != null : "Annotation entry hasn't typeReference " + annotation.getText();
   JetTypeElement typeElement = typeReference.getTypeElement();
   if (typeElement instanceof JetUserType) {
     JetUserType userType = (JetUserType) typeElement;
     String shortName = userType.getReferencedName();
     if (shortName != null) {
       return Name.identifier(shortName);
     }
   }
   return null;
 }
コード例 #3
0
ファイル: JetPsiUtil.java プロジェクト: vijaykiran/kotlin
  public static boolean isVoidType(@Nullable JetTypeReference typeReference) {
    if (typeReference == null) {
      return false;
    }

    return KotlinBuiltIns.getInstance()
        .getUnit()
        .getName()
        .asString()
        .equals(typeReference.getText());
  }