Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static JavaRefactoringActionHandlerFactory getInstance() {
* Creates handler for Introduce Parameter refactoring.<p>
*
* {@link RefactoringActionHandler#invoke(Project, PsiElement[], DataContext)}
* accepts either 1 <code>PsiExpression</code>, that will be an initialzier for introduced parameter,
* accepts either 1 <code>PsiExpression</code>, that will be an initializer for introduced parameter,
* or 1 <code>PsiLocalVariable</code>, that will be replaced with introduced parameter.
*/
public abstract RefactoringActionHandler createIntroduceParameterHandler();
Expand Down Expand Up @@ -181,7 +181,7 @@ public static JavaRefactoringActionHandlerFactory getInstance() {
* Creates handler for Introduce Field refactoring.<p>
*
* {@link RefactoringActionHandler#invoke(Project, PsiElement[], DataContext)}
* accepts either 1 <code>PsiExpression</code>, that will be an initialzier for introduced field,
* accepts either 1 <code>PsiExpression</code>, that will be an initializer for introduced field,
* or 1 <code>PsiLocalVariable</code>, that will be replaced with introduced field.
*/
public abstract RefactoringActionHandler createIntroduceFieldHandler();
Expand All @@ -190,15 +190,15 @@ public static JavaRefactoringActionHandlerFactory getInstance() {
* Creates handler for Introduce Variable refactoring.<p>
*
* {@link RefactoringActionHandler#invoke(Project, PsiElement[], DataContext)}
* accepts 1 <code>PsiExpression</code>, that will be an initialzier for introduced variable.
* accepts 1 <code>PsiExpression</code>, that will be an initializer for introduced variable.
*/
public abstract RefactoringActionHandler createIntroduceVariableHandler();

/**
* Creates handler for Introduce Constant refactoring.<p>
*
* {@link RefactoringActionHandler#invoke(Project, PsiElement[], DataContext)}
* accepts either 1 <code>PsiExpression</code>, that will be an initialzier for introduced constant,
* accepts either 1 <code>PsiExpression</code>, that will be an initializer for introduced constant,
* or 1 <code>PsiLocalVariable</code>, that will be replaced with introduced constant.
*/
public abstract IntroduceConstantHandler createIntroduceConstantHandler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Created by IntelliJ IDEA.
* User: max
* Date: Oct 12, 2001
* Time: 9:40:45 PM
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/

package com.intellij.java.analysis.impl.codeInspection.deadCode;

import com.intellij.java.analysis.codeInspection.GlobalJavaInspectionContext;
Expand Down Expand Up @@ -77,6 +67,10 @@

import java.util.*;

/**
* @author max
* @since 2001-10-12
*/
public abstract class UnusedDeclarationInspectionBase extends GlobalInspectionTool implements OldStyleInspection {
@Deprecated
public boolean ADD_MAINS_TO_ENTRIES = true;
Expand Down Expand Up @@ -661,7 +655,7 @@ private static class CodeScanner extends RefJavaVisitor {
@Override
public void visitMethod(@Nonnull RefMethod method) {
if (!myProcessedMethods.contains(method)) {
// Process class's static intitializers
// Process class's static initializers
if (method.isStatic() || method.isConstructor()) {
if (method.isConstructor()) {
addInstantiatedClass(method.getOwnerClass());
Expand Down Expand Up @@ -695,7 +689,7 @@ public void visitClass(@Nonnull RefClass refClass) {
((RefClassImpl)refClass).setReachable(true);

if (!alreadyActive) {
// Process class's static intitializers.
// Process class's static initializers.
makeClassInitializersReachable(refClass);
}

Expand All @@ -704,7 +698,7 @@ public void visitClass(@Nonnull RefClass refClass) {

@Override
public void visitField(@Nonnull RefField field) {
// Process class's static intitializers.
// Process class's static initializers.
if (!field.isReachable()) {
makeContentReachable((RefJavaElementImpl)field);
makeClassInitializersReachable(field.getOwnerClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ public void parseClassTypeSignature(CharacterIterator it, StringBuilder buf) thr

super.parseClassTypeSignature(it, buf);

final String qName = convertToQalifiedName(buf.substring(start + 1, buf.length() - 1));
final String qName = convertToQualifiedName(buf.substring(start + 1, buf.length() - 1));
myInterfaceBounds.add(qName);
}
else {
super.parseClassTypeSignature(it, buf);
}
}

private static String convertToQalifiedName(String ifaceSignature) {
private static String convertToQualifiedName(String ifaceSignature) {
ifaceSignature = ifaceSignature.replaceAll("<.*>", "");
return ifaceSignature.replace('/', '.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,19 +285,19 @@ public TargetOptionsComponent(Project project) {
add(tableComp, constraints(0, 2, 2, 1, 1.0, 1.0, GridBagConstraints.BOTH));
}

private static GridBagConstraints constraints(final int gridx,
final int gridy,
final int gridwidth,
final int gridheight,
final double weightx,
final double weighty,
private static GridBagConstraints constraints(final int gridX,
final int gridY,
final int gridWidth,
final int gridHeight,
final double weightX,
final double weightY,
final int fill) {
return new GridBagConstraints(gridx,
gridy,
gridwidth,
gridheight,
weightx,
weighty,
return new GridBagConstraints(gridX,
gridY,
gridWidth,
gridHeight,
weightX,
weightY,
GridBagConstraints.WEST,
fill,
new Insets(5, 5, 0, 0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ byte[] processClassFile(CompileContext compileContext,
Cache newClassesCache,
int classId,
File file,
ThrowableComputable<byte[], IOException> bytesCompitable,
ThrowableComputable<byte[], IOException> bytesComputable,
InstrumentationClassFinder classFinder) throws IOException, CacheCorruptedException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public byte[] processClassFile(CompileContext compileContext,
Cache newClassesCache,
int classId,
File file,
ThrowableComputable<byte[], IOException> bytesCompitable,
ThrowableComputable<byte[], IOException> bytesComputable,
InstrumentationClassFinder classFinder) throws IOException, CacheCorruptedException
{
Sdk jdk = JavaCompilerUtil.getSdkForCompilation(affectedModule);
Expand All @@ -70,7 +70,7 @@ public byte[] processClassFile(CompileContext compileContext,
return null;
}

byte[] bytes = bytesCompitable.compute();
byte[] bytes = bytesComputable.compute();
FailSafeClassReader reader = new FailSafeClassReader(bytes, 0, bytes.length);

assert classFinder != null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
import jakarta.annotation.Nullable;

/**
* Created by IntelliJ IDEA.
* User: michael.golubev
* @author michael.golubev
*/
public interface DebugUIEnvironment {
DebugEnvironment getEnvironment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void createRequest(DebugProcessImpl debugProcess)
@Override
public void processClassPrepare(DebugProcess debugProcess, ReferenceType refType)
{
// should be emty - does not make sense for this breakpoint
// should be empty - does not make sense for this breakpoint
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
import jakarta.annotation.Nonnull;

/**
* User: Irina.Chernushina
* Date: 8/5/11
* Time: 7:46 PM
* @author Irina.Chernushina
* @since 2011-08-05
*/
@ExtensionAPI(ComponentScope.APPLICATION)
public interface ExceptionFilterFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
import jakarta.annotation.Nonnull;

/**
* Created by IntelliJ IDEA.
* User: Irina.Chernushina
* Date: 8/8/11
* Time: 12:11 PM
* @author Irina.Chernushina
* @since 2011-08-08
*/
@ExtensionImpl
public class ExceptionBaseFilterFactory implements ExceptionFilterFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public interface PsiAssertStatement extends PsiStatement{
/**
* Returns the expression representing the asserted condition.
*
* @return the asserted conditione expression, or null if the assert statement
* @return the asserted condition expression, or null if the assert statement
* is incomplete.
*/
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
public class JavaDocUtil {
private static final Logger LOG = Logger.getInstance(JavaDocUtil.class);

private static final
@NonNls
Pattern ourTypePattern = Pattern.compile("[ ]+[^ ^\\[^\\]]");
private static final Pattern ourTypePattern = Pattern.compile("[ ]+[^ ^\\[^\\]]");

private JavaDocUtil() {
}
Expand All @@ -49,22 +47,22 @@ private JavaDocUtil() {
* @return length of the extracted reference
*/
public static int extractReference(String text) {
int lparenthIndex = text.indexOf('(');
int lParenIndex = text.indexOf('(');
int spaceIndex = text.indexOf(' ');
if (spaceIndex < 0) {
spaceIndex = text.length();
}
if (lparenthIndex < 0) {
if (lParenIndex < 0) {
return spaceIndex;
} else {
if (spaceIndex < lparenthIndex) {
if (spaceIndex < lParenIndex) {
return spaceIndex;
}
int rparenthIndex = text.indexOf(')', lparenthIndex);
if (rparenthIndex < 0) {
rparenthIndex = text.length() - 1;
int rParenIndex = text.indexOf(')', lParenIndex);
if (rParenIndex < 0) {
rParenIndex = text.length() - 1;
}
return rparenthIndex + 1;
return rParenIndex + 1;
}
}

Expand Down Expand Up @@ -124,8 +122,8 @@ public static PsiElement findReferenceTarget(PsiManager manager, String refText,

@Nullable
private static PsiElement findReferencedMember(PsiClass aClass, String memberRefText, PsiElement context) {
int parenthIndex = memberRefText.indexOf('(');
if (parenthIndex < 0) {
int parenIndex = memberRefText.indexOf('(');
if (parenIndex < 0) {
String name = memberRefText;
PsiField field = aClass.findFieldByName(name, true);
if (field != null) {
Expand All @@ -143,25 +141,25 @@ private static PsiElement findReferencedMember(PsiClass aClass, String memberRef
}
return null;
} else {
String name = memberRefText.substring(0, parenthIndex).trim();
String name = memberRefText.substring(0, parenIndex).trim();
int rparenIndex = memberRefText.lastIndexOf(')');
if (rparenIndex == -1) {
return null;
}

String parmsText = memberRefText.substring(parenthIndex + 1, rparenIndex).trim();
StringTokenizer tokenizer = new StringTokenizer(parmsText.replaceAll("[*]", ""), ",");
String paramsText = memberRefText.substring(parenIndex + 1, rparenIndex).trim();
StringTokenizer tokenizer = new StringTokenizer(paramsText.replaceAll("[*]", ""), ",");
PsiType[] types = new PsiType[tokenizer.countTokens()];
int i = 0;
PsiElementFactory factory = JavaPsiFacade.getInstance(aClass.getProject()).getElementFactory();
while (tokenizer.hasMoreTokens()) {
String parmText = tokenizer.nextToken().trim();
String paramText = tokenizer.nextToken().trim();
try {
Matcher typeMatcher = ourTypePattern.matcher(parmText);
String typeText = parmText;
Matcher typeMatcher = ourTypePattern.matcher(paramText);
String typeText = paramText;

if (typeMatcher.find()) {
typeText = parmText.substring(0, typeMatcher.start());
typeText = paramText.substring(0, typeMatcher.start());
}

PsiType type = factory.createTypeFromText(typeText, context);
Expand All @@ -173,27 +171,27 @@ private static PsiElement findReferencedMember(PsiClass aClass, String memberRef
PsiMethod[] methods = aClass.findMethodsByName(name, true);
MethodsLoop:
for (PsiMethod method : methods) {
PsiParameter[] parms = method.getParameterList().getParameters();
if (parms.length != types.length) {
PsiParameter[] params = method.getParameterList().getParameters();
if (params.length != types.length) {
continue;
}

for (int k = 0; k < parms.length; k++) {
PsiParameter parm = parms[k];
final PsiType parmType = parm.getType();
for (int k = 0; k < params.length; k++) {
PsiParameter param = params[k];
final PsiType paramType = param.getType();
if (types[k] != null &&
!TypeConversionUtil.erasure(parmType).getCanonicalText().equals(types[k].getCanonicalText
!TypeConversionUtil.erasure(paramType).getCanonicalText().equals(types[k].getCanonicalText
()) &&
!parmType.getCanonicalText().equals(types[k].getCanonicalText()) &&
!TypeConversionUtil.isAssignable(parmType, types[k])) {
!paramType.getCanonicalText().equals(types[k].getCanonicalText()) &&
!TypeConversionUtil.isAssignable(paramType, types[k])) {
continue MethodsLoop;
}
}

int hashIndex = memberRefText.indexOf('#', rparenIndex);
if (hashIndex != -1) {
int parameterNumber = Integer.parseInt(memberRefText.substring(hashIndex + 1));
if (parameterNumber < parms.length) {
if (parameterNumber < params.length) {
return method.getParameterList().getParameters()[parameterNumber].getNavigationElement();
}
}
Expand Down Expand Up @@ -233,14 +231,14 @@ public static String getReferenceText(Project project, PsiElement element) {
buffer.append("#");
buffer.append(name);
buffer.append("(");
PsiParameter[] parms = method.getParameterList().getParameters();
PsiParameter[] params = method.getParameterList().getParameters();
boolean spaceBeforeComma = JavaDocCodeStyle.getInstance(project).spaceBeforeComma();
boolean spaceAfterComma = JavaDocCodeStyle.getInstance(project).spaceAfterComma();
for (int i = 0; i < parms.length; i++) {
PsiParameter parm = parms[i];
String typeText = TypeConversionUtil.erasure(parm.getType()).getCanonicalText();
for (int i = 0; i < params.length; i++) {
PsiParameter param = params[i];
String typeText = TypeConversionUtil.erasure(param.getType()).getCanonicalText();
buffer.append(typeText);
if (i < parms.length - 1) {
if (i < params.length - 1) {
if (spaceBeforeComma) {
buffer.append(" ");
}
Expand Down Expand Up @@ -335,18 +333,18 @@ public static String getLabelText(Project project, PsiManager manager, String re

private static String getMemberLabelText(Project project, PsiManager manager, String memberText,
PsiElement context) {
int parenthIndex = memberText.indexOf('(');
if (parenthIndex < 0) {
int parenIndex = memberText.indexOf('(');
if (parenIndex < 0) {
return memberText;
}
if (!StringUtil.endsWithChar(memberText, ')')) {
return memberText;
}
String parms = memberText.substring(parenthIndex + 1, memberText.length() - 1);
String params = memberText.substring(parenIndex + 1, memberText.length() - 1);
StringBuffer buffer = new StringBuffer();
boolean spaceBeforeComma = JavaDocCodeStyle.getInstance(project).spaceBeforeComma();
boolean spaceAfterComma = JavaDocCodeStyle.getInstance(project).spaceAfterComma();
StringTokenizer tokenizer = new StringTokenizer(parms, ",");
StringTokenizer tokenizer = new StringTokenizer(params, ",");
while (tokenizer.hasMoreTokens()) {
String param = tokenizer.nextToken().trim();
int index1 = param.indexOf('[');
Expand All @@ -372,7 +370,7 @@ private static String getMemberLabelText(Project project, PsiManager manager, St
}
}
}
return memberText.substring(0, parenthIndex + 1) + buffer.toString() + ")";
return memberText.substring(0, parenIndex + 1) + buffer.toString() + ")";
}

public static PsiClassType[] getImplementsList(PsiClass aClass) {
Expand Down
Loading
Loading