java: minor optimization

This commit is contained in:
Roman Shevchenko
2014-06-05 15:28:10 +04:00
parent f5f8124350
commit 49b602b19f
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -26,13 +26,12 @@ import com.intellij.psi.stubs.StubElement;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* @author max
*/
public class PsiParameterStubImpl extends StubBase<PsiParameter> implements PsiParameterStub {
private StringRef myName;
private boolean myGeneratedName = true;
private final TypeInfo myType;
private final boolean myIsEllipsis;
@@ -81,18 +80,11 @@ public class PsiParameterStubImpl extends StubBase<PsiParameter> implements PsiP
public void setName(String name) {
myName = StringRef.fromString(name);
myGeneratedName = false;
}
public boolean isAutoGeneratedName() {
final List children = getParentStub().getChildrenStubs();
int paramIndex = 0;
for (Object o : children) {
if (o instanceof PsiParameterStub) {
paramIndex++;
if (o == this) break;
}
}
return ("p" + paramIndex).equals(getName());
return myGeneratedName;
}
@Override