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 193887 Details for
Bug 339478
[1.7][compiler] support for diamond case
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Revised Implementation v0.9
patch.txt (text/plain), 26.28 KB, created by
Srikanth Sankaran
on 2011-04-21 16:40:22 EDT
(
hide
)
Description:
Revised Implementation v0.9
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2011-04-21 16:40:22 EDT
Size:
26.28 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java,v >retrieving revision 1.84.2.5 >diff -u -r1.84.2.5 AllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 20 Apr 2011 16:36:05 -0000 1.84.2.5 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java 21 Apr 2011 20:24:58 -0000 >@@ -17,12 +17,14 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.ast; > >+import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.compiler.ASTVisitor; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.codegen.*; > import org.eclipse.jdt.internal.compiler.flow.*; > import org.eclipse.jdt.internal.compiler.impl.Constant; > import org.eclipse.jdt.internal.compiler.lookup.*; >+import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; > > public class AllocationExpression extends Expression implements InvocationSite { > >@@ -260,11 +262,7 @@ > // initialization of an enum constant > this.resolvedType = scope.enclosingReceiverType(); > } else { >- if ((this.type.bits & ASTNode.IsDiamond) != 0) { >- this.resolvedType = null; // can be done only after type arguments and method arguments resolution. >- } else { >- this.resolvedType = this.type.resolveType(scope, true /* check bounds*/); >- } >+ this.resolvedType = this.type.resolveType(scope, true /* check bounds*/); > // check for parameterized allocation deferred to below. > } > // will check for null after args are resolved >@@ -338,9 +336,18 @@ > return this.resolvedType; > } > } >- if (this.type != null && (this.type.bits & ASTNode.IsDiamond) != 0) { >- // Perform diamond inference here. (Not done yet.) >- this.resolvedType = this.type.resolveType(scope, true /* check bounds*/); // for now just do what we do for 1.6- >+ if (this.resolvedType == null || !this.resolvedType.isValidBinding()) { >+ return null; >+ } >+ >+ // null type denotes fake allocation for enum constant inits >+ if (this.type != null && !this.resolvedType.canBeInstantiated()) { >+ scope.problemReporter().cannotInstantiate(this.type, this.resolvedType); >+ return this.resolvedType; >+ } >+ if (this.type != null && this.resolvedType != null && (this.type.bits & ASTNode.IsDiamond) != 0) { >+ TypeBinding [] inferredTypes = inferElidedTypes(((ParameterizedTypeBinding) this.resolvedType).genericType(), argumentTypes, scope); >+ this.resolvedType = this.type.resolvedType = scope.environment().createParameterizedType(((ParameterizedTypeBinding) this.resolvedType).genericType(), inferredTypes, ((ParameterizedTypeBinding) this.resolvedType).enclosingType()); > } > checkParameterizedAllocation: { > if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>() >@@ -360,15 +367,7 @@ > } > } > } >- if (this.resolvedType == null || !this.resolvedType.isValidBinding()) { >- return null; >- } > >- // null type denotes fake allocation for enum constant inits >- if (this.type != null && !this.resolvedType.canBeInstantiated()) { >- scope.problemReporter().cannotInstantiate(this.type, this.resolvedType); >- return this.resolvedType; >- } > ReferenceBinding allocationType = (ReferenceBinding) this.resolvedType; > if (!(this.binding = scope.getConstructor(allocationType, argumentTypes, this)).isValidBinding()) { > if (this.binding.declaringClass == null) { >@@ -394,6 +393,131 @@ > return allocationType; > } > >+private TypeBinding[] inferElidedTypes(ReferenceBinding allocationType, TypeBinding[] argumentTypes, final BlockScope scope) { >+ TypeVariableBinding[] classTypeVariables = allocationType.typeVariables(); >+ int classTypeVariablesArity = classTypeVariables.length; >+ TypeBinding [] inferredTypes = new TypeBinding[classTypeVariablesArity]; >+ for (int i = 0; i < classTypeVariablesArity; i++) { >+ inferredTypes[i] = new ProblemReferenceBinding(CharOperation.NO_CHAR_CHAR, null, ProblemReasons.InferenceFailed); >+ } >+ MethodBinding[] methods = allocationType.getMethods(TypeConstants.INIT, argumentTypes.length); >+ MethodBinding [] staticFactories = new MethodBinding[methods.length]; >+ int sfi = 0; >+ for (int i = 0, length = methods.length; i < length; i++) { >+ MethodBinding method = methods[i]; >+ >+ TypeVariableBinding[] methodTypeVariables = method.typeVariables(); >+ int methodTypeVariablesArity = methodTypeVariables.length; >+ >+ if (this.genericTypeArguments != null && this.genericTypeArguments.length < methodTypeVariablesArity) >+ continue; // wrong tree, don't bark. >+ MethodBinding staticFactory = new MethodBinding(method.modifiers | ClassFileConstants.AccStatic, TypeConstants.SYNTHETIC_STATIC_FACTORY, >+ null, null, null, method.declaringClass); >+ staticFactory.typeVariables = new TypeVariableBinding[classTypeVariablesArity + (this.genericTypeArguments == null ? methodTypeVariablesArity : 0)]; >+ final SimpleLookupTable map = new SimpleLookupTable(classTypeVariablesArity + methodTypeVariablesArity); >+ // Rename each type variable T of the type to T' >+ for (int j = 0; j < classTypeVariablesArity; j++) { >+ map.put(classTypeVariables[j], staticFactory.typeVariables[j] = new TypeVariableBinding(CharOperation.concat(classTypeVariables[j].sourceName, "'".toCharArray()), //$NON-NLS-1$ >+ staticFactory, j, scope.environment())); >+ } >+ // Rename each type variable U of method U to U'' if not explicitly parameterized. Otherwise use the parameterizing type. >+ for (int j = classTypeVariablesArity, max = classTypeVariablesArity + methodTypeVariablesArity; j < max; j++) { >+ map.put(methodTypeVariables[j - classTypeVariablesArity], >+ this.genericTypeArguments != null ? this.genericTypeArguments[j - classTypeVariablesArity] : >+ (staticFactory.typeVariables[j] = new TypeVariableBinding(CharOperation.concat(methodTypeVariables[j - classTypeVariablesArity].sourceName, "''".toCharArray()), //$NON-NLS-1$ >+ staticFactory, j, scope.environment()))); >+ } >+ >+ Substitution substitution = new Substitution() { >+ public LookupEnvironment environment() { >+ return scope.environment(); >+ } >+ public boolean isRawSubstitution() { >+ return false; >+ } >+ public TypeBinding substitute(TypeVariableBinding typeVariable) { >+ return (TypeBinding) map.get(typeVariable); >+ } >+ }; >+ >+ // initialize new variable bounds >+ for (int j = 0, max = classTypeVariablesArity + methodTypeVariablesArity; j < max; j++) { >+ TypeVariableBinding originalVariable = j < classTypeVariablesArity ? classTypeVariables[j] : methodTypeVariables[j - classTypeVariablesArity]; >+ TypeBinding substitutedType = (TypeBinding) map.get(originalVariable); >+ if (substitutedType instanceof TypeVariableBinding) { >+ TypeVariableBinding substitutedVariable = (TypeVariableBinding) substitutedType; >+ TypeBinding substitutedSuperclass = Scope.substitute(substitution, originalVariable.superclass); >+ ReferenceBinding[] substitutedInterfaces = Scope.substitute(substitution, originalVariable.superInterfaces); >+ if (originalVariable.firstBound != null) { >+ substitutedVariable.firstBound = originalVariable.firstBound == originalVariable.superclass >+ ? substitutedSuperclass // could be array type or interface >+ : substitutedInterfaces[0]; >+ } >+ switch (substitutedSuperclass.kind()) { >+ case Binding.ARRAY_TYPE : >+ substitutedVariable.superclass = scope.environment().getResolvedType(TypeConstants.JAVA_LANG_OBJECT, null); >+ substitutedVariable.superInterfaces = substitutedInterfaces; >+ break; >+ default: >+ if (substitutedSuperclass.isInterface()) { >+ substitutedVariable.superclass = scope.environment().getResolvedType(TypeConstants.JAVA_LANG_OBJECT, null); >+ int interfaceCount = substitutedInterfaces.length; >+ System.arraycopy(substitutedInterfaces, 0, substitutedInterfaces = new ReferenceBinding[interfaceCount+1], 1, interfaceCount); >+ substitutedInterfaces[0] = (ReferenceBinding) substitutedSuperclass; >+ substitutedVariable.superInterfaces = substitutedInterfaces; >+ } else { >+ substitutedVariable.superclass = (ReferenceBinding) substitutedSuperclass; // typeVar was extending other typeVar which got substituted with interface >+ substitutedVariable.superInterfaces = substitutedInterfaces; >+ } >+ } >+ } >+ } >+ TypeVariableBinding[] returnTypeParameters = new TypeVariableBinding[classTypeVariablesArity]; >+ for (int j = 0; j < classTypeVariablesArity; j++) { >+ returnTypeParameters[j] = (TypeVariableBinding) map.get(classTypeVariables[j]); >+ } >+ staticFactory.returnType = scope.environment().createParameterizedType(allocationType, returnTypeParameters, allocationType.enclosingType()); >+ staticFactory.parameters = Scope.substitute(substitution, method.parameters); >+ staticFactory.thrownExceptions = Scope.substitute(substitution, method.thrownExceptions); >+ if (staticFactory.thrownExceptions == null) { >+ staticFactory.thrownExceptions = Binding.NO_EXCEPTIONS; >+ } >+ staticFactories[sfi++] = new ParameterizedMethodBinding((ParameterizedTypeBinding) scope.environment().convertToParameterizedType(staticFactory.declaringClass), >+ staticFactory); >+ } >+ if (sfi != methods.length) { >+ System.arraycopy(staticFactories, 0, staticFactories = new MethodBinding[sfi], 0, sfi); >+ } >+ MethodBinding[] compatible = new MethodBinding[sfi]; >+ int compatibleIndex = 0; >+ for (int i = 0; i < sfi; i++) { >+ MethodBinding compatibleMethod = scope.computeCompatibleMethod(staticFactories[i], argumentTypes, this); >+ if (compatibleMethod != null) { >+ if (compatibleMethod.isValidBinding()) >+ compatible[compatibleIndex++] = compatibleMethod; >+ } >+ } >+ >+ if (compatibleIndex == 0) { >+ return inferredTypes; >+ } >+ MethodBinding[] visible = new MethodBinding[compatibleIndex]; >+ int visibleIndex = 0; >+ for (int i = 0; i < compatibleIndex; i++) { >+ MethodBinding method = compatible[i]; >+ if (method.canBeSeenBy(this, scope)) >+ visible[visibleIndex++] = method; >+ } >+ if (visibleIndex == 0) { >+ return inferredTypes; >+ } >+ MethodBinding mostSpecific = visibleIndex == 1 ? visible[0] : scope.mostSpecificMethodBinding(visible, visibleIndex, argumentTypes, this, allocationType); >+ if (mostSpecific == null || !mostSpecific.isValidBinding()) { >+ return inferredTypes; >+ } >+ return ((ParameterizedGenericMethodBinding) mostSpecific).typeArguments; >+} >+ > public void setActualReceiverType(ReferenceBinding receiverType) { > // ignored > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java,v >retrieving revision 1.63.2.6 >diff -u -r1.63.2.6 ParameterizedQualifiedTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java 19 Apr 2011 21:36:37 -0000 1.63.2.6 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java 21 Apr 2011 20:24:59 -0000 >@@ -268,7 +268,7 @@ > // check argument type compatibility > if (checkBounds) // otherwise will do it in Scope.connectTypeVariables() or generic method resolution > parameterizedType.boundCheck(scope, args); >- else >+ else if ((this.bits & ASTNode.IsDiamond) == 0) > scope.deferBoundCheck(this); > qualifyingType = parameterizedType; > } else { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java,v >retrieving revision 1.54.2.6 >diff -u -r1.54.2.6 ParameterizedSingleTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 19 Apr 2011 21:36:37 -0000 1.54.2.6 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 21 Apr 2011 20:24:59 -0000 >@@ -245,7 +245,7 @@ > // check argument type compatibility > if (checkBounds) // otherwise will do it in Scope.connectTypeVariables() or generic method resolution > parameterizedType.boundCheck(scope, this.typeArguments); >- else >+ else if ((this.bits & ASTNode.IsDiamond) == 0) > scope.deferBoundCheck(this); > if (isTypeUseDeprecated(parameterizedType, scope)) > reportDeprecatedType(parameterizedType, scope); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java,v >retrieving revision 1.101.2.4 >diff -u -r1.101.2.4 QualifiedAllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 20 Apr 2011 16:36:05 -0000 1.101.2.4 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java 21 Apr 2011 20:25:00 -0000 >@@ -275,11 +275,7 @@ > // initialization of an enum constant > receiverType = scope.enclosingSourceType(); > } else { >- if ((this.type.bits & ASTNode.IsDiamond) == 0) { >- receiverType = this.type.resolveType(scope, true /* check bounds*/); >- } else { >- // can be done only after type arguments and method arguments resolution >- } >+ receiverType = this.type.resolveType(scope, true /* check bounds*/); > // check for parameterized allocation deferred to below. > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java,v >retrieving revision 1.14.28.1 >diff -u -r1.14.28.1 ProblemReasons.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java 2 Mar 2011 11:56:58 -0000 1.14.28.1 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java 21 Apr 2011 20:25:00 -0000 >@@ -31,4 +31,5 @@ > final int TypeArgumentsForRawGenericMethod = 13; // for generic method > final int InvalidTypeForStaticImport = 14; > final int InvalidTypeForAutoManagedResource = 15; >+ final int InferenceFailed = 16; > } >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.380.2.3 >diff -u -r1.380.2.3 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 15 Feb 2011 05:43:47 -0000 1.380.2.3 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 21 Apr 2011 20:25:04 -0000 >@@ -511,7 +511,7 @@ > * Will answer a substituted method in case the method was generic and type inference got triggered; > * in case the method was originally compatible, then simply answer it back. > */ >- protected final MethodBinding computeCompatibleMethod(MethodBinding method, TypeBinding[] arguments, InvocationSite invocationSite) { >+ public final MethodBinding computeCompatibleMethod(MethodBinding method, TypeBinding[] arguments, InvocationSite invocationSite) { > TypeBinding[] genericTypeArguments = invocationSite.genericTypeArguments(); > TypeBinding[] parameters = method.parameters; > TypeVariableBinding[] typeVariables = method.typeVariables; >@@ -3686,7 +3686,7 @@ > } > > // caveat: this is not a direct implementation of JLS >- protected final MethodBinding mostSpecificMethodBinding(MethodBinding[] visible, int visibleSize, TypeBinding[] argumentTypes, final InvocationSite invocationSite, ReferenceBinding receiverType) { >+ public final MethodBinding mostSpecificMethodBinding(MethodBinding[] visible, int visibleSize, TypeBinding[] argumentTypes, final InvocationSite invocationSite, ReferenceBinding receiverType) { > int[] compatibilityLevels = new int[visibleSize]; > for (int i = 0; i < visibleSize; i++) > compatibilityLevels[i] = parameterCompatibilityLevel(visible[i], argumentTypes); >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java,v >retrieving revision 1.51.2.4 >diff -u -r1.51.2.4 TypeConstants.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java 19 Apr 2011 13:09:09 -0000 1.51.2.4 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java 21 Apr 2011 20:25:04 -0000 >@@ -170,6 +170,7 @@ > char[] SYNTHETIC_ENCLOSING_INSTANCE_PREFIX = "this$".toCharArray(); //$NON-NLS-1$ > char[] SYNTHETIC_ACCESS_METHOD_PREFIX = "access$".toCharArray(); //$NON-NLS-1$ > char[] SYNTHETIC_ENUM_CONSTANT_INITIALIZATION_METHOD_PREFIX = " enum constant initialization$".toCharArray(); //$NON-NLS-1$ >+ char[] SYNTHETIC_STATIC_FACTORY = "<factory>".toCharArray(); //$NON-NLS-1$ > > // synthetic package-info name > public static final char[] PACKAGE_INFO_NAME = "package-info".toCharArray(); //$NON-NLS-1$ >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Attic/GenericsRegressionTest_1_7.java,v >retrieving revision 1.1.2.6 >diff -u -r1.1.2.6 GenericsRegressionTest_1_7.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java 19 Apr 2011 12:10:01 -0000 1.1.2.6 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java 21 Apr 2011 20:25:08 -0000 >@@ -18,7 +18,7 @@ > public class GenericsRegressionTest_1_7 extends AbstractRegressionTest { > > static { >-// TESTS_NAMES = new String[] { "test0014" }; >+// TESTS_NAMES = new String[] { "test0016" }; > // TESTS_NUMBERS = new int[] { 40, 41, 43, 45, 63, 64 }; > // TESTS_RANGE = new int[] { 11, -1 }; > } >@@ -28,7 +28,7 @@ > public static Test suite() { > return buildMinimalComplianceTestSuite(testClass(), F_1_7); > } >-public void _test001() { >+public void test001() { > this.runConformTest( > new String[] { > "X.java", >@@ -44,7 +44,7 @@ > }, > "SUCCESS"); > } >-public void _test001a() { >+public void test001a() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -65,7 +65,7 @@ > "The method testFunction(String) in the type X<String> is not applicable for the arguments (int)\n" + > "----------\n"); > } >-public void _test001b() { >+public void test001b() { > this.runConformTest( > new String[] { > "X.java", >@@ -80,7 +80,7 @@ > "SUCCESS"); > } > // fields >-public void _test001b_1() { >+public void test001b_1() { > this.runConformTest( > new String[] { > "X.java", >@@ -94,7 +94,7 @@ > }, > "SUCCESS"); > } >-public void _test001c() { >+public void test001c() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -114,7 +114,7 @@ > "----------\n"); > } > // fields >-public void _test001c_1() { >+public void test001c_1() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -133,7 +133,7 @@ > "The method add(int, String) in the type ArrayList<String> is not applicable for the arguments (int)\n" + > "----------\n"); > } >-public void _test001d() { >+public void test001d() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -155,7 +155,7 @@ > "The method ab(ArrayList<String>) in the type X<String> is not applicable for the arguments (ArrayList<Object>)\n" + > "----------\n"); > } >-public void _test001e() { >+public void test001e() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -177,7 +177,7 @@ > "The method ab(ArrayList<String>) in the type X<String> is not applicable for the arguments (ArrayList<Object>)\n" + > "----------\n"); > } >-public void _test001f() { >+public void test001f() { > this.runConformTest( > new String[] { > "X.java", >@@ -216,7 +216,7 @@ > }, > "SUCCESS"); > } >-public void _test001g() { >+public void test001g() { > this.runConformTest( > new String[] { > "X.java", >@@ -256,7 +256,7 @@ > }, > "SUCCESS\n1"); > } >-public void _test001h() { >+public void test001h() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -284,7 +284,7 @@ > "The method methodx(String) in the type X<String>.X2<String> is not applicable for the arguments (int)\n" + > "----------\n"); > } >-public void _test001h_1() { >+public void test001h_1() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -329,7 +329,7 @@ > "Type safety: The method methodx(Object) belongs to the raw type X.X2. References to generic type X<T>.X2<T> should be parameterized\n" + > "----------\n"); > } >-public void _test001i() { >+public void test001i() { > this.runConformTest( > new String[] { > "X.java", >@@ -376,7 +376,7 @@ > "Type safety: The method testFunction(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + > "----------\n"); > } >-public void _test003() { >+public void test003() { > this.runConformTest( > new String[] { > "X.java", >@@ -392,7 +392,7 @@ > "SUCCESS"); > } > >-public void _test004b() { >+public void test004b() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -437,7 +437,7 @@ > "1"); > } > >-public void _test006() { >+public void test006() { > this.runConformTest( > new String[] { > "X.java", >@@ -460,7 +460,7 @@ > "SUCCESS"); > } > // shows the difference between using <> and the raw type - different semantics >-public void _test007() { >+public void test007() { > this.runConformTest( > new String[] { > "X.java", >@@ -487,7 +487,7 @@ > "1\n" + > "2"); > } >-public void _test007a() { >+public void test007a() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -529,12 +529,12 @@ > "----------\n"); > } > //shows the difference between using <> and the raw type - different semantics >-public void _test008() { >- this.runConformTest( >+public void test008() { >+ this.runNegativeTest( > new String[] { > "X.java", > "public class X<T> {\n" + >- " T field1;" + >+ " T field1;\n" + > " public X(T param){\n" + > " field1 = param;\n" + > " }\n" + >@@ -547,10 +547,30 @@ > " }\n" + > "}", > }, >- ""); >+ "----------\n" + >+ "1. WARNING in X.java (at line 7)\n" + >+ " X<?> x1 = new X(1).get(\"\");\n" + >+ " ^^^^^^^^\n" + >+ "Type safety: The constructor X(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 7)\n" + >+ " X<?> x1 = new X(1).get(\"\");\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The method get(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 7)\n" + >+ " X<?> x1 = new X(1).get(\"\");\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 8)\n" + >+ " X<?> x2 = new X<>(1).get(\"\");\n" + >+ " ^^^\n" + >+ "The method get(Integer) in the type X<Integer> is not applicable for the arguments (String)\n" + >+ "----------\n"); > } > >-public void _test0014() { >+public void test0014() { > this.runConformTest( > new String[] { > "X.java", >@@ -568,7 +588,7 @@ > "SUCCESS\n" + > "123"); > } >-public void _test0014a() { >+public void test0014a() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -590,7 +610,7 @@ > "The method testFunction(String, Integer) in the type X<String,Integer> is not applicable for the arguments (int, String)\n" + > "----------\n"); > } >-public void _test0015() { >+public void test0015() { > this.runConformTest( > new String[] { > "X.java", >@@ -611,7 +631,7 @@ > } > // To verify that a parameterized invocation of a generic constructor works even if <> is used > // to elide class type parameters. >-public void _test0016() { >+public void test0016() { > this.runConformTest( > new String[] { > "X.java", >@@ -632,7 +652,7 @@ > } > // To verify that a parameterized invocation of a generic constructor works even if <> is used > // to elide class type parameters. This test handles fields >-public void _test0016b() { >+public void test0016b() { > this.runConformTest( > new String[] { > "X.java", >@@ -657,7 +677,7 @@ > // To verify that a parameterized invocation of a non-generic constructor works even if <> is used > // to elide class type parameters. > // This was not allowed in java 1.6 and 1.5 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=168230) >-public void _test0017() { >+public void test0017() { > this.runConformTest( > new String[] { > "X.java", >@@ -679,7 +699,7 @@ > "const.1\nconst.1\nconst.2"); > } > // To verify that the correct constructor is found by parameter substitution in the diamond case >-public void _test0018() { >+public void test0018() { > this.runConformTest( > new String[] { > "X.java", >@@ -700,7 +720,7 @@ > } > // To verify that the correct constructor is found by parameter substitution > // in the diamond case -- fields >-public void _test0018b() { >+public void test0018b() { > this.runConformTest( > new String[] { > "X.java", >@@ -738,7 +758,7 @@ > "----------\n"); > } > // check inference at method argument position. >-public void _test0020() { >+public void test0020() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -757,7 +777,7 @@ > "----------\n"); > } > //check inference at method argument position. >-public void _test0021() { >+public void test0021() { > this.runNegativeTest( > new String[] { > "X.java",
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 339478
:
190845
|
191332
|
191458
|
191707
|
191785
|
191891
|
191902
|
191946
|
191947
|
191984
|
192058
|
193887
|
193901
|
193918
|
193951
|
193962
|
193963