PsiJavaToken (@Nullable PsiElement element, @NotNull IElementType type) { if (element == null) return null; final SoftReference<PsiJavaToken> ref = element.getUserData(PSI_JAVA_TOKEN); final PsiJavaToken token = dereference(ref); if (token != null) return token; final LightJavaToken newToken = new LightJavaToken(element, type); element.putUserData(PSI_JAVA_TOKEN, new SoftReference<>(newToken)); return newToken; }