{"record":{"id":"7fb54ad375bd02e0","repo":"stanfordnlp/CoreNLP","slug":"this-not-implemented-for-arg1-arg1-getclass","errorCode":null,"errorMessage":"THIS not implemented for arg1=${arg1.getClass()}, arg2=${arg2.getClass()}","messagePattern":"THIS not implemented for arg1=(.+?), arg2=(.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/time/SUTime.java","lineNumber":1070,"sourceCode":"      }\n    },\n    // Use arg1 as reference to resolve arg2 (take more general fields from arg1\n    // and apply to arg2)\n    THIS {\n      @Override\n      public Temporal apply(Temporal arg1, Temporal arg2, int flags) {\n        if (arg1 == null) {\n          return new RelativeTime(THIS, arg2, flags);\n        }\n        if (arg1 instanceof Time) {\n          if (arg2 instanceof Duration) {\n            return ((Duration) arg2).toTime((Time) arg1, flags);\n          } else {\n            // TODO: flags?\n            return arg2.resolve((Time) arg1, flags | RESOLVE_TO_THIS);\n          }\n        } else {\n          throw new UnsupportedOperationException(\"THIS not implemented for arg1=\" + arg1.getClass() + \", arg2=\" + arg2.getClass());\n        }\n      }\n    },\n    // (predecessor) Previous week/day/...\n    PREV {\n      @Override\n      public Temporal apply(Temporal arg1, Temporal arg2, int flags) {\n        if (arg2 == null) {\n          return arg1;\n        }\n        Temporal arg2Prev = arg2.prev();\n        if (arg1 == null || arg2Prev == null) {\n          return arg2Prev;\n        }\n        if (arg1 instanceof Time) {\n          // TODO: flags?\n          Temporal resolved = arg2Prev.resolve((Time) arg1, 0 /*RESOLVE_TO_PAST */);\n          return resolved;","sourceCodeStart":1052,"sourceCodeEnd":1088,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/time/SUTime.java#L1052-L1088","documentation":"TemporalOp.THIS ('this week/month') resolves arg2 relative to arg1 taken as the reference Time. When arg1 is not a Time there is no anchoring point, so the operator throws UnsupportedOperationException naming the runtime classes of both arguments.","triggerScenarios":"Calling SUTime.TemporalOp.THIS.apply(arg1, arg2, flags) where arg1 is a Duration/Range instead of a Time — e.g. rules that mis-assign which temporal is the reference.","commonSituations":"Custom SUTime rules for expressions like 'this quarter' where the reference temporal was parsed as a Duration; argument-order mistakes in programmatic use of the TemporalOp enum.","solutions":["Ensure arg1 is a SUTime.Time (convert via toTime()/resolve before apply)","Check the class names in the message to identify the mis-typed argument and fix the rule","Guard with instanceof Time and handle non-Time cases explicitly","Swap arguments if reference and target were accidentally reversed"],"exampleFix":"// before\nTemporalOp.THIS.apply(durationArg, target, flags);\n// after\nTemporalOp.THIS.apply(durationArg.toTime(), target, flags);\n","handlingStrategy":"type-guard","validationCode":"if (!(arg1 instanceof SUTime.Time)) { throw new IllegalArgumentException(\"THIS requires arg1 to be a Time\"); }","typeGuard":"boolean canApplyThis(SUTime.Temporal arg1) { return arg1 instanceof SUTime.Time; }","tryCatchPattern":"try { result = TemporalOp.THIS.apply(arg1, arg2, flags); } catch (UnsupportedOperationException e) { /* convert arg1 to Time and retry */ }","preventionTips":["Verify reference temporal is a Time for THIS/THIS_IMMEDIATE","Unit-test rules producing 'this X' expressions","Convert Durations with toTime() before operator application"],"tags":["java","unsupported-operation","sutime","temporal"],"backgroundTag":"unsupported-operation","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"}