Merge remote-tracking branch 'origin/master'

This commit is contained in:
Konstantin Bulenkov
2012-10-18 16:56:21 +02:00
705 changed files with 1528 additions and 1564 deletions
@@ -270,6 +270,15 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
}
}
private static boolean isExternalizableNoParameterConstructor(PsiMethod method, RefClass refClass) {
if (!method.isConstructor()) return false;
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) return false;
final PsiParameterList parameterList = method.getParameterList();
if (parameterList.getParametersCount() != 0) return false;
final PsiClass aClass = method.getContainingClass();
return aClass == null || isExternalizable(aClass, refClass);
}
private static boolean isSerializationImplicitlyUsedField(PsiField field) {
@NonNls final String name = field.getName();
if (!HighlightUtil.SERIAL_VERSION_UID_FIELD_NAME.equals(name) && !"serialPersistentFields".equals(name)) return false;
@@ -330,6 +339,15 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
return false;
}
private static boolean isExternalizable(PsiClass aClass, RefClass refClass) {
final GlobalSearchScope scope = aClass.getResolveScope();
final PsiClass externalizableClass = JavaPsiFacade.getInstance(aClass.getProject()).findClass("java.io.Externalizable", scope);
if (externalizableClass == null) {
return false;
}
return isSerializable(aClass, refClass, externalizableClass);
}
private static boolean isSerializable(PsiClass aClass, RefClass refClass, PsiClass serializableClass) {
if (aClass == null) return false;
if (aClass.isInheritor(serializableClass, true)) return true;
@@ -600,7 +618,7 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
private static boolean isSerializablePatternMethod(PsiMethod psiMethod, RefClass refClass) {
return isReadObjectMethod(psiMethod, refClass) || isWriteObjectMethod(psiMethod, refClass) || isReadResolveMethod(psiMethod, refClass) ||
isWriteReplaceMethod(psiMethod, refClass);
isWriteReplaceMethod(psiMethod, refClass) || isExternalizableNoParameterConstructor(psiMethod, refClass);
}
private void enqueueMethodUsages(final RefMethod refMethod) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -24,7 +24,6 @@ import com.intellij.codeInspection.miscGenerics.SuspiciousCollectionsMethodCalls
import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiUtil;
@@ -82,7 +81,7 @@ public class RedundantCastInspection extends GenericsInspectionToolBase {
@Override
public JComponent createOptionsPanel() {
final MultipleCheckboxOptionsPanel optionsPanel = new MultipleCheckboxOptionsPanel(this);
optionsPanel.addCheckbox("Ignore casts appeared in suspicious collections method calls", "IGNORE_SUSPICIOUS_METHOD_CALLS");
optionsPanel.addCheckbox("Ignore casts in suspicious collections method calls", "IGNORE_SUSPICIOUS_METHOD_CALLS");
optionsPanel.addCheckbox("Ignore casts to invoke @NotNull method which overrides @Nullable", "IGNORE_ANNOTATED_METHODS");
return optionsPanel;
}
@@ -167,9 +167,7 @@ public class MakeMethodStaticProcessor extends MakeMethodOrClassStaticProcessor<
PsiReferenceExpression methodRef = (PsiReferenceExpression) element;
PsiElement parent = methodRef.getParent();
LOG.assertTrue(parent instanceof PsiMethodCallExpression);
PsiMethodCallExpression methodCall = (PsiMethodCallExpression) parent;
PsiExpression instanceRef;
instanceRef = methodRef.getQualifierExpression();
@@ -192,21 +190,25 @@ public class MakeMethodStaticProcessor extends MakeMethodOrClassStaticProcessor<
if (mySettings.getNewParametersNumber() > 1) {
int copyingSafetyLevel = RefactoringUtil.verifySafeCopyExpression(instanceRef);
if (copyingSafetyLevel == RefactoringUtil.EXPR_COPY_PROHIBITED) {
String tempVar = RefactoringUtil.createTempVar(instanceRef, methodCall, true);
String tempVar = RefactoringUtil.createTempVar(instanceRef, parent, true);
instanceRef = factory.createExpressionFromText(tempVar, null);
}
}
PsiElement anchor = null;
PsiExpressionList argList = methodCall.getArgumentList();
PsiExpression[] exprs = argList.getExpressions();
if (mySettings.isMakeClassParameter()) {
if (exprs.length > 0) {
anchor = argList.addBefore(instanceRef, exprs[0]);
}
else {
anchor = argList.add(instanceRef);
PsiExpressionList argList = null;
PsiExpression[] exprs = new PsiExpression[0];
if (parent instanceof PsiMethodCallExpression) {
argList = ((PsiMethodCallExpression)parent).getArgumentList();
exprs = argList.getExpressions();
if (mySettings.isMakeClassParameter()) {
if (exprs.length > 0) {
anchor = argList.addBefore(instanceRef, exprs[0]);
}
else {
anchor = argList.add(instanceRef);
}
}
}
@@ -31,14 +31,17 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.search.searches.MethodReferencesSearch;
import com.intellij.refactoring.HelpID;
import com.intellij.refactoring.RefactoringActionHandler;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.util.CommonRefactoringUtil;
import com.intellij.util.Processor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -83,7 +86,7 @@ public class MakeStaticHandler implements RefactoringActionHandler {
invoke(member);
}
public static void invoke(PsiTypeParameterListOwner member) {
public static void invoke(final PsiTypeParameterListOwner member) {
final Project project = member.getProject();
final InternalUsageInfo[] classRefsInMember = MakeStaticUtil.findClassRefsInMember(member, false);
@@ -95,7 +98,26 @@ public class MakeStaticHandler implements RefactoringActionHandler {
AbstractMakeStaticDialog dialog;
if (!ApplicationManager.getApplication().isUnitTestMode()) {
if (classRefsInMember.length > 0) {
final boolean[] hasMethodReferenceOnInstance = new boolean[] {false};
if (member instanceof PsiMethod) {
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
@Override
public void run() {
hasMethodReferenceOnInstance[0] = !MethodReferencesSearch.search((PsiMethod)member).forEach(new Processor<PsiReference>() {
@Override
public boolean process(PsiReference reference) {
final PsiElement element = reference.getElement();
if (element instanceof PsiMethodReferenceExpression) {
return false;
}
return true;
}
});
}
}, "Search for method references", true, project)) return;
}
if (classRefsInMember.length > 0 || hasMethodReferenceOnInstance[0]) {
final PsiType type = JavaPsiFacade.getInstance(project).getElementFactory().createType(member.getContainingClass());
//TODO: callback
String[] nameSuggestions =
@@ -0,0 +1,9 @@
class Test4 {
void test() {
Foo2<Test4> f = Test4::yyy;
}
static void yyy(Test4 anObject) {}
}
interface Foo2<T> {
void bar(T j);
}
@@ -0,0 +1,9 @@
class Test4 {
void test() {
Foo2<Test4> f = Test4::yyy;
}
void yy<caret>y() {}
}
interface Foo2<T> {
void bar(T j);
}
@@ -19,7 +19,6 @@ import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.TargetElementUtilBase;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiTypeParameterListOwner;
import com.intellij.refactoring.makeStatic.MakeMethodStaticProcessor;
import com.intellij.refactoring.makeStatic.MakeStaticUtil;
import com.intellij.refactoring.makeStatic.Settings;
@@ -186,13 +185,21 @@ public class MakeMethodStaticTest extends LightRefactoringTestCase {
assertFalse(MakeStaticUtil.isParameterNeeded((PsiMethod)element));
}
public void testMethodReference() throws Exception {
doTest(true);
}
public void testPreserveParametersAlignment() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(false);
}
private void doTest(final boolean addClassParameter) throws Exception {
configureByFile("/refactoring/makeMethodStatic/before" + getTestName(false) + ".java");
perform(false);
perform(addClassParameter);
checkResultByFile("/refactoring/makeMethodStatic/after" + getTestName(false) + ".java");
}
@@ -358,7 +358,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
context.checkCanceled();
if (!forms.isEmpty() || addNotNullAssertions) {
if (diagnosticSink.getErrorCount() == 0 && (!forms.isEmpty() || addNotNullAssertions)) {
final Map<File, String> chunkSourcePath = ProjectPaths.getSourceRootsWithDependents(chunk);
final InstrumentationClassFinder finder = createInstrumentationClassFinder(platformCp, classpath, chunkSourcePath, outputSink);
@@ -367,8 +367,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
try {
context.processMessage(new ProgressMessage("Instrumenting forms [" + chunkName + "]"));
instrumentForms(context, chunk, chunkSourcePath, finder, forms, outputSink);
JpsUiDesignerConfiguration configuration = JpsUiDesignerExtensionService.getInstance().getUiDesignerConfiguration(
pd.getProject());
JpsUiDesignerConfiguration configuration = JpsUiDesignerExtensionService.getInstance().getUiDesignerConfiguration(pd.getProject());
if (configuration != null && configuration.isCopyFormsRuntimeToOutput()) {
for (ModuleBuildTarget target : chunk.getTargets()) {
if (!target.isTests()) {
@@ -17,6 +17,7 @@ package com.intellij.application.options;
import com.intellij.application.options.codeStyle.*;
import com.intellij.lang.Language;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationBundle;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
@@ -482,6 +483,13 @@ public abstract class TabbedLanguageCodeStylePanel extends CodeStyleAbstractPane
public ConfigurableWrapper(@NotNull Configurable configurable, CodeStyleSettings settings) {
super(settings);
myConfigurable = configurable;
Disposer.register(this, new Disposable() {
@Override
public void dispose() {
myConfigurable.disposeUIResources();
}
});
}
@Override
@@ -105,7 +105,7 @@ public class InstalledPluginsTableModel extends PluginTableModel {
return false;
}
public static void updateExistingPlugin(IdeaPluginDescriptor descriptor, IdeaPluginDescriptor existing) {
public static void updateExistingPlugin(IdeaPluginDescriptor descriptor, @Nullable IdeaPluginDescriptor existing) {
if (existing != null) {
updateExistingPluginInfo(descriptor, existing);
updatedPlugins.add(existing.getPluginId());
@@ -601,14 +601,16 @@ public final class UpdateChecker {
boolean installed = false;
for (PluginDownloader downloader : downloaders) {
if (getDisabledToUpdatePlugins().contains(downloader.getPluginId())) continue;
try {
final IdeaPluginDescriptor descriptor = downloader.getDescriptor();
InstalledPluginsTableModel.updateExistingPlugin(descriptor, PluginManager.getPlugin(descriptor.getPluginId()));
downloader.install();
installed = true;
}
catch (IOException e) {
LOG.info(e);
final IdeaPluginDescriptor descriptor = downloader.getDescriptor();
if (descriptor != null) {
try {
InstalledPluginsTableModel.updateExistingPlugin(descriptor, PluginManager.getPlugin(descriptor.getPluginId()));
downloader.install();
installed = true;
}
catch (IOException e) {
LOG.info(e);
}
}
}
return installed;
@@ -45,7 +45,7 @@ public class ProjectFileType implements InternalFileType {
}
public Icon getIcon() {
return AllIcons.Nodes.IdeaProject;
return AllIcons.Nodes.IdeaModule;
}
public boolean isBinary() {
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2011 Bas Leijdekkers
* Copyright 2006-2012 Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,8 +36,7 @@ public class SimplifiableIfStatementInspection extends BaseInspection {
@Override
@NotNull
public String getDisplayName() {
return InspectionGadgetsBundle.message(
"simplifiable.if.statement.display.name");
return InspectionGadgetsBundle.message("simplifiable.if.statement.display.name");
}
@Override
@@ -175,23 +174,31 @@ public class SimplifiableIfStatementInspection extends BaseInspection {
return builder.toString();
}
private static void getPresentableText(PsiElement element, StringBuilder builder) {
private static void getPresentableText(@Nullable PsiElement element, StringBuilder builder) {
if (element == null) {
return;
}
if (element instanceof PsiWhiteSpace) {
final PsiElement prevSibling = element.getPrevSibling();
if (prevSibling instanceof PsiComment) {
final PsiComment comment = (PsiComment)prevSibling;
if (JavaTokenType.END_OF_LINE_COMMENT.equals(comment.getTokenType())) {
builder.append('\n');
return;
}
}
builder.append(' ');
return;
}
final PsiElement[] children = element.getChildren();
if (children.length != 0) {
if (children.length == 0) {
builder.append(element.getText());
}
else {
for (PsiElement child : children) {
getPresentableText(child, builder);
}
}
else {
builder.append(element.getText());
}
}
@@ -258,10 +265,10 @@ public class SimplifiableIfStatementInspection extends BaseInspection {
private static class SimplifiableIfStatementFix extends InspectionGadgetsFix {
@Override
@NotNull
public String getName() {
return InspectionGadgetsBundle.message(
"constant.conditional.expression.simplify.quickfix");
return InspectionGadgetsBundle.message("constant.conditional.expression.simplify.quickfix");
}
@Override
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports usages of absolute alignment constants from AWT and Swing. Internationalized applications should make use of
Reports usages of absolute alignment constants from AWT and Swing. Internationalized applications should make use of
relative alignment, because it respects locale component orientation settings.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports abstract classes which extend concrete classes.
Reports abstract classes which extend concrete classes.
<!-- tooltip end -->
<p>
<small>Powered by InspectionGadgets</small>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports abstract classes which have no
Reports abstract classes which have no
concrete subclasses.
<!-- tooltip end -->
<p>
@@ -3,7 +3,7 @@
This inspection is intended for J2ME and other highly resource constrained environments.
Applying the results of this inspection without consideration might have negative effects on code clarity and design.
<p>
This inspection reports abstract classes which have precisely one
Reports abstract classes which have precisely one
direct inheritor. While such classes may offer admirable clarity of design,
in memory-constrained or bandwidth-limited environments, they needlessly increase
the total footprint of the application. Consider merging the abstract class with its inheritor.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports abstract classes without abstract methods.
Reports abstract classes without abstract methods.
<!-- tooltip end -->
<p>
<small>Powered by InspectionGadgets</small>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any calls of abstract methods within a constructor of an
Reports any calls of abstract methods within a constructor of an
abstract class. Such calls may result in subtle bugs, as the object is not guaranteed to be initialized
before the method call occurs.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports <b>abstract</b> methods which override <b>abstract</b> methods. Methods with
Reports <b>abstract</b> methods which override <b>abstract</b> methods. Methods with
different return types or exception declarations than the method they override are not
reported by this inspection.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports abstract methods which override concrete methods.
Reports abstract methods which override concrete methods.
Methods overridden from <b>java.lang.Object</b> are not reported
by this inspection.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any abstract methods which are not implemented in every concrete
Reports any abstract methods which are not implemented in every concrete
subclass. This is a compile-time error on the subclasses, while this inspection
reports the problem at the point of the abstract method.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports on any access to a <b>static</b> field
Reports on any access to a <b>static</b> field
of any non-threadsafe type specified below, which is accessed from an instance field or a
non-synchronized block. It is possible that the static field is accessed from
multiple threads, which can lead to unspecified side effects.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports on any access to a non-constant <b>static</b> field which is
Reports on any access to a non-constant <b>static</b> field which is
locked on either <b>this</b> or an instance field of <b>this</b>.
Locking a <b>static</b> field on instance data does not prevent the field from being
modified by other instances, and thus may result in surprising race conditions.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports field accesses of a super class where a local variable, parameter or field of the same name is available
Reports field accesses of a super class where a local variable, parameter or field of the same name is available
in the surrounding class. In this case a cursory reader of the code may think that a variable in the surrounding class is
accessed, when in fact a field from the super class is accessed. To make the intent of the code more clear it is recommended to add a
<b>this</b> qualifier to the field access call.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any method calls to super methods where a method
Reports any method calls to super methods where a method
with the same name is available in the surrounding class. In this case a cursory
reader of the code may think that a method in the surrounding class is
called, when in fact a method from the super class is called. To make the
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any uses of annotations.
Reports any uses of annotations.
Annotations are not supported under Java 1.4 or earlier JVMs.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports annotation interfaces.
Reports annotation interfaces.
Such interfaces are not supported under Java 1.4 or earlier JVMs.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports annotation classes whose names are either too short, too long, or do not follow
Reports annotation classes whose names are either too short, too long, or do not follow
the specified regular expression pattern.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports anonymous inner classes with too high of a total complexity. The
Reports anonymous inner classes with too high of a total complexity. The
total complexity of a class is the sum of the cyclomatic complexities of all the methods
and initializers the class declares. Inherited methods and initializers are not counted
toward the total complexity. Anonymous classes with more than very low complexities may be
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports anonymous inner class with too many methods.
Reports anonymous inner class with too many methods.
Anonymous classes with more than a very low number of methods may be
difficult to understand, and should probably be promoted to become named inner classes.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports anonymous class variables being named identically to variables of a containing method.
Reports anonymous class variables being named identically to variables of a containing method.
Such a variable name may be confusing.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any anonymous inner classes.
Reports any anonymous inner classes.
Some code standards discourage the use of anonymous inner classes.
<!-- tooltip end -->
<p>
@@ -3,7 +3,7 @@
This inspection is intended for J2ME and other highly resource constrained environments.
Applying the results of this inspection without consideration might have negative effects on code clarity and design.
<p>
This inspection reports any anonymous inner classes which may safely be made into a named
Reports any anonymous inner classes which may safely be made into a named
<b>static</b> inner class. An inner class may be static if it doesn't reference
its enclosing class instance or local variables. A static inner class uses slightly less memory.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any calls to <b>Integer.getInteger()</b> or <b>Boolean.getBoolean()</b>.
Reports any calls to <b>Integer.getInteger()</b> or <b>Boolean.getBoolean()</b>.
These methods fetch integer and boolean values from the
system properties for a given key. Due to their underexpressive names and confusing
location of functionality, it's easy for novice programmers to attempt to use these
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any use of <b>==</b> to test for Array equality,
Reports any use of <b>==</b> to test for Array equality,
rather than the <b>"java.util.Arrays.equals()"</b> method.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports <b>equals()</b> being called
Reports <b>equals()</b> being called
to compare two arrays. Calling <b>equals()</b> on an array
compares identity and is equivalent to using <b>==</b>. Use
<b>Arrays.equals()</b> to compare the contents of two arrays
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports <b>hashCode()</b> being called
Reports <b>hashCode()</b> being called
on an array. To get the same hash code for two arrays
with identical contents call <b>Arrays.hashCode()</b>.
Use <b>Arrays.deepHashCode()</b> to calculate the hash
@@ -3,7 +3,7 @@
This inspection is intended for J2ME and other highly resource constrained environments.
Applying the results of this inspection without consideration might have negative effects on code clarity and design.
<p>
This inspection reports any access to the <b>.length</b> of an array in the condition part of a
Reports any access to the <b>.length</b> of an array in the condition part of a
loop statement. In highly resource constrained environments, such calls may
have adverse performance implications.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any calls to <b>Arrays.asList()</b> with zero arguments or only one argument. Such calls could be replaced
Reports any calls to <b>Arrays.asList()</b> with zero arguments or only one argument. Such calls could be replaced
with either a call to <b>Collections.singletonList()</b> or <b>Collections.emptyList()</b> which will save some memory.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports variables, methods, or classes named
Reports variables, methods, or classes named
<b>assert</b>. Such names are legal under Java 1.3 or
earlier JVMs, but will cause problems under Java 1.4 or later.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any calls to JUnit's <b>assertEquals()</b>
Reports any calls to JUnit's <b>assertEquals()</b>
method where the expected result and actual result arguments are of incompatible
types. While such a call might theoretically be useful, most likely it represents a bug.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any calls to JUnit's <b>assertEquals()</b>
Reports any calls to JUnit's <b>assertEquals()</b>
method with arguments of type array. Arrays should be checked with one of the
<b>assertArrayEquals()</b> methods.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any calls to <b>org.junit.Assert.assertEquals()</b>
Reports any calls to <b>org.junit.Assert.assertEquals()</b>
or <b>junit.framework.Assert.assertEquals()</b> which
can be replaced with an equivalent call to <b>assertSame()</b>.
This is possible when the arguments are instances of a final class which does not override
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports <b>assert</b> statements.
Reports <b>assert</b> statements.
Such statements are not supported under Java 1.3 or earlier JVMs.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any <b>assert</b> statements
Reports any <b>assert</b> statements
that cause side effects outside of the assert statement. Since assertions can be
switched off, the side effects are not guaranteed to happen and can cause subtle bugs.
Common unwanted side effects detected by this inspection are modifications of variables
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports calls to JUnit <b>assertXXX()</b> or <b>fail()</b> methods that do not have an error message string argument.
Reports calls to JUnit <b>assertXXX()</b> or <b>fail()</b> methods that do not have an error message string argument.
An error message on assertion failure may help clarify the test case's intent.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports assignment to variable declared as a <b>catch</b> block parameter.
Reports assignment to variable declared as a <b>catch</b> block parameter.
While occasionally intended, this construct can be confusing.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any attempt to assign an array or <b>Collection</b> field from a method parameter.
Reports any attempt to assign an array or <b>Collection</b> field from a method parameter.
Since the array or <b>Collection</b> may have its contents modified by the calling method, this construct may
result in an object having its state modified unexpectedly. While occasionally useful for performance
reasons, this construct is inherently bug-prone.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any attempt to assign a <b>java.lang.Date</b> or
Reports any attempt to assign a <b>java.lang.Date</b> or
<b>java.lang.Calendar</b> field from a method parameter.
Since <b>Date</b> or <b>Calendar</b> are often
treated as immutable values but are actually mutable, assigning to such a field from a method parameter may
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports assignment a variable declared in a <b>for</b> statement
Reports assignment a variable declared in a <b>for</b> statement
in the body of that statement. It also reports any attempt to increment or decrement the variable.
While occasionally intended, this construct can be extremely confusing, and is often the result of a typo.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports assignment to a
Reports assignment to a
variable declared as a method parameter. It also reports any attempt to increment or decrement the variable.
While occasionally intended, this construct can be extremely confusing, and is often the result of a typo.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports the assignment of a variable to
Reports the assignment of a variable to
<b>null</b>, outside of declarations.
While occasionally useful for triggering garbage collection, this
construct may make the code more prone
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any assignments to <b>static</b> fields from within
Reports any assignments to <b>static</b> fields from within
instance methods. While legal, such assignments are tricky to do
safely, and are often a result of fields being inadvertently marked
<b>static</b>.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports an assignment being
Reports an assignment being
used as the condition of an <b>if</b>, <b>while</b>, <b>for</b> or
<b>do</b> statement. While occasionally intended,
this usage is confusing, and often indicates a typo
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports "auto-boxing", i.e. the automatic wrapping of primitive values as objects, where needed.
Reports "auto-boxing", i.e. the automatic wrapping of primitive values as objects, where needed.
Code which relies on auto-boxing will not work in pre-Java 5.0 environments.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports "auto-unboxing", e.g. the automatic unwrapping of objects into primitive values, where needed.
Reports "auto-unboxing", e.g. the automatic unwrapping of objects into primitive values, where needed.
Code which relies on auto-boxing will not work in pre-Java 5.0 environments.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports on any call to <b>java.util.concurrent.locks.Condition.await()</b> not made inside a loop.
Reports on any call to <b>java.util.concurrent.locks.Condition.await()</b> not made inside a loop.
<b>await()</b> and related methods are normally
used to suspend a thread until a condition is signalled as true, and that condition should be checked after the <b>await()</b>
returns. A loop is the clearest way to achieve this.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports on any call to <b>Condition.signal()</b>
Reports on any call to <b>Condition.signal()</b>
or <b>Condition.signalAll()</b>
for which no call to a corresponding <b>Condition.await()</b>
can be found. Only calls which target fields of the current class are reported by this inspection.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports <b>catch</b> clauses
Reports <b>catch</b> clauses
which catch inappropriate exceptions. Some exceptions, for instance
<b>java.lang.NullPointerException</b> and
<b>java.lang.IllegalMonitorStateException</b> represent programming errors
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports inappropriate exceptions declared by methods. One use of this inspection would be to warn of
Reports inappropriate exceptions declared by methods. One use of this inspection would be to warn of
<b>throws</b> clauses which declare overly generic exceptions (e.g. <b>java.lang.Exception</b> or <b>java.lang.Throwable</b>).
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports <b>throw</b> statements
Reports <b>throw</b> statements
which throw inappropriate exceptions. One use of this inspection would be to warn of
<b>throw</b> statements which throw overly generic exceptions
(e.g. <b>java.lang.Exception</b> or <b>java.io.IOException</b>).
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any checks for oddness of the form:
Reports any checks for oddness of the form:
<code><pre>x % 2 == 1</pre></code>
Such checks will fail for negative odd values, which is probably not the behaviour intended. Consider using:
<code><pre>x % 2 != 0</pre></code> or: <code><pre>(x & 1) == 1</pre></code> instead.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports JUnit 4.0 <b>@BeforeClass</b> or <b>@AfterClass</b> method
Reports JUnit 4.0 <b>@BeforeClass</b> or <b>@AfterClass</b> method
is not declared
<b>public static</b>, does not return <b>void</b>, or takes arguments.
Such methods are easy to create inadvertently, and will not be executed by JUnit tests runners.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports JUnit 4.0 <b>@Before</b> or <b>@After</b> method
Reports JUnit 4.0 <b>@Before</b> or <b>@After</b> method
is not declared
<b>public</b>, does not return <b>void</b>, or takes arguments.
Such methods are easy to create inadvertently, and will not be executed by JUnit tests runners.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports <b>.equals()</b> being called
Reports <b>.equals()</b> being called
to compare two <b>java.math.BigDecimal</b> numbers. This is normally
a mistake, as two <b>java.math.BigDecimal</b>s are only equal if
they are equal in both value and scale, so that 2.0 is not equal to 2.00
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any attempt to instantiate a new <b>Boolean</b>
Reports any attempt to instantiate a new <b>Boolean</b>
object. Constructing new <b>Boolean</b> objects is rarely necessary,
and may cause performance problems if done often enough.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports methods with a <b>boolean</b> return type
Reports methods with a <b>boolean</b> return type
the usages of which always occur in negated context. Since this inspection
requires global code analysis, it is only available in batch inspection mode.
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports boolean methods whose names do not start with a question
Reports boolean methods whose names do not start with a question
word. Boolean methods that override library methods are ignored by this inspection.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any boolean variables or fields which are always negated
Reports any boolean variables or fields which are always negated
when its value is used.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports boxing of already boxed values. This is a useless
Reports boxing of already boxed values. This is a useless
operation since any boxed value will first be auto-unboxed before boxing the
value again. If done inside an inner loop such code may cause performance
problems.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports <b>break</b> statements,
Reports <b>break</b> statements,
other than at the end of a <b>switch</b> statement branch.
<b>break</b> statements complicate refactoring, and can be confusing.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports <b>break</b> statements with labels.
Reports <b>break</b> statements with labels.
Labeled <b>break</b> statements complicate refactoring, and can be confusing.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports calls to <b>java.lang.Thread.sleep()</b> that occur inside loops. Such calls
Reports calls to <b>java.lang.Thread.sleep()</b> that occur inside loops. Such calls
are indicative of "busy-waiting". Busy-waiting is often inefficient, and may result in unexpected deadlocks
as busy-waiting threads do not release locked resources.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports array declarations made using C-style syntax, with the array indicator attached to the variable,
Reports array declarations made using C-style syntax, with the array indicator attached to the variable,
rather than Java-style syntax, with the array indicator attached to the type.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any attempt to instantiate a new <b>Long</b>,
Reports any attempt to instantiate a new <b>Long</b>,
<b>Integer</b>, <b>Short</b> or
<b>Byte</b> object from a primitive <b>long</b>,
<b>integer</b>, <b>short</b> or
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any to methods declared <b>native</b> while in
Reports any to methods declared <b>native</b> while in
a synchronized block or method. While not necessarily representing a problem, such calls cause
an expensive context switch, and are best kept out of synchronized contexts, if possible.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any calls to a simple property getter from within the property's class.
Reports any calls to a simple property getter from within the property's class.
A simple property getter is defined as one which simply returns the value of a field,
and does no other calculation. Such simple getter calls may be safely inlined, at a small performance
improvement. Some coding standards also suggest against the use of simple getters for code clarity
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any calls to a simple property setter from within the property's class.
Reports any calls to a simple property setter from within the property's class.
A simple property setter is defined as one which simply assigns the value of its parameter to a field,
and does no other calculation. Such simple setter calls may be safely inlined, at a small performance
improvement. Some coding standards also suggest against the use of simple setters for code clarity
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports calls to the <b>concat</b> method
Reports calls to the <b>concat</b> method
of a <b>java.lang.String</b> object. Such calls can be
replaced with the '+' operator for increased code clarity and possible increased
performance if the method was invoked on a constant with a constant argument.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports type cast expressions which are surrounded by an
Reports type cast expressions which are surrounded by an
<b>instanceof</b> check for a different type.
While it is possible that this was intended, such a construct is most likely an error, and will
result in a <b>java.lang.ClassCastException</b> at runtime.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any cast operations between built-in numeric types which may
Reports any cast operations between built-in numeric types which may
result in loss of precision. Such casts are not necessarily a problem, but may result in difficult to
trace bugs if the loss of precision is unexpected.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports casting a value to a concrete class, rather than an interface.
Reports casting a value to a concrete class, rather than an interface.
Such declarations may represent a failure of abstraction, and may make testing more difficult.
Declarations whose classes come from system or third-party libraries will not be reported by this inspection.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports type cast expressions where
Reports type cast expressions where
the cast type is an interface, and the cast expression has a class type which neither
implements the cast interface, nor has any visible subclasses which implement or extend the cast interface.
While it is possible that this was intended, such a construct is most likely an error, and will
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any <b>catch</b> block where
Reports any <b>catch</b> block where
the caught exception is immediately rethrown, without performing any action on it.
Such <b>catch</b> blocks are unnecessary or lack error
handling.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports chained equality comparisons (i.e. <b>a==b==c</b>).
Reports chained equality comparisons (i.e. <b>a==b==c</b>).
Such comparisons are confusing.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports method calls whose target is another
Reports method calls whose target is another
method call.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any <b>Channel</b> which is not opened in
Reports any <b>Channel</b> which is not opened in
front of a <b>try</b> block and closed in the corresponding
<b>finally</b> block. Such resources may be inadvertently leaked
if an exception is thrown before the resource is closed. Channel resources reported
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports on any expressions of type char which are used in
Reports on any expressions of type char which are used in
addition or subtraction expressions.
<!-- tooltip end -->
<p>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any ordinal comparison of <b>char</b> values. In an internationalized
Reports any ordinal comparison of <b>char</b> values. In an internationalized
environment, such comparisons are rarely correct.
<!-- tooltip end -->
<p>
@@ -3,7 +3,7 @@
This inspection is intended for J2ME and other highly resource constrained environments.
Applying the results of this inspection without consideration might have negative effects on code clarity and design.
<p>
This inspection reports large array allocations which do not check
Reports large array allocations which do not check
for <b>java.lang.OutOfMemoryError</b>. In memory
constrained environments, allocations of large data objects should probably
be checked for memory depletion.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports checked exception classes (i.e. subclasses of <b>Exception</b> which are
Reports checked exception classes (i.e. subclasses of <b>Exception</b> which are
not also subclasses of <b>RuntimeException</b>). Certain coding standards require that all user-defined exception
classes be unchecked.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports class with too high of a total complexity. The
Reports class with too high of a total complexity. The
total complexity of a class is the sum of the cyclomatic complexities of all the methods
and initializers the class declares. Inherited methods and initializers are not counted
toward the total complexity.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports classes which are highly coupled, i.e. that reference too many other classes.
Reports classes which are highly coupled, i.e. that reference too many other classes.
Classes with too high a coupling can be very fragile, and should probably be broken up. References to system classes
(those in the <b>java.</b>or <b>javax.</b> packages), are not
counted for purposes of this inspection.
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any references to classes which allow the class name to
Reports any references to classes which allow the class name to
be used outside the class's stated scope. For instance, this inspection would report
a public method which returns a private inner class, or a protected field whose
type is a package-visible class. While legal Java, such references can be very
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any classes which do not contain package declarations.
Reports any classes which do not contain package declarations.
<!-- tooltip end -->
<p>
<small>Powered by InspectionGadgets</small>
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any classes which are neither dependent on nor depended on by other classes
Reports any classes which are neither dependent on nor depended on by other classes
in their module. Such classes are an indication of ad-hoc or incoherent modularisation strategies,
and may often profitably be moved.
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports class too deep in the inheritance hierarchy. Classes too deeply inherited
Reports class too deep in the inheritance hierarchy. Classes too deeply inherited
may be confusing, and are a good sign that refactoring may be necessary. This inspection counts all superclasses
from a library as a single superclass (libraries are considered unmodifyable).
<!-- tooltip end -->
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any of non-<b>static</b> initializers
Reports any of non-<b>static</b> initializers
in classes. Some coding standards prohibit such initializers, preferring initialization to be done
in constructors or field initializers. Non-<b>static</b> initializers
may also be inadvertently created by deleting the <b>static</b> keyword,
@@ -1,6 +1,6 @@
<html>
<body>
This inspection reports any class initializers which may safely be made <b>static</b>.
Reports any class initializers which may safely be made <b>static</b>.
A class initializer may be static if it does not reference any of its class' non static methods
and non static fields.
<!-- tooltip end -->

Some files were not shown because too many files have changed in this diff Show More