[tests] prepares Java tests for the language level raise

This commit is contained in:
Roman Shevchenko
2017-03-24 13:09:47 +01:00
parent 05b15f593e
commit 6bd1b92c6e
38 changed files with 129 additions and 166 deletions

View File

@@ -1,11 +1,11 @@
class Test {
interface II {
int _();
int m();
}
interface IL {
long _();
long m();
}
void m0(II im) { }

View File

@@ -1,10 +1,10 @@
public class Test<A, B extends Number> {
interface IO<T> {
T _(Object o);
T m(Object o);
}
interface IN<T extends Number> {
T _(Object o);
T m(Object o);
}

View File

@@ -3,7 +3,7 @@ class Test {
int foo() { return 0; }
Integer fooBoxed() { return 0; }
}
void test(Stream<Inner> sp) {
IntStream mi = sp.map(Inner::foo);
Stream<Integer> mI = sp.map(Inner::fooBoxed);
@@ -18,11 +18,11 @@ class Test {
}
interface Function<T, R> {
public R _(T t);
public R f(T t);
}
interface IntFunction<T> {
public int _(T t);
public int f(T t);
}
interface IntStream {}

View File

@@ -1,18 +1,3 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.
*/
class Test {
public interface I {
int m();
@@ -39,7 +24,7 @@ class Test {
class Test1 {
interface I<T, V> {
V _(T t);
V m(T t);
}
static <V> void bar(I<String, V> ii, I<V, String> ik){}
@@ -47,5 +32,4 @@ class Test1 {
{
bar(s -> s.equals("") ? 0 : 1, i -> "");
}
}
}

View File

@@ -1,8 +1,8 @@
class Test {
interface I<T extends Number> {
void _(T t);
void m(T t);
}
void foo(Object o) { }
void test() {

View File

@@ -18,14 +18,14 @@ class Test {
}
interface II {
boolean _(String s);
boolean m(String s);
}
class Test1 {
void bar(boolean b){
II ik = b ? (s)-> true : (s)->false;
II ik1 = (II)((b ? <error descr="Lambda expression not expected here">(s)-> true</error> : <error descr="Lambda expression not expected here">(s)->false</error>));
II ik2 = (II)(ik1 = (b ? (s)-> true : (s)->false));
(b ? <error descr="Lambda expression not expected here">(s) -> true</error> : ik)._("");
(b ? <error descr="Lambda expression not expected here">(s) -> true</error> : ik).m("");
}
}

View File

@@ -1,6 +1,6 @@
class TestData<K> {}
interface TerminalOp<L, M> extends IntermediateOp<L, M> {}
interface IntermediateOp<L1, M1> { boolean _(L1 l, M1 m);}
interface IntermediateOp<L1, M1> { boolean m(L1 l, M1 m);}
class Test<T, U> {
protected U exerciseOps(TestData<T> data, TerminalOp<T, U> terminal, IntermediateOp<T, U>... ops) {

View File

@@ -1,7 +1,7 @@
import java.util.*;
class TestData<K> {}
interface TerminalOp<L, M> extends IntermediateOp<L, M> {}
interface IntermediateOp<L1, M1> { boolean _(L1 l, M1 m);}
interface IntermediateOp<L1, M1> { boolean m(L1 l, M1 m);}
class Test1 {
@@ -52,7 +52,7 @@ class Test4 {
}
public interface BiPredicate1<T, U> extends IntermediateOp1<T, U>{
boolean _(T t, U u);
boolean m(T t, U u);
}
public interface TerminalOp1<T, U> extends IntermediateOp1<T, U> {}

View File

@@ -1,9 +1,9 @@
interface I {
Integer _();
Integer m();
}
interface I1 {
String _();
String m();
}
class Test {

View File

@@ -57,7 +57,7 @@ lower bounds: String">x-> ""</error>);
static <K> K fooo(){return null;}
static int foooI(){return 0;}
interface I<X> {
X foo(X x);
}
@@ -72,12 +72,11 @@ lower bounds: String">x-> ""</error>);
}
class TypeArgsConsistency3 {
public static void main(String[] args) {
public static void main(String[] args) {
doIt1(1, x -> doIt1(x, y -> x * y));
doIt1(1, x -> x);
doIt1(1, x -> x * x);
}
interface F1<ResultType, P1> { ResultType _(P1 p); }
static <T> T doIt1(T i, F1<T,T> f) { return f._(i);}
}
interface F1<ResultType, P1> { ResultType f(P1 p); }
static <T> T doIt1(T i, F1<T,T> f) { return f.f(i);}
}