Java 类com.intellij.openapi.util.VolatileNullableLazyValue 实例源码

项目:intellij-ce-playground    文件:ExpectedTypeInfoImpl.java   
public ExpectedTypeInfoImpl(@NotNull PsiType type,
                            @Type int kind,
                            @NotNull PsiType defaultType,
                            @NotNull TailType myTailType,
                            PsiMethod calledMethod,
                            @NotNull NullableComputable<String> expectedName) {
  this.type = type;
  this.kind = kind;

  this.myTailType = myTailType;
  this.defaultType = defaultType;
  myCalledMethod = calledMethod;
  this.expectedNameComputable = expectedName;
  expectedNameLazyValue = new VolatileNullableLazyValue<String>() {
    @Nullable
    @Override
    protected String compute() {
      return expectedNameComputable.compute();
    }
  };

  PsiUtil.ensureValidType(type);
  PsiUtil.ensureValidType(defaultType);
}
项目:tools-idea    文件:ClsTypeElementImpl.java   
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
  myParent = parent;
  myTypeText = TypeInfo.internFrequentType(typeText);
  myVariance = variance;
  myChild = new VolatileNullableLazyValue<ClsElementImpl>() {
    @Nullable
    @Override
    protected ClsElementImpl compute() {
      return calculateChild();
    }
  };
  myCachedType = new AtomicNotNullLazyValue<PsiType>() {
    @NotNull
    @Override
    protected PsiType compute() {
      return calculateType();
    }
  };
}
项目:consulo-java    文件:ExpectedTypeInfoImpl.java   
public ExpectedTypeInfoImpl(@NotNull PsiType type,
        @Type int kind,
        @NotNull PsiType defaultType,
        @NotNull TailType myTailType,
        PsiMethod calledMethod,
        @NotNull NullableComputable<String> expectedName)
{
    this.type = type;
    this.kind = kind;

    this.myTailType = myTailType;
    this.defaultType = defaultType;
    myCalledMethod = calledMethod;
    this.expectedNameComputable = expectedName;
    expectedNameLazyValue = new VolatileNullableLazyValue<String>()
    {
        @Nullable
        @Override
        protected String compute()
        {
            return expectedNameComputable.compute();
        }
    };

    PsiUtil.ensureValidType(type);
    PsiUtil.ensureValidType(defaultType);
}