mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge commit 'origin/master' into changeSignature
Conflicts: java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureTargetUtil.java plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrChangeSignatureHandler.java
This commit is contained in:
Generated
+9
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="commons-lang">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/commons-lang-2.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
@@ -0,0 +1,26 @@
|
||||
<component>
|
||||
<version codename="Community Edition" major="10" minor="0" eap="true" update-channel="IDEA10EAP"/>
|
||||
<build number="__BUILD_NUMBER__" date="__BUILD_DATE__"/>
|
||||
<install-over minbuild="0" maxbuild="0" version="9.0"/>
|
||||
<logo url="/idea_community_logo.png" textcolor="FFFFFF"/>
|
||||
<about url="/idea_community_about.png"/>
|
||||
<icon size32="/icon_CE.png" size16="/icon_CEsmall.png" size32opaque="/icon_CEwhite.png" size12="/general/toolWindowProject.png"/>
|
||||
<package code="__PACKAGE_CODE__"/>
|
||||
<names product="IDEA" fullname="IntelliJ IDEA"/>
|
||||
|
||||
<welcome-screen caption-url="/welcomeCaption_community.png" slogan-url="/developSlogan_community.png"/>
|
||||
|
||||
<update-urls check="http://www.jetbrains.com/updates/updates.xml"
|
||||
patches="http://download.jetbrains.com/idea/"/>
|
||||
<help file="ideahelp.jar" root="idea"/>
|
||||
<documentation url="http://www.jetbrains.com/idea/documentation"/>
|
||||
<support url="http://www.jetbrains.com/support/idea/index.html"/>
|
||||
<feedback eap-url="http://youtrack.jetbrains.net" release-url="http://www.jetbrains.com/feedback/feedback.jsp?product=IDEA&build=$BUILD&timezone=$TIMEZONE&eval=$EVAL"/>
|
||||
<plugins url="http://plugins.intellij.net"/>
|
||||
<whatsnew url="http://www.jetbrains.com/idea/whatsnew/index.html"/>
|
||||
<keymap win="http://www.jetbrains.com/idea/docs/IntelliJIDEA9_ReferenceCard.pdf"
|
||||
mac="http://www.jetbrains.com/idea/docs/IntelliJIDEA9_ReferenceCard_Mac.pdf"/>
|
||||
|
||||
<plugins-page category="VCS Integration" title="Select VCS Integration Plugins"/>
|
||||
<plugins-page title="Select Other Plugins"/>
|
||||
</component>
|
||||
+9
-3
@@ -16,6 +16,8 @@
|
||||
package com.intellij.packaging.impl.compiler;
|
||||
|
||||
import com.intellij.compiler.impl.AdditionalCompileScopeProvider;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.compiler.CompileScope;
|
||||
import com.intellij.openapi.compiler.CompilerFilter;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -29,7 +31,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class ArtifactAdditionalCompileScopeProvider extends AdditionalCompileScopeProvider {
|
||||
@Override
|
||||
public CompileScope getAdditionalScope(@NotNull CompileScope baseScope, @NotNull CompilerFilter filter, @NotNull Project project) {
|
||||
public CompileScope getAdditionalScope(@NotNull final CompileScope baseScope, @NotNull CompilerFilter filter, @NotNull final Project project) {
|
||||
if (ArtifactCompileScope.getArtifacts(baseScope) != null) {
|
||||
return null;
|
||||
}
|
||||
@@ -37,7 +39,11 @@ public class ArtifactAdditionalCompileScopeProvider extends AdditionalCompileSco
|
||||
if (compiler == null || !filter.acceptCompiler(compiler)) {
|
||||
return null;
|
||||
}
|
||||
final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, baseScope);
|
||||
return ArtifactCompileScope.createScopeForModulesInArtifacts(project, artifacts);
|
||||
return new ReadAction<CompileScope>() {
|
||||
protected void run(final Result<CompileScope> result) {
|
||||
final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, baseScope);
|
||||
result.setResult(ArtifactCompileScope.createScopeForModulesInArtifacts(project, artifacts));
|
||||
}
|
||||
}.execute().getResultObject();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,8 +344,8 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
final MyExternalPromptDialog dialog = new MyExternalPromptDialog(project);
|
||||
if (dialog.isToBeShown()) {
|
||||
final MyExternalPromptDialog dialog = ApplicationManager.getApplication().isUnitTestMode() || ApplicationManager.getApplication().isHeadlessEnvironment() ? null : new MyExternalPromptDialog(project);
|
||||
if (dialog != null && dialog.isToBeShown()) {
|
||||
final PsiElement highlightElement = element instanceof PsiNameIdentifierOwner
|
||||
? ((PsiNameIdentifierOwner)element).getNameIdentifier()
|
||||
: element.getNavigationElement();
|
||||
@@ -605,7 +605,6 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
|
||||
}
|
||||
|
||||
protected boolean isToBeShown() {
|
||||
if (ApplicationManager.getApplication().isHeadlessEnvironment() || ApplicationManager.getApplication().isUnitTestMode()) return false;
|
||||
return CodeStyleSettingsManager.getSettings(myProject).USE_EXTERNAL_ANNOTATIONS;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.command.UndoConfirmationPolicy;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.ScrollType;
|
||||
import com.intellij.openapi.editor.EditorModificationUtil;
|
||||
import com.intellij.openapi.editor.ScrollType;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
@@ -87,6 +87,10 @@ public class JavaTypedHandler extends TypedHandlerDelegate {
|
||||
}
|
||||
if (originalFileType == StdFileTypes.JAVA && c == '{') {
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
if (offset == 0) {
|
||||
return Result.CONTINUE;
|
||||
}
|
||||
|
||||
HighlighterIterator iterator = ((EditorEx) editor).getHighlighter().createIterator(offset - 1);
|
||||
while (iterator.getTokenType() == TokenType.WHITE_SPACE) {
|
||||
iterator.retreat();
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.intellij.codeInsight.template.TemplateBuilderImpl;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
|
||||
abstract class TemplateGenerationInfo extends GenerationInfo {
|
||||
public abstract class TemplateGenerationInfo extends GenerationInfo {
|
||||
private final Expression myExpression;
|
||||
private SmartPsiElementPointer<PsiMethod> myElement;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.ExternalAnnotationsManager;
|
||||
import com.intellij.codeInsight.documentation.DocumentationManager;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.LangBundle;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -28,6 +29,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
|
||||
import com.intellij.psi.impl.source.tree.JavaDocElementType;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.javadoc.PsiDocTag;
|
||||
import com.intellij.psi.javadoc.PsiDocTagValue;
|
||||
@@ -315,10 +317,7 @@ public class JavaDocInfoGenerator {
|
||||
|
||||
PsiDocComment comment = getDocComment(aClass);
|
||||
if (comment != null) {
|
||||
generateDescription(buffer, comment);
|
||||
generateDeprecatedSection(buffer, comment);
|
||||
generateSinceSection(buffer, comment);
|
||||
generateSeeAlsoSection(buffer, comment);
|
||||
generateCommonSection(buffer, comment);
|
||||
generateTypeParametersSection(buffer, aClass);
|
||||
}
|
||||
generateEpilogue(buffer);
|
||||
@@ -418,10 +417,7 @@ public class JavaDocInfoGenerator {
|
||||
|
||||
PsiDocComment comment = getDocComment(field);
|
||||
if (comment != null) {
|
||||
generateDescription(buffer, comment);
|
||||
generateDeprecatedSection(buffer, comment);
|
||||
generateSinceSection(buffer, comment);
|
||||
generateSeeAlsoSection(buffer, comment);
|
||||
generateCommonSection(buffer, comment);
|
||||
}
|
||||
|
||||
generateEpilogue(buffer);
|
||||
@@ -463,6 +459,23 @@ public class JavaDocInfoGenerator {
|
||||
|
||||
private void generatePackageJavaDoc(final StringBuilder buffer, final PsiPackage psiPackage) {
|
||||
for(PsiDirectory directory: psiPackage.getDirectories()) {
|
||||
final PsiFile packageInfoFile = directory.findFile("package-info.java");
|
||||
if (packageInfoFile != null) {
|
||||
final ASTNode node = packageInfoFile.getNode();
|
||||
if (node != null) {
|
||||
final ASTNode docCommentNode = node.findChildByType(JavaDocElementType.DOC_COMMENT);
|
||||
if (docCommentNode != null) {
|
||||
final PsiDocComment docComment = (PsiDocComment)docCommentNode.getPsi();
|
||||
|
||||
generatePrologue(buffer);
|
||||
|
||||
generateCommonSection(buffer, docComment);
|
||||
|
||||
generateEpilogue(buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
PsiFile packageHtmlFile = directory.findFile("package.html");
|
||||
if (packageHtmlFile != null) {
|
||||
generatePackageHtmlJavaDoc(buffer, packageHtmlFile);
|
||||
@@ -471,6 +484,13 @@ public class JavaDocInfoGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
private void generateCommonSection(StringBuilder buffer, PsiDocComment docComment) {
|
||||
generateDescription(buffer, docComment);
|
||||
generateDeprecatedSection(buffer, docComment);
|
||||
generateSinceSection(buffer, docComment);
|
||||
generateSeeAlsoSection(buffer, docComment);
|
||||
}
|
||||
|
||||
private void generatePackageHtmlJavaDoc(final StringBuilder buffer, final PsiFile packageHtmlFile) {
|
||||
String htmlText;
|
||||
XmlFile packageXmlFile = (XmlFile) packageHtmlFile;
|
||||
@@ -502,9 +522,7 @@ public class JavaDocInfoGenerator {
|
||||
|
||||
generatePrologue(buffer);
|
||||
|
||||
generateDescription(buffer, docComment);
|
||||
generateSinceSection(buffer, docComment);
|
||||
generateSeeAlsoSection(buffer, docComment);
|
||||
generateCommonSection(buffer, docComment);
|
||||
|
||||
generateEpilogue(buffer);
|
||||
}
|
||||
|
||||
+8
-9
@@ -51,7 +51,6 @@ import com.intellij.psi.search.searches.OverridingMethodsSearch;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -369,7 +368,7 @@ public class GlobalJavaInspectionContextImpl extends GlobalJavaInspectionContext
|
||||
return new PsiReferenceProcessor() {
|
||||
public boolean execute(PsiReference reference) {
|
||||
AnalysisScope scope = context.getRefManager().getScope();
|
||||
if ((scope.contains(reference.getElement()) && reference.getElement().getLanguage() == StdLanguages.JAVA) ||
|
||||
if (scope.contains(reference.getElement()) && reference.getElement().getLanguage() == StdLanguages.JAVA ||
|
||||
PsiTreeUtil.getParentOfType(reference.getElement(), PsiDocComment.class) != null) {
|
||||
return true;
|
||||
}
|
||||
@@ -391,13 +390,13 @@ public class GlobalJavaInspectionContextImpl extends GlobalJavaInspectionContext
|
||||
public void performPreRunActivities(final List<Tools> globalTools, final List<Tools> localTools,
|
||||
final GlobalInspectionContext context) {
|
||||
getEntryPointsManager(context.getRefManager()).resolveEntryPoints(context.getRefManager());
|
||||
ContainerUtil.quickSort(globalTools, new Comparator<Tools>() {
|
||||
public int compare(Tools o1, Tools o2) {
|
||||
if (o1.getTool() instanceof UnusedDeclarationInspection) return -1;
|
||||
if (o2.getTool() instanceof UnusedDeclarationInspection) return 1;
|
||||
return 0;
|
||||
for (int i = 0; i < globalTools.size(); i++) {
|
||||
InspectionProfileEntry tool = globalTools.get(i).getTool();
|
||||
if (UnusedDeclarationInspection.SHORT_NAME.equals(tool.getShortName())) {
|
||||
Collections.swap(globalTools, i, 0);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -423,4 +422,4 @@ public class GlobalJavaInspectionContextImpl extends GlobalJavaInspectionContext
|
||||
while (!needRepeatSearchRequest.isEmpty());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -20,6 +20,7 @@ import com.intellij.codeInspection.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -105,6 +106,7 @@ public class RedundantTypeArgsInspection extends GenericsInspectionToolBase {
|
||||
argumentList.getExpressions(),
|
||||
resolveResult.getSubstitutor(), expression, false);
|
||||
if (!typeArguments[i].equals(inferedType)) return;
|
||||
if (PsiUtil.resolveClassInType(method.getReturnType()) == typeParameter && PsiPrimitiveType.getUnboxedType(inferedType) != null) return;
|
||||
}
|
||||
|
||||
final PsiCallExpression copy = (PsiCallExpression)expression.copy(); //see IDEADEV-8174
|
||||
|
||||
+1
-1
@@ -197,7 +197,7 @@ public class FieldCanBeLocalInspection extends BaseLocalInspectionTool {
|
||||
|
||||
@Override public void visitReferenceExpression(PsiReferenceExpression expression) {
|
||||
final PsiExpression qualifier = expression.getQualifierExpression();
|
||||
if (qualifier == null || qualifier instanceof PsiThisExpression && ((PsiThisExpression)qualifier).getQualifier() == null) {
|
||||
if (qualifier == null || qualifier instanceof PsiThisExpression) {
|
||||
final PsiElement resolved = expression.resolve();
|
||||
if (resolved instanceof PsiField) {
|
||||
final PsiField field = (PsiField)resolved;
|
||||
|
||||
+6
-4
@@ -40,15 +40,17 @@ public class WrongPackageStatementInspection extends BaseJavaLocalInspectionTool
|
||||
if (file instanceof PsiJavaFile) {
|
||||
if (JspPsiUtil.isInJspFile(file)) return null;
|
||||
PsiJavaFile javaFile = (PsiJavaFile)file;
|
||||
// highlight the first class in the file only
|
||||
PsiClass[] classes = javaFile.getClasses();
|
||||
if (classes.length == 0) return null;
|
||||
|
||||
PsiDirectory directory = javaFile.getContainingDirectory();
|
||||
if (directory == null) return null;
|
||||
PsiPackage dirPackage = JavaDirectoryService.getInstance().getPackage(directory);
|
||||
if (dirPackage == null) return null;
|
||||
PsiPackageStatement packageStatement = javaFile.getPackageStatement();
|
||||
|
||||
// highlight the first class in the file only
|
||||
PsiClass[] classes = javaFile.getClasses();
|
||||
if (classes.length == 0 && packageStatement == null) return null;
|
||||
|
||||
String packageName = dirPackage.getQualifiedName();
|
||||
if (!Comparing.strEqual(packageName, "", true) && packageStatement == null) {
|
||||
String description = JavaErrorMessages.message("missing.package.statement", packageName);
|
||||
@@ -75,7 +77,7 @@ public class WrongPackageStatementInspection extends BaseJavaLocalInspectionTool
|
||||
String description = JavaErrorMessages.message("package.name.file.path.mismatch",
|
||||
packageReference.getText(),
|
||||
dirPackage.getQualifiedName());
|
||||
return new ProblemDescriptor[]{manager.createProblemDescriptor(packageStatement, description, isOnTheFly, availableFixes.toArray(new LocalQuickFix[availableFixes.size()]), ProblemHighlightType.GENERIC_ERROR_OR_WARNING)};
|
||||
return new ProblemDescriptor[]{manager.createProblemDescriptor(packageStatement.getPackageReference(), description, isOnTheFly, availableFixes.toArray(new LocalQuickFix[availableFixes.size()]), ProblemHighlightType.GENERIC_ERROR_OR_WARNING)};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,6 +161,7 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
|
||||
@NotNull
|
||||
public PsiElement[] getSecondaryElements() {
|
||||
PsiElement element = getPsiElement();
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) return PsiElement.EMPTY_ARRAY;
|
||||
if (element instanceof PsiField) {
|
||||
final PsiField field = (PsiField)element;
|
||||
PsiClass containingClass = field.getContainingClass();
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.ide.projectView.ViewSettings;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeNode;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.ElementPresentationUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -42,23 +41,19 @@ public class ClassTreeNode extends BasePsiMemberNode<PsiClass>{
|
||||
ArrayList<PsiElement> result = new ArrayList<PsiElement>();
|
||||
PsiClassChildrenSource.DEFAULT_CHILDREN.addChildren(parent, result);
|
||||
for (PsiElement psiElement : result) {
|
||||
psiElement.accept(new JavaElementVisitor() {
|
||||
@Override public void visitClass(PsiClass aClass) {
|
||||
treeNodes.add(new ClassTreeNode(getProject(), aClass, getSettings()));
|
||||
}
|
||||
if (!psiElement.isPhysical()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@Override public void visitMethod(PsiMethod method) {
|
||||
treeNodes.add(new PsiMethodNode(getProject(), method, getSettings()));
|
||||
}
|
||||
|
||||
@Override public void visitField(PsiField field) {
|
||||
treeNodes.add(new PsiFieldNode(getProject(), field, getSettings()));
|
||||
}
|
||||
|
||||
@Override public void visitReferenceExpression(PsiReferenceExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
});
|
||||
if (psiElement instanceof PsiClass) {
|
||||
treeNodes.add(new ClassTreeNode(getProject(), (PsiClass)psiElement, getSettings()));
|
||||
}
|
||||
else if (psiElement instanceof PsiMethod) {
|
||||
treeNodes.add(new PsiMethodNode(getProject(), (PsiMethod)psiElement, getSettings()));
|
||||
}
|
||||
else if (psiElement instanceof PsiField) {
|
||||
treeNodes.add(new PsiFieldNode(getProject(), (PsiField)psiElement, getSettings()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return treeNodes;
|
||||
|
||||
@@ -302,9 +302,13 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
return createMockJdk(jdkHome, versionName, getInstance());
|
||||
}
|
||||
|
||||
public static Sdk getMockJdk17(@NonNls String versionName) {
|
||||
String jdkHome = PathManager.getHomePath() + File.separator + "mockJDK-1.7";
|
||||
return createMockJdk(jdkHome, versionName, getInstance());
|
||||
public static Sdk getMockJdk17() {
|
||||
File mockJdkCEPath = new File(PathManager.getHomePath(), "java/mockJDK-1.7");
|
||||
if (mockJdkCEPath.exists()) {
|
||||
return createMockJdk(mockJdkCEPath.getPath(), "java 1.7", getInstance());
|
||||
}
|
||||
mockJdkCEPath = new File(PathManager.getHomePath(), "community/java/mockJDK-1.7");
|
||||
return createMockJdk(mockJdkCEPath.getPath(), "java 1.7", getInstance());
|
||||
}
|
||||
|
||||
private static Sdk createMockJdk(String jdkHome, final String versionName, JavaSdk javaSdk) {
|
||||
|
||||
+3
-1
@@ -578,9 +578,11 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
|
||||
|| FIND_PREFIX.equals(firstWord)
|
||||
|| CREATE_PREFIX.equals(firstWord)) {
|
||||
final String propertyName = methodName.substring(firstWord.length());
|
||||
String[] names = getSuggestionsByName(propertyName, variableKind, false);
|
||||
final String[] names = getSuggestionsByName(propertyName, variableKind, false);
|
||||
return new NamesByExprInfo(propertyName, names);
|
||||
}
|
||||
} else {
|
||||
return new NamesByExprInfo(methodName, getSuggestionsByName(methodName, variableKind, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,10 @@ public class FieldElement extends CompositeElement{
|
||||
super(Constants.FIELD);
|
||||
}
|
||||
|
||||
protected FieldElement(@NotNull IElementType type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public int getTextOffset() {
|
||||
return findChildByRole(ChildRole.NAME).getStartOffset();
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ public class JavaRefactoringSettings implements PersistentStateComponent<JavaRef
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean RENAME_INHERITORS = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean RENAME_PARAMETER_IN_HIERARCHY = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean RENAME_VARIABLES = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean RENAME_TESTS = true;
|
||||
|
||||
public static JavaRefactoringSettings getInstance() {
|
||||
return ServiceManager.getService(JavaRefactoringSettings.class);
|
||||
@@ -136,4 +137,12 @@ public class JavaRefactoringSettings implements PersistentStateComponent<JavaRef
|
||||
public void loadState(JavaRefactoringSettings state) {
|
||||
XmlSerializerUtil.copyBean(state, this);
|
||||
}
|
||||
|
||||
public boolean isToRenameTests() {
|
||||
return RENAME_TESTS;
|
||||
}
|
||||
|
||||
public void setRenameTests(boolean renameTests) {
|
||||
this.RENAME_TESTS = renameTests;
|
||||
}
|
||||
}
|
||||
+12
-7
@@ -427,13 +427,18 @@ public class ChangeSignatureDialog extends RefactoringDialog {
|
||||
private void updateSignature() {
|
||||
if (mySignatureArea == null) return;
|
||||
|
||||
myUpdateSignatureAlarm.cancelAllRequests();
|
||||
myUpdateSignatureAlarm.addRequest(new Runnable() {
|
||||
final Runnable updateRunnable = new Runnable() {
|
||||
public void run() {
|
||||
doUpdateSignature();
|
||||
updatePropagateButtons();
|
||||
myUpdateSignatureAlarm.cancelAllRequests();
|
||||
myUpdateSignatureAlarm.addRequest(new Runnable() {
|
||||
public void run() {
|
||||
doUpdateSignature();
|
||||
updatePropagateButtons();
|
||||
}
|
||||
}, 100, ModalityState.stateForComponent(mySignatureArea));
|
||||
}
|
||||
}, 100, ModalityState.stateForComponent(mySignatureArea));
|
||||
};
|
||||
SwingUtilities.invokeLater(updateRunnable);
|
||||
}
|
||||
|
||||
private void doUpdateSignature() {
|
||||
@@ -450,7 +455,7 @@ public class ChangeSignatureDialog extends RefactoringDialog {
|
||||
private boolean mayPropagateExceptions() {
|
||||
final ThrownExceptionInfo[] thrownExceptions = myExceptionsTableModel.getThrownExceptions();
|
||||
final PsiClassType[] types = myMethod.getThrowsList().getReferencedTypes();
|
||||
if (thrownExceptions.length < types.length) return false;
|
||||
if (thrownExceptions.length <= types.length) return false;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (thrownExceptions[i].oldIndex != i) return false;
|
||||
}
|
||||
@@ -460,7 +465,7 @@ public class ChangeSignatureDialog extends RefactoringDialog {
|
||||
private boolean mayPropagateParameters() {
|
||||
final ParameterInfoImpl[] infos = myParametersTableModel.getParameters();
|
||||
final PsiParameter[] parameters = myMethod.getParameterList().getParameters();
|
||||
if (infos.length < parameters.length) return false;
|
||||
if (infos.length <= parameters.length) return false;
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
if (infos[i].oldParameterIndex != i) return false;
|
||||
}
|
||||
|
||||
+5
-3
@@ -152,9 +152,11 @@ public abstract class CallerChooser extends DialogWrapper {
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
myTree.removeTreeSelectionListener(myTreeSelectionListener);
|
||||
EditorFactory.getInstance().releaseEditor(myCallerEditor);
|
||||
EditorFactory.getInstance().releaseEditor(myCalleeEditor);
|
||||
if (myTree != null) {
|
||||
myTree.removeTreeSelectionListener(myTreeSelectionListener);
|
||||
EditorFactory.getInstance().releaseEditor(myCallerEditor);
|
||||
EditorFactory.getInstance().releaseEditor(myCalleeEditor);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@ public class ExtractClassProcessor extends FixableUsagesRefactoringProcessor {
|
||||
}
|
||||
for (PsiMethod method : methods) {
|
||||
method.accept(visitor);
|
||||
//do not include method's type parameters in class signature
|
||||
typeParamSet.removeAll(Arrays.asList(method.getTypeParameters()));
|
||||
}
|
||||
typeParams.addAll(typeParamSet);
|
||||
}
|
||||
|
||||
+9
-9
@@ -180,7 +180,7 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
|
||||
InitializationPlace initializerPlace = settings.getInitializerPlace();
|
||||
final PsiLocalVariable localVariable = settings.getLocalVariable();
|
||||
final boolean deleteLocalVariable = settings.isDeleteLocalVariable();
|
||||
PsiExpression initializer;
|
||||
@Nullable PsiExpression initializer;
|
||||
if (localVariable != null) {
|
||||
initializer = localVariable.getInitializer();
|
||||
}
|
||||
@@ -193,7 +193,9 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
|
||||
|
||||
if (!CommonRefactoringUtil.checkReadOnlyStatus(project, destClass.getContainingFile())) return;
|
||||
|
||||
ChangeContextUtil.encodeContextInfo(initializer, true);
|
||||
if (initializer != null) {
|
||||
ChangeContextUtil.encodeContextInfo(initializer, true);
|
||||
}
|
||||
PsiField field = settings.isIntroduceEnumConstant() ? EnumConstantsUtil.createEnumConstant(destClass, fieldName, initializer) : createField(fieldName, type, initializer, initializerPlace == InitializationPlace.IN_FIELD_DECLARATION && initializer != null);
|
||||
|
||||
PsiElement finalAnchorElement = null;
|
||||
@@ -205,7 +207,7 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
|
||||
}
|
||||
}
|
||||
PsiMember anchorMember = finalAnchorElement instanceof PsiMember ? (PsiMember)finalAnchorElement : null;
|
||||
setModifiers(field, settings, settings.isDeclareStatic(), occurrences);
|
||||
setModifiers(field, settings, settings.isDeclareStatic());
|
||||
if ((anchorMember instanceof PsiField) &&
|
||||
anchorMember.hasModifierProperty(PsiModifier.STATIC) == field.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
field = (PsiField)destClass.addBefore(field, anchorMember);
|
||||
@@ -295,7 +297,9 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
|
||||
}
|
||||
}
|
||||
|
||||
ChangeContextUtil.clearContextInfo(initializer);
|
||||
if (initializer != null) {
|
||||
ChangeContextUtil.clearContextInfo(initializer);
|
||||
}
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
LOG.error(e);
|
||||
@@ -316,7 +320,7 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void setModifiers(PsiField field, Settings settings, final boolean declareStatic, PsiExpression[] occurrences) {
|
||||
public static void setModifiers(PsiField field, Settings settings, final boolean declareStatic) {
|
||||
if (!settings.isIntroduceEnumConstant()) {
|
||||
if (declareStatic) {
|
||||
PsiUtil.setModifierProperty(field, PsiModifier.STATIC, true);
|
||||
@@ -355,10 +359,6 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
|
||||
|
||||
protected abstract boolean validClass(PsiClass parentClass, Editor editor);
|
||||
|
||||
protected boolean isStaticField() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static PsiElement getNormalizedAnchor(PsiElement anchorElement) {
|
||||
PsiElement child = anchorElement;
|
||||
while (child != null) {
|
||||
|
||||
+1
-3
@@ -37,6 +37,7 @@ import com.intellij.refactoring.util.occurences.ExpressionOccurenceManager;
|
||||
import com.intellij.refactoring.util.occurences.OccurenceManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class IntroduceConstantHandler extends BaseExpressionToFieldHandler {
|
||||
@@ -226,7 +227,4 @@ public class IntroduceConstantHandler extends BaseExpressionToFieldHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isStaticField() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public abstract class LocalToFieldHandler {
|
||||
PsiField field = settings.isIntroduceEnumConstant() ? EnumConstantsUtil.createEnumConstant(aaClass, local, fieldName)
|
||||
: createField(local, fieldName, initializerPlace == IN_FIELD_DECLARATION);
|
||||
field = (PsiField)aaClass.add(field);
|
||||
BaseExpressionToFieldHandler.setModifiers(field, settings, isStatic, occurences);
|
||||
BaseExpressionToFieldHandler.setModifiers(field, settings, isStatic);
|
||||
if (!settings.isIntroduceEnumConstant()) {
|
||||
VisibilityUtil.fixVisibility(occurences, field, settings.getFieldVisibility());
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class JavaUnresolvableLocalCollisionDetector {
|
||||
// element is a PsiParameter
|
||||
scope = ((PsiParameter)element).getDeclarationScope();
|
||||
}
|
||||
LOG.assertTrue(scope != null);
|
||||
LOG.assertTrue(scope != null, element.getClass().getName());
|
||||
|
||||
final CollidingVariableVisitor collidingNameVisitor = new CollidingVariableVisitor() {
|
||||
public void visitCollidingElement(PsiVariable collidingVariable) {
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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 com.intellij.refactoring.rename.naming;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.JavaRefactoringSettings;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class AutomaticTestRenamerFactory implements AutomaticRenamerFactory {
|
||||
public boolean isApplicable(final PsiElement element) {
|
||||
return element instanceof PsiClass;
|
||||
}
|
||||
|
||||
public String getOptionName() {
|
||||
return RefactoringBundle.message("rename.tests");
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return JavaRefactoringSettings.getInstance().isToRenameTests();
|
||||
}
|
||||
|
||||
public void setEnabled(final boolean enabled) {
|
||||
JavaRefactoringSettings.getInstance().setRenameTests(enabled);
|
||||
}
|
||||
|
||||
public AutomaticRenamer createRenamer(final PsiElement element, final String newName, final Collection<UsageInfo> usages) {
|
||||
return new TestsRenamer((PsiClass)element, newName);
|
||||
}
|
||||
|
||||
private static class TestsRenamer extends AutomaticRenamer {
|
||||
public TestsRenamer(PsiClass aClass, String newClassName) {
|
||||
|
||||
appendTestClass(aClass, "Test");
|
||||
appendTestClass(aClass, "TestCase");
|
||||
|
||||
suggestAllNames(aClass.getName(), newClassName);
|
||||
}
|
||||
|
||||
private void appendTestClass(PsiClass aClass, String testSuffix) {
|
||||
final Project project = aClass.getProject();
|
||||
final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
|
||||
final PsiClass psiClassTest = facade.findClass(aClass.getQualifiedName() + testSuffix, GlobalSearchScope.projectScope(project));
|
||||
if (psiClassTest != null) {
|
||||
myElements.add(psiClassTest);
|
||||
}
|
||||
}
|
||||
|
||||
public String getDialogTitle() {
|
||||
return RefactoringBundle.message("rename.tests.title");
|
||||
}
|
||||
|
||||
public String getDialogDescription() {
|
||||
return RefactoringBundle.message("rename.tests.with.the.following.names.to");
|
||||
}
|
||||
|
||||
public String entityName() {
|
||||
return RefactoringBundle.message("entity.name.test");
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-21
@@ -635,20 +635,13 @@ public abstract class TurnRefsToSuperProcessorBase extends BaseRefactoringProces
|
||||
markNode(element);
|
||||
}
|
||||
else if (element instanceof PsiParameter) {
|
||||
final PsiType type = ((PsiParameter)element).getType();
|
||||
final PsiType type = TypeConversionUtil.erasure(((PsiParameter)element).getType());
|
||||
final PsiClass aClass = PsiUtil.resolveClassInType(type);
|
||||
if (aClass != null) {
|
||||
if (aClass instanceof PsiTypeParameter) {
|
||||
for (Node node : myElementToNode.get(element).mySuccessors) {
|
||||
final PsiResolveHelper psiResolveHelper = JavaPsiFacade.getInstance(myProject).getResolveHelper();
|
||||
final PsiType psiType = psiResolveHelper
|
||||
.inferTypeForMethodTypeParameter((PsiTypeParameter)aClass, new PsiParameter[]{(PsiParameter)element},
|
||||
new PsiExpression[]{(PsiExpression)node.myMark.myElement}, PsiSubstitutor.EMPTY, null,
|
||||
false);
|
||||
if (checkNode(element, PsiUtil.resolveClassInType(psiType))) break;
|
||||
if (!myManager.isInProject(element) || !myManager.areElementsEquivalent(aClass, myClass)) {
|
||||
if (!isSuperInheritor(aClass)) {
|
||||
markNode(element);
|
||||
}
|
||||
} else {
|
||||
checkNode(element, aClass);
|
||||
}
|
||||
}
|
||||
else { // unresolvable class
|
||||
@@ -658,16 +651,6 @@ public abstract class TurnRefsToSuperProcessorBase extends BaseRefactoringProces
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkNode(PsiElement element, PsiClass psiClass) {
|
||||
if (!myManager.isInProject(element) || !myManager.areElementsEquivalent(psiClass, myClass)) {
|
||||
if (!isSuperInheritor(psiClass)) {
|
||||
markNode(element);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract boolean isSuperInheritor(PsiClass aClass);
|
||||
|
||||
protected abstract boolean isInSuper(PsiElement member);
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
@@ -105,6 +106,10 @@ public class AppMain {
|
||||
parms[j - 1] = args[j];
|
||||
}
|
||||
Method m = Class.forName(mainClass).getMethod("main", new Class[]{parms.getClass()});
|
||||
if (!Modifier.isStatic(m.getModifiers())) {
|
||||
System.err.println("main method should be static");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ensureAccess(m);
|
||||
m.invoke(null, new Object[]{parms});
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><PRE>class <b>MethodTypeParam</b><T>
|
||||
extends <a href="psi_element://java.lang.Object"><code>Object</code></a></PRE>
|
||||
<DD><DL><DT><b>Type parameters:</b><DD><code><T></code> - type param</DD></DL></DD></body></html>
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @param <T> type param
|
||||
*/
|
||||
class MethodTypeParam<T> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static int <b>JAVADOC_ME = 23</b></PRE> The value of the field is 23.</body></html>
|
||||
@@ -0,0 +1,4 @@
|
||||
class A {
|
||||
/** The value of the field is {@value}. */
|
||||
public static int JAVADOC_ME = 23;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><small><b><a href="psi_element://Idea4780"><code>Idea4780</code></a></b></small><PRE>public <a href="psi_element://java.lang.Object"><code>Object</code></a> <b>read</b>()
|
||||
throws <a href="psi_element://java.io.IOException"><code>IOException</code></a></PRE><DD><DL><DT><b>Throws:</b><DD><a href="psi_element://java.io.EOFException"><code>EOFException</code></a> - if this source is already closed when the <code>read()</code> is called, or is closed during the <code>read()</code>. <DD><font color=red>InterruptedIOException</font> - if the reading thread is interrupted.<DD><a href="psi_element://java.io.IOException"><code>IOException</code></a> - if an I/O error occurs while reading. </DD></DL></DD></body></html>
|
||||
@@ -0,0 +1,14 @@
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
|
||||
public interface Idea4780 {
|
||||
/**
|
||||
* @throws IOException if an I/O error occurs while reading.
|
||||
* @throws EOFException if this source is already closed when the <code>read()</code> is called,
|
||||
* or is closed during the <code>read()</code>.
|
||||
* @throws InterruptedIOException if the reading thread is interrupted.
|
||||
*/
|
||||
public Object read()
|
||||
throws IOException;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><small><b><a href="psi_element://MethodTypeParam"><code>MethodTypeParam</code></a></b></small><PRE><T> void <b>foo</b>(T t)</PRE><DD><DL><DT><b>Type parameters:</b><DD><code><T></code> - type param</DD></DL></DD></body></html>
|
||||
@@ -0,0 +1,7 @@
|
||||
class MethodTypeParam {
|
||||
/**
|
||||
* @param <T> type param
|
||||
*/
|
||||
<T> void foo(T t) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* This package contains nothing but package-info.java
|
||||
*/
|
||||
package packageInfo;
|
||||
@@ -0,0 +1,2 @@
|
||||
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body>
|
||||
This package contains nothing but package-info.java</body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static int <b>JAVADOC_ME</b></PRE> Test</body></html>
|
||||
@@ -0,0 +1,4 @@
|
||||
class A {
|
||||
/** Test */
|
||||
public static int JAVADOC_ME;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static void <b>JAVADOC_ME</b>()</PRE> The value of A is 23.</body></html>
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
public static int A = 23;
|
||||
|
||||
/** The value of A is {@value #A}. */
|
||||
public static void JAVADOC_ME() { }
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems/>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public class Outer {
|
||||
private int value = 0;
|
||||
|
||||
public class Inner {
|
||||
private final int myValue = Outer.this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import java.util.Map;
|
||||
class Test {
|
||||
Map someMap;
|
||||
|
||||
public int getGetBar() {
|
||||
return this.<Integer>getFoo("numberOfConfigurations");
|
||||
}
|
||||
|
||||
protected <T> T getFoo(String key) {
|
||||
return (T)someMap.get(key);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
class Inner{
|
||||
int myField;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
class Inner{
|
||||
int myField;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Foo {
|
||||
void foo() {
|
||||
foo(
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
class Foo {
|
||||
void foo() {
|
||||
foo(
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
public class A {
|
||||
private void foo() {
|
||||
Runnable a = new Runnable() {
|
||||
private int a;
|
||||
|
||||
public void run() {
|
||||
newMethod();
|
||||
}
|
||||
|
||||
private void newMethod() {
|
||||
a = 2;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
public class A {
|
||||
private void foo() {
|
||||
Runnable a = new Runnable() {
|
||||
private int a;
|
||||
|
||||
public void run() {
|
||||
newMethod();
|
||||
}
|
||||
|
||||
private void newMethod() {
|
||||
a = 2;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Foo {
|
||||
void foo(){
|
||||
try {
|
||||
// comment before
|
||||
g();
|
||||
// comment after
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Foo {
|
||||
void foo(){
|
||||
try {
|
||||
// comment before
|
||||
g();
|
||||
// comment after
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Foo{
|
||||
void foo() {
|
||||
someVariable = x =
|
||||
x +
|
||||
y;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
class Foo {
|
||||
void foo() {
|
||||
someVariable = x =
|
||||
x +
|
||||
y;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Foo {
|
||||
void foo(){
|
||||
for (int i = 0;
|
||||
i < 5;
|
||||
i++) {
|
||||
doSomething(i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
class Foo {
|
||||
void foo() {
|
||||
for (int i = 0;
|
||||
i < 5;
|
||||
i++) {
|
||||
doSomething(i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Foo{
|
||||
public void foo(){
|
||||
int someVariable = (y +
|
||||
z
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
class Foo {
|
||||
public void foo() {
|
||||
int someVariable = (y +
|
||||
z
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
A IMPL = new A() {
|
||||
void f(boolean b) {
|
||||
bar();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
class A {
|
||||
A IMPL = new A() {
|
||||
void f(boolean b) {
|
||||
bar();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
public class A {
|
||||
void f() {
|
||||
new My() {
|
||||
public void f() {
|
||||
int i = 9;
|
||||
int j = 9;
|
||||
}
|
||||
};
|
||||
new My() {
|
||||
public void f() {
|
||||
l();
|
||||
l();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
public class A {
|
||||
void f() {
|
||||
new My() {
|
||||
public void f() {
|
||||
int i = 9;
|
||||
int j = 9;
|
||||
}
|
||||
};
|
||||
new My() {
|
||||
public void f() {
|
||||
l();
|
||||
l();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
void foo () {
|
||||
assert false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class Foo {
|
||||
void foo() {
|
||||
assert false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
class Foo {
|
||||
void foo(){
|
||||
if (a)
|
||||
{
|
||||
}
|
||||
|
||||
while(a)
|
||||
{
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
} while(a);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
|
||||
switch(a)
|
||||
{
|
||||
}
|
||||
|
||||
for(a)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
class Foo {
|
||||
void foo() {
|
||||
if (a) {
|
||||
}
|
||||
|
||||
while (a) {
|
||||
}
|
||||
|
||||
do {
|
||||
} while (a);
|
||||
|
||||
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
}
|
||||
|
||||
for (a) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Foo{
|
||||
public void a(){
|
||||
if (b) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
class Foo {
|
||||
public void a() {
|
||||
if (b) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Foo {
|
||||
public void foo(){
|
||||
if (a) {
|
||||
|
||||
} else {
|
||||
((String)value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
class Foo {
|
||||
public void foo() {
|
||||
if (a) {
|
||||
|
||||
} else {
|
||||
((String) value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
class FormattingTest {
|
||||
|
||||
private static FormattingTest staticFoo;
|
||||
private FormattingTest instanceFoo;
|
||||
|
||||
@SuppressWarnings({"AccessStaticViaInstance"})
|
||||
public void test() {
|
||||
|
||||
// Long chained method calls with initial instance target - method calls are aligned to the first method
|
||||
// call place.
|
||||
instanceFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed();
|
||||
|
||||
// Long chained method calls with initial static target - method calls are aligned to the first method
|
||||
// call place.
|
||||
staticFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed();
|
||||
|
||||
// Interleaved method call chains - every sub-chain is aligned to its own target
|
||||
instanceFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed().instanceFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed();
|
||||
|
||||
// Interleaved method call chains with manual line break - every sub-chain is aligned to its own
|
||||
// target and manual line break is preserved.
|
||||
instanceFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed()
|
||||
.instanceFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed();
|
||||
|
||||
// Chained calls with implicit target - method calls are not aligned and use continuation indent instead.
|
||||
instanceMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed();
|
||||
}
|
||||
|
||||
public FormattingTest instanceMethodWithQuiteLongNameIndeed() {
|
||||
return instanceFoo;
|
||||
}
|
||||
|
||||
public static FormattingTest staticMethodWithQuiteLongNameIndeed() {
|
||||
return staticFoo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
class FormattingTest {
|
||||
|
||||
private static FormattingTest staticFoo;
|
||||
private FormattingTest instanceFoo;
|
||||
|
||||
@SuppressWarnings({"AccessStaticViaInstance"})
|
||||
public void test() {
|
||||
|
||||
// Long chained method calls with initial instance target - method calls are aligned to the first method
|
||||
// call place.
|
||||
instanceFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed()
|
||||
.instanceMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed()
|
||||
.staticMethodWithQuiteLongNameIndeed();
|
||||
|
||||
// Long chained method calls with initial static target - method calls are aligned to the first method
|
||||
// call place.
|
||||
staticFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed()
|
||||
.instanceMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed()
|
||||
.staticMethodWithQuiteLongNameIndeed();
|
||||
|
||||
// Interleaved method call chains - every sub-chain is aligned to its own target
|
||||
instanceFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed()
|
||||
.instanceMethodWithQuiteLongNameIndeed().instanceFoo.instanceMethodWithQuiteLongNameIndeed()
|
||||
.staticMethodWithQuiteLongNameIndeed()
|
||||
.instanceMethodWithQuiteLongNameIndeed();
|
||||
|
||||
// Interleaved method call chains with manual line break - every sub-chain is aligned to its own
|
||||
// target and manual line break is preserved.
|
||||
instanceFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed()
|
||||
.instanceFoo.instanceMethodWithQuiteLongNameIndeed().staticMethodWithQuiteLongNameIndeed()
|
||||
.instanceMethodWithQuiteLongNameIndeed();
|
||||
|
||||
// Chained calls with implicit target - method calls are not aligned and use continuation indent instead.
|
||||
instanceMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed()
|
||||
.instanceMethodWithQuiteLongNameIndeed().instanceMethodWithQuiteLongNameIndeed();
|
||||
}
|
||||
|
||||
public FormattingTest instanceMethodWithQuiteLongNameIndeed() {
|
||||
return instanceFoo;
|
||||
}
|
||||
|
||||
public static FormattingTest staticMethodWithQuiteLongNameIndeed() {
|
||||
return staticFoo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
void foo() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class A {
|
||||
void foo() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class C {
|
||||
{
|
||||
String q = (String) ( (String)"abc" );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class C {
|
||||
{
|
||||
String q = (String) ((String) "abc");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class C {
|
||||
{
|
||||
for(String s :collection) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
class C {
|
||||
{
|
||||
for (String s : collection) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
class Foo {
|
||||
void foo() {
|
||||
if (a) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Foo {
|
||||
void foo() {
|
||||
if (a)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
class Foo {
|
||||
void foo() {
|
||||
if (a) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
public class Foo {
|
||||
public void foo(boolean a, int x,
|
||||
int y, int z) {
|
||||
label1:
|
||||
do {
|
||||
try {
|
||||
if (x > 0) {
|
||||
int someVariable = a ?
|
||||
x :
|
||||
y;
|
||||
}
|
||||
else if (x < 0) {
|
||||
int someVariable = (y +
|
||||
z
|
||||
);
|
||||
someVariable = x =
|
||||
x +
|
||||
y;
|
||||
}
|
||||
else {
|
||||
label2:
|
||||
for (int i = 0;
|
||||
i < 5;
|
||||
i++)
|
||||
doSomething(i);
|
||||
}
|
||||
switch (a) {
|
||||
case 0:
|
||||
doCase0();
|
||||
break;
|
||||
default:
|
||||
doDefault();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
processException(e.getMessage(),
|
||||
x + y, z, a);
|
||||
}
|
||||
finally {
|
||||
processFinally();
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
if (2 < 3) return;
|
||||
if (3 < 4)
|
||||
return;
|
||||
do x++ while (x < 10000);
|
||||
while (x < 50000) x++;
|
||||
for (int i = 0; i < 5; i++) System.out.println(i);
|
||||
}
|
||||
|
||||
private class InnerClass implements I1,
|
||||
I2 {
|
||||
public void bar() throws E1,
|
||||
E2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
public class Foo {
|
||||
public void foo(boolean a, int x,
|
||||
int y, int z) {
|
||||
label1:
|
||||
do {
|
||||
try {
|
||||
if (x > 0) {
|
||||
int someVariable = a ?
|
||||
x :
|
||||
y;
|
||||
}
|
||||
else
|
||||
if (x < 0) {
|
||||
int someVariable = (y +
|
||||
z
|
||||
);
|
||||
someVariable = x =
|
||||
x +
|
||||
y;
|
||||
}
|
||||
else {
|
||||
label2:
|
||||
for (int i = 0;
|
||||
i < 5;
|
||||
i++) {
|
||||
doSomething(i);
|
||||
}
|
||||
}
|
||||
switch (a) {
|
||||
case 0:
|
||||
doCase0();
|
||||
break;
|
||||
default:
|
||||
doDefault();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
processException(e.getMessage(),
|
||||
x + y, z, a);
|
||||
}
|
||||
finally {
|
||||
processFinally();
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
if (2 < 3) return;
|
||||
if (3 < 4)
|
||||
return;
|
||||
do x++ while (x < 10000);
|
||||
while (x < 50000) x++;
|
||||
for (int i = 0; i < 5; i++) System.out.println(i);
|
||||
}
|
||||
|
||||
private class InnerClass implements I1,
|
||||
I2 {
|
||||
public void bar() throws E1,
|
||||
E2 {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
class Foo {
|
||||
void foo() {
|
||||
if (a)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Foo{
|
||||
public void foo(){
|
||||
bar_call(new Runnable(){
|
||||
void run(){
|
||||
bar();
|
||||
bar();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
class Foo {
|
||||
public void foo() {
|
||||
bar_call(new Runnable() {
|
||||
void run() {
|
||||
bar();
|
||||
bar();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
public class Test {
|
||||
void anotherMethod(String s);
|
||||
String field;
|
||||
/**
|
||||
* @param anObject
|
||||
*/
|
||||
void method(Test anObject, String field1) {
|
||||
anObject.anotherMethod(field1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
public class Test {
|
||||
void anotherMethod(String s);
|
||||
|
||||
String field;
|
||||
|
||||
/**
|
||||
* @param anObject
|
||||
*/
|
||||
void method(Test anObject, String field1) {
|
||||
anObject.anotherMethod(field1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class X {
|
||||
void Y() {
|
||||
z: for (int i = 0; i < 24; i++) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
class X {
|
||||
void Y() {
|
||||
z:
|
||||
for (int i = 0; i < 24; i++) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@XmlType(name = "submissionData",
|
||||
propOrder = {"submissionId", "submitterId", "contestId", "submittedDate", "submissionContent", "passedScreening", "placement", "paidFor", "price", "markedForPurchase", "removed"})
|
||||
public class SubmissionData {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@XmlType(name = "submissionData",
|
||||
propOrder = {"submissionId", "submitterId", "contestId", "submittedDate", "submissionContent",
|
||||
"passedScreening", "placement", "paidFor", "price", "markedForPurchase", "removed"})
|
||||
public class SubmissionData {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Foo{
|
||||
void foo(){
|
||||
ClassBar bar =
|
||||
createBar();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
class Foo {
|
||||
void foo() {
|
||||
ClassBar bar =
|
||||
createBar();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user