aws / aws/jsii

Deprecated API element remover does the wrong thing in case of deprecated base class

Open
#3,025 0 comments 0 reactions 0 assignees View on GitHub
bug language/dotnet module/pacmak p1
Dominant language
TypeScript
Stars
2.9k
Forks
267
Avg merge
1d 25m
Merged PRs (30d)
14

Description

## :bug: Bug Report

### Affected Languages
- [ ] `TypeScript` or `Javascript`
- [ ] `Python`
- [ ] `Java`
- [x] .NET (`C#`, `F#`, ...)
- [ ] `Go`

### What is the problem?

The deprecated API element remover generates incorrect code based on the following sources:

```ts
interface ISomeInterface {
someMethod(): void;
}

/** @deprecated */
class SomeBaseClass implements ISomeInterface {
public someMethod() {
console.log('some method');
}
}

class Subclass extends SomeBaseclass {
}
```

### What happens?

`SomeBaseClass` gets completely removed, but the fact that `Subclass implements ISomeInterface` does get propagated (as it should).

End result is that `Subclass` does not have an implementation for `someMethod`, and so in fact DOES NOT end up implementing `ISomeInterface`.

This definitely fails in C#... might affect other languages too. In C# the class ends up like this:

```cs
class Subclass : DeputyBase, ISomeInterface {
//
}
```

And we then get an error that the implementation for `SomeMethod` is missing.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the deprecated base-class example through the deprecated API element remover and inspect how it transforms the generated C# hierarchy. Verify that removing SomeBaseClass preserves the inherited someMethod implementation or otherwise keeps Subclass valid as an ISomeInterface implementation; the issue does not name specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, typescript
Domain
backend-api-design, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.