Transform CharSequence.length to property
This commit is contained in:
committed by
Mikhail Glukhikh
parent
6c0d55e4ed
commit
1305d9755a
@@ -3,6 +3,7 @@ import java.util.*;
|
||||
public class J {
|
||||
|
||||
public static class B extends A {
|
||||
public int getLength() { return 456; }
|
||||
public char get(int index) {
|
||||
if (index == 1) return 'a';
|
||||
return super.get(index);
|
||||
@@ -13,6 +14,10 @@ public class J {
|
||||
B b = new B();
|
||||
CharSequence cs = (CharSequence) b;
|
||||
|
||||
if (cs.length() != 456) return "fail 01";
|
||||
if (b.length() != 456) return "fail 02";
|
||||
if (b.getLength() != 456) return "fail 03";
|
||||
|
||||
if (cs.charAt(0) != 'z') return "fail 1";
|
||||
if (b.get(0) != 'z') return "fail 2";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user