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 185993 Details for
Bug 332744
Generated model code doesn't compile with J2SE-1.4 execution environment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch + test - under test
patch.txt (text/plain), 6.41 KB, created by
Srikanth Sankaran
on 2011-01-04 05:54:19 EST
(
hide
)
Description:
Patch + test - under test
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2011-01-04 05:54:19 EST
Size:
6.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java,v >retrieving revision 1.132 >diff -u -r1.132 Expression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java 17 Dec 2010 06:40:12 -0000 1.132 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java 4 Jan 2011 10:52:42 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -390,8 +390,11 @@ > return false; > } else { > // pre1.5 semantics - no covariance allowed (even if 1.5 compliant, but 1.4 source) >- MethodBinding[] castTypeMethods = getAllInheritedMethods((ReferenceBinding) castType); >- MethodBinding[] expressionTypeMethods = getAllInheritedMethods((ReferenceBinding) expressionType); >+ // look at original methods rather than the parameterized variants at 1.4 to detect >+ // covariance. Otherwise when confronted with one raw type and one parameterized type, >+ // we could mistakenly detect covariance and scream foul. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=332744 >+ MethodBinding[] castTypeMethods = getAllOriginalInheritedMethods((ReferenceBinding) castType); >+ MethodBinding[] expressionTypeMethods = getAllOriginalInheritedMethods((ReferenceBinding) expressionType); > int exprMethodsLength = expressionTypeMethods.length; > for (int i = 0, castMethodsLength = castTypeMethods.length; i < castMethodsLength; i++) { > for (int j = 0; j < exprMethodsLength; j++) { >@@ -739,9 +742,12 @@ > codeStream.invokeStringConcatenationStringConstructor(); > } > >-private MethodBinding[] getAllInheritedMethods(ReferenceBinding binding) { >+private MethodBinding[] getAllOriginalInheritedMethods(ReferenceBinding binding) { > ArrayList collector = new ArrayList(); > getAllInheritedMethods0(binding, collector); >+ for (int i = 0, len = collector.size(); i < len; i++) { >+ collector.set(i, ((MethodBinding)collector.get(i)).original()); >+ } > return (MethodBinding[]) collector.toArray(new MethodBinding[collector.size()]); > } > >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java,v >retrieving revision 1.221 >diff -u -r1.221 MethodVerifyTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 3 Dec 2010 08:44:25 -0000 1.221 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 4 Jan 2011 10:52:46 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -11875,4 +11875,97 @@ > compilerOptions14, > null); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=332744 (all 1.5+) >+public void test332744() { >+ Map compilerOptions15 = getCompilerOptions(); >+ compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); >+ compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); >+ compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); >+ this.runConformTest( >+ new String[] { >+ "EList.java", >+ "import java.util.List;\n" + >+ "public interface EList<E> extends List<E> {\n" + >+ "}\n", >+ "FeatureMap.java", >+ "public interface FeatureMap extends EList<FeatureMap.Entry> {\n" + >+ " interface Entry {\n" + >+ " }\n" + >+ "}\n", >+ "InternalEList.java", >+ "public interface InternalEList<E> extends EList<E> {\n" + >+ "}\n" >+ }, >+ "", >+ null, >+ true, >+ null, >+ compilerOptions15, >+ null); >+ >+ this.runConformTest( >+ new String[] { >+ "Client.java", >+ "public class Client {\n" + >+ " Client(FeatureMap fm) {\n" + >+ " InternalEList e = (InternalEList) fm;\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "", >+ null, >+ false, >+ null, >+ compilerOptions15, >+ null); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=332744 (1.4/1.5 mix) >+public void test332744b() { >+ Map compilerOptions15 = getCompilerOptions(); >+ compilerOptions15.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, CompilerOptions.VERSION_1_5); >+ compilerOptions15.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); >+ compilerOptions15.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); >+ this.runConformTest( >+ new String[] { >+ "EList.java", >+ "import java.util.List;\n" + >+ "public interface EList<E> extends List<E> {\n" + >+ "}\n", >+ "FeatureMap.java", >+ "public interface FeatureMap extends EList<FeatureMap.Entry> {\n" + >+ " interface Entry {\n" + >+ " }\n" + >+ "}\n", >+ "InternalEList.java", >+ "public interface InternalEList<E> extends EList<E> {\n" + >+ "}\n" >+ }, >+ "", >+ null, >+ true, >+ null, >+ compilerOptions15, >+ null); >+ >+ Map compilerOptions14 = getCompilerOptions(); >+ compilerOptions14.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2); >+ compilerOptions14.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); >+ compilerOptions14.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3); >+ compilerOptions14.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE); >+ this.runConformTest( >+ new String[] { >+ "Client.java", >+ "public class Client {\n" + >+ " Client(FeatureMap fm) {\n" + >+ " InternalEList e = (InternalEList) fm;\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "", >+ null, >+ false, >+ null, >+ compilerOptions14, >+ 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 332744
:
185326
|
185987
| 185993