diff --git a/java/java-impl/src/com/intellij/psi/impl/compiled/ClsStubBuilder.java b/java/java-impl/src/com/intellij/psi/impl/compiled/ClsStubBuilder.java index cffaf7cff658..7ee585d4867e 100644 --- a/java/java-impl/src/com/intellij/psi/impl/compiled/ClsStubBuilder.java +++ b/java/java-impl/src/com/intellij/psi/impl/compiled/ClsStubBuilder.java @@ -364,34 +364,32 @@ public class ClsStubBuilder { final byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnnotationMethod, isVarargs, isDeprecated, false); String canonicalMethodName = isConstructor ? myResult.getName() : name; - final boolean[] parsedViaGenericSignature = new boolean[1]; final List args = new ArrayList(); final List throwables = exceptions != null ? new ArrayList() : null; - final PsiModifierListStub[] modlist = new PsiModifierListStub[1]; - PsiMethodStubImpl stub = new PsiMethodStubImpl(myResult, StringRef.fromString(canonicalMethodName), flags, null){ - @Override - protected TypeInfo createReturnType() { - modlist[0] = new PsiModifierListStubImpl(this, packMethodFlags(access)); - parsedViaGenericSignature[0] = false; - String returnType; - if (signature == null) { - returnType = parseMethodViaDescription(desc, this, args); - } - else { - try { - returnType = parseMethodViaGenericSignature(signature, this, args, throwables); - parsedViaGenericSignature[0] = true; - } - catch (ClsFormatException e) { - returnType = parseMethodViaDescription(desc, this, args); - } - } - return TypeInfo.fromString(returnType); + + PsiMethodStubImpl stub = new PsiMethodStubImpl(myResult, StringRef.fromString(canonicalMethodName), flags, null); + + final PsiModifierListStub modlist = new PsiModifierListStubImpl(stub, packMethodFlags(access)); + boolean parsedViaGenericSignature = false; + String returnType; + if (signature == null) { + returnType = parseMethodViaDescription(desc, stub, args); + } + else { + try { + returnType = parseMethodViaGenericSignature(signature, stub, args, throwables); + parsedViaGenericSignature = true; } - }; + catch (ClsFormatException e) { + returnType = parseMethodViaDescription(desc, stub, args); + } + } + + stub.setReturnType(TypeInfo.fromString(returnType)); + boolean nonStaticInnerClassConstructor = - isConstructor && !parsedViaGenericSignature[0] && !(myParent instanceof PsiFileStub) && (myModlist.getModifiersMask() & Opcodes.ACC_STATIC) == 0; + isConstructor && !parsedViaGenericSignature && !(myParent instanceof PsiFileStub) && (myModlist.getModifiersMask() & Opcodes.ACC_STATIC) == 0; final PsiParameterListStubImpl parameterList = new PsiParameterListStubImpl(stub); final int paramCount = args.size(); @@ -408,11 +406,11 @@ public class ClsStubBuilder { new PsiModifierListStubImpl(parameterStub, 0); } - String[] thrownTypes = buildThrowsList(exceptions, throwables, parsedViaGenericSignature[0]); + String[] thrownTypes = buildThrowsList(exceptions, throwables, parsedViaGenericSignature); new PsiClassReferenceListStubImpl(JavaStubElementTypes.THROWS_LIST, stub, thrownTypes, PsiReferenceList.Role.THROWS_LIST); int ignoreCount = (access & Opcodes.ACC_STATIC) != 0 ? 0 : 1; - return new AnnotationParamCollectingVisitor(stub, modlist[0], ignoreCount, paramCount, paramStubs); + return new AnnotationParamCollectingVisitor(stub, modlist, ignoreCount, paramCount, paramStubs); } private static String[] buildThrowsList(String[] exceptions, List throwables, boolean parsedViaGenericSignature) { diff --git a/java/java-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiMethodStubImpl.java b/java/java-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiMethodStubImpl.java index 53152ebf9c71..63240781cc2c 100644 --- a/java/java-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiMethodStubImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiMethodStubImpl.java @@ -33,7 +33,7 @@ import org.jetbrains.annotations.NotNull; import java.util.List; public class PsiMethodStubImpl extends StubBase implements PsiMethodStub { - private final TypeInfo myReturnType; + private TypeInfo myReturnType; private final byte myFlags; private final StringRef myName; private StringRef myDefaultValueText; @@ -51,16 +51,11 @@ public class PsiMethodStubImpl extends StubBase implements PsiMethodS final StringRef defaultValueText) { super(parent, isAnnotationMethod(flags) ? JavaStubElementTypes.ANNOTATION_METHOD : JavaStubElementTypes.METHOD); - myReturnType = createReturnType(); myFlags = flags; myName = name; myDefaultValueText = defaultValueText; } - protected TypeInfo createReturnType() { - return myReturnType; - } - public PsiMethodStubImpl(final StubElement parent, final StringRef name, final TypeInfo returnType, @@ -74,6 +69,10 @@ public class PsiMethodStubImpl extends StubBase implements PsiMethodS myDefaultValueText = defaultValueText; } + public void setReturnType(TypeInfo returnType) { + myReturnType = returnType; + } + public boolean isConstructor() { return (myFlags & CONSTRUCTOR) != 0; }