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 181936 Details for
Bug 328775
[compiler] Compiler fails to warn about invalid cast when using J2SE 1.4 compiler settings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch that fixes the problem
patch.txt (text/plain), 3.79 KB, created by
Srikanth Sankaran
on 2010-10-28 09:57:33 EDT
(
hide
)
Description:
Patch that fixes the problem
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-10-28 09:57:33 EDT
Size:
3.79 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.125 >diff -u -r1.125 BinaryTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 20 Oct 2010 05:46:47 -0000 1.125 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 28 Oct 2010 13:55:20 -0000 >@@ -489,7 +489,7 @@ > } else { > methodModifiers |= ExtraCompilerModifiers.AccGenericSignature; > // MethodTypeSignature = ParameterPart(optional) '(' TypeSignatures ')' return_typeSignature ['^' TypeSignature (optional)] >- SignatureWrapper wrapper = new SignatureWrapper(methodSignature, use15specifics); >+ SignatureWrapper wrapper = new SignatureWrapper(methodSignature, true); > if (wrapper.signature[wrapper.start] == '<') { > // <A::Ljava/lang/annotation/Annotation;>(Ljava/lang/Class<TA;>;)TA; > // ParameterPart = '<' ParameterSignature(s) '>' >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.374 >diff -u -r1.374 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 20 Oct 2010 05:46:47 -0000 1.374 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 28 Oct 2010 13:55:25 -0000 >@@ -525,6 +525,7 @@ > return null; // incompatible > > if (typeVariables != Binding.NO_TYPE_VARIABLES) { // generic method >+ boolean compliant14 = compilerOptions().complianceLevel < ClassFileConstants.JDK1_5; > TypeBinding[] newArgs = null; > for (int i = 0; i < argLength; i++) { > TypeBinding param = i < paramLength ? parameters[i] : parameters[paramLength - 1]; >@@ -534,6 +535,27 @@ > System.arraycopy(arguments, 0, newArgs, 0, argLength); > } > newArgs[i] = environment().computeBoxingType(arguments[i]); >+ >+ } else if (compliant14 && invocationSite instanceof MessageSend >+ && param.kind() == Binding.PARAMETERIZED_TYPE && param.erasure().id == TypeIds.T_JavaLangClass >+ && ((ParameterizedTypeBinding) param).arguments.length == 1 >+ && ((ParameterizedTypeBinding) param).arguments[0] instanceof TypeVariableBinding >+ && arguments[i].kind() == Binding.TYPE && arguments[i].erasure().id == TypeIds.T_JavaLangClass) { >+ /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=328775. Class literals are special in that >+ they carry (and are the only expressions that can carry) full parameterization information >+ even in 1.4 source code. For inference during method selection/invocation to work properly, >+ resolve class literal expression's type to be a parameterized type if in 1.4 we encounter >+ a method that expects a parameter of the type Class<> >+ */ >+ if (newArgs == null) { >+ newArgs = new TypeBinding[argLength]; >+ System.arraycopy(arguments, 0, newArgs, 0, argLength); >+ } >+ ClassLiteralAccess classLiteral = (ClassLiteralAccess) ((MessageSend) invocationSite).arguments[i]; >+ // Integer.class --> Class<Integer>, perform boxing of base types (int.class --> Class<Integer>) >+ // BundleWiring.class --> Class<BundleWiring> >+ TypeBinding boxedType = boxing(classLiteral.targetType); >+ newArgs[i] = classLiteral.resolvedType = environment().createParameterizedType(((ParameterizedTypeBinding)param).genericType(), new TypeBinding[]{ boxedType }, null /*not a member*/); > } > } > if (newArgs != 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 328775
:
181779
|
181923
|
181936
|
182019