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 102849 Details for
Bug 234619
[1.5][compiler] Object#getClass() has wrong expression type binding with JRE from 1.6
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for 3.3.x
234619-33x.txt (text/plain), 5.04 KB, created by
Philipe Mulet
on 2008-05-30 09:05:08 EDT
(
hide
)
Description:
Patch for 3.3.x
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2008-05-30 09:05:08 EDT
Size:
5.04 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.631.2.19 >diff -u -r1.631.2.19 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 28 May 2008 10:55:19 -0000 1.631.2.19 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 30 May 2008 13:04:59 -0000 >@@ -41390,4 +41390,55 @@ > "Zork cannot be resolved to a type\n" + > "----------\n"); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=234619 >+public void test1338() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", // ================= >+ "public class X {\n" + >+ " void m(Object someObject, Integer intObject) {\n" + >+ " Exception class1 = someObject.getClass();\n" + >+ " Exception class2 = intObject.getClass();\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " Exception class1 = someObject.getClass();\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Class<capture#1-of ? extends Object> to Exception\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 4)\n" + >+ " Exception class2 = intObject.getClass();\n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Class<capture#2-of ? extends Integer> to Exception\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=234619 - variation >+public void test1339() { >+ this.runNegativeTest( >+ new String[] { >+ "java/lang/Object.java", // ================= >+ "package java.lang;\n" + >+ "\n" + >+ "public class Object {\n" + >+ " void foo() {\n" + >+ " Exception e1 = getClass();\n" + >+ " Exception e2 = this.getClass();\n" + >+ " }\n" + >+ " public Class<?> getClass() { return null; }\n" + >+ "}\n", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in java\\lang\\Object.java (at line 5)\n" + >+ " Exception e1 = getClass();\n" + >+ " ^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Class<capture#1-of ? extends Object> to Exception\n" + >+ "----------\n" + >+ "2. ERROR in java\\lang\\Object.java (at line 6)\n" + >+ " Exception e2 = this.getClass();\n" + >+ " ^^^^^^^^^^^^^^^\n" + >+ "Type mismatch: cannot convert from Class<capture#2-of ? extends Object> to Exception\n" + >+ "----------\n"); >+} > } >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.310.2.7 >diff -u -r1.310.2.7 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 16 May 2008 23:30:06 -0000 1.310.2.7 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 30 May 2008 13:05:01 -0000 >@@ -774,8 +774,7 @@ > unitScope.recordTypeReferences(exactMethod.thrownExceptions); > // special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type) > if (receiverType.isInterface() || exactMethod.canBeSeenBy(receiverType, invocationSite, this)) { >- if (receiverType.id != T_JavaLangObject >- && argumentTypes == Binding.NO_PARAMETERS >+ if (argumentTypes == Binding.NO_PARAMETERS > && CharOperation.equals(selector, GETCLASS) > && exactMethod.returnType.isParameterizedType()/*1.5*/) { > return ParameterizedMethodBinding.instantiateGetClass(receiverType, exactMethod, this); >@@ -1818,8 +1817,7 @@ > invocationSite.setActualReceiverType(receiverType); > } > // special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type) >- if (receiverType.id != T_JavaLangObject >- && argumentTypes == Binding.NO_PARAMETERS >+ if (argumentTypes == Binding.NO_PARAMETERS > && CharOperation.equals(selector, GETCLASS) > && methodBinding.returnType.isParameterizedType()/*1.5*/) { > return ParameterizedMethodBinding.instantiateGetClass(receiverType, methodBinding, this); >@@ -2078,8 +2076,7 @@ > return methodBinding; > > // special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type) >- if (receiverType.id != T_JavaLangObject >- && argumentTypes == Binding.NO_PARAMETERS >+ if (argumentTypes == Binding.NO_PARAMETERS > && CharOperation.equals(selector, GETCLASS) > && methodBinding.returnType.isParameterizedType()/*1.5*/) { > return ParameterizedMethodBinding.instantiateGetClass(receiverType, methodBinding, this);
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 234619
:
102685
|
102689
| 102849