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 41743 Details for
Bug 141800
[1.5][compiler] Necessary cast is marked as "unnecessary" for cast check in 3.2RC4
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
141800.txt (text/plain), 3.48 KB, created by
Philipe Mulet
on 2006-05-17 12:08:44 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2006-05-17 12:08:44 EDT
Size:
3.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java,v >retrieving revision 1.45 >diff -u -r1.45 VarargsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java 16 May 2006 14:14:23 -0000 1.45 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java 17 May 2006 16:09:41 -0000 >@@ -1752,4 +1752,43 @@ > }, > "121212"); > } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141800 >+ public void test050() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ " import java.util.Arrays;\n" + >+ " public class X {\n" + >+ " public static void main( String args[] ) {\n" + >+ " Object test = new Object[] { \"Hello\", \"World\" };\n" + >+ " System.out.println(Arrays.asList(test));\n" + >+ " System.out.println(Arrays.asList((Object[])test)); // Warning here\n" + >+ " Zork z;\n" + >+ " }\n" + >+ "}", >+ }, >+ // ensure no complaint about unnecessary cast >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + >+ "----------\n"); >+ } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=141800 - variation >+ public void test051() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ " import java.util.Arrays;\n" + >+ " public class X {\n" + >+ " public static void main( String args[] ) {\n" + >+ " Object test = new Object[] { \"Hello\", \"World\" };\n" + >+ " System.out.print(Arrays.asList(test).size());\n" + >+ " System.out.println(Arrays.asList((Object[])test).size()); // Warning here\n" + >+ " }\n" + >+ "}", >+ }, >+ "12"); >+ } > } >#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.100 >diff -u -r1.100 CastExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java 11 May 2006 10:22:12 -0000 1.100 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java 17 May 2006 16:09:44 -0000 >@@ -253,15 +253,13 @@ > ArrayBinding varargsType = (ArrayBinding) binding.parameters[varargsIndex]; > TypeBinding lastArgType = alternateArgumentTypes[varargsIndex]; > // originalType may be compatible already, but cast mandated to clarify between varargs/non-varargs call >- int dimensions = lastArgType.dimensions(); >- if (varargsType.dimensions < dimensions) { >+ if (varargsType.dimensions != lastArgType.dimensions()) { > return; >- } else if (varargsType.dimensions == dimensions) { >- if (lastArgType.isCompatibleWith(varargsType.elementsType()) >- && lastArgType.isCompatibleWith(varargsType)) { >- return; >- } >- } >+ } >+ if (lastArgType.isCompatibleWith(varargsType.elementsType()) >+ && lastArgType.isCompatibleWith(varargsType)) { >+ return; >+ } > } > } > for (int i = 0; i < argumentLength; i++) {
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 141800
: 41743