google / google/closure-compiler
Bad protected property warning
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Code:
``` js
// SuperFoo.js
class SuperFoo {
/** @protected */ bar() {}
}
```
``` js
// SubFoo.js
class SubFoo extends SuperFoo {
bar() {}
}
```
Expected: No warning
Actual: Access to protected property bar of SubFoo.prototype not allowed here.
If I add an "override" annotation, the warning goes away.
Repro link:
http://closure-compiler-debugger.appspot.com/#input0%3Dclass%2520SuperFoo%2520%257B%250A%2520%2520%252F**%2520%2540protected%2520*%252F%2520bar()%2520%257B%257D%250A%257D%26input1%3D%250A%250Aclass%2520SubFoo%2520extends%2520SuperFoo%2520%257B%250A%2520%2520bar()%2520%257B%257D%250A%257D%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26CHECK_VISIBILITY%3D1%26CLOSURE_PASS%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRESERVE_TYPE_ANNOTATIONS%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1
Contributor guide
Assessment
This issue has not been assessed yet.