Lines 50557-50560
Link Here
|
50557 |
"Zork cannot be resolved to a type\n" + |
50557 |
"Zork cannot be resolved to a type\n" + |
50558 |
"----------\n"); |
50558 |
"----------\n"); |
50559 |
} |
50559 |
} |
|
|
50560 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=320463 |
50561 |
public void test1465() { |
50562 |
this.runNegativeTest( |
50563 |
new String[] { |
50564 |
"Outer.java", |
50565 |
"public class Outer<T> {\n"+ |
50566 |
" class Cell {\n"+ |
50567 |
" final T value;\n"+ |
50568 |
" Cell(T value) {\n"+ |
50569 |
" this.value = value;\n"+ |
50570 |
" }\n"+ |
50571 |
" }\n"+ |
50572 |
" Class<Outer<T>.Cell> cellClass = Cell.class;\n"+ |
50573 |
" {\n"+ |
50574 |
" this.cellClass = Cell.class;\n"+ |
50575 |
" this.cellClass = Outer.Cell.class;\n"+ |
50576 |
" }\n"+ |
50577 |
" public static void main(String[] args) {\n"+ |
50578 |
" Outer<Integer>.Cell intCell = new Outer<Integer>().new Cell(314);\n"+ |
50579 |
" Outer<String>.Cell strCell = new Outer<String>().cellClass.cast(intCell);\n"+ |
50580 |
" String val = strCell.value; // ClassCastException\n"+ |
50581 |
" System.out.println(val);\n"+ |
50582 |
" }\n"+ |
50583 |
"}\n" |
50584 |
}, |
50585 |
"----------\n" + |
50586 |
"1. ERROR in Outer.java (at line 8)\n" + |
50587 |
" Class<Outer<T>.Cell> cellClass = Cell.class;\n" + |
50588 |
" ^^^^^^^^^^\n" + |
50589 |
"Type mismatch: cannot convert from Class<Outer.Cell> to Class<Outer<T>.Cell>\n" + |
50590 |
"----------\n" + |
50591 |
"2. ERROR in Outer.java (at line 10)\n" + |
50592 |
" this.cellClass = Cell.class;\n" + |
50593 |
" ^^^^^^^^^^\n" + |
50594 |
"Type mismatch: cannot convert from Class<Outer.Cell> to Class<Outer<T>.Cell>\n" + |
50595 |
"----------\n" + |
50596 |
"3. ERROR in Outer.java (at line 11)\n" + |
50597 |
" this.cellClass = Outer.Cell.class;\n" + |
50598 |
" ^^^^^^^^^^^^^^^^\n" + |
50599 |
"Type mismatch: cannot convert from Class<Outer.Cell> to Class<Outer<T>.Cell>\n" + |
50600 |
"----------\n"); |
50601 |
} |
50602 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=312076 |
50603 |
public void test1466() { |
50604 |
this.runNegativeTest( |
50605 |
new String[] { |
50606 |
"X.java", |
50607 |
"public class X<T> { \n" + |
50608 |
" public abstract static class Base<S extends Base<S>> {\n" + |
50609 |
" public Base(Class<S> sClass) {\n" + |
50610 |
" Class<S> theClass = sClass;\n" + |
50611 |
" System.out.println(theClass);\n" + |
50612 |
" System.out.println(sClass);\n" + |
50613 |
" }\n" + |
50614 |
" }\n" + |
50615 |
" public class Arr extends Base<Arr> {\n" + |
50616 |
" public Arr() { \n" + |
50617 |
" super(Arr.class);\n" + |
50618 |
" System.out.println(Arr.class);\n" + |
50619 |
" }\n" + |
50620 |
" }\n" + |
50621 |
" public static void main(String[] args) {\n" + |
50622 |
" X<Integer> x = new X<Integer>();\n" + |
50623 |
" X<Integer>.Arr a = x.new Arr();\n" + |
50624 |
" System.out.println(a);\n" + |
50625 |
" }\n" + |
50626 |
"}\n" |
50627 |
}, |
50628 |
"----------\n" + |
50629 |
"1. ERROR in X.java (at line 11)\n" + |
50630 |
" super(Arr.class);\n" + |
50631 |
" ^^^^^^^^^^^^^^^^^\n" + |
50632 |
"The constructor X.Base<X<T>.Arr>(Class<X.Arr>) is undefined\n" + |
50633 |
"----------\n"); |
50634 |
} |
50560 |
} |
50635 |
} |