Skip to main content

Posts

Showing posts with the label extends

Extending Protocol Buffers in Java

I'm having trouble accessing extended protocol buffer members. Here is the scenario: Message Foo { optional int i = 1; } message Bar { extend Foo { optional int j = 10001; } } I don't have the Bar message within any of my other protos. How can I get Bar.j in Java? All examples I've found require a Bar within a message. Thanks!

Error while working with List<? extends DefaultMutableTreeNodel>

public void findClassNodesMatching(String lowerCaseSearchText, List<? extends DefaultMutableTreeNode> foundNodes) { findClassNodesMatching(lowerCaseSearchText, (DefaultMutableTreeNode) getRoot(), foundNodes); } private void findClassNodesMatching(String lowerCaseSearchText, DefaultMutableTreeNode node, List<? extends DefaultMutableTreeNode> foundNodes) { String nodeLabel = node.toString().toLowerCase(); if (nodeLabel.indexOf(lowerCaseSearchText) >= 0) { foundNodes.add(node); } } Why does this code give an error The method add(capture#2-of ? extends DefaultMutableTreeNode) in the type List is not applicable for the arguments (DefaultMutableTreeNode) The error is at the line of foundNodes.add(node);