{"record":{"id":"77060a2ae8a4ddb2","repo":"stanfordnlp/CoreNLP","slug":"method-not-implemented","errorCode":null,"errorMessage":"Method not implemented!","messagePattern":"Method not implemented!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/scenegraph/DcorefPronounResolver.java","lineNumber":40,"sourceCode":" * coreference resolution system.\n *\n * @author Sebastian Schuster\n */\n\npublic class DcorefPronounResolver extends AbstractPronounResolver {\n\n  private StanfordCoreNLP pipeline;\n\n  public DcorefPronounResolver() {\n    Properties props  = new Properties();\n    props.setProperty(\"annotators\", \"parse,ner,lemma,dcoref\");\n    props.setProperty(\"enforceRequirements\", \"false\");\n    pipeline = new StanfordCoreNLP(props);\n  }\n\n  @Override\n  protected HashMap<Integer, Integer> resolvePronouns(SemanticGraph sg) {\n    throw new RuntimeException(\"Method not implemented!\");\n  }\n\n\n  @Override\n  protected HashMap<Integer, Integer> resolvePronouns(List<CoreLabel> tokens) {\n\n    HashMap<Integer, Integer> pronPairs = new HashMap<Integer,Integer>(1);\n\n    CoreMap sentence = new CoreLabel();\n    sentence.set(CoreAnnotations.TokensAnnotation.class, tokens);\n    sentence.set(CoreAnnotations.SentenceIndexAnnotation.class, 1);\n\n    List<CoreMap> sentences = new ArrayList<CoreMap>(1);\n    sentences.add(sentence);\n\n    Annotation annotation = new Annotation(sentences);\n\n    pipeline.annotate(annotation);","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/scenegraph/DcorefPronounResolver.java#L22-L58","documentation":"DcorefPronounResolver.resolvePronouns(SemanticGraph) is an unimplemented overload: it unconditionally throws RuntimeException(\"Method not implemented!\") at src/edu/stanford/nlp/scenegraph/DcorefPronounResolver.java:40. Only the List<CoreLabel> token-based overload is implemented, so callers must not pass a SemanticGraph to this resolver.","triggerScenarios":"Invoking resolvePronouns on a DcorefPronounResolver instance with a SemanticGraph argument — e.g. calling the base-class API with a parsed graph instead of a token list, or framework code dispatching to the SemanticGraph overload.","commonSituations":"Writing scene-graph code that calls the generic PronounResolver interface with a SemanticGraph; copying example code that used the token-list overload but passing a graph from the dependency parser.","solutions":["Convert the SemanticGraph to a List<CoreLabel> (e.g. sg.vertexListSorted()) and call the token-list overload.","Use a different PronounResolver implementation that supports SemanticGraph input.","Add the conversion inside a wrapper method so the unimplemented overload is never invoked."],"exampleFix":"// before\nresolver.resolvePronouns(sg); // throws\n// after\nList<CoreLabel> tokens = sg.vertexListSorted();\nresolver.resolvePronouns(tokens);","handlingStrategy":"type-guard","validationCode":"if (input instanceof SemanticGraph) {\n  input = ((SemanticGraph) input).vertexListSorted(); // convert to List<CoreLabel>\n}","typeGuard":"List<CoreLabel> toTokens(Object graphOrTokens) {\n  if (graphOrTokens instanceof SemanticGraph) return ((SemanticGraph) graphOrTokens).vertexListSorted();\n  return (List<CoreLabel>) graphOrTokens;\n}","tryCatchPattern":"try {\n  return resolver.resolvePronouns(input);\n} catch (RuntimeException e) {\n  if (e.getMessage().contains(\"not implemented\")) return resolver.resolvePronouns(toTokens(input));\n  throw e;\n}","preventionTips":["Read the class Javadoc: DcorefPronounResolver supports only token lists","Route SemanticGraph inputs through a converter before resolving","Prefer the token-list overload in all call sites"],"tags":["java","unimplemented","scenegraph","api-misuse"],"backgroundTag":"method-not-implemented","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}