From b40cd6a2217cb26278d6a946caf97f9a327f7233 Mon Sep 17 00:00:00 2001 From: Eric Milles Date: Mon, 30 Sep 2024 13:31:26 -0500 Subject: [PATCH] Fix for #1588 and #1595: update single method context `GenericsMapper` - do not show type vars in javadoc display --- .../tests/search/GenericInferencingTests.java | 1 + .../jdt/groovy/search/GenericsMapper.java | 27 +---- .../jdt/groovy/search/SimpleTypeLookup.java | 2 +- .../TypeInferencingVisitorWithRequestor.java | 16 ++- .../jdt/groovy/search/TypeLookupResult.java | 112 ++++++++++++------ .../tests/CodeSelectMethodsTests.groovy | 12 +- .../requestor/CodeSelectRequestor.java | 22 ++-- .../dsl/pointcuts/GroovyDSLDContext.java | 4 +- 8 files changed, 103 insertions(+), 93 deletions(-) diff --git a/base-test/org.eclipse.jdt.groovy.core.tests.builder/src/org/eclipse/jdt/core/groovy/tests/search/GenericInferencingTests.java b/base-test/org.eclipse.jdt.groovy.core.tests.builder/src/org/eclipse/jdt/core/groovy/tests/search/GenericInferencingTests.java index 56c8c54ea1..1a94420916 100644 --- a/base-test/org.eclipse.jdt.groovy.core.tests.builder/src/org/eclipse/jdt/core/groovy/tests/search/GenericInferencingTests.java +++ b/base-test/org.eclipse.jdt.groovy.core.tests.builder/src/org/eclipse/jdt/core/groovy/tests/search/GenericInferencingTests.java @@ -427,6 +427,7 @@ public void testMap18() { String contents = "def xxx = ['item'].collectEntries {str -> /*...*/}\n"; + assertType(contents, "str", "java.lang.String"); assertType(contents, "xxx", "java.util.Map"); } diff --git a/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/GenericsMapper.java b/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/GenericsMapper.java index 2d9cd43bd3..0d0a237297 100644 --- a/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/GenericsMapper.java +++ b/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/GenericsMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2023 the original author or authors. + * Copyright 2009-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ import org.codehaus.groovy.ast.GenericsType; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.Parameter; -import org.codehaus.groovy.ast.tools.GenericsUtils; import org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -226,32 +225,12 @@ public static GenericsMapper gatherGenerics(final List argumentTypes, //-------------------------------------------------------------------------- /** Keeps track of all type parameterization up the type hierarchy. */ - private final Deque> allGenerics = new LinkedList<>(); + final Deque> allGenerics = new LinkedList<>(); protected boolean hasGenerics() { return !allGenerics.isEmpty() && !allGenerics.getLast().isEmpty(); } - protected GenericsMapper fillPlaceholders(final GenericsType[] typeParameters) { - for (Map.Entry name2Type : allGenerics.getLast().entrySet()) { - ClassNode type = name2Type.getValue(); if (type.isGenericsPlaceHolder()) { - for (GenericsType tp : typeParameters) { - if (type.getUnresolvedName().equals(tp.getName())) { // unresolved - // replace type parameter "T" with type "Number" or "Object" or whatever its erasure type is - type = type.hasMultiRedirect() ? type.asGenericsType().getUpperBounds()[0] : type.redirect(); - if (type.isGenericsPlaceHolder()) type = type.getSuperClass(); - // remove nested references to this or other type parameters - if (GenericsUtils.hasUnresolvedGenerics(type)) - type = type.getPlainNodeReference(); - name2Type.setValue(type); - break; - } - } - } - } - return this; - } - /** * Finds the type of a parameter name in the highest level of the type hierarchy currently analyzed. * @@ -357,7 +336,7 @@ protected static void saveParameterType(final Map map, final if (old != null && !old.equals(val) && !old.equals(VariableScope.OBJECT_CLASS_NODE) && weak) { val = /*WideningCategories.lowestUpperBound(*/old/*, val)*/; } - map.put(key, val); + map.put(key, GroovyUtils.getWrapperTypeIfPrimitive(val)); } protected static void tryResolveMethodT(final GenericsType unresolved, final Map resolved, final Parameter[] parameters, final List argumentTypes) { diff --git a/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/SimpleTypeLookup.java b/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/SimpleTypeLookup.java index fc446fd6c8..29e53e5604 100644 --- a/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/SimpleTypeLookup.java +++ b/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/SimpleTypeLookup.java @@ -251,7 +251,7 @@ protected TypeLookupResult findType(final Expression node, final ClassNode decla } else if (cexp.isEmptyStringExpression() || VariableScope.STRING_CLASS_NODE.equals(nodeType)) { return new TypeLookupResult(VariableScope.STRING_CLASS_NODE, null, node, confidence, scope); } else if (ClassHelper.isNumberType(nodeType) || VariableScope.BIG_DECIMAL_CLASS.equals(nodeType) || VariableScope.BIG_INTEGER_CLASS.equals(nodeType)) { - return new TypeLookupResult(GroovyUtils.getWrapperTypeIfPrimitive(nodeType), null, null, confidence, scope); + return new TypeLookupResult(nodeType, null, null, confidence, scope); } else { return new TypeLookupResult(nodeType, null, null, TypeConfidence.UNKNOWN, scope); } diff --git a/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/TypeInferencingVisitorWithRequestor.java b/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/TypeInferencingVisitorWithRequestor.java index d361dc54eb..0d3e9f6480 100644 --- a/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/TypeInferencingVisitorWithRequestor.java +++ b/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/TypeInferencingVisitorWithRequestor.java @@ -1994,7 +1994,7 @@ private void visitUnaryExpression(final Expression node, final Expression operan ClassNode operandType = primaryTypeStack.removeLast(); // infer the type of the (possibly overloaded) operator String associatedMethod = findUnaryOperatorName(operation); - if (associatedMethod != null && !operandType.isDerivedFrom(VariableScope.NUMBER_CLASS_NODE)) { + if (associatedMethod != null && !ClassHelper.getWrapper(operandType).isDerivedFrom(VariableScope.NUMBER_CLASS_NODE)) { scope.setMethodCallArgumentTypes(Collections.emptyList()); TypeLookupResult result = lookupExpressionType(GeneralUtils.constX(associatedMethod), operandType, false, scope); @@ -2442,7 +2442,7 @@ private List getMethodCallArgumentTypes(ASTNode node) { } else if (expression instanceof ConstantExpression && ((ConstantExpression) expression).isNullExpression()) { types.add(VariableScope.NULL_TYPE); // sentinel for wildcard matching } else if (ClassHelper.isNumberType(exprType) || VariableScope.BIG_DECIMAL_CLASS.equals(exprType) || VariableScope.BIG_INTEGER_CLASS.equals(exprType)) { - types.add(GroovyUtils.getWrapperTypeIfPrimitive(exprType)); + types.add(exprType); } else if (expression instanceof GStringExpression || (expression instanceof ConstantExpression && ((ConstantExpression) expression).isEmptyStringExpression())) { types.add(VariableScope.STRING_CLASS_NODE); } else if (expression instanceof BooleanExpression || (expression instanceof ConstantExpression && (((ConstantExpression) expression).isTrueExpression() || ((ConstantExpression) expression).isFalseExpression()))) { @@ -3219,7 +3219,7 @@ private static Parameter findTargetParameter(final Expression arg, final MethodC } /** - * @return the method name associated with this unary operator + * @return the method name associated with the unary operator */ private static String findUnaryOperatorName(final String text) { switch (text.charAt(0)) { @@ -3235,8 +3235,6 @@ private static String findUnaryOperatorName(final String text) { return "negative"; case '~': return "bitwiseNegate"; - case ']': - return "putAt"; } return null; } @@ -3561,10 +3559,10 @@ private static List membersOf(final IType type, final boolean isScript) return members; } - private static void resetType(final GenericsType gt, final ClassNode t) { - ClassNode type = ClassHelper.isPrimitiveType(t) ? ClassHelper.getWrapper(t) : t; - gt.setName(type.getName()); - gt.setType(type); + private static void resetType(final GenericsType g, final ClassNode c) { + ClassNode type = GroovyUtils.getWrapperTypeIfPrimitive(c); + g.setName(type.getName()); + g.setType(type); } //-------------------------------------------------------------------------- diff --git a/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/TypeLookupResult.java b/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/TypeLookupResult.java index e869f4f17e..86145608a9 100644 --- a/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/TypeLookupResult.java +++ b/base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/TypeLookupResult.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.function.BiFunction; import java.util.function.Predicate; import groovy.transform.stc.ClosureParams; @@ -34,6 +35,7 @@ import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.ConstructorNode; import org.codehaus.groovy.ast.FieldNode; +import org.codehaus.groovy.ast.GenericsType; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.Parameter; import org.codehaus.groovy.ast.PropertyNode; @@ -202,7 +204,43 @@ public TypeLookupResult resolveTypeParameterization(final ClassNode objExprType, ClassNode targetType = null; GenericsMapper mapper; - if (scope.getEnclosingNode() instanceof MethodPointerExpression) { + if (!(scope.getEnclosingNode() instanceof MethodPointerExpression)) { + if (scope.getMethodCallArgumentTypes() != null) argumentTypes.addAll(scope.getMethodCallArgumentTypes()); + mapper = GenericsMapper.gatherGenerics(argumentTypes, objectType, method, scope.getMethodCallGenericsTypes()); + method = VariableScope.resolveTypeParameterization(mapper, method); + + BiFunction finder = mapper::findParameter; + Predicate unresolved = (tp) -> (finder.apply(tp.getName(), null) == null); + + if (scope.getMethodCallGenericsTypes() == null && + Arrays.stream(GroovyUtils.getGenericsTypes(method)).anyMatch(unresolved)) { + if (testEnclosingAssignment(scope, rhs -> + (rhs instanceof StaticMethodCallExpression && rhs == scope.getCurrentNode()) || + (rhs instanceof MethodCallExpression && ((MethodCallExpression) rhs).getMethod() == scope.getCurrentNode()) + )) { + // maybe the assign target type can help resolve type parameters of method + targetType = scope.getEnclosingAssignment().getLeftExpression().getType(); + + GenericsMapper gm = GenericsMapper.gatherGenerics(singletonList(targetType), objectType, returnTypeStub(method)); + if (gm.hasGenerics()) { + for (GenericsType tp : method.getGenericsTypes()) { + if (unresolved.test(tp) && gm.findParameter(tp.getName(), null) != null) { + mapper.allGenerics.getLast().put(tp.getName(), gm.findParameter(tp.getName(), null)); + } + } + } + } + + // do not return method type parameters; "def T m()" returns Object if "T" unknown + for (GenericsType tp : method.getGenericsTypes()) { + if (unresolved.test(tp)) { + mapper.allGenerics.getLast().put(tp.getName(), erasure(tp)); + } + } + + method = VariableScope.resolveTypeParameterization(mapper, (MethodNode) declaration); + } + } else { // method pointer or reference if (!isStatic && !method.isStatic()) { // apply type arguments from the object expression to the referenced method mapper = GenericsMapper.gatherGenerics(argumentTypes, objectType, method); @@ -242,49 +280,34 @@ public TypeLookupResult resolveTypeParameterization(final ClassNode objExprType, mapper = GenericsMapper.gatherGenerics(singletonList(returnType), declaringType, returnTypeStub(method)); method = VariableScope.resolveTypeParameterization(mapper, method); - } else { - if (ClassHelper.isSAMType(targetType)) { - ClassNode[] pt = GenericsUtils.parameterizeSAM(targetType).getV1(); - if (isStatic && !method.isStatic()) { // GROOVY-10734, GROOVY-11259 - objectType = pt[0]; pt = Arrays.copyOfRange(pt, 1, pt.length); - } - // use parameter types of SAM as "argument types" for referenced method to help resolve type parameters - mapper = GenericsMapper.gatherGenerics(Arrays.asList(pt), objectType, method); - method = VariableScope.resolveTypeParameterization(mapper, method); - - mapper = GenericsMapper.gatherGenerics(targetType); - method = VariableScope.resolveTypeParameterization(mapper, method); + } else if (ClassHelper.isSAMType(targetType)) { + ClassNode[] pt = GenericsUtils.parameterizeSAM(targetType).getV1(); + if (isStatic && !method.isStatic()) { // GROOVY-10734, GROOVY-11259 + objectType = pt[0]; pt = Arrays.copyOfRange(pt, 1, pt.length); } + // use parameter types of SAM as "argument types" for referenced method to help resolve type parameters + mapper = GenericsMapper.gatherGenerics(Arrays.asList(pt), objectType, method); + method = VariableScope.resolveTypeParameterization(mapper, method); + + mapper = GenericsMapper.gatherGenerics(targetType); + method = VariableScope.resolveTypeParameterization(mapper, method); } } - } else { - if (scope.getMethodCallArgumentTypes() != null) argumentTypes.addAll(scope.getMethodCallArgumentTypes()); - mapper = GenericsMapper.gatherGenerics(argumentTypes, objectType, method, scope.getMethodCallGenericsTypes()); - method = VariableScope.resolveTypeParameterization(mapper, method); - if (scope.getMethodCallGenericsTypes() == null && GenericsUtils.hasUnresolvedGenerics(method.getReturnType()) && - (argumentTypes.size() == (isGroovy ? 1 : 0) || false/*return type placeholder(s) not in parameters*/) && - testEnclosingAssignment(scope, rhs -> - (rhs instanceof StaticMethodCallExpression && rhs == scope.getCurrentNode()) || - (rhs instanceof MethodCallExpression && ((MethodCallExpression) rhs).getMethod() == scope.getCurrentNode()) - )) { - // maybe the assign target type can help resolve type parameters of method - targetType = scope.getEnclosingAssignment().getLeftExpression().getType(); - - mapper = GenericsMapper.gatherGenerics(singletonList(targetType), declaringType, returnTypeStub(method)); - method = VariableScope.resolveTypeParameterization(mapper, method); + // do not return method type parameters; "def T m()" returns Object if "T" unknown + if (method.getGenericsTypes() != null && GenericsUtils.hasUnresolvedGenerics(method.getReturnType())) { + mapper = GenericsMapper.gatherGenerics(GroovyUtils.getParameterTypes(method.getParameters()), objectType, method); + for (GenericsType tp : method.getGenericsTypes()) { + if (mapper.findParameter(tp.getName(), null) == null) { + mapper.allGenerics.getLast().put(tp.getName(), erasure(tp)); + } + } + method = VariableScope.resolveTypeParameterization(mapper, (MethodNode) declaration); } } - ClassNode returnType = method.getReturnType(); - // do not return method type parameters; "def T m()" returns Object if "T" unknown - if (method.getGenericsTypes() != null && scope.getMethodCallGenericsTypes() == null && - GenericsUtils.hasUnresolvedGenerics(returnType) && (mapper = GenericsMapper.gatherGenerics(returnType)).hasGenerics()) { - returnType = VariableScope.resolveTypeParameterization(mapper.fillPlaceholders(method.getGenericsTypes()), VariableScope.clone(returnType.redirect())); - } - - if (method != declaration || returnType != method.getReturnType()) { - return new TypeLookupResult(returnType, declaringType, method, this); + if (method != declaration) { + return new TypeLookupResult(method.getReturnType(), declaringType, method, this); } } } @@ -293,6 +316,21 @@ public TypeLookupResult resolveTypeParameterization(final ClassNode objExprType, //-------------------------------------------------------------------------- + private static ClassNode erasure(GenericsType tp) { + ClassNode cn = tp.getType().redirect(); + if (tp.getType().getGenericsTypes() != null) { + tp = tp.getType().getGenericsTypes()[0]; + } + if (tp.getUpperBounds() != null) { + cn = tp.getUpperBounds()[0]; + } + if (GenericsUtils.hasUnresolvedGenerics(cn)) { + // deal with T extends Comparable + cn = cn.getPlainNodeReference(); + } + return cn; + } + private static MethodNode returnTypeStub(final MethodNode node) { MethodNode stub = new MethodNode("", 0, VariableScope.VOID_CLASS_NODE, new Parameter[] {new Parameter(node.getReturnType(), "")}, null, null); stub.setDeclaringClass(node.getDeclaringClass()); diff --git a/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectMethodsTests.groovy b/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectMethodsTests.groovy index 287fde75c0..8089de04d2 100644 --- a/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectMethodsTests.groovy +++ b/ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectMethodsTests.groovy @@ -214,7 +214,7 @@ final class CodeSelectMethodsTests extends BrowsingTestSuite { assert element.key == 'Ljava/util/Set;.add(TBar;)Z' element = assertCodeSelect([contents], 'findAll') - assert element.key == 'Lorg/codehaus/groovy/runtime/DefaultGroovyMethods;.findAll(Ljava/util/Set;)Ljava/util/Set;%' + assert element.key == 'Lorg/codehaus/groovy/runtime/DefaultGroovyMethods;.findAll(Ljava/util/Set;)Ljava/util/Set;' } @Test @@ -514,7 +514,7 @@ final class CodeSelectMethodsTests extends BrowsingTestSuite { assertCodeSelect([contents], 'Collections') IJavaElement element = assertCodeSelect([contents], 'emptyList') assert element.inferredElement.returnType.toString(false) == 'java.util.List' - assert element.key == 'Ljava/util/Collections;.emptyList()Ljava/util/List;%' + assert element.key == 'Ljava/util/Collections;.emptyList()Ljava/util/List;' } @Test @@ -522,7 +522,7 @@ final class CodeSelectMethodsTests extends BrowsingTestSuite { String contents = 'java.util.function.Supplier getter = Collections.&emptyList' IJavaElement element = assertCodeSelect([contents], 'emptyList') assert element.inferredElement.returnType.toString(false) == 'java.util.List' - assert element.key == 'Ljava/util/Collections;.emptyList()Ljava/util/List;%' + assert element.key == 'Ljava/util/Collections;.emptyList()Ljava/util/List;' } @Test // https://github.com/groovy/groovy-eclipse/issues/1595 @@ -532,8 +532,8 @@ final class CodeSelectMethodsTests extends BrowsingTestSuite { | def list = Collections.emptyList() |}'''.stripMargin() IJavaElement element = assertCodeSelect([contents], 'emptyList') - assert element.inferredElement.returnType.toString(false) == 'java.util.List' // TODO: want T to be java.lang.Object - assert element.key == 'Ljava/util/Collections;.emptyList()Ljava/util/List;%' + assert element.inferredElement.returnType.toString(false) == 'java.util.List' + assert element.key == 'Ljava/util/Collections;.emptyList()Ljava/util/List;' } @Test @@ -548,7 +548,7 @@ final class CodeSelectMethodsTests extends BrowsingTestSuite { |}'''.stripMargin() IJavaElement element = assertCodeSelect([contents], 'singletonList') assert element.inferredElement.returnType.toString(false) == 'java.util.List' - assert element.key == 'Ljava/util/Collections;.singletonList(Ljava/lang/String;)Ljava/util/List;%' + assert element.key == 'Ljava/util/Collections;.singletonList(Ljava/lang/String;)Ljava/util/List;' } @Test diff --git a/ide/org.codehaus.groovy.eclipse.codebrowsing/src/org/codehaus/groovy/eclipse/codebrowsing/requestor/CodeSelectRequestor.java b/ide/org.codehaus.groovy.eclipse.codebrowsing/src/org/codehaus/groovy/eclipse/codebrowsing/requestor/CodeSelectRequestor.java index 2478109d1a..030a19549e 100644 --- a/ide/org.codehaus.groovy.eclipse.codebrowsing/src/org/codehaus/groovy/eclipse/codebrowsing/requestor/CodeSelectRequestor.java +++ b/ide/org.codehaus.groovy.eclipse.codebrowsing/src/org/codehaus/groovy/eclipse/codebrowsing/requestor/CodeSelectRequestor.java @@ -70,10 +70,8 @@ import org.eclipse.jdt.core.Signature; import org.eclipse.jdt.groovy.core.util.GroovyUtils; import org.eclipse.jdt.groovy.search.AccessorSupport; -import org.eclipse.jdt.groovy.search.GenericsMapper; import org.eclipse.jdt.groovy.search.ITypeRequestor; import org.eclipse.jdt.groovy.search.TypeLookupResult; -import org.eclipse.jdt.groovy.search.VariableScope; import org.eclipse.jdt.internal.core.BinaryType; import org.eclipse.jdt.internal.core.JavaElement; import org.eclipse.jdt.internal.core.LocalVariable; @@ -698,7 +696,7 @@ private static void appendUniqueKeyForMethod(final StringBuilder sb, final Metho GroovyUtils.getTypeSignature(type, true, true).replace('.', '/').replaceAll("L[/\\w]+;:(T\\w+;)", "$1"); // omit type parameter qualifiers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - // type parameters + /* type parameters GenericsType[] generics = GroovyUtils.getGenericsTypes(node); if (generics.length > 0) { sb.append(Signature.C_GENERIC_START); @@ -717,7 +715,7 @@ private static void appendUniqueKeyForMethod(final StringBuilder sb, final Metho } } sb.append(Signature.C_GENERIC_END); - } + }*/ // call parameters sb.append(Signature.C_PARAM_START); @@ -730,20 +728,14 @@ private static void appendUniqueKeyForMethod(final StringBuilder sb, final Metho // return type sb.append(signer.apply(returnType)); - // type parameter resolution + /* type parameter resolution if (generics.length > 0) { - // generics have been resolved for returnType, declaringType and parameterTypes; mappings can be recovered using original method reference - GenericsMapper mapper = GenericsMapper.gatherGenerics(GroovyUtils.getParameterTypes(parameters), declaringType, node.getOriginal()); - - sb.append('%'); - sb.append(Signature.C_GENERIC_START); - for (GenericsType gt : generics) { - gt = VariableScope.clone(gt, 0); - ClassNode rt = VariableScope.resolveTypeParameterization(mapper, gt, gt.getType()); - sb.append(GroovyUtils.getTypeSignatureWithoutGenerics(rt, true, true).replace('.', '/')); + sb.append('%').append(Signature.C_GENERIC_START); + for (TODO : TODO) { + sb.append(GroovyUtils.getTypeSignature(TODO, true, true).replace('.', '/')); } sb.append(Signature.C_GENERIC_END); - } + }*/ // exceptions if (node.getExceptions() != null) { diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/GroovyDSLDContext.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/GroovyDSLDContext.java index 90453b695c..98729f7858 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/GroovyDSLDContext.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/GroovyDSLDContext.java @@ -15,6 +15,8 @@ */ package org.codehaus.groovy.eclipse.dsl.pointcuts; +import static org.eclipse.jdt.groovy.core.util.GroovyUtils.getWrapperTypeIfPrimitive; + import java.util.Collection; import java.util.LinkedHashSet; import java.util.Map; @@ -260,7 +262,7 @@ public void setTargetType(ClassNode targetType) { targetType = targetType.getGenericsTypes()[0].getType(); this.isStatic = true; // not a Class instance anymore } - this.targetType = targetType; + this.targetType = getWrapperTypeIfPrimitive(targetType); cachedHierarchy = null; }