This commit is contained in:
Maxim.Medvedev
2012-01-31 17:23:09 +04:00
parent 0a09d401c7
commit f464286dfe
@@ -1,19 +1,18 @@
/*
* Copyright 2000-2011 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-2011 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.
*/
package org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions;
import com.intellij.lang.ASTNode;
@@ -35,7 +34,7 @@ import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
*/
public class GrThisReferenceExpressionImpl extends GrThisSuperReferenceExpressionBase implements GrThisReferenceExpression {
private static final NullableFunction<GrThisReferenceExpressionImpl,PsiType> TYPE_CALCULATOR =
private static final NullableFunction<GrThisReferenceExpressionImpl, PsiType> TYPE_CALCULATOR =
new NullableFunction<GrThisReferenceExpressionImpl, PsiType>() {
@Override
public PsiType fun(GrThisReferenceExpressionImpl ref) {
@@ -84,7 +83,7 @@ public class GrThisReferenceExpressionImpl extends GrThisSuperReferenceExpressio
return GroovyPsiManager.getInstance(getProject()).getType(this, TYPE_CALCULATOR);
}
private PsiType createType(PsiClass context) {
private PsiType createType(@NotNull PsiClass context) {
final JavaPsiFacade facade = JavaPsiFacade.getInstance(context.getProject());
PsiElementFactory elementFactory = facade.getElementFactory();
@@ -93,8 +92,7 @@ public class GrThisReferenceExpressionImpl extends GrThisSuperReferenceExpressio
//create instance of java.lang.Class<CurrentClass>
if (context instanceof PsiAnonymousClass) {
final PsiClassType type = ((PsiAnonymousClass)context).getBaseClassType();
final PsiClass aClass =
facade.findClass(CommonClassNames.JAVA_LANG_CLASS, context.getResolveScope());
final PsiClass aClass = facade.findClass(CommonClassNames.JAVA_LANG_CLASS, context.getResolveScope());
if (aClass != null) {
return elementFactory.createType(aClass, type);
}