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 60750 Details for
Bug 177194
[1.5][compiler] preserveAllLocals option has undesirable side-effect when invoking generic method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
In progress patch
177194.txt (text/plain), 8.77 KB, created by
Philipe Mulet
on 2007-03-13 19:08:35 EDT
(
hide
)
Description:
In progress patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2007-03-13 19:08:35 EDT
Size:
8.77 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java,v >retrieving revision 1.95 >diff -u -r1.95 SingleNameReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 6 Mar 2007 02:38:48 -0000 1.95 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 13 Mar 2007 23:05:23 -0000 >@@ -360,8 +360,9 @@ > } else { > codeStream.invokestatic(syntheticAccessors[READ]); > } >+ // required cast must occur even if no value is required >+ if (this.genericCast != null) codeStream.checkcast(this.genericCast); > if (valueRequired) { >- if (this.genericCast != null) codeStream.checkcast(this.genericCast); > codeStream.generateImplicitConversion(implicitConversion); > } else { > if ((implicitConversion & TypeIds.UNBOXING) != 0) { >@@ -378,7 +379,9 @@ > } > } > } else { >- if (!valueRequired && ((implicitConversion & TypeIds.UNBOXING) == 0)) { >+ if (!valueRequired >+ && ((implicitConversion & TypeIds.UNBOXING) == 0) >+ && this.genericCast == null) { // required cast must occur even if no value is required > // if no valueRequired, optimize out entire gen > break; > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java,v >retrieving revision 1.108 >diff -u -r1.108 FieldReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java 21 Feb 2007 18:08:14 -0000 1.108 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java 13 Mar 2007 23:05:22 -0000 >@@ -189,7 +189,8 @@ > return; > } > if (valueRequired || (!isThisReceiver && currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) >- || ((implicitConversion & TypeIds.UNBOXING) != 0)) { >+ || ((implicitConversion & TypeIds.UNBOXING) != 0) >+ || (this.genericCast != null)) { > receiver.generateCode(currentScope, codeStream, !isStatic); > pc = codeStream.position; > if (this.codegenBinding.declaringClass == null) { // array length >@@ -210,8 +211,9 @@ > } else { > codeStream.invokestatic(syntheticAccessors[READ]); > } >+ // required cast must occur even if no value is required >+ if (this.genericCast != null) codeStream.checkcast(this.genericCast); > if (valueRequired) { >- if (this.genericCast != null) codeStream.checkcast(this.genericCast); > codeStream.generateImplicitConversion(implicitConversion); > } else { > if ((implicitConversion & TypeIds.UNBOXING) != 0) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java,v >retrieving revision 1.120 >diff -u -r1.120 MessageSend.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 6 Mar 2007 02:38:48 -0000 1.120 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java 13 Mar 2007 23:05:22 -0000 >@@ -144,11 +144,11 @@ > } else { > codeStream.invokestatic(syntheticAccessor); > } >- // operation on the returned value >+ // required cast must occur even if no value is required >+ if (this.valueCast != null) codeStream.checkcast(this.valueCast); >+ > if (valueRequired){ > // implicit conversion if necessary >- if (this.valueCast != null) >- codeStream.checkcast(this.valueCast); > codeStream.generateImplicitConversion(implicitConversion); > } else { > // pop return value if any >#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.601 >diff -u -r1.601 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 6 Mar 2007 04:42:12 -0000 1.601 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 13 Mar 2007 23:05:44 -0000 >@@ -36736,4 +36736,140 @@ > }, > ""); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 >+public void testONLY_1109() { >+ Map settings = getCompilerOptions(); >+ settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "class A<T> {\n" + >+ " public T foo(Object o) {\n" + >+ " return (T) o; // should get unchecked warning\n" + >+ " }\n" + >+ "}\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " A<X> a = new A<X>();\n" + >+ " try {\n" + >+ " X s = a.foo(new Object());\n" + >+ " } catch(ClassCastException e) {\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " return;\n" + >+ " }\n" + >+ " System.out.println(\"FAILED\");\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "SUCCESS", >+ null, >+ true, >+ null, >+ settings, >+ null); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation >+public void testONLY_1110() { >+ Map settings = getCompilerOptions(); >+ settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "class A<T> {\n" + >+ " public T foo;\n" + >+ "}\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " A<X> a = new A<X>();\n" + >+ " A ua = a;\n" + >+ " ua.foo = new Object();\n" + >+ " try {\n" + >+ " X s = a.foo;\n" + >+ " } catch(ClassCastException e) {\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " return;\n" + >+ " }\n" + >+ " System.out.println(\"FAILED\");\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "SUCCESS", >+ null, >+ true, >+ null, >+ settings, >+ null); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation >+public void testONLY_1111() { >+ Map settings = getCompilerOptions(); >+ settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "class A<T> {\n" + >+ " public T foo;\n" + >+ "}\n" + >+ "\n" + >+ "public class X extends A<X>{\n" + >+ " public static void main(String[] args) {\n" + >+ " new X().foo();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " A ua = this;\n" + >+ " ua.foo = new Object();\n" + >+ " try {\n" + >+ " X s = foo;\n" + >+ " } catch(ClassCastException e) {\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " return;\n" + >+ " }\n" + >+ " System.out.println(\"FAILED\");\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "SUCCESS", >+ null, >+ true, >+ null, >+ settings, >+ null); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation >+public void testONLY_1112() { >+ Map settings = getCompilerOptions(); >+ settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "class A<T> {\n" + >+ " public T foo;\n" + >+ "}\n" + >+ "\n" + >+ "public class X extends A<X>{\n" + >+ " public static void main(String[] args) {\n" + >+ " new X().foo();\n" + >+ " }\n" + >+ " public void foo() {\n" + >+ " A ua = this;\n" + >+ " ua.foo = new Object();\n" + >+ " try {\n" + >+ " X s = this.foo;\n" + >+ " } catch(ClassCastException e) {\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " return;\n" + >+ " }\n" + >+ " System.out.println(\"FAILED\");\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "SUCCESS", >+ null, >+ true, >+ null, >+ settings, >+ null); >+} > }
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 177194
:
60750
|
60757
|
60920
|
60927
|
60990