Java Code Examples for com.intellij.openapi.util.AtomicNullableLazyValue

The following are top voted examples for showing how to use com.intellij.openapi.util.AtomicNullableLazyValue. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: intellij-ce-playground   File: ClsTypeElementImpl.java   View source code 6 votes vote down vote up
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
  myParent = parent;
  myTypeText = TypeInfo.internFrequentType(typeText);
  myVariance = variance;
  myChild = new AtomicNullableLazyValue<ClsElementImpl>() {
    @Override
    protected ClsElementImpl compute() {
      return calculateChild();
    }
  };
  myCachedType = new AtomicNotNullLazyValue<PsiType>() {
    @NotNull
    @Override
    protected PsiType compute() {
      return calculateType();
    }
  };
}
 
Example 2
Project: consulo-java   File: ClsPackageAccessibilityStatementImpl.java   View source code 6 votes vote down vote up
public ClsPackageAccessibilityStatementImpl(PsiPackageAccessibilityStatementStub stub)
{
	super(stub);
	myPackageReference = new AtomicNullableLazyValue<PsiJavaCodeReferenceElement>()
	{
		@Override
		protected PsiJavaCodeReferenceElement compute()
		{
			String packageName = getPackageName();
			return packageName != null ? new ClsJavaCodeReferenceElementImpl(ClsPackageAccessibilityStatementImpl.this, packageName) : null;
		}
	};
	myModuleReferences = new AtomicNotNullLazyValue<Iterable<PsiJavaModuleReferenceElement>>()
	{
		@NotNull
		@Override
		protected Iterable<PsiJavaModuleReferenceElement> compute()
		{
			return ContainerUtil.map(getStub().getTargets(), target -> new ClsJavaModuleReferenceElementImpl(ClsPackageAccessibilityStatementImpl.this, target));
		}
	};
}
 
Example 3
Project: consulo-java   File: ClsTypeElementImpl.java   View source code 6 votes vote down vote up
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance)
{
	myParent = parent;
	myTypeText = TypeInfo.internFrequentType(typeText);
	myVariance = variance;
	myChild = new AtomicNullableLazyValue<ClsElementImpl>()
	{
		@Override
		protected ClsElementImpl compute()
		{
			return calculateChild();
		}
	};
	myCachedType = new AtomicNotNullLazyValue<PsiType>()
	{
		@NotNull
		@Override
		protected PsiType compute()
		{
			return calculateType();
		}
	};
}