Use the original java test code
This commit is contained in:
parent
1ae5c6fdcc
commit
b3c86bc757
3 changed files with 21 additions and 12 deletions
|
|
@ -1,8 +1,11 @@
|
||||||
package com.vimspector.test;
|
package com.vimspector.test;
|
||||||
|
|
||||||
class Base {
|
public class Base
|
||||||
|
{
|
||||||
public String DoSomething()
|
public String DoSomething()
|
||||||
{
|
{
|
||||||
return "";
|
String s = new String();
|
||||||
|
s.replace( "A", "B" );
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,6 @@ public class TestApplication {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TestGeneric<T extends Base > {
|
|
||||||
T t;
|
|
||||||
public TestGeneric( T t ) {
|
|
||||||
this.t = t;
|
|
||||||
}
|
|
||||||
public void DoSomethingUseful() {
|
|
||||||
System.out.println( t.DoSomething() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T extends Base> void DoGeneric( T b ) {
|
private static <T extends Base> void DoGeneric( T b ) {
|
||||||
TestGeneric<T> foo = new TestGeneric<>( b );
|
TestGeneric<T> foo = new TestGeneric<>( b );
|
||||||
foo.DoSomethingUseful();
|
foo.DoSomethingUseful();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.vimspector.test;
|
||||||
|
|
||||||
|
class TestGeneric<T extends Base> {
|
||||||
|
T base;
|
||||||
|
|
||||||
|
public TestGeneric( T b )
|
||||||
|
{
|
||||||
|
this.base = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String DoSomethingUseful() {
|
||||||
|
String s = "A B C" + base.DoSomething();
|
||||||
|
|
||||||
|
return s.replace( "B", "C" );
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue