diff --git a/java/java-psi-api/src/com/intellij/psi/PsiArrayType.java b/java/java-psi-api/src/com/intellij/psi/PsiArrayType.java index 6c950ad5e293..50777e6d878b 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiArrayType.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiArrayType.java @@ -1,22 +1,9 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi; import com.intellij.lang.jvm.types.JvmArrayType; import com.intellij.psi.search.GlobalSearchScope; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; /** @@ -114,6 +101,7 @@ public class PsiArrayType extends PsiType.Stub implements JvmArrayType { */ @NotNull @Override + @Contract(pure = true) public PsiType getComponentType() { return myComponentType; } diff --git a/java/java-psi-api/src/com/intellij/psi/PsiEllipsisType.java b/java/java-psi-api/src/com/intellij/psi/PsiEllipsisType.java index 6b6d50a0ee8a..937feef79a35 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiEllipsisType.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiEllipsisType.java @@ -1,20 +1,7 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; /** @@ -69,6 +56,7 @@ public class PsiEllipsisType extends PsiArrayType { * * @return the array type instance. */ + @Contract(pure = true) public PsiType toArrayType() { return new PsiArrayType(getComponentType(), getAnnotationProvider()); } diff --git a/java/java-psi-api/src/com/intellij/psi/PsiExpression.java b/java/java-psi-api/src/com/intellij/psi/PsiExpression.java index 80dcd4d06994..cf5d17856c60 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiExpression.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiExpression.java @@ -1,24 +1,10 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi; import com.intellij.util.ArrayFactory; import com.intellij.util.Function; import com.intellij.util.NullableFunction; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Nullable; /** @@ -40,5 +26,6 @@ public interface PsiExpression extends PsiAnnotationMemberValue { * @return the expression type, or null if the type is not known. */ @Nullable + @Contract(pure = true) PsiType getType(); } diff --git a/java/java-psi-api/src/com/intellij/psi/PsiTypeElement.java b/java/java-psi-api/src/com/intellij/psi/PsiTypeElement.java index 1be650b01200..3bbbac1d0d25 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiTypeElement.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiTypeElement.java @@ -1,21 +1,8 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi; import com.intellij.util.ArrayFactory; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -44,6 +31,7 @@ public interface PsiTypeElement extends PsiElement, PsiAnnotationOwner { * @see PsiVariable#getType() */ @NotNull + @Contract(pure = true) PsiType getType(); /** @@ -65,6 +53,7 @@ public interface PsiTypeElement extends PsiElement, PsiAnnotationOwner { * * Applicable to local variables with initializers, foreach parameters, try-with-resources variables */ + @Contract(pure = true) default boolean isInferredType() { return false; }