2 * Copyright 2000-2014 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.codeInsight.daemon.lambda;
18 import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
19 import com.intellij.codeInspection.LocalInspectionTool;
20 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
21 import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
22 import com.intellij.openapi.projectRoots.JavaSdkVersion;
23 import com.intellij.openapi.projectRoots.Sdk;
24 import com.intellij.testFramework.IdeaTestUtil;
25 import org.jetbrains.annotations.NonNls;
26 import org.jetbrains.annotations.NotNull;
28 public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
29 @NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef";
32 protected void setUp() throws Exception {
34 enableInspectionTool(new UnusedDeclarationInspection());
39 protected LocalInspectionTool[] configureLocalInspectionTools() {
40 return new LocalInspectionTool[]{
41 new UncheckedWarningLocalInspection()
45 public void testIDEA93587() throws Exception {
49 public void testIDEA106522() throws Exception {
53 public void testIDEA112574() throws Exception {
57 public void testIDEA113558() throws Exception {
61 public void testAfterDistinctOps() throws Exception {
65 public void testWildcardReturns() throws Exception {
69 public void testInexactMethodReferencePrimitiveBound() throws Exception {
73 public void testAfterCollectors1() throws Exception {
77 public void testAfterCollectors2() throws Exception {
81 public void testIDEA116359() throws Exception {
85 public void testAfterSliceOps() throws Exception {
89 public void testAssertNumberOfParameters() throws Exception {
93 public void testGenericArrayCreation() throws Exception {
97 public void testWildcardsInClassTypeQualifier() throws Exception {
101 public void testRawConstructorReferenceWithTypeParams() throws Exception {
105 public void testCheckReturnTypeForExactRefs() throws Exception {
109 public void testPotentialApplicability() throws Exception {
113 public void testLiftMethodReferenceTypeParams() throws Exception {
117 public void testHighlightReferenceWhenContradictBoundsAreInferred() throws Exception {
121 public void testAfterBounds() throws Exception {
125 public void testIncludeContainingClassParamsInResolveSetForConstructorRefs() throws Exception {
129 public void testContainingClassTypeParamsForBounds() throws Exception {
133 public void testCapturingReturnValue() throws Exception {
137 public void testIDEA117311() throws Exception {
141 public void testDeepWildcardEliminating() throws Exception {
145 public void _testLambdaExercise() throws Exception {
149 public void testIDEA118437() throws Exception {
153 public void testIDEA113297() throws Exception {
157 public void testIDEA120376() throws Exception {
161 public void testIDEA120370() throws Exception {
165 public void testExcludeContainingClassTypeParamsFromInference() throws Exception {
169 public void testEnsureTypeParametersAreNotModifiedDuringGroundTypeEvaluation() throws Exception {
173 public void testIncorrectArrayCreationSignature() throws Exception {
177 public void testRawTargetType() throws Exception {
181 public void testReturnTypeCheckForRawReceiver() throws Exception {
185 public void testStaticNonStaticReferenceTypeAmbiguity() throws Exception {
189 public void testSuperClassPotentiallyApplicableMembers() throws Exception {
193 public void testExactMethodReferencePertinentToApplicabilityCheck() throws Exception {
197 public void testAmbiguityVarargs() throws Exception {
201 public void testRawInnerClassQualifier() throws Exception {
205 public void testIDEA122100() throws Exception {
209 public void testIDEA122509() throws Exception {
213 public void testIDEA122681() throws Exception {
217 public void testIDEA112191() throws Exception {
221 public void testIDEA122018comment() throws Exception {
225 public void testIDEA123223() throws Exception {
229 public void testIDEA123248() throws Exception {
233 public void testIDEA123366() throws Exception {
237 public void testIDEA123366comment() throws Exception {
241 public void testFromReferenceWithTypeArgs() throws Exception {
245 public void testRefOnStaticInterfaceMethod() throws Exception {
249 public void testUncheckedMethodReference() throws Exception {
253 public void testIDEA124148() throws Exception {
257 public void testIDEA124613() throws Exception {
261 public void testCollectingApplicabilityConstraints() {
265 public void testIDEA126062() {
269 public void testRejectReceiverTypesForConstructorRefs() {
273 public void testEnumValuesMethod() throws Exception {
277 public void testMissedApplicableMemberContainingClassSubstitution() throws Exception {
281 public void testIDEA126969() throws Exception {
285 public void testIDEA127506() throws Exception {
289 public void testIDEA127275() throws Exception {
293 public void testIDEA127275_() throws Exception {
297 public void testUnresolvedMethodReference() throws Exception {
301 public void testIDEA128534() throws Exception {
305 public void testIDEA128712() throws Exception {
309 public void testAdditionalConstraints3Level() throws Exception {
313 public void testWildcardParametrization() throws Exception {
317 public void testReceiverTypeSubstitution() throws Exception {
321 public void testTypeParametersInitOrder() throws Exception {
325 public void testIDEA132560() throws Exception {
329 public void testEnsureThatCapturedWildcardsAreNotOpenWithoutAnyReason() throws Exception {
333 public void testVarargsParametersCountComparison() throws Exception {
337 public void testPotentialCompatibilityWithInvalidShape() throws Exception {
341 public void testSiteSubstitutionOfNonReceiverReference() throws Exception {
345 public void testRawReferenceTypeWithReceiver() throws Exception {
349 public void testMethodReferenceTypeArgumentsApplicability() throws Exception {
353 public void testTypeNameInterfaceSuperMethodReferenceApplicability() throws Exception {
357 public void testNewParameterizedReferenceOnRawType() throws Exception {
361 public void testArrayTypeNewReifiable() throws Exception {
365 public void testReturnTypeApplocabilityIfCapturedWildcardInferred() throws Exception {
369 public void testIDEA133935() throws Exception {
373 public void testIDEA132379() throws Exception {
377 public void testIDEA136581() throws Exception {
381 public void testSuperSubstitutorInNormalCase() throws Exception {
385 public void testSecondSearchIfFirstParameterIsASubtypeOfReferenceTypeFromExpressionDeclaration() throws Exception {
389 public void testEnsureNotResolvedMethodRefsAreNotMarkedAsExact() throws Exception {
393 public void testReceiverSubstitutorForExactReferenceInMethodReferenceConstraint() throws Exception {
397 public void testSkipCheckedExceptionsHandledByInterfaceMethod() throws Exception {
401 public void testConstraintsFromNonRawReceiverType() throws Exception {
405 public void testSubstitutionForReturnTypeConstraintsForTargetGenericMethod() throws Exception {
409 public void testIDEA140586() throws Exception {
413 public void testUnhandledExceptionsInQualifier() throws Exception {
417 public void testRawClassTypeOnConstructorReference() throws Exception {
421 public void testIncompleteCodeWithMethodReferenceOverLambdaParameter() throws Exception {
425 public void testIncompleteMethodReferenceWithUncheckedWarningInspection() throws Exception {
429 public void testCapturedReturnTypeOfMethodReference() throws Exception {
433 public void testEnumConstantsAsContext() throws Exception {
437 public void testIDEA138752() throws Exception {
441 public void testIDEA136708() throws Exception {
445 public void testContainingClassTypeParametersShouldNotBeInferredDuringMethodReferenceProcessing() throws Exception {
449 public void testIDEA147511() throws Exception {
453 private void doTest() {
457 private void doTest(boolean warnings) {
458 IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
459 doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
463 protected Sdk getProjectJDK() {
464 return IdeaTestUtil.getMockJdk18();