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 182190 Details for
Bug 186565
[1.5][compiler] 1.4/1.5 .class file interaction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Revised patch under test
patch.txt (text/plain), 8.45 KB, created by
Srikanth Sankaran
on 2010-11-02 03:52:55 EDT
(
hide
)
Description:
Revised patch under test
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-11-02 03:52:55 EDT
Size:
8.45 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java,v >retrieving revision 1.128 >diff -u -r1.128 BinaryTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 1 Nov 2010 14:44:53 -0000 1.128 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 2 Nov 2010 07:51:04 -0000 >@@ -993,7 +993,14 @@ > case Binding.RAW_TYPE : > return otherType.erasure() == this; > } >- return false; >+ /* With the hybrid 1.4/1.5+ projects modes, while establishing type equivalence, we need to >+ be prepared for a type such as Map appearing in one of three forms: As (a) a ParameterizedTypeBinding >+ e.g Map<String, String>, (b) as RawTypeBinding Map#RAW and finally (c) as a BinaryTypeBinding >+ When the usage of a type lacks type parameters, whether we land up with the raw form or not depends >+ on whether the underlying type was "seen to be" a generic type in the particular build environment or >+ not. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=186565 && https://bugs.eclipse.org/bugs/show_bug.cgi?id=328827 >+ */ >+ return this == otherType.erasure(); > } > public boolean isGenericType() { > return this.typeVariables != Binding.NO_TYPE_VARIABLES; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java,v >retrieving revision 1.118 >diff -u -r1.118 ParameterizedTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 1 Nov 2010 14:44:53 -0000 1.118 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 2 Nov 2010 07:51:07 -0000 >@@ -15,7 +15,6 @@ > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.compiler.ast.TypeReference; > import org.eclipse.jdt.internal.compiler.ast.Wildcard; >-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > > /** > * A parameterized type encapsulates a type with type arguments, >@@ -868,19 +867,28 @@ > this.arguments[i] = resolveType; > this.tagBits |= resolvedType.tagBits & TagBits.ContainsNestedTypeReferences; > } >- // arity check >- TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables(); >- if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic >- // Below 1.5, we should have already complained about the use of type parameters. >- boolean isCompliant15 = this.environment.globalOptions.originalSourceLevel >= ClassFileConstants.JDK1_5; >- if (isCompliant15 && (resolvedType.tagBits & TagBits.HasMissingType) == 0) { >- this.environment.problemReporter.nonGenericTypeCannotBeParameterized(0, null, resolvedType, this.arguments); >- } >- return this; >- } else if (argLength != refTypeVariables.length) { // check arity >- this.environment.problemReporter.incorrectArityForParameterizedType(null, resolvedType, this.arguments); >- return this; // cannot reach here as AbortCompilation is thrown >- } >+ /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=186565, Removed generic check >+ and arity check since we are dealing with binary types here and the fact that >+ the compiler produced class files for these types at all is proof positive that >+ the generic check and the arity check passed in the build environment that produced >+ these class files. Otherwise we don't handle mixed 1.5 and 1.4 projects correctly. >+ Just as with bounds check below, incremental build will propagate the change and >+ detect problems in source. >+ */ >+ >+// // arity check >+// TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables(); >+// if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic >+// // Below 1.5, we should have already complained about the use of type parameters. >+// boolean isCompliant15 = this.environment.globalOptions.originalSourceLevel >= ClassFileConstants.JDK1_5; >+// if (isCompliant15 && (resolvedType.tagBits & TagBits.HasMissingType) == 0) { >+// this.environment.problemReporter.nonGenericTypeCannotBeParameterized(0, null, resolvedType, this.arguments); >+// } >+// return this; >+// } else if (argLength != refTypeVariables.length) { // check arity >+// this.environment.problemReporter.incorrectArityForParameterizedType(null, resolvedType, this.arguments); >+// return this; // cannot reach here as AbortCompilation is thrown >+// } > // check argument type compatibility... REMOVED for now since incremental build will propagate change & detect in source > // for (int i = 0; i < argLength; i++) { > // TypeBinding resolvedArgument = this.arguments[i]; >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v >retrieving revision 1.217 >diff -u -r1.217 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 1 Nov 2010 14:43:34 -0000 1.217 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 2 Nov 2010 07:51:57 -0000 >@@ -11963,4 +11963,60 @@ > new File(lib1Path).delete(); > } > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=186565 Test interaction between 1.4 and 1.5 class files >+public void test186565(){ >+ String outputDirName = OUTPUT_DIR + File.separator + "d", >+ metaInfDirName = outputDirName + File.separator + "META-INF", >+ jarFileName = outputDirName + File.separator + "classB15.jar"; >+ this.runConformTest( >+ new String[] { >+ "d/B.java", >+ "public class B<T> extends A<T> {\n" + >+ "}", >+ "d/A.java", >+ "public class A<T> {\n" + >+ "}", >+ }, >+ "\"" + outputDirName + "\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -d \"" + outputDirName + "\"", >+ "", >+ "", >+ true /* flush output directory */); >+ File outputDirectory = new File(outputDirName); >+ File metaInfDirectory = new File(metaInfDirName); >+ metaInfDirectory.mkdirs(); >+ try { >+ Util.createFile(metaInfDirName + File.separator + "MANIFEST.MF", >+ "Manifest-Version: 1.0\n" + >+ "Class-Path: ../d/classB15.jar\n"); >+ } catch (IOException e) { >+ fail("could not create manifest file"); >+ } >+ Util.delete(outputDirName + File.separator + "A.class"); >+ Util.delete(outputDirName + File.separator + "A.java"); >+ try { >+ Util.zip(outputDirectory, jarFileName); >+ } catch (IOException e) { >+ fail("could not create jar file"); >+ } >+ Util.delete(outputDirName + File.separator + "B.class"); >+ Util.delete(outputDirName + File.separator + "B.java"); >+ this.runConformTest( >+ new String[] { >+ "d/A.java", >+ "public class A {\n" + >+ "}", >+ "d/C.java", >+ "public class C extends B<String> {\n" + >+ "}", >+ }, >+ "\"" + outputDirName + "\"" >+ + " -1.5 -g -preserveAllLocals" >+ + " -cp \"" + jarFileName + "\"" >+ + " -d \"" + OUTPUT_DIR + "\"", >+ "", >+ "", >+ false /* do not flush output directory */); >+} > } >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v >retrieving revision 1.297 >diff -u -r1.297 ASTConverter15Test.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 19 Oct 2010 18:08:23 -0000 1.297 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 2 Nov 2010 07:52:27 -0000 >@@ -9313,7 +9313,7 @@ > false); > assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType()); > CompilationUnit unit = (CompilationUnit) node; >- assertProblemsSize(unit, 1, "The type A is not generic; it cannot be parameterized with arguments <?>"); >+ assertProblemsSize(unit, 0); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=191908 > public void test0274() throws JavaModelException {
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 186565
:
181269
|
182190
|
182218