Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 175193 Details for
Bug 312076
[1.5][compiler] Eclipse compiler behaves differently from javac
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Same patch after synchronizing with HEAD changes.
patch.txt (text/plain), 5.05 KB, created by
Srikanth Sankaran
on 2010-07-25 22:35:02 EDT
(
hide
)
Description:
Same patch after synchronizing with HEAD changes.
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-07-25 22:35:02 EDT
Size:
5.05 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java,v >retrieving revision 1.50 >diff -u -r1.50 ClassLiteralAccess.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java 27 Jun 2008 16:03:55 -0000 1.50 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java 26 Jul 2010 02:33:31 -0000 >@@ -77,6 +77,16 @@ > this.constant = Constant.NotAConstant; > if ((this.targetType = this.type.resolveType(scope, true /* check bounds*/)) == null) > return null; >+ >+ /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=320463 >+ https://bugs.eclipse.org/bugs/show_bug.cgi?id=312076 >+ JLS3 15.8.2 forbids the type named in the class literal expression from being a parameterized type. >+ And the grammar in 18.1 disallows (where X and Y are some concrete types) constructs of the form >+ Outer<X>.class, Outer<X>.Inner.class, Outer.Inner<X>.class, Outer<X>.Inner<Y>.class etc. >+ Corollary wise, we should resolve the type of the class literal expression to be a raw type as >+ class literals exist only for the raw underlying type. >+ */ >+ this.targetType = scope.environment().convertToRawType(this.targetType, true /* force conversion of enclosing types*/); > > if (this.targetType.isArrayType()) { > ArrayBinding arrayBinding = (ArrayBinding) this.targetType; >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.824 >diff -u -r1.824 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 22 Jul 2010 18:49:18 -0000 1.824 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 26 Jul 2010 02:33:49 -0000 >@@ -50576,5 +50576,79 @@ > }, > ""); > } >- >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=320463 >+public void test1466() { >+ this.runNegativeTest( >+ new String[] { >+ "Outer.java", >+ "public class Outer<T> {\n"+ >+ " class Cell {\n"+ >+ " final T value;\n"+ >+ " Cell(T value) {\n"+ >+ " this.value = value;\n"+ >+ " }\n"+ >+ " }\n"+ >+ " Class<Outer<T>.Cell> cellClass = Cell.class;\n"+ >+ " {\n"+ >+ " this.cellClass = Cell.class;\n"+ >+ " this.cellClass = Outer.Cell.class;\n"+ >+ " }\n"+ >+ " public static void main(String[] args) {\n"+ >+ " Outer<Integer>.Cell intCell = new Outer<Integer>().new Cell(314);\n"+ >+ " Outer<String>.Cell strCell = new Outer<String>().cellClass.cast(intCell);\n"+ >+ " String val = strCell.value; // ClassCastException\n"+ >+ " System.out.println(val);\n"+ >+ " }\n"+ >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in Outer.java (at line 8)\n" + >+ " Class<Outer<T>.Cell> cellClass = Cell.class;\n" + >+ " ^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Class<Outer.Cell> to Class<Outer<T>.Cell>\n" + >+ "----------\n" + >+ "2. ERROR in Outer.java (at line 10)\n" + >+ " this.cellClass = Cell.class;\n" + >+ " ^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Class<Outer.Cell> to Class<Outer<T>.Cell>\n" + >+ "----------\n" + >+ "3. ERROR in Outer.java (at line 11)\n" + >+ " this.cellClass = Outer.Cell.class;\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Class<Outer.Cell> to Class<Outer<T>.Cell>\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=312076 >+public void test1467() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> { \n" + >+ " public abstract static class Base<S extends Base<S>> {\n" + >+ " public Base(Class<S> sClass) {\n" + >+ " Class<S> theClass = sClass;\n" + >+ " System.out.println(theClass);\n" + >+ " System.out.println(sClass);\n" + >+ " }\n" + >+ " }\n" + >+ " public class Arr extends Base<Arr> {\n" + >+ " public Arr() { \n" + >+ " super(Arr.class);\n" + >+ " System.out.println(Arr.class);\n" + >+ " }\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " X<Integer> x = new X<Integer>();\n" + >+ " X<Integer>.Arr a = x.new Arr();\n" + >+ " System.out.println(a);\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 11)\n" + >+ " super(Arr.class);\n" + >+ " ^^^^^^^^^^^^^^^^^\n" + >+ "The constructor X.Base<X<T>.Arr>(Class<X.Arr>) is undefined\n" + >+ "----------\n"); >+} > } >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 312076
:
174944
| 175193