diff options
author | Stephan Herrmann | 2017-04-09 19:03:54 +0000 |
---|---|---|
committer | Stephan Herrmann | 2017-04-09 19:03:54 +0000 |
commit | dc6e539f1543a55b703775e31c7eb90500565bee (patch) | |
tree | eeec593dca3d64972e70ce1e997393e5621953f0 /org.eclipse.jdt.core | |
parent | 0da3c2bfd41bdb1134fb297a803d154ee2ea7998 (diff) | |
download | eclipse.jdt.core-dc6e539f1543a55b703775e31c7eb90500565bee.tar.gz eclipse.jdt.core-dc6e539f1543a55b703775e31c7eb90500565bee.tar.xz eclipse.jdt.core-dc6e539f1543a55b703775e31c7eb90500565bee.zip |
Bug 506653: Eclipse claims about duplicated method declarationI20170409-2000
Change-Id: Ibea2f0cb37dc614ea59b88a05c4503c321edc7e5
Diffstat (limited to 'org.eclipse.jdt.core')
-rw-r--r-- | org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java index 934a4835f6..4636fdd8fe 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java @@ -192,31 +192,37 @@ public MethodBinding asRawMethod(LookupEnvironment env) { int length = this.typeVariables.length; TypeBinding[] arguments = new TypeBinding[length]; for (int i = 0; i < length; i++) { - TypeVariableBinding var = this.typeVariables[i]; - if (var.boundsCount() <= 1) { - arguments[i] = env.convertToRawType(var.upperBound(), false /*do not force conversion of enclosing types*/); + arguments[i] = makeRawArgument(env, this.typeVariables[i]); + } + return env.createParameterizedGenericMethod(this, arguments); +} +private TypeBinding makeRawArgument(LookupEnvironment env, TypeVariableBinding var) { + if (var.boundsCount() <= 1) { + TypeBinding upperBound = var.upperBound(); + if (upperBound.isTypeVariable()) + return makeRawArgument(env, (TypeVariableBinding) upperBound); + return env.convertToRawType(upperBound, false /*do not force conversion of enclosing types*/); + } else { + // use an intersection type to retain full bound information if more than 1 bound + TypeBinding[] itsSuperinterfaces = var.superInterfaces(); + int superLength = itsSuperinterfaces.length; + TypeBinding rawFirstBound = null; + TypeBinding[] rawOtherBounds = null; + if (var.boundsCount() == superLength) { + rawFirstBound = env.convertToRawType(itsSuperinterfaces[0], false); + rawOtherBounds = new TypeBinding[superLength - 1]; + for (int s = 1; s < superLength; s++) + rawOtherBounds[s - 1] = env.convertToRawType(itsSuperinterfaces[s], false); } else { - // use an intersection type to retain full bound information if more than 1 bound - TypeBinding[] itsSuperinterfaces = var.superInterfaces(); - int superLength = itsSuperinterfaces.length; - TypeBinding rawFirstBound = null; - TypeBinding[] rawOtherBounds = null; - if (var.boundsCount() == superLength) { - rawFirstBound = env.convertToRawType(itsSuperinterfaces[0], false); - rawOtherBounds = new TypeBinding[superLength - 1]; - for (int s = 1; s < superLength; s++) - rawOtherBounds[s - 1] = env.convertToRawType(itsSuperinterfaces[s], false); - } else { - rawFirstBound = env.convertToRawType(var.superclass(), false); - rawOtherBounds = new TypeBinding[superLength]; - for (int s = 0; s < superLength; s++) - rawOtherBounds[s] = env.convertToRawType(itsSuperinterfaces[s], false); - } - arguments[i] = env.createWildcard(null, 0, rawFirstBound, rawOtherBounds, org.eclipse.jdt.internal.compiler.ast.Wildcard.EXTENDS); + rawFirstBound = env.convertToRawType(var.superclass(), false); + rawOtherBounds = new TypeBinding[superLength]; + for (int s = 0; s < superLength; s++) + rawOtherBounds[s] = env.convertToRawType(itsSuperinterfaces[s], false); } + return env.createWildcard(null, 0, rawFirstBound, rawOtherBounds, org.eclipse.jdt.internal.compiler.ast.Wildcard.EXTENDS); } - return env.createParameterizedGenericMethod(this, arguments); } + /* Answer true if the receiver is visible to the type provided by the scope. * InvocationSite implements isSuperAccess() to provide additional information * if the receiver is protected. |