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 81958 Details for
Bug 207573
[1.5][compiler] Internal compiler error: ClassCastException / ArrayBinding
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for 3.3.x
207573-3.3.txt (text/plain), 10.70 KB, created by
Philipe Mulet
on 2007-11-02 10:21:26 EDT
(
hide
)
Description:
Patch for 3.3.x
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2007-11-02 10:21:26 EDT
Size:
10.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java,v >retrieving revision 1.22 >diff -u -r1.22 ParameterizedMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java 25 Jun 2006 12:37:58 -0000 1.22 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java 2 Nov 2007 14:21:06 -0000 >@@ -106,6 +106,8 @@ > this.returnType = Scope.substitute(substitution, this.returnType); > this.parameters = Scope.substitute(substitution, this.parameters); > this.thrownExceptions = Scope.substitute(substitution, this.thrownExceptions); >+ // error case where exception type variable would have been substituted by a non-reference type (207573) >+ if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; > } > } > >@@ -195,6 +197,8 @@ > this.returnType = Scope.substitute(substitution, this.returnType); > this.parameters = Scope.substitute(substitution, this.parameters); > this.thrownExceptions = Scope.substitute(substitution, this.thrownExceptions); >+ // error case where exception type variable would have been substituted by a non-reference type (207573) >+ if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; > } > } > >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.1 >diff -u -r1.310.2.1 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 21 Aug 2007 19:09:09 -0000 1.310.2.1 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 2 Nov 2007 14:21:07 -0000 >@@ -199,12 +199,15 @@ > ReferenceBinding[] substitutedTypes = originalTypes; > for (int i = 0, length = originalTypes.length; i < length; i++) { > ReferenceBinding originalType = originalTypes[i]; >- ReferenceBinding substitutedParameter = (ReferenceBinding)substitute(substitution, originalType); >- if (substitutedParameter != originalType) { >+ TypeBinding substitutedType = substitute(substitution, originalType); >+ if (!(substitutedType instanceof ReferenceBinding)) { >+ return null; // impossible substitution >+ } >+ if (substitutedType != originalType) { > if (substitutedTypes == originalTypes) { > System.arraycopy(originalTypes, 0, substitutedTypes = new ReferenceBinding[length], 0, i); > } >- substitutedTypes[i] = substitutedParameter; >+ substitutedTypes[i] = (ReferenceBinding)substitutedType; > } else if (substitutedTypes != originalTypes) { > substitutedTypes[i] = originalType; > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java,v >retrieving revision 1.57.2.1 >diff -u -r1.57.2.1 ParameterizedGenericMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 10 Oct 2007 08:20:15 -0000 1.57.2.1 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java 2 Nov 2007 14:21:06 -0000 >@@ -283,6 +283,8 @@ > this.thrownExceptions = Scope.substitute(this, ignoreRawTypeSubstitution > ? originalMethod.thrownExceptions // no substitution if original was static > : Scope.substitute(rawType, originalMethod.thrownExceptions)); >+ // error case where exception type variable would have been substituted by a non-reference type (207573) >+ if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; > this.returnType = Scope.substitute(this, ignoreRawTypeSubstitution > ? originalMethod.returnType // no substitution if original was static > : Scope.substitute(rawType, originalMethod.returnType)); >@@ -305,6 +307,8 @@ > this.originalMethod = originalMethod; > this.parameters = Scope.substitute(this, originalMethod.parameters); > this.thrownExceptions = Scope.substitute(this, originalMethod.thrownExceptions); >+ // error case where exception type variable would have been substituted by a non-reference type (207573) >+ if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; > this.returnType = Scope.substitute(this, originalMethod.returnType); > this.wasInferred = true;// resulting from method invocation inferrence > } >@@ -431,6 +435,8 @@ > this.inferredReturnType = inferenceContext.hasExplicitExpectedType && this.returnType != oldReturnType; > this.parameters = Scope.substitute(this, this.parameters); > this.thrownExceptions = Scope.substitute(this, this.thrownExceptions); >+ // error case where exception type variable would have been substituted by a non-reference type (207573) >+ if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; > return this; > } > >Index: buildnotes_jdt-core.html >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/buildnotes_jdt-core.html,v >retrieving revision 1.5933.2.51 >diff -u -r1.5933.2.51 buildnotes_jdt-core.html >--- buildnotes_jdt-core.html 2 Nov 2007 12:51:06 -0000 1.5933.2.51 >+++ buildnotes_jdt-core.html 2 Nov 2007 14:21:06 -0000 >@@ -54,7 +54,9 @@ > <h2>What's new in this drop</h2> > > <h3>Problem Reports Fixed</h3> >-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=208263">208263</a> >+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=207573">207573</a> >+[1.5][compiler] Internal compiler error: ClassCastException / ArrayBinding >+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=208263">208263</a> > [ast rewrite] performance problems with lots of changes > <br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=207441">207441</a> > Wrong delta for files created in folders that are on a java project as classes folder >#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.4 >diff -u -r1.631.2.4 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 10 Oct 2007 08:20:24 -0000 1.631.2.4 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 2 Nov 2007 14:21:18 -0000 >@@ -38785,4 +38785,104 @@ > }, > ""); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=207573 >+public void test1206() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public final <E extends Exception> E throwE(E ex, Object... args) throws E {\n" + >+ " Object[] oar = new Object[0];\n" + >+ " return throwE(oar, ex, args);\n" + >+ " }\n" + >+ "\n" + >+ " public final <E extends Exception> E throwE(Object[] oar, E ex, Object... args) throws E {\n" + >+ " throw ex;\n" + >+ " }\n" + >+ "}", // ================= >+ }, >+ ""); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=207573 - variation >+public void test1207() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public final <E extends Exception> E throwE (E ex) throws E {\n" + >+ " throw ex;\n" + >+ " }\n" + >+ " void foo(Object[] objs) {\n" + >+ " throwE(objs);\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\r\n" + >+ " throwE(objs);\r\n" + >+ " ^^^^^^\n" + >+ "Bound mismatch: The generic method throwE(E) of type X is not applicable for the arguments (Object[]). The inferred type Object[] is not a valid substitute for the bounded parameter <E extends Exception>\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=207573 - variation >+public void test1208() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public final <E extends Exception> E throwE2(E ex, Object... args) throws E {\n" + >+ " Object[] oar = new Object[0];\n" + >+ " return throwE(oar, ex, args);\n" + >+ " }\n" + >+ "\n" + >+ " public final <E extends Exception> E throwE(Object[] oar, E ex, Object... args) throws E {\n" + >+ " throw ex;\n" + >+ " }\n" + >+ "}", // ================= >+ }, >+ ""); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=207573 - variation >+public void test1209() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public final <E extends Exception> E throwE (E ex, Object ... args) throws E {\n" + >+ " throw ex;\n" + >+ " }\n" + >+ " void foo(Object[] objs) {\n" + >+ " throwE(objs);\n" + >+ " }\n" + >+ "}", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\r\n" + >+ " throwE(objs);\r\n" + >+ " ^^^^^^\n" + >+ "Bound mismatch: The generic method throwE(E, Object...) of type X is not applicable for the arguments (Object[]). The inferred type Object[] is not a valid substitute for the bounded parameter <E extends Exception>\n" + >+ "----------\n"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=207573 - variation >+public void test1210() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public final <E extends Exception> E throwE (Object ... args) throws E {\n" + >+ " return null;\n" + >+ " }\n" + >+ " void foo(Object[] objs) {\n" + >+ " Object[] o = throwE(objs);\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " Object[] o = throwE(objs);\n" + >+ " ^^^^^^\n" + >+ "Bound mismatch: The generic method throwE(Object...) of type X is not applicable for the arguments (Object[]). The inferred type Object[] is not a valid substitute for the bounded parameter <E extends Exception>\n" + >+ "----------\n"); >+} >+ > }
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 207573
:
81570
| 81958