fix instanceof expressions usages not expecting pattern as parent

GitOrigin-RevId: 015e19f2ca9617f54de06a01be3c23f0be3bcb61
This commit is contained in:
Roman.Ivanov
2019-12-10 20:43:16 +07:00
committed by intellij-monorepo-bot
parent 987491a69d
commit e2bb8d31e0
4 changed files with 6 additions and 34 deletions

View File

@@ -1,18 +1,4 @@
/*
* 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-2019 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.impl.source.codeStyle;
import com.intellij.application.options.CodeStyle;
@@ -279,7 +265,7 @@ public class JavaReferenceAdjuster implements ReferenceAdjuster {
if (parent instanceof PsiTypeElement) {
final PsiClass containingClass = refClass.getContainingClass();
if (containingClass != null && containingClass.hasTypeParameters()) {
if (parent.getParent() instanceof PsiInstanceOfExpression) {
if (parent.getParent() instanceof PsiTypeTestPattern) {
return false;
}
if (!refClass.hasModifierProperty(PsiModifier.STATIC)) {

View File

@@ -1,18 +1,4 @@
/*
* 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-2019 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.refactoring.changeClassSignature;
import com.intellij.history.LocalHistory;
@@ -100,7 +86,7 @@ public class ChangeClassSignatureProcessor extends BaseRefactoringProcessor {
if (reference.getElement() instanceof PsiJavaCodeReferenceElement) {
PsiJavaCodeReferenceElement referenceElement = (PsiJavaCodeReferenceElement)reference.getElement();
PsiElement parent = referenceElement.getParent();
if (parent instanceof PsiTypeElement && (parent.getParent() instanceof PsiInstanceOfExpression ||
if (parent instanceof PsiTypeElement && (parent.getParent() instanceof PsiTypeTestPattern ||
parent.getParent() instanceof PsiClassObjectAccessExpression)) {
continue;
}