JaroslavTulach commented on a change in pull request #3047: URL: https://github.com/apache/netbeans/pull/3047#discussion_r668755362
########## File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/files/OpenedDocuments.java ########## @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.netbeans.modules.java.lsp.server.files; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Consumer; +import javax.swing.text.Document; + +/** + * Gathers documents opened by the LSP client. + * + * @author Martin Entlicher + */ +public final class OpenedDocuments { Review comment: There is an implicit `public` constructor and I don't think it should be there. ########## File path: ide/nativeimage.api/src/org/netbeans/modules/nativeimage/api/Symbol.java ########## @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.netbeans.modules.nativeimage.api; + +/** + * A symbol in the debuggee program. + * + * @since 0.2 + */ +public final class Symbol { + + private final String name; + private final String type; + private final String description; + + private Symbol(String name, String type, String description) { + this.name = name; + this.type = type; + this.description = description; + } + + /** + * Get the symbol name. Never <code>null<code>. + * + * @since 0.2 + */ + public String getName() { + return name; + } + + /** + * Get the symbol type. + * + * @since 0.2 + */ + public String getType() { + return type; + } + + /** + * Get the symbol description. + * + * @since 0.2 + */ + public String getDescription() { + return description; + } + + /** + * Creates a builder to build a new {@link Symbol}. + * + * @since 0.2 + */ + public static Builder newBuilder() { + return new Builder(); + } + + @Override + public String toString() { + return "Symbol{" + "name=" + name + ", type=" + type + ", description=" + description + '}'; + } + + /** + * Symbol's builder. + * + * @since 0.2 + */ + public static final class Builder { Review comment: Usage of builders seems fine. ########## File path: ide/nativeimage.api/src/org/netbeans/modules/nativeimage/api/Location.java ########## @@ -0,0 +1,140 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.netbeans.modules.nativeimage.api; + +/** + * A location in the debuggee program. + * + * @since 0.2 + */ +public final class Location { + + private final long pc; + private final int line; + private final int column; + + private Location(long pc, int line, int column) { + this.pc = pc; + this.line = line; + this.column = column; + } + + /** + * Get the program counter position. + * + * @since 0.2 + */ + public long getPc() { Review comment: `getPC`? ########## File path: ide/nativeimage.api/src/org/netbeans/modules/nativeimage/spi/debug/NIDebuggerProvider.java ########## @@ -120,4 +124,24 @@ * @since 1.0 */ String getVersion(); + + /** + * Provide a list of locations for a given file path. + * + * @param filePath a file path + * @return list of locations, or <code>null</code> when there's no location + * information about such file. + * @since 0.2 + */ + default List<Location> listLocations(String filePath) { Review comment: Consider adding subinterface `SymbolProvider extends Provider` ########## File path: ide/nativeimage.api/src/org/netbeans/modules/nativeimage/api/debug/NIDebugger.java ########## @@ -165,6 +170,49 @@ public String getVersion() { return provider.getVersion(); } + /** + * Get a list of locations for a given file path. + * + * @param filePath a file path + * @return list of locations, or <code>null</code> when there's no location + * information about such file. + * @since 0.2 + */ + @CheckForNull + public List<Location> listLocations(String filePath) { + return provider.listLocations(filePath); + } + + /** + * Get a list of functions of a given name. + * + * @param name a name pattern + * @param includeNondebug include also symbols from the symbol table + * @param maxResults maximum number of results + * @return list of source information and their symbols, or <code>null</code> + * when there are no matching symbols. + * @since 0.2 + */ + @CheckForNull + public List<Pair<SourceInfo, List<Symbol>>> listFunctions(String name, boolean includeNondebug, int maxResults) { Review comment: What's the difference between `name` and `filePath` at line 176? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
