From 224f972cc5afac166519985483e77fa2382a543c Mon Sep 17 00:00:00 2001 From: Dusan Balek Date: Mon, 22 Apr 2024 13:17:05 +0200 Subject: [PATCH] Micronaut: Method parameters should be resolvable in expression language. --- enterprise/micronaut/nbproject/project.xml | 2 +- .../micronaut/MicronautConfigUtilities.java | 2 +- .../MicronautDataCompletionCollector.java | 8 ++ .../MicronautDataCompletionProvider.java | 12 +++ ...MicronautExpressionLanguageCompletion.java | 35 +++++--- .../expression/EvaluationContext.java | 12 ++- .../micronaut/expression/ExpressionTree.java | 88 +++++++++++-------- java/java.lsp.server/vscode/src/extension.ts | 2 +- .../nbproject/project.properties | 2 +- .../api/java/source/ElementHandle.java | 41 ++++++++- .../api/java/source/ui/ElementOpen.java | 5 ++ 11 files changed, 152 insertions(+), 57 deletions(-) diff --git a/enterprise/micronaut/nbproject/project.xml b/enterprise/micronaut/nbproject/project.xml index 4454124894e4..9021e675fefb 100644 --- a/enterprise/micronaut/nbproject/project.xml +++ b/enterprise/micronaut/nbproject/project.xml @@ -273,7 +273,7 @@ - 2.49 + 2.68 diff --git a/enterprise/micronaut/src/org/netbeans/modules/micronaut/MicronautConfigUtilities.java b/enterprise/micronaut/src/org/netbeans/modules/micronaut/MicronautConfigUtilities.java index 7617172bbbb0..029b05829c83 100644 --- a/enterprise/micronaut/src/org/netbeans/modules/micronaut/MicronautConfigUtilities.java +++ b/enterprise/micronaut/src/org/netbeans/modules/micronaut/MicronautConfigUtilities.java @@ -69,7 +69,7 @@ */ public class MicronautConfigUtilities { - private static final Pattern REGEXP = Pattern.compile("^(application|bootstrap)(-\\w*)*\\.(yml|properties)$", Pattern.CASE_INSENSITIVE); + private static final Pattern REGEXP = Pattern.compile("^(application|bootstrap)(-\\w*)*\\.(yml|yaml|properties)$", Pattern.CASE_INSENSITIVE); public static final String YAML_MIME = "text/x-yaml"; public static final String PROPERTIES_MIME = "text/x-properties"; diff --git a/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionCollector.java b/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionCollector.java index 008d1f99ebde..72b27b956a9d 100644 --- a/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionCollector.java +++ b/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionCollector.java @@ -309,6 +309,14 @@ public Completion createJavaElementItem(CompilationInfo info, Element element, i } Builder builder = CompletionCollector.newBuilder(simpleName); switch (element.getKind()) { + case PARAMETER: + builder.kind(Completion.Kind.Variable).sortText(String.format("%04d%s", 90, simpleName)) + .labelDescription(Utils.getTypeName(info, element.asType(), false, false).toString()); + break; + case RECORD_COMPONENT: + builder.kind(Completion.Kind.Field).sortText(String.format("%04d%s", 90, simpleName)) + .labelDescription(Utils.getTypeName(info, element.asType(), false, false).toString()); + break; case ENUM: builder.kind(Completion.Kind.Enum).sortText(String.format("%04d%s", 300, simpleName)); break; diff --git a/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionProvider.java b/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionProvider.java index 60e76472f36a..aa61fa5beb83 100644 --- a/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionProvider.java +++ b/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionProvider.java @@ -107,12 +107,16 @@ private static class MicronautDataCompletionQuery extends AsyncCompletionQuery { private static final String RECORD_ICON = "org/netbeans/modules/editor/resources/completion/record.png"; private static final String METHOD_PUBLIC = "org/netbeans/modules/editor/resources/completion/method_16.png"; //NOI18N private static final String METHOD_ST_PUBLIC = "org/netbeans/modules/editor/resources/completion/method_static_16.png"; + private static final String FIELD_PUBLIC = "org/netbeans/modules/editor/resources/completion/field_16.png"; //NOI18N + private static final String LOCAL_VARIABLE = "org/netbeans/modules/editor/resources/completion/localVariable.gif"; //NOI18N private static final String ATTRIBUTE_VALUE = "org/netbeans/modules/java/editor/resources/attribute_value_16.png"; // NOI18N private static final String PROPERTY = "org/netbeans/modules/beans/resources/propertyRO.gif"; private static final String KEYWORD_COLOR = getHTMLColor(64, 64, 217); private static final String PACKAGE_COLOR = getHTMLColor(64, 150, 64); private static final String CLASS_COLOR = getHTMLColor(150, 64, 64); private static final String INTERFACE_COLOR = getHTMLColor(128, 128, 128); + private static final String FIELD_COLOR = getHTMLColor(64, 198, 88); + private static final String PARAMETER_COLOR = getHTMLColor(64, 64, 188); private static final String PARAMETERS_COLOR = getHTMLColor(192, 192, 192); private static final String PARAMETER_NAME_COLOR = getHTMLColor(224, 160, 65); private static final String ATTRIBUTE_VALUE_COLOR = getHTMLColor(128, 128, 128); @@ -496,6 +500,14 @@ public CompletionItem createJavaElementItem(CompilationInfo info, Element elemen } CompletionUtilities.CompletionItemBuilder builder = CompletionUtilities.newCompletionItemBuilder(simpleName).startOffset(offset); switch (element.getKind()) { + case PARAMETER: + builder.iconResource(LOCAL_VARIABLE).leftHtmlText(PARAMETER_COLOR + simpleName + COLOR_END).sortPriority(90) + .rightHtmlText(Utils.getTypeName(info, element.asType(), false, false).toString()); + break; + case RECORD_COMPONENT: + builder.iconResource(FIELD_PUBLIC).leftHtmlText(FIELD_COLOR + simpleName + COLOR_END).sortPriority(90) + .rightHtmlText(Utils.getTypeName(info, element.asType(), false, false).toString()); + break; case ENUM: builder.iconResource(ENUM_ICON).leftHtmlText(CLASS_COLOR + simpleName + COLOR_END).sortPriority(300); break; diff --git a/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageCompletion.java b/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageCompletion.java index 4fb2b2da6b04..c7e69ad7a8b4 100644 --- a/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageCompletion.java +++ b/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautExpressionLanguageCompletion.java @@ -88,7 +88,7 @@ public Result query(int offset, ItemFactory factory) { if (tree == null) { kws = ctx.getScope().getEnclosingMethod() != null ? Arrays.asList("true", "false", "null", "this", "empty", "not") : Arrays.asList("true", "false", "null", "empty", "not"); builtins = Arrays.asList("T", "()", "ctx", "[]", "env", "[]"); - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); anchorOffset = startOffset + offset; } else { String tokenText = ts.token().text().subSequence(0, offset - ts.offset()).toString().trim(); @@ -105,7 +105,7 @@ public Result query(int offset, ItemFactory factory) { if (offset <= tree.getStartPosition()) { kws = ctx.getScope().getEnclosingMethod() != null ? Arrays.asList("true", "false", "null", "this", "empty", "not") : Arrays.asList("true", "false", "null", "empty", "not"); builtins = Arrays.asList("T", "()", "ctx", "[]", "env", "[]"); - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); } else { ExpressionTree lastTree = tree; if (tree.getKind() == ExpressionTree.Kind.ERRONEOUS) { @@ -149,7 +149,7 @@ public Result query(int offset, ItemFactory factory) { case NONE: String prev = prevNonWSTokenText(prefix); if ("#".equals(prev)) { - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); } break; } @@ -214,7 +214,7 @@ public Result query(int offset, ItemFactory factory) { kws = Arrays.asList("this"); } builtins = Arrays.asList("T", "()", "ctx", "[]", "env", "[]"); - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); } break; case EQUAL_TO: @@ -225,7 +225,7 @@ public Result query(int offset, ItemFactory factory) { } else { kws = ctx.getScope().getEnclosingMethod() != null ? Arrays.asList("null", "this"): Arrays.asList("null"); builtins = Arrays.asList("T", "()", "ctx", "[]", "env", "[]"); - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); } break; case AND: @@ -238,11 +238,11 @@ public Result query(int offset, ItemFactory factory) { case NOT: kws = ctx.getScope().getEnclosingMethod() != null ? Arrays.asList("true", "false", "not", "empty", "this"): Arrays.asList("true", "false", "not", "empty"); builtins = Arrays.asList("T", "()", "ctx", "[]", "env", "[]"); - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); break; case EMPTY: builtins = Arrays.asList("T", "()", "ctx", "[]", "env", "[]"); - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); break; case INSTANCE_OF: ExpressionTree.InstanceOf instanceOf = (ExpressionTree.InstanceOf) path.getLeaf(); @@ -262,7 +262,7 @@ public Result query(int offset, ItemFactory factory) { if ("?". equals(prev) || ":".equals(prev)) { kws = ctx.getScope().getEnclosingMethod() != null ? Arrays.asList("true", "false", "null", "this", "empty", "not") : Arrays.asList("true", "false", "null", "empty", "not"); builtins = Arrays.asList("T", "()", "ctx", "[]", "env", "[]"); - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); } } break; @@ -274,12 +274,12 @@ public Result query(int offset, ItemFactory factory) { if (callee != null) { TypeMirror pacTM = callee.getTypeMirror(ctx); if (pacTM.getKind() == TypeKind.DECLARED) { - elements = ElementFilter.methodsIn(((DeclaredType) pacTM).asElement().getEnclosedElements()).stream() + elements = ((DeclaredType) pacTM).asElement().getEnclosedElements().stream() .filter(ee -> callee.getKind() != ExpressionTree.Kind.TYPE_REFERENCE || ee.getModifiers().contains(Modifier.STATIC)) .collect(Collectors.toList()); } } else { - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); } } break; @@ -296,12 +296,12 @@ public Result query(int offset, ItemFactory factory) { .collect(Collectors.toList()); } } else { - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); } } else if ("(".equals(prev) || ",".equals(prev)) { kws = ctx.getScope().getEnclosingMethod() != null ? Arrays.asList("true", "false", "null", "this", "empty", "not") : Arrays.asList("true", "false", "null", "empty", "not"); builtins = Arrays.asList("T", "()", "ctx", "[]", "env", "[]"); - elements = ctx.getContextMethods(); + elements = ctx.getContextElements(); } break; } @@ -381,7 +381,16 @@ public Result query(int offset, ItemFactory factory) { items.add(factory.createBeanPropertyItem(propertyName, returnType, anchorOffset)); } } - } else { + } else if (element.getKind() == ElementKind.RECORD_COMPONENT) { + TypeMirror enclType = element.getEnclosingElement().asType(); + if (enclType.getKind() == TypeKind.DECLARED && Utils.startsWith(name, prefix) && info.getTrees().isAccessible(ctx.getScope(), element, (DeclaredType) enclType)) { + items.add(factory.createJavaElementItem(info, element, anchorOffset)); + } + } else if (element.getKind() == ElementKind.PARAMETER) { + if (Utils.startsWith(name, prefix)) { + items.add(factory.createJavaElementItem(info, element, anchorOffset)); + } + } else if (element.getKind().isClass() || element.getKind().isInterface()) { if (Utils.startsWith(name, prefix) && info.getTrees().isAccessible(ctx.getScope(), (TypeElement) element)) { items.add(factory.createJavaElementItem(info, element, anchorOffset)); } diff --git a/enterprise/micronaut/src/org/netbeans/modules/micronaut/expression/EvaluationContext.java b/enterprise/micronaut/src/org/netbeans/modules/micronaut/expression/EvaluationContext.java index d9f659f618b6..17872cb31a9b 100644 --- a/enterprise/micronaut/src/org/netbeans/modules/micronaut/expression/EvaluationContext.java +++ b/enterprise/micronaut/src/org/netbeans/modules/micronaut/expression/EvaluationContext.java @@ -107,15 +107,19 @@ public Scope getScope() { return scope; } - public List getContextMethods() { + public List getContextElements() { if (contextClasses == null) { initializeContextClasses(); } - List methods = new ArrayList<>(); + List elements = new ArrayList<>(); for (TypeElement contextClass : contextClasses) { - methods.addAll(ElementFilter.methodsIn(contextClass.getEnclosedElements())); + elements.addAll(ElementFilter.methodsIn(contextClass.getEnclosedElements())); } - return methods; + ExecutableElement enclosingMethod = scope.getEnclosingMethod(); + if (enclosingMethod != null && !enclosingMethod.getParameters().isEmpty()) { + elements.addAll(enclosingMethod.getParameters()); + } + return elements; } private void initializeContextClasses() { diff --git a/enterprise/micronaut/src/org/netbeans/modules/micronaut/expression/ExpressionTree.java b/enterprise/micronaut/src/org/netbeans/modules/micronaut/expression/ExpressionTree.java index 6e62b91f2126..e00189ba5cf5 100644 --- a/enterprise/micronaut/src/org/netbeans/modules/micronaut/expression/ExpressionTree.java +++ b/enterprise/micronaut/src/org/netbeans/modules/micronaut/expression/ExpressionTree.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.stream.Collectors; import javax.lang.model.element.Element; +import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; @@ -564,42 +565,44 @@ public R accept(Scanner scanner, D data) { @Override protected void resolve(EvaluationContext ctx) { - List methods = null; + List elements = null; DeclaredType dt = null; if (callee == null) { - methods = ctx.getContextMethods(); + elements = ctx.getContextElements(); } else { TypeMirror calleeTM = callee.getTypeMirror(ctx); if (calleeTM.getKind() == TypeKind.DECLARED) { dt = (DeclaredType) calleeTM; - methods = ElementFilter.methodsIn(((TypeElement) dt.asElement()).getEnclosedElements()); + elements = ElementFilter.methodsIn(((TypeElement) dt.asElement()).getEnclosedElements()); } } - if (methods != null && !methods.isEmpty()) { + if (elements != null && !elements.isEmpty()) { List argTypes = arguments.stream().map(arg -> arg.getTypeMirror(ctx)).collect(Collectors.toList()); - for (ExecutableElement ee : methods) { - TypeMirror enclType = dt != null ? dt : ee.getEnclosingElement().asType(); - if (enclType.getKind() == TypeKind.DECLARED && identifier.contentEquals(ee.getSimpleName()) && ctx.getTrees().isAccessible(ctx.getScope(), ee, (DeclaredType) enclType)) { - ExecutableType et = (ExecutableType) ctx.getTypes().asMemberOf((DeclaredType) enclType, ee); - List paramTypes = et.getParameterTypes(); - if (ee.isVarArgs() && argTypes.size() >= paramTypes.size() || argTypes.size() == paramTypes.size()) { - boolean match = true; - Iterator paramsIt = paramTypes.iterator(); - TypeMirror param = paramsIt.hasNext() ? paramsIt.next() : null; - for (Iterator argsIt = argTypes.iterator(); match && argsIt.hasNext();) { - TypeMirror arg = argsIt.next(); - if (!ctx.getTypes().isAssignable(arg, param)) { - match = false; + for (Element e : elements) { + if (e.getKind() == ElementKind.METHOD) { + TypeMirror enclType = dt != null ? dt : e.getEnclosingElement().asType(); + if (enclType.getKind() == TypeKind.DECLARED && identifier.contentEquals(e.getSimpleName()) && ctx.getTrees().isAccessible(ctx.getScope(), e, (DeclaredType) enclType)) { + ExecutableType et = (ExecutableType) ctx.getTypes().asMemberOf((DeclaredType) enclType, e); + List paramTypes = et.getParameterTypes(); + if (((ExecutableElement) e).isVarArgs() && argTypes.size() >= paramTypes.size() || argTypes.size() == paramTypes.size()) { + boolean match = true; + Iterator paramsIt = paramTypes.iterator(); + TypeMirror param = paramsIt.hasNext() ? paramsIt.next() : null; + for (Iterator argsIt = argTypes.iterator(); match && argsIt.hasNext();) { + TypeMirror arg = argsIt.next(); + if (!ctx.getTypes().isAssignable(arg, param)) { + match = false; + } + if (paramsIt.hasNext()) { + param = paramsIt.next(); + } } - if (paramsIt.hasNext()) { - param = paramsIt.next(); + if (match) { + element = e; + typeMirror = et.getReturnType(); + return; } } - if (match) { - element = ee; - typeMirror = et.getReturnType(); - return; - } } } } @@ -656,25 +659,40 @@ public R accept(Scanner scanner, D data) { @Override protected void resolve(EvaluationContext ctx) { - List methods = null; + List elements = null; DeclaredType dt = null; if (callee == null) { - methods = ctx.getContextMethods(); + elements = ctx.getContextElements(); } else { TypeMirror calleeTM = callee.getTypeMirror(ctx); if (calleeTM.getKind() == TypeKind.DECLARED) { dt = (DeclaredType) calleeTM; - methods = ElementFilter.methodsIn(((TypeElement) dt.asElement()).getEnclosedElements()); + elements = ((TypeElement) dt.asElement()).getEnclosedElements(); } } - if (methods != null && !methods.isEmpty()) { - for (ExecutableElement ee : methods) { - TypeMirror enclType = dt != null ? dt : ee.getEnclosingElement().asType(); - if (enclType.getKind() == TypeKind.DECLARED && identifier.equals(getPropertyName(ee)) && ctx.getTrees().isAccessible(ctx.getScope(), ee, (DeclaredType) enclType)) { - ExecutableType et = (ExecutableType) ctx.getTypes().asMemberOf((DeclaredType) enclType, ee); - element = ee; - typeMirror = et.getReturnType(); - return; + if (elements != null && !elements.isEmpty()) { + for (Element e : elements) { + if (e.getKind() == ElementKind.METHOD) { + TypeMirror enclType = dt != null ? dt : e.getEnclosingElement().asType(); + if (enclType.getKind() == TypeKind.DECLARED && identifier.equals(getPropertyName((ExecutableElement) e)) && ctx.getTrees().isAccessible(ctx.getScope(), e, (DeclaredType) enclType)) { + ExecutableType et = (ExecutableType) ctx.getTypes().asMemberOf((DeclaredType) enclType, e); + element = e; + typeMirror = et.getReturnType(); + return; + } + } else if (e.getKind() == ElementKind.RECORD_COMPONENT) { + TypeMirror enclType = dt != null ? dt : e.getEnclosingElement().asType(); + if (enclType.getKind() == TypeKind.DECLARED && identifier.contentEquals(e.getSimpleName()) && ctx.getTrees().isAccessible(ctx.getScope(), e, (DeclaredType) enclType)) { + element = e; + typeMirror = e.asType(); + return; + } + } else if (e.getKind() == ElementKind.PARAMETER) { + if (identifier.contentEquals(e.getSimpleName())) { + element = e; + typeMirror = e.asType(); + return; + } } } } diff --git a/java/java.lsp.server/vscode/src/extension.ts b/java/java.lsp.server/vscode/src/extension.ts index e0cf43fdd386..1e78564c0bca 100644 --- a/java/java.lsp.server/vscode/src/extension.ts +++ b/java/java.lsp.server/vscode/src/extension.ts @@ -1036,7 +1036,7 @@ function doActivateWithJDK(specifiedJDK: string | null, context: ExtensionContex const conf = workspace.getConfiguration(); let documentSelectors : DocumentSelector = [ { language: 'java' }, - { language: 'yaml', pattern: '**/{application,bootstrap}*.yml' }, + { language: 'yaml', pattern: '**/{application,bootstrap}*.{yml,yaml}' }, { language: 'properties', pattern: '**/{application,bootstrap}*.properties' }, { language: 'jackpot-hint' }, { language: 'xml', pattern: '**/pom.xml' }, diff --git a/java/java.source.base/nbproject/project.properties b/java/java.source.base/nbproject/project.properties index 68928c3b4e17..170637154fce 100644 --- a/java/java.source.base/nbproject/project.properties +++ b/java/java.source.base/nbproject/project.properties @@ -23,7 +23,7 @@ javadoc.name=Java Source Base javadoc.title=Java Source Base javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml -spec.version.base=2.67.0 +spec.version.base=2.68.0 test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/nb-javac-api.jar test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\ ${o.n.core.dir}/lib/boot.jar:\ diff --git a/java/java.source.base/src/org/netbeans/api/java/source/ElementHandle.java b/java/java.source.base/src/org/netbeans/api/java/source/ElementHandle.java index 1a31fb4dfbec..c17c623259a9 100644 --- a/java/java.source.base/src/org/netbeans/api/java/source/ElementHandle.java +++ b/java/java.source.base/src/org/netbeans/api/java/source/ElementHandle.java @@ -24,7 +24,6 @@ import com.sun.tools.javac.code.Symbol; import com.sun.tools.javac.code.Symtab; import com.sun.tools.javac.jvm.Target; -import com.sun.tools.javac.model.JavacElements; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.util.Name; import java.util.Arrays; @@ -234,6 +233,31 @@ private T resolveImpl (final ModuleElement module, final JavacTaskImpl jt) { log.log(Level.INFO, "Resolved type is null for kind = {0}", this.kind); // NOI18N break; } + case PARAMETER: + { + assert signatures.length == 3; + final Element type = getTypeElementByBinaryName (module, signatures[0], jt); + if (type instanceof TypeElement) { + final List members = type.getEnclosedElements(); + for (Element member : members) { + if (member.getKind() == ElementKind.METHOD || member.getKind() == ElementKind.CONSTRUCTOR) { + String[] desc = ClassFileUtil.createExecutableDescriptor((ExecutableElement)member); + assert desc.length == 3; + if (this.signatures[1].equals(desc[1]) && this.signatures[2].equals(desc[2])) { + assert member instanceof ExecutableElement; + List ves =((ExecutableElement)member).getParameters(); + for (VariableElement ve : ves) { + if (ve.getSimpleName().contentEquals(signatures[3])) { + return (T) ve; + } + } + } + } + } + } else + log.log(Level.INFO, "Resolved type is null for kind = {0} signatures.length = {1}", new Object[] {this.kind, signatures.length}); // NOI18N + break; + } case TYPE_PARAMETER: { if (signatures.length == 2) { @@ -496,6 +520,21 @@ public static ElementHandle createModuleElementHandle( assert element instanceof VariableElement; signatures = ClassFileUtil.createFieldDescriptor((VariableElement)element); break; + case PARAMETER: + assert element instanceof VariableElement; + Element ee = element.getEnclosingElement(); + ElementKind eek = ee.getKind(); + if (eek == ElementKind.METHOD || eek == ElementKind.CONSTRUCTOR) { + assert ee instanceof ExecutableElement; + String[] _sigs = ClassFileUtil.createExecutableDescriptor((ExecutableElement)ee); + signatures = new String[_sigs.length + 1]; + System.arraycopy(_sigs, 0, signatures, 0, _sigs.length); + signatures[_sigs.length] = element.getSimpleName().toString(); + } + else { + throw new IllegalArgumentException(eek.toString()); + } + break; case TYPE_PARAMETER: assert element instanceof TypeParameterElement; TypeParameterElement tpe = (TypeParameterElement) element; diff --git a/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementOpen.java b/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementOpen.java index 3248b4b11d5b..0465ac2d66a1 100644 --- a/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementOpen.java +++ b/java/java.sourceui/src/org/netbeans/api/java/source/ui/ElementOpen.java @@ -551,6 +551,11 @@ private static void getOffset(final FileObject fo, final ElementHandle