Lines 50576-50580
Link Here
|
50576 |
}, |
50576 |
}, |
50577 |
""); |
50577 |
""); |
50578 |
} |
50578 |
} |
50579 |
|
50579 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=320463 |
|
|
50580 |
public void test1466() { |
50581 |
this.runNegativeTest( |
50582 |
new String[] { |
50583 |
"Outer.java", |
50584 |
"public class Outer<T> {\n"+ |
50585 |
" class Cell {\n"+ |
50586 |
" final T value;\n"+ |
50587 |
" Cell(T value) {\n"+ |
50588 |
" this.value = value;\n"+ |
50589 |
" }\n"+ |
50590 |
" }\n"+ |
50591 |
" Class<Outer<T>.Cell> cellClass = Cell.class;\n"+ |
50592 |
" {\n"+ |
50593 |
" this.cellClass = Cell.class;\n"+ |
50594 |
" this.cellClass = Outer.Cell.class;\n"+ |
50595 |
" }\n"+ |
50596 |
" public static void main(String[] args) {\n"+ |
50597 |
" Outer<Integer>.Cell intCell = new Outer<Integer>().new Cell(314);\n"+ |
50598 |
" Outer<String>.Cell strCell = new Outer<String>().cellClass.cast(intCell);\n"+ |
50599 |
" String val = strCell.value; // ClassCastException\n"+ |
50600 |
" System.out.println(val);\n"+ |
50601 |
" }\n"+ |
50602 |
"}\n" |
50603 |
}, |
50604 |
"----------\n" + |
50605 |
"1. ERROR in Outer.java (at line 8)\n" + |
50606 |
" Class<Outer<T>.Cell> cellClass = Cell.class;\n" + |
50607 |
" ^^^^^^^^^^\n" + |
50608 |
"Type mismatch: cannot convert from Class<Outer.Cell> to Class<Outer<T>.Cell>\n" + |
50609 |
"----------\n" + |
50610 |
"2. ERROR in Outer.java (at line 10)\n" + |
50611 |
" this.cellClass = Cell.class;\n" + |
50612 |
" ^^^^^^^^^^\n" + |
50613 |
"Type mismatch: cannot convert from Class<Outer.Cell> to Class<Outer<T>.Cell>\n" + |
50614 |
"----------\n" + |
50615 |
"3. ERROR in Outer.java (at line 11)\n" + |
50616 |
" this.cellClass = Outer.Cell.class;\n" + |
50617 |
" ^^^^^^^^^^^^^^^^\n" + |
50618 |
"Type mismatch: cannot convert from Class<Outer.Cell> to Class<Outer<T>.Cell>\n" + |
50619 |
"----------\n"); |
50620 |
} |
50621 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=312076 |
50622 |
public void test1467() { |
50623 |
this.runNegativeTest( |
50624 |
new String[] { |
50625 |
"X.java", |
50626 |
"public class X<T> { \n" + |
50627 |
" public abstract static class Base<S extends Base<S>> {\n" + |
50628 |
" public Base(Class<S> sClass) {\n" + |
50629 |
" Class<S> theClass = sClass;\n" + |
50630 |
" System.out.println(theClass);\n" + |
50631 |
" System.out.println(sClass);\n" + |
50632 |
" }\n" + |
50633 |
" }\n" + |
50634 |
" public class Arr extends Base<Arr> {\n" + |
50635 |
" public Arr() { \n" + |
50636 |
" super(Arr.class);\n" + |
50637 |
" System.out.println(Arr.class);\n" + |
50638 |
" }\n" + |
50639 |
" }\n" + |
50640 |
" public static void main(String[] args) {\n" + |
50641 |
" X<Integer> x = new X<Integer>();\n" + |
50642 |
" X<Integer>.Arr a = x.new Arr();\n" + |
50643 |
" System.out.println(a);\n" + |
50644 |
" }\n" + |
50645 |
"}\n" |
50646 |
}, |
50647 |
"----------\n" + |
50648 |
"1. ERROR in X.java (at line 11)\n" + |
50649 |
" super(Arr.class);\n" + |
50650 |
" ^^^^^^^^^^^^^^^^^\n" + |
50651 |
"The constructor X.Base<X<T>.Arr>(Class<X.Arr>) is undefined\n" + |
50652 |
"----------\n"); |
50653 |
} |
50580 |
} |
50654 |
} |