Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Arthanareeswaran2015-08-18 06:36:43 +0000
committerJay Arthanareeswaran2015-08-24 05:50:17 +0000
commit9fabadbc8516cb9e1d8169d3db05014e3e569e55 (patch)
treeb2cb0202c4b09a463a9ff954e04c8758eaa4e17b
parent55aaf5499f405cd5e860235407dcd457c7297e41 (diff)
downloadeclipse.jdt.core-9fabadbc8516cb9e1d8169d3db05014e3e569e55.tar.gz
eclipse.jdt.core-9fabadbc8516cb9e1d8169d3db05014e3e569e55.tar.xz
eclipse.jdt.core-9fabadbc8516cb9e1d8169d3db05014e3e569e55.zip
Bug 382590 - TypesImpl.asMemberOf must also work with a subclass and its
superclass' element Change-Id: Iffe5fd774b3ae1dbe4c6c00d31d61a4450275f1f
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors.jarbin198078 -> 197964 bytes
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/typeutils/TypeUtilsProc.java7
-rw-r--r--org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AsMemberOf.java6
-rw-r--r--org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypesImpl.java6
4 files changed, 8 insertions, 11 deletions
diff --git a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors.jar b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors.jar
index d60c3cec07..8c8a101ca4 100644
--- a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors.jar
+++ b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors.jar
Binary files differ
diff --git a/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/typeutils/TypeUtilsProc.java b/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/typeutils/TypeUtilsProc.java
index 73130a8d99..b0b4a36af2 100644
--- a/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/typeutils/TypeUtilsProc.java
+++ b/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/typeutils/TypeUtilsProc.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 - 2012 BEA Systems, Inc. and others
+ * Copyright (c) 2007 - 2015 BEA Systems, Inc. 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Walter Harley - initial API and implementation
+ * IBM Corporation - Bug 382590
*******************************************************************************/
package org.eclipse.jdt.compiler.apt.tests.processors.typeutils;
@@ -405,10 +406,6 @@ public class TypeUtilsProc extends BaseProcessor
return false;
}
ExecutableType etm = (ExecutableType)tm;
- if (!etm.getParameterTypes().isEmpty()) {
- reportError(method + ": member m() should be void, but it had parameters");
- return false;
- }
if (!_typeUtils.isSameType(etm.getReturnType(), longType)) {
reportError(method + ": member m() should have Long return type, but found " + etm.getReturnType());
return false;
diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AsMemberOf.java b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AsMemberOf.java
index 5df21e72fa..473887c090 100644
--- a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AsMemberOf.java
+++ b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AsMemberOf.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Walter Harley and others
+ * Copyright (c) 2015 Walter Harley 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
@@ -15,7 +15,7 @@ package targets.model.pc;
*/
public class AsMemberOf<T> {
private T f;
- private T m() { return f; }
+ protected T m(T[] t1, T t2) { return f; }
E<Integer> e = new E<Integer>();
// Type parameter 'T' of static class is unrelated to 'T' of containing class
@@ -39,7 +39,7 @@ public class AsMemberOf<T> {
// even when accesed through a subclass; this is not explicitly specified, but
// is true for javac 1.6.
T publicize() {
- return (m() == null) ? new C<T>().x() : new D().x();
+ return (m(null, null) == null) ? new C<T>().x() : new D().x();
}
}
diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypesImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypesImpl.java
index dabeb0e7a6..820a8996d4 100644
--- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypesImpl.java
+++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypesImpl.java
@@ -7,7 +7,7 @@
*
* Contributors:
* Walter Harley - initial API and implementation
- * IBM Corporation - fix for 342598
+ * IBM Corporation - fix for 342598, 382590
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.apt.model;
@@ -85,8 +85,8 @@ public class TypesImpl implements Types {
MethodBinding methodBinding = (MethodBinding) elementImpl._binding;
while (referenceBinding != null) {
for (MethodBinding method : referenceBinding.methods()) {
- if (CharOperation.equals(method.selector, methodBinding.selector)
- && method.areParameterErasuresEqual(methodBinding)) {
+ if (CharOperation.equals(method.selector, methodBinding.selector) &&
+ (method.original() == methodBinding || method.areParameterErasuresEqual(methodBinding))) {
return this._env.getFactory().newTypeMirror(method);
}
}

Back to the top