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 59593 Details for
Bug 172913
[compiler][1.5] an extra checkcast bytecode instruction generated
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
172913.txt (text/plain), 5.57 KB, created by
Philipe Mulet
on 2007-02-22 13:08:50 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2007-02-22 13:08:50 EST
Size:
5.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java,v >retrieving revision 1.108 >diff -u -r1.108 CastExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java 22 Nov 2006 16:47:44 -0000 1.108 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java 22 Feb 2007 18:05:34 -0000 >@@ -367,7 +367,7 @@ > return; > } > expression.generateCode(currentScope, codeStream, valueRequired || needRuntimeCheckcast); >- if (needRuntimeCheckcast && this.expression.postConversionType(currentScope) != this.resolvedType) { // no need to issue a checkcast if already done as genericCast >+ if (needRuntimeCheckcast && this.expression.postConversionType(currentScope) != this.resolvedType.erasure()) { // no need to issue a checkcast if already done as genericCast > codeStream.checkcast(this.resolvedType); > } > if (valueRequired) { >#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.598 >diff -u -r1.598 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 22 Feb 2007 15:39:04 -0000 1.598 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 22 Feb 2007 18:05:47 -0000 >@@ -36637,4 +36637,87 @@ > "The generic class X<T>.Y may not subclass java.lang.Throwable\n" + > "----------\n"); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=172913 >+public void test1107() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.util.ArrayList;\n" + >+ "import java.util.Collection;\n" + >+ "import java.util.HashMap;\n" + >+ "import java.util.Iterator;\n" + >+ "import java.util.List;\n" + >+ "\n" + >+ "public class X {\n" + >+ " private void processLocks(HashMap locksMap, Object key) {\n" + >+ " for (Iterator iter = locksMap.keySet().iterator(); iter.hasNext();) {\n" + >+ " Object call = iter.next();\n" + >+ " List locks = externLocks((Collection) locksMap.get(call), call);\n" + >+ " // ...\n" + >+ " }\n" + >+ " }\n" + >+ " private List externLocks(Collection locks, Object call) {\n" + >+ " List result = new ArrayList();\n" + >+ " // ..\n" + >+ " return result;\n" + >+ " }\n" + >+ "}\n", >+ }, >+ ""); >+ // ensure only one instance of: checkcast java.util.Collection >+ String expectedOutput = >+ " // Method descriptor #15 (Ljava/util/HashMap;Ljava/lang/Object;)V\n" + >+ " // Stack: 3, Locals: 6\n" + >+ " private void processLocks(java.util.HashMap locksMap, java.lang.Object key);\n" + >+ " 0 aload_1 [locksMap]\n" + >+ " 1 invokevirtual java.util.HashMap.keySet() : java.util.Set [16]\n" + >+ " 4 invokeinterface java.util.Set.iterator() : java.util.Iterator [22] [nargs: 1]\n" + >+ " 9 astore_3 [iter]\n" + >+ " 10 goto 38\n" + >+ " 13 aload_3 [iter]\n" + >+ " 14 invokeinterface java.util.Iterator.next() : java.lang.Object [28] [nargs: 1]\n" + >+ " 19 astore 4 [call]\n" + >+ " 21 aload_0 [this]\n" + >+ " 22 aload_1 [locksMap]\n" + >+ " 23 aload 4 [call]\n" + >+ " 25 invokevirtual java.util.HashMap.get(java.lang.Object) : java.lang.Object [34]\n" + >+ " 28 checkcast java.util.Collection [38]\n" + >+ " 31 aload 4 [call]\n" + >+ " 33 invokespecial X.externLocks(java.util.Collection, java.lang.Object) : java.util.List [40]\n" + >+ " 36 astore 5\n" + >+ " 38 aload_3 [iter]\n" + >+ " 39 invokeinterface java.util.Iterator.hasNext() : boolean [44] [nargs: 1]\n" + >+ " 44 ifne 13\n" + >+ " 47 return\n" + >+ " Line numbers:\n" + >+ " [pc: 0, line: 9]\n" + >+ " [pc: 13, line: 10]\n" + >+ " [pc: 21, line: 11]\n" + >+ " [pc: 38, line: 9]\n" + >+ " [pc: 47, line: 14]\n" + >+ " Local variable table:\n" + >+ " [pc: 0, pc: 48] local: this index: 0 type: X\n" + >+ " [pc: 0, pc: 48] local: locksMap index: 1 type: java.util.HashMap\n" + >+ " [pc: 0, pc: 48] local: key index: 2 type: java.lang.Object\n" + >+ " [pc: 10, pc: 47] local: iter index: 3 type: java.util.Iterator\n" + >+ " [pc: 21, pc: 38] local: call index: 4 type: java.lang.Object\n"; >+ >+ try { >+ File f = new File(OUTPUT_DIR + File.separator + "X.class"); >+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f); >+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler(); >+ String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED); >+ int index = result.indexOf(expectedOutput); >+ if (index == -1 || expectedOutput.length() == 0) { >+ System.out.println(Util.displayString(result, 3)); >+ } >+ if (index == -1) { >+ assertEquals("Wrong contents", expectedOutput, result); >+ } >+ } catch (org.eclipse.jdt.core.util.ClassFormatException e) { >+ assertTrue(false); >+ } catch (IOException e) { >+ assertTrue(false); >+ } >+ } > } >\ 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 172913
: 59593