summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2013-08-16 08:53:25 -0700
committerTor Norbye <tnorbye@google.com>2013-08-16 08:53:25 -0700
commit4db7dfd37df60de478b5d99be0554bc0e06dfdba (patch)
tree01e1b92d88bbb2b9cdf0941627054e7933c11ead /java
parentbb2fc4a79dd544c91510116bc692e0b8b09d2341 (diff)
downloadidea-4db7dfd37df60de478b5d99be0554bc0e06dfdba.tar.gz
Snapshot dc8d47d344cb8e7b04ed2af7a93fd95627f38ee0 from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I7d6b4a705cb79fae78d9e845acad2d50fa3f4402
Diffstat (limited to 'java')
-rw-r--r--java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java36
-rw-r--r--java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/IdeaProjectSettingsService.java15
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java62
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/CommentFormatter.java5
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java15
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/PathListReferenceProvider.java14
-rw-r--r--java/java-psi-api/src/com/intellij/psi/GenericsUtil.java17
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java4
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA112122.java16
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEADEV15534.java2
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java3
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/formatter/java/JavadocFormatterTest.java70
12 files changed, 138 insertions, 121 deletions
diff --git a/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java b/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java
index cd4131363ddf..777105f840ba 100644
--- a/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java
+++ b/java/idea-ui/src/com/intellij/ide/actions/ShowStructureSettingsAction.java
@@ -15,20 +15,15 @@
*/
package com.intellij.ide.actions;
-import com.intellij.facet.Facet;
-import com.intellij.facet.FacetManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.options.newEditor.OptionsEditorDialog;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
-import com.intellij.openapi.ui.Messages;
public class ShowStructureSettingsAction extends AnAction implements DumbAware {
public void actionPerformed(AnActionEvent e) {
@@ -37,37 +32,6 @@ public class ShowStructureSettingsAction extends AnAction implements DumbAware {
project = ProjectManager.getInstance().getDefaultProject();
}
- // TEMPORARY HACK! DO NOT MERGE INTO INTELLIJ. This just works around a lot
- // of confusion caused by the fact that the structure dialog lets you edit
- // project state which is ignored by gradle, so temporarily disable this
- // dialog for Android-Gradle-based projects.
- if (isGradleProject(project)) {
- showDisabledProjectStructureDialogMessage();
- }
-
ShowSettingsUtil.getInstance().editConfigurable(project, OptionsEditorDialog.DIMENSION_KEY, ProjectStructureConfigurable.getInstance(project));
}
-
- public static void showDisabledProjectStructureDialogMessage() {
- Messages.showInfoMessage(
- "We will provide a UI to configure project settings later. " +
- "Until then, please manually edit your build.gradle file to " +
- "configure source folders, libraries and dependencies.\n\n" +
- "NOTE THAT EDITS MADE IN THE FOLLOWING DIALOG DO NOT AFFECT THE GRADLE BUILD.\n" +
- "The dialog can be used for temporary adjustments to SDKs etc.",
- "Project Structure");
- }
-
- public static boolean isGradleProject(Project project) {
- ModuleManager moduleManager = ModuleManager.getInstance(project);
- for (Module module : moduleManager.getModules()) {
- FacetManager facetManager = FacetManager.getInstance(module);
- for (Facet facet : facetManager.getAllFacets()) {
- if ("android-gradle".equals(facet.getType().getStringId())) {
- return true;
- }
- }
- }
- return false;
- }
} \ No newline at end of file
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/IdeaProjectSettingsService.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/IdeaProjectSettingsService.java
index 612399ade011..e654eab22bcd 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/IdeaProjectSettingsService.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/IdeaProjectSettingsService.java
@@ -16,7 +16,6 @@
package com.intellij.openapi.roots.ui.configuration;
import com.intellij.compiler.actions.ArtifactAwareProjectSettingsService;
-import com.intellij.ide.actions.ShowStructureSettingsAction;
import com.intellij.ide.projectView.impl.ModuleGroup;
import com.intellij.ide.util.projectWizard.JdkChooserPanel;
import com.intellij.openapi.module.Module;
@@ -66,7 +65,6 @@ public class IdeaProjectSettingsService extends ProjectSettingsService implement
@Override
public void openLibrary(@NotNull final Library library) {
- warnIfGradleProject();
final ProjectStructureConfigurable config = ProjectStructureConfigurable.getInstance(myProject);
ShowSettingsUtil.getInstance().editConfigurable(myProject, config, new Runnable() {
@Override
@@ -83,7 +81,6 @@ public class IdeaProjectSettingsService extends ProjectSettingsService implement
@Override
public void openModuleSettings(final Module module) {
- warnIfGradleProject();
ModulesConfigurator.showDialog(myProject, module.getName(), null);
}
@@ -94,7 +91,6 @@ public class IdeaProjectSettingsService extends ProjectSettingsService implement
@Override
public void openModuleLibrarySettings(final Module module) {
- warnIfGradleProject();
ModulesConfigurator.showDialog(myProject, module.getName(), ClasspathEditor.NAME);
}
@@ -105,7 +101,6 @@ public class IdeaProjectSettingsService extends ProjectSettingsService implement
@Override
public void openContentEntriesSettings(final Module module) {
- warnIfGradleProject();
ModulesConfigurator.showDialog(myProject, module.getName(), ContentEntriesEditor.NAME);
}
@@ -116,7 +111,6 @@ public class IdeaProjectSettingsService extends ProjectSettingsService implement
@Override
public void openModuleDependenciesSettings(@NotNull final Module module, @Nullable final OrderEntry orderEntry) {
- warnIfGradleProject();
ShowSettingsUtil.getInstance().editConfigurable(myProject, ProjectStructureConfigurable.getInstance(myProject), new Runnable() {
@Override
public void run() {
@@ -132,7 +126,6 @@ public class IdeaProjectSettingsService extends ProjectSettingsService implement
@Override
public void openLibraryOrSdkSettings(@NotNull final OrderEntry orderEntry) {
- warnIfGradleProject();
final ProjectStructureConfigurable config = ProjectStructureConfigurable.getInstance(myProject);
ShowSettingsUtil.getInstance().editConfigurable(myProject, config, new Runnable() {
@Override
@@ -173,14 +166,6 @@ public class IdeaProjectSettingsService extends ProjectSettingsService implement
@Override
public void openArtifactSettings(@Nullable Artifact artifact) {
- warnIfGradleProject();
ModulesConfigurator.showArtifactSettings(myProject, artifact);
}
-
- // TEMPORARY HACK!! REMOVE ME ASAP!
- private void warnIfGradleProject() {
- if (ShowStructureSettingsAction.isGradleProject(myProject)) {
- ShowStructureSettingsAction.showDisabledProjectStructureDialogMessage();
- }
- }
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
index d0aa4f960005..2cbde604dc7d 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
@@ -27,6 +27,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
@@ -59,49 +60,24 @@ public class GenericsHighlightUtil {
public static HighlightInfo checkInferredTypeArguments(PsiMethod genericMethod,
PsiMethodCallExpression call,
PsiSubstitutor substitutor) {
- PsiTypeParameter[] typeParameters = genericMethod.getTypeParameters();
- for (PsiTypeParameter typeParameter : typeParameters) {
- PsiType substituted = substitutor.substitute(typeParameter);
- if (substituted == null) return null;
- substituted = PsiUtil.captureToplevelWildcards(substituted, call);
- PsiClassType[] extendsTypes = typeParameter.getExtendsListTypes();
- for (PsiClassType type : extendsTypes) {
- PsiType extendsType = substitutor.substitute(type);
- if (substituted instanceof PsiWildcardType) {
- if (((PsiWildcardType)substituted).isSuper()) {
- continue;
- }
- final PsiType extendsBound = ((PsiWildcardType)substituted).getExtendsBound();
- if (TypeConversionUtil.erasure(extendsType).equals(TypeConversionUtil.erasure(extendsBound))) {
- if (extendsBound instanceof PsiClassType) {
- PsiType[] parameters = ((PsiClassType)extendsBound).getParameters();
- if (parameters.length == 1) {
- PsiType argType = parameters[0];
- if (argType instanceof PsiCapturedWildcardType) {
- argType = ((PsiCapturedWildcardType)argType).getWildcard();
- }
- if (argType instanceof PsiWildcardType && !((PsiWildcardType)argType).isBounded()) continue;
- }
- }
- }
- }
- if (!TypeConversionUtil.isAssignable(extendsType, substituted, false)) {
- PsiClass boundClass = extendsType instanceof PsiClassType ? ((PsiClassType)extendsType).resolve() : null;
-
- @NonNls String messageKey = boundClass == null || typeParameter.isInterface() == boundClass.isInterface()
- ? "generics.inferred.type.for.type.parameter.is.not.within.its.bound.extend"
- : "generics.inferred.type.for.type.parameter.is.not.within.its.bound.implement";
-
- String description = JavaErrorMessages.message(
- messageKey,
- HighlightUtil.formatClass(typeParameter),
- JavaHighlightUtil.formatType(extendsType),
- JavaHighlightUtil.formatType(substituted)
- );
-
- return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(call).descriptionAndTooltip(description).create();
- }
- }
+ final Pair<PsiTypeParameter, PsiType> inferredTypeArgument =
+ GenericsUtil.findTypeParameterWithBoundError(genericMethod.getTypeParameters(), substitutor, call, false);
+ if (inferredTypeArgument != null) {
+ final PsiType extendsType = inferredTypeArgument.second;
+ final PsiTypeParameter typeParameter = inferredTypeArgument.first;
+ PsiClass boundClass = extendsType instanceof PsiClassType ? ((PsiClassType)extendsType).resolve() : null;
+
+ @NonNls String messageKey = boundClass == null || typeParameter.isInterface() == boundClass.isInterface()
+ ? "generics.inferred.type.for.type.parameter.is.not.within.its.bound.extend"
+ : "generics.inferred.type.for.type.parameter.is.not.within.its.bound.implement";
+
+ String description = JavaErrorMessages.message(
+ messageKey,
+ HighlightUtil.formatClass(typeParameter),
+ JavaHighlightUtil.formatType(extendsType),
+ JavaHighlightUtil.formatType(substitutor.substitute(typeParameter))
+ );
+ return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(call).descriptionAndTooltip(description).create();
}
return null;
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/CommentFormatter.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/CommentFormatter.java
index 624c5370c4ad..aaf47cfb0a7d 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/CommentFormatter.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/CommentFormatter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2013 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.
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.openapi.util.text.LineTokenizer;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
@@ -45,7 +46,7 @@ public class CommentFormatter {
public CommentFormatter(@NotNull Project project) {
mySettings = CodeStyleSettingsManager.getSettings(project);
- myParser = new JDParser(mySettings);
+ myParser = new JDParser(mySettings, LanguageLevelProjectExtension.getInstance(project).getLanguageLevel());
myProject = project;
}
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java
index f4ba00070611..5dbc02583aa7 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/javadoc/JDParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2013 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.
@@ -17,6 +17,7 @@ package com.intellij.psi.impl.source.codeStyle.javadoc;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -39,9 +40,11 @@ public class JDParser {
private static final String SELF_CLOSED_P_TAG = "<p/>";
private final CodeStyleSettings mySettings;
+ private final LanguageLevel myLanguageLevel;
- public JDParser(@NotNull CodeStyleSettings settings) {
+ public JDParser(@NotNull CodeStyleSettings settings, @NotNull LanguageLevel languageLevel) {
mySettings = settings;
+ myLanguageLevel = languageLevel;
}
private static final char lineSeparator = '\n';
@@ -514,7 +517,13 @@ public class JDParser {
if (line.length() == 0 && !mySettings.JD_KEEP_EMPTY_LINES) continue;
if (i != 0) sb.append(prefix);
if (line.length() == 0 && mySettings.JD_P_AT_EMPTY_LINES && !insidePreTag) {
- sb.append(SELF_CLOSED_P_TAG);
+ if (myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
+ //Self-closing elements are not allowed for javadoc tool from JDK8
+ sb.append(P_START_TAG);
+ }
+ else {
+ sb.append(SELF_CLOSED_P_TAG);
+ }
}
else {
sb.append(line);
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/PathListReferenceProvider.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/PathListReferenceProvider.java
index b21c39506dd2..3685ef7c9b8b 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/PathListReferenceProvider.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/PathListReferenceProvider.java
@@ -16,22 +16,18 @@
package com.intellij.psi.impl.source.resolve.reference.impl.providers;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiReference;
-import com.intellij.psi.ElementManipulator;
-import com.intellij.psi.ElementManipulators;
-import com.intellij.psi.impl.source.resolve.reference.PsiReferenceProviderBase;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.text.CharFilter;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ProcessingContext;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.util.text.CharFilter;
-import com.intellij.openapi.util.TextRange;
import org.jetbrains.annotations.NotNull;
/**
* @author davdeev
*/
-public class PathListReferenceProvider extends PsiReferenceProviderBase {
+public class PathListReferenceProvider extends PsiReferenceProvider {
@Override
@NotNull
diff --git a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
index c09660c4af08..4132f2389d43 100644
--- a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
@@ -249,10 +249,17 @@ public class GenericsUtil {
final PsiSubstitutor substitutor,
final PsiElement context,
final boolean allowUncheckedConversion) {
+ return findTypeParameterWithBoundError(typeParams, substitutor, context, allowUncheckedConversion) == null;
+ }
+
+ public static Pair<PsiTypeParameter, PsiType> findTypeParameterWithBoundError(final PsiTypeParameter[] typeParams,
+ final PsiSubstitutor substitutor,
+ final PsiElement context,
+ final boolean allowUncheckedConversion) {
nextTypeParam:
for (PsiTypeParameter typeParameter : typeParams) {
PsiType substituted = substitutor.substitute(typeParameter);
- if (substituted == null) return true;
+ if (substituted == null) return null;
substituted = PsiUtil.captureToplevelWildcards(substituted, context);
PsiClassType[] extendsTypes = typeParameter.getExtendsListTypes();
@@ -263,7 +270,7 @@ public class GenericsUtil {
continue;
}
final PsiType extendsBound = ((PsiWildcardType)substituted).getExtendsBound();
- if (TypeConversionUtil.erasure(extendsType).equals(TypeConversionUtil.erasure(extendsBound))) {
+ if (Comparing.equal(TypeConversionUtil.erasure(extendsType), TypeConversionUtil.erasure(extendsBound))) {
if (extendsBound instanceof PsiClassType) {
if (acceptExtendsBound((PsiClassType)extendsBound, 0)) continue;
} else if (extendsBound instanceof PsiIntersectionType) {
@@ -275,12 +282,12 @@ public class GenericsUtil {
}
}
}
- if (!TypeConversionUtil.isAssignable(extendsType, substituted, allowUncheckedConversion)) {
- return false;
+ if (extendsType != null && !TypeConversionUtil.isAssignable(extendsType, substituted, allowUncheckedConversion)) {
+ return Pair.create(typeParameter, extendsType);
}
}
}
- return true;
+ return null;
}
private static boolean acceptExtendsBound(PsiClassType extendsBound, int depth) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java
index 6dde4206470f..bbe39b386ded 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java
@@ -572,10 +572,6 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
final boolean captureWildcard) {
if (arg instanceof PsiWildcardType && !captureWildcard) return FAILED_INFERENCE;
if (arg != PsiType.NULL) {
- if (arg instanceof PsiWildcardType) {
- final PsiType bound = ((PsiWildcardType)arg).getBound();
- if (bound instanceof PsiClassType && ((PsiClassType)bound).isRaw()) return Pair.create(null, constraintType);
- }
return new Pair<PsiType, ConstraintType>(arg, constraintType);
}
return null;
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA112122.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA112122.java
new file mode 100644
index 000000000000..bb1e1abba0b3
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA112122.java
@@ -0,0 +1,16 @@
+class Cast<T> implements SemElement {
+
+ {
+ final SemKey<? extends Cast> key = null;
+ final Cast semElement = getSemElement(key);
+ }
+
+ public <T extends SemElement> T getSemElement(SemKey<T> key) {
+ return null;
+ }
+
+
+ class SemKey<T extends SemElement> {}
+}
+
+interface SemElement {}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEADEV15534.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEADEV15534.java
index d4042a575841..0fc7639c49c2 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEADEV15534.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEADEV15534.java
@@ -18,7 +18,7 @@ class SortTest<R extends Comparable<R>> implements Comparable<SortTest<R>> {
list.add(t1);
SortTest<?> t2 = new SortTest<Integer>(0);
list.add(t2);
- <error descr="Inferred type 'SortTest<capture<?>>' for type parameter 'T' is not within its bound; should implement 'java.lang.Comparable<? super SortTest<?>>'">Collections.sort(list)</error>;
+ <error descr="Inferred type 'SortTest<?>' for type parameter 'T' is not within its bound; should implement 'java.lang.Comparable<? super SortTest<?>>'">Collections.sort(list)</error>;
t1.compareTo<error descr="'compareTo(SortTest<capture<? extends java.lang.Comparable<capture<?>>>>)' in 'SortTest' cannot be applied to '(SortTest<capture<?>>)'">(t2)</error>;
//this should be OK
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
index 3fef647dbaa3..a0c0ffa8e37d 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
@@ -300,7 +300,8 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEA67682() { doTest5(false); }
public void testIDEA57391() { doTest5(false); }
public void testIDEA110869() { doTest5(false); }
- public void testIDEA110947() { doTest5(false); }
+ public void _testIDEA110947() { doTest5(false); }
+ public void testIDEA112122() { doTest5(false); }
public void testNoInferenceFromTypeCast() { doTest5(false); }
public void testCaptureWildcardsInTypeCasts() { doTest5(false); }
public void testIDEA111085() { doTest5(false); }
diff --git a/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavadocFormatterTest.java b/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavadocFormatterTest.java
index 24adb297bce6..d4c7274c1cca 100644
--- a/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavadocFormatterTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavadocFormatterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2013 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.
@@ -17,6 +17,8 @@ package com.intellij.psi.formatter.java;
import com.intellij.lang.java.JavaLanguage;
+import com.intellij.openapi.roots.LanguageLevelProjectExtension;
+import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
/**
@@ -95,6 +97,7 @@ public class JavadocFormatterTest extends AbstractJavaFormatterTest {
getSettings().getRootSettings().ENABLE_JAVADOC_FORMATTING = true;
getSettings().getRootSettings().WRAP_COMMENTS = true;
getSettings().getRootSettings().RIGHT_MARGIN = 20;
+ LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
doTextTest("/**\n" + " * <p />\n" + " * Another paragraph of the description placed after blank line.\n" + " */\n" + "class A{}",
"/**\n" +
@@ -107,11 +110,31 @@ public class JavadocFormatterTest extends AbstractJavaFormatterTest {
"class A {\n" +
"}");
}
-
+
+ public void testSCR2632_JDK8_LanguageLevel() throws Exception {
+ getSettings().getRootSettings().ENABLE_JAVADOC_FORMATTING = true;
+ getSettings().getRootSettings().WRAP_COMMENTS = true;
+ getSettings().getRootSettings().RIGHT_MARGIN = 20;
+ LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
+
+ doTextTest("/**\n" + " * <p />\n" + " * Another paragraph of the description placed after blank line.\n" + " */\n" + "class A{}",
+ "/**\n" +
+ " * <p>\n" +
+ " * Another paragraph\n" +
+ " * of the description\n" +
+ " * placed after\n" +
+ " * blank line.\n" +
+ " */\n" +
+ "class A {\n" +
+ "}");
+ }
+
+
public void testParagraphTagGeneration() {
// Inspired by IDEA-61811
getSettings().getRootSettings().ENABLE_JAVADOC_FORMATTING = true;
getSettings().getRootSettings().JD_P_AT_EMPTY_LINES = true;
+ LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
doTextTest(
"/**\n" +
" * line 1\n" +
@@ -618,4 +641,47 @@ public class JavadocFormatterTest extends AbstractJavaFormatterTest {
"}";
doTextTest(before, before);
}
+
+
+ public void testNotGenerateSelfClosingPTagIfLanguageLevelJava8() throws Exception {
+ getSettings().getRootSettings().JD_P_AT_EMPTY_LINES = true;
+ getSettings().getRootSettings().ENABLE_JAVADOC_FORMATTING = true;
+ String before = "/**\n" +
+ " * Super method\n" +
+ " *\n" +
+ " * Super multiple times\n" +
+ " */\n" +
+ "public void voo() {\n" +
+ "}\n";
+ String after = "/**\n" +
+ " * Super method\n" +
+ " * <p>\n" +
+ " * Super multiple times\n" +
+ " */\n" +
+ "public void voo() {\n" +
+ "}\n";
+ doClassTest(before, after);
+ }
+
+ public void testGenerateSelfClosingPTagIfLanguageLevelNotJava8() throws Exception {
+ getSettings().getRootSettings().JD_P_AT_EMPTY_LINES = true;
+ getSettings().getRootSettings().ENABLE_JAVADOC_FORMATTING = true;
+ LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
+ String before = "/**\n" +
+ " * Super method\n" +
+ " *\n" +
+ " * Super multiple times\n" +
+ " */\n" +
+ "public void voo() {\n" +
+ "}\n";
+ String after = "/**\n" +
+ " * Super method\n" +
+ " * <p/>\n" +
+ " * Super multiple times\n" +
+ " */\n" +
+ "public void voo() {\n" +
+ "}\n";
+ doClassTest(before, after);
+ }
+
} \ No newline at end of file