diff options
author | Stephan Herrmann | 2014-01-30 15:35:40 +0000 |
---|---|---|
committer | Stephan Herrmann | 2014-01-30 15:35:40 +0000 |
commit | 995521865cfd6e568bdd12bfb7d4a59fc50611ab (patch) | |
tree | 09dc22664ec58b2503d942c0a5067f8edf1b0b58 | |
parent | 12bb3007708f198ce96e1ee7074598576067e3f5 (diff) | |
download | eclipse.jdt.core-995521865cfd6e568bdd12bfb7d4a59fc50611ab.tar.gz eclipse.jdt.core-995521865cfd6e568bdd12bfb7d4a59fc50611ab.tar.xz eclipse.jdt.core-995521865cfd6e568bdd12bfb7d4a59fc50611ab.zip |
Bug 426998 - [1.8][compiler] method(java.lang.Class, java.lang.String)
not applicable for the arguments (java.lang.Class, java.lang.String)
2 files changed, 32 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java index b1afe7359a..e28bd8ab8b 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java @@ -1641,4 +1641,33 @@ public void testBug424930c() { "Cannot make a static reference to the non-static field dequeCapacity\n" + "----------\n"); } +public void testBug426998a() { + runConformTest( + new String[] { + "Snippet.java", + "public class Snippet {\n" + + " static void call(Class type, long init) {\n" + + " String string = new String();\n" + + " method(type, init == 0 ? new String() : string);\n" + + " }\n" + + " private static void method(Class type, String s) {}\n" + + "}\n" + }); +} +// from https://bugs.eclipse.org/bugs/show_bug.cgi?id=426764#c5 +public void testBug426998b() { + runConformTest( + new String[] { + "Snippet.java", + "public class Snippet {\n" + + " private static final String PLACEHOLDER_MEMORY = new String();\n" + + "\n" + + " static void newInstance(Class type, long init) {\n" + + " method(type, init == 0 ? new String() : PLACEHOLDER_MEMORY);\n" + + " }\n" + + "\n" + + " private static void method(Class type, String str) {}\n" + + "}\n" + }); +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java index b357716d46..2ff993e5ec 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java @@ -32,6 +32,7 @@ * Bug 426589 - [1.8][compiler] Compiler error with generic method/constructor invocation as vargs argument * Bug 426590 - [1.8][compiler] Compiler error with tenary operator * Bug 426764 - [1.8] Presence of conditional expression as method argument confuses compiler + * Bug 426998 - [1.8][compiler] method(java.lang.Class, java.lang.String) not applicable for the arguments (java.lang.Class, java.lang.String) * Jesper S Moller - Contributions for * Bug 378674 - "The method can be declared as static" is wrong * Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335 @@ -850,10 +851,10 @@ public abstract class Scope { } else if (invocArg.isPolyExpression()) { if (invocArg instanceof ConditionalExpression) { ConditionalExpression ce = (ConditionalExpression) invocArg; - int level = compatibilityLevel18FromInner(method, innerInferenceHelper, ce.valueIfTrue, argLen, compatible, isVarArgs); + int level = compatibilityLevel18FromInner(method, innerInferenceHelper, ce.valueIfTrue, argLen, i, isVarArgs); if (level == NOT_COMPATIBLE) return NOT_COMPATIBLE; - int level2 = compatibilityLevel18FromInner(method, innerInferenceHelper, ce.valueIfFalse, argLen, compatible, isVarArgs); + int level2 = compatibilityLevel18FromInner(method, innerInferenceHelper, ce.valueIfFalse, argLen, i, isVarArgs); if (level2 == NOT_COMPATIBLE) return NOT_COMPATIBLE; return Math.max(level, level2); |